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