NOW LET US – AI RAG SaaS Studio TP.HCM
NOW LET US
Digital Product Studio
Back to news
DEV-TOOLS...1 min read

Herbie: Automatically improve imprecise floating point formulas

Share
NOW LET US Article – Herbie: Automatically improve imprecise floating point formulas

Herbie is a tool that automatically rewrites floating-point expressions to improve their accuracy and performance, helping developers fix mysterious numerical inaccuracies.

Herbie rewrites floating point expressions to make them more accurate. Floating point arithmetic is inaccurate; even 0.1 + 0.2 != 0.3 in floating-point. Herbie helps find and fix these mysterious inaccuracies.

To get started, download and install Herbie. You're then ready to begin using it. Start Herbie with racket -l herbie web. After a brief wait, your web browser should open and show you Herbie's main window.

Let's start by looking at an example: sqrt(x + 1) - sqrt(x) with x ranging from 0 to 1.79e308. After clicking "Improve with Herbie", you'll see results showing that Herbie's most accurate alternative has an accuracy of 99.7%, much better than the initial 53.2%, and is also 1.9x faster.

You can use Herbie on expressions from source code, mathematical models, or debugging tools. For instance, in bug 208 of math.js, Herbie was used to fix inaccurate square roots for complex numbers. By extracting the mathematical kernel and feeding it to Herbie, developers can identify where accuracy drops (e.g., when inputs exceed 1e150).

Herbie's suggested alternatives often use if statements to handle cancellation and functions like hypot to compute distances more accurately. The tool even allows translating the output directly into languages like JavaScript for easy integration.

© 2026 Now Let Us. All rights reserved.

Source: Hacker News

Advertisement
Ad slot ready: 5887729102

More in this category

NOW LET US Related – GLM 5.2 Is Out

dev-tools

GLM 5.2 Is Out

Zhipu AI has officially released GLM-5.2, its most powerful open-source model to date, featuring a 1M context window and advanced long-horizon task capabilities. The release underscores Zhipu's commitment to open-source AI and global scientific collaboration amid rising technological restrictions.

NOW LET US Related – Noise infusion banned from statistical products published by Census Bureau

dev-tools

Noise infusion banned from statistical products published by Census Bureau

The U.S. Department of Commerce has banned "noise infusion" from statistical products published by the Census Bureau, a decision that could have severe consequences for both data utility and privacy protection.

NOW LET US Related – Treating pancreatic tumours may have revealed cancer's master switch

dev-tools

Treating pancreatic tumours may have revealed cancer's master switch

A promising new drug called daraxonrasib has shown breakthrough results in treating pancreatic cancer, doubling median survival times. This achievement could pave the way for an entirely new class of cancer treatments.

NOW LET US Related – Every Frame Perfect

dev-tools

Every Frame Perfect

In UI design, perfection isn't just about the start and end states, but every single transition frame in between. Polishing these micro-interactions is key to building user trust.

NOW LET US Related – Leaving Mozilla

dev-tools

Leaving Mozilla

A poignant and candid reflection from a 15-year Mozilla veteran upon their departure. The author highlights the leadership's missteps in trying to emulate tech giants and urges Mozilla to return to its core values: community and uniqueness.

NOW LET US Related – Shepherd's Dog: A Game by the Most Dangerous AI Model

dev-tools

Shepherd's Dog: A Game by the Most Dangerous AI Model

A developer tested Anthropic's latest, supposedly 'too dangerous' AI model by asking it to build a long-held game idea in a single shot. The model succeeded, generating a complete 2,319-line game after a 45-minute reasoning session.

EXPLORE TOPICS

Discover All Categories

Deep dive into the specific technology sectors that matter most to you.