Skip to main content

floor_pow10

Function floor_pow10 

Source
pub fn floor_pow10(x: f64) -> f64
Expand description

Largest power of ten 10^n <= x. Assumes positive_finite(x).

The exponent is taken from log10(x).floor() but reconstructed with powi (exact for |result| < 2^53) and corrected by at most one step, so a one-ulp log10 error at an exact power-of-ten boundary can’t leak.

pub so non-node callers can reuse the exact floor_base10 formula without re-deriving it (DRY). floor_base10 the node is just this function behind the positive_finite guard, so a caller that already guarantees a strictly-positive, finite x (e.g. the CQL batch-stride planner, which floors budget / row_size) can call this directly.