Synthesis for floating-point expressions
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src Bound the accuracy of binary search, given how slow it is Jun 14, 2018


Build Status

Herbie synthesizes floating-point programs from real-number programs, automatically handling simple numerical instabilities. Visit our website for tutorials, documentation, and an online demo. Herbie has semi-regular releases twice a year, maintains backwards compatibility, and uses standardized formats.


For full details on installing Herbie, please see the tutorial.

Herbie requires Racket 6.7 or later, and supports Windows, OS X, and Linux. Install it with:

raco pkg install herbie

This will install a herbie binary to somewhere in your home directory. You can also run src/herbie.rkt directly instead of using the herbie command, for example if you'd like to download the source directly instead of through the package manager.

Running Herbie

For full details on running Herbie, please see the tutorial.

Herbie's input is a Scheme-based language called FPCore; you can several examples in bench/. For example, consider this simple expression:

(FPCore (x)
  (- (+ 1 x) x))

Run Herbie from the top-level directory of the repo, and enter the cancellation test:

$ herbie shell
Herbie 1.2 with seed #(349461420 3681359142 2680361770 2900531005 1939065059 1779362427)
Find help on <>, exit with Ctrl-D
herbie> (FPCore (x) (- (+ 1 x) x))
(FPCore (x) ... 1)

The output is Herbie's improved, more-accurate expression, in this case the constant 1.

Besides the shell, Herbie also has a web interface, and can run on files of FPCore expressions with the improve and report commands. Consult the documentation. for more.

Helping Out

Herbie development is organized on our mailing list where we discuss work in progress and announce major improvements. Email us to get involved!

We use Github and Trello to organize some development goals.

Running Tests

Herbie contains unit tests to test basic functionality, though coverage is far from complete. You can run the test suite with:

raco test src/

Herbie also contains a large integration suite from open source projects, examples emailed to the developers, and from numerical analysis textbooks. This suite is found in bench/. The full test can be run with

herbie report bench/ graphs/

The output is an HTML report in graphs/. This full test can take several hours to run. We often test Herbie on basic but representative examples with:

herbie report bench/hamming/ graphs/

This takes approximately 15 minutes.

Historic and nightly test results are collected on