Okies, here's the shhhh-don't-tell-anyone-secret of the IDE Math Evaluator....
It's mainly in the IDE as a quick testing tool for the developers.
And now that the cat is out of the bag, let me explain what that tool is, and why it's so useful for us.
Inside QB64PE, you'll find several routines written by yours truly, that were derived and evolved basically from the code here:
https://qb64phoenix.com/forum/showthread.php?tid=1266
That's my math evaluator, and QB64PE (and even QB64 itself, as much as some folks want to deny anything Steve-adjact as being part of those versions), makes use of it whenever you use any CONST in your code.
CONST is a special case function, where we calculate the values and figures BEFORE compiling/translating, and substitute them into your code. For example, let's say you write a program like so:
Code: (Select All)
CONST x = 1
PRINT x
Now, feel free to dig all you want around in the c-translation of that code. At NO point, will you ever find a reference to x in your code. No variable. No declaration. No nothing. All you'll find in the translated code is the same thing you'd find if you wrote your program as:
Code: (Select All)
PRINT 1
BEFORE compile time, CONST does all the math and calculations and whatnot, and substitutes them into your code in place of those constant variables -- and it's the math evaluator that allows us to do this.
CONST x = 1 + 2
That 1 + 2 above, can't be calculated at RUN-TIME, as we substitute the value of 3 BEFORE compilation ever even takes place. That means we have to evaluate that fomula, get the final result, and substitute that final result before we compile -- and that's what the math evaluation routines do for us.
And how does all this backstory play into effect with the Math Tool in the IDE menu???
That Math Tool does the **exact** same math that CONST does for us. In fact, try the following:
1) Write a single line of code: CONST x = 3.14
2) Go to the IDE options, select the math tool, and type in a formula of "X * 2"
3) Be amazed to see the end result of 6.28!!
That math tool is a quick testing tool for the devs so that we can quickly test various interactions with whatever values CONST might generate, to help us debug those internal routines.
IF some user finds it useful for their own stuff, that's GREAT as well, but the primary reason it was added to the IDE menu was as an use-tool for the develeopers to help debug those internal math routines quickly and easily.