@@ -8,7 +8,7 @@ import Base: (*), +, -, /, <, <=, ==, ^, convert,
8
8
significand_mask, exponent, significand,
9
9
promote_rule, widen,
10
10
string, print, show, parse,
11
- acos, acosh, asin, asinh, atan, atanh, cosh, cos,
11
+ acos, acosh, asin, asinh, atan, atanh, cosh, cos, sincos,
12
12
exp, expm1, log, log2, log10, log1p, sin, sinh, sqrt,
13
13
tan, tanh,
14
14
ceil, floor, trunc, round, fma,
@@ -41,7 +41,7 @@ macro ccall(expr)
41
41
42
42
expr_call = expr. args[1 ]
43
43
@assert expr_call isa Expr && expr_call. head == :call
44
-
44
+
45
45
expr_fname = expr_call. args[1 ]
46
46
47
47
if expr_fname isa Symbol
@@ -51,9 +51,9 @@ macro ccall(expr)
51
51
end
52
52
53
53
expr_args = expr_call. args[2 : end ]
54
-
55
- @assert all (ex isa Expr && ex. head == :(:: ) for ex in expr_args)
56
-
54
+
55
+ @assert all (ex isa Expr && ex. head == :(:: ) for ex in expr_args)
56
+
57
57
arg_names = [ex. args[1 ] for ex in expr_args]
58
58
arg_types = [ex. args[2 ] for ex in expr_args]
59
59
@@ -65,7 +65,7 @@ macro ccall(expr)
65
65
r = Ref {Cfloat128} ()
66
66
ccall ($ fname, Cvoid, (Ref{Cfloat128}, $ (esc .(arg_types)... ),), r, $ (esc .(arg_names)... ))
67
67
r[]
68
- end
68
+ end
69
69
else
70
70
:(ccall ($ fname, $ (esc (ret_type)), ($ (esc .(arg_types)... ),), $ (esc .(arg_names)... )))
71
71
end
@@ -345,11 +345,15 @@ hypot(x::Float128, y::Float128) =
345
345
Float128 (@ccall (libquadmath. hypotq (x:: Cfloat128 , y:: Cfloat128 ):: Cfloat128 ))
346
346
atan (x:: Float128 , y:: Float128 ) =
347
347
Float128 (@ccall (libquadmath. atan2q (x:: Cfloat128 , y:: Cfloat128 ):: Cfloat128 ))
348
+ sincos (x:: Float128 ) = (sin (x), cos (x))
348
349
349
350
# # misc
350
- fma (x:: Float128 , y:: Float128 , z:: Float128 ) =
351
- Float128 (@ccall (libquadmath. fmaq (x:: Cfloat128 , y:: Cfloat128 , z:: Cfloat128 ):: Cfloat128 ))
352
-
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
353
357
354
358
isnan (x:: Float128 ) = 0 != @ccall (libquadmath. isnanq (x:: Cfloat128 ):: Cint )
355
359
isinf (x:: Float128 ) = 0 != @ccall (libquadmath. isinfq (x:: Cfloat128 ):: Cint )
@@ -366,8 +370,8 @@ precision(::Type{Float128}) = 113
366
370
eps (:: Type{Float128} ) = reinterpret (Float128, 0x3f8f_0000_0000_0000_0000_0000_0000_0000 )
367
371
floatmin (:: Type{Float128} ) = reinterpret (Float128, 0x0001_0000_0000_0000_0000_0000_0000_0000 )
368
372
floatmax (:: Type{Float128} ) = reinterpret (Float128, 0x7ffe_ffff_ffff_ffff_ffff_ffff_ffff_ffff )
369
-
370
373
maxintfloat (:: Type{Float128} ) = Float128 (0x0002_0000_0000_0000_0000_0000_0000_0000 )
374
+
371
375
"""
372
376
Inf128
373
377
0 commit comments