On 1/17/06, Bob Ippolito <[EMAIL PROTECTED]> wrote:
>
> On Jan 17, 2006, at 3:38 PM, Adam Olsen wrote:
>
> > I dream of a day when str(3.25, base=2) == '11.01'.  That is the
> > number a float really represents.  It would be so much easier to
> > understand why floats behave the way they do if it were possible to
> > print them in binary.
>
> Actually if you wanted something that closely represents what a
> floating point number is then you would want to see this::
>
>         >>> str(3.25, base=2)
>         '1.101e1'
>         >>> str(0.25, base=2)
>         '1.0e-10'
>
> Printing the bits without an exponent is nearly as misleading as
> printing them in decimal.

I disagree.  The exponent is involved in rounding to fit in compact
storage but once that is complete the value can be represented exactly
without it.

--
Adam Olsen, aka Rhamphoryncus
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to