15.04.2018 Views

programming-for-dummies

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

594<br />

Declaring Variables<br />

Table 5-2 (continued)<br />

Data Type Number of Bytes Range<br />

Uint16 2 0 to 65535<br />

Uint32 4 0 to 4,294,967,295<br />

Uint64 8 0 to 2^64–1<br />

Declaring decimal data types<br />

Decimal values represent numbers such as 1.28 or –90.4. Just as you can<br />

limit the range of integer values a variable can hold, so can you limit the<br />

range of decimal values a variable can hold. In Visual Basic, the three types<br />

of decimal data types are Single, Double, and Decimal (as shown in Table<br />

5-3). In REALbasic, the only two decimal data types are Single and Double<br />

(as shown in Table 5-4).<br />

Table 5-3<br />

Visual Basic Decimal Data Types<br />

Data Type Number of Bytes Range<br />

Single 4 –3.402823 E38 to –1.401298 E-45<br />

(negative values)<br />

1.401298 E–45 to 3.402823 E38<br />

(positive values)<br />

Double 8 –1.79769313486231 E308 to<br />

–4.94065645841247 E–324<br />

(negative values)<br />

4.94065645841247 E–324 to<br />

1.79769313486232 E308<br />

(positive values)<br />

Decimal 12 +/–79,228,162,514,264,337,593,<br />

543,950,335 (no decimal point)<br />

+/–7.9228162514264337593543950335<br />

(up to 28 decimal places)<br />

Table 5-4<br />

REALbasic Decimal Data Types<br />

Data Type Number of Bytes Range<br />

Single 4 1.175494 E–38 and 3.402823 E+38<br />

Double 8 2.2250738585072013 E–308 and<br />

1.7976931348623157 E+308<br />

To declare a variable as a Decimal data type, use the Single, Double, or<br />

Decimal keyword, such as<br />

Dim TaxRefund As Single

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!