Data representation refers to the data types employed in BASIC. There are primarily two types of data:
Numeric |
Consists of a series of digits and represents an amount, such as 123. |
String |
Consists of a set of characters, such as "Jan Smith". |
For non-Pick BASIC, a numeric value in the range of:
{+/-}140737488355327*(10(-p))
where p is the precision value between 0 and 9, and is stored as numeric data. A numeric value outside this range is stored as string data.
Data representation for BASIC and Floating Point BASIC have implementation specific constraints.
In order to maintain maximum accuracy, when an operation causes an overflow condition, a precision of up to 18 digits to the right of the decimal is stored internally.
Results from addition, subtraction, division, multiplication, and remainder operations that exceed this range of {+/-}140737488355327*(10(-p)) have no limitation on their numeric range.
For the comparison operators such as < , = , > , and the arithmetic functions int(x), abs(x), mod(x,y), and rem(x,y), there is no limitation, because the result is limited to a 1 or 0.
The BASIC functions ln(), sqrt(), pwr(), and exp() can be (+/-)140737488355327x(10(-p)).
A string can contain up to 2 GB of characters in D3. A string constant is represented by a set of characters delimited by ’, " , or \. If any of the string delimiters are to be part of the string, then one of the other delimiters must be used to delimit the string.
Numeric and string data can be represented within a BASIC program as either constants or variables. A constant, as its name implies, has the same value throughout the execution of the program. A variable can contain data types other than string and numeric data (root, active list, file variable), but these representations are limited to specific statements.
See Also