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 6262"""
6363$(SIGNATURES)
6464
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 .
6666
6767```jldoctest
6868julia> xexpy(1.0, -Inf)
@@ -72,7 +72,7 @@ julia> xexpy(1.0, -Inf)
7272function xexpy (x:: Real , y:: Real )
7373 expy = exp (y)
7474 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
7676end
7777
7878# The following bounds are precomputed versions of the following abstract
Original file line number Diff line number Diff line change 7373 for x in (randn (), randn (Float32))
7474 @test xexpy (x, x) ≈ xexpx (x)
7575 end
76+ @test xexpy (0 , 1000 ) == 0.0
77+ @test isnan (xexpy (0 , Inf ))
78+ @test isnan (xexpy (0 , NaN ))
7679end
7780
7881@testset " logistic & logit" begin
You can’t perform that action at this time.
0 commit comments