Skip to content

Commit

Permalink
Remove unnecessary complexity from the code
Browse files Browse the repository at this point in the history
  • Loading branch information
gbaraldi committed Aug 9, 2023
1 parent 9fcc63f commit c295ecb
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions base/special/trig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -796,9 +796,7 @@ function sinpi(_x::T) where T<:IEEEFloat
throw(DomainError(x, "`x` cannot be infinite."))
end
# For large x, answers are all 1 or zero.
if T <: AbstractFloat
x >= maxintfloat(T) && return copysign(zero(T), _x)
end
x >= maxintfloat(T) && return copysign(zero(T), _x)

# reduce to interval [0, 0.5]
n = round(2*x)
Expand Down Expand Up @@ -827,9 +825,7 @@ function cospi(x::T) where T<:IEEEFloat
throw(DomainError(x, "`x` cannot be infinite."))
end
# For large x, answers are all 1 or zero.
if T <: AbstractFloat
x >= maxintfloat(T) && return one(T)
end
x >= maxintfloat(T) && return one(T)

# reduce to interval [0, 0.5]
n = round(2*x)
Expand Down Expand Up @@ -863,9 +859,7 @@ function sincospi(_x::T) where T<:IEEEFloat
throw(DomainError(x, "`x` cannot be infinite."))
end
# For large x, answers are all 1 or zero.
if T <: AbstractFloat
x >= maxintfloat(T) && return (copysign(zero(T), _x), one(T))
end
x >= maxintfloat(T) && return (copysign(zero(T), _x), one(T))

# reduce to interval [0, 0.5]
n = round(2*x)
Expand Down Expand Up @@ -905,9 +899,7 @@ function tanpi(_x::T) where T<:IEEEFloat
end
# For large x, answers are all zero.
# All integer values for floats larger than maxintfloat are even.
if T <: AbstractFloat
x >= maxintfloat(T) && return copysign(zero(T), _x)
end
x >= maxintfloat(T) && return copysign(zero(T), _x)

# reduce to interval [0, 0.5]
n = round(2*x)
Expand Down

0 comments on commit c295ecb

Please sign in to comment.