Constants And Internal Representation

From Appmethod Topics
Jump to: navigation, search

Go Up to Constants Overview Index

ANSI C acknowledges that the size and numeric range of the basic data types (and their various permutations) are implementation-specific and usually derive from the architecture of the host computer. For Appmethod C++, the target platform is the IBM PC family (and compatibles), so the architecture of the Intel Pentium family of microprocessors governs the choices of internal representations for the various data types.

The following table lists the sizes and resulting ranges of the data types.

32-bit data types, sizes, and ranges

Type

Size (bits)

Range

Sample applications

unsigned char

8

0 <= X <= 255

Small numbers and full PC character set

char

8

-128 <= X <= 127

Very small numbers and ASCII characters

short int

16

-32,768 <= X <= 32,767

Counting, small numbers, loop control

unsigned int

32

0 <= X <= 4,294,967,295

Large numbers and loops

int

32

-2,147,483,648 <= X <= 2,147,483,647

Counting, small numbers, loop control

unsigned long

32

0 <= X <= 4,294,967,295

Astronomical distances

enum

32

-2,147,483,648 <= X <= 2,147,483,647

Ordered sets of values

long

32

-2,147,483,648 <= X <= 2,147,483,647

Large numbers, populations

float

32

1.18E-38 < |X| < 3.40E+38

Scientific (7-digit precision)

double

64

2.23E-308 < |X| < 1.79E+308

Scientific (15-digit precision)

long double

80

3.37E-4932 < |X| < 1.18E+4932

Financial (18-digit precision)


Internal Representation Of Numerical Types shows how these types are represented internally in the Intel Pentium family of microprocessors.

See Also