14 releases

0.6.0 Nov 23, 2024
0.5.6 May 28, 2024
0.5.5 Nov 16, 2023
0.5.3 Apr 13, 2023
0.1.0 Oct 15, 2020

#395 in Internationalization (i18n)

Download history 22813/week @ 2024-08-19 26950/week @ 2024-08-26 23869/week @ 2024-09-02 25327/week @ 2024-09-09 28469/week @ 2024-09-16 60844/week @ 2024-09-23 60656/week @ 2024-09-30 59418/week @ 2024-10-07 35457/week @ 2024-10-14 33263/week @ 2024-10-21 27480/week @ 2024-10-28 36856/week @ 2024-11-04 36029/week @ 2024-11-11 33347/week @ 2024-11-18 19094/week @ 2024-11-25 29430/week @ 2024-12-02

118,507 downloads per month
Used in 68 crates (17 directly)

Unicode-3.0

285KB
5K SLoC

fixed_decimal crates.io

fixed_decimal is a utility crate of the ICU4X project.

It includes FixedDecimal, a core API for representing numbers in a human-readable form appropriate for formatting and plural rule selection. It is optimized for operations involving the individual digits of a number.

Examples

use fixed_decimal::FixedDecimal;

let dec = FixedDecimal::from(250).multiplied_pow10(-2);
assert_eq!("2.50", format!("{}", dec));

#[derive(Debug, PartialEq)]
struct MagnitudeAndDigit(i16, u8);

let digits: Vec<MagnitudeAndDigit> = dec
    .magnitude_range()
    .map(|m| MagnitudeAndDigit(m, dec.digit_at(m)))
    .collect();

assert_eq!(
    vec![
        MagnitudeAndDigit(-2, 0),
        MagnitudeAndDigit(-1, 5),
        MagnitudeAndDigit(0, 2)
    ],
    digits
);

More Information

For more information on development, authorship, contributing etc. please visit ICU4X home page.

Dependencies

~265–750KB
~18K SLoC