Hi, i've just taken higher computing in college and need to know a couple of things before i can proceed further with the course.

The first is how to represent floating point numbers in binary.

i have a good grasp of binary & data types etc.

there are a few problems in the book i am working on, change these denary numbers into binary using a binary point.

0.25 = 0.01
7.375 = 0111.011
15.53125 = 1111.10001

i understand the process before the point, its after the point i don't get, could someone explain the process?

this lot requires floating point representation using a 16bit mantissa and 8 bit exponent. the process for teh answers is included.

27.5 = 0000 0000 0011 011.1
changed into .1101 1100 0000 0000 * 2 (exp) 0000 0101

134.125 = 0000 0100 0011 0.001
changed into .1000 0110 0010 0000 * 2 (exp) 0000 1000

4200.25 = 0100 0001 1010 00.01
changed into .100 0001 1010 00010 *2 (exp) 0000 1101

i really dont understand the process to get these answer, neither do i understand the difference, ofc one is using an exponent, the other is using a straight representation. is it fractional or what? what is the process?


The second is two's compliment. i can understand signed and unsigned data types, that bit is easy. i just dont understand the process for two's compliment.

could someone help me understand them please? and if its possible could you keep the examples simple while i try to understand?

Thanks.

Recommended Answers

All 3 Replies

> changed into .1101 1100 0000 0000 * 2 (exp) 0000 0101
The first part is a fraction - in this case it's 0.859375
In this FP scheme, all mantissas are >=0.0 and <1.0

Basically, you take the radix point, and move it left one digit at a time, and increment the exponent by 1 as you go. When you reach the left-most 1, you stop.

The second part is the exponent (in this case, it is 5)
Now 2^5 is 32
And 32 * 0.859375 is 27.5

ok i understand floating point representation ie.

8.5 is 0.1000 * 2^ 0100

is that right?


what i dont understand is using the binary point.

ie.

7.375 = 0111.011

how does .011 = .375?

i understand that the numbers before the point are represented

8 4 2 1 like so,

but is there a format for the fractional numbers after the decimal point?

Thanks mate. :)

Just like how before the decimal point, values count for .., 8, 4, 2, 1, to the right of the decimal point, values count for 1/2, 1/4, 1/8, ...

You just keep dividing by two, each digit over.

So 0.011 equals 1/4 + 1/8.

And 0.101 equals 1/2 + 1/8.

And 0.0101010101010101... equals 1/4 + 1/16 + 1/64 + 1/256 + ... which equals 1/3.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.