numpy.finfo() function – Python (original) (raw)
Last Updated : 18 Jun, 2020
numpy.finfo()
function shows machine limits for floating point types.
Syntax : numpy.finfo(dtype)
Parameters :
dtype : [float, dtype, or instance] Kind of floating point data-type about which to get information.
Return : Machine parameters for floating point types.
Code #1 :
import
numpy as geek
gfg
=
geek.finfo(geek.float32)
print
(gfg)
Output :
Machine parameters for float32
precision = 6 resolution = 1.0000000e-06 machep = -23 eps = 1.1920929e-07 negep = -24 epsneg = 5.9604645e-08 minexp = -126 tiny = 1.1754944e-38 maxexp = 128 max = 3.4028235e+38 nexp = 8 min = -max
Code #2 :
import
numpy as geek
gfg
=
geek.finfo(geek.float64)
print
(gfg)
Output :
Machine parameters for float64
precision = 15 resolution = 1.0000000000000001e-15 machep = -52 eps = 2.2204460492503131e-16 negep = -53 epsneg = 1.1102230246251565e-16 minexp = -1022 tiny = 2.2250738585072014e-308 maxexp = 1024 max = 1.7976931348623157e+308 nexp = 11 min = -max
Similar Reads
- numpy.fromstring() function – Python numpy.fromstring() function create a new one-dimensional array initialized from text data in a string. Syntax : numpy.fromstring(string, dtype = float, count = -1, sep = ' ') Parameters : string : [str] A string that contained the data. dtype : [data-type, optional] Data-type of the array. Default d 1 min read
- numpy.i0() function | Python numpy.i0() function is the modified Bessel function of the first kind, order 0. it's usually denoted by I0. Syntax : numpy.i0(x) Parameters : x : [array_like, dtype float or complex] Argument of the Bessel function. Return : [ndarray, shape = x.shape, dtype = x.dtype] The modified Bessel function ev 1 min read
- numpy.fromfunction() function – Python numpy.fromfunction() function construct an array by executing a function over each coordinate and the resulting array, therefore, has a value fn(x, y, z) at coordinate (x, y, z). Syntax : numpy.fromfunction(function, shape, dtype) Parameters : function : [callable] The function is called with N para 2 min read
- numpy.frombuffer() function – Python numpy.frombuffer() function interpret a buffer as a 1-dimensional array. Syntax : numpy.frombuffer(buffer, dtype = float, count = -1, offset = 0) Parameters : buffer : [buffer_like] An object that exposes the buffer interface. dtype : [data-type, optional] Data-type of the returned array, default da 1 min read
- numpy.who function - Python numpy.who() function print the NumPy arrays in the given dictionary. Syntax : numpy.who(vardict = None) Parameters : vardict : [dict, optional] A dictionary possibly containing ndarrays. Return : Returns ‘None’. If there is no dictionary passed in or vardict is None then returns NumPy arrays in the 1 min read
- numpy.fmin() in Python numpy.fmin() function is used to compute element-wise minimum of array elements. This function compare two arrays and returns a new array containing the element-wise minima. If one of the elements being compared is a NaN, then the non-nan element is returned. If both elements are NaNs then the first 2 min read
- numpy.real() function - Python numpy.real() function return the real part of the complex argument. Syntax : numpy.real(arr) Parameters : arr : [array_like] Input array. Return : [ndarray or scalar] The real component of the complex argument. If val is real, the type of val is used for the output. If val has complex elements, the 1 min read
- numpy.iinfo() function – Python numpy.iinfo() function shows machine limits for integer types. Syntax : numpy.iinfo(dtype) Parameters : dtype : [integer type, dtype, or instance] The kind of integer data type to get information about. Return : Machine limits for integer types. Code #1 : # Python program explaining # numpy.iinfo() 1 min read
- numpy.roots() function - Python numpy.roots() function return the roots of a polynomial with coefficients given in p. The values in the rank-1 array p are coefficients of a polynomial. If the length of p is n+1 then the polynomial is described by: p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] Syntax : numpy.roots(p) Parame 1 min read
- dir() function in Python The dir() function is a built-in Python tool used to list the attributes (like methods, variables, etc.) of an object. It helps inspect modules, classes, functions, and even user-defined objects during development and debugging. Syntaxdir([object]) Parameters: object (optional): Any Python object (l 3 min read