I need to find a numpy.float64
value that is as close to zero as possible.
Numpy offers several constants that allow to do something similar:
np.finfo(np.float64).eps = 2.2204460492503131e-16
np.finfo(np.float64).tiny = 2.2250738585072014e-308
These are both reasonably small, but when I do this
>>> x = np.finfo(np.float64).tiny
>>> x / 2
6.9533558078350043e-310
the result is even smaller. When using an impromptu binary search I can get down to about 1e-323
, before the value is rounded down to 0.0
.
Is there a constant for this in numpy that I am missing? Alternatively, is there a right way to do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…