Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) std::floor

 

std::floor is an STL mathematical function to round off a double down to the first integer. For example, the double 1.9 becomes the integer 1. Or more general, the double X.Y becomes the integer X.

 

#include <cassert>
#include <cmath>

int main()
{
  const int x = std::floor(1.9);
  assert(x == 1);
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict