Skip to content

Commit 7c23abd

Browse files
authored
BUG: expi returns NaN upon calling sc.expi(inf) (#66)
1 parent 46b9c28 commit 7c23abd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

include/xsf/expint.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ XSF_HOST_DEVICE inline double expi(double x) {
149149
}
150150
}
151151
ei = ga + std::log(x) + x * ei;
152+
} else if (std::isinf(x)) {
153+
// Special use-case needed because exp(inf) / inf is undefined/NaN
154+
return std::numeric_limits<double>::infinity();
152155
} else {
153156
// Asymptotic expansion (the series is not convergent)
154157
ei = 1.0;

0 commit comments

Comments
 (0)