| <html lang="en"> |
| <head> |
| <title>remquo - 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="remainder.html#remainder" title="remainder"> |
| <link rel="next" href="rint.html#rint" title="rint"> |
| <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="remquo"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="rint.html#rint">rint</a>, |
| Previous: <a rel="previous" accesskey="p" href="remainder.html#remainder">remainder</a>, |
| Up: <a rel="up" accesskey="u" href="Math.html#Math">Math</a> |
| <hr> |
| </div> |
| |
| <h3 class="section">1.47 <code>remquo</code>, <code>remquof</code>–remainder and part of quotient</h3> |
| |
| <p><a name="index-remquo-129"></a><a name="index-remquof-130"></a><strong>Synopsis</strong> |
| <pre class="example"> #include <math.h> |
| double remquo(double <var>x</var>, double <var>y</var>, int *<var>quo</var>); |
| float remquof(float <var>x</var>, float <var>y</var>, int *<var>quo</var>); |
| |
| </pre> |
| <p><strong>Description</strong><br> |
| The <code>remquo</code> functions compute the same remainder as the <code>remainder</code> |
| functions; this value is in the range -<var>y</var>/2 ... +<var>y</var>/2. In the object |
| pointed to by <code>quo</code> they store a value whose sign is the sign of <code>x</code>/<code>y</code> |
| and whose magnitude is congruent modulo 2**n to the magnitude of the integral |
| quotient of <code>x</code>/<code>y</code>. (That is, <code>quo</code> is given the n lsbs of the |
| quotient, not counting the sign.) This implementation uses n=31 if int is 32 |
| bits or more, otherwise, n is 1 less than the width of int. |
| |
| <p>For example: |
| <pre class="smallexample"> remquo(-29.0, 3.0, &<var>quo</var>) |
| </pre> |
| <p>returns -1.0 and sets <var>quo</var>=10, and |
| <pre class="smallexample"> remquo(-98307.0, 3.0, &<var>quo</var>) |
| </pre> |
| <p>returns -0.0 and sets <var>quo</var>=-32769, although for 16-bit int, <var>quo</var>=-1. In |
| the latter case, the actual quotient of -(32769=0x8001) is reduced to -1 |
| because of the 15-bit limitation for the quotient. |
| |
| <p><br> |
| <strong>Returns</strong><br> |
| When either argument is NaN, NaN is returned. If <var>y</var> is 0 or <var>x</var> is |
| infinite (and neither is NaN), a domain error occurs (i.e. the "invalid" |
| floating point exception is raised or errno is set to EDOM), and NaN is |
| returned. |
| Otherwise, the <code>remquo</code> functions return <var>x</var> REM <var>y</var>. |
| |
| <p><br> |
| <strong>Bugs</strong><br> |
| IEEE754-2008 calls for <code>remquo</code>(subnormal, inf) to cause the "underflow" |
| floating-point exception. This implementation does not. |
| |
| <p><br> |
| <strong>Portability</strong><br> |
| C99, POSIX. |
| |
| <p><br> |
| |
| </body></html> |
| |