v 0.954a3 brings quite a few changes to what we can do with CONST in QB64.

For starters, it removes the old CONST PI = 4 * ATN(1) and CONST PI = PI commands. They've been replaced with something much prettier and shinier -- the _MATH parameter for CONST!

Inside our math function, we can now use any of the following:

COS -- cosine

SIN -- sine

TAN -- tanget

ATN -- arctanget

LOG --- log

SQR -- square root

SEC -- secant

CSC -- cosecant

COT -- cotangent

PI -- pi

One thing this expects, is for the user to USE one of these commands in the MATH function. If you just use CONST x = _MATH(1), it doesn't like that. I could go in and change this behavior, but I'm not going to. WHY would someone want to call out to a function to delay things, when they don't need to?

This calculates your values for you as you type, and then sends them back to be processed as a valid input, so on longer instances of code it will make editing in the IDE a bit slower. (Anything extra for the IDE to process makes it slower...) Why increase the burden by running it through a function that will basically do nothing, and then send it to process your input, when you can simply send it directly to process your input?

If you need a CONST for 1 + 3 then for goodness sake, type in CONST x = 1 + 3. Don't try and bog it down with CONST x = _MATH(1 + 3). Now, CONST x = _MATH(1 + 3 * COS(30)) would work and run fine, as we're actually using the math function.

Some do's and don't's:

DO use one of our 10 functions with _MATH.

DO expect to see an error until you use one of those functions, then the IDE will let you know it's happy, or for you to finsish typing in the rest of the formula...

DON'T try and use this to stack CONST of more than 1 variable per a line. CONST x = 3, y = 4 works normally. CONST x = _MATH(COS(30)), y = 4 will NOT. You've been warned here first.

DON'T give it variables to reference, or even other CONST. It won't work with those things. (Though later I'd like to add support for using constants in a constant. It just doesn't do it -- YET.)

DO expect to see error messages if you try and give it something impossible to solve -- like a SEC that would involve 1/ 0 errors. Infinity can't be a CONST...

And really, that's about all I can think of. A good bit of expanded support, and I don't think it's too "unbasic" of a way to use them. I wish I could have just plugged these in directly to QB64's normal processes, but that turned out to be a crazier process than I'd want to admit to, and I ended up just abandoning it. Tossing it into a sub-function really was the simplest way (for me at least), and from all my testing so far, it works as expected now.

Honestly, I'm quite proud of all the little abilities this code adds for us to use with CONST. And best of all: it's easily upgradeable and expandable, if I need to go in and teach it something else.

Example usage:

CONST x = _MATH(1 + COS(30))

It's that simple.

NOTE: I haven't tried to teach it to do math inside our values yet (and I probably never will really), so don't try and use CONST x = _MATH(COS(14+12*2)). It won't like that at all and will go blabbity-blah at you and error out...

********************************

********************************

Special thanks to Matt (DSMan195276) for helping to test this version, offer feedback, and help find and locate some of the bugs that were in it. Thanks also for pointing out the issues that were affecting the Linux version of the source as well, as I've also made certain to go in and fix those also.