Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue: Difference between the operator % of Motoko and Smalltalk #4823

Open
crusso opened this issue Dec 13, 2024 · 0 comments
Open

issue: Difference between the operator % of Motoko and Smalltalk #4823

crusso opened this issue Dec 13, 2024 · 0 comments

Comments

@crusso
Copy link
Contributor

crusso commented Dec 13, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant