The care of numbers constitutes an important part of every programming system. Fortunately, PowerBASIC allows you to ignore most technical considerations about internal number handling. If you never give a thought to such matters as calculation speed, precision, and memory requirements, your programs will usually continue to work as you expect. However, an understanding of the underlying issues will help when you need to write programs that are faster, more accurate, and require less memory.
For efficiency, PowerBASIC stores and processes data in different forms. It supports eleven unique numeric types, three string types, and also pointers. The following tables summarize the most important features and distinctions of these data types. The rest of this section explains these features in detail.
Numeric Data storage requirements and ranges
Data Type |
Size |
Decimal Range |
Binary Range |
16 bits (2 bytes), signed |
-32,768 to 32,767 |
-2^15 to 2^15-1 | |
32 bits (4 bytes), signed |
-2,147,483,648 to 2,147,483,647 |
-2^31 to 2^31-1 | |
64 bits (8 bytes), signed |
-9.22*10^18 to +9.22*10^18 |
-2^63 to 2^63-1 | |
8 bits (1 byte), unsigned |
0 to 255 |
0 to 2^8 -1 | |
16 bits (2 bytes), unsigned |
0 to 65,535 |
0 to 2^16 -1 | |
32 bits (4 bytes), unsigned |
0 to 4,294,967,295 |
0 to 2^32 -1 | |
32 bits (4 bytes) |
8.43*10^-37 to 3.40*10^38 |
| |
64 bits (8 bytes) |
4.19*10^-307 to 1.79*10^308 |
| |
80 bits (10 bytes) |
3.4*10^-4932 to 1.2*10^4932 |
| |
64 bits (8 bytes) |
-9.22*10^14 to +9.22*10^14 |
| |
64 bits (8 bytes) |
-9.22*10^16 to +9.22*10^16 |
| |
128 bits (16 bytes) |
{data-dependent} |
{data-dependent} |
Variable type-specifiers and keywords
Variable type |
Type specifier |
Element size |
DEF type |
Type keyword |
N/A |
4 |
N/A |
PTR/POINTER | |
Integer |
% |
2 |
DEFINT |
INTEGER |
Long-integer |
& |
4 |
DEFLNG |
LONG |
Quad-integer |
&& |
8 |
DEFQUD |
QUAD |
Byte |
? |
1 |
DEFBYT |
BYTE |
Word |
?? |
2 |
DEFWRD |
WORD |
Double-word |
??? |
4 |
DEFDWD |
DWORD |
Single-precision |
! |
4 |
DEFSNG |
SINGLE |
Double-precision |
# |
8 |
DEFDBL |
DOUBLE |
Extended-precision |
## |
10 |
DEFEXT |
EXT/EXTENDED |
Currency |
@ |
8 |
DEFCUR |
CUR/CURRENCY |
Extended-currency |
@@ |
8 |
DEFCUX |
CUX/CURRENCYX |
$ |
4 |
DEFSTR |
STRING | |
N/A |
N/A |
N/A |
STRING * x | |
N/A |
N/A |
N/A |
ASCIIZ, ASCIZ | |
$ |
16 |
N/A |
FIELD | |
Variant |
N/A |
16 |
N/A |
VARIANT |
N/A |
16 |
N/A |
GUID | |
N/A |
4 |
N/A |
DISPATCH |