Skip to content

Document rounding for floating-point primitive operations and string parsing #96129

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

Merged
merged 2 commits into from
May 23, 2022

Conversation

mattheww
Copy link
Contributor

The docs for floating point don't have much to say at present about either the precision of their results or rounding behaviour.

As I understand it12, Rust doesn't support operating with non-default rounding directions, so we need only describe roundTiesToEven.

This PR makes a start by documenting that for primitive operations and from_str().

Footnotes

  1. https://github.com/rust-lang/rust/issues/41753#issuecomment-299322887

  2. https://github.com/llvm/llvm-project/issues/8472#issuecomment-980888781

State that the four primitive operations honour IEEE 754 roundTiesToEven.

Documenting under "Primitive Type f32"; f64 refers to that.
@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Apr 16, 2022
@rust-highfive
Copy link
Contributor

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with r? rust-lang/libs-api @rustbot label +T-libs-api -T-libs to request review from a libs-api team reviewer. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @scottmcm (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 16, 2022
@mattheww
Copy link
Contributor Author

r? rust-lang/libs-api @rustbot label +T-libs-api -T-libs

@rust-highfive rust-highfive assigned m-ou-se and unassigned scottmcm Apr 16, 2022
@rustbot rustbot added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 16, 2022
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 22, 2022
@Dylan-DPC
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 23, 2022

📌 Commit 16c81fa has been approved by Dylan-DPC

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 23, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request May 23, 2022
Rollup of 4 pull requests

Successful merges:

 - rust-lang#96129 (Document rounding for floating-point primitive operations and string parsing)
 - rust-lang#97286 (Add new eslint rule to prevent whitespace before function call paren)
 - rust-lang#97292 (Lifetime variance fixes for rustc)
 - rust-lang#97309 (Add some regression tests for rust-lang#90400)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 98a8035 into rust-lang:master May 23, 2022
@rustbot rustbot added this to the 1.63.0 milestone May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants