Utility types for numbers.
npm install @jdeurt/math.tsNumber types passed to any of the following utility types are casted to integers. For example, Add<5, 3.5> will return 8.
Adds integers A and B and returns the result.
type Result = Add<5, 3>; // 8Subtracts integer B from A and returns the result.
type Result = Sub<5, 3>; // 2Multiplies integers A and B and returns the result.
type Result = Mul<5, 3>; // 15Divides integer A by integer B and returns the result.
type Result = Div<10, 2>; // 5Finds the modulus of integer A by B and returns the result.
type Result = Mod<10, 3>; // 1Raises integer A to the power of B and returns the result.
type Result = Pow<2, 3>; // 8Checks if integer A is equal to B and returns 1 if true, otherwise 0.
type Result = Eq<5, 5>; // 1Checks if integer A is greater than B and returns 1 if true, otherwise 0.
type Result = Gt<5, 3>; // 1Checks if integer A is less than B and returns 1 if true, otherwise 0.
type Result = Lt<5, 7>; // 1Checks if integer A is greater than or equal to B and returns 1 if true, otherwise 0.
type Result = Gte<5, 5>; // 1Checks if integer A is less than or equal to B and returns 1 if true, otherwise 0.
type Result = Lte<5, 7>; // 1MIT © Juan de Urtubey