Function

NSDecimalCompare(_:_:)

Compares two decimal values.

Declaration

func NSDecimalCompare(_ leftOperand: UnsafePointer<Decimal>, _ rightOperand: UnsafePointer<Decimal>) -> ComparisonResult

Return Value

NSOrderedDescending if leftOperand is bigger than rightOperand; NSOrderedAscending if rightOperand is bigger than leftOperand; or NSOrderedSame if the two operands are equal.

Discussion

For more information, see Number and Value Programming Topics.

See Also

Comparing Decimals

static func < (Decimal, Decimal) -> Bool

Returns a Boolean value indicating whether one decimal number is strictly less than another.

static func == (Decimal, Decimal) -> Bool

Returns a Boolean value indicating whether two decimal numbers are equal.

func isEqual(to: Decimal) -> Bool

Indicates whether this decimal is equal to the specified one.

func isLess(than: Decimal) -> Bool

Indicates whether this decimal is less than the specified one.

func isLessThanOrEqualTo(Decimal) -> Bool

Indicates whether this decimal is less than or equal to the specified one.

func isTotallyOrdered(belowOrEqualTo: Decimal) -> Bool

Returns a Boolean value indicating whether this instance should precede the given value in an ascending sort.

func distance(to: Decimal) -> Decimal

Returns the distance from this value to the specified value.

func advanced(by: Decimal) -> Decimal

Returns a new value advanced by the given distance.