<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/Float/isEqual(to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:Sf7isEqual2toSbSf_tF"
  },
  "title" : "isEqual(to:)"
}
-->

# isEqual(to:)

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

```
func isEqual(to other: Float) -> Bool
```

## Parameters

`other`

The value to compare with this 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

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](http://ieeexplore.ieee.org/servlet/opac?punumber=4610933).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)