4 ms·
An interesting tool to help preserve floating point precision is Herbie (https://herbie.uwplse.org/ https://herbie.uwplse.org/), which takes an expression as in
by vlmutolo 5y ago
An interesting tool to help preserve floating point precision is Herbie (https://herbie.uwplse.org/ https://herbie.uwplse.org/), which takes an expression as input and outputs an optimized version of it that will retain precision.
The example they give on their site is:
sqrt(x+1) - sqrt(x) => 1/(sqrt(x+1) + sqrt(x))
- klysm 5y agoThis tool is a really cool mix of hard math and soft reality. You need some pretty advanced tools to symbolically manipulate expressions like this, and then it takes the results and throws it on the wall to see what sticks best.
- dekhn 5y agodoes it generate erfc(x) from 1-erf(x)?
- vlmutolo 5y agoApparently it does. http://herbie.uwplse.org/demo/042341d0fe3004d56ba86a30344299e5e258e053.ea9754c765d6f2e3443236047de835c7bf56f0de/graph.html http://herbie.uwplse.org/demo/042341d0fe3004d56ba86a30344299...
- deleted 5y ago[deleted]
- gruez 5y agoI'm glad that there's a tool to automatically do this. When I was in university, this was something that was on tests/assignments.
- aSanchezStern 5y agoFor those curious, this tool uses arbitrary precision floating-point arithmetic (up to 3000 bits) to sample the input space and measure the error of different implementations of the function, then some clever numerical program synthesis to generate candidates and search for the most accurate implementation.
- jl2718 5y agoSeems like this should be solvable with something like symbolic manipulation or (e.g. Taylor) series expansion.
- voxl 5y agoIt is, there is an entire field called Numerical Analysis about this, but instead of spending a year learning numerical analysis throwing it at a tool that spits out something pretty decent after 15 minutes is probably a better ROI.