Download Binary Real Numbers Conversion

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Irrational number wikipedia , lookup

Approximations of π wikipedia , lookup

Transcript
Binary Real Numbers Conversion
Real numbers are decimal numbers. In programming we often use a Float data type to
represent these.
Real numbers are stored using a sign bit, an exponent section and a mantissa. The way
these work vary from system to system.
Exam method:
In an exam you need to be able to convert from binary to a denary real number and
vice-versa using this method:
Place value
.
1/2
1/4
1/8
1/16
1/32
4s
2s
1s
-
0.5
0.25
0.125
0.0625
0.03125
1
0
1
.
1
1
0
1
0
The numbers before the decimal place act as regular binary numbers with 4s, 2s and 1s.
The numbers after the decimal place start with the ½s, then the ¼s and so on. This allows
you to build up the decimal part of the number by using the fractions.
Build up each part of the number to convert to denary:
•
left side = one 4, no 2, one 1 = 4 + 0 + 1 = 5
•
right side = one half, one quarter, one sixteenth = 0.5 + 0.25 + 0.0625 = 0.8125
•
combine = left side . right side = 5.8125
Questions:
a) Complete the table to show the unshaded place values and then convert the
binary real number shown to denary.
Place value
= 3.75
4s
2s
1s
-
0.5
0.25
0
1
1
.
1
1
0
0
0
b) Complete the table to show the unshaded place values and then convert the
binary real number shown to denary.
Place value
4s
2s
1s
-
0.5
0.25
0.125
0
1
0
.
0
1
1
0
0
0
0
0
= 2.375
c) Convert the binary real number shown below to denary.
1
1
1
.
1
0
= 7.5
Converting to binary real numbers:
To convert from denary to binary simply break the number down into the two parts and
build each of them up using the place values.
•
1.25 is split into 1 and .25
•
1 goes on the left side as 001
•
on the right side, 0.25 is made up of one quarter, so the right side is 01000
Questions:
a) Convert the denary real number 2.5 to binary by completing the table.
0
1
0
.
1
0
0
0
0
b) Convert the denary real number 7.75 to binary by completing the table.
1
1
1
.
1
1
0
0
0
c) Convert the denary real number 2 ⅝ to binary by completing the table.
0
1
0
.
1
0
1
0
d) Convert the denary real number 3.5 to binary using a standard place value
notation with 3 bits before the decimal place.
= 011.1 (you don't need the end 0s)
0