Hacker News new | past | comments | ask | show | jobs | submit login
Floating-Point Determinism (2013) (randomascii.wordpress.com)
57 points by antioedipus on June 17, 2018 | hide | past | favorite | 6 comments



I rewrote the main trig functions in Javascript to help with cross browser determinism. They run as quickly as the native math routines while compromising accuracy to around 10 significant digits.

https://github.com/strainer/trigfills


Excellent article. It's so easy to think "same inputs = same outputs" but that's such a simplification. There's so much more in between!


For anyone interested in this sort of thing you'd probably also be interested in John Gustafson's work on unums/posits. Here's a nice introductory presentation https://www.youtube.com/watch?v=aP0Y1uAA-2Y


I’m glad it pointed to the article of the terrible accuracy of the x87 trig functions - the OS X and I assume GCC software implementations are ostensibly correctly accurate, which I think is done by using witchcraft. (More precisely I think they do it using infinite precision Pi?)


Correctly rounded trig functions requires great care, and some way of knowing how much precision you need for the calculations. Doing all of the calculations at the maximum needed precision would be hugely inefficient. A high-precision version of Pi is just one of the things needed.


What I had been told was that they commuted "as if" they had infinite precision pi (rather than reduction modulo some approximation)




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

Search: