I'm using xcode. I have something like this in my code
NSNumber *a=[NSNumber numberWithDouble:[@"0.07" doubleValue]];
//after that line a value is 0.07000000000000001
NSNumber *a=[NSNumber numberWithDouble:[@"0.099999999999999" doubleValue]];
// after that line a value is 0.09999999999999901
I found these 2 exceptions. Others numbers are working fine. How can I fix it?
i need to convert a string in a nsnumber, but this is trowing my a wrong number i need a value to be 0.07 equal as the string number. This number will be typed by the user and i need to show later the number exactly how he typed it, i cant rounding it with a formatter, because i don't know the quantity of decimals that the user type.