Using fractions instead of floats
mensanator at aol.com
mensanator at aol.com
Mon Oct 1 21:03:18 EDT 2007
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?
>>> print gmpy.mpq('0.6')
3/5
> How on earth does this work?
The rationals are always reduced to lowest terms.
>
> Richard
More information about the Python-list
mailing list