Using fractions instead of floats

richyjsm at gmail.com richyjsm at gmail.com
Mon Oct 1 21:17:03 EDT 2007


On Oct 1, 9:03 pm, "mensana... at aol.com" <mensana... at aol.com> wrote:
> On Oct 1, 7:20 pm, richy... at gmail.com wrote:
>
> > On Oct 1, 8:30 am, Nick Craig-Wood <n... at craig-wood.com> wrote:
>
> > >   >>> mpq(1,3)+0.6
> > >   mpq(14,15)
>
> > Golly!  That's quite impressive.  And more than a little bit magic as
> > well, since 0.6 is definitely not the same as 3/5.  
>
> It's not? Since when?

The 0.6 above is a floating point number, mathematically very close to
0.6 but definitely not equal to it, since 0.6 can't be represented
exactly as a float.




More information about the Python-list mailing list