version 1.30, 1999/05/14 20:55:13
|
version 1.31, 1999/05/15 20:00:22
|
Line 2439 doc-d2/
|
Line 2439 doc-d2/
|
recognising double-precision integers. |
recognising double-precision integers. |
|
|
A double precision number is represented by a cell pair, with the most |
A double precision number is represented by a cell pair, with the most |
significant digit at the TOS. It is trivial to convert an unsigned |
significant cell at the TOS. It is trivial to convert an unsigned |
single to an (unsigned) double; simply push a @code{0} onto the |
single to an (unsigned) double; simply push a @code{0} onto the |
TOS. Since numbers are represented by Gforth using 2's complement |
TOS. Since numbers are represented by Gforth using 2's complement |
arithmetic, converting a signed single to a (signed) double requires |
arithmetic, converting a signed single to a (signed) double requires |
sign-extension across the most significant digit. This can be achieved |
sign-extension across the most significant cell. This can be achieved |
using @code{s>d}. The moral of the story is that you cannot convert a |
using @code{s>d}. The moral of the story is that you cannot convert a |
number without knowing whether it represents an unsigned or a |
number without knowing whether it represents an unsigned or a |
signed number. |
signed number. |
Line 2476 doc-0>=
|
Line 2476 doc-0>=
|
|
|
doc-u< |
doc-u< |
doc-u<= |
doc-u<= |
@comment TODO why u<> and u= ... they are the same as <> and = |
@c TODO why u<> and u= ... they are the same as <> and = |
doc-u<> |
@c commented them out because they are unnecessary |
doc-u= |
@c doc-u<> |
|
@c doc-u= |
doc-u> |
doc-u> |
doc-u>= |
doc-u>= |
|
|
Line 2500 doc-d0>=
|
Line 2501 doc-d0>=
|
|
|
doc-du< |
doc-du< |
doc-du<= |
doc-du<= |
doc-du<> |
@c doc-du<> |
doc-du= |
@c doc-du= |
doc-du> |
doc-du> |
doc-du>= |
doc-du>= |
|
|
Line 2579 doc-facosh
|
Line 2580 doc-facosh
|
doc-fatanh |
doc-fatanh |
doc-pi |
doc-pi |
|
|
|
doc-f2* |
|
doc-f2/ |
|
doc-1/f |
|
doc-precision |
|
doc-set-precision |
|
|
|
One particular problem with floating-point arithmetic is that comparison |
|
for equality often fails when you would expect it to succeed. For this |
|
reason approximate equality is often preferred (but you still have to |
|
know what you are doing). The comparison words are: |
|
|
|
doc-f~rel |
|
doc-f~abs |
|
doc-f= |
|
doc-f~ |
|
doc-f<> |
|
|
|
doc-f< |
|
doc-f<= |
|
doc-f> |
|
doc-f>= |
|
|
doc-f0< |
doc-f0< |
doc-f0<= |
doc-f0<= |
doc-f0<> |
doc-f0<> |
Line 2586 doc-f0=
|
Line 2609 doc-f0=
|
doc-f0> |
doc-f0> |
doc-f0>= |
doc-f0>= |
|
|
doc-f< |
|
doc-f<= |
|
doc-f<> |
|
doc-f= |
|
doc-f> |
|
doc-f>= |
|
|
|
doc-f2* |
|
doc-f2/ |
|
doc-1/f |
|
doc-f~ |
|
doc-precision |
|
doc-set-precision |
|
|
|
@node Stack Manipulation, Memory, Arithmetic, Words |
@node Stack Manipulation, Memory, Arithmetic, Words |
@section Stack Manipulation |
@section Stack Manipulation |