Rules / TAU-N004
No exact float comparison
decided by Clippy kernel deny core deny edge deny
Applies to tests: no
Exceptions:
#[expect] + reasonWhy
Exact equality of computed floats is almost always a bug.
Fix
Compare with an explicit tolerance, or use integers in fixed units.
What it checks
Lints: clippy::float_cmp, clippy::float_cmp_const
Seen in fixtures
//! Exact comparison of floating-point values. /// Whether two readings are the same.#[must_use]pub fn same(a: f64, b: f64) -> bool { a == b}$ cargo tauten check
error[TAU-N004]: strict comparison of `f32` or `f64` --> rej-float-eq/src/lib.rs:6:5 (core crate `rej-float-eq`) = rule: No exact float comparison (decided by Clippy) = fix: Compare with an explicit tolerance, or use integers in fixed units.rej-float-eq (core) expects TAU-N004. Output captured at 0200db3.In the terminal
cargo tauten explain TAU-N004$ cargo tauten explain TAU-N004
TAU-N004: No exact float comparison Why: Exact equality of computed floats is almost always a bug. Fix: Compare with an explicit tolerance, or use integers in fixed units. Decided by: ClippyDecides: No exact `==` comparison of floating-point values.Sees: resolved; complete: yesDoes not see: Code expanded from macros defined in other crates (clippy skips it); code disabled by `cfg`; build scripts.Applies to tests: noExceptions allowed: with #[expect(.., reason)] kernel deny core deny edge denyLints: clippy::float_cmp, clippy::float_cmp_const