Contents

NSDecimalNumber.RoundingMode

These constants specify rounding behaviors.

Declaration

enum RoundingMode

Overview

The rounding mode matters only if the scale() method sets a limit on the precision of NSDecimalNumber return values. It has no effect if scale() returns NSDecimalNoScale. Assuming that scale() returns 1, the rounding mode has the following effects on various original values:

Original Value

NSRoundPlain

NSRoundDown & NS RoundUp

NSRoundBankers

1.24

1.2

1.2 & 1.3

1.2

1.26

1.3

1.2 & 1.3

1.3

1.25

1.3

1.2 & 1.3

1.2

1.35

1.4

1.3 & 1.4

1.4

–1.35

–1.4

–1.4 & -1.3

–1.4

Topics

Constants

Initializers

See Also

Performing arithmetic using references