Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-85988: Change documentation for sys.float_info.rounds#99675

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

tbwolfe
Copy link
Contributor

@tbwolfetbwolfe commentedNov 22, 2022
edited by bedevere-bot
Loading

Change the documentation for sys.float_info.rounds to remove references to C99 section 5.2.4.2.2 and instead place the available values inline.

Change the documentation for sys.float_info.rounds to removereferences to C99 section 5.2.4.2.2 and instead place theavailable values inline.
Newlines were not preserved in generated HTML on previouscommit. I have changes the list to a comma-separated listof values and their meanings.
…cpython into float-info-rounds-documentationMerge upstream branch into local topic branch
@mdickinson
Copy link
Member

Thanks for the PR. A couple of comments:

We should keep the "This reflects the value of the system FLT_ROUNDS macro at interpreter startup time" text: there's important information there. In C,FLT_ROUNDS is the onefloat.h value that's not necessarily constant, potentially reflecting the current rounding mode. But Python's value is constant, and won't change if the rounding mode is changed dynamically. (With hindsight, I suspect thatsys.float_info.rounds isn't all that useful, and would have been better left out of the struct - it's the only piece of information that relates to the semantics of operations rather than simply to the storage format. But it's too late to change that now.)

The "for floating-point addition" language seems curiously specific (yes, I know it comes directly from the standard). I'd expect the rounding mode to apply to all arithmetic operations (possibly excludingsqrt); not just addition. The C++ standard appears to use the language "floating-point arithmetic operations" instead.

Clarify the source of the FLT_ROUNDS value andchange 'floating-point addition' to 'floating-pointarithmetic' to indicate that the rounding modeapplies to all arithmetic operations.
@tbwolfe
Copy link
ContributorAuthor

Thank you for the feedback,@mdickinson ! I have made a few changes to address your points.

Just let me know if you see anything that I might have overlooked, and I'll be glad to sort it out.

Copy link
Member

@mdickinsonmdickinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM too. Thanks!

@mdickinsonmdickinson merged commit6562939 intopython:mainNov 27, 2022
hugovk pushed a commit to hugovk/cpython that referenced this pull requestFeb 28, 2023
…nGH-99675)* Change documentation for sys.float_info.roundsChange the documentation for sys.float_info.rounds to removereferences to C99 section 5.2.4.2.2 and instead place theavailable values inline.* Correction to previous documentation changeNewlines were not preserved in generated HTML on previouscommit. I have changes the list to a comma-separated listof values and their meanings.* Clarify source for value of FLT_ROUNDSClarify the source of the FLT_ROUNDS value andchange 'floating-point addition' to 'floating-pointarithmetic' to indicate that the rounding modeapplies to all arithmetic operations.
hugovk pushed a commit to hugovk/cpython that referenced this pull requestFeb 28, 2023
…nGH-99675)* Change documentation for sys.float_info.roundsChange the documentation for sys.float_info.rounds to removereferences to C99 section 5.2.4.2.2 and instead place theavailable values inline.* Correction to previous documentation changeNewlines were not preserved in generated HTML on previouscommit. I have changes the list to a comma-separated listof values and their meanings.* Clarify source for value of FLT_ROUNDSClarify the source of the FLT_ROUNDS value andchange 'floating-point addition' to 'floating-pointarithmetic' to indicate that the rounding modeapplies to all arithmetic operations.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mdickinsonmdickinsonmdickinson approved these changes

@rhettingerrhettingerrhettinger approved these changes

Assignees
No one assigned
Labels
docsDocumentation in the Doc dirskip news
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@tbwolfe@mdickinson@rhettinger@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp