@@ -123,7 +123,11 @@ func TestFloat32Conversions(t *testing.T) {
123123 }
124124 case "FromFloat32" :
125125 res := tc .f16 .ToFloat32 ()
126- if tc .expected .(float32 ) != res && ! math .IsNaN (float64 (res )) {
126+ if math .IsNaN (float64 (tc .expected .(float32 ))) {
127+ if ! math .IsNaN (float64 (res )) {
128+ t .Errorf ("Expected NaN, got %v" , res )
129+ }
130+ } else if res != tc .expected .(float32 ) {
127131 t .Errorf ("Expected %v, got %v" , tc .expected , res )
128132 }
129133 }
@@ -195,6 +199,9 @@ func TestFromFloat64WithModeExtra(t *testing.T) {
195199 {"Normal" , 1.0 , ModeIEEE , RoundNearestEven , FromFloat64 (1.0 ), false },
196200 {"Strict Inf" , math .Inf (1 ), ModeStrict , RoundNearestEven , 0 , true },
197201 {"Strict NaN" , math .NaN (), ModeStrict , RoundNearestEven , 0 , true },
202+ {"Overflow" , 70000.0 , ModeIEEE , RoundNearestEven , PositiveInfinity , false },
203+ {"Underflow" , 1e-40 , ModeIEEE , RoundNearestEven , PositiveZero , false },
204+ {"Underflow Strict" , 1e-40 , ModeStrict , RoundNearestEven , 0 , true },
198205 }
199206
200207 for _ , tc := range testCases {
0 commit comments