[Bug][Fix] For Fraction>>=

Dwight Hughes dwighth at ipa.net
Fri Jul 30 19:48:10 UTC 1999


A couple of days ago it was noted on c.l.s that 

(Fraction numerator: 3 denominator: 6) = (1/2) --> false

in Squeak and some other Smalltalks (VW3.0 also returns false, but
Dolphin 2.1 returns true), so to support the goal that Squeak always do
the "right thing" with numbers, I offer the attached fix.

-- Dwight
'From Squeak 2.4c of May 10, 1999 on 30 July 1999 at 2:33:20 pm'!

!Fraction methodsFor: 'comparing' stamp: 'dwh 7/30/1999 14:26'!
= aNumber
	aNumber isNumber ifFalse: [^ false].
	^ (self - aNumber asFraction) isZero
! !

!Fraction methodsFor: 'comparing' stamp: 'dwh 7/30/1999 14:18'!
isZero
	^ numerator = 0! !


!Integer methodsFor: 'comparing' stamp: 'dwh 7/30/1999 14:18'!
isZero
	^ self = 0! !





More information about the Squeak-dev mailing list