User's Manual

PROGRAMMING NUMERIC APPLICATIONS
FABS
FABS (absolute value) changes the top stack element to its absolute value by making its sign positive.
FCHS
FCHS
(change sign) complements (reverses) the sign of the top stack element.
Comparison
Instructions
Each of these instructions (table
2-5)
analyzes the top stack element, often in relationship to another
operand, and reports the result in the status word condition code. The basic operations are compare,
test (compare with zero), and examine (report tag, sign, and normalization). Special forms of the compare
operation are provided to optimize algorithms by allowing direct comparisons with binary integers and
real numbers in memory,
as
well
as
popping the stack after a comparison.
The
FSTSW (store status word) instruction may be used following a comparison to transfer the condi-
tion code to memory for inspection.
Note that instructions other than those in the comparison group may update the condition code. To
ensure that the status word
is
not altered inadvertently, store it immediately following a comparison
operation.
FCOM / /source
FCOM
(compare real) compares the stack top to the source operand. The source operand may be a
register
on
the stack, or a short or
long
real memory operand.
If
an operand
is
not coded, ST
is
compared
to
ST(1). Positive and negative forms of zero compare identically
as
if they were unsigned. Following
the instruction, the condition codes reflect the order of the operands
as
shown in table
2-6.
C3
0
0
1
1
Table 2-5. Comparison Instructions
FCOM
FCOMP
FCOMPP
FICOM
FICOMP
FTST
FXAM
Compare
real
Compare real and pop
Compare
real and pop twice
Integer compare
Integer compare and pop
Test
Examine
Table 2-6. Condition Code
Interpretation
after
FCOM
Condition Code
Interpretation
after
FCOM
C2
C1
CO
0
X
0
ST>
source
0
X 1
ST < source
0
X 0
ST = source
1 X
1 ST is not comparable
2-10