The following commands perform basic mathematical and bitwise operations. Many of these commands are subject to scalar extension and use a numerical modifier to enable binary extension. Note that the trigonometric commands have their own page.
+
)
Adds two numbers. Subject to scalar and binary extension. If
given a numerical modifier of 0, this command pushes 0
.
If given ⚐ as its sole argument, this command pushes 0
.
-
)Subtracts two numbers. Subject to scalar and binary extension. With a numerical modifier of 1, this command returns the negative of its sole argument.
×
)
Multiplies two numbers. Subject to scalar and binary extension.
With a numerical modifier of 0, pushes 1
. If given
⚐ as its sole argument, this command pushes 1
.
÷
)Divides two numbers. Subject to scalar and binary extension. With a numerical modifier of 1, this command returns the reciprocal of its argument.
Note that since Pancode uses IEEE floats, division by zero is not an error and will simply return either infinity, negative infinity, or NaN, as per the IEEE specification.
*
)
Raises its first argument to the power of its second. Subject to
scalar and binary extension (binary extension associates to the
right). If given a numerical modifier of 0, this command returns 1
.
If given ⚐ as its sole argument, this command pushes 1
.
ê
)
Takes a single argument and returns the mathematical constant e
raised
to that power. Subject to scalar extension.
🌳
)Takes a single argument and returns the natural logarithm of that argument. Subject to scalar extension.
🌳′
)Takes two arguments and returns the logarithm of the first in the base of the second. Subject to scalar and binary extension.
√
)Takes a single argument and returns its square root. Subject to scalar extension.
√′
)Takes two arguments and returns the nth root of the first, where n is the second argument. Subject to scalar and binary extension.
|
)Takes two arguments and returns the first argument modulo the second. Subject to scalar extension but not binary extension. The sign of the result shall match that of the divisor.
⩑
)Takes two arguments and returns their least common multiple. Subject to scalar and binary extension. With a numerical modifier of 0 or a ⚐ argument, returns 1.
⩒
)Takes two arguments and returns their greatest common divisor. Subject to scalar and binary extension. With a numerical modifier of 0 or a ⚐ argument, returns 0.
_
)Returns the negative of its argument. Subject to scalar extension.
⅟
)Returns the reciprocal of its argument. Subject to scalar extension.
⌉
)Returns the least integer greater than or equal to its argument. Subject to scalar extension.
⌋
)Returns the greatest integer less than or equal to its argument. Subject to scalar extension.
A
)Returns the absolute value of its argument. Subject to scalar extension.
a
)Returns the sign of its argument. Subject to scalar extension.
∧
)
Takes two arguments and performs the bitwise-and operation on
them. The two numbers are treated as being in two's complement
form. The result is undefined if either number is not an
integer. Subject to scalar and binary extension. Returns -1
with
a numerical argument of 0 or a ⚐ argument.
∨
)
Takes two arguments and performs the bitwise-or operation on
them. The two numbers are treated as being in two's complement
form. The result is undefined if either number is not an
integer. Subject to scalar and binary extension. Returns 0
with
a numerical argument of 0 or a ⚐ argument.
⊕
)
Takes two arguments and performs the bitwise-xor operation on
them. The two numbers are treated as being in two's complement
form. The result is undefined if either number is not an
integer. Subject to scalar and binary extension. Returns 0
with
a numerical argument of 0 or a ⚐ argument.
¬
)Takes one argument and takes its bitwise negation. Subject to scalar extension.