# A brief introduction to interval arithmetic

## This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com hardware-buttons scrape-images linkedin-bot Post date: 25 Jun 2024

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
• ### ClickHouse

ClickHouse® is a real-time analytics DBMS

This is a good article!

In ClickHouse, interval arithmetic is applied to index analysis. A sparse index consists of granules, and each granule is an interval of tuples in lexicographic order. This interval is decomposed into a union of hyperrectangles. Conditions such as comparisons, logic operators, and many other functions are evaluated on these hyperrectangles, yielding boolean intervals. Boolean intervals represent ternary logic (always true, always false, can be true or false). Interesting tricks include: applying functions that are monotonic on ranges (for example, the function "day of month" is monotonic as long as the month does not change), calculating function preimages on intervals, and even calculating preimages of n-ary functions, which is useful for space-filling curves, such as Morton or Hilbert curves.

Check for more details: https://github.com/ClickHouse/ClickHouse/blob/master/src/Sto...

Or see examples, such as https://adsb.exposed/

• ### InfluxDB

Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

• ### clpBNR

CLP(BNR) module for SWI-Prolog

See clpBNR with SWI Prolog for a way to use interval arithmetic in the broader scope of logic programming.

https://github.com/ridgeworks/clpBNR

• ### TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

I took the idea of interval types and decomposed them to an even lower primitive: Inequality types. An interval type is just an intersection of two inequality types. For example `(>0) & (<1)` is the interval `(0, 1)`.

The nice thing about this decomposition is that applying arithmetic "just works" because you just define them for the inequality primitive. For example:

I prototyped this for TypeScript and created a proposal. It does not contain type-level arithmetic because TS doesn't do that. I'm not entirely convinced myself of that proposal, but maybe someone finds this interesting:

https://github.com/microsoft/TypeScript/issues/43505

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

## Related posts

• ### Remove TypeScript

4 projects | news.ycombinator.com | 6 Sep 2023
• ### An Introduction to TypeScript for JavaScript Developers

1 project | dev.to | 29 Jul 2024
• ### Master TypeScript: Let's Do Math In Type System

1 project | dev.to | 28 Jul 2024
• ### Streaming HTTP Responses using fetch

1 project | dev.to | 23 Jul 2024
• ### Alternative File-Type extension for TypeScript files (.ts = MPEG-2 video)

1 project | news.ycombinator.com | 12 Jul 2024