Skip to content

Fix i_to_f test - #1324

Merged
beetrees merged 1 commit into
rust-lang:mainfrom
beetrees:fix-i-to-f-test
Sep 29, 2026
Merged

beetrees merged 1 commit into
rust-lang:mainfrom
beetrees:fix-i-to-f-test

Conversation

@beetrees

@beetrees beetrees commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

When casting from fN to iX, fN::{,NEG_}INFINITY always saturates to to [iu]X::{MAX,MIN}, which can sometimes be further away from the original integer that was casted to fN than the next closest value to zero, fN::{MAX,MIN}. This PR fixes the test by manually calculating the integer value that is 1 ULP above/below fN::{MAX,MIN}, therefore allowing the test to pass in this case.

cc #729

r? @tgross35

@beetrees
beetrees force-pushed the fix-i-to-f-test branch 2 times, most recently from 9965ec2 to c345777 Compare September 22, 2026 17:35
@beetrees

Copy link
Copy Markdown
Contributor Author

Test failures appear unrelated

@tgross35 tgross35 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One request then LGTM. Please put the PR description into the commit message before merging.

View changes since this review

Comment thread libm/src/math/support/float_traits.rs
When casting from `fN` to `iX`, `fN::{,NEG_}INFINITY` always saturates to to `[iu]X::{MAX,MIN}`, which can sometimes be further away from the original integer that was casted to `fN` than the next closest value to zero, `fN::{MAX,MIN}`. This PR fixes the test by manually calculating the integer value that is 1 ULP above/below `fN::{MAX,MIN}`, therefore allowing the test to pass in this case.
@rustbot

rustbot commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@beetrees
beetrees enabled auto-merge (rebase) September 29, 2026 10:51
@beetrees
beetrees merged commit a141d3f into rust-lang:main Sep 29, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants