rust/library/coretests/tests/num
bors c6768de2d6 Auto merge of #138062 - LorrensP-2158466:miri-enable-float-nondet, r=RalfJung
Enable Non-determinism of float operations in Miri and change std tests

Links to [#4208](https://github.com/rust-lang/miri/issues/4208) and [#3555](https://github.com/rust-lang/miri/issues/3555) in Miri.

Non-determinism of floating point operations was disabled in rust-lang/rust#137594 because it breaks the tests and doc-tests in core/coretests and std. This PR enables some of them.

This pr includes the following changes:

- Enables the float non-determinism but with a lower relative error of 4ULP instead of 16ULP
- These operations now have a fixed output based on the C23 standard, except the pow operations, this is tracked in [#4286](https://github.com/rust-lang/miri/issues/4286#issue-3010677983)
- Changes tests that made incorrect assumptions about the operations, not to make that assumption anymore (from `assert_eq!` to `assert_approx_eq!`.
- Changed the doctests of the stdlib of these operations to compare against fixed constants instead of `f*::EPSILON`, which now succeed with Miri and `-Zmiri-many-seeds`
- Added a constant `APPROX_DELTA` in `std/tests/floats/f32.rs` which is used for approximation tests, but with a different value when run in Miri. This is to make these tests succeed.
- Added tests in the float tests of Miri to test the C23 behaviour.

Fixes https://github.com/rust-lang/miri/issues/4208
2025-06-09 21:21:58 +00:00
..
dec2flt Enable Float non-determinism in miri. Update and add tests and change 2025-06-03 19:46:13 +02:00
flt2dec float: Add tests for f16 conversions to and from decimal 2025-05-18 16:51:28 +00:00
bignum.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
const_from.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
float_iter_sum_identity.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
i8.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
i16.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
i32.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
i64.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
i128.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
ieee754.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
int_log.rs checked_ilog tests: deal with a bit of float imprecision 2025-02-27 15:38:22 +01:00
int_macros.rs add tests for negative numbers 2025-06-03 21:02:04 -04:00
int_sqrt.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
midpoint.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
mod.rs Make NonZero<char> possible 2025-06-07 11:40:49 +00:00
nan.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
niche_types.rs Make NonZero<char> possible 2025-06-07 11:40:49 +00:00
ops.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
u8.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
u16.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
u32.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
u64.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
u128.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00
uint_macros.rs add tests 2025-06-02 22:57:16 -04:00
wrapping.rs Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00