I misunderstood you. I am sorry. The actual representation in memory can be demonstrated by:
Code: Select all
double c = 5.5;
unsigned char *b = (unsigned char*)&c;
printf("%x.%x.%x.%x\n", b[0], b[1], b[2], b[3]);
printf("%x.%x.%x.%x\n", b[4], b[5], b[6], b[7]);
The most significant bits come first in each byte which is demonstrated by:
Code: Select all
unsigned char v = 0xff;
printf("First Value:%u Second Value:%u\n", v, v>>1);
So a thirty-two bit value stored as 0x12345678 is really 0x78,0x56,0x34,0x12 in memory on the I386. Where each byte's bit are
from least significant to most significant. The only reason the individual bytes are reversed is because the processor stored it as 0x1E and displayed it in big endian as 0x78.
7........8................1......E..................7.......8
0111 1000 ----> 0001 1110 ------> 0111 1000
I see it in binary as:
....5.....6.......7......8
0101 0110 0111 1000 = 0x5678
The Intel sees it as:
0001 1110 0110 1010 = 0x1E6A
If I try to read just one byte of it which the Intel will see as:
0001 1110 = 0x1E
It will reverse it to:
0111 1000 = 0x78
It just reverses the eight bits for a byte, sixteen bits for a word, and thirty-two bits for a double word.
We read in big endian and the processor reads in little endian.
5413413 to the processor is really 3143145.
So that would be IEEE doubles stored with the least significant 32bits of the significant first and then the sign, exponent and rest of the significant in the second 32bits. Could someone either correct me or confirm that as fact?
If I serialized the data of the four bytes starting at the lowest bit address. It would be serialized as.... mantissa, exponent, sign..
0x1234 would truly be viewed as 0001->0010->0011->0100, but stored as 0010->1100->0100->0001 in each nibble in memory moving upwards on the Intel.
If I am correct when a PCI card has a logic one on the address pins. Which go from A0 to A31. Then highest bit of the address would be stored at pin A31 and represent the decimal value 2,147,483,648.
It just depends on how you are viewing it.
"Floating point values are IEEE doubles stored in the representation as on the i386."