10-14-2008, 05:15 AM
[quote='Ralph link' dateline='1223418270']
I'm having a problem understanding what is going on and how to correct my program. When I run it, it gives me an OVERFLOW errror at line
A = 10 * 10 * 10 * 10 * 10
as though A had been defined as an integer. Why is this, and how do I correct it?
As you probably already figured out, the problem is the "tens" are set to integer by default.
Take a look at the Qbasic Help, in the section about "Type Conversion". This explains your problem, although not very clearly. You need to read it several times.
Regards..... Moneo
I'm having a problem understanding what is going on and how to correct my program. When I run it, it gives me an OVERFLOW errror at line
A = 10 * 10 * 10 * 10 * 10
as though A had been defined as an integer. Why is this, and how do I correct it?
Quote:'aaatest2Hi Ralph, don't feel bad, many of us have fallen into the same trap.
DEFLNG A-Z
CLS
'multiplication
R = 10 ^ 6
T1 = TIMER
FOR i = 1 TO R
 A = 10 * 10 * 10 * 10 * 10
NEXT i
PRINT TIMER - T1
SYSTEM
As you probably already figured out, the problem is the "tens" are set to integer by default.
Take a look at the Qbasic Help, in the section about "Type Conversion". This explains your problem, although not very clearly. You need to read it several times.
Regards..... Moneo