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


Groups > comp.lang.python > #29676

Re: Exact integer-valued floats

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

Show all headers | View raw


On 21 Sep 2012 17:29:13 GMT, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> declaimed the following in
gmane.comp.python.general:

> 
> The question is, what is the largest integer number N such that every 
> whole number between -N and N inclusive can be represented as a float?
>
	Single precision commonly has 7 significant (decimal) digits. Double
precision runs somewhere between 13 and 15 (decimal) significant digits 

> If my tests are correct, that value is 9007199254740992.0 = 2**53.
>

	For an encoding of a double precision using one sign bit and an
8-bit exponent, you have 53 bits available for the mantissa. 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). 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...


-- 
	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