Skip to content

Commit 3ae6a80

Browse files
Compare once instead of twice
1 parent e5a823e commit 3ae6a80

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/e_lgammaf_r.jl

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

2222
#= purge off +-inf, NaN, +-0, tiny and negative arguments =#
2323
signgam = 1
24+
isneg = hx < Int32(0)
2425
ix = hx & 0x7fffffff
2526
ix 0x7f800000 && return x * x, signgam
2627
ix == 0x00000000 && return Inf32, signgam
2728
if ix < 0x35000000 #= |x|<2**-21, return -log(|x|) =#
28-
if hx < Int32(0)
29+
if isneg
2930
signgam = -1
3031
return -log(-x), signgam
3132
else
3233
return -log(x), signgam
3334
end
3435
end
35-
if hx < Int32(0)
36+
if isneg
3637
# ix ≥ 0x4b000000 && return Inf32, signgam #= |x|>=2**23, must be -integer =#
3738
t = sinpi(x)
3839
t == 0.0f0 && return Inf32, signgam #= -integer =#
@@ -98,7 +99,7 @@ function _logabsgamma(x::Float32)
9899
#= 2^58 ≤ x ≤ Inf =#
99100
r = muladd(x, log(x), -x)
100101
end
101-
if hx < Int32(0)
102+
if isneg
102103
r = nadj - r
103104
end
104105
return r, signgam

0 commit comments

Comments
 (0)