For the rules used by the text interpreter for recognising double-precision integers, see Literals.
A double precision number is represented by a cell pair, with the most
significant cell at the top-of-stack (TOS). It is trivial to convert
an unsigned single to a double: simply push a 0
onto the
TOS. Numbers are represented by Gforth using 2’s complement
arithmetic, so converting a signed single to a (signed) double
requires sign-extension across the most significant cell. This can be
achieved using s>d
. You cannot convert a number from
single-cell to double-cell without knowing whether it represents an
unsigned or a signed number. By contrast, in 2’s complement
arithmetic the conversion from double to single just drop
s the
most significant cell, and d>s
just documents the intent.
D+
and d-
are defined for signed operands, but also work
for unsigned numbers.