100% found this document useful (1 vote)
216 views

Real Numbers Problems PDF

Uploaded by

Edgardo Leysa
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
100% found this document useful (1 vote)
216 views

Real Numbers Problems PDF

Uploaded by

Edgardo Leysa
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/ 9

2

1 In a particular computer system, real numbers are stored using floating-point representation with:

8 bits for the mantissa, followed by


8 bits for the exponent

Twos complement form is used for both mantissa and exponent.

(a) (i) A real number is stored as the following two bytes:

Mantissa Exponent

0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1

Calculate the denary value of this number. Show your working.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

(ii) Explain why the floating-point number in part (a)(i) is not normalised.

...........................................................................................................................................

.......................................................................................................................................[2]

(iii) Normalise the floating-point number in part (a)(i).

Mantissa Exponent

[2]

UCLES 2015 9608/31/O/N/15


3

(b) (i) Write the largest positive number that can be written as a normalised floating-point
number in this format.

Mantissa Exponent

[2]

(ii) Write the smallest positive number that can be written as a normalised floating-point
number in this format.

Mantissa Exponent

[2]

(iii) If a positive number is added to the number in part (b)(i) explain what will happen.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[2]

(c) A student writes a program to output numbers using the following code:

X 0.0
FOR i 0 TO 1000
X X + 0.1
OUTPUT X
ENDFOR

The student is surprised to see that the program outputs the following sequence:

0.0 0.1 0.2 0.2999999 0.3999999

Explain why this output has occurred.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[3]

UCLES 2015 9608/31/O/N/15 [Turn over


Page 2 Mark Scheme Syllabus Paper
Cambridge International A Level October/November 2015 9608 31

1 (a) (i) 00101000 00000011


=0.0101 2 3 [1]
=10.1 [1]
=2.5 [1]

(ii) For a positive number (mantissa starts with a zero) [1]


bit after binary point (second bit from left) should be a one [1]

(iii) 00101000 00000011


= 01010000 00000010 [1+1]

(b) (i) 01111111 0111111 [1+1]

(ii) 01000000 1000000 [1+1]

(iii) number will become too large to represent [1]


which will result in overflow [1]

(c) Any point 1 mark

0.1 cannot be represented exactly in binary


0.1 represented here by a value just less than 0.1
the loop keeps adding this approximate value to counter
until all accumulated small differences become significant enough to be seen
[max 3]

Cambridge International Examinations 2015


2

1 In a particular computer system, real numbers are stored using floating-point representation with:

8 bits for the mantissa, followed by


4 bits for the exponent

Twos complement form is used for both mantissa and exponent.

(a) (i) A real number is stored as the following 12-bit binary pattern:

0 1 1 0 1 0 0 0 0 0 1 1

Calculate the denary value of this number. Show your working.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

(ii) Give the normalised binary pattern for +3.5. Show your working.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

(iii) Give the normalised binary pattern for 3.5. Show your working.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

UCLES 2015 9608/32/O/N/15


3

The number of bits available to represent a real number is increased to 16.

(b) (i) If the system were to use the extra 4 bits for the mantissa, state what the effect would be
on the numbers that can be represented.

...........................................................................................................................................

.......................................................................................................................................[1]

(ii) If the system were to use the extra 4 bits for the exponent instead, state what the effect
would be on the numbers that can be represented.

...........................................................................................................................................

.......................................................................................................................................[1]

(c) A student enters the following expression into an interpreter:

OUTPUT (0.1 + 0.2)

The student is surprised to see the following output:

0.3000000000000001

Explain why this output has occurred.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[3]

UCLES 2015 9608/32/O/N/15 [Turn over


Page 2 Mark Scheme Syllabus Paper
Cambridge International A Level October/November 2015 9608 32

1 (a) (i) 01101000 0011


= 0.1101 (or 1/2 + 1/4 + 1/16) 23 [1+1]
= 110.1
= 6.5 [1]

(ii) +3.5
= 11.1 [1]
= 0.111 22 (or indication of moving binary point correctly) [1]
= 01110000 0010 [1]

(iii) 01110000 Allow f.t. from (ii)


10001111 Ones complement on mantissa [1]
10001111 +1 Twos complement [1]

= 10010000 0010 [1]

(b) (i) Precision/accuracy of numbers represented will increase [1]

(ii) Range of numbers represented will increase [1]

(c) Any point, 1 mark (max. 3)

0.1/0.2 cannot be represented exactly in binary // rounding error [1]


0.1 represented by a value just greater than 0.1 // 0.2 represented by a value
just greater than 0.2 [1]
adding two representations together adds the two differences [1]
summed difference significant enough to be seen [1]
[max. 3]

[Total: 14]

Cambridge International Examinations 2015


Most computer systems need to store and process real numbers.

A computer uses two bytes to store a real number.

The first byte (Byte 7) stores the mantissa. The second byte (Byte 8) stores the exponent.

Both mantissa and exponent use twos complement form.

Byte 7 Byte 8

1 0 1 0 1 0 0 0 0 0 0 0 1 0 1 1

(i) State, without any working out, how you can recognise that this 16-bit pattern (Byte 7
and Byte 8) is a negative number.

...................................................................................................................................... [1]

UCLES 2016 9691/31/M/J/16


11

(ii) State the denary values for the mantissa and the exponent represented by Byte 7 and
Byte 8.

Mantissa ............................................................................................................................

...........................................................................................................................................

Exponent ...........................................................................................................................

...................................................................................................................................... [2]

(iii) Calculate the denary value represented by Byte 7 and Byte 8.

...................................................................................................................................... [1]

(e) State how you can recognise that this 16-bit pattern (Byte 7 and Byte 8) is normalised.

...................................................................................................................................................

.............................................................................................................................................. [1]

(f) Write the binary patterns for the largest and smallest positive number that can be represented
with this 16-bit format for normalised real numbers.

Smallest

Largest

[2]

UCLES 2016 9691/31/M/J/16 [Turn over


Page 5 Mark Scheme Syllabus Paper
Cambridge International AS Level May/June 2016 9691 31

(d) (i) The mantissa starts with a 1 digit [1]

(ii) Mantissa: 1 + 5/16 // 11/16 // 0.6875


Exponent: 11 [2]

(iii) 11/16 * 2^11 // 11 * 2^7 // 1408 [1]

(e) The mantissa starts with 10 // the first two bits of the mantissa are different [1]

(f) Smallest [1]

0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0

Largest [1]

0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1

Cambridge International Examinations 2016

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy