Download BASIC User`s Manual
Transcript
TSC BASIC User's Manual 4.2 Constants Numbers may be represented using either floating point or scientific notation for positive and negative values. This BASIC has six decimal digit accuracy and an approximate range of: 10E-38 to 10E38 0 -1OE-38 to -10E38 for positive numbers zero for negative numbers A floating point number can be entered into the computer in the form that you would normally write or type it. It may be a simple string of decimal digits (an integer) or it may have a decimal point appearing somewhere (a decimal digit). Since internal representation of numbers in this form is only possible over a limited range, BASIC is forced to convert very large or small numbers to scientific notation. The form for Scientific Notation is to write the mantissa, follow it by "E", and then the exponent. Any number over six digits long, whether typed in by the user or generated by the program, will automatically be converted to Scientific notation. Expressions can also be used to represent numbers. The reasons for using an expression can best be illustrated by an example. Take for instance the number 1/3. To type this into the computer as a decimal digit requires seven key strokes for the most accurate representation possible. You would type: ".333333". An expression would have been better here since only three keystrokes are required to type: "1/3". They each represent the same quantity and typing in more than six 3's in the first representation will not provide improved accuracy because anything beyond six digits is ignored. Expressions are often desirable just for the sake of clarity alone since not many people would recognize: ".111111" as the fraction: "1/9". Some examples of different number representations are: floating point: 365 98.345 scientific notation: 6.02E-23 -1.145E7 numerical expressions: 22/7 7+1/6 (approximation for PI) Another type of constant is the character string. It is different than the other constants both in the way it is defined and in the way it is usually used. Character string constants will probably be seen most -6-