Large computational projects usually involve storing and handling large amounts of data. For performance reasons it is better to keep this data in binary (unformatted) form. However different computers can store the binary data in different formats. In big-endian architectures, the leftmost bytes (those with a lower address) are most significant. In little-endian architectures, the rightmost bytes are most significant. For example, consider the number 1025 (2 to the tenth power plus one) stored in a 4-byte integer
00000000 00000000 00000100 00000001
| Address |
Big-Endian representation of 1025 |
Little-Endian representation of 1025 |
00 01 02 03 |
00000000 00000000 00000100 00000001 |
00000001 00000100 00000000 00000000 |
Many mainframe computers, particularly IBM mainframes, and workstations use a big-endian architecture. Most modern computers, including PCs, use the little-endian system. The PowerPC system is bi-endian because it can understand both systems.
Converting data between the two systems is sometimes referred to as the NUXI problem. Imagine the word UNIX stored in two 2-byte words. In a Big-Endian systems, it would be stored as UNIX. In a little-endian system, it would be stored as NUXI.
Note that the example above shows only big- and little-endian byte orders. The bit ordering within each byte can also be big- or little-endian, and some architectures actually use big-endian ordering for bits and little-endian ordering for bytes, or vice versa.
The terms big-endian and little-endian are derived from the Lilliputians of Gulliver's Travels, whose major political issue was whether soft-boiled eggs should be opened on the big side or the little side. Likewise, the big-/little-endian computer debate has much more to do with political issues than technological merits.
Fortran Compilers usually have build-in flags to switch between the two formats and handle the data in the proper way (the Fortran Intel compiler doesn't have this flag).
In addition to the platform dependent representation of binary data, sequential or direct access to binary files plays an important role (Fortran). To assure interoperability between C/C++ binary files and Fortran files the direct access method is recommended for files created by Fortran applications.