views:

48

answers:

1

The documentation confuses me about this. They say:

void NSDecimalCompact (
   NSDecimal *number
);

Discussion Formats number so that calculations using it will take up as little memory as possible. All the NSDecimal... arithmetic functions expect compact NSDecimal arguments.

The last part is important:

All the NSDecimal... arithmetic functions expect compact NSDecimal arguments.

So that means, that I have to execute NSDecimalCompact() on every NSDecimal, every time I provide it as a parameter to one of the NSDecimal... arithmetic functions? Or would I do that only once when creating the NSDecimal?

+1  A: 

You do not need to call NSDecimalCompact(), the results from NSDecimal..() functions are compact as long as the return value is NSCalculationNoError.

PeyloW