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
I’m porting Smalltalk to Motoko and I’ve found a semantic difference between Motoko’s % operator and the same % operator in Smalltalk. For Motoko’s % operator to return the same result as Smalltalk’s it should, for integers, return a % b = a - (if (a/b > 0) a / b else a/b - 1) * b and for Floats a % b = a - Float.floor(a/b)*b. It seems to me that the definition in Smalltalk is more consistent and coherent than Motoko’s.
I’m porting Smalltalk to Motoko and I’ve found a semantic difference between Motoko’s % operator and the same % operator in Smalltalk. For Motoko’s % operator to return the same result as Smalltalk’s it should, for integers, return a % b = a - (if (a/b > 0) a / b else a/b - 1) * b and for Floats a % b = a - Float.floor(a/b)*b. It seems to me that the definition in Smalltalk is more consistent and coherent than Motoko’s.
https://forum.dfinity.org/t/difference-between-the-operator-of-motoko-and-smalltalk/38822/1
The text was updated successfully, but these errors were encountered: