<title>hypot</title>
<link rel="stylesheet" href="../../math.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
-<link rel="home" href="../../index.html" title="Math Toolkit 2.10.0">
+<link rel="home" href="../../index.html" title="Math Toolkit 2.11.0">
<link rel="up" href="../powers.html" title="Basic Functions">
<link rel="prev" href="powm1.html" title="powm1">
<link rel="next" href="ct_pow.html" title="Compile Time Power of a Runtime Base">
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">></span>
<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">hypot</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">y</span><span class="special">);</span>
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter 19. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
-<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">hypot</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">y</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 19. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
+<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
+<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">hypot</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">y</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
</pre>
<p>
- <span class="bold"><strong>Effects: </strong></span> computes <span class="inlinemediaobject"><img src="../../../equations/hypot.svg"></span>
-in such a way
- as to avoid undue underflow and overflow.
+ <span class="bold"><strong>Effects: </strong></span> computes
+ </p>
+<div class="blockquote"><blockquote class="blockquote"><p>
+ <span class="inlinemediaobject"><img src="../../../equations/hypot.svg"></span>
+
+ </p></blockquote></div>
+<p>
+ in such a way as to avoid undue underflow and overflow.
</p>
<p>
The return type of this function is computed using the <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>result
types.
</p>
<p>
- The final <a class="link" href="../../policy.html" title="Chapter 19. Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can
+ The final <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can
be used to control the behaviour of the function: how it handles errors,
- what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter 19. Policies: Controlling Precision, Error Handling etc">policy
+ what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">policy
documentation for more details</a>.
</p>
<p>
- When calculating <span class="inlinemediaobject"><img src="../../../equations/hypot.svg"></span> it's quite easy for the intermediate terms to
- either overflow or underflow, even though the result is in fact perfectly
- representable.
+ When calculating
+ </p>
+<div class="blockquote"><blockquote class="blockquote"><p>
+ <span class="inlinemediaobject"><img src="../../../equations/hypot.svg"></span>
+
+ </p></blockquote></div>
+<p>
+ it's quite easy for the intermediate terms to either overflow or underflow,
+ even though the result is in fact perfectly representable.
</p>
<h5>
<a name="math_toolkit.powers.hypot.h0"></a>
<span class="phrase"><a name="math_toolkit.powers.hypot.implementation"></a></span><a class="link" href="hypot.html#math_toolkit.powers.hypot.implementation">Implementation</a>
</h5>
<p>
- The function is even and symmetric in x and y, so first take assume <span class="emphasis"><em>x,y
- > 0</em></span> and <span class="emphasis"><em>x > y</em></span> (we can permute the arguments
- if this is not the case).
+ The function is even and symmetric in <span class="emphasis"><em>x</em></span> and <span class="emphasis"><em>y</em></span>,
+ so first take assume <span class="emphasis"><em>x,y > 0</em></span> and <span class="emphasis"><em>x >
+ y</em></span> (we can permute the arguments if this is not the case).
</p>
<p>
- Then if <span class="emphasis"><em>x * ε   >= y</em></span> we can simply return <span class="emphasis"><em>x</em></span>.
+ Then if <span class="emphasis"><em>x * ε >= y</em></span> we can simply return <span class="emphasis"><em>x</em></span>.
</p>
<p>
Otherwise the result is given by:
</p>
-<p>
- <span class="inlinemediaobject"><img src="../../../equations/hypot2.svg"></span>
- </p>
+<div class="blockquote"><blockquote class="blockquote"><p>
+ <span class="inlinemediaobject"><img src="../../../equations/hypot2.svg"></span>
+
+ </p></blockquote></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>