The ALTernative Language
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Interval Arithmetic

Numbers are special in ALT as they are intervals of infinitely sized fractions. With ALT you can add, subtract, multiply and divide such numbers. The implementation closely follows the theory of interval arithmetic.

Add and Subtract

Adding and subtracting number intervals is pretty straight forward. Here are some examples:

A1:
A2:
A3:
A4:
A5:
A6:

Multiply and Divide

Multiplying and dividing number intervals is not as straight forward, and sometimes yields non-intuitive results, especially when zeros in the denominator are involved:

M1:
M2:
D1:
D2:
D3:
D4:
D5:

Union, Intersection and Negation

Manipulating bags of numbers is easy by using the 3 core algebraic operators, union, intersection and negation:

I1:
I2:
N1:
N2: