Module "Arithmetic": Number Arithmetic Functions

(+) \a \b

Result is the sum of a and b .

Example:

5 + 3 => 8

(-) \a \b

Result is the difference of a and b .

Note that if you write - b , this implies a=0 and you will get the numerical negation. This is a special case only for this function.

Example:

5 - 3 => 2
- 3 => (-3)

(*) \a \b

Alternative Name: ⋅

Result is the product of a and b .

Example:

5 ⋅ 3 => 15

(/) \a \b

Alternative Name: ÷

Result is the quotient of a and b .

Example:

5 / 3 => 1.6666666666666667

divrem \a \b

Result is a list with the integer quotient of a and b and the remainder.

Example:

divrem 5 3 => (1:2:nil)

(<) \a \b

Result is whether a is smaller than b.

Example:

if (5 < 3) 'yes else 'no => no

(<=) \a \b

Alternative Name: ≤

Result is whether a is smaller than or equal to b.

Example:

if (5 <= 5) 'yes else 'no => yes
if (5 ≤ 5) 'yes else 'no => yes

(=) \a \b

Result is whether a is equal to b.

Example:

if (5 = 5) 'yes else 'no => yes

(/=) \a \b

Result is whether a is not equal to b.

Example:

if (5 /= 5) 'yes else 'no => no

(>) \a \b

Result is whether a is greater than b.

Example:

if (5 > 3) 'yes else 'no => yes

(>=) \a \b

Alternative Name: ≥

Result is whether a is greater than or equal to b.

Example:

if (5 >= 5) 'yes else 'no => yes
if (5 ≥ 5) 'yes else 'no => yes

abs \a

Returns the absolute value of a.

Example:

abs 5 => 5
abs (-5) => 5
abs (-5.3) => 5.3
abs 0 => 0