Skip to content

Commit e30c30e

Browse files
mdhabersteppi
andcommitted
MAINT: special.hankel2: fix edge case (#21577)
* MAINT: special.hankel2: fix edge case * Apply suggestions from code review Co-authored-by: Albert Steppi <[email protected]> * Update scipy/special/tests/test_basic.py --------- Co-authored-by: Albert Steppi <[email protected]>
1 parent 86b7903 commit e30c30e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

scipy/special/xsf/bessel.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,11 @@ inline std::complex<double> cyl_hankel_2(double v, std::complex<double> z) {
11721172
if (isnan(v) || isnan(z.real()) || isnan(z.imag())) {
11731173
return cy;
11741174
}
1175+
if (v == 0 && z == 0.0) {
1176+
cy.real(NAN);
1177+
cy.imag(INFINITY);
1178+
return cy;
1179+
}
11751180
if (v < 0) {
11761181
v = -v;
11771182
sign = -1;

0 commit comments

Comments
 (0)