1.5 KiB
1.5 KiB
Convert numbers to binary
Number in decimal: 53.7
Decimal conversion
Calculation | Remainder/Binary |
---|---|
53 / 2 = 26 | 1 |
26 / 2 = 13 | 0 |
13 / 2 = 6 | 1 |
6 / 2 = 3 | 0 |
3 / 2 = 1 | 1 |
1 / 2 = 0 | 1 |
So in binary 110101, as the order is in reverse of the decimals |
Fraction Conversion
Calculation | Non Decimal Portion/Binary |
---|---|
0.7 x 2 = 1.4 | 1 |
0.4 x 2 = 0.8 | 0 |
0.8 x 2 = 1.6 | 1 |
0.6 x 2 = 1.2 | 1 |
0.2 x 2 = 0.4 | 0 |
And so on.. so the fraction would be .10110, with 0110 repeating infinitely | |
So the final number would be 110101.10110... |
Normalization is the process is the process of adjusting a number so only 1 non zero digit on the left side of a number, i.e. the number is in scientific notation
Floating point number types
Precision | Sign | Exponent | Mantissa |
---|---|---|---|
single | 1 | 8 | 23 |
double | 1 | 11 | 52 |
long double | 1 | 15 | 64 |
Truncation types | |||
Chopping: Omit the numbers that we don't want, looking to the first bit that we want to erase | |||
Rounding: We should take care about the first digit that we want to omit and adjust the 52nd bit |