Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'bits': 0.07; 'bits.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'sep': 0.09; 'encoding': 0.15; '8-bit': 0.16; 'bits,': 0.16; 'ignores': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'sign,': 0.16; 'wrote:': 0.17; 'bit': 0.21; 'affected': 0.22; 'machine': 0.24; 'possibility': 0.27; 'then.': 0.27; 'header:X -Complaints-To:1': 0.28; 'arithmetic': 0.29; 'decimal': 0.29; 'implied': 0.29; 'fri,': 0.30; 'could': 0.32; '+0200,': 0.33; 'shift': 0.33; 'url:home': 0.33; 'to:addr:python-list': 0.33; 'machines': 0.35; 'doing': 0.35; 'something': 0.35; 'received:org': 0.36; 'too': 0.36; 'charset:us-ascii': 0.36; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'subject:-': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'remove': 0.61; 'leading': 0.61; "you'll": 0.62; 'leaving': 0.62; 'more': 0.63; 'power': 0.74; 'dennis': 0.91; 'received:108': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Exact integer-valued floats Date: Fri, 21 Sep 2012 20:54:10 -0400 Organization: > Bestiaria Support Staff < References: <505ca3e9$0$29981$c3e8da3$5496439d@news.astraweb.com> <505cd64e$0$6958$e4fe514c@news2.news.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-79-219-15.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES 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: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348275254 news.xs4all.nl 6874 [2001:888:2000:d::a6]:33460 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29702 On Fri, 21 Sep 2012 23:04:14 +0200, Hans Mulder declaimed the following in gmane.comp.python.general: > On 21/09/12 22:26:26, Dennis Lee Bieber wrote: > > > For an encoding of a double precision using one sign bit and an > > 8-bit exponent, you have 53 bits available for the mantissa. > > If your floats have 64 bits, and you use 1 bit for the sign and 8 for > the exponent, you'll have 55 bits available for the mantissa. > Mea Culpa -- doing mental arithmetic too fast > > This > > ignores the possibility of an implied msb in the mantissa (encodings > > which normalize to put the leading 1-bit at the msb can on some machines > > remove that 1-bit and shift the mantissa one more place; effectively > > giving a 54-bit mantissa). > > My machine has 64-bits floats, using 1 bit for the sign, 11 for the > exponent, leaving 52 for the mantissa. The mantissa has an implied > leading 1, so it's nominally 53 bits. > > You can find this number in sys.float_info.mant_dig > > > Something like an old XDS Sigma-6 used > > non-binary exponents (exponent was in power of 16 <> 2^4) and used > > "non-normalized" mantissa -- the mantissa could have up to three leading > > 0-bits); this affected the decimal significance... > > Your Sigma-6 must have sys.float_info.radix == 16 then. > > > Hope this helps, > > -- HansM -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/