blob: 0579a742a2819af40521a4918a547973f4e47fbe [file] [log] [blame] [raw]
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="style.css" type="text/css" rel="stylesheet">
<title>FSQRT—Square Root </title></head>
<body>
<h1>FSQRT—Square Root</h1>
<table>
<tr>
<th>Opcode</th>
<th>Instruction</th>
<th>64-Bit Mode</th>
<th>Compat/Leg Mode</th>
<th>Description</th></tr>
<tr>
<td>D9 FA</td>
<td>FSQRT</td>
<td>Valid</td>
<td>Valid</td>
<td>Computes square root of ST(0) and stores the result in ST(0).</td></tr></table>
<h2>Description</h2>
<p>Computes the square root of the source value in the ST(0) register and stores the result in ST(0).</p>
<p>The following table shows the results obtained when taking the square root of various classes of numbers, assuming that neither overflow nor underflow occurs.</p>
<h3>Table 3-47. FSQRT Results</h3>
<table>
<tr>
<th>SRC (ST(0))</th>
<th>DEST (ST(0))</th></tr>
<tr>
<td>− ∞</td>
<td>*</td></tr>
<tr>
<td>− F</td>
<td>*</td></tr>
<tr>
<td>− 0</td>
<td>− 0</td></tr>
<tr>
<td>+ 0</td>
<td>+ 0</td></tr>
<tr>
<td>+ F</td>
<td>+ F</td></tr>
<tr>
<td>+ ∞</td>
<td>+ ∞</td></tr>
<tr>
<td>NaN</td>
<td>NaN</td></tr></table>
<p><strong>NOTES:</strong></p>
<p>F Means finite floating-point value.</p>
<p>*</p>
<p>Indicates floating-point invalid-arithmetic-operand (#IA) exception.</p>
<p>This instruction’s operation is the same in non-64-bit modes and 64-bit mode.</p>
<h2>Operation</h2>
<pre>ST(0) ← SquareRoot(ST(0));</pre>
<h2>FPU Flags Affected</h2>
<table class="exception-table">
<tr>
<td>C1</td>
<td>
<p>Set to 0 if stack underflow occurred.</p>
<p>Set if result was rounded up; cleared otherwise.</p></td></tr>
<tr>
<td>C0, C2, C3</td>
<td>Undefined.</td></tr></table>
<h2>Floating-Point Exceptions</h2>
<table class="exception-table">
<tr>
<td>#IS</td>
<td>Stack underflow occurred.</td></tr>
<tr>
<td>#IA</td>
<td>
<p>Source operand is an SNaN value or unsupported format.</p>
<p>Source operand is a negative value (except for −0).</p></td></tr></table>
<p>#D</p>
<p>Source operand is a denormal value.</p>
<p>#P</p>
<p>Value cannot be represented exactly in destination format.</p>
<h2>Protected Mode Exceptions</h2>
<table class="exception-table">
<tr>
<td>#NM</td>
<td>CR0.EM[bit 2] or CR0.TS[bit 3] = 1.</td></tr>
<tr>
<td>#MF</td>
<td>If there is a pending x87 FPU exception.</td></tr>
<tr>
<td>#UD</td>
<td>If the LOCK prefix is used.</td></tr></table>
<h2>Real-Address Mode Exceptions</h2>
<p>Same exceptions as in protected mode.</p>
<h2>Virtual-8086 Mode Exceptions</h2>
<p>Same exceptions as in protected mode.</p>
<h2>Compatibility Mode Exceptions</h2>
<p>Same exceptions as in protected mode.</p>
<h2>64-Bit Mode Exceptions</h2>
<p>Same exceptions as in protected mode.</p></body></html>