Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Explain floating point to me

Name: Anonymous 2006-04-30 0:54

I understand how signed and unsigned binary arithmetic works (the sign bit, carry, and all that good stuff), and how one would get the ASCII output from it.

I need help in understanding how one takes the bytes from the binary representation of a floating point number or register, and how one can get the ASCII from it.

Name: Anonymous 2006-04-30 1:21

Question is too vague.  What exactly are you trying to do?  "Get the ASCII from it" can mean anything.

Name: Anonymous 2006-04-30 3:38

Floating point is actually more complicated than most would think.  Or at least, I thought so when I learned how to do it in binary for the first time. You should be able to google it up though and get tons of sites explaining it.

Name: Anonymous 2006-04-30 5:35

>>1
Yeah, I can crank a shitty explanation for you but you will find far better stuff in Google or Wikipedia.

Just so you have a general idea of what's it about, it's made of a sign bit, many mantissa bits (actual number data, works like unsigned integers) and exponent. Numbers are stored like e.g. Positive, 1425387, multiplied by 2 to the power of 12, so to speak.

Name: Anonymous 2006-04-30 10:19

Basically, what >>4 is trying to say is that your float numbers are stored as integers, plus another integer that says where to put the decimal point, except it's not a decimal point because it's in binary.

Name: Anonymous 2006-04-30 12:53

It's easy, it's a point... that floating.

Name: Anonymous 2006-04-30 14:34

>>6
unless you're using integers as fixed-point floats.

Name: Anonymous 2006-04-30 14:34 (sage)

>>3
most? speak for yourself, floats are easy to understand

Name: Anonymous 2006-04-30 18:26

>>5
Yeah, I failed my explanation, it was only understandable by people who already knew it ._.

>>7
Fixed point is not floating point

Name: Anonymous 2006-05-01 2:17

I read some stuff on Wikipedia and I think I get the basics as far as representation goes.

So, taking the bytes that make up two floats, how can I add/subtract them?  Multiplying/dividing is as easy as adding/subtracting exponents, right?

Name: Boring person 2006-05-01 3:06

>>10
It's not well discussed because floating point aritmetic is usualy embeded in the processors (not so usual on mobile phones and stuff like that).
Basicaly the big bitch in the floating point are these http://en.wikipedia.org/wiki/IEEE_floating-point_standard
the IEEE standard. So as it says:
 1  e bits     f bits      Width of field
+-+--------+-------------+
|S|  Exp   |  Fraction   |
+-+--------+-------------+
 e+f                    0  Bit index
As usual you have bit signal in S, the Exp and Fraction part varies in size from 32 to 64 bit standards. So to get the floating point rep:
1. take the signal
2. convert to binary with the point
3. (normalize) make point go to the leftmost bit, and keep the number of places moved.
So, far we got the signal, the number with the point in a convinient place, and the movement of the point necessary to recover the number.
4. The number is the Exp, and the other is the Fraction or mantissa, that has to be converted because it can be negative.

This document (linked from wikipedia page) http://www.opencores.org/projects.cgi/web/fpu100/fpu_doc.pdf gives a deep insight on this and ARITHMETIC and it's algorithms.
It's not something that is usualy learned in schools, it's algorithms for reference. So I will not explain them to you.

Name: Anonymous 2007-09-13 23:34 ID:Heaven

[o];3[/o]

Name: Anonymous 2007-09-13 23:36 ID:Heaven

;33

Name: Anonymous 2010-06-07 6:38

Hi, I can spam /prog/ too, you faggot.

Also, smoke weed everyday.

Name: Anonymous 2012-03-11 22:59

resurrecting !

Name: Anonymous 2012-03-11 23:00

>>15
fuck off and die, ``faggot''

Name: Anonymous 2012-03-11 23:27

the points are floating around.
all of these numbers aren't real

Don't change these.
Name: Email:
Entire Thread Thread List