NumPy Data type: MachAr() function
numpy.MachAr() function
The MachAr() function is used to inspect type precision limits.
Version: 1.15.0
Syntax:
numpy.MachAr(float_conv=<class 'float'>, int_conv=<class 'int'>, float_to_float=<class 'float'>, float_to_str=<function MachAr.<lambda>>, title='Python floating point number')
Parameter:
Name | Description | Required / Optional |
---|---|---|
float_conv | Function that converts an integer or integer array to a float or float array. Default is float. | Optional |
int_conv | Function that converts a float or float array to an integer or integer array. Default is int. | Optional |
float_to_float | Function that converts a float array to float. Default is float. Note that this does not seem to do anything useful in the current implementation. | Optional |
float_to_str | Function that converts a single float to a string. Default is lambda v:'%24.16e' %v. | Optional |
title | Title that is printed in the string representation of MachAr. | Optional |
Example: numpy.MachAr() function
>>> import numpy as np
>>> machar = numpy.MachAr(float_conv=numpy.float32)
>>> print(machar)
Machine parameters for Python floating point number
---------------------------------------------------------------------
ibeta=2 it=23 iexp=8 ngrd=0 irnd=5
machep=-23 eps= 1.1920928955078125e-07 (beta**machep == epsilon)
negep =-24 epsneg= 5.9604644775390625e-08 (beta**epsneg)
minexp=-126 xmin= 1.1754943508222875e-38 (beta**minexp == tiny)
maxexp=128 xmax= 3.4028234663852886e+38 ((1-epsneg)*beta**maxexp == huge)
---------------------------------------------------------------------
Python - NumPy Code Editor:
Previous:
iinfo()
Next:
Data type testing issctype()
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/numpy/data-type-routines/machar.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics