The range of values for a variable is bounded by the minimum and maximum values that can be represented internally in a given number of bits. However, because of C’s conversion rules (discussed in detail in Type Conversions in Chapter 4) you cannot always use the maximum or minimum value for a constant of a particular type in an expression.
For example, the constant expression -32768
consists of the arithmetic negation operator (–) applied to the constant value 32,768. Since 32,768 is too large to represent as a short int, it is given the long type. Consequently, the constant expression -32768
has long type. You can only represent –32,768 as a short int by type-casting it to the short type. No information is lost in the type cast, since –32,768 can be represented internally in 2 bytes.
The value 65,000 in decimal notation is considered a signed constant. It is given the long type because 65,000 does not fit into a short. A value such as 65,000 can only be represented as an unsigned short by type-casting the value to unsigned short type, by giving the value in octal or hexadecimal notation, or by specifying it as 65000U. You can cast this long value to the unsigned short type without loss of information, since 65,000 can fit in 2 bytes when it is stored as an unsigned number.
Microsoft Specific —>
The long double contains 80 bits: 1 for sign, 15 for exponent, and 64 for mantissa. Its range is +/–1.2E4932 with at least 19 digits of precision. Although long double and double are separate types, the representation of long double and double is identical.
END Microsoft Specific