Next: , Previous: , Up: Built-Ins   [Contents][Index]


4.4 Arithmetic

The following arithemetic functions are available.

Num1 + Num2

Returns the sum of Num1 and Num2.
+ : (nat, nat) -> nat | (int, int) -> int | (num, num) -> num

Num1 - Num2

Returns the difference of Num1 and Num2.
- : (int, int) -> int | (num, num) -> num

-Num1

Returns the negation of Num.
- : int -> int | num -> num

Num1 * Num2

Returns the product of Num1 and Num2.
* : (nat, nat) -> nat | (int, int) -> int | (num, num) -> num

Num1 // Num2

Returns the integer division of Num1 and Num2.
// : (nat, nat) -> nat | (int, int) -> int

Num1 / Num2

Returns the division of Num1 and Num2.
/ : (num, num) -> num

Num1 mod Num2

Returns the mod of Num1 and Num2.
mod : (nat, int) -> nat | (int, int) -> int

Num1 ** Num2

Returns Num1 raised to the power Num2.
** : (nat, nat) -> nat | (int, nat) -> int | (num, num) -> num

Int >> Nat

Returns the bitwise right shift of Int with respect to Nat.
>>: (int, nat) -> int

Int << Nat

Returns the bitwise left shift of Int with respect to Nat.
<<: (int, nat) -> int

Int1 /\ Int2

Returns the bitwise AND of Int1 and Int2.
/\: (int, int) -> int

Int1 \/ Int2

Returns the bitwise OR of Int1 and Int2.
\/: (int, int) -> int

\ Int

Returns the bitwise complement of Int.
\: (int) -> int

abs(Num)

Returns the absolute value of Num.
abs: int -> nat | num -> num

sqrt(Num)

Returns the square root of Num.
sqrt: num -> num

round(Num)

Returns the round of Num.
round: num -> int

floor(Num)

Returns the floor of Num.
floor: num -> int

ceiling(Num)

Returns the ceiling of Num.
ceiling: num -> int

pi_()

Returns PI.
pi_: () -> num

e_()

Returns E.
e_: () -> num

sin(Num)

Returns the sin of Num.
sin: num -> num

cos(Num)

Returns the cos of Num.
cos: num -> num

tan(Num)

Returns the tan of Num.
tan: num -> num

asin(Num)

Returns the arcsin of Num.
asin: num -> num

acos(Num)

Returns the arccos of Num.
acos: num -> num

atan(Num)

Returns the arctan of Num.
atan: num -> num

atan2(Y, X)

Returns the atan2 of Y and X. This returns an angle in the range (-pi, pi].
atan2: (num,num) -> num


Next: , Previous: , Up: Built-Ins   [Contents][Index]