Show HN: I made a calculator that works over disjoint sets of intervals

Internet geeks cheer a “can’t-break-it” calculator—then argue about brackets

TLDR: A Show HN calculator does math on ranges of numbers, keeping results honest and even handling divide-by-zero-style inputs. Commenters cheered the “inclusion” idea, shared related tools and demos, and squabbled over bracket notation and rounding features—proof that math tools are powerful, but their UX matters.

Hacker News lit up over a wild new calculator that does math on ranges of numbers instead of single digits—and yes, it can give a tidy answer even when you try to divide by a range that includes zero. The creator, fouronnes3, says the flashy bit isn’t just fixing the classic “0.1 + 0.2” glitch in computers; it’s the bigger idea called the inclusion property—pick any number from each input range, do the math, and the true answer will always land inside the output range. Nerd magic, but explained like a good party trick.

Fans showed up with receipts. One commenter linked to Matt Keeter’s talk on graphics and interval math here, while another dropped their own interval-powered graphing calculator demo. The mood: builders high-fiving builders. People raved about using this for uncertainty—like “50 times a maybe”—and cackled that you can finally “divide by zero… sort of.” Also trending: flexing the full precision mode, which shows 0.1 + 0.2 landing in a tiny range that actually contains 0.3. Cue the “computer math is lies” memes.

But this is the internet, so nitpicks arrived right on time. _Microft demanded clearer interval notation—open vs. closed endpoints—and reminded everyone that infinity is never actually included. Then anematode wished more programming languages exposed “directed rounding,” so tools like this could be everywhere. In short: math wizardry wowed the crowd, and then the bike-shedding over brackets began—because even certainty needs good UX.

Key Points

  • The calculator performs arithmetic over unions of intervals, extending interval arithmetic to remain closed under operations, including division by intervals containing zero.
  • It guarantees the inclusion property: results of real-number evaluations within inputs are contained in the output union.
  • A full precision mode uses outward rounding on IEEE 754 double precision floats to enclose true values despite floating-point errors.
  • Syntax supports [a, b] intervals, union U, and operations +, -, *, /, ^, with a broad set of functions (e.g., logs, exp, trig, min/max) and constants (inf, pi, e).
  • Bare numbers are treated as narrow intervals, intervals can be nested (bounds treated as intervals using upper bound), enabling arithmetic on interval bounds.

Hottest takes

"Outward rounding is cool, but the 'inclusion property', as it's known in research papers, works at every scale!" — fouronnes3
"Maybe show which upper or lower values are included" — _Microft
"I wish that directed rounding was exposed in more languages" — anematode
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.