0% found this document useful (0 votes)
19 views6 pages

COS10003 Assignment 01

The document discusses a class assignment for Swinburne Vietnam's Ho Chi Minh City campus. It provides the class topic, instructor details, student names and location. Multiple parts of the document then show calculations and conversions between binary, hexadecimal and floating point number formats.

Uploaded by

phongvunz123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views6 pages

COS10003 Assignment 01

The document discusses a class assignment for Swinburne Vietnam's Ho Chi Minh City campus. It provides the class topic, instructor details, student names and location. Multiple parts of the document then show calculations and conversions between binary, hexadecimal and floating point number formats.

Uploaded by

phongvunz123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

SWINBURNE VIETNAM

HO CHI MINH CAMPUS

CLASS: COS10003
Topic

Assignment 1

INSTRUCTOR:
Dr. Van Ho

STUDENT NAMES:
Vu Thanh Phong

ID:
104486950
HO CHI MINH CITY – June 2023
Starting point 2:

1a)
1698/256 = 6, remainder = 162
162/16 = 10, remainder = 2
2/1 = 2, remainder = 0
 1686 = 0x6A2

1b)
42/2 = 21, remainder = 0
21/2 = 10, remainder = 1
10/2 = 5, remainder = 0
5/2 = 2, remainder = 1
2/2 = 1, remainder = 0
1/2 = 0.5, remainder = 1
 42 in binary = 0b00101010
Flip all the bits: 0b11010101
Add 1-bit = 0b11010110
 8-bits two’s complement of -42 is 0b11010110

1c)
236.5 is a positive number, so sign = 0
236/2 = 118, remainder = 0
118/2 = 59, remainder = 0
59/2 = 29, remainder = 1
29/2 = 14, remainder = 1
14/2 = 7, remainder = 0
7/2 = 3, remainder = 1
3/2 = 1, remainder = 1
1/2= 0.5, remainder = 1
 236 in binary = 0b 1110 1100
Fraction = 0.5
0.5 x 2 = 1
The positive number before normalisation = 1110 1100.10000000000000000000000
Normalise the number = 1.110110010000000000000000000000x 27
M = 11011001000000000000000
Exp = 7 + 127 = 134
134/2 = 67, remainder = 0
67/2 = 33, remainder = 1
33/2 = 16, remainder = 1
16/2 = 8, remainder = 0
8/2 = 4, remainder = 0
4/2 = 2, remainder = 0
2/2 = 1, remainder = 0
1/2 = 0.5, remainder = 1
 134 in binary = 0b1000 0110
 236.5 in IEEE 754 single precision = 0 10000110 11011001000000000000000

2a) 0010 1111 1001 1010


0010 = 2
1111 = F
1001 = 9
1010 = A
 0010 1111 1001 1010 = 0x2F9A

2b)
0010 1111 = 1x 2^5 + 1 x 2^3 + 1 x 2^2 + 1 x 2^1 + 1 x 2^0 = 47
1001 1010 = 1 x 2^7 + 1 x 2^4 + 1 x 2^3 + 1 x 2^1 = 154

2c)
The MSB of 0010 1111 is 0 which means it is a positive number. Therefore, the number does not
change:
0010 1111 = = 1x 2^5 + 1 x 2^3 + 1 x 2^2 + 1 x 2^1 + 1 x 2^0 = 47

The MSB of 1001 1010 is 1 which means it is a negative number. Therefore, the number needs
to go through the process of two’s complement
1001 1010 – 1 = 1001 1001
Flip all the bits = 0110 0110
0110 0110 = 1x 2^6 + 1 x 2^5 + 1 x 2^2 + 1 x 2^1 = 102
 1001 1010 in two’s complement representation is -102

2d) 0 01011 1110011010


Sign = 0, therefore it is a positive number
0b01011 in decimal = 1 x 2^3 + 1 x 2^1 + 1 x 2^0 = 11
Exp = 11 – 15 =-4
M = 1. 1110011010 = 2^0 + 2^-1 + 2^-2 + 2^-3 + 2^-6 + 2^-7 + 2^-9 = 1.900390625
Number = (-1)^0 x 1.900390625 x 2^-4 = 0.1187744141
 0 01011 1110011010 in one half-precision = 0.1188

3) df 81 e2 91 a1 34 f0 9d 8d a7
df = 1101 1111
81 = 1000 0001
e2 = 1110 0010
91 = 1001 0001
a1 = 1010 0001
34 = 0011 0100
f0 = 1111 0000
9d = 1001 1101
8d = 1000 1101
a7 = 1010 0111
11011111 10000001 11100010 10010001 10100001 00110100 11110000 10011101 10001101
10100111

To convert the given code to UTF-8 encoding, the hexadecimal codes need to be converted to 8-
bits binary. Then match those codes to the correct group and the prefaced bits (in bold) are
removed.
1st code point 11011111 10000001 = 111 1100 0001 => U+07C1
2nd code point 11100010 10010001 10100001 = 0010 0100 0110 0001 => U+2461
3rd code point 00110100 = 011 0100 => U+0034
4th code point 11110000 10011101 10001101 10100111 = 0 0001 1101 0011 0110 0111 =>
U+1D367

U+07C1: ߁
U+2461: ②
U+0034: 4

U+1D367: 𝍧

You might also like