Skip to content

Commit 5fe2738

Browse files
authored
Merge pull request #4743 from rust-lang/rustup-2025-12-06
Automatic Rustup
2 parents 15c5042 + 2f4afcc commit 5fe2738

File tree

3 files changed

+29
-35
lines changed

3 files changed

+29
-35
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ jobs:
3131
os: ubuntu-24.04-arm
3232
multiarch: armhf
3333
gcc_cross: arm-linux-gnueabihf
34-
- host_target: riscv64gc-unknown-linux-gnu
35-
os: ubuntu-latest
36-
multiarch: riscv64
37-
gcc_cross: riscv64-linux-gnu
38-
qemu: true
3934
# Ubuntu mirrors are not reliable enough for these architectures
4035
# (see <https://bugs.launchpad.net/ubuntu/+bug/2130309>).
36+
# - host_target: riscv64gc-unknown-linux-gnu
37+
# os: ubuntu-latest
38+
# multiarch: riscv64
39+
# gcc_cross: riscv64-linux-gnu
40+
# qemu: true
4141
# - host_target: s390x-unknown-linux-gnu
4242
# os: ubuntu-latest
4343
# multiarch: s390x

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
864339abf952f07098dd82610256338520167d4a
1+
36b2369c91d32c2659887ed6fe3d570640f44fd2

tests/pass/float.rs

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -48,29 +48,15 @@ macro_rules! assert_approx_eq {
4848
};
4949
}
5050

51-
/// From IEEE 754 a Signaling NaN for single precision has the following representation:
52-
/// ```
53-
/// s | 1111 1111 | 0x..x
54-
/// ````
55-
/// Were at least one `x` is a 1.
56-
///
57-
/// This sNaN has the following representation and is used for testing purposes.:
58-
/// ```
59-
/// 0 | 1111111 | 01..0
60-
/// ```
61-
const SNAN_F32: f32 = f32::from_bits(0x7fa00000);
62-
63-
/// From IEEE 754 a Signaling NaN for double precision has the following representation:
64-
/// ```
65-
/// s | 1111 1111 111 | 0x..x
66-
/// ````
67-
/// Were at least one `x` is a 1.
68-
///
69-
/// This sNaN has the following representation and is used for testing purposes.:
70-
/// ```
71-
/// 0 | 1111 1111 111 | 01..0
72-
/// ```
73-
const SNAN_F64: f64 = f64::from_bits(0x7ff4000000000000);
51+
/// We turn the quiet NaN f*::NAN into a signaling one by flipping the first (most significant)
52+
/// two bits of the mantissa. For this we have to shift by `MANTISSA_DIGITS-3` because:
53+
/// we subtract 1 as the actual mantissa is 1 bit smaller, and 2 more as that's the width
54+
/// if the value we are shifting.
55+
const F16_SNAN: f16 = f16::from_bits(f16::NAN.to_bits() ^ (0b11 << (f16::MANTISSA_DIGITS - 3)));
56+
const F32_SNAN: f32 = f32::from_bits(f32::NAN.to_bits() ^ (0b11 << (f32::MANTISSA_DIGITS - 3)));
57+
const F64_SNAN: f64 = f64::from_bits(f64::NAN.to_bits() ^ (0b11 << (f64::MANTISSA_DIGITS - 3)));
58+
const F128_SNAN: f128 =
59+
f128::from_bits(f128::NAN.to_bits() ^ (0b11 << (f128::MANTISSA_DIGITS - 3)));
7460

7561
fn main() {
7662
basic();
@@ -757,6 +743,8 @@ fn ops() {
757743
assert_eq(f16::NAN.max(-9.0), -9.0);
758744
assert_eq((9.0_f16).min(f16::NAN), 9.0);
759745
assert_eq((-9.0_f16).max(f16::NAN), -9.0);
746+
assert_eq(F16_SNAN.min(9.0), 9.0);
747+
assert_eq((-9.0_f16).max(F16_SNAN), -9.0);
760748

761749
// f32 min/max
762750
assert_eq((1.0 as f32).max(-1.0), 1.0);
@@ -765,6 +753,8 @@ fn ops() {
765753
assert_eq(f32::NAN.max(-9.0), -9.0);
766754
assert_eq((9.0 as f32).min(f32::NAN), 9.0);
767755
assert_eq((-9.0 as f32).max(f32::NAN), -9.0);
756+
assert_eq(F32_SNAN.min(9.0), 9.0);
757+
assert_eq((-9.0_f32).max(F32_SNAN), -9.0);
768758

769759
// f64 min/max
770760
assert_eq((1.0 as f64).max(-1.0), 1.0);
@@ -773,6 +763,8 @@ fn ops() {
773763
assert_eq(f64::NAN.max(-9.0), -9.0);
774764
assert_eq((9.0 as f64).min(f64::NAN), 9.0);
775765
assert_eq((-9.0 as f64).max(f64::NAN), -9.0);
766+
assert_eq(F64_SNAN.min(9.0), 9.0);
767+
assert_eq((-9.0_f64).max(F64_SNAN), -9.0);
776768

777769
// f128 min/max
778770
assert_eq((1.0_f128).max(-1.0), 1.0);
@@ -781,6 +773,8 @@ fn ops() {
781773
assert_eq(f128::NAN.max(-9.0), -9.0);
782774
assert_eq((9.0_f128).min(f128::NAN), 9.0);
783775
assert_eq((-9.0_f128).max(f128::NAN), -9.0);
776+
assert_eq(F128_SNAN.min(9.0), 9.0);
777+
assert_eq((-9.0_f128).max(F128_SNAN), -9.0);
784778

785779
// f16 copysign
786780
assert_eq(3.5_f16.copysign(0.42), 3.5_f16);
@@ -1548,15 +1542,15 @@ fn test_non_determinism() {
15481542
test_operations_f128(25., 18.);
15491543

15501544
// SNaN^0 = (1 | NaN)
1551-
check_nondet(|| f32::powf(SNAN_F32, 0.0).is_nan());
1552-
check_nondet(|| f64::powf(SNAN_F64, 0.0).is_nan());
1545+
check_nondet(|| f32::powf(F32_SNAN, 0.0).is_nan());
1546+
check_nondet(|| f64::powf(F64_SNAN, 0.0).is_nan());
15531547

15541548
// 1^SNaN = (1 | NaN)
1555-
check_nondet(|| f32::powf(1.0, SNAN_F32).is_nan());
1556-
check_nondet(|| f64::powf(1.0, SNAN_F64).is_nan());
1549+
check_nondet(|| f32::powf(1.0, F32_SNAN).is_nan());
1550+
check_nondet(|| f64::powf(1.0, F64_SNAN).is_nan());
15571551

15581552
// same as powf (keep it consistent):
15591553
// x^SNaN = (1 | NaN)
1560-
check_nondet(|| f32::powi(SNAN_F32, 0).is_nan());
1561-
check_nondet(|| f64::powi(SNAN_F64, 0).is_nan());
1554+
check_nondet(|| f32::powi(F32_SNAN, 0).is_nan());
1555+
check_nondet(|| f64::powi(F64_SNAN, 0).is_nan());
15621556
}

0 commit comments

Comments
 (0)