Go to the previous, next section.

Arithmetic

`+'
Pops two values off the stack, adds them, and pushes the result. The precision of the result is determined only by the values of the arguments, and is enough to be exact.

`-'
Pops two values, subtracts the first one popped from the second one popped, and pushes the result.

`*'
Pops two values, multiplies them, and pushes the result. The number of fraction digits in the result is controlled by the current precision value (see below) and does not depend on the values being multiplied.

`/'
Pops two values, divides the second one popped from the first one popped, and pushes the result. The number of fraction digits is specified by the precision value.

`%'
Pops two values, computes the remainder of the division that the `/' command would do, and pushes that. The division is done with as many fraction digits as the precision value specifies, and the remainder is also computed with that many fraction digits.

`^'
Pops two values and exponentiates, using the first value popped as the exponent and the second popped as the base. The fraction part of the exponent is ignored. The precision value specifies the number of fraction digits in the result.

`v'
Pops one value, computes its square root, and pushes that. The precision value specifies the number of fraction digits in the result.

Most arithmetic operations are affected by the precision value, which you can set with the `k' command. The default precision value is zero, which means that all arithmetic except for addition and subtraction produces integer results.

The remainder operation (`%') requires some explanation: applied to arguments `a' and `b' it produces `a - (b * (a / b))', where `a / b' is computed in the current precision.

Go to the previous, next section.