Skip to main content

parse_decimal_mantissa

Function parse_decimal_mantissa 

Source
fn parse_decimal_mantissa<T: DecimalType>(
    mantissa: &[u8],
    negative: bool,
    scale: i64,
) -> Result<(T::Native, usize), MantissaError>
Expand description

Scans mantissa (digits with at most one decimal point; the sign has already been removed) and folds the digits that are significant at scale into a native value, rounding half away from zero on the first digit that is not. Also returns an upper bound on the number of decimal digits of the value: the digits kept, the zeros appended to reach the scale, and the digit that rounding up can add.