Skip to content

Commit 68456c5

Browse files
Fix: return NaN under appropriate conditions
This propagates any signals which happen to be on the `NaN`, mimicking the behavior of OpenLibm (though, I suspect no one depends on signaling `NaN`s being propagated through `logabsgamma`).
1 parent 2c949d7 commit 68456c5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/e_lgamma_r.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function _logabsgamma(x::Float64)
9494
#= purge off +-inf, NaN, +-0, tiny and negative arguments =#
9595
signgam = 1
9696
ix = hx & 0x7fffffff
97-
ix 0x7ff00000 && return Inf, signgam
97+
ix 0x7ff00000 && return x * x, signgam
9898
ix | lx == 0x00000000 && return Inf, signgam
9999
if ix < 0x3b900000 #= |x|<2**-70, return -log(|x|) =#
100100
if hx < Int32(0)

src/e_lgammaf_r.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function _logabsgamma(x::Float32)
2222
#= purge off +-inf, NaN, +-0, tiny and negative arguments =#
2323
signgam = 1
2424
ix = hx & 0x7fffffff
25-
ix 0x7f800000 && return Inf32, signgam
25+
ix 0x7f800000 && return x * x, signgam
2626
ix == 0x00000000 && return Inf32, signgam
2727
if ix < 0x35000000 #= |x|<2**-21, return -log(|x|) =#
2828
if hx < Int32(0)

0 commit comments

Comments
 (0)