7-39
FLOATING-POINT UNIT
These instructions operate on the top one or two registers of the FPU register stack and they
return their results to the stack. The source operands must be given in radians.
The FSINCOS instruction returns both the sine and the cosine of a source operand value. It oper-
ates faster than executing the FSIN and FCOS instructions in succession.
The FPATAN instruction computes the arctangent of ST(1) divided by ST(0). It is useful for
converting rectangular coordinates to polar coordinates.
7.5.8.Pi
When the argument (source operand) of a trigonometric function is within the range of the func-
tion, the argument is automatically reduced by the appropriate multiple of 2
?
through the same
reduction mechanism used by the FPREM and FPREM1 instructions. The internal value of
?
that the IA FPU uses for argument reduction and other computations is as follows:
?
= 0.f
?
2
2
where:
f = C90FDAA2 2168C234 C
(The spaces in the fraction above indicate 32-bit boundaries.)
This internal
?
value has a 66-bit mantissa, which is 2 bits more than is allowed in the signifi-
cand of an extended-real value. (Since 66 bits is not an even number of hexadecimal digits, two
additional zeros have been added to the value so that it can be represented in hexadecimal
format. The least-significant hexadecimal digit (C) is thus 1100B, where the two least-
significant bits represent bits 67 and 68 of the mantissa.)
This value of
?
has been chosen to guarantee no loss of significance in a source operand,
provided the operand is within the specified range for the instruction.
If the results of computations that explicitly use
?
are to be used in the FSIN, FCOS, FSINCOS,
or FPTAN instructions, the full 66-bit fraction of
?
should be used. This insures that the results
are consistent with the argument-reduction algorithms that these instructions use. Using a
rounded version of
?
can cause inaccuracies in result values, which if propagated through
several calculations, might result in meaningless results.
A common method of representing the full 66-bit fraction of
?
is to separate the value into two
numbers (high
?
and low
?
) that when added together give the value for
?
shown earlier in this
section with the full 66-bit fraction:
?
= high
?
+ low
?
For example, the following two values (given in scientific notation with the fraction in hexadec-
imal and the exponent in decimal) represent the 33 most-significant and the 33 least-significant
bits of the fraction:
high
?
(unnormalized)= 0.C90FDAA20 * 2
+2
low
?
(unnormalized)= 0.42D184698 * 2
?
31