RS.CLIPPY.ZERO_DIVIDED_BY_ZERO

Usage of `0.0 / 0.0` to obtain NaN instead of `f32::NAN` or `f64::NAN`

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: zero_divided_by_zero. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for 0.0 / 0.0.

Why is this bad?

It's less readable than f32::NAN or f64::NAN.

Example

let nan = 0.0f32 / 0.0;

Use instead:

let nan = f32::NAN;