I've got a float value from an accelerometer which looks like this:
-3.04299553323
I'd like to get -3.04 for example. Is there an easy way for rounding that float value?
Edit:
http://stackoverflow.com/questions/752817/rounding-numbers-in-objective-c
I've got a float value from an accelerometer which looks like this:
-3.04299553323
I'd like to get -3.04 for example. Is there an easy way for rounding that float value?
Edit:
http://stackoverflow.com/questions/752817/rounding-numbers-in-objective-c
float f = -3.04299553323
int i = f *100; //-304
float answer = i/100 ;//-3.04