floorl
Round to largest integral value not greater than x
Description
The floor functions return the largest integral value less than or equal to x.Example:
Example - Round to largest integral value not greater than x
Workings
#include <stdio.h> #include <math.h> int main(void) { for (double a = 12.5; a < 13.4; a += 0.1) printf("floor of %.1lf is %.1lf\n", a, floor(a)); return 0; }
Solution
Output:
floor of 12.5 is 12.0 floor of 12.6 is 12.0 floor of 12.7 is 12.0 floor of 12.8 is 12.0 floor of 12.9 is 12.0 floor of 13.0 is 13.0 floor of 13.1 is 13.0 floor of 13.2 is 13.0 floor of 13.3 is 13.0 floor of 13.4 is 13.0