const-decimal 0.3.0

Integer-backed decimals with constant precision
Documentation
1
2
3
4
5
6
7
8
9
10
11
use crate::ScaledInteger;

pub(crate) fn log10<const D: u8, I: ScaledInteger<D>>(mut input: I) -> I {
    let mut result = I::ZERO;
    while input > I::ZERO {
        input /= I::TEN;
        result += I::ONE;
    }

    result
}