By default, numbers in Forth are single-precision integers that are one cell (a machine word, e.g., 64 bits on a 64-bit system) in size. They can be signed or unsigned, depending upon how you treat them. For the rules used by the text interpreter for recognising single-precision integers see Literals.
+
, 1+
, under+
, -
, 1-
, *
are
defined for signed operands, but they also work for unsigned numbers.
For division words see Integer division.
+
( n1 n2 – n ) core “plus”
1+
( n1 – n2 ) core “one-plus”
under+
( n1 n2 n3 – n n2 ) gforth-0.3 “under-plus”
add n3 to n1 (giving n)
-
( n1 n2 – n ) core “minus”
1-
( n1 – n2 ) core “one-minus”
*
( n1 n2 – n ) core “star”
negate
( n1 – n2 ) core “negate”
abs
( n – u ) core “abs”
min
( n1 n2 – n ) core “min”
max
( n1 n2 – n ) core “max”
umin
( u1 u2 – u ) gforth-0.5 “umin”
umax
( u1 u2 – u ) gforth-1.0 “umax”