# no-floating-point-equality

Rule `sonarjs/no-floating-point-equality`. Floating point numbers should not be tested for equality

- Source: sonarjs
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 6.2M weekly downloads of presets that enable it
- Trend: +62.1% last quarter
- Rank: #1271 by reach, #572 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `sonarjs/no-floating-point-equality` | yes | no | package `eslint-plugin-sonarjs` | [docs](https://rules.sonarsource.com/javascript/RSPEC-1244/) |

## Enable it

### ESLint: `eslint.config.js`

```js
export default [
  {
    rules: {
      "sonarjs/no-floating-point-equality": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [SonarJS recommended](https://lintradar.dev/presets/sonarjs-recommended.md) | ESLint | `eslint-plugin-sonarjs` | 230 | 6.2M | +62.1% |

## Related rules

- [sonarjs/no-fixed-wait-in-tests](https://lintradar.dev/rules/sonarjs/no-fixed-wait-in-tests.md): Fixed waits should not be used in tests
- [sonarjs/no-forced-browser-interaction](https://lintradar.dev/rules/sonarjs/no-forced-browser-interaction.md): Forced browser interactions should not bypass actionability checks
- [sonarjs/no-fallthrough](https://lintradar.dev/rules/sonarjs/no-fallthrough.md): Switch cases should end with an unconditional "break" statement
- [sonarjs/no-global-this](https://lintradar.dev/rules/sonarjs/no-global-this.md): The global "this" object should not be used
- [sonarjs/no-extra-arguments](https://lintradar.dev/rules/sonarjs/no-extra-arguments.md): Function calls should not pass extra arguments
- [sonarjs/no-globals-shadowing](https://lintradar.dev/rules/sonarjs/no-globals-shadowing.md): Special identifiers should not be bound or assigned

---

Web page: https://lintradar.dev/rules/sonarjs/no-floating-point-equality. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
