NSDecimalNumber multiplication strangeness

Posted by rein on Stack Overflow See other posts from Stack Overflow or by rein
Published on 2010-04-04T22:28:02Z Indexed on 2010/04/04 22:33 UTC
Read the original article Hit count: 245

ExclusivePrice, quantity are both NSDecimalNumbers.

NSDecimalNumber *price = [exclusivePrice decimalNumberByMultiplyingBy:quantity];
NSLog(@"%@ * %@ = %@", exclusivePrice, quantity, price);

The result I get:

2010-04-05 00:22:29.111 TestApp[13269:207] 65 * 2 = -0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007169919476068871316457914368

What I expected:

2010-04-05 00:22:29.111 TestApp[13269:207] 65 * 2 = 130

Can anyone explain this please?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocoa-touch