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.

Start the Herbie web shell by running:

racket -l herbie web

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

racket -l herbie web
Starting Herbie 2.2 with seed 1003430182
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. Once you're done, hit the "Improve with Herbie" button 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 an input file in FPCore format:

racket -l herbie report bench/tutorial.fpcore output/ 
Starting Herbie 2.2 with 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.8s]   55% → 100%	Expanding a square
  2/3	[   0.8s]  100% → 100%	Commute and associate
  3/3	[   0.9s]   53% → 100%	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 Herbie will emit warnings, just like in the example above. All of Herbie's warnings are documented, with explanations and suggested fixes.

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 best 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.