| <html lang="en"> |
| <head> |
| <title>labs - 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="Stdlib.html#Stdlib" title="Stdlib"> |
| <link rel="prev" href="getenv.html#getenv" title="getenv"> |
| <link rel="next" href="ldiv.html#ldiv" title="ldiv"> |
| <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="labs"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="ldiv.html#ldiv">ldiv</a>, |
| Previous: <a rel="previous" accesskey="p" href="getenv.html#getenv">getenv</a>, |
| Up: <a rel="up" accesskey="u" href="Stdlib.html#Stdlib">Stdlib</a> |
| <hr> |
| </div> |
| |
| <h3 class="section">2.19 <code>labs</code>—long integer absolute value</h3> |
| |
| <p><a name="index-labs-33"></a><strong>Synopsis</strong> |
| <pre class="example"> #include <stdlib.h> |
| long labs(long <var>i</var>); |
| |
| </pre> |
| <p><strong>Description</strong><br> |
| <code>labs</code> returns |
| the absolute value of <var>i</var> (also called the magnitude |
| of <var>i</var>). That is, if <var>i</var> is negative, the result is the opposite |
| of <var>i</var>, but if <var>i</var> is nonnegative the result is <var>i</var>. |
| |
| <p>The similar function <code>abs</code> uses and returns <code>int</code> rather than |
| <code>long</code> values. |
| |
| <p><br> |
| <strong>Returns</strong><br> |
| The result is a nonnegative long integer. |
| |
| <p><br> |
| <strong>Portability</strong><br> |
| <code>labs</code> is ANSI. |
| |
| <p>No supporting OS subroutine calls are required. |
| |
| <p><br> |
| |
| </body></html> |
| |