Re: Confused about Floating Point format

From: Scott Moore (spamtrap_at_crayne.org)
Date: 09/08/04


Date: Wed, 8 Sep 2004 07:19:07 +0000 (UTC)

encryption_x wrote:

> The "Art of Assembly" book (sec. 4.2) describes that binary strings
> that represent floating point numbers practically always have a
> mantisa that has a H.O. bit of "1" and thus normalized, but then it
> goes on to mention that if it isnt normalized then you should
> left-shift the mantisa. This doesn't compute to me, can anyone help?
> 'Preciate it.
>

Normalization means to move the mantissa until it is "correct", by
shifting it and changing the exponent to reflect the shift. For most
implementations, that means getting rid of the leading zeros. It also
preserves accuracy. If you have a 64 bit accumulator, and you are going
to reduce down to a 32 bit format, if you don't get rid of the leading
zeros, you will lose digits off the right end.

Now, long ago, someone with excess cleverness noticed that if you
normalize numbers, you are either always going to have the leftmost
digit (bit) a '1', or else the entire mantissa is going to be zero.
So said clever programmer decided that if you shift off that top bit,
you don't really need it ! If the mantissa is all zeros, there was
no leading bit, otherwise, you can always assume the missing bit
was a '1'. Thus, the clever programmer saved a single bit in the
format, and probally retired rich somewhere.

-- 
Samiam is Scott A. Moore
Personal web site: http:/www.moorecad.com/scott
My electronics engineering consulting site: http://www.moorecad.com
ISO 7185 Standard Pascal web site: http://www.moorecad.com/standardpascal
Classic Basic Games web site: http://www.moorecad.com/classicbasic
The IP Pascal web site, a high performance, highly portable ISO 7185 Pascal
compiler system: http://www.moorecad.com/ippas
Being right is more powerfull than large corporations or governments.
The right argument may not be pervasive, but the facts eventually are.


Relevant Pages

  • Re: floating point mantissa?
    ... optimized normalization, denormalization methods. ... > IMHO 146 cycles just for a normalization of a single floating point number ... shift the mantissa left a bit (and decrement the exponent) ...
    (microsoft.public.vc.language)
  • Re: Is there a switch that will show no dollar sign if theres no data?
    ... Word MVP web site http://word.mvps.org ... > nothing in the table cell when no data is being merged? ... > avoid showing zeros or zeros with $ signs if I can). ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Wipe a Drive - Destroy the Data on Boot Drive
    ... download the floppies from your hard drive manufacturer's web site and use them to write zeros on the disk. ...
    (microsoft.public.windowsxp.general)
  • Re: whole number constants
    ... by appending binary zeros. ... normalization. ... As with conversion, it is usual to shift in zeros. ...
    (comp.lang.fortran)
  • Re: leading zeros
    ... or if you always want four zeros regardless of the page numbers put the ... Word MVP web site http://word.mvps.org ...
    (microsoft.public.word.pagelayout)