Skip to content

Commit 4c309ed

Browse files
committed
Update f128 tests
1 parent 75419c7 commit 4c309ed

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

library/std/src/f128/tests.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,8 @@ fn test_powi() {
431431
let inf: f128 = f128::INFINITY;
432432
let neg_inf: f128 = f128::NEG_INFINITY;
433433
assert_eq!(1.0f128.powi(1), 1.0);
434-
assert_approx_eq!((-3.1f128).powi(2), 9.61, TOL_0);
435-
assert_approx_eq!(5.9f128.powi(-2), 0.028727, TOL_N2);
434+
assert_approx_eq!((-3.1f128).powi(2), 9.6100000000000005506706202140776519387, TOL_0);
435+
assert_approx_eq!(5.9f128.powi(-2), 0.028727377190462507313100483690639638451, TOL_N2);
436436
assert_eq!(8.3f128.powi(0), 1.0);
437437
assert!(nan.powi(2).is_nan());
438438
assert_eq!(inf.powi(3), inf);
@@ -445,10 +445,10 @@ fn test_powf() {
445445
let inf: f128 = f128::INFINITY;
446446
let neg_inf: f128 = f128::NEG_INFINITY;
447447
assert_eq!(1.0f128.powf(1.0), 1.0);
448-
assert_approx_eq!(3.4f128.powf(4.5), 246.408183, TOL_P2);
449-
assert_approx_eq!(2.7f128.powf(-3.2), 0.041652, TOL_N2);
450-
assert_approx_eq!((-3.1f128).powf(2.0), 9.61, TOL_P2);
451-
assert_approx_eq!(5.9f128.powf(-2.0), 0.028727, TOL_N2);
448+
assert_approx_eq!(3.4f128.powf(4.5), 246.40818323761892815995637964326426756, TOL_P2);
449+
assert_approx_eq!(2.7f128.powf(-3.2), 0.041652009108526178281070304373500889273, TOL_N2);
450+
assert_approx_eq!((-3.1f128).powf(2.0), 9.61000000000000055067062021407765193876 TOL_P2);
451+
assert_approx_eq!(5.9f128.powf(-2.0), 0.028727377190462507313100483690639638451, TOL_N2);
452452
assert_eq!(8.3f128.powf(0.0), 1.0);
453453
assert!(nan.powf(2.0).is_nan());
454454
assert_eq!(inf.powf(2.0), inf);
@@ -469,8 +469,8 @@ fn test_sqrt_domain() {
469469
#[test]
470470
fn test_exp() {
471471
assert_eq!(1.0, 0.0f128.exp());
472-
assert_approx_eq!(2.718282, 1.0f128.exp(), TOL_0);
473-
assert_approx_eq!(148.413159, 5.0f128.exp(), TOL_0);
472+
assert_approx_eq!(consts::E, 1.0f128.exp(), TOL_0);
473+
assert_approx_eq!(148.41315910257660342111558004055227962348775, 5.0f128.exp(), TOL_0);
474474

475475
let inf: f128 = f128::INFINITY;
476476
let neg_inf: f128 = f128::NEG_INFINITY;
@@ -505,7 +505,7 @@ fn test_ln() {
505505
assert!((-2.3f128).ln().is_nan());
506506
assert_eq!((-0.0f128).ln(), neg_inf);
507507
assert_eq!(0.0f128.ln(), neg_inf);
508-
assert_approx_eq!(4.0f128.ln(), 1.386294, TOL_0);
508+
assert_approx_eq!(4.0f128.ln(), 1.3862943611198906188344642429163531366, TOL_0);
509509
}
510510

511511
#[test]
@@ -531,9 +531,9 @@ fn test_log2() {
531531
let nan: f128 = f128::NAN;
532532
let inf: f128 = f128::INFINITY;
533533
let neg_inf: f128 = f128::NEG_INFINITY;
534-
assert_approx_eq!(10.0f128.log2(), 3.321928, TOL_0);
535-
assert_approx_eq!(2.3f128.log2(), 1.201634, TOL_0);
536-
assert_approx_eq!(1.0f128.exp().log2(), 1.442695, TOL_0);
534+
assert_approx_eq!(10.0f128.log2(), 3.32192809488736234787031942948939017, TOL_0);
535+
assert_approx_eq!(2.3f128.log2(), 1.2016338611696504130002982471978765921, TOL_0);
536+
assert_approx_eq!(1.0f128.exp().log2(), 1.4426950408889634073599246810018921381, TOL_0);
537537
assert!(nan.log2().is_nan());
538538
assert_eq!(inf.log2(), inf);
539539
assert!(neg_inf.log2().is_nan());
@@ -548,8 +548,8 @@ fn test_log10() {
548548
let inf: f128 = f128::INFINITY;
549549
let neg_inf: f128 = f128::NEG_INFINITY;
550550
assert_eq!(10.0f128.log10(), 1.0);
551-
assert_approx_eq!(2.3f128.log10(), 0.361728, TOL_0);
552-
assert_approx_eq!(1.0f128.exp().log10(), 0.434294, TOL_0);
551+
assert_approx_eq!(2.3f128.log10(), 0.36172783601759284532595218865859309898, TOL_0);
552+
assert_approx_eq!(1.0f128.exp().log10(), 0.43429448190325182765112891891660508222, TOL_0);
553553
assert_eq!(1.0f128.log10(), 0.0);
554554
assert!(nan.log10().is_nan());
555555
assert_eq!(inf.log10(), inf);
@@ -566,7 +566,7 @@ fn test_to_degrees() {
566566
let inf: f128 = f128::INFINITY;
567567
let neg_inf: f128 = f128::NEG_INFINITY;
568568
assert_eq!(0.0f128.to_degrees(), 0.0);
569-
assert_approx_eq!((-5.8f128).to_degrees(), -332.315521, TOL_P2);
569+
assert_approx_eq!((-5.8f128).to_degrees(), -332.31552117587745090765431723855668471, TOL_P2);
570570
assert_approx_eq!(pi.to_degrees(), 180.0, TOL_P2);
571571
assert!(nan.to_degrees().is_nan());
572572
assert_eq!(inf.to_degrees(), inf);
@@ -581,8 +581,8 @@ fn test_to_radians() {
581581
let inf: f128 = f128::INFINITY;
582582
let neg_inf: f128 = f128::NEG_INFINITY;
583583
assert_eq!(0.0f128.to_radians(), 0.0);
584-
assert_approx_eq!(154.6f128.to_radians(), 2.698279, TOL_0);
585-
assert_approx_eq!((-332.31f128).to_radians(), -5.799903, TOL_0);
584+
assert_approx_eq!(154.6f128.to_radians(), 2.6982790235832334267135442069489767804, TOL_0);
585+
assert_approx_eq!((-332.31f128).to_radians(), -5.7999036373023566567593094812182763013, TOL_0);
586586
// check approx rather than exact because round trip for pi doesn't fall on an exactly
587587
// representable value (unlike `f32` and `f64`).
588588
assert_approx_eq!(180.0f128.to_radians(), pi, TOL_0);
@@ -609,7 +609,7 @@ fn test_asinh() {
609609
// regression test for the catastrophic cancellation fixed in 72486
610610
assert_approx_eq!(
611611
(-67452098.07139316f128).asinh(),
612-
-18.72007542627454439398548429400083,
612+
-18.720075426274544393985484294000831757220,
613613
TOL_0
614614
);
615615

0 commit comments

Comments
 (0)