Rules / TAU-N003

No floating point in the kernel

decided by Clippy kernel deny core – edge –
Applies to tests: no Exceptions: #[expect] + reason

Why

Floating point is not associative and has NaN; kernel decisions must be exact and proof-friendly.

Fix

Use integers in fixed units (cents, milliseconds, basis points) or a rational type.

What it checks

Lints: clippy::float_arithmetic

Seen in fixtures

rej-kernel-impure/src/lib.rs kernel

//! Kernel without no_std, using HashMap and floats. use std::collections::HashMap; /// Count keys.#[must_use]pub fn count(map: &HashMap<u8, u8>) -> usize {    map.len()} /// Average.#[must_use]pub fn half(x: f64) -> f64 {    x / 2.0}

$ cargo tauten check

error[TAU-N003]: floating-point arithmetic detected  --> rej-kernel-impure/src/lib.rs:14:5 (kernel crate `rej-kernel-impure`)  = rule: No floating point in the kernel (decided by Clippy)  = fix: Use integers in fixed units (cents, milliseconds, basis points) or a rational type.
Fixture rej-kernel-impure (kernel) expects TAU-K003, TAU-K001, TAU-N003. Output captured at 0200db3.

In the terminal

cargo tauten explain TAU-N003

$ cargo tauten explain TAU-N003

TAU-N003: No floating point in the kernel Why: Floating point is not associative and has NaN; kernel decisions must be exact and proof-friendly. Fix: Use integers in fixed units (cents, milliseconds, basis points) or a rational type. Decided by: ClippyDecides: No floating-point arithmetic in kernel crates.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 -  edge -Lints: clippy::float_arithmetic