floor, floorl

De RAD Studio
Aller à : navigation, rechercher

Remonter à math.h - Index


Header File

math.h

Category

Math Routines

Prototype

double floor(double x);

long double floorl(long double x);

Description

Rounds down.

floor finds the largest integer not greater than x.

floorl is the long double version; it takes a long double argument and returns a long double result.

Return Value

floor returns the integer found as a double. floorl returns the integer found as a long double.

Example

#include <math.h>
#include <stdio.h>

int main(void)
{
  double number = 123.54;
  double down, up;

  down = floor(number);
  up = ceil(number);

  printf("original number     %5.2lf\n", number);
  printf("number rounded down %5.2lf\n", down);
  printf("number rounded up   %5.2lf\n", up);

  return 0;
}

Portability

POSIX Win32 ANSI C ANSI C++

floor

+

+

+

+

floorl

+

+

+