u/samthin r/haskell • Recommends
On “80% of Haskell packages that use floating point expressions contain numerical instabilities. The Herbie GHC Plugin automatically rewrites these expressions into a numerically stable form.”
Neil Toronto (also the author of some of the Racket libraries that Herbie uses) has written about this. He gave a talk at RacketCon about how to do it: link to this video and slides. He also wrote a paper with Jay McCarthy on how to write numerically stable functions: http://www.cs.umd.edu/~ntoronto/papers/toronto-2014cise-floating-point.pdf