tanszek:oktatas:techcomm:floating-point_representation
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tanszek:oktatas:techcomm:floating-point_representation [2024/10/06 17:27] – created knehez | tanszek:oktatas:techcomm:floating-point_representation [2024/10/06 17:35] (current) – [The IEEE 754 Standard] knehez | ||
---|---|---|---|
Line 13: | Line 13: | ||
The formula: | The formula: | ||
- | $$ \text{Value} = (-1)^S \times 1.M \times 2^{(E - \text{Bias})} $$ | + | $$ \text{value} = (-1)^S \times 1.M \times 2^{(E - \text{Bias})} $$ |
where **Bias** is 127 for single-precision (32-bit). | where **Bias** is 127 for single-precision (32-bit). | ||
Line 36: | Line 36: | ||
* **Step 4**: Combine them | * **Step 4**: Combine them | ||
$$ 0 | 10000010 | 01001000000000000000000 $$ | $$ 0 | 10000010 | 01001000000000000000000 $$ | ||
+ | |||
+ | ==== Special Values in Floating-Point Representation ==== | ||
+ | |||
+ | In the IEEE 754 floating-point standard, certain special values are reserved for //edge cases// such as **zero**, **infinity**, | ||
+ | |||
+ | === Special Values Overview === | ||
+ | |||
+ | * **Zero**: Represents positive or negative zero | ||
+ | * **Infinity**: | ||
+ | * **NaN (Not a Number)**: Represents undefined results, such as **0/0** or **sqrt(-1)** | ||
+ | |||
+ | ^ Value ^ Sign Bit (S) ^ Exponent (E) ^ Mantissa (M) ^ Description ^ | ||
+ | | +Zero | 0 | 00000000 | 00000000000000000000000 | Represents positive zero | | ||
+ | | -Zero | 1 | 00000000 | 00000000000000000000000 | Represents negative zero | | ||
+ | | +Infinity| 0 | 11111111 | 00000000000000000000000 | Represents positive infinity | | ||
+ | | -Infinity| 1 | 11111111 | 00000000000000000000000 | Represents negative infinity | | ||
+ | | NaN | 0 or 1 | 11111111 | Non-zero value | Represents "Not a Number", | ||
+ | |||
+ | Try them out here: https:// | ||
+ |
tanszek/oktatas/techcomm/floating-point_representation.1728235657.txt.gz · Last modified: 2024/10/06 17:27 by knehez