numpy.finfo()函數顯示浮點類型的機器限製。
用法: numpy.finfo(dtype)
參數:
dtype:[float,dtype或instance]要獲取有關其信息的浮點數據類型的種類。
返回:浮點類型的機器參數。
代碼1:
# Python program explaining
# numpy.finfo() function
# importing numpy as geek
import numpy as geek
gfg = geek.finfo(geek.float32)
print (gfg)
輸出:
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 ---------------------------------------------------------------
代碼2:
# Python program explaining
# numpy.finfo() function
# importing numpy as geek
import numpy as geek
gfg = geek.finfo(geek.float64)
print (gfg)
輸出:
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 ---------------------------------------------------------------
相關用法
- Python Wand function()用法及代碼示例
- Python cmp()用法及代碼示例
- Python dir()用法及代碼示例
- Python oct()用法及代碼示例
- Python tell()用法及代碼示例
- Python int()用法及代碼示例
- Python map()用法及代碼示例
- Python str()用法及代碼示例
- Python id()用法及代碼示例
- Python sum()用法及代碼示例
- Python now()用法及代碼示例
- Python hex()用法及代碼示例
- Python ord()用法及代碼示例
- Python numpy.ix_()用法及代碼示例
- Python ldexp()用法及代碼示例
- Python turtle.dot()用法及代碼示例
注:本文由純淨天空篩選整理自sanjoy_62大神的英文原創作品 numpy.finfo() function – Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。