# Re: hm.

``` BBS: Inland Empire Archive
Date: 10-29-92 (12:15)             Number: 320
From: TONY ELLIOTT                 Refer#: NONE
To: WARREN SCHREY                 Recvd: NO
Subj: Re: hm.                        Conf: (2) Quik_Bas```
```Warren,

WS> Why does this work?
WS> A#=100
WS> B#=533
WS> C#=8
WS> D&=A#*B#*C#

WS> where this
WS> --clipit--
WS> D&=100*533*8
WS> <Overflow Error>

WS> doesn't?  It seems that QB won't let me insert anything beyond the
WS> 32767 or -32768 limits using direct numbers as in my second clip...
WS> Is this a bug, an undocumented feature, or just another of those
WS> annoyances? :-)

Under most conditions, Basic assumes that literal, whole numbers are
integers -unless- a variable of greater precision appears to the left.
For example:

D& = A# * 533 * 8

-will- work. Basic evaluates expressions using the algebraic order of
operations. In the above example, it encountered A# and thus considered
any literal values (such as 533 and 8) as double precision as well.
This also works:

D& = 100& * 533& * 8&
D& = 100& * 533 * 8         '533 and 8 considered to be long ints
'because 100 is a long int.

Putting overrides on literals eliminates the guesswork in Basic's
automatic conversion of literals.

Believe it or not, this is documented .. just not in a great deal of
depth. Ethan Winer's book "PC Magazine's BASIC Techniques and
Utilities" describes this process (as well as many others). A highly
recommended book.

Tony

... Go straight to the docs.  Do not pass GO.  Do not collect \$200!
--- Blue Wave/Max v2.10 [NR]
* Origin: Oakland BBS - McDonough, GA - (404) 954-0071 (1:133/706.0)
```

Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET