bigdecimal-rs
bigdecimal-rs copied to clipboard
Maths functions
If you are interested. I have a set of maths functions on BigDecimal
that I am using as a reference for libm
generation.
https://github.com/extendr/doctor-syn/blob/main/src/bdmath.rs
These are only references, using MacLaurin series and do not cover all domains, but could be worked into something more useful.
I've also added a version of "round" that does not panic.
I'm a bit short of time at the moment, but anyone interested, should feel free to cut and paste.
I guess Maclaurin is not fast, right?
Taylor/Maclaurin series converge slowly except for very small values.
Some of the functions do range reduction to map the inputs to small ones, but more work is required here for fast convergence.
At the moment, these are just used as references for polynomial approximations in our CAS package:
https://github.com/doctor-syn/doctor-syn