Skip to content

Commit 1765ff3

Browse files
committed
eliminate common subexpression
1 parent 6a32963 commit 1765ff3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

base/special/trig.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,8 @@ See also [`sinc`](@ref).
11051105
"""
11061106
cosc(x::Number) = _cosc(float(x))
11071107
function _cosc_generic(x)
1108-
((pi*x)*cospi(x)-sinpi(x))/((pi*x)*x)
1108+
pi_x = pi * x
1109+
(pi_x*cospi(x)-sinpi(x))/(pi_x*x)
11091110
end
11101111
function _cosc(x::Number)
11111112
# naive cosc formula is susceptible to catastrophic

0 commit comments

Comments
 (0)