How can I round a float value (such as 37.777779) to two decimal places (37.78) in C?
I made this macro for rounding float numbers. Add it in your header / being of file
#define ROUNDF(f, c) (((float)((int)((f) * (c))) / (c)))
Here is an example:
float x = ROUNDF(3.141592, 100)
x equals 3.14 :)