6.11.187 truncl Function
Rounds the argument rounded to an integer value no large than the argument value.
Include
<math.h>
Prototype
long double truncl(long double x);
Argument
x
- the value to round
Return Value
Returns the value of x
rounded to the nearest integer value that is no
larger in magnitude that the original argument. The rounded integer is returned as a
long double precision floating-point value.
Example
See the notes at the beginning of this chapter or section for
information on using printf()
or scanf()
(and other functions reading and writing the stdin
or
stdout
streams) in the example code.
#include <math.h>
#include <stdio.h>
int main(void)
{
long double x, y;
x = -10.103;
y = truncl(x);
printf("The nearest integer value to %Lf is %Lf\n", x, y);
x = 10.9;
y = truncl(x);
printf("The nearest integer value to %Lf is %Lf\n", x, y);
}
Example Output
The nearest integer value to -10.103000 is -10.000000
The nearest integer value to 10.900000 is 10.000000