What I am trying to do is very simple yet the results comes up with an error:
float x = 423.36;
NSLog(@"%f", x);
NSLog(@"%.2f", x*17719);
Result:
2012-11-12 11:19:02.096 test[2917:907] 423.359985
2012-11-12 11:19:02.098 test[2917:907] 7501515.50
- First question: On the first NSLog the decimal part is being changed,
how can I keep it as it is? - Second question: Since the decimal changes the multiplication
process is resulting with an inaccurate product.
When calculating it with calculator I get: 7501515.84, and that is what I want to get in my app.
Any ideas ?
Thanks in advance!
Roy.
dont use floats as they are inprecise for everybody. use doubles