Fresh IDE . Artifact [be59ba4166]
Not logged in

This repository is a mirror!

The original is located on: https://fresh.flatassembler.net/fossil/repo/fresh
If you want to follow the project, please update your remote-url

Artifact be59ba4166a4650e6262a02ea4b29973d1786a94:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="../style/style.css" />
<title>FPTAN: Partial Tangent (x86 Instruction Set Reference)</title>
</head>
<body>
<div class="main_container"><h1>x86 Instruction Set Reference</h1>
<title>FPTAN: Partial Tangent (x86 Instruction Set Reference)</title>
<h1>FPTAN</h1>
<h2>Partial Tangent</h2>
<object>
<table class="box">
<tr>
<th>Opcode</th>
<th>Mnemonic</th>
<th>Description</th>
</tr>
<tr>
<td class="grid"><code>D9 F2</code></td>
<td class="grid"><code>FPTAN Replace ST(0) with its tangent and push 1 onto the FPU stack.</code></td>
<td class="grid"></td>
</tr>
</table>
</object>
<object>
<table class="box">
<tr>
<th>Description</th>
</tr>
<tr>
<td class="instruction_set_reference_box">
<p>Computes the 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 +-2^63. The following table shows the unmasked results obtained when computing the partial tangent of various classes of numbers, assuming that underflow does not occur.</p>
<div>
<table class="grid">
<caption>FPTAN Results</caption>
<tr><th>ST(0) Source</th><th>ST(0) Destination</th></tr>
<tr><td>-inf</td><td>*</td></tr>
<tr><td>-F</td><td>-F to +F</td></tr>
<tr><td>-0</td><td>-0</td></tr>
<tr><td>+0</td><td>+0</td></tr>
<tr><td>+F</td><td>-F to +F</td></tr>
<tr><td>+inf</td><td>*</td></tr>
<tr><td>NaN</td><td>NaN</td></tr>
<tfoot>
<tr><td colspan="2">F Means finite floating-point value.</td></tr>
<tr><td colspan="2">* Indicates floating-point invalid-arithmetic-operand (#IA) exception.</td></tr>
</tfoot>
</table>
</div>
<p>If the source operand is outside the acceptable range, the C2 flag in the FPU status word is set, and the value in register ST(0) remains unchanged. The instruction does not raise an exception when the source operand is out of range. It is up to the program to check the C2 flag for out-ofrange conditions. Source values outside the range -2^63 to +2^63 can be reduced to the range of the instruction by subtracting an appropriate integer multiple of 2 * pi or by using the FPREM instruction with a divisor of 2 * pi. See the section titled &quot;Pi&quot; in Chapter 8 of the IA-32 Intel Architecture Software Developer's Manual, Volume 1, for a discussion of the proper value to use for pi in performing such reductions.</p>
<p>The value 1.0 is pushed onto the register stack after the tangent has been computed to maintain compatibility with the Intel 8087 and Intel287 math coprocessors. This operation also simplifies the calculation of other trigonometric functions. For instance, the cotangent (which is the reciprocal of the tangent) can be computed by executing a FDIVR instruction after the FPTAN instruction.</p>
</td>
</tr>
</table>
</object>
<object>
<table class="box">
<tr>
<th>Operation</th>
</tr>
<tr>
<td class="instruction_set_reference_box">
<pre><span class="keyword">if</span><span class="operator">(</span>ST<span class="operator">(</span><span class="number">0</span><span class="operator">)</span> <span class="operator">&lt;</span> <span class="operator">(</span><span class="number">1</span> <span class="operator">&lt;&lt;</span> <span class="number">63</span><span class="operator">)</span><span class="operator">)</span> {
	C2 <span class="operator">=</span> <span class="number">0</span><span class="operator">;</span>
	ST<span class="operator">(</span><span class="number">0</span><span class="operator">)</span> <span class="operator">=</span> Tangens<span class="operator">(</span>ST<span class="operator">(</span><span class="number">0</span><span class="operator">)</span><span class="operator">)</span><span class="operator">;</span>
	Top <span class="operator">=</span> Top <span class="operator">-</span> <span class="number">1</span><span class="operator">;</span>
	ST<span class="operator">(</span><span class="number">0</span><span class="operator">)</span> <span class="operator">=</span> <span class="number">1.0</span><span class="operator">;</span>
}
<span class="keyword">else</span> C2 <span class="operator">=</span> <span class="number">1</span><span class="operator">;</span> <span class="comment">//source operand is out-of-range</span>
</pre>
</td>
</tr>
</table>
</object>
<object>
<table class="box">
<tr>
<th>FPU flags affected</th>
</tr>
<tr>
<td class="instruction_set_reference_box">
<p>C1 Set to 0 if stack underflow occurred; set to 1 if stack overflow occurred.
Set if result was rounded up; cleared otherwise.
C2 Set to 1 if outside range (-2^63 &lt; source operand &lt; +2^63); otherwise, set to 0.
C0, C3 Undefined.
</p>
</td>
</tr>
</table>
</object>
<object>
<table class="box">
<tr>
<th>Floating-Point Exceptions</th>
</tr>
<tr>
<td class="instruction_set_reference_box">
<div>
<table class="operations_table">
<tr><td><code>#IS</code></td><td>Stack underflow or overflow occurred.</td></tr>
<tr><td><code>#IS</code></td><td>Stack underflow or overflow occurred.</td></tr>
<tr><td><code>#IA</code></td><td>Source operand is an SNaN value, pi, or unsupported format.</td></tr>
<tr><td><code>#D</code></td><td>Source operand is a denormal value.</td></tr>
<tr><td><code>#U</code></td><td>Result is too small for destination format.</td></tr>
</table>
</div>
</td>
</tr>
</table>
</object>
<object>
<table class="box">
<tr>
<th>Protected Mode Exceptions</th>
</tr>
<tr>
<td class="instruction_set_reference_box">
<div>
<table class="operations_table">
<tr><td><code>#NM</code></td><td>EM or TS in CR0 is set.</td></tr>
</table>
</div>
</td>
</tr>
</table>
</object>
<object>
<table class="box">
<tr>
<th>Real-Address Mode Exceptions</th>
</tr>
<tr>
<td class="instruction_set_reference_box">
<div>
<table class="operations_table">
<tr><td><code>#NM</code></td><td>EM or TS in CR0 is set.</td></tr>
</table>
</div>
</td>
</tr>
</table>
</object>
<object>
<table class="box">
<tr>
<th>Virtual-8086 Mode Exceptions</th>
</tr>
<tr>
<td class="instruction_set_reference_box">
<div>
<table class="operations_table">
<tr><td><code>#NM</code></td><td>EM or TS in CR0 is set.</td></tr>
</table>
</div>
</td>
</tr>
</table>
</object>
<object>
<table class="box">
<tr>
<th>Instruction</th>
<th>Latency</th>
<th>Throughput</th>
<th>Execution Unit</th>
</tr>
<tr><td class="grid"><code>CPUID</code></td><td class="grid">0F3n/0F2n</td><td class="grid">0F3n/0F2n</td><td class="grid">0F2n</td></tr>
<tr><td class="grid"><code>FPTAN</code></td><td class="grid">240-300/225-250</td><td class="grid">170</td><td class="grid">-</td></tr>
</table>
</object>
</div>
</body>
</html>