Next: , Previous: Arithmetic, Up: Arithmetic

5.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       “under-plus”

add n3 to n1 (giving n)

-       n1 n2 – n        core       “minus”

1-       n1 – n2        core       “one-minus”

*       n1 n2 – n        core       “star”

/       n1 n2 – n        core       “slash”

mod       n1 n2 – n        core       “mod”

/mod       n1 n2 – n3 n4        core       “slash-mod”

negate       n1 – n2        core       “negate”

abs       n – u        core       “abs”

min       n1 n2 – n        core       “min”

max       n1 n2 – n        core       “max”

FLOORED       – f         environment       “FLOORED”

True if / etc. perform floored division