6.5.1 Single precision

By default, numbers in Forth are single-precision integers that are one cell 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 Number Conversion.

These words are all defined for signed operands, but some of them also work for unsigned numbers: +, 1+, -, 1-, *.

+ ( 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”