Skip to content

Commit 57bbaf2

Browse files
committed
added NaN edge case to erf(x::Float32)
1 parent b819c58 commit 57bbaf2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/erf.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,17 @@ function _erf(x::Float32)
288288

289289

290290
else
291-
# |x| >= 4.0.
292-
r=copysign(1f0,x)
293-
end
291+
# |x| >= 4.0.
292+
293+
if(isnan(x))
294+
return NaN
295+
end
296+
297+
r=copysign(1f0,x)
298+
294299
return r
295300

301+
end
296302

297303
end
298304

0 commit comments

Comments
 (0)