Herbie rewrites floating point expressions to
make them more accurate. The expressions could come from
anywhere—your source code, mathematical papers, or even the output
of Herbgrind, our tool for
finding inaccurate expressions in binaries. This tutorial runs
Herbie on the benchmark programs that Herbie ships with.

Herbie can be used from the command-line
or from the browser. This page covers
using Herbie from the command line.

Input expressions

Herbie ships a collection of benchmarks in its bench/
directory. For example, bench/tutorial.fpcore
contains the following code:

(FPCore (x)
:name "Cancel like terms"
(- (+ 1 x) x))
(FPCore (x)
:name "Expanding a square"
(- (sqr (+ x 1)) 1))
(FPCore (x y z)
:name "Commute and associate"
(- (+ (+ x y) z) (+ x (+ y z))))

This code defines three floating point expressions that we want
to run Herbie on: