let a = Decimal::from_str("2.02").unwrap();
let b = Decimal::from_str("5.02").unwrap();
let c = a + b * b;
println!("{}", c.to_string());
You know what... this line of documentation about math (rust_decimal - Rust) is not that clear, especially on the etc part, so I assume it won't work before even trying it. And lack of example also doesn't help either
This feature enables mathematical functionality such as pow , ln , enf etc.
All the math operators are implemented using traits in the std::ops module. If you scroll to the bottom of the Decimal type's API docs you will see lines like impl Add<Decimal> for Decimal which means you can use the + operator with two Decimals.