-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Floating point tutorial: "today (November 2000)" #104479
Comments
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"?
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. |
Perhaps instead of "today", use "most machines since 2000" or somesuch. This might convey that this isn't a new state of affairs. |
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. |
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. |
Ah, I see, that's true, the month isn't needed. |
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. |
Agreed. 🤝🏾 |
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? |
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:
Proposal:
|
Sure @hugovk |
…ythonGH-104681) (cherry picked from commit 2cf04e4) Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
…ence (pythonGH-104681). (cherry picked from commit 2cf04e4) Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Thanks all! |
Documentation
It says:
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
The text was updated successfully, but these errors were encountered: