Hi all,
Currently the behaviour of perm with exact=True
is inconsistent with the other combinatorial functions. Specifically, floats sometimes cause an error and sometimes produce an output:
In [4]: perm(4.6, 6, exact=True)
Out[4]: 0
In [5]: perm(4.6, 3, exact=True)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[5], line 1
----> 1 perm(4.6, 3, exact=True)
File ~/development/scipy/build-install/lib/python3.11/site-packages/scipy/special/_basic.py:2797, in perm(N, k, exact)
2795 return 0
2796 val = 1
-> 2797 for i in range(N - k + 1, N + 1):
2798 val *= i
2799 return val
TypeError: 'float' object cannot be interpreted as an integer
I have opened a PR to deprecate this behaviour; please feel free to discuss.
Jake