Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-30547

Problems when mod , division function and extremum function are used together

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Duplicate
    • 10.9.4
    • N/A
    • Data types
    • None
    • mariadb docker

    Description

      We found that problems also occur when we use the mod function, the division function and two extremal functions together

      select least('0'/-4,0/-4); – -0
      select greatest('0'/-4,0/-4); – 0
      select least(mod('-12',-4),mod(-12,-4)); – -0
      select Greatest(mod('-12',-4),mod(-12,-4)); – 0

      We tested the following two use cases
      select mod('-12',-4) = mod(-12,-4); – 1
      select '0'/-4 = 0/4; – 1

      These two use cases prove that the two calculation results are equal. We hope that the extreme value function can give the same result, because the operation process of these two extreme value functions should also be the ultimate result of the comparison operator.
      Although the result of the internal mod function or division function is incorrect, we think that the extreme value function should eliminate the influence of the negative number representation and give the correct answer.

      MySQL has verified this as a bug. please see https://bugs.mysql.com/bug.php?id=109842. so I consider it also a bug for mariadb.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              undefined 王瑞丰
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.