TIP: Click on subject to list as thread! ANSI
echo: science
to: MARK LEWIS
from: DAVID WILLIAMS
date: 2004-09-02 20:29:52
subject: Pythagorean Triples

->  DW> The DEFLNG A-Z at the beginning makes the variables 
->  DW> default to "long" (32-bit) integers, unless their 
->  DW> names carry suffixes such as "$" or "#"
to indicate 
->  DW> some other type. 
 
-> can you tell me what those used in your pythag are and what they mean? i see 
-> some with $ and one or two with #... its kinda hard to convert to another 
-> language when the size of the variables isn't known ;)  it also helps to kno 
-> the ranges, too... 
 
-> )\/(ark 
  
In QBasic (and many other dialects) "short" integers have 16 bits (2 
bytes). One bit is used to represent the sign, so 15 bits are available 
for the number itself. This means that the range of integers that can 
be represented is from -32768 to 32767. (Zero is counted as a positive 
number, so there is one less nonzero positive number than negative.) 
  
"Long" integers are 32 bits (4 bytes) long. Again, one bit is used for 
the sign, so the range is from -2^31 to (2^31 - 1). I don't know the 
exact decimal equivalents offhand, but it's something like +/- 2 
billion. 
  
The statement DEFLNG A-Z at the start of the program makes the default 
variable type "long" integers. Any simple variable name such as X or A 
is assumed to be a long integer. However, the suffixes $, #, !, or % 
can be used on a name, e.g. A$, A#, T!, to represent a variable of a 
different type from the default one. In the above order, they mean 
strings, double-precision floating-point numbers, single-precision 
ones, and short integers. "&" can also be used as a suffix, to mean a 
long integer, when the default is something else. 
  
In my program *all* the variables are long integers, with the single 
exception of the CONSTant Z#, which represents (SQR(2) + 1). This is 
represented in double-precision floating-point notation, giving about 
16 significant (decimal) digits of precision. 
  
That's all! There are no other variables, or types, in the program. 
  
                        dow 
--- Platinum Xpress/Win/WINServer v3.0pr5
* Origin: The Bayman BBS,Toronto, (416)698-6573 - 1:250/514 (1:250/514)
SEEN-BY: 633/267 270
@PATH: 250/514 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.