Skip to content

Commit

Permalink
Fix f128 test, disable powi tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Jul 12, 2024
1 parent 0bca7c3 commit 9dd7bb8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion library/std/src/f128/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ fn test_to_degrees() {
let neg_inf: f128 = f128::NEG_INFINITY;
assert_eq!(0.0f128.to_degrees(), 0.0);
assert_approx_eq!((-5.8f128).to_degrees(), -332.315521, TOL_P2);
assert_eq!(pi.to_degrees(), 180.0, TOL_P2);
assert_approx_eq!(pi.to_degrees(), 180.0, TOL_P2);
assert!(nan.to_degrees().is_nan());
assert_eq!(inf.to_degrees(), inf);
assert_eq!(neg_inf.to_degrees(), neg_inf);
Expand Down
24 changes: 14 additions & 10 deletions library/std/src/f16/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,16 +396,20 @@ fn test_recip() {

#[test]
fn test_powi() {
let nan: f16 = f16::NAN;
let inf: f16 = f16::INFINITY;
let neg_inf: f16 = f16::NEG_INFINITY;
assert_eq!(1.0f16.powi(1), 1.0);
assert_approx_eq!((-3.1f16).powi(2), 9.61, TOL_0);
assert_approx_eq!(5.9f16.powi(-2), 0.028727, TOL_N2);
assert_eq!(8.3f16.powi(0), 1.0);
assert!(nan.powi(2).is_nan());
assert_eq!(inf.powi(3), inf);
assert_eq!(neg_inf.powi(2), inf);
// FIXME(f16_f128): LLVM misoptimizes `powi.f16`
// <https://github.com/llvm/llvm-project/issues/98665>
// let nan: f16 = f16::NAN;
// let inf: f16 = f16::INFINITY;
// let neg_inf: f16 = f16::NEG_INFINITY;
// dbg!(1.0f16);
// dbg!(1.0f16.powi(1));
// assert_eq!(1.0f16.powi(1), 1.0);
// assert_approx_eq!((-3.1f16).powi(2), 9.61, TOL_0);
// assert_approx_eq!(5.9f16.powi(-2), 0.028727, TOL_N2);
// assert_eq!(8.3f16.powi(0), 1.0);
// assert!(nan.powi(2).is_nan());
// assert_eq!(inf.powi(3), inf);
// assert_eq!(neg_inf.powi(2), inf);
}

#[test]
Expand Down

0 comments on commit 9dd7bb8

Please sign in to comment.