CodeCogs - An iteractive open source Numerical library Welcome... Login
CodeCogs
shopping cart
OSXWindowsLinux
Search CodeCogs
Numerical Pages

Valid RSS

CMath.h

floor

About | FAQ | Contact
About FAQ Contact

Round to largest integral value not greater than x

viewed 42362 times


+View other versions (3)
Contents -

Interface

#include <math.h>
double floor (double x)
long floorl (long double x)
float floorf (float x)

Description

The floor functions return the largest integral value less than or equal to x.
Example 1:
#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;
}

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

Special Values

floor ( ±0 ) returns ±0.
floor ( ±∞ ) returns ±∞.

See Also

abs, ceil, fabs

Standards

The floor functions conform to ISO/IEC 9899:1999(E).
Last Modified: 2009-11-01 08:41:18     Page Rendered: 2010-03-14 00:40:07

Page Comments

Format Excel Equations

  You must login to leave a messge


Valid CSS!   Valid XHTML 1.0 Transitional