From 7432a5fcd64b8a2898e21bdd3efaa7bc986bf284 Mon Sep 17 00:00:00 2001 From: Mikko Tommila Date: Sun, 28 Jan 2024 00:48:45 +0200 Subject: [PATCH] Fix mod math test --- .../template/org/apfloat/internal/RawtypeModMathTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apfloat/src/test/template/org/apfloat/internal/RawtypeModMathTest.java b/apfloat/src/test/template/org/apfloat/internal/RawtypeModMathTest.java index 5fc42c7..614303b 100644 --- a/apfloat/src/test/template/org/apfloat/internal/RawtypeModMathTest.java +++ b/apfloat/src/test/template/org/apfloat/internal/RawtypeModMathTest.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2002-2023 Mikko Tommila + * Copyright (c) 2002-2024 Mikko Tommila * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -28,7 +28,7 @@ import junit.framework.TestSuite; /** - * @version 1.0.1 + * @version 1.13.0 * @author Mikko Tommila */ @@ -114,7 +114,7 @@ public static void testInverse() for (int i = 0; i < 1000; i++) { - x = Math.abs(random.nextLong()) % lm; + x = Math.abs(random.nextLong()) % (lm - 1) + 1; assertEquals(x + " ^ -1 % " + lm, 1L, (long) math.modMultiply(math.modInverse((rawtype) x), (rawtype) x)); } @@ -159,7 +159,7 @@ public static void testDivide() for (int i = 0; i < 1000; i++) { x = Math.abs(random.nextLong()) % lm; - y = Math.abs(random.nextLong()) % lm; + y = Math.abs(random.nextLong()) % (lm - 1) + 1; assertEquals(x + " / " + y + " % " + lm, x, (long) math.modMultiply(math.modDivide((rawtype) x, (rawtype) y), (rawtype) y)); }