int.modulo/int.remainder/% confusion #4949
jrunning
started this conversation in
Ideas & suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I was surprised to find that
int.modulo
returns different output than the%
operator, until I noticed thatgleam/int
also definesint.remainder
.Fair enough; I had forgotten this. However, the docs for both
int.modulo
andint.remainder
say:This is a little confusing, since only
int.remainder
has the same behavior as%
. I think the docs could spend a few more words on the distinction between these two operations, especially since%
behaves differently than it does in many programming languages.Beta Was this translation helpful? Give feedback.
All reactions