1 #include "lxgui/utils_maths.hpp"
13 return std::max(1.0f, std::round(value / unit) * unit);
14 else if (value < 0.0f)
15 return std::min(-1.0f, std::round(value / unit) * unit);
20 default:
return std::round(value / unit) * unit;
float round(float value, float unit, rounding_method method)
Round a floating point value to a specific unit and using a specific rounding method.
rounding_method
Rounding method for points to pixels conversions.
@ down
Equivalent to floor()
@ nearest
Equivalent to round()
@ nearest_not_zero
Equivalent to round() but only returns 0 if input is exactly 0.