I just thought that Basic is an old programming language and that the QB64 compiler certainly doesn't have the ability to work with large numbers.
I only found this article yesterday and it completely changed my mind. But something like that also happens
So I'm already smarter today and I know that QB64 has various built-in data types, including those that allow you to work with large numbers.
By the way, Basic was my first programming language that I learned at college in the 1980s.
I finally installed QB64 on my Linux PC and was able to compare it with the BASIC256 that I had previously installed.
In terms of speed when processing numbers - for example when searching for prime numbers - the QB64 is far superior to the BASIC256.
But both are really good, and what's great is that they are both cross-platform for Linux and Windows.
For someone who is just starting out programming, BASIC256 is definitely easier to use - very nice and easy to use.
Those who, on the other hand, have a little more programming experience, are not afraid of the very classic retro look of the IDE and want to develop astonishingly powerful multi-platform applications in Basic, will appreciate the QB64 more.
Although I still run into problems with large numbers when testing for primes.
Your advice regards using
DIM As _Unsigned _Integer64, P
correctly tested a 20-digit Prime BUT fails when testing 21 digit numbers.
The screen input will not allow input of the 21st digit during input.
Very strange.
If and only if, when you have time, can you help.
I do coding for fun and to keep my grey cells ticking. (along with Sudoku).
So, if you are busy and you feel I am stretching our online friendship toooo far, please forget and forgive!
I can send you my Prime Testing program if you wish.
you can see that the Maximum value of UNSIGNED _INTEGER64 is 18,446,744,073,709,551,615
That's the 20 digit limit. It seems, that you reached the limit, 21 digit integers are not possible with this data type.
The data type _FLOAT supports larger numbers, but it is unfortunately not suitable for calculations with large integers. For example, when I tried to find all divisors of the number N = 12345678901234567890, then using UNSIGNED _INTEGER64 data type delivered me first three divisors 2, 3, 5 which is true. But when I changed the data type to _FLOAT, then the program delivered me first three divisors 2, 4, 7, which is false. It did not calculate the divisor 3, but 3 is sure the divisor of N because sum of digits of N is 90 what is divisible by 3. Similarly it did not calculate the divisor 5, which must be true because N ends with 0.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.