floor(3M)
floor, floorl, ffloor, floorf, ceil, ceill, fceil, ceilf, copysign, copysignl, drem, dreml, fmod, fmodl, fmodf, fabsl, fabs, fabsf, remainder, rint, rintl, trunc, truncl, ftrunc, truncf - Floor, ceiling, remainder, absolute value, nearest integer, and truncation functions
As shipped in IRIX 6.5.5. Last changed in IRIX 6.5.5.
NAME floor, floorl, ffloor, floorf, ceil, ceill, fceil, ceilf, copysign, copysignl, drem, dreml, fmod, fmodl, fmodf, fabsl, fabs, fabsf, remainder, rint, rintl, trunc, truncl, ftrunc, truncf - Floor, ceiling, remainder, absolute value, nearest integer, and truncation functions SYNOPSIS #include <math.h> double floor (double x); long double floorl (long double x); float ffloor (float x); float floorf (float x); double ceil (double x); long double ceill (long double x); float fceil (float x); float ceilf (float x); double copysign (double x, double y); long double copysignl \ (long double x, long double y); "double drem (double x, double y);" long double dreml \ (long double x, long double y); "double remainder (double x, double y);" double trunc (double x); long double truncl (long double x); float ftrunc (float x); float truncf (float x); double fmod (double x, double y); long double fmodl \ (long double x, long double y); float fmodf (float x, float y); double fabs (double x); long double fabsl (long double x); float fabsf (float x); double rint (double x); long double rintl (long double x); IMPLEMENTATION IRIX systems DESCRIPTION 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 floor functions return the largest integer not greater than x. The argument x is double for floor, long double for floorl, and float for ffloor and its ANSI-named equivalent floorf. copysign(x,y) returns the number with the magnitude of x and the sign of y. copysignl is the long double counterpart of copysign. 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. dreml is the long double counterpart of drem. The ceil functions return the smallest integer not less than x. The argument x is double for ceil, long double for ceill, and float for fceil and its ANSI-named equivalent ceilf. The trunc functions return the integer (represented as a floating- point number) of x with the fractional bits truncated. The argument x is double for trunc, long double for truncl, and float for ftrunc. fabs returns the absolute value of the double x, |x|. It also has counterparts of type long double and float, namely fabsl, and fabsf, respectively. rint returns the integer (represented as a double precision number) nearest its double argument x in the direction of the prevailing rounding mode. rintl is the long double counterpart of rint. rint has no counterpart that accepts an argument of type float. 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) fmodl is the counterpart of fmod which accepts and returns values of type long double, and fmodf is the counterpart of fmod which accepts and returns values of type float. 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 are optional according to the ANSI C Programming Language Specification ISO/IEC 9899 : 1990 (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) This man page is available only online.