finfo

paddle. finfo ( dtype ) [source]

paddle.finfo is a function that returns an object that represents the numerical properties of a floating point paddle.dtype. This is similar to numpy.finfo.

Parameters

dtype (paddle.dtype|string) – One of paddle.float16, paddle.float32, paddle.float64, paddle.bfloat16, paddle.complex64, and paddle.complex128.

Returns

  • min(double): The smallest representable number (typically -max).

  • max(double): The largest representable number.

  • eps(double): The smallest representable number such that 1.0 + eps ≠ 1.0.

  • resolution(double): The approximate decimal resolution of this type, i.e., 10**-precision.

  • smallest_normal(double): The smallest positive normal number.

  • tiny(double): The smallest positive normal number. Equivalent to smallest_normal.

  • bits(int): The number of bits occupied by the type.

  • dtype(str): The string name of the argument dtype.

Return type

An finfo object, which has the following 8 attributes

Examples

>>> import paddle

>>> finfo_float32 = paddle.finfo(paddle.float32)
>>> print(finfo_float32.min)
-3.4028234663852886e+38
>>> print(finfo_float32.max)
3.4028234663852886e+38
>>> print(finfo_float32.eps)
1.1920928955078125e-07
>>> print(finfo_float32.resolution)
1e-06
>>> print(finfo_float32.smallest_normal)
1.1754943508222875e-38
>>> print(finfo_float32.tiny)
1.1754943508222875e-38
>>> print(finfo_float32.bits)
32
>>> print(finfo_float32.dtype)
float32