#Modulo keyword
11 messages · Page 1 of 1 (latest)
Hey, @next lynx!
Please remember to /close this post once your question has been answered!
i think at the end it perform division so should be like
dividend % divisor = reminder
not sure through
Here is the official terminology from the Java spec: https://docs.oracle.com/javase/specs/jls/se17/html/jls-15.html#jls-15.17.3
So yes, a "dividend" and "divisor" yield the "remainder" (careful, this differs from modulo for negative numbers)
what about negative
For example, the remainder operator can give you negative results for a negative dividend and positive divisor: https://stackoverflow.com/a/37240042/3754304
If you want "true" mathematical modulo in Java, you have to do that yourself, there is no dedicated operator
ah right