Professional Documents
Culture Documents
Storing Data
Bits and Bytes
More about data types…
Integer
Single and Double
Boolean
Char and String
Variable Scope
Formatting Data for output
27 27
11 exponent bits, E
52 significand bits, M
Range of Values:
-1.79769313486231570E+308 ~1.79769313486231570E+308
The Decimal data type is also available for floats:
The float is stored as a signed 16 byte Integer (128 bits)…
The Integer is then scaled by a power of 10 to produce the float:
This specifies the number of digits to the right of the decimal point.
The scale is from 0 decimal places to 28 decimal places.
Useful for fixed point calculations…like currency (money).
Boolean
Boolean variables can take only two values:
True or False
Although simple, such Boolean variables become very important
when making decisions...
Such as conditional statements.
More on this, later…
Example:
Dim isReady As Boolean = False
Declares a boolean value ‘isReady’, and initializes it to False.
Characters
A character refers to a single symbol.
Examples: a, 虹 , M, 3, =, ひ
In VB, a character is stored via the Char data type…
as a two byte, unsigned integer (16 bits).
Range: 0 – 65,535
For a given character, this integer:
uniquely identifies the represented character;
is called the Unicode representation.
Dim d As Double
Dim i As Integer
i = CType(d, Integer) ‘conversion, followed by assignment.
Variable Scope
A variable’s scope refers to its range:
Where it is visible (i.e., available for use).
FormatCurrency(Object o)
Data o is formatted using the operating system currency symbol…
set by the user, via Control Panel.
Setting up Numerical Data Format
Here are the format characters for setting up a custom format: