Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50739 > unrolled thread
| Started by | Marco <m.b@gmail.com> |
|---|---|
| First post | 2013-07-16 13:43 +0200 |
| Last post | 2013-07-16 20:21 +0300 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.python
Floating point minimum and maximum exponent values Marco <m.b@gmail.com> - 2013-07-16 13:43 +0200
Re: Floating point minimum and maximum exponent values Chris Angelico <rosuav@gmail.com> - 2013-07-16 22:04 +1000
Re: Floating point minimum and maximum exponent values Christian Heimes <christian@python.org> - 2013-07-16 14:46 +0200
Re: Floating point minimum and maximum exponent values Serhiy Storchaka <storchaka@gmail.com> - 2013-07-16 20:21 +0300
| From | Marco <m.b@gmail.com> |
|---|---|
| Date | 2013-07-16 13:43 +0200 |
| Subject | Floating point minimum and maximum exponent values |
| Message-ID | <ks3bl6$g8o$1@speranza.aioe.org> |
Hi all, why the maximum and minimum exp values are 1024 and -1021?: >>> sys.float_info sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1) The values (in double precision) 0 and 2047 are reserved for zero, infinity and NaN (in combination with the fraction), so I was expecting -1022 and 1023... -- Marco Buttu
[toc] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-07-16 22:04 +1000 |
| Message-ID | <mailman.4768.1373976274.3114.python-list@python.org> |
| In reply to | #50739 |
On Tue, Jul 16, 2013 at 9:43 PM, Marco <m.b@gmail.com> wrote: > Hi all, why the maximum and minimum exp values are 1024 and -1021?: > >>>> sys.float_info > sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, > min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, > mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1) > > The values (in double precision) 0 and 2047 are reserved for zero, infinity > and NaN (in combination with the fraction), so I was expecting -1022 and > 1023... 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? ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Christian Heimes <christian@python.org> |
|---|---|
| Date | 2013-07-16 14:46 +0200 |
| Message-ID | <mailman.4770.1373978811.3114.python-list@python.org> |
| In reply to | #50739 |
Am 16.07.2013 14:04, schrieb 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? Because float.h defines DBL_MAX_EXP like that. Why? I can't tell, too.
[toc] | [prev] | [next] | [standalone]
| From | Serhiy Storchaka <storchaka@gmail.com> |
|---|---|
| Date | 2013-07-16 20:21 +0300 |
| Message-ID | <mailman.4776.1373995308.3114.python-list@python.org> |
| In reply to | #50739 |
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)
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web