Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '16,': 0.03; 'one?': 0.05; 'correct.': 0.07; 'float': 0.07; 'exp': 0.09; 'expecting': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'infinity': 0.16; 'marco': 0.16; 'nan': 0.16; 'subject:values': 0.16; 'zero,': 0.16; 'wrote:': 0.18; 'all,': 0.19; '>>>': 0.22; '(in': 0.22; 'skip:e 30': 0.24; 'values': 0.27; 'header:In-Reply- To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'piece': 0.31; 'question:': 0.31; 'this.': 0.32; 'info': 0.35; 'received:google.com': 0.35; 'combination': 0.36; 'minimum': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'reserved': 0.61; 'such': 0.63; 'maximum': 0.63; 'jul': 0.74; 'technically': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=FyETb1tWJSH5dKqbbhDV7Sdsi/7KHoJupZV7IBFgV4k=; b=wvxOs/IWSiUudsbweXhJjlFLDY2YBiLCmG0lTcw0ns5WA+UgAzAJxMKGYpmsQjuiwW H9EaRrCukn0w72x8zuS5dwu9bmJJqDMxfRKOjfk33MasmHssnIVHmdqE5RSfgDLf04+7 Hx/wdmu5a18G89IiFB16IGiN3T83i2CW/yOX3zKE2oOhQocqh1G0VeXhgDIvpRJMmZP7 gSpDU3GADHOMPw9IjkdbQxWsrgrqVbRCtnWS5DJJERcC6GrBkhvwERm/IjfA/J4l9d/P mF+yEjtRG9O+QCFENqGJ7iJ4U7B0VCdoKyM4rp/e3IUvycXXjSvdn2nOGcJ9+I/GC2JB UviA== MIME-Version: 1.0 X-Received: by 10.52.93.106 with SMTP id ct10mr272815vdb.83.1373976265711; Tue, 16 Jul 2013 05:04:25 -0700 (PDT) In-Reply-To: References: Date: Tue, 16 Jul 2013 22:04:25 +1000 Subject: Re: Floating point minimum and maximum exponent values From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1373976274 news.xs4all.nl 15916 [2001:888:2000:d::a6]:57606 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50740 On Tue, Jul 16, 2013 at 9:43 PM, Marco 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