Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Fractional Representation

Author
Message
BlackChaos
16
Years of Service
User Offline
Joined: 2nd May 2010
Location: London
Posted: 10th Oct 2011 22:18
Hey guys, I am a 1st year student studying computer science. I need a bit of help with something called "Fractional Representation" when working with base two(binary).

Does anyone know where I can get a breakdown on what this is. By the way, I have been to all of my lectures and I've spoken to my tutor but I'm still having difficulties. Also I am running out of time because I have got a test on Monday.

bchaos101
BlackChaos
16
Years of Service
User Offline
Joined: 2nd May 2010
Location: London
Posted: 10th Oct 2011 22:19
Sorry for posting this here but I don't know where else to look

bchaos101
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 10th Oct 2011 22:26
A better place to post this probably would have been "Geek Culture".

But if you're talking about how floating point numbers are represented on PCs, check this link here.
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 10th Oct 2011 22:33 Edited at: 10th Oct 2011 22:35
Are you talking about floating point numbers? The wikipedia page on them is pretty good.

If you're talking about numbers like

1.0011

that's
1*2^0 + 0*2^(-1) + 0*2^(-2) + 1*2^(-3) + 1*2^(-4)
=1+1/8+1/16
=1.125 + .0625
=1.125+0.0625
=1.1875

I'm not sure really how to help you with that. Look at how I evaluated it and then go over your notes. Also, if you go to the wiki page (http://en.wikipedia.org/wiki/Binary_numeral_system) and search "fractional binary" (ctrl+f search), then there's an explanation of it.

[edit]
and if it's not that, you have a harder topic on your hands. go to the floating point wiki http://en.wikipedia.org/wiki/Floating_point and learn about the mantissa, exponent, and sign of a floating point number.

BlackChaos
16
Years of Service
User Offline
Joined: 2nd May 2010
Location: London
Posted: 10th Oct 2011 23:26
Yup floating point numbers. Thanks guys, I will check out the links Once again sorry about the irrelevant post.

bchaos101
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 10th Oct 2011 23:34
Years ago before FPU's were widely used (and became faster) I used fixed point precision a lot.

ie using and integer which is 4 bytes long

16 bits (top) = would be the main integer value -32k to +32k
16 bits (low) = would be the precision (anything after the point)

It's probably irrelevant but I'd thought I'd mention it.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 11th Oct 2011 03:16
WLGfx - Did you use a sign bit at all?
zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 11th Oct 2011 11:05 Edited at: 11th Oct 2011 11:20
Quote: "WLGfx - Did you use a sign bit at all? "

I believe that can be inferred given the range is +/- 32k (more precisely 32,767) which would require 15 bits, and then 1 bit left over for the sign bit?


I thought the same as Neuro Fuzzy when I read the post. If so, I think this link helps explain the process. http://cs.furman.edu/digitaldomain/more/ch6/dec_frac_to_bin.htm
or for more background on binary
http://cs.furman.edu/digitaldomain/ and click the 'RESOURCES' tab

Your signature has been erased by a mod please reduce it to 600 x 120.
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 11th Oct 2011 14:42 Edited at: 11th Oct 2011 14:43
They were the good old days of no internet to aid programming and to grab resources. (between 20 and 30 years ago)

Some things I didn't need a sign bit so it made fixed point calcs quicker still, but yes I did use a sign bit too. It wasn't until the 68020 onwards when the FPU got introduced, but still then unsigned fixed point would still be much quicker. It would be a simple case of grabbing the top 16 bits or for larger numbers with less precision it would be an arithmetic shift right on the bits to preserve the sign bit.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
BlackChaos
16
Years of Service
User Offline
Joined: 2nd May 2010
Location: London
Posted: 20th Oct 2011 12:47
Thanks guys sorry for the late reply. Also I was talking about representing signed and unsigned integers in binary and Hex

Its all good now, I've taken my exam and I think I've passed

Login to post a reply

Server time is: 2026-07-10 18:42:23
Your offset time is: 2026-07-10 18:42:23