Menu

I unit-tested the 131 conversion equations in my own docs. The tolerance was the bug.
📰

I unit-tested the 131 conversion equations in my own docs. The tolerance was the bug.

DEV Community: python·Jianzhujisuan·2 days ago
#eZvOryeF
#devtopython#devto#dev#printed#unit
Long article (1631 words) — no AI summary yet.
Reading 0:00
15s threshold

The check I added to my build last week has printed 0 arithmetic errors on every single run. Then I scrolled a live page and read one row of a conversion table:

C30 concrete = 30 MPa = 30 N/mm² = 300 kgf/cm²

Enter fullscreen mode

Exit fullscreen mode

30 MPa is 305.9 kgf/cm². That row is off by 1.93%, and the check that exists specifically to catch wrong numbers had waved it through.

Not a regex bug. Not a missing test case. One line of tolerance arithmetic — the part everybody writes in thirty seconds and never looks at again.

What the check actually does

The site publishes 242 pages in each of two languages, about 2.7 million characters of visible text. Buried in that prose are sentences like 1 in = 25.4 mm and 1 ft³ = 0.0283168 m³ . Unit conversions are the one class of statement where correctness is decided by arithmetic alone — no editor, no source, no judgement.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.