Open
Description
All arithmetic operations can be perform in four ways: scalar-scalar, series-scalar, scalar-series, and series-series.
Except for the division. It is implemented in a way that expects a number:
/ aNumber
"Primitive. This primitive (for /) divides the receiver by the argument
and returns the result if the division is exact. Fail if the result is not a
whole integer. Fail if the argument is 0 or is not a SmallInteger. Optional.
No Lookup. See Object documentation whatIsAPrimitive."
<primitive: 10>
aNumber isZero ifTrue: [^(ZeroDivide dividend: self) signal].
^(aNumber isMemberOf: SmallInteger)
ifTrue: [(Fraction numerator: self denominator: aNumber) reduced]
ifFalse: [super / aNumber]
As a result, these are valid:
2 * series.
3 + series.
4 - series.
But this raises an exception that series does not understand isZero:
1 / series.