Skip to content

Math

Arithmetic operators and numeric functions.

AbsExpression

Returns the absolute value of self.

Signature

txt
Number::abs () : Number

Example

txt
-2.abs() = 2

AdditionExpression

Addition operator.

Symbol: +

Example

txt
1 + 2

DivExpression

Returns the integer quotient of the division of self by i.

Signature

txt
Number::div ( i : Number ) : Number

Example

txt
3 div 2 = 1

DivideExpression

Division operator.

Symbol: /

Example

txt
17 / 2

MaxExpression

Returns the greatest of self and i.

Signature

txt
Number::max ( i : Number ) : Number

Example

txt
6.max(3) = 6

MinExpression

Returns the lowest of self and i.

Signature

txt
Number::min ( i : Number ) : Number

Example

txt
6.min(3) = 3

ModuloExpression

Returns the remainder of the division of self by i.

Signature

txt
Number::mod ( i : Number ) : Number

Example

txt
4 mod 2 = 0

MultiplyExpression

Multiplication operator.

Symbol: *

Example

txt
1 * 2

PowerExpression

Power operator.

Symbol: ^

Example

txt
4 ^ 2

RoundExpression

Returns the nearest integer to self.

Signature

txt
Number::round () : Number

SqrtExpression

Returns the square root of self.

Signature

txt
Number::sqrt () : Number

Example

txt
9.sqrt() = 3

SubstractionExpression

Subtraction operator.

Symbol: -

Example

txt
1 - 2

Released under the MIT License.