---
title: "isEqual(to:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/double/isequal(to:)"
---

# isEqual(to:)

Returns a Boolean value indicating whether this instance is equal to the given value.

## Declaration

```swift
func isEqual(to other: Double) -> Bool
```

## Parameters

- `other`: The value to compare with this value.

## Return Value

Return Value true if other has the same value as this instance; otherwise, false. If either this value or other is NaN, the result of this method is false.

## Discussion

Discussion This method serves as the basis for the equal-to operator (==) for floating-point values. When comparing two values with this method, -0 is equal to +0. NaN is not equal to any value, including itself. For example: let x = 15.0 x.isEqual(to: 15.0) // true x.isEqual(to: .nan) // false Double.nan.isEqual(to: .nan) // false The isEqual(to:) method implements the equality predicate defined by the IEEE 754 specification.

## See Also

### Comparing Values

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