Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Anyone know offhand what the minimum value of n is for which this fails due to floating point inaccuracies?


Javascript doesn't have more than one number data type. This algorithm may fail earlier due to loss of precision from the way JS does exponentiation or sqrt or some such but even a purely additive method will fail due to floating point inaccuracies as well.

Edit: On an in-browser test with Chrome I get accurate values up to 75 with the closed form function and accurate values up to n=78 for the recursive / additive function.




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

Search: