-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
bpo-45584: Clarify the meaning of truncate
in documentation
#29183
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a math expert but the change makes sense to me!
Doc/library/math.rst
Outdated
:class:`~numbers.Integral` (usually an integer). Delegates to | ||
:meth:`x.__trunc__() <object.__trunc__>`. | ||
:class:`~numbers.Integral` (usually an integer). Truncating *x* means | ||
removing the digits after the decimal comma, hence rounding toward 0. It is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since not all locales use a comma:
removing the digits after the decimal comma, hence rounding toward 0. It is | |
removing the digits after the decimal separator, hence rounding toward 0. It is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
I didn't realize that the English doc had to be normalized. I admit that if I were to translate it to French (my mother tongue), I clearly would have used "dot". But I guess it's great this way, thanks!
Not a math expert but the change makes sense to me!
Great! That's the point. That the doc is easy to get even without being a math expert. At least in my opinion.
aab6de7
to
93db851
Compare
While floor/ceil 's documentation are very precise, `truncate` was not explained. I actually had to search online to understand the difference between `truncate` and `floor` (admittedly, once I remembered that numbers are signed, and that floating numbers actually uses a bit for negation symbol instead of two complement, it became obvious) I assume that I won't be the only user having this trouble, especially for people whose mother tongue is not English. So I suggest adding a clarification to help make what should be obvious to most actually explicit
93db851
to
e0a173d
Compare
For future PRs to CPython repositories, please avoid using rebases and force pushes: https://devguide.python.org/pullrequest/#quick-guide |
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Azure pipelines PR fail at Pre-build check stating
I assume it's unrelated to the current PR. What should I do here? |
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be put in the comfy chair! |
Azure Pipelines PR tests are currently not working, so that failure can be ignored. In essence, all checks are currently passing. |
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
I have made the requested changes; please review again. I tested ceil and floor, they both link as expected. Do you believe it would make sens to try to go over the whole |
Thanks for making the requested changes! @terryjreedy, @merwok: please review the changes made to this pull request. |
This commit is the first commit of what I plan to be a sequence of commit whose goal is to improve the documentation usability. It's goal is to be an example, concentrated on ``__name__``, that will allow me to get feedback and show my goals before working on other missing references. Whatever the place in the documentation, it may always save a little bit of time that references are clicable. This allows the reader to easily get more information if needed. My goal is to go through the part of the documentation in /Doc and ensure that as many method, variable, members, functions, classes... becomes links. Actually, I got the idea from PR python#29183, where terryjreedy asked me to add a link to a method in a part of the documentation my PR was touching. I believe the idea was good and should be systematized. Since this may be a big change, here are the steps to ensure that it gets easy to review: * each commit consider a single word. In this case ``__name__``, so the commit is really easy (even if boring) to review * only the lines containing the changed words are changed. No other reformating occurs. This allow any diff tool to really easily show that no other differences are introduced. The downside is that some lines are now longer than 80 characters. However, I should note that this constraint was already not respected in a lot of place of the documentation. And until there is an automated formatting tool, I think the cost is quite small compared to the improvement in the documentation usability. If those 80 characters are considered a blocker, it would be easy to reformat all lines in a last commit, once the link creations are done.
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
@terryjreedy your suggestions were addressed, are you OK with merging this now?
Please go ahead. |
Thanks @Arthur-Milchior for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10. |
Sorry @Arthur-Milchior and @JelleZijlstra, I had trouble checking out the |
GH-32272 is a backport of this pull request to the 3.9 branch. |
Thanks @Arthur-Milchior for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10. |
GH-32273 is a backport of this pull request to the 3.10 branch. |
While floor/ceil 's documentation are very precise, `truncate` was not explained. I actually had to search online to understand the difference between `truncate` and `floor` (admittedly, once I remembered that numbers are signed, and that floating numbers actually uses a bit for negation symbol instead of two complement, it became obvious) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Éric Araujo <merwok@netwok.org> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit ebbdbbf) Co-authored-by: Arthur Milchior <arthur@milchior.fr>
While floor/ceil 's documentation are very precise, `truncate` was not explained. I actually had to search online to understand the difference between `truncate` and `floor` (admittedly, once I remembered that numbers are signed, and that floating numbers actually uses a bit for negation symbol instead of two complement, it became obvious) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Éric Araujo <merwok@netwok.org> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit ebbdbbf) Co-authored-by: Arthur Milchior <arthur@milchior.fr>
While floor/ceil 's documentation are very precise, `truncate` was not explained. I actually had to search online to understand the difference between `truncate` and `floor` (admittedly, once I remembered that numbers are signed, and that floating numbers actually uses a bit for negation symbol instead of two complement, it became obvious) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Éric Araujo <merwok@netwok.org> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit ebbdbbf) Co-authored-by: Arthur Milchior <arthur@milchior.fr>
While floor/ceil 's documentation are very precise, `truncate` was not explained. I actually had to search online to understand the difference between `truncate` and `floor` (admittedly, once I remembered that numbers are signed, and that floating numbers actually uses a bit for negation symbol instead of two complement, it became obvious) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Éric Araujo <merwok@netwok.org> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit ebbdbbf) Co-authored-by: Arthur Milchior <arthur@milchior.fr>
bpo-45584: Clarify the meaning of
truncate
in documentationWhile floor/ceil 's documentation are very precise,
truncate
was not explained. I actually had to search online to understand the difference betweentruncate
andfloor
(admittedly, once I remembered that numbers are signed, and that floating numbers actually uses a bit for negation symbol instead of two complement, it became obvious)I assume that I won't be the only user having this trouble, especially for people whose mother tongue is not English. So I suggest adding a clarification to help make what should be obvious to most actually explicit
https://bugs.python.org/issue45584