Herbie aims to make floating point problems easier to find and fix.




sqrt(x + 1) - sqrt(x)1/(sqrt(x+1) - sqrt(x))
Herbie can detect inaccurate floating point expressions and gives you more-accurate replacements. The red expression gives inaccurate answers when x > 0; Herbie rewrites it into the green expression, accurate for all x.


The Herbie project provides Herbie and HerbGrind, complementary tools for finding and fixing floating point problems:

rewrites floating point expressions to make them more accurate. Herbie supports all commonly-used floating point functions, and uses a cutting-edge search to identify more-accurate rearrangements of a floating point computation.
analyzes binaries to catch floating point inaccuracies as they occur and extract them for analysis. HerbGrind analyzes binaries directly, detecting problems on realistic workloads and extracting them in a standard format.

The Herbie tools have been used on large numerical computations, mathematical libraries, graphics programs, and embedded systems. It regularly finds subtle floating point issues and produces fixes.

Longer arrows are better. Each arrow measures an improvement in accuracy due to Herbie. Each arrow points from the accuracy of the original program, and to the accuracy of Herbie’s output, in each case on random double-precision inputs.

Herbie Project News

  1. In preparation for the Version 1.0 release, we've renamed the pi and e constants to upper case. This matches libm and should make it a little harder to cause bugs. Herbie will now optimize expressions like (exp 1) to E.
  2. We're proud to announce that we've been collaborating with Prof. Martel and his students to build a common benchmark suite and format for floating point tools. Version 1.0 of Herbie will support only the FPBench format.
  3. Pavel is giving a talk at Google on how Herbie works and what our plans for the future are.
  4. Pavel is giving a talk at MIT on how Herbie works internally.
  5. In preparation for the Version 1.0 release, we've renamed several functions in Herbie to match the libm names. In particular, look out for abs, which is now fabs, and expt, which is now pow.
  6. Pavel is giving a talk at MathWorks on how Herbie works answered questions on how it could be extended.
  7. The Herbie Rust Linter plugs into the Rust compiler to add warnings for numerically unstable expressions, and suggests Herbie's more accurate output as a hint.

  8. The Herbie GHC Plugin by Mike Izbicki automatically runs Herbie on applicable expressions in a Haskell program. He's also scanned all of Stackage LTS-3.5 for numerical inaccuracies with Herbie.
  9. Pavel is giving a Distinguished Paper talk at PLDI’15 on the scientific advances that underpin Herbie.
  10. Zach is giving a talk at Berkeley on how we plan to improve floating point accuracy with Herbie.

  11. Pavel is giving a talk at OPLSS on whether floating point accuracy can be improved, and our plans for finding out.
  12. Pavel is giving a lightning talk on a new project to improve the accuracy of floating point expressions.
  13. Pavel is giving a talk on at Dropbox on a new project to improve the accuracy of floating point expressions. (video)


Blog posts about Herbie

The Herbie Developers

Herbie is chiefly developed by the University of Washington Programming Languages and Software Engineering group, with contributions from a supportive community. The main contributors are:

  1. Pavel Panchekha
  2. Alex Sanchez-Stern
  3. Chen Qiu
  4. Jack Firth
  5. James R. Wilcox
  6. Zachary Tatlock