@@ -652,6 +652,38 @@ fn test_atanh() {
652652    assert_approx_eq ! ( ( -0.5f32 ) . atanh( ) ,  -0.54930614433405484569762261846126285f32 ) ; 
653653} 
654654
655+ #[ test]  
656+ fn  test_gamma ( )  { 
657+     // precision can differ between platforms 
658+     assert_approx_eq ! ( 1.0f32 . gamma( ) ,  1.0f32 ) ; 
659+     assert_approx_eq ! ( 2.0f32 . gamma( ) ,  1.0f32 ) ; 
660+     assert_approx_eq ! ( 3.0f32 . gamma( ) ,  2.0f32 ) ; 
661+     assert_approx_eq ! ( 4.0f32 . gamma( ) ,  6.0f32 ) ; 
662+     assert_approx_eq ! ( 5.0f32 . gamma( ) ,  24.0f32 ) ; 
663+     assert_approx_eq ! ( 0.5f32 . gamma( ) ,  consts:: PI . sqrt( ) ) ; 
664+     assert_approx_eq ! ( ( -0.5f32 ) . gamma( ) ,  -2.0  *  consts:: PI . sqrt( ) ) ; 
665+     assert_eq ! ( 0.0f32 . gamma( ) ,  f32 :: INFINITY ) ; 
666+     assert_eq ! ( ( -0.0f32 ) . gamma( ) ,  f32 :: NEG_INFINITY ) ; 
667+     assert ! ( ( -1.0f32 ) . gamma( ) . is_nan( ) ) ; 
668+     assert ! ( ( -2.0f32 ) . gamma( ) . is_nan( ) ) ; 
669+     assert ! ( f32 :: NAN . gamma( ) . is_nan( ) ) ; 
670+     assert ! ( f32 :: NEG_INFINITY . gamma( ) . is_nan( ) ) ; 
671+     assert_eq ! ( f32 :: INFINITY . gamma( ) ,  f32 :: INFINITY ) ; 
672+     assert_eq ! ( 171.71f32 . gamma( ) ,  f32 :: INFINITY ) ; 
673+ } 
674+ 
675+ #[ test]  
676+ fn  test_ln_gamma ( )  { 
677+     assert_approx_eq ! ( 1.0f32 . ln_gamma( ) . 0 ,  0.0f32 ) ; 
678+     assert_eq ! ( 1.0f32 . ln_gamma( ) . 1 ,  1 ) ; 
679+     assert_approx_eq ! ( 2.0f32 . ln_gamma( ) . 0 ,  0.0f32 ) ; 
680+     assert_eq ! ( 2.0f32 . ln_gamma( ) . 1 ,  1 ) ; 
681+     assert_approx_eq ! ( 3.0f32 . ln_gamma( ) . 0 ,  2.0f32 . ln( ) ) ; 
682+     assert_eq ! ( 3.0f32 . ln_gamma( ) . 1 ,  1 ) ; 
683+     assert_approx_eq ! ( ( -0.5f32 ) . ln_gamma( ) . 0 ,  ( 2.0  *  consts:: PI . sqrt( ) ) . ln( ) ) ; 
684+     assert_eq ! ( ( -0.5f32 ) . ln_gamma( ) . 1 ,  -1 ) ; 
685+ } 
686+ 
655687#[ test]  
656688fn  test_real_consts ( )  { 
657689    use  super :: consts; 
0 commit comments