fasteval icon indicating copy to clipboard operation
fasteval copied to clipboard

Advanced Numeric Types

Open likebike opened this issue 6 years ago • 6 comments

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

  • f32
  • Complex Numbers
  • Rational Numbers
  • Arbitrary Precision Numbers
  • Big Integers + Crypto

Any others?

likebike avatar Jan 26 '20 17:01 likebike

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?

adamsky avatar Sep 23 '20 21:09 adamsky

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 avatar Sep 23 '20 22:09 likebike

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

likebike avatar Sep 23 '20 23:09 likebike

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.

likebike avatar Sep 23 '20 23:09 likebike

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

metasim avatar Jun 30 '22 15:06 metasim

Any news on supporting f32?

fgvieira avatar Dec 14 '22 14:12 fgvieira