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/01/08 17:49] – [Table] ktokarz | en:multiasm:cs:chapter_3_11 [2025/05/15 06:20] (current) – [Integers] ktokarz | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ===== 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, |
| + | |||
| + | In two's complement representation, | ||
| <table binarynumbers> | <table binarynumbers> | ||
| < | < | ||
| Line 18: | Line 20: | ||
| ===== Floating point ===== | ===== Floating point ===== | ||
| - | Integer calculations do not always cover all mathematical requirements of the algorithm. To represent real numbers the floating point encoding is used. A floating point is the representation of the value //A// which is composed of two numbers | + | Integer calculations do not always cover all mathematical requirements of the algorithm. To represent real numbers the floating point encoding is used. A floating point is the representation of the value //A// which is composed of three fields: |
| - | * Mantissa | + | * Sign bit |
| - | * Exponent | + | * Exponent |
| + | * Mantissa | ||
| fulfilling the equation | fulfilling the equation | ||
| {{ : | {{ : | ||
| - | There are two main types of real numbers, called floating point values. Single precision is the 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 the number which is encoded in 32 bits. Double precision floating point number is encoded with 64 bits. They are presented in Fig{{ref> |
| <figure realtypes> | <figure realtypes> | ||
| Line 30: | Line 33: | ||
| < | < | ||
| </ | </ | ||
| + | |||
| + | The Table{{ref> | ||
| <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 implemented which make the calculations easier for computers. | ||
| + | * The Biased exponent | ||
| + | * The Normalised Mantissa | ||
| + | Biased exponent means that the bias value is added to the real exponent value. This results with all positive exponents which makes it easier to compare numbers. | ||
| + | The normalised mantissa is adjusted to have only one bit of the value " | ||
| + | |||
| + | |||
| ===== Texts ===== | ===== Texts ===== | ||