Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing the max integer limit.
#1
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).
Reply
#2
("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.
Reply
#3
Or get hold of Neo's BIGINT library... I'm sure he'd love to explain how it works...
Reply
#4
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?
Reply
#5
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.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#6
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)