fptan

Partial Tangent

FPTAN

Computes tangent of ST(0) and pushes 1.0.

Details

Computes the tangent of ST(0) and then pushes 1.0 onto the stack, so ST(0) becomes tan(original ST(0)) and the constant 1.0 moves to ST(1). The x87 status flags are updated; C2 may be set if the argument is out of the acceptable range. This is used in conjuction with FPATAN to compute arctangent.

Pseudocode Operation

temp ← ST(0); ST(0) ← tan(temp); push(1.0); TOS ← TOS + 1

Example

FPTAN

Encoding

Binary Layout
D9
+0
F2
+1
 
Format Legacy
Opcode D9 F2
Extension x87 FPU

Operands

Reference (Intel® SDM)

Instruction Forms

Opcode Instruction Op/En 64/32-bit Mode CPUID Description
D9 F2 FPTAN Valid Valid Replace ST(0) with its approximate tangent and push 1 onto the FPU stack.

Description

Computes the approximate tangent of the source operand in register ST(0), stores the result in ST(0), and pushes a 1.0 onto the FPU register stack. The source operand must be given in radians and must be less than ±263. The following table shows the unmasked results obtained when computing the partial tangent of various classes of numbers, assuming that underflow does not occur. Table 3-35. FPTAN Results ST(0) SRC ST(0) DEST − ∞ * − F − F to + F − 0 - 0 + 0 + 0 + F − F to + F + ∞ * NaN NaN

Operation

IF ST(0) < 263
THEN
C2 := 0;
ST(0) := fptan(ST(0)); // approximation of tan
TOP := TOP − 1;
ST(0) := 1.0;
ELSE (* Source operand is out-of-range *)
C2 := 1;
FI;

Exceptions

Protected Mode Exceptions

#NM CR0.EM[bit 2] or CR0.TS[bit 3] = 1. #MF If there is a pending x87 FPU exception. #UD If the LOCK prefix is used.

Real-Address Mode Exceptions

Same exceptions as in protected mode.

Virtual-8086 Mode Exceptions

Same exceptions as in protected mode.

Compatibility Mode Exceptions

Same exceptions as in protected mode.

64-Bit Mode Exceptions

Same exceptions as in protected mode. FPTAN—Partial Tangent Vol. 2A 3-371