| 1 |
'\" t |
| 2 |
.\" Copyright 2002, Walter Harms <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: GPL-1.0-or-later |
| 6 |
.\" |
| 7 |
.TH remquo 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
remquo, remquof, remquol \- remainder and part of quotient |
| 10 |
.SH LIBRARY |
| 11 |
Math library |
| 12 |
.RI ( libm ,\~ \-lm ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <math.h> |
| 16 |
.P |
| 17 |
.BI "double remquo(double " x ", double " y ", int *" quo ); |
| 18 |
.BI "float remquof(float " x ", float " y ", int *" quo ); |
| 19 |
.BI "long double remquol(long double " x ", long double " y ", int *" quo ); |
| 20 |
.fi |
| 21 |
.P |
| 22 |
.RS -4 |
| 23 |
Feature Test Macro Requirements for glibc (see |
| 24 |
.BR feature_test_macros (7)): |
| 25 |
.RE |
| 26 |
.P |
| 27 |
.BR remquo (), |
| 28 |
.BR remquof (), |
| 29 |
.BR remquol (): |
| 30 |
.nf |
| 31 |
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L |
| 32 |
.fi |
| 33 |
.SH DESCRIPTION |
| 34 |
These functions compute the remainder and part of the quotient |
| 35 |
upon division of |
| 36 |
.I x |
| 37 |
by |
| 38 |
.IR y . |
| 39 |
A few bits of the quotient are stored via the |
| 40 |
.I quo |
| 41 |
pointer. |
| 42 |
The remainder is returned as the function result. |
| 43 |
.P |
| 44 |
The value of the remainder is the same as that computed by the |
| 45 |
.BR remainder (3) |
| 46 |
function. |
| 47 |
.P |
| 48 |
The value stored via the |
| 49 |
.I quo |
| 50 |
pointer has the sign of |
| 51 |
.I x\~/\~y |
| 52 |
and agrees with the quotient in at least the low order 3 bits. |
| 53 |
.P |
| 54 |
For example, |
| 55 |
.I remquo(29.0,\ 3.0) |
| 56 |
returns \-1.0 and might store 2. |
| 57 |
Note that the actual quotient might not fit in an integer. |
| 58 |
.\" A possible application of this function might be the computation |
| 59 |
.\" of sin(x). Compute remquo(x, pi/2, &quo) or so. |
| 60 |
.\" |
| 61 |
.\" glibc, UnixWare: return 3 bits |
| 62 |
.\" MacOS 10: return 7 bits |
| 63 |
.SH RETURN VALUE |
| 64 |
On success, these functions return the same value as |
| 65 |
the analogous functions described in |
| 66 |
.BR remainder (3). |
| 67 |
.P |
| 68 |
If |
| 69 |
.I x |
| 70 |
or |
| 71 |
.I y |
| 72 |
is a NaN, a NaN is returned. |
| 73 |
.P |
| 74 |
If |
| 75 |
.I x |
| 76 |
is an infinity, |
| 77 |
and |
| 78 |
.I y |
| 79 |
is not a NaN, |
| 80 |
a domain error occurs, and |
| 81 |
a NaN is returned. |
| 82 |
.P |
| 83 |
If |
| 84 |
.I y |
| 85 |
is zero, |
| 86 |
and |
| 87 |
.I x |
| 88 |
is not a NaN, |
| 89 |
a domain error occurs, and |
| 90 |
a NaN is returned. |
| 91 |
.SH ERRORS |
| 92 |
See |
| 93 |
.BR math_error (7) |
| 94 |
for information on how to determine whether an error has occurred |
| 95 |
when calling these functions. |
| 96 |
.P |
| 97 |
The following errors can occur: |
| 98 |
.TP |
| 99 |
Domain error: \f[I]x\f[] is an infinity or \f[I]y\f[] is 0, \ |
| 100 |
and the other argument is not a NaN. |
| 101 |
.\" .I errno |
| 102 |
.\" is set to |
| 103 |
.\" .BR EDOM . |
| 104 |
An invalid floating-point exception |
| 105 |
.RB ( FE_INVALID ) |
| 106 |
is raised. |
| 107 |
.P |
| 108 |
These functions do not set |
| 109 |
.IR errno . |
| 110 |
.\" FIXME . Is it intentional that these functions do not set errno? |
| 111 |
.\" Bug raised: https://www.sourceware.org/bugzilla/show_bug.cgi?id=6802 |
| 112 |
.SH ATTRIBUTES |
| 113 |
For an explanation of the terms used in this section, see |
| 114 |
.BR attributes (7). |
| 115 |
.TS |
| 116 |
allbox; |
| 117 |
lbx lb lb |
| 118 |
l l l. |
| 119 |
Interface Attribute Value |
| 120 |
T{ |
| 121 |
.na |
| 122 |
.nh |
| 123 |
.BR remquo (), |
| 124 |
.BR remquof (), |
| 125 |
.BR remquol () |
| 126 |
T} Thread safety MT-Safe |
| 127 |
.TE |
| 128 |
.SH STANDARDS |
| 129 |
C11, POSIX.1-2008. |
| 130 |
.SH HISTORY |
| 131 |
glibc 2.1. |
| 132 |
C99, POSIX.1-2001. |
| 133 |
.SH SEE ALSO |
| 134 |
.BR fmod (3), |
| 135 |
.BR logb (3), |
| 136 |
.BR remainder (3) |