File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ pub(crate) fn apply_random_float_error<F: rustc_apfloat::Float>(
15
15
|| matches ! ( ecx. machine. float_rounding_error, FloatRoundingErrorMode :: None )
16
16
// relative errors don't do anything to zeros... avoid messing up the sign
17
17
|| val. is_zero ( )
18
+ // The logic below makes no sense if the input is already non-finite.
19
+ || !val. is_finite ( )
18
20
{
19
21
return val;
20
22
}
@@ -54,6 +56,8 @@ pub(crate) fn apply_random_float_error_ulp<F: rustc_apfloat::Float>(
54
56
// FIXME: also disturb zeros? That requires a lot more cases in `fixed_float_value`
55
57
// and might make the std test suite quite unhappy.
56
58
|| val. is_zero ( )
59
+ // The logic below makes no sense if the input is already non-finite.
60
+ || !val. is_finite ( )
57
61
{
58
62
return val;
59
63
}
Original file line number Diff line number Diff line change @@ -1052,6 +1052,10 @@ pub fn libm() {
1052
1052
assert_eq ! ( 42f64 . powf( 0.0 ) , 1.0 ) ;
1053
1053
assert_eq ! ( f32 :: INFINITY . powf( 0.0 ) , 1.0 ) ;
1054
1054
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 ) ;
1055
1059
1056
1060
// f*::NAN is a quiet NAN and should return 1 as well.
1057
1061
assert_eq ! ( f32 :: NAN . powi( 0 ) , 1.0 ) ;
You can’t perform that action at this time.
0 commit comments