Next: , Previous: , Up: Forth Words   [Contents][Index]


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 implementation-defined behaviour, but, e.g., /f, /modf or fm/mod (see Integer division).