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

Gforth Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.5.2 Double precision

For the rules used by the text interpreter for recognising double-precision integers, see 5.13.2 Number Conversion.

A double precision number is represented by a cell pair, with the most significant cell at the TOS. It is trivial to convert an unsigned single to a double: simply push a 0 onto the TOS. Since numbers are represented by Gforth using 2's complement arithmetic, converting a signed single to a (signed) double requires sign-extension across the most significant cell. This can be achieved using s>d. The moral of the story is that you cannot convert a number without knowing whether it represents an unsigned or a signed number.

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

doc-s>d doc-d>s doc-d+ doc-d- doc-dnegate doc-dabs doc-dmin doc-dmax

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