The Browser UI

Herbie rewrites floating point expressions to make them more accurate. Herbie can be used from the command-line or from the browser; this page is about 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. The web shell is the friendliest and easiest way to use Herbie. Run the Herbie web shell with this command:

racket -l herbie web

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

racket -l herbie web
Herbie 2.1 with seed 1003430182
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.
A screenshot of the Herbie web shell main page.

You can type an input expressions in standard mathematical syntax. After typing in an expression, you will be asked to specify the range of values for each input variable that Herbie should consider when trying to improve the expression. Hit the "Improve with Herbie" button once you're done to run Herbie.

The web shell reports Herbie's progress and redirects to a report once Herbie is done.

The web shell can also automatically save the generated reports, and has many other options you might want to explore.

Batch report generation

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

racket -l herbie report bench/tutorial.fpcore output/ 
Starting Herbie on 3 problems (seed: 770126425)...
Warning: 25.0% of points produce a very large (infinite) output. 
You may want to add a precondition.
See https://herbie.uwplse.org/doc/latest/faq.html#inf-points for 
more.
  1/3   [   0.703s]   29→ 0     Expanding a square
  2/3   [   1.611s]    0→ 0     Commute and associate
  3/3   [   0.353s]   30→ 0     Cancel like terms

This command generates a report from the input expressions in bench/tutorial.fpcore and saves the report in the directory output/. It's best if that directory doesn't exist before running this command, because otherwise Herbie may overwrite files in that directory.

Occasionally you may also see Herbie emit warnings as shown above. All of Herbie's warnings are listed, with explanations, in the FAQ.

The report Herbie generates is in HTML format so you'll need to start a web server. If you have Python installed, that's particularly convenient:

python3 -m http.server -d output

Then go to localhost:8000 in your favorite browser. The report summarizes Herbie's results for all expression in your input file, and you can click on individual expressions to see Herbie's output for them.

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.