MedVision ad

Do we actually have to do floating pointin the Exam? (1 Viewer)

whitey9999

New Member
Joined
Aug 14, 2007
Messages
26
Gender
Male
HSC
N/A
Since the SDD exam doesnt allow calculators do we actually have to do floating point to decimal conversions. If so can someone teach me an easier way than adding fractions with denominators up to like 2^23

Has anyone seen a Floating point in a past exam? either conversion to or from? (i havent looked yet)
 

Graceofgod

Member
Joined
Feb 17, 2008
Messages
136
Location
Now? A computer.
Gender
Undisclosed
HSC
2008
whitey9999 said:
Since the SDD exam doesnt allow calculators do we actually have to do floating point to decimal conversions. If so can someone teach me an easier way than adding fractions with denominators up to like 2^23

Has anyone seen a Floating point in a past exam? either conversion to or from? (i havent looked yet)
Well, I have no idea about whether they are in past papers. Simply because I am too lazy to do SDD past papers.
However, I will try and remember/teach how to do this easily :)

Decimal to floating point

Ok, lets take the decimal 564.725

First, we work to the left of the decimal place;
564 = 512 + 32 + 16 + 4 = 1000110100

Now, for the right of the decimal place, my teacher taught me a little trick:
You keep doubling the decimal place and ignoring the first digit.
What you end up with is the binary representation for the part to the right of the decimal place.
...725
1.450
0.9
1.8
1.6
1.2
0.4
0.8
1.6
1.2
0.4
0.8
etc
As you can see it has started recurring.
So for the part after the decimal place we get:
.1011100110011001100110011 etc

Adding this with the part to the left of the decimal place we get:
1000110100.1011100110011001100110011

Now the sign bit is 0 as the number is positive.
Counting for exponent gives us 9
Now the exponent in binary = 9 + 127 (you add 127 to positive exponent) = 128 + 8 = 10001000

Now we have all we need, remember, you ignore the starting 1 in the mantissa:
0 (sign bit) 10001000 (exponent) 00011010010111001100110 (mantissa)
Total of 32 bits, 1 sign bit, 8 exponent, 23 mantissa.

And thats it, your done:
01000100000011010010111001100110

Hope that helps :)

Converting back can be a pain, simple, but a pain. Doubt you will be asked that in an exam, even more than I doubt you will be asked this =S

Just read your post, you asked for the other way, hmmm. Woops oh well, might help someone else. The only thing I can say is that after about 8 decimal places you have got a pretty good idea of what the decimal will be.

Floating point to decimal

0 10001000 00011010010111001100110
Using the answer from above:
Positive from sign bit (0)
10001000 = 128 + 8 = 127 + 9
Therefore exponent = 9

Applying this to our mantissa (don't forget to add the extra 1 to the front):
1000110100.10111001100110
Now: 1000110100 = 512 + 32 + 16 + 4 = 564

Now for after the decimal place:
= .5 + .125 + 0.0625 + 0.03125 + .... = 0.71875
Hmmm. This is going to get crap. I would honestly just stop there and say the answer is 564.72
Which is close enough.. :p
If they did ask it in an exam, it wouldn't have anywhere near this many decimal places. They would probably try and use maybe a 2-3 byte floating point or something and an easy number like 564.25

Well that was a good and hopeless waste of time :)
 
Last edited:

whitey9999

New Member
Joined
Aug 14, 2007
Messages
26
Gender
Male
HSC
N/A
Yeh im good for converting decimal to floating point, thats simple and could be done without a calculator... but converting the other way sucks and yeh id leave it rounded to one dp lol

I hope neither is in the exam to be honest but i wouldnt be surprised if a decimal to floating would be in there
 

gingyangel

New Member
Joined
Mar 13, 2008
Messages
18
Gender
Female
HSC
2008
whitey9999 said:
Yeh im good for converting decimal to floating point, thats simple and could be done without a calculator... but converting the other way sucks and yeh id leave it rounded to one dp lol

I hope neither is in the exam to be honest but i wouldnt be surprised if a decimal to floating would be in there
i look at few past papers and there are only few or even none floating point questions in it
probably it's too bothersome? so they don't put it in
on the other hand there might be a chance.

we were allow to bring calculators for internal assessment, but it's much more helpful if we can bring them in.

also i have a question, how do we determine the sign from the binary? i get the pos = 0 and neg = 1 but how do i know that from the binary?
 

Graceofgod

Member
Joined
Feb 17, 2008
Messages
136
Location
Now? A computer.
Gender
Undisclosed
HSC
2008
gingyangel said:
i look at few past papers and there are only few or even none floating point questions in it
probably it's too bothersome? so they don't put it in
on the other hand there might be a chance.

we were allow to bring calculators for internal assessment, but it's much more helpful if we can bring them in.

also i have a question, how do we determine the sign from the binary? i get the pos = 0 and neg = 1 but how do i know that from the binary?
Well if you are talking about floating point, the first bit is the sign. As you said positive = 0, negative = 1.
This is the same for two's complement.

Sorry, I'm not quite sure what you mean. Please be more specific as to what you mean by 'binary' if I haven't answered your question.
 

gingyangel

New Member
Joined
Mar 13, 2008
Messages
18
Gender
Female
HSC
2008
Graceofgod said:
Well if you are talking about floating point, the first bit is the sign. As you said positive = 0, negative = 1.
This is the same for two's complement.

Sorry, I'm not quite sure what you mean. Please be more specific as to what you mean by 'binary' if I haven't answered your question.
i think i get it now, but i'm not sure if it's right
if you look at the 2007 paper Q25 a)ii) it said evaluate the following 8 bit two's complement expression which is 11111101 x 00001111
so is 11111101 a negative number and 00001111 is a positive number?
 
Last edited:

Graceofgod

Member
Joined
Feb 17, 2008
Messages
136
Location
Now? A computer.
Gender
Undisclosed
HSC
2008
gingyangel said:
i think i get it now, but i'm not sure if it's right
if you look at the 2007 paper Q25 a)ii) it said evaluate the following 8 bit two's complement expression which is 11111101 x 00001111
so is 11111101 a negative number and 00001111 is a positive number?
Yes. I will even do it for you because I am bored :)

This is a particularly tricky one =S
The best way I can think to do it is as follows:
11111101 = -00000011 = -3
00001111 = 15
Performing this multiplication in binary is hell..
So I suggest changing it to 3 x -15
ie 00000011 x 11110001
or:
....11110001x
....00000011
....11110001
..111100010
1011010011

Taking the first 8 bits:
11010011
= - 00101101
= -45

If you had to do this all in binary. You would end up having to add 4 numbers together. Resulting in carries > 1
The best way to deal with this would be to divide it up into multiple additions (unless anyone else has a better idea)
ie:

11111101x
00001111

Dividing this up into 2 multiplications:

..11111101x
..00000011
..11111101
111111010
..11110111 (only worry about first 8 bits)

.......11111101x
.......00001100
..1111110100
11111101000
.......11011100 (first 8 bits)

Then add these 2 together:
11110111+
11011100
11010011 (first 8 bits)

= - 00101101
= -45

However, that is a massive amount of maths. I think the simplest way, and perhaps the way they are asking is just to convert, multiply, convert.
i.e.
11111101 = -3
00001111 = 15
-3 x 15 = -45 = - 00101101 = 11010011
 
Last edited:

gingyangel

New Member
Joined
Mar 13, 2008
Messages
18
Gender
Female
HSC
2008
Graceofgod said:
Yes. I will even do it for you because I am bored :)

This is a particularly tricky one =S
The best way I can think to do it is as follows:
11111101 = -00000011 = -3
00001111 = 15
Performing this multiplication in binary is hell..
So I suggest changing it to 3 x -15
ie 00000011 x 11110001
or:
....11110001x
....00000011
....11110001
..111100010
1011010011

Taking the first 8 bits:
11010011
= - 00101101
= -45

If you had to do this all in binary. You would end up having to add 4 numbers together. Resulting in carries > 1
The best way to deal with this would be to divide it up into multiple additions (unless anyone else has a better idea)
ie:

11111101x
00001111

Dividing this up into 2 multiplications:

..11111101x
..00000011
..11111101
111111010
..11110111 (only worry about first 8 bits)

.......11111101x
.......00001100
..1111110100
11111101000
.......11011100 (first 8 bits)

Then add these 2 together:
11110111+
11011100
11010011 (first 8 bits)

= - 00101101
= -45

However, that is a massive amount of maths. I think the simplest way, and perhaps the way they are asking is just to convert, multiply, convert.
i.e.
11111101 = -3
00001111 = 15
-3 x 15 = -45 = - 00101101 = 11010011
thank you! you're very helpful
 

vandretta

New Member
Joined
Jan 8, 2008
Messages
10
Gender
Male
HSC
2009
Simple answer: Yes.

They are generally worth more than 1-2 marks though.

Good Luck :D
 

kruznpinoy

New Member
Joined
Sep 15, 2008
Messages
1
Gender
Male
HSC
2009
So does the multiplication only work for numbers that multiply up to 127 or -128?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top