Skip to content
DevMeme
CS Fundamentals Post #127 · source on Telegram

A Programmer's Order: The Root Beer Float(ing Point)

Description

A screenshot of a tweet from user Carlos Bueno (@Archivd). The text tells a classic programmer joke: 'A programmer walks into a bar and orders 1.000000119 root beers. The bartender says, "I'm gonna have to charge you extra; that's a root beer float". And the programmer says, "Well in that case make it a double".' The humor is a multi-layered pun based on computer science data types. 'Float' refers to single-precision floating-point numbers, which often have tiny precision errors, resulting in values like 1.000000119 instead of exactly 1. The programmer's response, 'make it a double,' is also a double entendre, referring to both a double-sized drink and the 'double' data type, which has significantly more precision than a float. This joke is a staple in developer communities, especially appreciated by those who have been bitten by floating-point arithmetic bugs

Comments

8
Anonymous ★ Top Pick The original programmer was happy with his double, but the JavaScript developer who ordered next was confused when his 0.1 + 0.2 root beers didn't quite fill the glass
  1. Anonymous ★ Top Pick

    The original programmer was happy with his double, but the JavaScript developer who ordered next was confused when his 0.1 + 0.2 root beers didn't quite fill the glass

  2. Anonymous

    Turns out ordering 1.000000119 root beers is the fastest path from “harmless precision tweak” to “full-scale migration to decimal128 - plus a mandatory double to cope with the audit.”

  3. Anonymous

    The real joke is that after 20 years in this industry, we still explain floating-point arithmetic to product managers using the exact same 0.1 + 0.2 != 0.3 example, and they still ship features that compare currency values with ==

  4. Anonymous

    The bartender should've charged in cents stored as floats - then the programmer's tab would've rounded itself off anyway

  5. Anonymous

    This joke brilliantly captures the eternal struggle of floating-point arithmetic - where asking for exactly 1.0 is apparently too much to ask from your CPU. The programmer's response is chef's kiss: when life gives you precision errors, upgrade to double precision. It's the numerical equivalent of 'if it compiles, ship it' - except here, if it floats, double it. Every senior engineer who's debugged financial calculations knows that 0.1 + 0.2 ≠ 0.3, and this bartender clearly understands IEEE 754 better than most junior devs understand their own codebase

  6. Anonymous

    I ordered 1 root beer +/- 1 ULP; bartender served a float. I said make it a double - after two decades of IEEE-754, I'll pay for the headroom

  7. Anonymous

    Bartender spotted the ulp drift in that float order - programmer's epsilon just cost him a premium pour

  8. Anonymous

    Production fix: migrate the bar’s schema from float to Decimal128 before the CFO notices the tab accumulating ULPs

Use J and K for navigation