@@ -431,8 +431,8 @@ fn test_powi() {
431
431
let inf: f128 = f128:: INFINITY ;
432
432
let neg_inf: f128 = f128:: NEG_INFINITY ;
433
433
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 ) ;
436
436
assert_eq ! ( 8.3f128 . powi( 0 ) , 1.0 ) ;
437
437
assert ! ( nan. powi( 2 ) . is_nan( ) ) ;
438
438
assert_eq ! ( inf. powi( 3 ) , inf) ;
@@ -445,10 +445,10 @@ fn test_powf() {
445
445
let inf: f128 = f128:: INFINITY ;
446
446
let neg_inf: f128 = f128:: NEG_INFINITY ;
447
447
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 ) ;
452
452
assert_eq ! ( 8.3f128 . powf( 0.0 ) , 1.0 ) ;
453
453
assert ! ( nan. powf( 2.0 ) . is_nan( ) ) ;
454
454
assert_eq ! ( inf. powf( 2.0 ) , inf) ;
@@ -469,8 +469,8 @@ fn test_sqrt_domain() {
469
469
#[ test]
470
470
fn test_exp ( ) {
471
471
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 ) ;
474
474
475
475
let inf: f128 = f128:: INFINITY ;
476
476
let neg_inf: f128 = f128:: NEG_INFINITY ;
@@ -505,7 +505,7 @@ fn test_ln() {
505
505
assert ! ( ( -2.3f128 ) . ln( ) . is_nan( ) ) ;
506
506
assert_eq ! ( ( -0.0f128 ) . ln( ) , neg_inf) ;
507
507
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 ) ;
509
509
}
510
510
511
511
#[ test]
@@ -531,9 +531,9 @@ fn test_log2() {
531
531
let nan: f128 = f128:: NAN ;
532
532
let inf: f128 = f128:: INFINITY ;
533
533
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 ) ;
537
537
assert ! ( nan. log2( ) . is_nan( ) ) ;
538
538
assert_eq ! ( inf. log2( ) , inf) ;
539
539
assert ! ( neg_inf. log2( ) . is_nan( ) ) ;
@@ -548,8 +548,8 @@ fn test_log10() {
548
548
let inf: f128 = f128:: INFINITY ;
549
549
let neg_inf: f128 = f128:: NEG_INFINITY ;
550
550
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 ) ;
553
553
assert_eq ! ( 1.0f128 . log10( ) , 0.0 ) ;
554
554
assert ! ( nan. log10( ) . is_nan( ) ) ;
555
555
assert_eq ! ( inf. log10( ) , inf) ;
@@ -566,7 +566,7 @@ fn test_to_degrees() {
566
566
let inf: f128 = f128:: INFINITY ;
567
567
let neg_inf: f128 = f128:: NEG_INFINITY ;
568
568
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 ) ;
570
570
assert_approx_eq ! ( pi. to_degrees( ) , 180.0 , TOL_P2 ) ;
571
571
assert ! ( nan. to_degrees( ) . is_nan( ) ) ;
572
572
assert_eq ! ( inf. to_degrees( ) , inf) ;
@@ -581,8 +581,8 @@ fn test_to_radians() {
581
581
let inf: f128 = f128:: INFINITY ;
582
582
let neg_inf: f128 = f128:: NEG_INFINITY ;
583
583
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 ) ;
586
586
// check approx rather than exact because round trip for pi doesn't fall on an exactly
587
587
// representable value (unlike `f32` and `f64`).
588
588
assert_approx_eq ! ( 180.0f128 . to_radians( ) , pi, TOL_0 ) ;
@@ -609,7 +609,7 @@ fn test_asinh() {
609
609
// regression test for the catastrophic cancellation fixed in 72486
610
610
assert_approx_eq ! (
611
611
( -67452098.07139316f128 ) . asinh( ) ,
612
- -18.72007542627454439398548429400083 ,
612
+ -18.720075426274544393985484294000831757220 ,
613
613
TOL_0
614
614
) ;
615
615
0 commit comments