---
title: "isTotallyOrdered(belowOrEqualTo:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/double/istotallyordered(beloworequalto:)"
---

# isTotallyOrdered(belowOrEqualTo:)

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

## Declaration

```swift
func isTotallyOrdered(belowOrEqualTo other: Self) -> Bool
```

## Parameters

- `other`: A floating-point value to compare to this value.

## Return Value

Return Value true if this value is ordered below or the same as other in a total ordering of the floating-point type; otherwise, false.

## Discussion

Discussion This relation is a refinement of the less-than-or-equal-to operator (<=) that provides a total order on all values of the type, including signed zeros and NaNs. The following example uses isTotallyOrdered(belowOrEqualTo:) to sort an array of floating-point values, including some that are NaN: var numbers = [2.5, 21.25, 3.0, .nan, -9.5] numbers.sort { !$1.isTotallyOrdered(belowOrEqualTo: $0) } print(numbers) // Prints "[-9.5, 2.5, 3.0, 21.25, nan]" The isTotallyOrdered(belowOrEqualTo:) method implements the total order relation as defined by the IEEE 754 specification.

## See Also

### Comparing Values

- [Floating-Point Operators for Double](swift/floating-point-operators-for-double.md)
- [isEqual(to:)](swift/double/isequal(to:).md)
- [isLess(than:)](swift/double/isless(than:).md)
- [isLessThanOrEqualTo(_:)](swift/double/islessthanorequalto(_:).md)
- [minimum(_:_:)](swift/double/minimum(_:_:).md)
- [minimumMagnitude(_:_:)](swift/double/minimummagnitude(_:_:).md)
- [maximum(_:_:)](swift/double/maximum(_:_:).md)
- [maximumMagnitude(_:_:)](swift/double/maximummagnitude(_:_:).md)
