Skip to content

Commit c8b8b6c

Browse files
committed
disable fma on Windows
See #31.
1 parent 797f3e8 commit c8b8b6c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/Quadmath.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,12 @@ atan(x::Float128, y::Float128) =
348348
sincos(x::Float128) = (sin(x), cos(x))
349349

350350
## misc
351-
fma(x::Float128, y::Float128, z::Float128) =
352-
Float128(@ccall(libquadmath.fmaq(x::Cfloat128, y::Cfloat128, z::Cfloat128)::Cfloat128))
351+
@static if !Sys.iswindows()
352+
# disable fma on Windows until rounding mode issue fixed
353+
# https://github.com/JuliaMath/Quadmath.jl/issues/31
354+
fma(x::Float128, y::Float128, z::Float128) =
355+
Float128(@ccall(libquadmath.fmaq(x::Cfloat128, y::Cfloat128, z::Cfloat128)::Cfloat128))
356+
end
353357

354358
isnan(x::Float128) = 0 != @ccall(libquadmath.isnanq(x::Cfloat128)::Cint)
355359
isinf(x::Float128) = 0 != @ccall(libquadmath.isinfq(x::Cfloat128)::Cint)

test/runtests.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ end
121121
@test abs(x) == x
122122
@test hypot(Float128(3),Float128(4)) == Float128(5)
123123
@test atan(x,x) Float128(pi) / 4
124-
@test fma(x,x,Float128(-1.0)) Float128(1)
124+
if !Sys.iswindows()
125+
@test fma(x,x,Float128(-1.0)) Float128(1)
126+
end
125127
end
126128
@testset "complex" begin
127129
x = sqrt(ComplexF128(1.0 + 1.0im))

0 commit comments

Comments
 (0)