You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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: [^(ZeroDividedividend:self) signal].
^(aNumber isMemberOf:SmallInteger)
ifTrue: [(Fractionnumerator:selfdenominator: 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:
Activity
olekscode commentedon Apr 1, 2019
I wrote a test for it:
But I can't think of any way to elegantly fix it (without too many hacks), so I leave this issue for the future