Next: , Previous: Boolean Flags, Up: Words


5.5 Arithmetic

Forth arithmetic is not checked, i.e., you will not hear about integer overflow on addition or multiplication, you may hear about division by zero if you are lucky. The operator is written after the operands, but the operands are still in the original order. I.e., the infix 2-1 corresponds to 2 1 -. Forth offers a variety of division operators. If you perform division with potentially negative operands, you do not want to use / or /mod with its undefined behaviour, but rather fm/mod or sm/mod (probably the former, see Mixed precision).