[SciPy-Dev] Argument casts in special functions
Pauli Virtanen
pav at iki.fi
Sat Oct 20 09:04:23 EDT 2012
Hi,
Related to: https://github.com/scipy/scipy/pull/334
Currently we have the following behavior for the integer-order
Bessel function:
from scipy.special import yn
print yn(1, 0.123) # -> -5.2816754510498471
print yn(1.5, 0.123) # -> -5.2816754510498471
That is, the floating point argument is silently truncated
to an integer.
This is not so optimal: the more strict behavior would be to
return a `nan` to signify the domain error.
The question now is: is it worth preserving the old behavior
of the existing functions?
My guess would be yes, but I think the unsafe casts should be
used just as a legacy special case, and not as a general rule.
(Also, the integer-order functions could be deprecated --- there
is no speed advantage in them as the kernel selection can be done
based on input / input data type).
--
Pauli Virtanen
More information about the SciPy-Dev
mailing list