rust-num / num-integer

Integer trait and functions for Rust
Apache License 2.0
180 stars 48 forks source link

`binomial(n, k)` for `n < 0` #56

Open ronnodas opened 11 months ago

ronnodas commented 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.