int.modulo/int.remainder/% confusion #4949
                  
                    
                      jrunning
                    
                  
                
                  started this conversation in
                Ideas & suggestions
              
            Replies: 1 comment
-
| 
         During my research back then I found Gleam's behaviour to not only be in line with what Erlang does (though there named   | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    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.moduloreturns different output than the%operator, until I noticed thatgleam/intalso definesint.remainder.Fair enough; I had forgotten this. However, the docs for both
int.moduloandint.remaindersay:This is a little confusing, since only
int.remainderhas 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