rust-num / num-rational

Generic Rational numbers for Rust
Apache License 2.0
144 stars 51 forks source link

Support for various trig functions? #54

Closed ckaran closed 5 years ago

ckaran commented 5 years ago

Are there any plans for supporting the various trigonometric functions? I could really use sine() and cosine() right about now...

cuviper commented 5 years ago

No plans -- most values of those functions are irrational. I would stick to floating point for this, or convert your Ratio to/from floating point if needed.

ckaran commented 5 years ago

Actually, that brings up a different problem for me; for some reason to_f64() doesn't work for me; I don't know why. The compiler keeps acting like the ToPrimitive trait isn't implemented. Should I use something else?

cuviper commented 5 years ago

Oh, we have FromPrimitive, but not the other way yet -- issue #4, and a PR I need to review in #52.

ckaran commented 5 years ago

Got it! Any idea when the PR might land? Otherwise I need to roll my own... 😒

ckaran commented 5 years ago

After talking with @cuviper about all the issues surrounding precision (via issue #53), I think that this should be closed. There just isn't any way of implementing the transcendental functions in general.