std::ceil
rounds up to the nearest integer
std::floor
rounds down to the nearest integer
std::round
performs the behavior you expect
please give a use case with numbers if this does not provide you with what you need!
More Related Contents:
- Sin and Cos give unexpected results for well-known angles
- Constexpr Math Functions
- Why are some functions in not in the std namespace?
- Is std::abs(0u) ill-formed?
- GCC C++ pow accuracy
- When do I use fabs and when is it sufficient to use std::abs?
- Why is pow(int, int) so slow?
- Getting a segmentation error when printing my array of strings
- SDL and C++ Class…how to separate this code?
- How do you clear a stringstream variable?
- Can I call a base class’s virtual function if I’m overriding it?
- What does C++ struct syntax “a : b” mean
- What belongs in an educational tool to demonstrate the unwarranted assumptions people make in C/C++?
- When passing an array to a function in C++, why won’t sizeof() work the same as in the main function?
- Modifying a const through a non-const pointer
- Error when compiling some simple c++ code
- Spiral rule and ‘declaration follows usage’ for parsing C and C++ declarations
- Why does std::array not have an constructor that takes a value for the array to be filled with?
- How to get the digits of a number without converting it to a string/ char array?
- How is P0522R0 breaking code?
- invalid conversion from ‘const char*’ to ‘char’
- CMake does not find Visual C++ compiler
- What happens if I read a map’s value where the key does not exist?
- C++ static template member, one instance for each template type?
- Determine if map contains a value for a key?
- What does the void() in decltype(void()) mean exactly?
- How to deal with global-constructor warning in clang?
- How do I print to the debug output window in a Win32 app?
- Template Function Specialization for Integer Types
- C++ 11: Calling a C++ function periodically