Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ floor(3M) — Sun WorkShop 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

aint(3M)

FLOOR(3M)  —  MATHEMATICAL LIBRARY

NAME

floor, ceil, rint − round to integral value in floating-point format

SYNOPSIS

#include <math.h>

double ceil(double x);

double floor(double x);

double rint(double x);

DESCRIPTION

ceil(), floor() and rint() convert a double value into an integral value in double format.  They vary in how they choose the result when the argument is not already an integral value.  Here an “integral value” means a value of a mathematical integer, which however might be too large to fit in a particular computer’s int format.  All sufficiently large values in a particular floating-point format are already integral; in IEEE754 double-precision format, that means all values >= 2∗∗52.  Zeros, infinities, and quiet NaNs are treated as integral values by these functions, which always preserve their argument’s sign. 

ceil() returns the least integral value greater than or equal to x. This corresponds to IEEE754 rounding toward positive infinity. 

floor() returns the greatest integral value less than or equal to x. This corresponds to IEEE754 rounding toward negative infinity. 

rint() rounds x to an integral value according to the current IEEE754 rounding direction. 

SEE ALSO

aint(3M)

Sun Release 4.1  —  Last change: 22 Jul 1994

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026