QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: SMcNeill on October 30, 2018, 12:02:20 pm
-
So I couldn't sleep last night, so I completely updated CONST and our internal math routines...
Bug here is fixed: https://www.qb64.org/forum/index.php?topic=703.0
********************
You can now use CONST with our math routines. Before, the following would error out for us:
CONST X = 1.2
CONST Y = INT(X)
Now, QB64 handles those routines just fine with the extended math functions.
**********************
The math routine got overhauled. Originally, the math functions to CONST were added several months BEFORE they were added into the main language itself. They were drafted into purpose from my experimental SteveIDE, and didn't match our standard naming convention.
Believe it or not, CONST X = ARCCOS(0.5) used to work just fine for us. (Unless I've got the name wrong...)
QB64, however, works with _ACOS, as that was the name the community decided on when the command was added into the language...
So, to correct this issue, I've changed the names you can use in CONST so they now match the actual syntax for the language.
********************
Several thousand lines of SteveIDE-related error-checking was removed, leaving QB64.bas and QB64.exe both smaller by quite a bit.
********************
Grab a copy of the Github version I forked off for the changes, and test to see if anything freezes, errors out, or returns false results. If all works as it should, the changes can be merged into the main repo soon and everyone can enjoy these fixes/enhancements.
-
Functions which we can now use with CONST:
CASE "_PI": n1
= 3.14159265358979323846264338327950288##
'Future compatable in case something ever stores extra digits for PI CASE "%": n1
= (VAL(num
(1))) / 100 'Note percent is a special case and works with the number BEFORE the % command and not after CASE "_D2R": n1
= 0.0174532925 * (VAL(num
(2))) CASE "_D2G": n1
= 1.1111111111 * (VAL(num
(2))) CASE "_R2D": n1
= 57.2957795 * (VAL(num
(2))) CASE "_R2G": n1
= 0.015707963 * (VAL(num
(2))) CASE "_G2D": n1
= 0.9 * (VAL(num
(2))) CASE "_G2R": n1
= 63.661977237 * (VAL(num
(2))) n1
= VAL(num
(1)): n2
= VAL(num
(2)) n3 = 1## / n2
n1 = sign * (n1 ^ n3)
-
Apologues for not "properly" looking this up yet but it may be useful - can we see the entire EvaluateNumbers$ function for our edification?
-
Apologues for not "properly" looking this up yet but it may be useful - can we see the entire EvaluateNumbers$ function for our edification?
Sure. Just look in QB64.bas. ;D
Actually, that's almost the whole function anyway, though it's just a part of the system which we use with EvaluateExpression$. There's one section which sets our order of precedence. Another to translate for &B, &H, and scientific notation. There's one routine which deals with duplicate negatives... EvaluateNumbers in just the cog in the machine which actually does the math functions for us. I was just lazy and posted the code as an easy way to highlight the functions currently available for us.
-
Thanks Steve, that is one thing I have wanted for some time, myself.
This is in latest download now? Oh it is forked off I see, OK!
-
Pushed the changes here into the development build for us, so folks will have it a little easier downloading and testing. So far, all seems to work as advertised, and this will make it one step easier for everybody to take advantages to these changes/bug fixes sooner.
-
@SMcNeill Got to get a hobby. And I don't mean QB64.
Typical programmer. Gut the code make it smaller, faster and add options/features.
For your next event are you going to pull a rabbit out of a hat or walk on water ?
Walking on water is easy, just need a submerged plank one inch below the water line.
-
@SMcNeill Got to get a hobby. And I don't mean QB64.
Typical programmer. Gut the code make it smaller, faster and add options/features.
For your next event are you going to pull a rabbit out of a hat or walk on water ?
Walking on water is easy, just need a submerged plank one inch below the water line.
And pulling a rabbit out of a hat isn't hard either; it's putting them INTO the hat where they'll bite you!
-
Excellent, Steve, as we expect.
As I only ever download specific QB64 versions, I shall eagerly await 1.3
-
And pulling a rabbit out of a hat isn't hard either; it's putting them INTO the hat where they'll bite you!
Keeping them from Poopin and\or Peein on you while you wear the hat is tricky too.
-
Funny, when I can't sleep at night, I just end up having sex... but my wife tells me I haven't spent enough time debugging that, either.
Pete :D
- I'm a CONST something.
-
Steve
great evolution!
thank to use so your time!
I'm sorry about your insomnia! But I can see that you are able to turn in positive some negative events.
Good!
-
Hi Steve,
I am wondering if CONST can do _RGB32() like other math functions?
-
Hi Steve,
I am wondering if CONST can do _RGB32() like other math functions?
It can. That's something that hasn't changed. It's just handled in a different routine than the one which I posted from above. ;)
It also handles _RGB colors, but it treats the 4th parameter as a screen mode rather than as an image handle.
-
Hi Steve,
I am wondering if CONST can do _RGB32() like other math functions?
It can. That's something that hasn't changed. It's just handled in a different routine than the one which I posted from above. ;)
It also handles _RGB colors, but it treats the 4th parameter as a screen mode rather than as an image handle.
Dang why did I think it didn't, must have been alpha I was trying.
Thanks!
-
_RGBA and _RGBA32 both work as well. (Or at least they should, unless something is broken.)
-
There are new syntaxes for _RGB32 in the dev build, that's likely what bplus means.
-
Hi Fellippe,
No, I do know about those updates. But does not hurt to remind! :)
Some time ago I seem to remember trying to setup color constants and ran into difficulties using _RGB something and figured it was because I was using a function so I switched to &H.... and that did work.
It's even possible I have used _RGB something for setting up color constants because it is my first instinct.
Eh memory, I don't think it will get better.