Skip to content

Floating point tutorial: "today (November 2000)" #104479

Description

@pochmann

Documentation

It says:

Almost all machines today (November 2000) use IEEE-754 floating point arithmetic, and almost all platforms map Python floats to IEEE-754 “double precision”. 754 doubles contain 53 bits of precision, [...]

That feels really weird, computer documentation written 22.5 years ago. I don't know what to think of that, whether that can be trusted today. I suggest to update that.

I also suggest to not start the next sentence with "754 doubles" but with "IEEE-754 doubles", both for style (don't start a sentence with a digit) and because it reads like a number of doubles instead of the kind of doubles (i.e., like "3 apples").

@mdickinson

Linked PRs

Activity

  1. mdickinson commented on May 14, 2023

    @mdickinson
    Member

    Agreed that this could use an update. The statement is still true, of course. (If anything, it's even more true today than when it was written, and is likely to remain so for some time, despite the excitement over things like bfloats and posits.)

    How about we just drop the explicit date and the "today"?

    Almost all machines use IEEE 754 floating-point arithmetic, [...]

    It would also be good to mention the "binary64" format explicitly, since that's the particular IEEE 754 interchange format that we care about and IEEE 754 defines various other formats these days (including decimal formats). The standard doesn't use the term "double precision". (I think it's fine to keep it in quotes, since it's a common way to refer to the binary64 format, but it would be good to say "binary64" as well somewhere to avoid ambiguity.)

    And a super-nitpick: "IEEE 754" should not be hyphenated.

  2. rhettinger commented on May 14, 2023

    @rhettinger
    Contributor

    Perhaps instead of "today", use "most machines since 2000" or somesuch. This might convey that this isn't a new state of affairs.

  3. David-Ademola commented on May 14, 2023

    @David-Ademola

    Since November 2000, IEEE-754 floating point arithmetic is utilized by nearly all machines, and Python floats are predominantly mapped to the IEEE-754 "double precision" format across various platforms. Specifically, 754 doubles are capable of retaining 53 bits of precision, thereby facilitating high-precision calculations.

    I feel the above is a better way of writing it. And if you think improvements can be made to it, please do.

  4. ericvsmith commented on May 15, 2023

    @ericvsmith
    Member

    I don't think "November 2000" adds anything. The statement was just as true a year before, or a year after. I guess we could drop the month, but it still seems oddly specific to pick 2000 as the time the statement became true.

  5. David-Ademola commented on May 15, 2023

    @David-Ademola

    Ah, I see, that's true, the month isn't needed.
    And according to Wikipedia, the first standard for floating-point arithmetic, IEEE 754-1985, was published in 1985.
    So would it be more accurate to say, "Since 1985......."

  6. ericvsmith commented on May 15, 2023

    @ericvsmith
    Member

    Only if 1985 is when the statement "IEEE-754 floating point arithmetic is utilized by nearly all machines" became true. I don't think we need to qualify it with a date. It's true now, so let's just leave it at that: no month or year.

  7. David-Ademola commented on May 15, 2023

    @David-Ademola

    Agreed. 🤝🏾

  8. hugovk commented on May 15, 2023

    @hugovk
    Member

    So something like this?

    diff --git a/Doc/tutorial/floatingpoint.rst b/Doc/tutorial/floatingpoint.rst
    index 306b1eba3c..17434486d4 100644
    --- a/Doc/tutorial/floatingpoint.rst
    +++ b/Doc/tutorial/floatingpoint.rst
    @@ -269,8 +269,8 @@ This is the chief reason why Python (or Perl, C, C++, Java, Fortran, and many
     others) often won't display the exact decimal number you expect.
     
     Why is that?  1/10 is not exactly representable as a binary fraction. Almost all
    -machines today (November 2000) use IEEE-754 floating point arithmetic, and
    -almost all platforms map Python floats to IEEE-754 "double precision".  754
    +machines use IEEE 754 floating-point arithmetic, and
    +almost all platforms map Python floats to IEEE 754 "double precision".  IEEE 754
     doubles contain 53 bits of precision, so on input the computer strives to
     convert 0.1 to the closest fraction it can of the form *J*/2**\ *N* where *J* is
     an integer containing exactly 53 bits.  Rewriting ::

    Also nitpicks "floating point arithmetic" -> "floating-point arithmetic".

    This would be a good PR for a new contributor. @David-Ademola, would you like to give it a go?

  9. pochmann commented on May 15, 2023

    @pochmann
    ContributorAuthor

    I agree with Raymond that it's useful to convey that this is "stable", i.e., has been the case for a long time. I agree with Eric that "since 2000" is oddly specific and doubtful (unless there was a sudden vast change that year). My proposal, also fixing the other issues:

    Current:

    Almost all machines today (November 2000) use IEEE-754 floating point arithmetic, and almost all platforms map Python floats to IEEE-754 “double precision”. 754 doubles contain 53 bits of precision, so [...]

    Proposal:

    Almost all machines use IEEE 754 floating point arithmetic, and almost all platforms map Python floats to IEEE 754 “double precision” binary64 (and this has been the case for decades). IEEE 754 binary64 contains 53 bits of precision, so [...]

  10. David-Ademola commented on May 16, 2023

    @David-Ademola

    Sure @hugovk

  11. self-assigned this
    on May 20, 2023
  12. added a commit that references this issue on May 26, 2023
  13. added a commit that references this issue on May 26, 2023
  14. added 3 commits that reference this issue on May 26, 2023
  15. hauntsaninja commented on May 26, 2023

    @hauntsaninja
    Contributor

    Thanks all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

docsDocumentation in the Doc direasy

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions