Hacker News new | past | comments | ask | show | jobs | submit login
Why does factorial(21) equal -4249290049419214848? (johnmyleswhite.com)
3 points by adambom on Feb 28, 2013 | hide | past | favorite | 3 comments



Factorial, not fib


Although fib grows exponentially, so it does the same for not so big numbers (a back-of-an-envelope calculation gives me that fib(91) doesn't fit in 63 bits).

OTOH, if I had to calculate fib(X), and not fib(1..X), I'd use the exponential formula (relying on floating point) instead of the recurrence (which uses integer), so I guess the error would be detected at the conversion to integer.


Whoops.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: