---
title: "NSDecimalCompare(_:_:)"
framework: foundation
role: symbol
role_heading: Function
path: "foundation/nsdecimalcompare(_:_:)"
---

# NSDecimalCompare(_:_:)

Compares two decimal values.

## Declaration

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

## Return Value

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

Discussion For more information, see Number and Value Programming Topics.

## See Also

### Comparing decimals

- [isEqual(to:)](foundation/decimal/isequal(to:).md)
- [isLess(than:)](foundation/decimal/isless(than:).md)
- [isLessThanOrEqualTo(_:)](foundation/decimal/islessthanorequalto(_:).md)
- [isTotallyOrdered(belowOrEqualTo:)](foundation/decimal/istotallyordered(beloworequalto:).md)
- [distance(to:)](foundation/decimal/distance(to:).md)
- [advanced(by:)](foundation/decimal/advanced(by:).md)
