Skip to content

Commit 2911312

Browse files
Added NaN case to erf(Float32)
Co-authored-by: David Müller-Widmann <[email protected]>
1 parent 642c1de commit 2911312

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/erf.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,11 @@ function _erf(x::Float32)
245245
p=(0.00040695202f0, -0.002178284f0, 0.0054457085f0, -0.008350053f0, 0.008622011f0, -0.006115167f0, 0.0027899458f0, -0.000519395f0, -0.00030461047f0, 0.00031068458f0, -0.00013866898f0, 3.6909692f-5, -5.682889f-6, 3.929763f-7)
246246
return copysign(1f0-evalpoly(xabs-2.5f0,p),x)
247247

248+
elseif isnan(x)
249+
return NaN
248250
else
249251
# range [4.0,inf)
250-
r=copysign(1f0,x)
251-
return r
252+
return copysign(1f0, x)
252253
end
253254
end
254255

0 commit comments

Comments
 (0)