xref: /haiku/src/preferences/screen/Utility.cpp (revision bc3955fea5b07e2e94a27fc05e4bb58fe6f0319b)
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