FLOOR(3M)FLOOR(3M)


NAME
     ceil, copysign, drem, fabs, floor, fmod, remainder, remquo, rintf,
     roundf, rint, round, trunc, ceilf, copysignf, dremf, fabsf, floorf,
     fmodf, remquof, truncf, ceill, copysignl, dreml, fabsl, floorl, fmodl,
     remquol, rintl, roundl, truncl, lrint, lrintf, lrintl, llrint,
     llrintf, llrintl, lround, lroundf, lroundl, llround, llroundf,
     llroundl - Floor, ceiling, remainder, absolute value, nearest integer,
     and truncation functions

SYNOPSIS
     #include <math.h>

     double ceil (double x);
     float ceilf (float x);
     long double ceill (long double x);

     double copysign (double x, double y);
     float copysignf (float x, float y);
     long double copysignl (long double x, long double y);

     double drem (double x, double y);
     float dremf (float x, float y);
     long double dreml (long double x, long double y);

     double fabs (double x);
     float fabsf (float x);
     long double fabsl (long double x);

     double floor (double x);
     float floorf (float x);
     long double floorl (long double x);

     double fmod (double x, double y);
     float fmodf (float x, float y);
     long double fmodl (long double x, long double y);

     double remainder (double x, double y);
     double remquo(double x, double y, int *quo);
     float remquof(float x, float y, int *quo);
     long double remquol(long double x, long double y, int *quo);

     double rint (double x);
     float rintf (float x);
     long double rintl (long double x);

     double round(double x);
     float roundf(float x);
     long double roundl(long double x);

     double trunc (double x);
     float truncf (float x);
     long double truncl (long double x);

     long int lrint double x);
     long int lrintf (float x);
     long int lrintl (long double x);

     long long int llrint (double x);
     long long int llrintf (float x);
     long long int llrintl (long double x);

     long int lround(double x);
     long int lroundf(float x);
     long int lroundl(long double x);

     long long int llround(double x);
     long long int llroundf(float x);
     long long int llroundl(long double x);

DESCRIPTION
     Alternate entries exist for several routines. The following lists
     these routines and the ANSI standard name and the alternate name:

     ANSI standard name       Alternate name

     floorf                   ffloor

     ceilf                    fceil

     truncf                   ftrunc

     fabsl                    qabs

     ceill                    qceil

     copysignl                qcopysign

     dreml                    qdrem

     floorl                   qfloor

     fmodl                    qmod

     rintl                    qrint

     truncl                   qtrunc

     These functions are not available for programs compiled with the O32
     ABI.

     The fmod, fabs, and trunc functions listed in the SYNOPSIS as well as
     the long double and single-precision versions of the remaining
     functions, are only available in the standard math library, -lm, and
     in -lmx.

     The ceil functions return the smallest integer not less than x.

     The copysign(x,y) functions produce a value with the magnitude of x
     and the sign of y.

     drem(x,y) returns the remainder r := x - n*y where n is the integer
     nearest the exact value of x/y; moreover, if |n-x/y|=1/2 then n is
     even.  Consequently, the remainder is computed exactly and |r| <
     |y|/2.  But drem(x,0) is exceptional; see the DIAGNOSTICS section on
     this man page.  remainder is an alternate entry point for drem.

     fabs returns the absolute value of the double x, |x|.

     The floor functions return the largest integer not greater than x.

     fmod returns the floating-point remainder of the division of its
     double arguments x by y.  It returns a number f with the same sign as
     x, such that x = iy + f for some integer i, and |f| < |y|.  Hence, the
     following two invocations yield 0.5:

               fmod(2.5,1.0)
               fmod(2.5,-1.0)

     while the following two invocations yield -0.5:

               fmod(-2.5,1.0)
               fmod(-2.5,-1.0)

     The lrint and llrint functions round their argument to the nearest
     integer value, rounding according to the current rounding direction.
     They return the rounded integer value.

     The lround and llround functions round their argument to the nearest
     integer value, rouding halfway cases away from zero regardless of the
     current rounding direction.

     The remquo functions compute the same remainder as the remainder
     functions. In the object pointed to by quo, they store a value whose
     sign is the sign of x/y and whose magnitude is congruent modulo 2^n to
     the magnitude of the integral quotient of x/y, where n is an
     implemntation-defined integer greater than or equal to 3.

     rint returns the integer (represented as a double precision number)
     nearest its double argument x in the direction of the prevailing
     rounding mode.

     The round functions round their argument to the nearest integer value
     in floating-point format, rounding halfway cases away from zero,
     regardless of the current rounding direction.

     The trunc functions return the integer (represented as a floating-
     point number) of x with the fractional bits truncated.

DIAGNOSTICS
     In the following diagnostics, functions in the standard math library
     libm.a, are referred to as -lm versions, those in math library libmx.a
     are referred to as -lmx versions, and those in the the BSD math
     library libm43.a are referred to as -lm43 versions.  The -lm and -lmx
     versions always return the default Quiet NaN and set errno to EDOM
     when a NaN is used as an argument.  A NaN argument usually causes the
     -lm43 versions to return the same argument.  The -lm43 versions never
     set errno.  The value of HUGE_VAL is IEEE Infinity.

     If y (and, possibly, x) are zero, or if x is +/-HUGE_VAL, the fmod
     functions return a quiet NaN, and set errno to EDOM.

     IEEE 754 defines drem(x,0) and drem(infinity,y) to be invalid
     operations that produce a .

     A version of the double-precision fabs function exists in the C
     library as well.  The C library version may not behave correctly when
     the input is NaN.

NOTES
     Long double operations on this system are only supported in round to
     nearest rounding mode (the default).  The system must be in round to
     nearest rounding mode when calling any of the long double functions,
     or incorrect answers will result.

     Users concerned with portability to other computer systems should note
     that the long double and float versions of these functions were
     optional according to the ANSI C Programming Language Specification
     ISO/IEC 9899 : 1990 (E) and are no longer optional according to
     ISO/IEC 9899:1999(E).

     Long double functions have been renamed to be compliant with the
     ANSI-C standard, however to be backward compatible, they may still be
     called with the double precision function name prefixed with a q.
     (Exceptions:  functions fabsl and fmodl may be called with names qabs
     and qmod, respectively.)

     In the default rounding mode, round to nearest, rint(x) is the integer
     nearest x with the additional stipulation that if |rint(x)-x|=1/2 then
     rint(x) is even.  Other rounding modes can make rint act like floor,
     or like ceil, or round towards zero.

     Another way to obtain an integer near x is to declare the following
     (in C):

          double x;    int k;    k=x;

     The C compilers round x towards zero to get the integer k.  Also note
     that, if x is larger than k can accommodate, the value of k and the
     presence or absence of an integer overflow are hard to detect.

     IEEE 754 requires copysign(x,Nan) = +-x.  In this implementation of
     copysign, the sign of NaN is ignored.  Thus, copysign(x, +-NaN) = +x,
     and copysign(+-NaN,x) = +NaN.

SEE ALSO
     abs(3C), math(3M), matherr(3M)