floor(3) CLIX floor(3)
NAME
floor, ceil, fmod, fabs - Floor, ceiling, remainder, absolute value
functions
LIBRARY
Standard Math Library (libm.a)
Intergraph Math Library (libmath.a)
SYNOPSIS
#include <math.h>
double floor(
double x );
double ceil(
double x );
double fmod(
double x ,
double y );
double fabs(
double x );
PARAMETERS
x A double
y A double
DESCRIPTION
The floor() function returns the largest integer (as a double-precision
number) not greater than x.
The ceil() function returns the smallest integer not less than x.
The fmod() function returns the floating-point remainder of the division
of x by y: x if y is 0 or if x/y would overflow; otherwise, the number f
with the same sign as x, such that x = iy + f for some integer i, and f<y.
The fabs() function returns the absolute value of x, x.
EXAMPLES
To find the floor, ceiling and absolute values of x, and get x mod y:
2/94 - Intergraph Corporation 1
floor(3) CLIX floor(3)
#include <math.h>
main()
{
double x;
double y;
printf("What is the value of x?\n");
scanf("%E",&x);
printf("what is the value of y?\n");
scanf("%E",&y);
printf("Floor of x = %E.\n",floor(x));
printf("Ceiling of x = %E.\n",ceil(x));
printf("Absolute value of x = %E.\n",fabs(x));
printf("x mod y = %E.\n",fmod(x,y));
}
RETURN VALUES
See DESCRIPTION.
RELATED INFORMATION
Functions: abs(3)
2 Intergraph Corporation - 2/94