File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 62
62
"""
63
63
$(SIGNATURES)
64
64
65
- Return `x * exp(y)` for `y > -Inf`, or zero if `y == -Inf`.
65
+ Return `x * exp(y)` for `y > -Inf`, or zero if `y == -Inf` or if `x == 0` and `y` is finite .
66
66
67
67
```jldoctest
68
68
julia> xexpy(1.0, -Inf)
@@ -72,7 +72,7 @@ julia> xexpy(1.0, -Inf)
72
72
function xexpy (x:: Real , y:: Real )
73
73
expy = exp (y)
74
74
result = x * expy
75
- return iszero (expy) && ! isnan (x) ? zero (result) : result
75
+ return ( iszero (x) && isfinite (y)) || ( iszero ( expy) && ! isnan (x) ) ? zero (result) : result
76
76
end
77
77
78
78
# The following bounds are precomputed versions of the following abstract
Original file line number Diff line number Diff line change 73
73
for x in (randn (), randn (Float32))
74
74
@test xexpy (x, x) ≈ xexpx (x)
75
75
end
76
+ @test xexpy (0 , 1000 ) == 0.0
77
+ @test isnan (xexpy (0 , Inf ))
78
+ @test isnan (xexpy (0 , NaN ))
76
79
end
77
80
78
81
@testset " logistic & logit" begin
You can’t perform that action at this time.
0 commit comments