floor()
Anonymous contributor
Anonymous contributor3077 total contributions
Anonymous contributor
Published Jul 16, 2021Updated Dec 21, 2022
Contribute to Docs
The floor()
function returns the first whole number that is less than or equal to the argument.
Syntax
The cmath
library must be added at the top of the file.
std::floor(n);
Argument must be a double
/float
/long double
, and the return value will be the same type.
Example
double result;result = std::floor(n);
Codebyte Example
Use floor()
to round down the double 12.3456
:
All contributors
- Anonymous contributorAnonymous contributor3077 total contributions
- StevenSwiniarski475 total contributions
- Christine_Yang271 total contributions
- garanews222 total contributions
- christian.dinh2481 total contributions
- Anonymous contributor
- StevenSwiniarski
- Christine_Yang
- garanews
- christian.dinh
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.