Squeak Version 2.2 released (division again)
Christopher Oliver
oliver at fritz.traverse.net
Fri Sep 25 10:05:48 UTC 1998
I see that the division of a LargePositiveIntegers is now fixed, but
the problem of evaluating (SmallInteger MinVal) quo: -1 remains. Will
anyone comment on the following substitution for Smallinteger>>quo:?
!SmallInteger methodsFor: 'arithmetic' stamp: 'cao 9/8/1998 13:02'!
quo: aNumber
"Primitive. Divide the receiver by the argument and answer with the
result. Round the result down towards zero to make it a whole integer.
Fail if the argument is 0 or is not a SmallInteger. Optional. See Object
documentation whatIsAPrimitive."
<primitive: 13>
aNumber = 0 ifTrue: [^self error: 'Attempt to divide by zero'].
(aNumber class == SmallInteger)
ifTrue: [^ SmallInteger minVal abs]
ifFalse: [^super quo: aNumber]! !
--
Christopher Oliver Traverse Internet
Systems Coordinator 223 Grandview Pkwy, Suite 108
oliver at traverse.net Traverse City, Michigan, 49684
"What good is a can of worms if you never open it?" -Bob Arning
More information about the Squeak-dev
mailing list
|