expression

Decimal scale, mantissa and normalize

Inspect the stored base-ten scale and signed coefficient. Normalization can remove trailing fractional zeros without changing numerical equality. Preserve scale separately if it has business meaning. Expected stdout (not executed): 12500 3 12.5 Common mistake: Equating numeric equality with identical display precision. Dependency: rust_decimal =1.36.0. See the staged Cargo fixture. Exact-version API and resolution not tested.

Formal Syntax & Structure

rust syntaxrust
d.scale(); d.mantissa(); d.normalize()

Working Example

Example Snippetrust
fn main() {    use rust_decimal::Decimal;    let d = Decimal::new(12500,3);    println!("{} {}",d.mantissa(),d.scale());    println!("{}",d.normalize());}
Rust Reference