Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #50740

Re: Floating point minimum and maximum exponent values

References <ks3bl6$g8o$1@speranza.aioe.org>
Date 2013-07-16 22:04 +1000
Subject Re: Floating point minimum and maximum exponent values
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.4768.1373976274.3114.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web