Notes/UNB/Year 5/Semester 1/CS3113/In class notes.md
2024-09-09 08:59:46 -03:00

895 B

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...