Skip to content
Permalink
Browse files
8271601: Math.floorMod(int, int) and Math.floorMod(long, long) differ…
… in their logic

Reviewed-by: bpb
  • Loading branch information
rgiulietti authored and Brian Burkhalter committed Aug 10, 2021
1 parent 57ae9fb commit 66d1faa7847b645f20ab2e966adf0a523e3ffeb2
Showing 1 changed file with 1 addition and 1 deletion.
@@ -1394,7 +1394,7 @@ public static long floorDiv(long x, long y) {
public static int floorMod(int x, int y) {
int mod = x % y;
// if the signs are different and modulo not zero, adjust result
if ((mod ^ y) < 0 && mod != 0) {
if ((x ^ y) < 0 && mod != 0) {
mod += y;
}
return mod;

1 comment on commit 66d1faa

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 66d1faa Aug 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.