paupino / rust-decimal

Decimal number implementation written in pure Rust suitable for financial and fixed-precision calculations.
https://docs.rs/rust_decimal/
MIT License
1.03k stars 183 forks source link

powd / powf result differ from regular rust pow and other online calculators #690

Open SamuelRamond opened 2 weeks ago

SamuelRamond commented 2 weeks ago

I was wondering if this miss match vs rust regular pow in result was expected ?

println!("{}", dec!(2.).powd(dec!(3.2)));
# 9.189586821131990468278294299
println!("{}", dec!(2.).powf(3.2));
# 9.189586821131990468278294299

let a: f64 = 2.;
println!("{}", a.powf(3.2));
# 9.18958683997628

also checking a few calculator online seems to be in favor of regular rust response:

image image image

Iphone calculator also match google and co

Is there something i'm missing ?