From 9fcc63faf73eaab08e972ab4cc47076bc01438a0 Mon Sep 17 00:00:00 2001 From: Gabriel Baraldi Date: Tue, 8 Aug 2023 22:05:29 -0300 Subject: [PATCH] Change dispatch logic slightly --- base/math.jl | 2 +- base/special/trig.jl | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/base/math.jl b/base/math.jl index 71bd4949498b5..0f917dce7c99c 100644 --- a/base/math.jl +++ b/base/math.jl @@ -1571,7 +1571,7 @@ sincos(a::Float16) = Float16.(sincos(Float32(a))) for f in (:sin, :cos, :tan, :asin, :atan, :acos, :sinh, :cosh, :tanh, :asinh, :acosh, :atanh, :exp, :exp2, :exp10, :expm1, :log, :log2, :log10, :log1p, - :exponent, :sqrt, :cbrt) + :exponent, :sqrt, :cbrt, :sinpi, :cospi, :sincospi, :tanpi) @eval function ($f)(x::Real) xf = float(x) x === xf && throw(MethodError($f, (x,))) diff --git a/base/special/trig.jl b/base/special/trig.jl index c9ae219769b27..7af954df7de01 100644 --- a/base/special/trig.jl +++ b/base/special/trig.jl @@ -932,10 +932,10 @@ cospi(x::Integer) = isodd(x) ? -one(float(x)) : one(float(x)) tanpi(x::Integer) = x >= 0 ? (isodd(x) ? -zero(float(x)) : zero(float(x))) : (isodd(x) ? zero(float(x)) : -zero(float(x))) sincospi(x::Integer) = (sinpi(x), cospi(x)) -sinpi(x::Real) = sin(pi*x) -cospi(x::Real) = cos(pi*x) -sincospi(x::Real) = sincos(pi*x) -tanpi(x::Real) = tan(pi*x) +sinpi(x::AbstractFloat) = sin(pi*x) +cospi(x::AbstractFloat) = cos(pi*x) +sincospi(x::AbstractFloat) = sincos(pi*x) +tanpi(x::AbstractFloat) = tan(pi*x) tanpi(x::Complex) = sinpi(x) / cospi(x) # Is there a better way to do this? function sinpi(z::Complex{T}) where T