Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. inline static float Round(const float val, const int prec = 0)
  2. {
  3. return ((float)(floor(val * pow(10, prec) + 0.5) / pow(10, prec)));
  4. }
  5.  
  6. Ex :
  7. Round(260.5657f, 3) returns 261 instead of 260.566
  8. Round(260.5657f, 0) returns 0 ALL THE TIME
  9. Round(260.5657f, 1) returns 3 instead of 260.6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement