Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inline static float Round(const float val, const int prec = 0)
- {
- return ((float)(floor(val * pow(10, prec) + 0.5) / pow(10, prec)));
- }
- Ex :
- Round(260.5657f, 3) returns 261 instead of 260.566
- Round(260.5657f, 0) returns 0 ALL THE TIME
- Round(260.5657f, 1) returns 3 instead of 260.6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement