2024-09-09 08:59:46
This commit is contained in:
24
UNB/Year 5/Semester 1/CS3113/In class notes.md
Normal file
24
UNB/Year 5/Semester 1/CS3113/In class notes.md
Normal file
@ -0,0 +1,24 @@
|
||||
## 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...
|
Reference in New Issue
Block a user