1257 * and the {@code /} operator that returns the integer closest to zero. |
1257 * and the {@code /} operator that returns the integer closest to zero. |
1258 * <p> |
1258 * <p> |
1259 * Examples: |
1259 * Examples: |
1260 * <ul> |
1260 * <ul> |
1261 * <li>If the signs of the arguments are the same, the results |
1261 * <li>If the signs of the arguments are the same, the results |
1262 * of {@code floorMod} and the {@code %} operator are the same. <br> |
1262 * of {@code floorMod} and the {@code %} operator are the same.<br> |
1263 * <ul> |
1263 * <ul> |
1264 * <li>{@code floorMod(4, 3) == 1}; and {@code (4 % 3) == 1}</li> |
1264 * <li>{@code floorMod(+4, +3) == +1}; and {@code (+4 % +3) == +1}</li> |
|
1265 * <li>{@code floorMod(-4, -3) == -1}; and {@code (-4 % -3) == -1}</li> |
1265 * </ul> |
1266 * </ul> |
1266 * <li>If the signs of the arguments are different, the results differ from the {@code %} operator.<br> |
1267 * <li>If the signs of the arguments are different, the results |
1267 * <ul> |
1268 * differ from the {@code %} operator.<br> |
1268 * <li>{@code floorMod(+4, -3) == -2}; and {@code (+4 % -3) == +1} </li> |
1269 * <ul> |
1269 * <li>{@code floorMod(-4, +3) == +2}; and {@code (-4 % +3) == -1} </li> |
1270 * <li>{@code floorMod(+4, -3) == -2}; and {@code (+4 % -3) == +1}</li> |
1270 * <li>{@code floorMod(-4, -3) == -1}; and {@code (-4 % -3) == -1 } </li> |
1271 * <li>{@code floorMod(-4, +3) == +2}; and {@code (-4 % +3) == -1}</li> |
1271 * </ul> |
1272 * </ul> |
1272 * </li> |
1273 * </li> |
1273 * </ul> |
1274 * </ul> |
1274 * <p> |
1275 * <p> |
1275 * If the signs of arguments are unknown and a positive modulus |
1276 * If the signs of arguments are unknown and a positive modulus |
1276 * is needed it can be computed as {@code (floorMod(x, y) + abs(y)) % abs(y)}. |
1277 * is needed it can be computed as {@code (floorMod(x, y) + abs(y)) % abs(y)}. |