likebike / fasteval

Fast and safe evaluation of algebraic expressions
https://crates.io/crates/fasteval/
MIT License
267 stars 26 forks source link

Advanced Numeric Types #7

Open likebike opened 4 years ago

likebike commented 4 years ago

Right now, fasteval only supports f64. I'd also like to support these other modes:

Any others?

adamsky commented 3 years ago

I'm curious what's the general idea on how to approach adding these new modes. Would all/some of these number types be supported within a single calculation? Or would this be more of an either or situation, being able to specify one of these for all numbers within a single calculation, or perhaps even on crate level with compile-time features?

likebike commented 3 years ago

Great questions. I really haven't figured out the right way to do this yet, but I was imagining that I would have a special syntax in the expressions to represent the Complex/Rational numbers. Then I would probably have a compile-time setting (maybe a generic structure like Evaler<f64> Evaler<f32> Evaler<BigInt>..., or maybe a crate feature for conditional compilation) for the different types.

There was another crate out there that had a nice expression syntax for the Rational and Complex stuff, but I can't remember which one it was at the moment. I'll find it...

likebike commented 3 years ago

Ah, the crate with the awesome expression syntax is rclc .

likebike commented 3 years ago

I should also mention that my top priority for this project is to maintain high performance. I will try my best to expand the capabilities to handle more advanced mathematical situations, but if I ever need to choose between mathematical perfection and performance, I'm going to choose performance. There are many other projects that already do the math stuff way better than I can ever do, so this project will focus completely on what it does better than anything else: performance. ...otherwise, there's no point for this project to exist.

metasim commented 2 years ago

I'd like to do something similar, but with ndarray types.

fgvieira commented 1 year ago

Any news on supporting f32?