I logged two NSDecimalNumber
NSLog(@"%@",[[NSDecimalNumber alloc] initWithFloat:2.675f]);
NSLog(@"%@",[[NSDecimalNumber alloc] initWithFloat:2.000f]);
I got the results in the console as
10:26 2013-05-16 10:23:20.807 SampleTest[1097:19d03] 2.674999952316284416
2013-05-16 10:23:22.484 SampleTest[1097:19d03] 2
My expected result is 2.0000
. It is fine to have any number of zero's after decimal But should have atleast one zero after the decimal point. It will be hard for me to change the NSDecimalNumber
datatype.
How can I acheive that. Can anyone help me out. Thanks in advance.