Skip to content

Conversation

@xonx4l
Copy link
Contributor

@xonx4l xonx4l commented Oct 28, 2025

In this PR Float tests are deduplicated and are unified in floats/mod.rs, as discussed in #141726.

The moved float tests are:

-> test_powf
-> test_exp
-> test_exp2
-> test_ln
-> test_log_generic
-> test_log2
-> test_log10
-> test_asinh
-> test_acosh
-> test_atanh
-> test_gamma
-> test_ln_gamma

Closes: #141726

r? tgross35

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 28, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 28, 2025

tgross35 is currently at their maximum review capacity.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@xonx4l xonx4l requested a review from bjorn3 November 4, 2025 00:43
@xonx4l
Copy link
Contributor Author

xonx4l commented Nov 11, 2025

Any update @bjorn3 ?

@bjorn3
Copy link
Member

bjorn3 commented Nov 11, 2025

CI is still failing.

@xonx4l
Copy link
Contributor Author

xonx4l commented Nov 11, 2025

CI is still failing.

ok let me fix .

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Nov 14, 2025

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@xonx4l xonx4l force-pushed the deduplicate-float-tests branch from b802b19 to abd73fd Compare November 14, 2025 08:43
@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

let inf: Float = Float::INFINITY;
let neg_inf: Float = Float::NEG_INFINITY;
assert_biteq!((10.0 as Float).log(10.0), 1.0);
assert_approx_eq!((2.3 as Float).log(3.5), 0.664858, Float::LOG_APPROX);
Copy link
Contributor

@LorrensP-2158466 LorrensP-2158466 Nov 17, 2025

Choose a reason for hiding this comment

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

This test here for f128 will fail because the precision is much higher, if you look at the original test, the expected value is much more precise than what you have written:

assert_approx_eq!(2.3f128.log(3.5), 0.66485771361478710036766645911922010272, TOL);

When testing higher precision floats, you need much more precise expected values or the tests will fail, as they do now. In Miri, this is even more strict.

If you look at the source of f16 constants, they use much more digits after the decimal point than needed:

pub const PI: f16 = 3.14159265358979323846264338327950288_f16;

So you should probably do that as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay it makes sense . Thanks

@tgross35
Copy link
Contributor

Thank you for the final cleanup here. Until CI is fixed,
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 19, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 19, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@xonx4l
Copy link
Contributor Author

xonx4l commented Nov 19, 2025

Thank you for the final cleanup here. Until CI is fixed, @rustbot author

Will finish this as soon as possible . A bit busy these days.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@xonx4l xonx4l force-pushed the deduplicate-float-tests branch from 0f27f23 to 507fb72 Compare December 23, 2025 17:59
rust-bors bot pushed a commit that referenced this pull request Jan 22, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #148206 (Deduplicated float tests and unified in floats/mod.rs)
 - #151042 (fix fallback impl for select_unpredictable intrinsic)
 - #151220 (option: Use Option::map in Option::cloned)
 - #151260 (Handle unevaluated ConstKind in in_operand)
 - #151441 (Fix ICE: Don't try to evaluate type_consts when eagerly collecting items)
 - #151465 (codegen: clarify some variable names around function calls)
 - #151469 (llvm: Tolerate dead_on_return attribute changes)
 - #151476 (Avoid `-> ()` in derived functions.)

r? @ghost
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 22, 2026

⌛ Testing commit 6ac8ff7 with merge e822724...

Workflow: https://github.com/rust-lang/rust/actions/runs/21248296883

rust-bors bot pushed a commit that referenced this pull request Jan 22, 2026
Deduplicated float tests and unified in floats/mod.rs

In this PR Float tests are deduplicated and are unified in floats/mod.rs, as discussed in #141726.

The moved float tests are:

-> test_powf
-> test_exp
-> test_exp2
-> test_ln
-> test_log_generic
-> test_log2
-> test_log10
-> test_asinh
-> test_acosh
-> test_atanh
-> test_gamma
-> test_ln_gamma

Closes: #141726
@JonathanBrouwer
Copy link
Contributor

@bors yield
Yield to enclosing rollup that failed spuriously

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 22, 2026

Auto build cancelled. Cancelled workflows:

The next pull request likely to be tested is #151485.

rust-bors bot pushed a commit that referenced this pull request Jan 22, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #148206 (Deduplicated float tests and unified in floats/mod.rs)
 - #151042 (fix fallback impl for select_unpredictable intrinsic)
 - #151220 (option: Use Option::map in Option::cloned)
 - #151260 (Handle unevaluated ConstKind in in_operand)
 - #151441 (Fix ICE: Don't try to evaluate type_consts when eagerly collecting items)
 - #151465 (codegen: clarify some variable names around function calls)
 - #151469 (llvm: Tolerate dead_on_return attribute changes)
 - #151476 (Avoid `-> ()` in derived functions.)

r? @ghost
@JonathanBrouwer
Copy link
Contributor

Actually I think this PR failed that rollup
@bors r-
#151485 (comment)

Not sure, if you disagree start a try job and then r+ again

@rust-bors rust-bors bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 22, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 22, 2026

Commit 6ac8ff7 has been unapproved.

rust-bors bot pushed a commit that referenced this pull request Jan 22, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #148206 (Deduplicated float tests and unified in floats/mod.rs)
 - #151042 (fix fallback impl for select_unpredictable intrinsic)
 - #151220 (option: Use Option::map in Option::cloned)
 - #151260 (Handle unevaluated ConstKind in in_operand)
 - #151441 (Fix ICE: Don't try to evaluate type_consts when eagerly collecting items)
 - #151465 (codegen: clarify some variable names around function calls)
 - #151469 (llvm: Tolerate dead_on_return attribute changes)
 - #151476 (Avoid `-> ()` in derived functions.)

r? @ghost
Comment on lines 1534 to 1535
name: powf,
attrs: {
const: #[cfg(false)],
f16: #[cfg(any(miri, target_has_reliable_f16_math))],
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like f16 needs to be not(miri), similar to f128

#[cfg(not(miri))]

That applies to most of the new functions here, check them against that source file.

@xonx4l xonx4l force-pushed the deduplicate-float-tests branch from 6ac8ff7 to d5bb79c Compare January 23, 2026 12:48
@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this patch file needs to be regenerated against the new changes

Copy link
Contributor Author

@xonx4l xonx4l Jan 24, 2026

Choose a reason for hiding this comment

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

Yes, Was doing that but got some work so couldn't send the push but will send one asap .

@xonx4l xonx4l force-pushed the deduplicate-float-tests branch 2 times, most recently from ea76b80 to a0621ec Compare January 24, 2026 07:19
@rustbot
Copy link
Collaborator

rustbot commented Jan 24, 2026

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.

@tgross35
Copy link
Contributor

@bors try jobs=x86_64-gnu-aux

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Jan 24, 2026
Deduplicated float tests and unified in floats/mod.rs


try-job: x86_64-gnu-aux
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 24, 2026

💔 Test for d97b772 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

test<Float> {
let nan: Float = Float::NAN;
let inf: Float = Float::INFINITY;
let neg_inf: Float = Float::NEG_INFINITY;
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like f16 needs to be not(miri), similar to f128

#[cfg(not(miri))]

That applies to most of the new functions here, check them against that source file.

Copy link
Contributor

@tgross35 tgross35 Jan 26, 2026

Choose a reason for hiding this comment

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

For some reason this comment got added to the wrong line, but it's referring to the current config:

        f16: #[cfg(any(not(miri), target_has_reliable_f16_math))],
        f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed all f16 from this -> f16: #[cfg(any(not(miri), target_has_reliable_f16_math))] to this -> f16: #[cfg(all(not(miri), target_has_reliable_f16_math))].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think for this change a new patch generation won't be required . But let's wait for ci.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh looks like I will need to regenerate the patch again.

@xonx4l xonx4l force-pushed the deduplicate-float-tests branch from a0621ec to eaf8049 Compare January 26, 2026 08:35
@rust-log-analyzer

This comment has been minimized.

@xonx4l xonx4l force-pushed the deduplicate-float-tests branch from eaf8049 to c22602b Compare January 26, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unify and deduplicate float tests

8 participants