NEWSFEVER
Technology worth discussing24 / 7 · RU + EN
Back to feedDevelopment & Open Source

Audit finds arithmetic errors in VHDL’s standard floating-point package

An audit published on GitHub reports rounding errors, incorrect arithmetic results and simulator stops in ieee.float_pkg.

Published: 20 Nov 2026, 07:00 UTC
Two calculation paths end at adjacent grid points; a magnifying circle highlights the discrepancy, while a broken line represents a stopped calculation.
Conceptual illustration of rounding errors and interrupted calculations in the VHDL package.

An audit published on GitHub reports defects in ieee.float_pkg, the floating-point package in VHDL standards IEEE Std 1076-2008 and 1076-2019. The author tested IEEE’s source code, which GHDL and NVC distribute unchanged, using GHDL 7.0.0-dev and NVC 1.23.1. Results were compared against a reference that performs exact fractional arithmetic before rounding once.

With the package’s default settings, sqrt(2.0) in float64 differed from the correctly rounded result by one unit in the last place. Among integers from 1 to 4,096, square roots had that discrepancy for 256 inputs in float32 and 264 in float64. Other failures were larger: mac returned −15 instead of 1 for (−6) × (−1) + (−5), while some format conversions stopped the simulator.

Across 3,439,564 calls covering four formats, the author counted 371,873 incorrect results and 1,302 simulator stops. A proposed patch changes 33 sections of the package body without changing declarations. On the same test vectors, the patched version produced no incorrect results or stops, and both simulators generated identical result files.

The findings remain bounded by the tests: with one or two guard bits, some results were still incorrectly rounded after patching. The VHDL-93 version contains the same lines but was not tested. The author says the findings were submitted to the IEEE P1076 working group and the GHDL, NVC and FPHDL issue trackers on 13 November 2026.

Original source: github.com ↗

Comments on source platforms

Rank is the maximum of the latest discussion counts. These are source metrics.

Hacker News