MS-Quickbasic numeric range problem 
Author Message
 MS-Quickbasic numeric range problem

Has anyone got an answer to this annoying problem:

I've been using MS-Quickbasic 4.0 for several years (yes I know its
ancient - I bought it in 1987!).  It has given me no problems until
now.  Specifically I'm getting "Out of Range" problems with integer
variables even though the value I'm trying to assign is well within
the stated range.  As an example the following piece of code will give
the aforementioned error:

DIM NumVar as LONG
NumVar = 123 * 1234

Either things were working fine until recently or I never wrote code
with anything other than low numbers !  :-)

I am running MS-DOS 6.2 on a 486DX33 with 8Mb RAM.  I appreciate that
QB version 4.0 was released in the days when a 286 was considered a
luxury but surely anything written for 8086 machines should be
compatible with later 80x86 processors ?

If anyone can suggest a solution or point out any known bugs in this
version of QB I would be mightily greatful.

Before I sign off - I feel the need to have a gripe about Microsoft's
customer support - I phoned them and they said "Sorry we don't support
version 4.0 only version 4.5 and VB", so I asked if I could talk to the
version 4.5 support team just in case they had an answer.  The MS
operator said "I'm sorry you have version 4.0, we don't support that,
so we can't help".   Thanks a lot Microsoft for being so considerate !!

Jezz

--
________________________

_______________________



Tue, 30 Dec 1997 03:00:00 GMT  
 MS-Quickbasic numeric range problem

Quote:

>Has anyone got an answer to this annoying problem:

>I've been using MS-Quickbasic 4.0 for several years (yes I know its
>ancient - I bought it in 1987!).  It has given me no problems until
>now.  Specifically I'm getting "Out of Range" problems with integer
>variables even though the value I'm trying to assign is well within
>the stated range.  As an example the following piece of code will give
>the aforementioned error:

>DIM NumVar as LONG
>NumVar = 123 * 1234

Use NumVar = 123 * 1234&

Since both numbers are integers, QB uses an integer multiply
function which overflows.  Forcing one of the numbers to the
'long' type makes QB use long integer multiplication.

--
Iain Crawford                    Phone: +44(0)1454 228596
Abraxas Software Ltd             Fax:   +44(0)1454 228586

Iron Acton, Bristol  BS17 1UQ



Wed, 31 Dec 1997 03:00:00 GMT  
 MS-Quickbasic numeric range problem


'Has anyone got an answer to this annoying problem:

'I've been using MS-Quickbasic 4.0 for several years (yes I know its
'ancient - I bought it in 1987!).  It has given me no problems until
'now.  Specifically I'm getting "Out of Range" problems with integer
'variables even though the value I'm trying to assign is well within
'the stated range.  As an example the following piece of code will give
'the aforementioned error:

'DIM NumVar as LONG
'NumVar = 123 * 1234

'Either things were working fine until recently or I never wrote code
'with anything other than low numbers !  :-)

This is not an error on the compilers part, but rather a misinterpreted
request. Basic can't see it needs the answer in a Long (even though you
assigned it that way because your multipling 2 integers) the Compiler
is coding expecting to only use 16bit registers and then later convert
it to a long int for assignment, instead the value is larger than an int
and can not be stored in 1 register. The solution is much simpler than the
problem (Thank goodness!)

Simply convert 1 of the values to a long (Doesn't matter which one the
compiler's now smart enough to know 16bits won't work) by adding a '&'.

ie NumVar = 123& * 1234

'I am running MS-DOS 6.2 on a 486DX33 with 8Mb RAM.  I appreciate that
'QB version 4.0 was released in the days when a 286 was considered a
'luxury but surely anything written for 8086 machines should be
'compatible with later 80x86 processors ?

The processor is not the problem.

'If anyone can suggest a solution or point out any known bugs in this
'version of QB I would be mightily greatful.

'Before I sign off - I feel the need to have a gripe about Microsoft's
'customer support - I phoned them and they said "Sorry we don't support
'version 4.0 only version 4.5 and VB", so I asked if I could talk to the
'version 4.5 support team just in case they had an answer.  The MS
'operator said "I'm sorry you have version 4.0, we don't support that,
'so we can't help".   Thanks a lot Microsoft for being so considerate !!

Funny this problem does exist under 4.5, VB-DOS, PDS, VB-WIN, MSVC++, MASM,
and any other compiler. But I'm surprised she told you they support v4.5,
because they don't. They only support Windows products now.Aany bug fixes,
notes, releases, ect. might be on a ftp mirror or their gopher server,
as a matter of fact I have a copy of the MSQBKB (MS QB Knowledge Base)
and though the viewer is slightly buggy, it is maintained in standard
text I believe or at least viewable through a binary editer if you want it
its at http://www.freenet.ufl.edu/~afn03257
its one of the first links.)

there is also a bug list at the Simtel mirror's in one of the sub dirs from

/SimTel/msdos [ /basic | /qbasic ]
--
"...AND WITH DUST IN THROAT I CRAVE, ONLY KNOWLEDGE WILL I SAVE,
TO THE GAME YOU STAY A SLAVE... - ROVER                  WANDERER
                                  NOMAD                  VAGABOND
                                - CALL ME WHAT YOU WILL." (Hetfield/Ulrich)



Wed, 31 Dec 1997 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. MS QuickBasic problem

2. Numeric Value out of Range

3. Inputting Numeric Ranges

4. Textbox control only numeric and range checking?

5. Numeric Value out of Range.

6. CRW 5: Numeric Value out of range error.

7. Numeric Value Out Of Range

8. MS Access vs. Crystal Reports numeric fields

9. DeBug MS QuickBasic 4.5 Compiled Code ??

10. MS-QuickBasic 4.5 question

11. MS QuickBasic and HP 870C Printer

12. Decompiler for MS QuickBasic

 

 
Powered by phpBB® Forum Software