xref: /haiku/src/preferences/screen/Utility.cpp (revision cbe0a0c436162d78cc3f92a305b64918c839d079)
1 #include "Utility.h"
2 #include <math.h>
3 
4 float round(float n, int32 max)
5 {
6 	max = (int32)pow(10, (float)max);
7 
8 	n *= max;
9 	n += 0.5;
10 
11 	int32 tmp = (int32)floor(n);
12 	return (float)tmp / (max);
13 }
14