ANSI C Data Representations |
A |
![]() |
1
long long is not available in -Xc mode.
|
Data Representations
Bit numberings of any given data element depend on the architecture in use: SPARCstationTM machines use bit 0 as the least significant bit, with byte 0 being the most significant byte. The tables in this section describe the various representations. Integer Representations
Integer types used in ANSI C are short, int, long, and long long:
Bits |
Content |
8 - 15 |
Byte 0 (SPARC) Byte 1 (Intel) (PowerPC) |
0 - 7 |
Byte 1 (SPARC) Byte 0 (Intel) (PowerPC) |
1
long long is not available in -Xc mode.
|
Floating-Point Representations
float, double, and long double data elements are represented according to the ANSI IEEE 754-1985 standard. The representation is:(-1)s2(e - bias) × j.f
where:
Bits |
Name |
31 |
Sign |
23 - 30 |
Exponent |
0 - 22 |
Fraction |
Bits |
Name |
63 |
Sign |
52 - 62 |
Exponent |
0 - 51 |
Fraction |
Bits |
Name |
127 |
Sign |
112 - 126 |
Exponent |
0 - 111 |
Fraction |
Bits |
Name |
80 - 95 |
Unused |
79 |
Sign |
64 - 78 |
Exponent |
63 |
Leading bit |
0 - 62 |
Fraction |
For further information, refer to the Numerical Computation Guide.
Exceptional Values
float and double numbers are said to contain a "hidden," or implied, bit, providing for one more bit of precision than would otherwise be the case. In the case of long double, the leading bit is implicit (SPARC) (PowerPC) or explicit (Intel); this bit is 1 for normal numbers, and 0 for subnormal numbers.
Hexadecimal Representation of Selected Numbers
The following tables show the hexadecimal representations.
For further information, refer to the Numerical Computation Guide.
Pointer Representation
A pointer in C occupies four bytes. The NULL value pointer is equal to zero. Array Storage
Arrays are stored with their elements in a specific storage order. The elements are actually stored in a linear sequence of storage elements.
1
Not valid in -Xc mode
|
Static and global arrays can accommodate many more elements.
Arithmetic Operations on Exceptional Values
This section describes the results derived from applying the basic arithmetic operations to combinations of exceptional and ordinary floating-point values. The information that follows assumes that no traps or any other exception actions are taken.
Abbreviation |
Meaning |
Num |
Subnormal or normal number |
Inf |
Infinity (positive or negative) |
NaN |
Not a number |
Uno |
Unordered |
|
Right Operand | |||
Left Operand |
0 |
Num |
Inf |
NaN |
0 |
0 |
Num |
Inf |
NaN |
Num |
Num |
See Note |
Inf |
NaN |
Inf |
Inf |
Inf |
See Note |
NaN |
NaN |
NaN |
NaN |
NaN |
NaN |
0
0
NaN
NaN
0
Num
Inf
NaN
NaN
Inf
Inf
NaN
NaN
NaN
NaN
NaN
NaN
0
0
NaN
Inf
Num
0
NaN
Inf
Inf
NaN
NaN
NaN
NaN
NaN
NaN
=
<
<
Uno
>
The result of the comparison
<
Uno
>
>
=
Uno
Uno
Uno
Uno
Uno
Note - Num + Num could be Inf, rather than Num, when the result is too large (overflow). Inf + Inf = NaN when the infinities are of opposite sign.
Table A-17 Multiplication Results
Right Operand
Left Operand
0
Num
Inf
NaN
0
Num
Inf
NaN
Table A-18 Division Results
Right Operand
Left Operand
0
Num
Inf
NaN
0
Num
Inf
NaN
Table A-19 Comparison Results
Right Operand
Left Operand
0
+Num
+Inf
NaN
0
+Num
+Inf
NaN
Note - NaN compared with NaN is unordered, and results in inequality. +0 compares equal to -0.
Argument-Passing Mechanism
This section describes how arguments are passed in ANSI C.
Set fr=1, gr=3, and starg to the start of the parameter area.