KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Ruby modulo 3 with negative numbers is unintuitive
Asked 2013-04-18T03:23:21.397
▲
9
▼
Ruby modulo rules with negative numbers are unclear. In IRB:
-7 % 3 == 2
Should be
1
! Why?
ruby
modulo
Copy Link
Twitter
Facebook
LinkedIn
Share
Edit
Save
Report
Add comment
0 Answers
Your Answer
Post Your Answer