Rexx Programming/How to Rexx/arithmetic
The rexx scripting language provides a set of arithmetic operators for manipulating integer and floating point numbers.
Operator Description + addition - subtraction * multiplication / division % integerdivision // modulus ** exponent
say 6 + 3 /* addition */ say 8 - 3 /* subtraction */ say 6 * 3 /* multiplication */ say 11 / 4 /* division */ say 11 % 4 /* integer division */ say 11 // 4 /* modulus */ say 5 ** 3 /* exponent */
Arithmetic operators may behave differently than they do in other programming languages
editNote that rexx uses unconventional arithmetic operators, which may have a different meaning to conventional operators used in other programming languages. For example the percent sign is used for integer division in rexx, whereas it is used as a modulus operator in perl.
Arithmetic operations should only be applied to valid numeric values
editThe rexx scripting language uses typeless variables that are treated as strings. Arithmetic operators should only be used on strings containing numeric values, otherwise an error may occur.