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


Groups > comp.lang.python > #29702

Re: Exact integer-valued floats

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Exact integer-valued floats
Date 2012-09-21 20:54 -0400
Organization > Bestiaria Support Staff <
References <505ca3e9$0$29981$c3e8da3$5496439d@news.astraweb.com> <mailman.1036.1348259186.27098.python-list@python.org> <505cd64e$0$6958$e4fe514c@news2.news.xs4all.nl>
Newsgroups comp.lang.python
Message-ID <mailman.1052.1348275254.27098.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, 21 Sep 2012 23:04:14 +0200, Hans Mulder <hansmu@xs4all.nl>
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/

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


Thread

Exact integer-valued floats Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-21 17:29 +0000
  Re: Exact integer-valued floats Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-21 12:13 -0600
  Re: Exact integer-valued floats Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2012-09-21 22:47 +0300
  Re: Exact integer-valued floats Nobody <nobody@nowhere.com> - 2012-09-21 20:59 +0100
  Re: Exact integer-valued floats Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-21 16:26 -0400
    Re: Exact integer-valued floats Hans Mulder <hansmu@xs4all.nl> - 2012-09-21 23:04 +0200
      Re: Exact integer-valued floats Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-21 20:54 -0400
  Re: Exact integer-valued floats Alister <alister.ware@ntlworld.com> - 2012-09-21 21:14 +0000
  Re: Exact integer-valued floats Paul Rubin <no.email@nospam.invalid> - 2012-09-21 15:23 -0700
    Re: Exact integer-valued floats Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-22 01:36 +0000
      Re: Exact integer-valued floats Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-22 01:01 -0400
        Re: Exact integer-valued floats Tim Roberts <timr@probo.com> - 2012-09-22 14:05 -0700
          Re: Exact integer-valued floats Dave Angel <d@davea.name> - 2012-09-22 19:06 -0400
            Re: Exact integer-valued floats Hans Mulder <hansmu@xs4all.nl> - 2012-09-23 09:45 +0200
          Re: Exact integer-valued floats wrw@mac.com - 2012-09-24 11:29 -0400
    Re: Exact integer-valued floats Nobody <nobody@nowhere.com> - 2012-09-22 11:19 +0100

csiph-web