Maths · Modules | Program

Modules · Core · Maths

Integer and real numbers, and their arithmetic. Maths gives you two native number types — Maths.Integer for whole numbers and Maths.Real for real (floating-point) numbers — each acting as a pseudo-module that also holds its operations. Every function is reactive: a sum or comparison recomputes whenever the values it reads change. Comparisons return a Logic.Maybe , so they compose with Logic .

A whole number, backed by each target's native integer type. It also groups the integer operations.

A real (floating-point) number, backed by each target's native double type. It also groups the real-number operations.

The absolute value of an integer.

Returns Maths.Integer — the non-negative magnitude of value .

Returns Maths.Integer — the sum of a and b .

Constrains a value to the min–max range.

Returns Maths.Integer — value pulled into the inclusive range min … max .

One less than the value.

Returns Maths.Integer — value minus one.

Divides a by b, truncating toward zero.

Returns Maths.Integer — the quotient, truncated toward zero.

Yes when two integers are equal.

Returns Logic.Maybe — yes when a and b are equal.

Yes when value is at or above the threshold.

Returns Logic.Maybe — yes when value ≥ threshold .

Yes when value is above the threshold.

Returns Logic.Maybe — yes when value > threshold .

One more than the value.

Returns Maths.Integer — value plus one.

The integer a fraction of the way from start to target.

Returns Maths.Integer — the rounded value progress of the way from start to target .

Yes when value is at or below the threshold.

Returns Logic.Maybe — yes when value ≤ threshold .

Yes when value is below the threshold.

Returns Logic.Maybe — yes when value < threshold .

The larger of two integers.

Returns Maths.Integer — whichever of a and b is larger.

The smaller of two integers.

Returns Maths.Integer — whichever of a and b is smaller.

The remainder of a divided by b.

Returns Maths.Integer — the remainder after dividing a by b .

Multiplies two integers.

Returns Maths.Integer — the product of a and b .

Yes when two integers differ.

Returns Logic.Maybe — yes when a and b differ.

Runs its block when its value matches the enclosing Select.

The content to run when optionValue equals the value selected by the enclosing Maths.Integer.Select .

Returns nothing — it runs its block only on a match.

Opens a group that runs the matching Option for an integer value.

An indented block of Maths.Integer.Option entries; the one whose value equals value runs.

Returns nothing — it publishes value to the enclosed options over its block.

Returns Maths.Integer — a minus b .

The integer converted to a real number.

Returns Maths.Real — value as a real number.

The integer rendered as text.

Returns Text — the decimal digits of value .

The absolute value of a real number.

Returns Maths.Real — the non-negative magnitude of value .

Adds two real numbers.

Returns Maths.Real — the sum of a and b .

The value rounded up to a whole number.

Returns Maths.Real — the smallest whole number not below value .

Constrains a real value to the min–max range.

Returns Maths.Real — value pulled into the inclusive range min … max .

The cosine of an angle in radians.

Returns Maths.Real — the cosine of radians .

Returns Maths.Real — the quotient of a over b .

Shapes linear progress into an eased curve.

Returns Maths.Real — the eased progress, useful for smoothing an animation .

The value rounded down to a whole number.

Returns Maths.Real — the largest whole number not above value .

The value a fraction of the way from start to target.

Returns Maths.Real — the value progress of the way from start to target .

The larger of two real numbers.

Returns Maths.Real — whichever of a and b is larger.

The smaller of two real numbers.

Returns Maths.Real — whichever of a and b is smaller.

Multiplies two real numbers.

Returns Maths.Real — the product of a and b .

Raises a to the power of b.

Returns Maths.Real — a raised to the power b .

The value rounded to the nearest whole number.

Returns Maths.Real — value rounded to the nearest whole number.

The sine of an angle in radians.

Returns Maths.Real — the sine of radians .

The square root of a real number.

Returns Maths.Real — the square root of value .

Returns Maths.Real — a minus b .

The real number converted to an integer, dropping any fraction.

Returns Maths.Integer — value with its fractional part dropped.

The real number rendered as text.

Returns Text — a textual form of value .

Recommended articles