Skip to content

Move several more float tests to floats/mod.rs #144923

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

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

rocurley
Copy link
Contributor

@rocurley rocurley commented Aug 4, 2025

This PR moves several tests to floats/mod.rs, as discussed in #141726. The tests moved are:

  • test_abs
  • test_signum
  • test_is_sign_positive
  • test_is_sign_negative
  • test_next_up
  • test_next_down
  • test_sqrt_domain
  • test_clamp_min_greater_than_max
  • test_clamp_min_is_nan
  • test_clamp_max_is_nan
  • test_total_cmp

This covers all the "easy" tests: the ones that don't have a lot of precision-specific constants. It's not clear to me that it's worth migrating the others.

Each test is its own commit (with the exception of the clamp tests), so it may be easiest to review each commit individually.

r? tgross35

This clobbers the existing generic abs test, but it covers strictly
more, so that seems fine.
Note that the behaviour of the f128 test is slightly changed to use the
same nan mask as is used in test_float_bits_conv, which is the behaviour
used by f16,f32,and f64.
@rustbot rustbot added 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. labels Aug 4, 2025
@rocurley rocurley marked this pull request as ready for review August 4, 2025 19:21
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 4, 2025
@rustbot

This comment has been minimized.

@rocurley rocurley force-pushed the float_tests_refactor_3 branch from 4737950 to 4e92c1c Compare August 4, 2025 19:24
@rust-log-analyzer

This comment has been minimized.

@rocurley rocurley marked this pull request as draft August 4, 2025 20:19
@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 Aug 4, 2025
This standardizes how max and min subnormals are generated. Since the
new method doesn't use powf, it also enables some of the tests for f128
that were previously disabled due to issues with powf (although it looks
like those issues were already fixed anyway). f16 signalling nan tests
previously disabled are not re-enabled, since the underlying LLVM issue
has not been closed.
@rocurley rocurley force-pushed the float_tests_refactor_3 branch from 4e92c1c to 4d3f410 Compare August 5, 2025 21:47
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants