Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-135431

Scoreboard division is inconsistent with modulo

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: Minecraft 18w31a
    • Fix Version/s: Minecraft 18w32a
    • Labels:
      None
    • Confirmation Status:
      Unconfirmed

      Description

      In 18w31a, the %= operation was changed to use Java's Math.floorMod instead of %. However, the /= operation still uses Java's / instead of Math.floorDiv, which is inconsistent.

      To reproduce:

      Create a new world:

      Run the following commands:

      /scoreboard objectives add test dummy
      /scoreboard objectives setdisplay sidebar test
      /scoreboard players set n test 3
      /scoreboard players set a test -5
      /scoreboard players set q test -5
      /scoreboard players set r test -5
      /scoreboard players operation q test /= n test
      /scoreboard players operation r test %= n test
      

      With a consistent division algorithm, a = n*q + r, but this is not the case here.

        Attachments

          Activity

            People

            • Assignee:
              boq [Mojang] Bartosz Bok
              Reporter:
              elyg Ely G
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: