@@ -632,15 +632,15 @@ where
632632
633633 #[ cfg( any( target_arch = "x86" , all( target_arch = "aarch64" , target_feature = "neon" ) ) ) ]
634634 {
635- // todo: why is the LHS printing 65500?
636- assert_eq ! ( to_string( f, f16:: MAX , Minus , 0 ) , format!( "65504{:0>1}" , "" ) ) ;
637- assert_eq ! ( to_string( f, f16:: MAX , Minus , 1 ) , format!( "65504{:0>1}.0" , "" ) ) ;
638- assert_eq ! ( to_string( f, f16:: MAX , Minus , 8 ) , format!( "65504{:0>1}.00000000" , "" ) ) ;
635+ assert_eq ! ( to_string( f, f16:: MAX , Minus , 0 ) , "65500" ) ;
636+ assert_eq ! ( to_string( f, f16:: MAX , Minus , 1 ) , "65500.0" ) ;
637+ assert_eq ! ( to_string( f, f16:: MAX , Minus , 8 ) , "65500.00000000" ) ;
639638
640639 let minf16 = ldexp_f16 ( 1.0 , -24 ) ;
641640 assert_eq ! ( to_string( f, minf16, Minus , 0 ) , format!( "0.{:0>7}6" , "" ) ) ;
642641 assert_eq ! ( to_string( f, minf16, Minus , 7 ) , format!( "0.{:0>7}6" , "" ) ) ;
643- assert_eq ! ( to_string( f, minf16, Minus , 8 ) , format!( "0.{:0>7}60" , "" ) ) ;
642+ // todo: this passes, but why does it not need a trailing `0` like the others?
643+ assert_eq ! ( to_string( f, minf16, Minus , 8 ) , format!( "0.{:0>7}6" , "" ) ) ;
644644 }
645645
646646 assert_eq ! ( to_string( f, f32 :: MAX , Minus , 0 ) , format!( "34028235{:0>31}" , "" ) ) ;
@@ -896,37 +896,22 @@ where
896896
897897 #[ cfg( any( target_arch = "x86" , all( target_arch = "aarch64" , target_feature = "neon" ) ) ) ]
898898 {
899- // todo: update values
900- assert_eq ! ( to_string( f, f16:: MAX , Minus , 1 , false ) , "3e38" ) ;
901- assert_eq ! ( to_string( f, f16:: MAX , Minus , 2 , false ) , "3.4e38" ) ;
902- assert_eq ! ( to_string( f, f16:: MAX , Minus , 4 , false ) , "3.403e38" ) ;
903- assert_eq ! ( to_string( f, f16:: MAX , Minus , 8 , false ) , "3.4028235e38" ) ;
904- assert_eq ! ( to_string( f, f16:: MAX , Minus , 16 , false ) , "3.402823466385289e38" ) ;
905- assert_eq ! (
906- to_string( f, f16:: MAX , Minus , 32 , false ) ,
907- "3.4028234663852885981170418348452e38"
908- ) ;
909- assert_eq ! (
910- to_string( f, f16:: MAX , Minus , 64 , false ) ,
911- "3.402823466385288598117041834845169254400000000000000000000000000e38"
912- ) ;
899+ assert_eq ! ( to_string( f, f16:: MAX , Minus , 1 , false ) , "7e4" ) ;
900+ assert_eq ! ( to_string( f, f16:: MAX , Minus , 2 , false ) , "6.6e4" ) ;
901+ assert_eq ! ( to_string( f, f16:: MAX , Minus , 4 , false ) , "6.550e4" ) ;
902+ assert_eq ! ( to_string( f, f16:: MAX , Minus , 5 , false ) , "6.5504e4" ) ;
903+ assert_eq ! ( to_string( f, f16:: MAX , Minus , 6 , false ) , "6.55040e4" ) ;
904+ assert_eq ! ( to_string( f, f16:: MAX , Minus , 16 , false ) , "6.550400000000000e4" ) ;
913905
914906 let minf16 = ldexp_f16 ( 1.0 , -24 ) ;
915- assert_eq ! ( to_string( f, minf16, Minus , 1 , false ) , "1e-45" ) ;
916- assert_eq ! ( to_string( f, minf16, Minus , 2 , false ) , "1.4e-45" ) ;
917- assert_eq ! ( to_string( f, minf16, Minus , 4 , false ) , "1.401e-45" ) ;
918- assert_eq ! ( to_string( f, minf16, Minus , 8 , false ) , "1.4012985e-45" ) ;
919- assert_eq ! ( to_string( f, minf16, Minus , 16 , false ) , "1.401298464324817e-45" ) ;
920- assert_eq ! ( to_string( f, minf16, Minus , 32 , false ) , "1.4012984643248170709237295832899e-45" ) ;
921- assert_eq ! (
922- to_string( f, minf16, Minus , 64 , false ) ,
923- "1.401298464324817070923729583289916131280261941876515771757068284e-45"
924- ) ;
925- assert_eq ! (
926- to_string( f, minf16, Minus , 128 , false ) ,
927- "1.401298464324817070923729583289916131280261941876515771757068283\
928- 8897910826858606014866381883621215820312500000000000000000000000e-45"
929- ) ;
907+ assert_eq ! ( to_string( f, minf16, Minus , 1 , false ) , "6e-8" ) ;
908+ assert_eq ! ( to_string( f, minf16, Minus , 2 , false ) , "6.0e-8" ) ;
909+ assert_eq ! ( to_string( f, minf16, Minus , 4 , false ) , "5.960e-8" ) ;
910+ assert_eq ! ( to_string( f, minf16, Minus , 8 , false ) , "5.9604645e-8" ) ;
911+ assert_eq ! ( to_string( f, minf16, Minus , 16 , false ) , "5.960464477539062e-8" ) ;
912+ assert_eq ! ( to_string( f, minf16, Minus , 17 , false ) , "5.9604644775390625e-8" ) ;
913+ assert_eq ! ( to_string( f, minf16, Minus , 18 , false ) , "5.96046447753906250e-8" ) ;
914+ assert_eq ! ( to_string( f, minf16, Minus , 24 , false ) , "5.96046447753906250000000e-8" ) ;
930915 }
931916
932917 assert_eq ! ( to_string( f, f32 :: MAX , Minus , 1 , false ) , "3e38" ) ;
@@ -1225,7 +1210,6 @@ where
12251210
12261211 #[ cfg( any( target_arch = "x86" , all( target_arch = "aarch64" , target_feature = "neon" ) ) ) ]
12271212 {
1228- // todo: update values
12291213 let minf16 = ldexp_f16 ( 1.0 , -24 ) ;
12301214 assert_eq ! ( to_string( f, minf16, Minus , 0 ) , "0" ) ;
12311215 assert_eq ! ( to_string( f, minf16, Minus , 1 ) , "0.0" ) ;
0 commit comments