Commit Graph

43 Commits

Author SHA1 Message Date
Stuart Cook
cec668fefc Rollup merge of #146737 - RalfJung:f16-f128-miri, r=tgross35
f16_f128: enable some more tests in Miri

For some reason, a bunch of tests were disabled in Miri that don't use any fancy intrinsics. Let's enable them.

I verified this with `./x miri library/core --no-doc -- float`.

r? `@tgross35`
2025-09-25 20:31:55 +10:00
Stuart Cook
8e62f95376 Rollup merge of #146735 - Qelxiros:const_mul_add, r=tgross35,RalfJung
unstably constify float mul_add methods

Tracking issue: rust-lang/rust#146724
r? `@tgross35`
2025-09-25 20:31:54 +10:00
Jeremy Smart
a00f24116e unstably constify float mul_add methods
Co-authored-by: Ralf Jung <post@ralfj.de>
2025-09-24 15:21:31 -04:00
Ralf Jung
f509dff56d f16_f128: enable some more tests in Miri 2025-09-24 16:47:13 +02:00
Nathaniel McCallum
5dde557fc4 constify {float}::total_cmp() 2025-09-22 10:24:39 -04:00
Romain Perier
b1c4e19e13 Unify and deduplicate bits conv float tests 2025-09-10 14:25:36 +02:00
Romain Perier
4e872375d4 Unify and deduplicate algebraic float tests 2025-09-03 14:39:50 +02:00
Karol Zwolak
9028efcf2e dedup to_radians float test 2025-08-31 18:20:49 +02:00
Karol Zwolak
c81a8a89ee dedup to_degrees float test 2025-08-31 18:19:05 +02:00
Karol Zwolak
e10e6d78ac dedup powi float test 2025-08-31 18:16:00 +02:00
Karol Zwolak
6ebd009d47 dedup recip float test
I left the additional asserts on {f16, f128}::MAX.recip() in a new
test_max_recip tests.
2025-08-30 14:54:41 +02:00
Roger Curley
57cf40cd82 Hoist zero and one out into TestableFloat 2025-08-07 22:51:46 -04:00
Roger Curley
80bcd1a61f Consolidate total_cmp tests
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.
2025-08-07 22:06:57 -04:00
Roger Curley
a5e4e7ab52 Consolidate clamp tests 2025-08-07 22:06:57 -04:00
Roger Curley
666bfcae21 Consolidate sqrt_domain tests 2025-08-07 22:06:57 -04:00
Roger Curley
8a65ce4360 Consolidate test_next_down 2025-08-07 22:06:57 -04:00
Roger Curley
f51f68b49a Consolidate test_next_up
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.
2025-08-07 22:06:56 -04:00
Roger Curley
71973fcbdb Consolidate is_sign_negative tests 2025-08-07 22:06:56 -04:00
Roger Curley
951ef57b85 Consolidate is_positive tests 2025-08-07 22:06:56 -04:00
Roger Curley
83878ea228 Consolidate signum tests 2025-08-07 22:06:51 -04:00
Roger Curley
b4a3d3014e Consolidate abs tests
This clobbers the existing generic abs test, but it covers strictly
more, so that seems fine.
2025-08-07 22:03:30 -04:00
Roger Curley
79769f2d5b Consolidate classify tests 2025-07-11 10:41:24 -04:00
Roger Curley
d2c1900086 Consolidate is_normal tests 2025-07-11 10:41:24 -04:00
Roger Curley
7dd2811b2a Consolidate is_finite tests 2025-07-11 10:41:24 -04:00
Roger Curley
e3d83679cb Consolidate is_infinite tests 2025-07-11 10:41:24 -04:00
Roger Curley
1b8904c0c5 Consolidate is_nan 2025-07-11 10:41:23 -04:00
Roger Curley
868020e059 Consolidate one tests 2025-07-11 10:31:26 -04:00
Roger Curley
fc01eed024 Consolidate negative zero tests 2025-07-11 10:31:25 -04:00
Roger Curley
0c01322ec6 Consolidate zero tests 2025-07-11 10:31:25 -04:00
Roger Curley
c2e6b39474 Consolidate neg_infinity tests 2025-07-11 10:31:25 -04:00
Roger Curley
c5e67b48ef Consolidate test_num tests 2025-07-11 10:31:25 -04:00
Roger Curley
cfb66e5e88 Consolidate infinity tests 2025-07-11 10:31:25 -04:00
Roger Curley
bc2001f158 Refactor nan tests 2025-07-09 23:24:47 -04:00
Ralf Jung
25ec235b86 tweak runtime/const macro management 2025-06-13 10:22:56 +02:00
Ralf Jung
1b6bb4566d float midpoint tests: add missing NAN cases 2025-06-09 14:24:24 +02:00
Ralf Jung
2766b77f1e make the default float comparison tolerance type-dependent 2025-06-09 14:24:24 +02:00
Ralf Jung
79cb013b55 float tests: deduplicate min, max, and rounding tests 2025-06-09 14:24:12 +02:00
Ralf Jung
20cf8ca3f7 float tests: use assert_biteq in more places 2025-06-09 14:17:28 +02:00
Ralf Jung
7742d0e230 coretests: move float tests from num to floats module and use a more flexible macro to generate them 2025-06-04 16:32:17 +02:00
Trevor Gross
70cce1c762 float: Use assert_biteq! where possible
`assert_eq!` ignores the sign of zero, but for any tests involving zeros
we do care about this sign. Replace `assert_eq!` with `assert_biteq!`
everywhere possible for float tests to ensure we don't miss this.
`assert_biteq!` is also updated to check equality on non-NaNs, to catch
the unlikely case that bitwise equality works but our `==`
implementation is broken.

There is one notable output change: we were asserting that
`(-0.0).fract()` and `(-1.0).fract()` both return -0.0, but both
actually return +0.0.
2025-05-29 21:13:26 +00:00
Trevor Gross
6a79b272ba float: Use a shared assert_biteq! macro for tests
Clean up the separate `assert_f{16,32,64,128}` macros with a single
`assert_biteq!` macro that works for all float widths.
2025-05-29 21:13:26 +00:00
Trevor Gross
2b9256e1c8 Move applicable float tests from coretests back to std
The previous commit moved all test files from `std` to `core` so git
understands the move. Not all functionality is actually testable in
`core`, however, so perform move the relevant portions back. Changes
from inherent to module methods is also done since this is the form of
math operations available in `core` (as `core_float_math`).
2025-05-14 14:29:58 +00:00
Trevor Gross
48f3e63f70 Move float tests from std to core
Many float-related tests in `std` only depend on `core`, so move the
tests there. This also allows us to verify functions from
`core_float_math`.

Since the majority of test files need to be moved to `coretests`, move
the files here without any cleanup; this is done in a followup commit.
This makes git history slightly cleaner, but coretests will not build
immediately after this commit.
2025-05-13 22:22:15 +00:00