Floating point minimum and maximum exponent values

Serhiy Storchaka storchaka at gmail.com
Tue Jul 16 19:21:30 CEST 2013


16.07.13 15:04, Chris Angelico написав(ла):
> Piece of extreme oddity, this.
>
>>>> help(sys.float_info)
> ... lots of other info ...
>   |  max_exp
>   |      DBL_MAX_EXP -- maximum int e such that radix**(e-1) is representable
>   |
>   |  min_exp
>   |      DBL_MIN_EXP -- minimum int e such that radix**(e-1) is a
> normalized float
> ...
>
> So it's technically correct. Followup question: Why is it off by one?

sys.float_info.max == sys.float_info.radix**sys.float_info.max_exp - 
sys.float_info.radix**(sys.float_info.max_exp-sys.float_info.mant_dig)





More information about the Python-list mailing list