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

Show HN (score: 5)
Found: October 13, 2025
ID: 1871

Description

Other
Show HN: I made a calculator that works over disjoint sets of intervals I've been studying interval arithmetic for the past few weeks and it's a really interesting field because while there is a ton of super interesting research published over the past decades, it has never really gotten the recognition that it deserves, IMO.

One reason for this is that standard interval arithmetic has really poor handling of division by intervals containing zero. If you compute 1 / [-1, 2] in regular interval arithmetic, you get either [-∞, +∞], or you have to say that the operation is undefined. Both solutions are virtually useless. The real answer of course is [-∞, -1] U [0.5, +∞]: i.e. a union of two disjoint intervals.

This is useful because you can confidently exclude a non empty set of the real numbers ([-1, 0.5]) from the set of possible values that you can get by dividing 1 by a number between -1 and 2.

But this definition of interval division yields a value that is not an interval. This is a problem if you want to define a closed arithmetic system, where you can build and evaluate arbitrary expression over interval values.

(This behavior extends to any non continuous function like tan() for example, which is implemented in my project - not without difficulties!)

Well the obvious solution is to define your arithmetic over disjoint unions of intervals. This is the subject of a 2017 paper called "Interval Unions" by by Schichl, H., Domes, F., Montanher, T. and Kofler, K..

This open-source project I made implements interval union arithmetic in TypeScript in the form of a simple interactive calculator, so you can try it out for yourself! The underlying TypeScript library is dependency free and implements interval union arithmetic over IEEE 754 double precision floats (JS native number type) with outward rounding. This guarantees accuracy of interval results in the presence of rounding issue inherent to floating point.

More from Show

Show HN: Widen – Open-source Mac Postgres GUI with local or cloud text-to-SQL

Show HN: Widen – Open-source Mac Postgres GUI with local or cloud text-to-SQL Github: <a href="https:&#x2F;&#x2F;github.com&#x2F;betocmn&#x2F;widen" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;betocmn&#x2F;widen</a><p>I was paying for DataGrip for several years as my desktop database GUI but if I wanted text-to-SQL with LLMs I&#x27;d have to pay even more on top. So I decided to build my own and I&#x27;ve been using it for a few weeks now.<p>At any time I&#x27;m usually working with 3 to 6 databases, and having them set up in something like Conductor (for parallel agentic coding), but for Postgres databases, lets me quickly start a session, ask questions to my database in plain English, get a data export, move on and close the session. It&#x27;s been working well and I thought I would share it here.<p>It&#x27;s a native Mac app (Swift), free and open source (MIT). For the LLM you bring your own OpenRouter key, or there&#x27;s an experimental on-device mode using Apple&#x27;s local model, where nothing leaves your Mac. Cloud mode only sends the question and schema metadata, not your data, unless you explicitly turn that on per connection.

Show HN: Play SNES, gba, in your terminal, even in tmux

Show HN: Play SNES, gba, in your terminal, even in tmux rom is a ~5k-line C libretro frontend that plays games in the terminal. It renders native pixels with the kitty graphics protocol in Ghostty or kitty, inline! even in tmux!<p>Nine platforms: SNES, NES, GB&#x2F;GBC, GBA, Genesis, PC Engine, N64, Doom&#x2F;Heretic&#x2F;Hexen, Wolfenstein. macOS and Linux, MIT.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;jhickner&#x2F;rom" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jhickner&#x2F;rom</a>

No other tools from this source yet.