Taiga UI 5.0 is out!

Math CDK

Examples Setup GitHub

On this page

A set of utils to calculate math

round

round, floor and ceil with fixed common problems of the native implementation

1.01 = round(value, precision);

1 = floor(value, precision);

1.01 = ceil(value, precision);

inRange

Checks if the value is in range
true = inRange(value, fromInclude, toExclude);

normalizeToIntNumber

Normalizes any number to an integer within inclusive range
5 = normalizeToIntNumber(value, min, max);

quantize

Rounds a number to the closest value in a fixed discrete series
4 = quantize(value, quantum);

clamp

Clamps a value between two inclusive limits
5 = clamp(value, min, max);