This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:multiasm:cs:chapter_3_11 [2025/12/12 13:23] – ktokarz | en:multiasm:cs:chapter_3_11 [2026/03/29 18:24] (current) – [Endianness] ktokarz | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Fundamentals of Data Encoding, Big Endian, Little Endian ====== | ====== Fundamentals of Data Encoding, Big Endian, Little Endian ====== | ||
| - | The processor can work with different types of data. These include integers of different sizes, floating point numbers, | + | The processor can work with different types of data. These include integers of different sizes, floating-point numbers, |
| ===== Integers ===== | ===== Integers ===== | ||
| - | Integer data types can be 8, 16, 32 or 64 bits long. If the encoded number is unsigned, it is stored in binary representation, | + | Integer data types can be 8, 16, 32 or 64 bits long. If the encoded number is unsigned, it is stored in binary representation, |
| + | {{: | ||
| + | where n is the number of bits in a number. | ||
| In two's complement representation, | In two's complement representation, | ||
| Line 24: | Line 26: | ||
| * Exponent (E) | * Exponent (E) | ||
| * Mantissa (M) | * Mantissa (M) | ||
| - | fulfilling the equation | + | fulfilling the equation\\ |
| - | {{ : | + | {{: |
| - | There are two main types of real numbers, called floating-point values. Single precision is a number which is encoded in 32 bits. Double-precision floating-point number is encoded with 64 bits. They are presented in Fig{{ref> | + | There are two main types of real numbers, called floating-point values. Single precision is a number which is encoded in 32 bits. A double-precision floating-point number is encoded with 64 bits. They are presented in Fig{{ref> |
| <figure realtypes> | <figure realtypes> | ||
| - | {{ : | + | {{: |
| < | < | ||
| </ | </ | ||
| Line 38: | Line 40: | ||
| <table realnumbers> | <table realnumbers> | ||
| < | < | ||
| - | ^ Precision | + | ^ Precision |
| - | | Single (32 bit) | 8 bits | 23 bits | {{ : | + | | Single (32 bit) | 8 bits | 23 bits | {{ : |
| - | | Double (64 bit) | 11 bits | 52 bits | {{ : | + | | Double (64 bit) | 11 bits | 52 bits | {{ : |
| </ | </ | ||
| - | The most common representation for real numbers on computers is standardised in the document IEEE Standard 754. There are two modifications | + | The most common representation for real numbers on computers is standardised in the document IEEE Standard 754. Two features have been implemented |
| - | * The Biased exponent | + | * the Biased exponent, |
| - | * The Normalised Mantissa | + | * the Normalised Mantissa. |
| A biased exponent means that the bias value is added to the real exponent value. This results in all positive exponents, which makes it easier to compare numbers. | A biased exponent means that the bias value is added to the real exponent value. This results in all positive exponents, which makes it easier to compare numbers. | ||
| The normalised mantissa is adjusted to have only one bit of the value " | The normalised mantissa is adjusted to have only one bit of the value " | ||
| Line 65: | Line 67: | ||
| < | < | ||
| </ | </ | ||
| + | |||
| + | Big-endian is mainly used in network protocols, where the most significant bytes are sent first. In modern processors, the dominant order of data placement in memory is little-endian, | ||