C Programming - Floating Point Issues - Discussion

Discussion Forum : Floating Point Issues - General Questions (Q.No. 8)
8.
A float occupies 4 bytes. If the hexadecimal equivalent of these 4 bytes are A, B, C and D, then when this float is stored in memory in which of the following order do these bytes gets stored?
ABCD
DCBA
0xABCD
Depends on big endian or little endian architecture
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
36 comments Page 2 of 4.

Anusha said:   1 decade ago
Why is the concept of little or big endian followed? Why can't people stick on to 1 particular method following a standard what difference does it make?

Mohamed said:   1 decade ago
What is the use of using these two kind of methods?

Manas Rajderkar said:   1 decade ago
Great! Santosh, and Krunal appreciable.

SAGAR said:   1 decade ago
Thanks nice explanation.

Ganesh said:   1 decade ago
Thank you all for such wonderful explanation.

Usman ali ar said:   10 years ago
What is meaning of this answer?

Raj said:   8 years ago
Please give an explanation. I am not getting the answer.

Ridhima Ramteke said:   8 months ago
Thank you for explaining the answer.

Anusha said:   1 decade ago
Thank you Krunal and Kavitha.

I had a doubt if I had to store 01020304 in little endian, according to ur discription it is 04030201 but why it could not be 40302010 ?

Krunal said:   2 decades ago
"Little Endian" means that the lower-order byte of the number is stored in memory at the lowest address, and the high-order byte at the highest address. For example, a 4 byte Integer

ABCD

will be arranged in memory as follows:
Base Address+0 Byte0
Base Address+1 Byte1
Base Address+2 Byte2
Base Address+3 Byte3

Intel processors (those used in PC's) use "Little Endian" byte order.
"Big Endian" means that the high-order byte of the number is stored in memory at the lowest address, and the low-order byte at the highest address. The same 4 byte integer would be stored as:

Base Address+0 Byte3
Base Address+1 Byte2
Base Address+2 Byte1
Base Address+3 Byte0

Motorola processors (those used in Mac's) use "Big Endian" byte order.


Post your comments here:

Your comments will be displayed after verification.