Skip to content

Commit

Permalink
Merge pull request #107 from saschatimme/polynomials
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreySarnoff committed May 8, 2020
2 parents 3e346ff + e98fb28 commit d8e9ff1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
[compat]
GenericSVD = "0"
GenericSchur = "0"
Polynomials = "0"
Polynomials = "0.8, 1"
Quadmath = "0"
Requires = "0, 1.0"
SpecialFunctions = "0"
Expand Down
19 changes: 9 additions & 10 deletions src/math/elementary/trig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ function tan(x::Double64)
isnan(x) && return x
isinf(x) && throw(DomainError("tan(x) only defined for finite x"))
abs(HI(x)) >= 0.36815538909255385 && return Double64(tan(Float128(x))) # (15/128 * pi)

abs(mod1pi(x-Double64(pi)/2)) <= eps(one(DoubleFloat{Float64})) && return DoubleFloat{Float64}(Inf)
iszero(x) && return zero(typeof(x))
!isfinite(x) && return nan(typeof(x))
Expand Down Expand Up @@ -287,8 +287,8 @@ const tan0qrtrpi_denomcoeffs = [
Double64(1.5859442637424446e-9, 6.30689666197131e-26)
];

const tan0qrtrpi_numerpoly = Poly(tan0qrtrpi_numercoeffs);
const tan0qrtrpi_denompoly = Poly(tan0qrtrpi_denomcoeffs);
const tan0qrtrpi_numerpoly = Polynomial(tan0qrtrpi_numercoeffs);
const tan0qrtrpi_denompoly = Polynomial(tan0qrtrpi_denomcoeffs);

function tan0qrtrpi(x::Double64)
numer = polyval(tan0qrtrpi_numerpoly, x)
Expand All @@ -298,7 +298,7 @@ end


function csc(x::DoubleFloat{T}) where {T<:IEEEFloat}
isnan(x) && return x
isnan(x) && return x
isinf(x) && throw(DomainError("csc(x) only defined for finite x"))
return inv(sin(x))
end
Expand All @@ -320,8 +320,8 @@ function sinpi(x::DoubleFloat{T}) where {T<:IEEEFloat}
isnan(x) && return x
isinf(x) && throw(DomainError("sinpi(x) only defined for finite x"))
return DoubleFloat{T}(sinpi(Quadmath.Float128(x)))
#=
y = Double64(x)
#=
y = Double64(x)
hi,lo = mul322(pi_1o1_t64, HILO(y))
y = Double64(hi, lo)
z = sin(y)
Expand All @@ -333,8 +333,8 @@ function cospi(x::DoubleFloat{T}) where {T<:IEEEFloat}
isnan(x) && return x
isinf(x) && throw(DomainError("cospi(x) only defined for finite x"))
return DoubleFloat{T}(cospi(Quadmath.Float128(x)))
#=
y = Double64(x)
#=
y = Double64(x)
hi,lo = mul322(pi_1o1_t64, HILO(y))
y = Double64(hi, lo)
z = cos(y)
Expand All @@ -347,11 +347,10 @@ function tanpi(x::DoubleFloat{T}) where {T<:IEEEFloat}
isinf(x) && throw(DomainError("tanpi(x) only defined for finite x"))
return sinpi(x)/cospi(x)
#=
y = Double64(x)
y = Double64(x)
hi,lo = mul322(pi_1o1_t64, HILO(y))
y = Double64(hi, lo)
z = tan(y)
return DoubleFloat{T}(z)
=#
end

0 comments on commit d8e9ff1

Please sign in to comment.