Fraction hackers...
Leandro Caniglia
caniglia at dm.uba.ar
Fri Sep 10 02:22:47 UTC 1999
Florin suggested
>Fraction>>reduced
>
> | gcd |
> numerator = 0 ifTrue: [^0].
> (gcd _ numerator gcd: denominator) == denominator ifTrue:
>[^numerator // gcd].
> gcd == 1 ifFalse: [
> numerator _ numerator // gcd.
> denominator _ denominator // gcd]
Is it right the first use of == here? In the case of LargeIntegers one
could have gcd = denominator but ~~ denominator.
Leandro
More information about the Squeak-dev
mailing list
|