Newsgroups: comp.lang.python
From: Nobody <nob...@nowhere.com>
Date: Fri, 21 Sep 2012 20:59:16 +0100
Local: Fri, Sep 21 2012 3:59 pm
Subject: Re: Exact integer-valued floats
On Fri, 21 Sep 2012 17:29:13 +0000, Steven D'Aprano wrote:
CPython's "float" type uses C's "double". For a system where C's "double"
> 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? > If my tests are correct, that value is 9007199254740992.0 = 2**53.
> Have I got this right? Is there a way to work out the gap between one
is IEEE-754 double precision, N=2**53 is the correct answer. An IEEE-754 double precision value consists of a 53-bit integer whose
http://en.wikipedia.org/wiki/IEEE_754-1985
The largest 53-bit integer is 2**53-1. 2**53 can be represented as
For values x where 2**52 <= x < 2**53, the the interval between
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||