BBS: Inland Empire Archive Date: 10-29-92 (21:37) Number: 322 From: RICK PEDLEY Refer#: NONE To: WARREN SCHREY Recvd: NO Subj: hm. Conf: (2) Quik_Bas
On 10-26-92 Warren Schrey wrote to All... WS> Why does this work? WS> WS> --clipit-- WS> WS> A#=100 WS> B#=533 WS> C#=8 WS> WS> D&=A#*B#*C# WS> WS> --clipit-- WS> WS> where this WS> WS> --clipit-- WS> WS> D&=100*533*8 WS> WS> <Overflow Error> WS> WS> --clipit-- WS> WS> doesn't? It seems that QB won't let me insert anything WS> beyond the 32767 or -32768 limits using direct numbers as WS> in my second clip... WS> WS> Is this a bug, an undocumented feature, or just another of WS> those annoyances? :-) It's because when calculations are done on the right side of the equation, QB stores the intermediate results in whatever type the factors are in; in other words, it interprets 100, 533, and 8 as being single (2-byte) integers, and then attempts to store the product as an integer, resulting in an overflow error if it is out of range. In the first example, you have specified the type of each factor, and intermediate results are stored in the same type. You can also do this if you want to avoid using variables: D& = 100& * 533& * 8& ... OFFLINE 1.40 --- Maximus 2.01wb * Origin: The BULLpen BBS * Intel 14.4EX (613)549-5168 (1:249/140)
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