NSDecimalNumber subtraction

Posted by happyCoding25 on Stack Overflow See other posts from Stack Overflow or by happyCoding25
Published on 2010-04-17T12:40:14Z Indexed on 2010/04/17 12:43 UTC
Read the original article Hit count: 370

Hello,

I need to subtract 0.5 from number a and set the answer to number b. My code looks like it would work but I'm not sure what I'm doing wrong. The error I get Is on the subtraction line, the error says incompatible type for argument 1 of 'decimalNumberBySubtracting:'.

Heres my header: (Note: I only showed the numbers because the header is large)

    NSDecimalNumber *a;
    NSDecimalNumber *b;

Heres the rest: (Assume this is in an IBAction)

    b = [a decimalNumberBySubtracting:0.5];

If anyone knows how to properly subtract any help would be appreciated.

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about math