Skip to content

Commit

Permalink
Improving ieee754_rem_pio2
Browse files Browse the repository at this point in the history
Fix #22004
  • Loading branch information
yuyichao committed Jul 8, 2017
1 parent 2535e31 commit d2b9c21
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions base/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ function add22condh(xh::Float64, xl::Float64, yh::Float64, yl::Float64)
return zh
end

function ieee754_rem_pio2(x::Float64)
@inline function ieee754_rem_pio2(x::Float64)
# rem_pio2 essentially computes x mod pi/2 (ie within a quarter circle)
# and returns the result as
# y between + and - pi/4 (for maximal accuracy (as the sign bit is exploited)), and
Expand All @@ -754,9 +754,9 @@ function ieee754_rem_pio2(x::Float64)
# this is just wrapping up
# https://github.com/JuliaLang/openspecfun/blob/master/rem_pio2/e_rem_pio2.c

y = [0.0,0.0]
n = ccall((:__ieee754_rem_pio2, openspecfun), Cint, (Float64,Ptr{Float64}), x, y)
return (n,y)
y = Ref{NTuple{2,Float64}}()
n = ccall((:__ieee754_rem_pio2, openspecfun), Cint, (Float64, Ptr{Void}), x, y)
return (n, y[])
end

# multiples of pi/2, as double-double (ie with "tail")
Expand Down

0 comments on commit d2b9c21

Please sign in to comment.