--- a/Fraction.st Thu Aug 21 14:10:36 2003 +0200
+++ b/Fraction.st Thu Aug 21 14:30:19 2003 +0200
@@ -700,7 +700,10 @@
!
equalFromFraction:aFraction
- denominator = aFraction denominator ifFalse:[^ false].
+ denominator = aFraction denominator ifFalse:[
+ ^ false " must always be reduced "
+ "/ ^ (numerator * aFraction denominator) = (aFraction numerator * denominator)
+ ].
^ numerator = aFraction numerator
!
@@ -711,8 +714,15 @@
However, it is here for subclasses and to allow comparing unnormalized fractions,
which might be encountered internally"
- denominator = 1 ifFalse:[^ false].
+ denominator = 1 ifFalse:[
+ ^ numerator = (anInteger * denominator)
+ ].
^ numerator = anInteger
+
+ "
+ 1 = (1 asFixedPoint:1)
+ (1 asFixedPoint:1) = 1
+ "
!
lessFromFraction:aFraction
@@ -1084,7 +1094,7 @@
!Fraction class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Fraction.st,v 1.66 2003-06-21 10:33:03 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Fraction.st,v 1.67 2003-08-21 12:30:19 cg Exp $'
! !
Fraction initialize!