@@ -789,16 +789,14 @@ Compute ``\\sin(\\pi x)`` more accurately than `sin(pi*x)`, especially for large
789789
790790See also [`sind`](@ref), [`cospi`](@ref), [`sincospi`](@ref).
791791"""
792- function sinpi (_x:: T ) where T<: Union{ IEEEFloat, Rational}
792+ function sinpi (_x:: T ) where T<: IEEEFloat
793793 x = abs (_x)
794794 if ! isfinite (x)
795795 isnan (x) && return x
796796 throw (DomainError (x, " `x` cannot be infinite." ))
797797 end
798798 # For large x, answers are all 1 or zero.
799- if T <: AbstractFloat
800- x >= maxintfloat (T) && return copysign (zero (T), _x)
801- end
799+ x >= maxintfloat (T) && return copysign (zero (T), _x)
802800
803801 # reduce to interval [0, 0.5]
804802 n = round (2 * x)
@@ -820,16 +818,14 @@ end
820818
821819Compute ``\\ cos(\\ pi x)`` more accurately than `cos(pi*x)`, especially for large `x`.
822820"""
823- function cospi (x:: T ) where T<: Union{ IEEEFloat, Rational}
821+ function cospi (x:: T ) where T<: IEEEFloat
824822 x = abs (x)
825823 if ! isfinite (x)
826824 isnan (x) && return x
827825 throw (DomainError (x, " `x` cannot be infinite." ))
828826 end
829827 # For large x, answers are all 1 or zero.
830- if T <: AbstractFloat
831- x >= maxintfloat (T) && return one (T)
832- end
828+ x >= maxintfloat (T) && return one (T)
833829
834830 # reduce to interval [0, 0.5]
835831 n = round (2 * x)
@@ -856,16 +852,14 @@ where `x` is in radians), returning a tuple `(sine, cosine)`.
856852
857853See also: [`cispi`](@ref), [`sincosd`](@ref), [`sinpi`](@ref).
858854"""
859- function sincospi (_x:: T ) where T<: Union{ IEEEFloat, Rational}
855+ function sincospi (_x:: T ) where T<: IEEEFloat
860856 x = abs (_x)
861857 if ! isfinite (x)
862858 isnan (x) && return x, x
863859 throw (DomainError (x, " `x` cannot be infinite." ))
864860 end
865861 # For large x, answers are all 1 or zero.
866- if T <: AbstractFloat
867- x >= maxintfloat (T) && return (copysign (zero (T), _x), one (T))
868- end
862+ x >= maxintfloat (T) && return (copysign (zero (T), _x), one (T))
869863
870864 # reduce to interval [0, 0.5]
871865 n = round (2 * x)
@@ -895,7 +889,7 @@ Compute ``\\tan(\\pi x)`` more accurately than `tan(pi*x)`, especially for large
895889
896890See also [`tand`](@ref), [`sinpi`](@ref), [`cospi`](@ref), [`sincospi`](@ref).
897891"""
898- function tanpi (_x:: T ) where T<: Union{ IEEEFloat, Rational}
892+ function tanpi (_x:: T ) where T<: IEEEFloat
899893 # This is modified from sincospi.
900894 # Would it be faster or more accurate to make a tanpi_kernel?
901895 x = abs (_x)
@@ -905,9 +899,7 @@ function tanpi(_x::T) where T<:Union{IEEEFloat, Rational}
905899 end
906900 # For large x, answers are all zero.
907901 # All integer values for floats larger than maxintfloat are even.
908- if T <: AbstractFloat
909- x >= maxintfloat (T) && return copysign (zero (T), _x)
910- end
902+ x >= maxintfloat (T) && return copysign (zero (T), _x)
911903
912904 # reduce to interval [0, 0.5]
913905 n = round (2 * x)
@@ -932,10 +924,10 @@ cospi(x::Integer) = isodd(x) ? -one(float(x)) : one(float(x))
932924tanpi (x:: Integer ) = x >= 0 ? (isodd (x) ? - zero (float (x)) : zero (float (x))) :
933925 (isodd (x) ? zero (float (x)) : - zero (float (x)))
934926sincospi (x:: Integer ) = (sinpi (x), cospi (x))
935- sinpi (x:: Real ) = sin (pi * x)
936- cospi (x:: Real ) = cos (pi * x)
937- sincospi (x:: Real ) = sincos (pi * x)
938- tanpi (x:: Real ) = tan (pi * x)
927+ sinpi (x:: AbstractFloat ) = sin (pi * x)
928+ cospi (x:: AbstractFloat ) = cos (pi * x)
929+ sincospi (x:: AbstractFloat ) = sincos (pi * x)
930+ tanpi (x:: AbstractFloat ) = tan (pi * x)
939931tanpi (x:: Complex ) = sinpi (x) / cospi (x) # Is there a better way to do this?
940932
941933function sinpi (z:: Complex{T} ) where T
0 commit comments