This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Base.Math: significand_bits,exponent_bias | |
@inline exp_kernel(x::Float64) = evalpoly(x, (1.0, 1.0, .5, .1666666666666666666)) | |
const J_TABLE = Float64[2^((j-1)/1024) for j in 1:1024] | |
function myexp(x::T) where T<:Float64 | |
# Negation so NaN gets caught | |
if !(abs(x) < 708.3964185322641) | |
x <= -708.3964185322641 && return 0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Base.Math: rem_pio2_kernel, sin_kernel, cos_kernel | |
function nansin(x::T) where T<:Union{Float64} | |
absx = abs(x) | |
if absx < T(pi)/4 #|x| ~<= pi/4, no need for reduction | |
if absx < sqrt(eps(T)) | |
return x | |
end | |
return sin_kernel(x) | |
elseif isnan(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Base.Math: rem_pio2_kernel, sin_kernel, cos_kernel | |
function nansin(x::T) where T<:Union{Float64} | |
absx = abs(x) | |
if absx < T(pi)/4 #|x| ~<= pi/4, no need for reduction | |
if absx < sqrt(eps(T)) | |
return x | |
end | |
return sin_kernel(x) | |
elseif isnan(x) |
OlderNewer