About | ACP | Buy | Industry Watch | Learning Curve | News | Search | Test
Home » Learning Curve


Wall Street bought a lot of NextStep boxes when they first came out, yet the current parent company are hardly known for their pedigree in the world of business. Small surprise then to discover that Cocoa, via NextStep, has an entire API dedicated to arithmetic manipulations with our common radix for monetary transcactions.

Following is an example of this API. Note in particular the NSRoundBankers rounding mode.


Adds two decimal values.


An NSDecimal can represent a number with up to 38 significant digits. If a number is more precise than that, it must be rounded off. There are four possible rounding modes:

NSRoundDown. The number rounds down.
NSRoundUp. The number rounds up.
NSRoundPlain. The number rounds to the closest 38-digit approximation. If the number is halfway between two positive numbers, it round up; if it's halfway between two negative numbers, it rounds down.
NSRoundBankers. The number rounds to the closest 38-digit approximation. If it is caught halfway between two possibilities, it rounds to the one whose last digit is even. In practice, this means that, over the long run, numbers will be rounded up as often as they are rounded down; there will be no systematic bias.
About | Buy | Industry Watch | Learning Curve | Products | Search
Copyright © Rixstep. All rights reserved.