[SciPy-dev] numpy.float128 absence yield bugs

Robert Kern robert.kern@gmail....
Mon Mar 10 12:44:52 CDT 2008

On Mon, Mar 10, 2008 at 12:37 PM, dmitrey <dmitrey.kroshko@scipy.org> wrote:
> As for numpy.longdouble (and related types if they are intended to be
>  implemented), I suppose numpy also should have a function to return
>  number of bites used (128, 96, 64 etc).

In [6]: numpy.dtype(numpy.longdouble).itemsize
Out[6]: 16

>  Ok. Another one question: does numpy have function(s), that accepts a
>  numpy type (float32, float64, uint16 etc) and yields: max value (like
>  1e300); min value (like -1e300); min positive value (for floats) like
>  1e-300?

In [7]: i = numpy.finfo(numpy.longdouble)

In [8]: i.
i.__class__         i.__module__        i.__weakref__
i._str_tiny         i.max               i.precision
i.__delattr__       i.__new__           i._finfo_cache      i.dtype
         i.maxexp            i.resolution
i.__dict__          i.__reduce__        i._init             i.eps
         i.min               i.tiny
i.__doc__           i.__reduce_ex__     i._str_eps          i.epsneg
i.__getattribute__  i.__repr__          i._str_epsneg       i.iexp
i.__hash__          i.__setattr__       i._str_max          i.machar
i.__init__          i.__str__           i._str_resolution   i.machep

In [8]: i.min
Out[8]: -1.189731495357231765021e+4932

In [9]: i.max
Out[9]: 1.189731495357231765021e+4932

In [10]: i.tiny
Out[10]: array(3.362103143112093506263e-4932, dtype=float128)

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco

More information about the Scipy-dev mailing list