|
-
May 2nd, 2024, 10:58 AM
#5
Re: Evaluating An Equation
The equations will almost never be the same, and yes, I'm talking about essentially evaluating the text. Back when I originally wrote this, back in VB6 in...probably around 2002, I was explicitly using strings and parsing them. The performance of that was horrible, as you would expect. I then came up with a better way to represent the equations as a List(of SomeClass), where SomeClass was an object that could be either a constant ( the 5 in 5X), an element (the X in 5X, and I didn't want to use the term 'variable', as that would have multiple meanings in programming), or an operator (the + in 5X + 7).
Parentheses are the pain.
I'll have to look into that Expression approach. I hadn't seen that. It does seem like it could have an advantage, as compiling the equation might allow it to be sped up. I'm doing something like that already, just rolling my own, and it's pretty quick. Building the equation will probably be equally painful either way, but the compiled lambda might outperform the approach I'm taking.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|