Re: A92: Floating-point Support


[Prev][Next][Index][Thread]

Re: A92: Floating-point Support



On Sun, 8 Feb 1998, Aaron A. Hill wrote:

> >why don't you just use the IEEE 754 standard floating point
> >representation?  It's what's used for short floating points on PCs.  I'll
> >upload and explanation of how to use it if anyone's interested.
> 
> If you could, please send me the info.  That would help a lot.  It looks
> like you know what you are doing.  Would you like to help?

I suppose I could. what would you need?  For any one that's interested, I
attached a copy of a float point example using IEEE 754.  Any questions,
give me a buzz.

Jonathan Dickmann
-----
jdickman@rhf.bradley.edu		http://rhf.bradley.edu/~jdickman
-----
I used to think that life wouldn't be exciting if I didn't keep busy
but I've since decided that life would be SANE if I didn't keep busy
and there's NO way I could stand THAT.   -- Jonathan Dickmann


2) floating point 



     the location of the binary point stored separately; the number m * 2e where m is a normalized mantissa, and e is the exponent; m and e are stored using two

     distinct fields; 



     to define a floating point representation, one must further designate: 

          # of bits n (# of words) 

          representation of mantissa (e.g., two's complement) 

          representation of exponent (e.g., biased) 

          distribution of n bits to mantissa and exponent 

          relative positions of mantissa and exponent 



     Example  IEEE 754 floating point representation (used for short floating point on PC's) 

     32 bits representation, having its mantissa stored in sign- magnitude notation and its exponent stored in bias127 notation 

          b31 b30 b29 ... b2 b1 b0 where: 

          b31 (1 bit) represents the sign of the mantissa 

          b30 - b23 (8 bits) represent the exponent, and 

          b22 - b0 (23 bits) represent the magnitude of the mantissa, less one

     i.e., number represented is: (-1)s * (1 + mag) * 2(exp-127) 



     e.g., Convert the IEEE 754 floating point representation: 

     1 00101101 1011 0111 00...00 to decimal 

     mantissa = -1*(1+1/2+1/8+1/16+1/64+1/128+1/256)  = -1.71484375 

     exponent = (25 + 23 + 22 + 20) - 127 = 45 - 127 = -82 

     decimal number is: -1.71484375 * 2-82 



     e.g., Convert the decimal number -47.3 to IEEE 754 floating point representation 

     4710 = 1011112 

     0.310 = 0.0100110011001...2 

     Normalizing the mantissa we get 

     101111.0100110011001... = 1.01111010011001...*25 

     In excess 127, 5 is represented by 127+5 = 132 which is 100001002 

     Therefore, the floating point representation is: 

     1 10000100 01111010011001100110011 

References: