Open ronnodas opened 11 months ago
This would be a breaking change either way, but binomial(n, k) with n < 0 should either produce (-1).pow(k) * binomial(k - n - 1, k) = n(n-1)...(n-k +1)/k! or n and k should be unsigned. See eg https://en.wikipedia.org/wiki/Binomial_coefficient#Generalization_and_connection_to_the_binomial_series.
binomial(n, k)
n < 0
(-1).pow(k) * binomial(k - n - 1, k) = n(n-1)...(n-k +1)/k!
n
k
This would be a breaking change either way, but
binomial(n, k)
withn < 0
should either produce(-1).pow(k) * binomial(k - n - 1, k) = n(n-1)...(n-k +1)/k!
orn
andk
should be unsigned. See eg https://en.wikipedia.org/wiki/Binomial_coefficient#Generalization_and_connection_to_the_binomial_series.