Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QB64 Phoenix Edition v3.11.0 Released!
#19
(01-07-2024, 06:22 PM)bplus Wrote: Sure be consistence to old computer bit math but in Real math FFFF base 16 is the big number and gets bigger with every F you add onto it.

Except... QB64 is a progamming language where you write programs for the computer. It's got to work in "computer bit math". Your PC doesn't run on base-10 at the end of the day, you know.

And if the only digits you had available for you were 0 through 9, it wouldn't be odd to designate a range for negative numbers.

0 = 0
1 = 1
2 = 2
3 = 3
4 = 4
5 - 5
6 = -4
7 = -3
8 = -2
9 = -1

You can now represent a range from -4 to 5 with the only digits available for you: 0 to 9.

Hex is just 0 to 9 and ABEDEF.... There's no - included in its character set. Your -&H is nothing more than a subtraction operation, and it could very well screw up your expected outcome of a calculation.

For example:

&HFFFF ^ 2

Normally this is (-1) ^ 2, which would give you 1.

-&H1 ^ 2 (this is how you suggest writing it).

- 1 ^ 2 ... you do exponents over subtraction so that = -1.

It's not the same thing at all. You'd more or less have to completely rewrite the rules of math for it to work like you're wanting.
Reply


Messages In This Thread
QB64 Phoenix Edition v3.11.0 Released! - by a740g - 01-03-2024, 05:45 PM
RE: QB64 Phoenix Edition v3.11.0 Released! - by SMcNeill - 01-07-2024, 06:36 PM



Users browsing this thread: 5 Guest(s)