blob: 6f0de9c6290af7cd2de803d2930c85f780d53043 [file]
<html lang="en">
<head>
<title>lrint - 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="logb.html#logb" title="logb">
<link rel="next" href="lround.html#lround" title="lround">
<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="lrint"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="lround.html#lround">lround</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="logb.html#logb">logb</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Math.html#Math">Math</a>
<hr>
</div>
<h3 class="section">1.38 <code>lrint</code>, <code>lrintf</code>, <code>llrint</code>, <code>llrintf</code>&ndash;round to integer</h3>
<p><a name="index-lrint-108"></a><a name="index-lrintf-109"></a><a name="index-llrint-110"></a><a name="index-llrintf-111"></a><strong>Synopsis</strong>
<pre class="example"> #include &lt;math.h&gt;
long int lrint(double <var>x</var>);
long int lrintf(float <var>x</var>);
long long int llrint(double <var>x</var>);
long long int llrintf(float <var>x</var>);
</pre>
<p><strong>Description</strong><br>
The <code>lrint</code> and <code>llrint</code> functions round their argument to the nearest
integer value, using the current rounding direction. If the rounded value is
outside the range of the return type, the numeric result is unspecified. A
range error may occur if the magnitude of <var>x</var> is too large.
The "inexact" floating-point exception is raised in implementations that
support it when the result differs in value from the argument (i.e., when
a fraction actually has been truncated).
<p><br>
<strong>Returns</strong><br>
<var>x</var> rounded to an integral value, using the current rounding direction.
<p><br>
<strong>See Also</strong><br>
<code>lround</code>
<p><br>
<strong>Portability</strong><br>
ANSI C, POSIX
<p><br>
</body></html>