Herbie: Automatically improve imprecise floating point formulas (herbie.uwplse.org)

The Herbie tutorial explains how the tool rewrites floating-point expressions to improve numerical accuracy, showing both a simple example and a more realistic workflow. It walks through locating a buggy math expression in math.js, translating complex-number square-root code into Herbie-friendly inputs, and using Herbie’s alternatives to produce a more accurate implementation using techniques like cancellation handling and hypot. The guide also notes that Herbie can trade accuracy for speed and provides derivations and options for applying results back in code.

April 04, 2026 07:54 Source: Hacker News