Hi!
As far as I understand Alexandria uses approximate formula for subfactorial, and it became wrong very fast. Subfactorial of 10 is correct, but for 11 it's wrong.
alexandria exact 11 14684571 14684570 12 176214848 176214841 13 2290792960 2290792932
I've found that it's floating point rounding error. Changing (exp 1) to (exp 1d0) fixes the problem for numbers below 19.
But I think 18 is still too small for a library. It could be just predefined constants table with more success. Maybe subfactorial should be rewritten to give exact answers? (at least (exp 1) should be changed to (exp 1d0) ASAP, I believe, because otherwise subfactorial gives wrong answers even for 11).
On Sun, Jan 23, 2011 at 12:07 AM, Sergey Dymchenko kit1980@gmail.com wrote:
Hi!
As far as I understand Alexandria uses approximate formula for subfactorial, and it became wrong very fast. Subfactorial of 10 is correct, but for 11 it's wrong.
alexandria exact 11 14684571 14684570 12 176214848 176214841 13 2290792960 2290792932
alexandria-devel@common-lisp.net