Round functions (in #include <mrpt/core/round.h>)

Overview

// global functions

template <typename T>
int mrpt::round(const T value);

template <typename T>
long mrpt::round_long(const T value);

template <class T>
T mrpt::round_10power(T val, int power10);

Global Functions

template <typename T>
int mrpt::round(const T value)

Returns the closer integer (int) to x.

template <typename T>
long mrpt::round_long(const T value)

Returns the closer integer (long) to x.

template <class T>
T mrpt::round_10power(T val, int power10)

Round a decimal number up to the given 10’th power (eg, to 1000,100,10, and also fractions) power10 means round up to: 1 -> 10, 2 -> 100, 3 -> 1000, …

-1 -> 0.1, -2 -> 0.01, …