Skip to content

Commit 642c1de

Browse files
Explicit NaN case for erf(Float64)
Co-authored-by: David Müller-Widmann <[email protected]>
1 parent 693f788 commit 642c1de

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/erf.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,10 @@ function _erf(x::Float64)
200200

201201
r=1.0-evalpoly(a,PF)
202202
return copysign(r,x)
203+
elseif isnan(x)
204+
return NaN
203205
else
204-
if(isnan(x))
205-
return NaN
206-
end
207-
copysign(1.0,x)
206+
return copysign(1.0,x)
208207
end
209208
end
210209

0 commit comments

Comments
 (0)