Skip to content

Commit

Permalink
Merge pull request #40 from musm/patch-1
Browse files Browse the repository at this point in the history
Revert addition of new `y` variable before return statements
  • Loading branch information
musm committed Aug 6, 2017
2 parents e6c7269 + cb27029 commit 2191e75
Showing 1 changed file with 14 additions and 21 deletions.
35 changes: 14 additions & 21 deletions src/sincosint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ using Base.Math.@horner
function sinint(x::Float64)
t = x*x
if t 36.0
y = (x * @horner(t, 1.00000000000000000000E0,
return x * @horner(t, 1.00000000000000000000E0,
-0.44663998931312457298E-1,
0.11209146443112369449E-2,
-0.13276124407928422367E-4,
Expand All @@ -33,11 +33,10 @@ function sinint(x::Float64)
0.54747121846510390750E-9,
0.10378561511331814674E-11,
0.13754880327250272679E-14,
0.10223981202236205703E-17))
return y
0.10223981202236205703E-17)
elseif t 144.0
invt = inv(t)
y = (copysign/2, x) - cos(x) *
return copysign/2, x) - cos(x) *
@horner(invt, 0.99999999962173909991E0,
0.36451060338631902917E3,
0.44218548041288440874E5,
Expand Down Expand Up @@ -71,11 +70,10 @@ function sinint(x::Float64)
0.62273134702439012114E10,
0.54570971054996441467E11,
0.18241750166645704670E12,
0.15407148148861454434E12))
return y
0.15407148148861454434E12)
elseif t < Inf
invt = inv(t)
y = (copysign/2, x) - cos(x) / x * (1.0 -
return copysign/2, x) - cos(x) / x * (1.0 -
@horner(invt, 0.19999999999999978257E1,
0.22206119380434958727E4,
0.84749007623988236808E6,
Expand Down Expand Up @@ -109,8 +107,7 @@ function sinint(x::Float64)
0.26028585666152144496E13,
0.85134283716950697226E14,
0.11304079361627952930E16,
0.42519841479489798424E16)*invt))
return y
0.42519841479489798424E16)*invt)
elseif isnan(x)
return NaN
else
Expand All @@ -125,7 +122,7 @@ function cosint(x::Float64)
if x < 0.0
throw(DomainErrorNoArgs)
elseif x 3.0
y = (log(x/r0) + ((x - r01) - r02) * (x + r0) *
return log(x/r0) + ((x - r01) - r02) * (x + r0) *
@horner(t, -0.24607411378767540707E0,
0.72113492241301534559E-2,
-0.11867127836204767056E-3,
Expand All @@ -137,10 +134,9 @@ function cosint(x::Float64)
0.78168450570724148921E-4,
0.29959200177005821677E-6,
0.73191677761328838216E-9,
0.94351174530907529061E-12))
return y
0.94351174530907529061E-12)
elseif x 6.0
y = (log(x/r1) + ((x - r11) - r12) * (x + r1) *
return log(x/r1) + ((x - r11) - r12) * (x + r1) *
@horner(t, -0.15684781827145408780E0,
0.66253165609605468916E-2,
-0.12822297297864512864E-3,
Expand All @@ -155,11 +151,10 @@ function cosint(x::Float64)
0.13544922659627723233E-6,
0.27715365686570002081E-9,
0.37718676301688932926E-12,
0.27706844497155995398E-15))
return y
0.27706844497155995398E-15)
elseif x 12.0
invt = inv(t)
y = (sin(x) * @horner(invt, 0.99999999962173909991E0,
return sin(x) * @horner(invt, 0.99999999962173909991E0,
0.36451060338631902917E3,
0.44218548041288440874E5,
0.22467569405961151887E7,
Expand Down Expand Up @@ -192,11 +187,10 @@ function cosint(x::Float64)
0.62273134702439012114E10,
0.54570971054996441467E11,
0.18241750166645704670E12,
0.15407148148861454434E12))
return y
0.15407148148861454434E12)
elseif x < Inf
invt = inv(t)
y = (sin(x)/x * (1.0 - @horner(invt, 0.19999999999999978257E1,
return sin(x)/x * (1.0 - @horner(invt, 0.19999999999999978257E1,
0.22206119380434958727E4,
0.84749007623988236808E6,
0.13959267954823943232E9,
Expand Down Expand Up @@ -229,8 +223,7 @@ function cosint(x::Float64)
0.26028585666152144496E13,
0.85134283716950697226E14,
0.11304079361627952930E16,
0.42519841479489798424E16)*invt))
return y
0.42519841479489798424E16)*invt)
elseif isnan(x)
return NaN
else
Expand Down

0 comments on commit 2191e75

Please sign in to comment.