off topic but please forgive me me and answer
Dave Angel
davea at ieee.org
Fri Apr 2 18:11:32 EDT 2010
Mensanator wrote:
> On Apr 1, 9:44 pm, Steven D'Aprano <st... at REMOVE-THIS-
> cybersource.com.au> wrote:
>
>> <snip>
>>>>> 1/2.0
>>>>>
>> 0.25
>>
>> If you want an exact result when multiplying arbitrary fractions, you
>> need to avoid floats and decimals and use Fractions:
>>
>>
>>>>> Fraction(1, 2)**2
>>>>>
>> Fraction(1, 4)
>>
>
> Where do you get that from?
>
>
In Python2.6,
from fractions import Fraction
And Fraction is now a class which supports fractional arithmetic.
More information about the Python-list
mailing list