]> git.lizzy.rs Git - rust.git/blob - src/docs/zero_divided_by_zero.txt
[Arithmetic] Consider literals
[rust.git] / src / docs / zero_divided_by_zero.txt
1 ### What it does
2 Checks for `0.0 / 0.0`.
3
4 ### Why is this bad?
5 It's less readable than `f32::NAN` or `f64::NAN`.
6
7 ### Example
8 ```
9 let nan = 0.0f32 / 0.0;
10 ```
11
12 Use instead:
13 ```
14 let nan = f32::NAN;
15 ```