Posts: 3
Threads: 2
Joined: May 2003
I have been programming with TI 83+ calculator for about 3-4 month and I have found that I can't do things that I want to with it. The max integer value you can use with those calculators is 9,999,999,999. The problem is that I need to be able to use integer values from 0 to 1,000,000,000,000 and I have no idea how I would do that with QBASIC.
If possible, could someone post a code to do this that has an input (I'm going to want to divide a number between 0 and 1,000,000,000,000 by a number between 1 and 100,000), and most importantly, an explaination on the code, so that way I will know what is happening and can use what I already know about QBASIC to make the program do exactly what I want it to do (meaning add things to it).
Posts: 704
Threads: 0
Joined: Dec 2002
("DIM variable AS LONG"), you can use integers up to 2^31 - 1. For larger values, I suggest SINGLE or DOUBLE precision values.
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Posts: 3,343
Threads: 83
Joined: Mar 2003
Or get hold of Neo's BIGINT library... I'm sure he'd love to explain how it works...
Posts: 3
Threads: 2
Joined: May 2003
Quote:("DIM variable AS LONG"), you can use integers up to 2^31 - 1. For larger values, I suggest SINGLE or DOUBLE precision values.
I understood "DIM variable AS LONG". Thanks for that, but could you please give me an example of how to use a SINGLE or DOUBLE precision value.
Also what are the max integer limits for SINGLE and DOUBLE?
Posts: 6,419
Threads: 74
Joined: Mar 2002
Just the same:
Code:
DIM singlevariable AS SINGLE
SINGLE and DOUBLE are not integers. You'll lose precission when you reach big numbers. You better use Neo's lib.
Posts: 704
Threads: 0
Joined: Dec 2002
e.g.,
DIM variable AS DOUBLE
Then you can do things like
variable = 1.356291D200
For SINGLE, just change the "DOUBLE" to "SINGLE" (but SINGLE is the default variable type you get if you don't DIM them as something else or use one of the type suffixes ("!" for SINGLE, "&" for LONG, "%" for INTEGER, "#" for DOUBLE, and "$" for a string). However, with SINGLE precision numbers, the largest value is somewhere around 1E38 (10^38).
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.