www.delorie.com/gnu/docs/gforth/gforth_68.html   search  
Buy GNU books!

Gforth Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [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 undefined behaviour, but rather fm/mod or sm/mod (probably the former, see section 5.5.5 Mixed precision).

5.5.1 Single precision  
5.5.2 Double precision  Double-cell integer arithmetic
5.5.3 Bitwise operations  
5.5.4 Numeric comparison  
5.5.5 Mixed precision  Operations with single and double-cell integers
5.5.6 Floating Point  

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003