floating point in 2.0

Chris Barker chrishbarker at home.net
Thu Jun 7 14:45:44 EDT 2001


Helen Dawson wrote:
> Remember that floating point has a mantissa and an *exponent*. So, if I
> have a binary floating point format with a one bit mantissa and an eight

Thank you, I had not considered that. Your example helped me sort it
out.


> > interestingly enough, If you try to diplay more, you get:
> > >>> '%.70f' % 0.1
> > '0.1000000000000000055511151231257827021181583404541015625000000000000000'
> >
> > now the extra is all zeros.

I now know the answer to that. From the Library Reference:

"For safety reasons, floating point precisions are clipped to 50;"

And the corresponding footnote:

"These numbers are fairly arbitrary. They are intended to avoid printing
endless strings of meaningless digits without hampering correct use and
without having to know the exact precision of floating point values on a
particular machine."


-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at home.net                 ---           ---           ---
http://members.home.net/barkerlohmann ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------



More information about the Python-list mailing list