Skip to main content

precision_from_str

Function precision_from_str 

Source
pub fn precision_from_str(s: &str) -> CorrectnessResult<u8>
Expand description

Returns the decimal precision inferred from the given string.

For scientific notation (e.g., “1e-300”, “1.5e-2”), the precision accounts for both the mantissa’s fractional digits and the signed exponent: max(0, fractional_digits - exponent), clamped to u8::MAX (255).

§Errors

Returns an error if a scientific exponent is missing or non-numeric.