Skip to content

Commit c479ac9

Browse files
authored
Merge pull request #4564 from rust-lang/rustup-2025-09-04
Automatic Rustup
2 parents 1c25086 + 0abd6e3 commit c479ac9

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
51ff895062ba60a7cba53f57af928c3fb7b0f2f4
1+
9385c64c95d971329e62917adc4349c8ccdbafe0

src/math.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ pub(crate) fn apply_random_float_error<F: rustc_apfloat::Float>(
1515
|| matches!(ecx.machine.float_rounding_error, FloatRoundingErrorMode::None)
1616
// relative errors don't do anything to zeros... avoid messing up the sign
1717
|| val.is_zero()
18+
// The logic below makes no sense if the input is already non-finite.
19+
|| !val.is_finite()
1820
{
1921
return val;
2022
}
@@ -54,6 +56,8 @@ pub(crate) fn apply_random_float_error_ulp<F: rustc_apfloat::Float>(
5456
// FIXME: also disturb zeros? That requires a lot more cases in `fixed_float_value`
5557
// and might make the std test suite quite unhappy.
5658
|| val.is_zero()
59+
// The logic below makes no sense if the input is already non-finite.
60+
|| !val.is_finite()
5761
{
5862
return val;
5963
}

tests/pass/float.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,10 @@ pub fn libm() {
10521052
assert_eq!(42f64.powf(0.0), 1.0);
10531053
assert_eq!(f32::INFINITY.powf(0.0), 1.0);
10541054
assert_eq!(f64::INFINITY.powf(0.0), 1.0);
1055+
assert_eq!(f32::NEG_INFINITY.powi(3), f32::NEG_INFINITY);
1056+
assert_eq!(f32::NEG_INFINITY.powi(2), f32::INFINITY);
1057+
assert_eq!(f64::INFINITY.powi(3), f64::INFINITY);
1058+
assert_eq!(f64::INFINITY.powi(2), f64::INFINITY);
10551059

10561060
// f*::NAN is a quiet NAN and should return 1 as well.
10571061
assert_eq!(f32::NAN.powi(0), 1.0);

0 commit comments

Comments
 (0)