@@ -1289,29 +1289,32 @@ end
12891289end
12901290
12911291@testset " fma" begin
1292- if ! (@static Sys. iswindows () && Int=== Int64) # windows fma currently seems broken somehow.
1293- for func in (fma, Base. fma_emulated)
1294- @test func (nextfloat (1. ),nextfloat (1. ),- 1.0 ) === 4.440892098500626e-16
1295- @test func (nextfloat (1f0 ),nextfloat (1f0 ),- 1f0 ) === 2.3841858f-7
1296- @testset " $T " for T in (Float32, Float64)
1297- @test func (floatmax (T), T (2 ), - floatmax (T)) === floatmax (T)
1298- @test func (floatmax (T), T (1 ), eps (floatmax ((T)))) === T (Inf )
1299- @test func (T (Inf ), T (Inf ), T (Inf )) === T (Inf )
1300- @test func (floatmax (T), floatmax (T), - T (Inf )) === - T (Inf )
1301- @test func (floatmax (T), - floatmax (T), T (Inf )) === T (Inf )
1302- @test isnan_type (T, func (T (Inf ), T (1 ), - T (Inf )))
1303- @test isnan_type (T, func (T (Inf ), T (0 ), - T (0 )))
1304- @test func (- zero (T), zero (T), - zero (T)) === - zero (T)
1305- for _ in 1 : 2 ^ 18
1306- a, b, c = reinterpret .(T, rand (Base. uinttype (T), 3 ))
1307- @test isequal (func (a, b, c), fma (a, b, c)) || (a,b,c)
1308- end
1292+ for func in (fma, Base. fma_emulated)
1293+ @test func (nextfloat (1. ),nextfloat (1. ),- 1.0 ) === 4.440892098500626e-16
1294+ @test func (nextfloat (1f0 ),nextfloat (1f0 ),- 1f0 ) === 2.3841858f-7
1295+ @testset " $T " for T in (Float32, Float64)
1296+ @test func (floatmax (T), T (2 ), - floatmax (T)) === floatmax (T)
1297+ @test func (floatmax (T), T (1 ), eps (floatmax ((T)))) === T (Inf )
1298+ @test func (T (Inf ), T (Inf ), T (Inf )) === T (Inf )
1299+ @test func (floatmax (T), floatmax (T), - T (Inf )) === - T (Inf )
1300+ @test func (floatmax (T), - floatmax (T), T (Inf )) === T (Inf )
1301+ @test isnan_type (T, func (T (Inf ), T (1 ), - T (Inf )))
1302+ @test isnan_type (T, func (T (Inf ), T (0 ), - T (0 )))
1303+ @test func (- zero (T), zero (T), - zero (T)) === - zero (T)
1304+ for _ in 1 : 2 ^ 18
1305+ a, b, c = reinterpret .(T, rand (Base. uinttype (T), 3 ))
1306+ @test isequal (func (a, b, c), fma (a, b, c)) || (a,b,c)
13091307 end
1310- @test func (floatmax (Float64), nextfloat (1.0 ), - floatmax (Float64)) === 3.991680619069439e292
1311- @test func (floatmax (Float32), nextfloat (1f0 ), - floatmax (Float32)) === 4.0564817f31
1312- @test func (1.6341681540852291e308 , - 2. , floatmax (Float64)) == - 1.4706431733081426e308 # case where inv(a)*c*a == Inf
1313- @test func (- 2. , 1.6341681540852291e308 , floatmax (Float64)) == - 1.4706431733081426e308 # case where inv(b)*c*b == Inf
1314- @test func (- 1.9369631f13 , 2.1513551f-7 , - 1.7354427f-24 ) == - 4.1670958f6
13151308 end
1309+ @test func (floatmax (Float64), nextfloat (1.0 ), - floatmax (Float64)) === 3.991680619069439e292
1310+ @test func (floatmax (Float32), nextfloat (1f0 ), - floatmax (Float32)) === 4.0564817f31
1311+ @test func (1.6341681540852291e308 , - 2. , floatmax (Float64)) == - 1.4706431733081426e308 # case where inv(a)*c*a == Inf
1312+ @test func (- 2. , 1.6341681540852291e308 , floatmax (Float64)) == - 1.4706431733081426e308 # case where inv(b)*c*b == Inf
1313+ @test func (- 1.9369631f13 , 2.1513551f-7 , - 1.7354427f-24 ) == - 4.1670958f6
1314+ end
1315+ @static if Sys. iswindows ()
1316+ # TODO : if this pass one day, then we can remove fma hack on windows
1317+ error = @eval Base. fma_float (- 1.9369631f13 , 2.1513551f-7 , - 1.7354427f-24 )
1318+ @test_broken error == fma (- 1.9369631f13 , 2.1513551f-7 , - 1.7354427f-24 )
13161319 end
13171320end
0 commit comments