blob: 8f514e3031982691f14369c42187b772c2661740 [file]
<html lang="en">
<head>
<title>hypot - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Math.html#Math" title="Math">
<link rel="prev" href="gamma.html#gamma" title="gamma">
<link rel="next" href="ilogb.html#ilogb" title="ilogb">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="hypot"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="ilogb.html#ilogb">ilogb</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="gamma.html#gamma">gamma</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Math.html#Math">Math</a>
<hr>
</div>
<h3 class="section">1.27 <code>hypot</code>, <code>hypotf</code>&mdash;distance from origin</h3>
<p><a name="index-hypot-73"></a><a name="index-hypotf-74"></a><strong>Synopsis</strong>
<pre class="example"> #include &lt;math.h&gt;
double hypot(double <var>x</var>, double <var>y</var>);
float hypotf(float <var>x</var>, float <var>y</var>);
</pre>
<p><strong>Description</strong><br>
<code>hypot</code> calculates the Euclidean distance
<code>sqrt(</code><var>x</var><code>*</code><var>x</var><code> + </code><var>y</var><code>*</code><var>y</var><code>)</code>
between the origin (0,0) and a point represented by the
Cartesian coordinates (<var>x</var>,<var>y</var>). <code>hypotf</code> differs only
in the type of its arguments and result.
<p><br>
<strong>Returns</strong><br>
Normally, the distance value is returned. On overflow,
<code>hypot</code> returns <code>HUGE_VAL</code> and sets <code>errno</code> to
<code>ERANGE</code>.
<p>You can change the error treatment with <code>matherr</code>.
<p><br>
<strong>Portability</strong><br>
<code>hypot</code> and <code>hypotf</code> are not ANSI C.
<br>
</body></html>