Skip to content

Commit

Permalink
return integer type with same precision
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonschaub committed May 12, 2020
1 parent e5e57f6 commit ad2cb25
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions base/special/trig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -860,8 +860,10 @@ function cospi(x::T) where T<:Union{Integer,Rational}
end
end

sinpi(x::Integer) = 0
cospi(x::Integer) = isodd(x) ? -1 : 1
sinpi(x::T) where {T<:Integer} = zero(signed(T))
sinpi(x::Bool) = 0
cospi(x::T) where {T<:Integer} = isodd(x) ? one(signed(T)) : -one(signed(T))
cospi(x::Bool) = x ? -1 : 1
sinpi(x::Real) = sinpi(float(x))
cospi(x::Real) = cospi(float(x))

Expand Down

0 comments on commit ad2cb25

Please sign in to comment.