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.02k stars 183 forks source link

Support more trigonometric functions #457

Open PaddiM8 opened 2 years ago

PaddiM8 commented 2 years ago

It seems like arc functions and hyperbolic functions are lacking, which is a bit limiting. Having these would make it almost as feature-rich as f64.

schungx commented 2 years ago

Since none of the trig functions necessarily maintain precision (or have perfect precision in the first place), it really might actually be better to first convert the Decimal to f64, do whatever trig function, then convert the result back.

Instead of giving a false impression to users that, somehow, Decimal trig functions are more precise than f64 ones (they are not).