Skip to content

Commit 90af185

Browse files
squash! Compare once instead of twice
1 parent 3ae6a80 commit 90af185

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/e_lgamma_r.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,19 @@ function _logabsgamma(x::Float64)
9393

9494
#= purge off +-inf, NaN, +-0, tiny and negative arguments =#
9595
signgam = 1
96+
isneg = hx < Int32(0)
9697
ix = hx & 0x7fffffff
9798
ix 0x7ff00000 && return x * x, signgam
9899
ix | lx == 0x00000000 && return Inf, signgam
99100
if ix < 0x3b900000 #= |x|<2**-70, return -log(|x|) =#
100-
if hx < Int32(0)
101+
if isneg
101102
signgam = -1
102103
return -log(-x), signgam
103104
else
104105
return -log(x), signgam
105106
end
106107
end
107-
if hx < Int32(0)
108+
if isneg
108109
# ix ≥ 0x43300000 && return Inf, signgam #= |x|>=2**52, must be -integer =#
109110
t = sinpi(x)
110111
iszero(t) && return Inf, signgam #= -integer =#
@@ -168,7 +169,7 @@ function _logabsgamma(x::Float64)
168169
else #= 2^58 ≤ x ≤ Inf =#
169170
r = muladd(x, log(x), -x)
170171
end
171-
if hx < Int32(0)
172+
if isneg
172173
r = nadj - r
173174
end
174175
return r, signgam

0 commit comments

Comments
 (0)