44 views

Uploaded by Ricky Kwan Ki Kwok

- Lesson Plan 1
- Numerical Analysis
- Dsc PC560 Manual Completo
- Numerical Methods Notes
- Fixed Point Representation Integer Representation
- Assignment 1
- Binary
- Lec 02 - Introduction to Number Systems
- TRM011 MotionWorksIEC Basic (1)
- ECC208A_4
- Abstract Csd
- Comp 411-3, Numbr Systems
- rfc401
- Fib Primitive
- Manual MemoRail Modbus a 1405 N en Knick
- ProgrammingGroundUp-1-0-lettersize
- Introduction to Computer Organization
- zio2011-qpaper
- The Ring programming language version 1.5.4 book - Part 24 of 185
- GE2112-QB

You are on page 1of 5

1) Find the twos complement representation for the following numbers, assuming that they are

represented as a 16-bit number. Write the value in both binary and hexadecimal.

a) 93

b) 1034

c) 492

d) 1094

2) Using the smallest data size possible, either a byte, a halfword (16 bits), or a word (32 bits),

convert the following values into twos complement representations:

a) 18,304

b) 20

c) 114

d) 128

3) Convert the following hexadecimal values to base ten:

a) 0xFE98

b) 0xFEED

c) 0xB00

d) 0xDEAF

4) Convert the following decimal numbers into hexadecimal

a) 256

b) 1000

c) 4095

d) 42

5) Convert the following fractions into decimal numbers

a) Binary number : 101.111

b) Hexadecimal number : 101.111

6) Convert the following numbers into binary numbers

a) Decimal number: 8.625

b) Hexadecimal number : A1.E8

7) List the advantages of using the twos complement representation over the more intuitive

sign-magnitude representation.

1) Steps

If number is positive, stop, else proceed to next step.

Compute the 1s complement by inverting the bits.

Add 1 to the 1s complement to obtain the 2s complement number.

a) 93 = 1 0 1 1 1 0 1 B

Can be converted by hand using repeated division by 2 and keeping track of the

remainders.

293

246

223

211

25

22

21

0

Remainder 0

Remainder 1

Remainder 1

Remainder 1

Remainder 0

Remainder 1

0000 0000 0101 1101B

Invert the bits to get the 1s complement : 1 1 1 1 1 1 1 1 1 0 1 0 0 0 1 0 B

Add 1 to obtain the 2s complement.

1111 1111 1010 0010B

+

1B

1 1 1 1 1 1 1 1 1 0 1 0 0 0 1 1 B (2s complement representation of 93 in Binary)

F

b) 1034 = 1 0 0 0 0 0 0 1 0 1 0 B

In 16-bit format

0000 0100 0000 1010B

0

c) 492 = 1 1 1 1 0 1 1 0 0 B

In 16-bit format

0000 0001 1110 1100B

0

d) 1094 = 1 0 0 0 1 0 0 0 1 1 0 B

In 16-bit format

0000 0100 0100 0110B

When doing by hand, another way of doing 2s complement is to start from the right, and

do bit by bit, all the bits will be unchanged until the first 1 is encountered. Then the bits

after the first 1 will be inverted. In the example above, the bits that are unchanged are

underlined, the rest will be negated.

1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 0 B is the 2s complement

F

Byte :

128 to 127

Halfword :

32,768 to 32,767

Word:

2,147,483,648 to 2,147,483,647

a) 18,304 can be represented using Halfword or 16 bits

In 16-bit format, 18304 can be represented by

0100 0111 1000 0000B

1 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 B (2s complement form)

b) 20 can be represented by a byte or 8 bits

In 16-bit format, 20 can be represented by

0001 0100B

1 1 1 0 1 1 0 0 B (2s complement form)

c) 114 can be represented by a byte

0111 0010B

d) 128 can be represented by a byte

1n 8-bit format, 128 can be represented by

1000 0000

3) a) 0xFE98

Decimal value is 8160+9161+14162+15163 = 65176

b) 0xFEED

Decimal value is 13160+14161+14162+15163 = 65261

c) 0xB00

d) 0xDEAF

Decimal value is 15160+10161+14162+13163 = 57007

4) Can be converted using repeated division by 16 and keeping track of the remainders

a) 16256

1616 Remainder 0 (Least Significant hexadecimal)

161

Remainder 0

1

Remainder 1

Therefore hexadecimal value is 0x100

b)

161000

1662 Remainder 8 (Least Significant hexadecimal)

163

Remainder E (Decimal 14)

0

Remainder 3

Therefore hexadecimal value is 0x3E8

c) 164095

16255 Remainder F (Least Significant hexadecimal)

1615 Remainder F

0

Remainder F

Therefore hexadecimal value is 0xFFF

d)

1642

162 Remainder A (Least Significant hexadecimal)

0 Remainder 2

Therefore hexadecimal value is 0x2A

5) Similar to Question 3

a) Binary number 101.111

Value in Decimal = 1 22 + 0 21 + 1 20 + 1 21 + 1 2-2 + 1 2-3

= 4+1+0.5+0.25+0.125

= 5.875

b) Hexadecimal 101.111

Value in Decimal = 1 162 + 0 161 + 1 160 + 1 161 + 1 16-2 + 1 16-3

= 256 + 1 + 0.0625 + 0.00390625 + 0.000244140625

257.06665

6) Have to separate the number into two parts, the whole number part and the fractional part.

a) 8.625 = 8 + 0.625

Convert the whole number part using repeated division by 2.

8 decimal = 1 0 0 0 Binary

Convert the fractional part using repeated multiplication by 2.

0.625 2 = 1.25 ; 1

0.25 2 = 0.5 ; 0

0.5 2 = 1.0 ; 1

Hence the binary number equivalent of 8.625 will be 1 0 0 0. 1 0 1

b) Hexadecimal to binary conversion is simple even for float numbers

A

1

.

E

8

1010 0001 .

1110 1000

Hence answer is 10100001.11101 Binary

7) There are a number of significant advantages that twos complement has over the signmagnitude representation

An adder can be used to perform subtraction when negative numbers are represented

in twos complement form.

A sign-magnitude representation has two representations of zeros. For example a zero

byte can be represented by 0 0 0 0 0 0 0 0 B or 1 0 0 0 0 0 0 0 B. Hence it is more

difficult to determine the zero condition as both values must be tested.

Twos complement number has the advantage of sign-extension, i.e. to convert a byte

to a halfword or a word, you only need to replicate the sign-bit to the left.

For example, 20 in 8 bits is 1 1 1 0 1 1 0 0 B

20 in 16 bits is 1111 1111 1110 1100 B

20 in 32 bits is 1111 1111 1111 1111 1111 1111 1110 1100 B

- Lesson Plan 1Uploaded bySatifah66
- Numerical AnalysisUploaded byAsif javed
- Dsc PC560 Manual CompletoUploaded byCristian Zuleta
- Numerical Methods NotesUploaded byfuwad84
- Fixed Point Representation Integer RepresentationUploaded byoureducation.in
- Assignment 1Uploaded byShamal De Silva
- BinaryUploaded byFrances Emmanuel Domingo Callado
- Lec 02 - Introduction to Number SystemsUploaded bySean Xavier Nieva
- TRM011 MotionWorksIEC Basic (1)Uploaded byCa Fc
- ECC208A_4Uploaded byKiran Kumar B M
- Abstract CsdUploaded bySARATH MOHANDAS
- Comp 411-3, Numbr SystemsUploaded byJed Gawan
- rfc401Uploaded byNickyNET
- Fib PrimitiveUploaded byManoj Sharma
- Manual MemoRail Modbus a 1405 N en KnickUploaded byRSScribd
- ProgrammingGroundUp-1-0-lettersizeUploaded bykongo86
- Introduction to Computer OrganizationUploaded byemirasabri
- zio2011-qpaperUploaded byrask2k1
- The Ring programming language version 1.5.4 book - Part 24 of 185Uploaded byMahmoud Samir Fayed
- GE2112-QBUploaded bykannanvishnu
- Boolean Algebra (4) K-MAP 2Uploaded byFir Daus
- Lecture_8Uploaded bySubs Negi
- THEORY OF COMPUTATION-2011-APRIL-MAY.pdfUploaded byAnirudhan Ravi
- Homework 1Uploaded byMinh Hoang

- MITRES_6_007S11_hw05Uploaded byLenin Kumar
- 1213 MathF1 FINALUploaded byRicky Kwan Ki Kwok
- EE2008 Chapter 4 Finding the RootUploaded byRicky Kwan Ki Kwok
- 3008 QuestionList Tutorial7 Digital DemodulationUploaded byRicky Kwan Ki Kwok
- Chapter 6 Risk Measures and Models SelectionsUploaded byRicky Kwan Ki Kwok
- David K. Cheng - Field and Wave ElectromagneticsUploaded bynikee72
- EE3008 Quiz 1Uploaded byRicky Kwan Ki Kwok
- lect5-fsm.pptUploaded bySangeetha Sangu BC
- PS05_FourierSeriesUploaded byRicky Kwan Ki Kwok
- 1201 ReviewUploaded byRicky Kwan Ki Kwok
- Flashcards csUploaded byRicky Kwan Ki Kwok
- Sarasate - Carmen Fantasie Op25 for Violin and PianoUploaded byTong Li

- Class WorkUploaded bySafia Amir Dahri
- AlgebraUploaded byMd. Kamrul Hasan
- Egypt Transformation ParametersUploaded byHenra Halim
- Chapter8 ComplexUploaded byjay
- NUMERACY SCOPE AND SEQUENCEUploaded bySarah Evans
- Class Big DecimalUploaded bysrikanth5b3
- Number systemUploaded byWaFiy YosHioka
- MAT FOR 1Uploaded byBHASKAR
- Mathematics Paper 1 Year 4, Pksr 1, 2010Uploaded bynorizan bt awang
- DLD03 ComplementUploaded byS.M.Abbas Zadi.
- calculadora ti30xaUploaded byoswaldor3
- Descriptive Statistics Measures of Cetral Tendency (2)Uploaded byImelda Maria Tania Rosario
- Computer Organizations ArithmeticUploaded byvenkeeku
- Computer ion Nd ArchitectureUploaded byedudivya
- Basic Arithmetic SkillsUploaded bynylashahid
- feep103Uploaded bykritagyasharma29
- Addition and Subtract ~ 0001Uploaded bySarsie Camua Reyes
- Advanced Algebra V1.0Uploaded byCarlos Murra
- Whole Numbers and IntegersUploaded byAkhilesh Verma
- 2017 Contest Final VersionUploaded byp001
- Solutions_C1.pdfUploaded byAhsun Taquveem Chohan
- Comple Number Theory_HUploaded bythinkiit
- Reasoning RRB TeluguUploaded byVishal Kumar
- maths progressionsUploaded byapi-350901903
- maths year 3 pkbs 1Uploaded by171173
- Arithmetic LCM and HCFUploaded byJaved Anwar
- RPT MT Y4 DLP [2019]Uploaded byyeokahhian82
- 6 1 PercentsUploaded byapi-25931785
- Ensamblador 8086Uploaded byarto99style
- Basic MathUploaded byisha84