*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> standard/floor (3)              
Title
Content
Arch
Section
 

Contents


FLOOR(3M)							     FLOOR(3M)


NAME    [Toc]    [Back]

     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    [Toc]    [Back]

     #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);

DESCRIPTION    [Toc]    [Back]

     The fmod, fabs, and trunc functions listed	above, 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.





									Page 1






FLOOR(3M)							     FLOOR(3M)



     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 below under DIAGNOSTICS.  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 which 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 both the
     invocations
	  fmod(2.5,1.0)
	  fmod(2.5,-1.0)
     yield 0.5,	while the two invocations
	  fmod(-2.5,1.0)
	  fmod(-2.5,-1.0)
     yield -0.5.
     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    [Toc]    [Back]

     In	the diagnostics	below, 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



									Page 2






FLOOR(3M)							     FLOOR(3M)



     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 NaN.

     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    [Toc]    [Back]

     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, resp.)

     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 (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    [Toc]    [Back]

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









									Page 3



FLOOR(3I)					       Last changed: 1-6-98

NAME    [Toc]    [Back]

     FLOOR - Returns the greatest integer less than or equal to	its
     argument

SYNOPSIS    [Toc]    [Back]

     FLOOR ([A=]a)

IMPLEMENTATION    [Toc]    [Back]

     UNICOS, UNICOS/mk,	and IRIX systems

STANDARDS    [Toc]    [Back]

     Fortran 90

DESCRIPTION    [Toc]    [Back]

     The FLOOR intrinsic function returns the greatest integer less than or
     equal to its argument.  It	accepts	the following argument:

     a	  Must be of type real

     FLOOR is an elemental function.  The name of this intrinsic cannot	be
     passed as an argument.

NOTES    [Toc]    [Back]

     On	UNICOS systems,	both execution speed and the number of bits used in
     mathematical operations are affected when compiling with
     f90 -O fastint, which is the default setting.  For	more information on
     this, see the CF90	Commands and Directives	Reference Manual,
     publication SR-3901.

RETURN VALUES    [Toc]    [Back]

     The result	is a default integer.  The result has value equal to the
     greatest integer less than	or equal to a.	The result is undefined	if
     the target	machine	cannot represent this value in the default integer
     type.

EXAMPLES    [Toc]    [Back]

     FLOOR(3.7)	has the	value 3.  FLOOR(-3.7) has the value -4.

SEE ALSO    [Toc]    [Back]

      
      
     CF90 Commands and Directives Reference Manual, publication	SR-3901

     Intrinsic Procedures Reference Manual, publication	SR-2138, for the
     printed version of	this man page.

FLOOR(3I)					       Last changed: 1-6-98

NAME    [Toc]    [Back]

     FLOOR - Returns the greatest integer less than or equal to	its
     argument

SYNOPSIS    [Toc]    [Back]

     FLOOR ([A=]a)

IMPLEMENTATION    [Toc]    [Back]

     UNICOS, UNICOS/mk,	and IRIX systems

STANDARDS    [Toc]    [Back]

     Fortran 90

DESCRIPTION    [Toc]    [Back]

     The FLOOR intrinsic function returns the greatest integer less than or
     equal to its argument.  It	accepts	the following argument:

     a	  Must be of type real

     FLOOR is an elemental function.  The name of this intrinsic cannot	be
     passed as an argument.

NOTES    [Toc]    [Back]

     On	UNICOS systems,	both execution speed and the number of bits used in
     mathematical operations are affected when compiling with
     f90 -O fastint, which is the default setting.  For	more information on
     this, see the CF90	Commands and Directives	Reference Manual,
     publication SR-3901.

RETURN VALUES    [Toc]    [Back]

     The result	is a default integer.  The result has value equal to the
     greatest integer less than	or equal to a.	The result is undefined	if
     the target	machine	cannot represent this value in the default integer
     type.

EXAMPLES    [Toc]    [Back]

     FLOOR(3.7)	has the	value 3.  FLOOR(-3.7) has the value -4.

SEE ALSO    [Toc]    [Back]

      
      
     CF90 Commands and Directives Reference Manual, publication	SR-3901

     Intrinsic Procedures Reference Manual, publication	SR-2138, for the
     printed version of	this man page.

[ Back ]
 Similar pages
Name OS Title
round IRIX FORTRAN nearest integer functions
lround Linux round to nearest integer, away from zero
round Linux round to nearest integer, away from zero
rint Linux round to nearest integer
lrint Linux round to nearest integer
div Linux computes the quotient and remainder of integer division
ldiv Linux computes the quotient and remainder of long integer division.
abs FreeBSD integer absolute value function
abs Linux compute the absolute value of an integer.
abs OpenBSD integer absolute value function
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service