Qbasicnews.com
January 27, 2022, 04:45:24 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Changing the max integer limit.  (Read 2581 times)
Arukas
New Member

Posts: 3


« on: May 09, 2003, 06:45:31 PM »

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).
Logged
Glenn
I hold this place together
*****
Posts: 786



WWW
« Reply #1 on: May 09, 2003, 08:04:04 PM »

("DIM variable AS LONG"), you can use integers up to 2^31 - 1.  For larger values, I suggest SINGLE or DOUBLE precision values.
Logged

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.
oracle
*/-\*
*****
Posts: 3652



WWW
« Reply #2 on: May 09, 2003, 09:21:34 PM »

Or get hold of Neo's BIGINT library... I'm sure he'd love to explain how it works...
Logged

Arukas
New Member

Posts: 3


« Reply #3 on: May 09, 2003, 10:56:34 PM »

Quote from: "Glenn"
("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?
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #4 on: May 09, 2003, 10:58:51 PM »

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.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Glenn
I hold this place together
*****
Posts: 786



WWW
« Reply #5 on: May 09, 2003, 11:01:11 PM »

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).
Logged

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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!