Using Herbie from the Browser

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.

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

The Herbie web shell

The Herbie web shell lets you interact with Herbie through your browser, featuring a convenient input format. Run the Herbie web shell:

herbie web

After a few seconds, the web shell will rev up and direct your browser to Herbie:

herbie web
Herbie 1.3 with seed 841489305
Find help on https://herbie.uwplse.org/, exit with Ctrl-C
Your Web application is running at http://localhost:8000/.
Stop this program at any time to terminate the Web Server.
The Herbie web shell.

You can type expressions in standard mathematical syntax (parsed by Math.js), and hit Enter to have Herbie attempt to improve them.

Herbie shows improvement logs as it works.

The web shell will print Herbie's progress, and redirect to a report once Herbie is done.

Interactive use of the web shell is the friendliest and easiest way to use Herbie. The web shell has many options, including automatically saving the generated reports.

Batch report generation

A report can also be generated directly from a file of input expressions:

$ herbie report input.fpcore output/
Starting Herbie on 3 problems (seed: 1201949741)...
  1/3	[  22.014s]   39→ 0	Expanding a square
  2/3	[   8.616s]    0→ 0	Commute and associate
  3/3	[   1.715s]   29→ 0	Cancel like terms

This command asks Herbie to generate a report from the input expressions in input.fpcore and save the report in the directory output/, which ought not exist yet. The printed seed can be used to reproduce a run of Herbie.

Once generated, open the output/results.html page in your favorite browser (but see the FAQ if you're using Chrome). From that page, you can click on the rows in the table at the bottom to see the report for that expression.

Batch report generation is the most informative way to run Herbie on a large collection of inputs. Like the web shell, it can be customized through command-line options, including parallelizing Herbie with multiple threads.