(libc.info.gz) Remainder Functions
Info Catalog
(libc.info.gz) Rounding Functions
(libc.info.gz) Arithmetic Functions
(libc.info.gz) FP Bit Twiddling
20.8.4 Remainder Functions
--------------------------
The functions in this section compute the remainder on division of two
floating-point numbers. Each is a little different; pick the one that
suits your problem.
-- Function: double fmod (double NUMERATOR, double DENOMINATOR)
-- Function: float fmodf (float NUMERATOR, float DENOMINATOR)
-- Function: long double fmodl (long double NUMERATOR, long double
DENOMINATOR)
Preliminary: | MT-Safe | AS-Safe | AC-Safe | POSIX Safety
Concepts.
These functions compute the remainder from the division of
NUMERATOR by DENOMINATOR. Specifically, the return value is
'NUMERATOR - N * DENOMINATOR', where N is the quotient of NUMERATOR
divided by DENOMINATOR, rounded towards zero to an integer. Thus, 'fmod (6.5, 2.3)'
returns '1.9', which is '6.5' minus '4.6'.
The result has the same sign as the NUMERATOR and has magnitude
less than the magnitude of the DENOMINATOR.
If DENOMINATOR is zero, 'fmod' signals a domain error.
-- Function: double drem (double NUMERATOR, double DENOMINATOR)
-- Function: float dremf (float NUMERATOR, float DENOMINATOR)
-- Function: long double dreml (long double NUMERATOR, long double
DENOMINATOR)
Preliminary: | MT-Safe | AS-Safe | AC-Safe | POSIX Safety
Concepts.
These functions are like 'fmod' except that they round the internal
quotient N to the nearest integer instead of towards zero to an
integer. For example, 'drem (6.5, 2.3)' returns '-0.4', which is
'6.5' minus '6.9'.
The absolute value of the result is less than or equal to half the
absolute value of the DENOMINATOR. The difference between 'fmod
(NUMERATOR, DENOMINATOR)' and 'drem (NUMERATOR, DENOMINATOR)' is
always either DENOMINATOR, minus DENOMINATOR, or zero.
If DENOMINATOR is zero, 'drem' signals a domain error.
-- Function: double remainder (double NUMERATOR, double DENOMINATOR)
-- Function: float remainderf (float NUMERATOR, float DENOMINATOR)
-- Function: long double remainderl (long double NUMERATOR, long double
DENOMINATOR)
Preliminary: | MT-Safe | AS-Safe | AC-Safe | POSIX Safety
Concepts.
This function is another name for 'drem'.
Info Catalog
(libc.info.gz) Rounding Functions
(libc.info.gz) Arithmetic Functions
(libc.info.gz) FP Bit Twiddling
automatically generated by
info2html