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?
Discussion:
36 comments Page 2 of 4.
Sandeep said:
1 decade ago
What kavitha said was up to the mark. But it is for 8 bit processors.
What we generally use are all of 16-bit processors.
So in ABCD.
CD will be allocated consecutive 2 bytes (16-bit).
And then AB will be allocated consecutive 2 bytes.
For more info refer to any microprocessors text.
What we generally use are all of 16-bit processors.
So in ABCD.
CD will be allocated consecutive 2 bytes (16-bit).
And then AB will be allocated consecutive 2 bytes.
For more info refer to any microprocessors text.
Santhosh kumar m v said:
1 decade ago
When designing computers, there are two different architectures for handling memory storage. They are called Big Endian and Little Endian and refer to the order in which the bytes are stored in memory. Windows NT was designed around Little Endian architecture and was not designed to be compatible with Big Endian because most programs are written with some dependency on Little Endian.
These two phrases are derived from "Big End In" and "Little End In." They refer to the way in which memory is stored. On an Intel computer, the little end is stored first. This means a Hex word like 0x1234 is stored in memory as (0x34 0x12). The little end, or lower end, is stored first. The same is true for a four-byte value; for example, 0x12345678 would be stored as (0x78 0x56 0x34 0x12). "Big End In" does this in the reverse fashion, so 0x1234 would be stored as (0x12 0x34) in memory. This is the method used by Motorola computers and can also be used on RISC-based computers. The RISC-based MIPS computers and the DEC Alpha computers are configurable for Big Endian or Little Endian. Windows NT works only in the Little Endian mode on both computers.
Windows NT was designed around Little Endian architecture. The Hardware Abstraction Layer (HAL) is written so that all operating system-related issues are automatically handled. Therefore, it is possible to create a HAL that could work on Big Endian architecture. The basic problem with porting the code has to do with the way the code is written for all programs. Code is often written with the assumption that Big Endian or Little Endian is being used. This may not be specific to the HAL; it could be something as simple as bit masking for graphics. To clarify this concept more, two programming examples follow.
These two phrases are derived from "Big End In" and "Little End In." They refer to the way in which memory is stored. On an Intel computer, the little end is stored first. This means a Hex word like 0x1234 is stored in memory as (0x34 0x12). The little end, or lower end, is stored first. The same is true for a four-byte value; for example, 0x12345678 would be stored as (0x78 0x56 0x34 0x12). "Big End In" does this in the reverse fashion, so 0x1234 would be stored as (0x12 0x34) in memory. This is the method used by Motorola computers and can also be used on RISC-based computers. The RISC-based MIPS computers and the DEC Alpha computers are configurable for Big Endian or Little Endian. Windows NT works only in the Little Endian mode on both computers.
Windows NT was designed around Little Endian architecture. The Hardware Abstraction Layer (HAL) is written so that all operating system-related issues are automatically handled. Therefore, it is possible to create a HAL that could work on Big Endian architecture. The basic problem with porting the code has to do with the way the code is written for all programs. Code is often written with the assumption that Big Endian or Little Endian is being used. This may not be specific to the HAL; it could be something as simple as bit masking for graphics. To clarify this concept more, two programming examples follow.
James said:
1 decade ago
Thank you very much.
Moshii said:
1 decade ago
THAK YOU ALL, I have question. Why Little Endian and Big Endian?
Please give me a proper answer.
Please give me a proper answer.
Akhilesh kumar yadav said:
1 decade ago
Santhosh Kumar M V concept is right.
Ramya said:
1 decade ago
Tq krunal for endian explanation.
Kingstan_BE_EIE said:
1 decade ago
Actually for all the compiler the basic data structure will vary according to the algorithm and architecture .
G.V.narayanan said:
1 decade ago
Explain clearly.
Manas Rajderkar said:
1 decade ago
Great! Santosh, and Krunal appreciable.
Aishwarya gupta said:
1 decade ago
Thank you very much.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers