Mathematical Functions
Common functions
+ ( term0 term1 -- sum ) adds two numbers
- ( minuend subtrahend -- difference ) subtracts one number from another
* ( factor0 factor1 -- product ) multiplies two numbers
/ ( dividend divisor -- quotient ) divides one number by another
abs ( number0 -- number1 ) returns absolute value
mod ( dividend divisor -- remainder ) returns the remainder after division
neg ( number0 -- number1 ) returns negative of a number
rcp ( number -- reciprocal ) returns reciprocal of a number
Trigonometric functions
acos ( number -- angle ) calculates arccosine in radians
asin ( number -- angle ) calculates arcsine in radians
atan ( number -- angle ) calculates arctangent in radians
atan2 ( y x -- angle ) calculates 2-argument arctangent in radians
cos ( angle -- number ) calculates cosine of an angle in radians
sin ( angle -- number ) calculates sine of an angle in radians
tan ( angle -- number ) calculates tangent of an angle in radians
Power functions
^ ( base exponent -- power ) raises a number to a given power
sqrt ( radicand -- root ) returns square root of a number
Rounding functions
ceil ( number0 -- number1 ) rounds up
floor ( number0 -- number1 ) rounds down
Exponential functions
exp ( base -- exponent ) calculates exponent
log ( antilogarithm -- logarithm ) calculates natural logarithm