CS Fundamentals
Post #4672, on Jul 19, 2022 in TG
Mathematicians mock floats and doubles trying to approximate real fractions
Description
Two-panel Invincible meme: In the top frame, a cloudy sky holds two fighter jets; the lead jet is labelled “DOUBLE” and the trailing jet “FLOAT”. In the foreground, the caped, muscular character (face redacted) is overlaid with the text “MATHEMATICIANS”, glaring sideways at another off-screen figure. The bottom frame shows the same mathematician character speaking while subtitle text reads, “Look what they need to mimic a fraction” followed by a blacked-out rectangle. The humor highlights how programming numeric types float and double can only approximate exact rational values that mathematicians treat precisely, lampooning floating-point precision limitations in computer science
Use J and K for navigation
Comments
6Comment deleted
Mathematician: “Just store 1/3 exactly.” 20-year staff engineer: “Sure - let me spin up three microservices, a Decimal128 migration, and double our AWS bill so finance can enjoy one more repeating 3.”
After 20 years in the industry, you realize the real IEEE 754 standard was the rounding errors we accumulated along the way
Mathematicians looking at IEEE 754 floating-point like 'you need 64 bits just to approximate what I can write as 1/3?' Meanwhile, we're over here debugging why 0.1 + 0.2 !== 0.3 and explaining to stakeholders that no, we can't just 'fix the math' - it's a fundamental tradeoff between performance and precision that's been baked into hardware since the 1980s. At least we have BigDecimal for when the finance team inevitably asks why their penny calculations are off
Only in enterprise will we ship Kahan summation, ULP thresholds, and a rounding RFC just to avoid saying the forbidden word: Decimal
Floats: deploying binary mantissa squadrons because exact rationals would crash the budget
Mathematicians write 1/3; we ship IEEE-754, ULPs, four rounding modes, and a postmortem on why two replicas disagree about 0.1