[Numpy-discussion] Epsilon for each dtype

Fabrice Silva silva@lma.cnrs-mrs...
Mon Dec 10 05:16:39 CST 2007


Le lundi 10 décembre 2007 à 11:38 +0100, Matthieu Brucher a écrit :
> Hi,
> Is there somewhere a equivalent to std::numerical_limits<>::epsilon,
> that is, the greatest value such that 1. + epsilon is numerically
> equal to 1. ?
> I saw something that could be related in oldnumeric, but nothing in
> numpy itself. 

if X is a numpy object:
numpy.finfo(type(X)).eps gives the epsilon of the type of X.
You may look at other attributes of finfo too..

-- 
Fabrice Silva <silva@lma.cnrs-mrs.fr>
LMA UPR CNRS 7051



More information about the Numpy-discussion mailing list