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

Decimal multiplication loses precision for no good reason

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.1.67, 5.2.14, 5.3.12, 5.5(EOL), 10.0(EOL), 10.1(EOL)
    • 10.5
    • OTHER

    Description

      MariaDB [test]> select 0.00000000000000000000000001035 * 100000000000000000000000000000000000000000000;
      +---------------------------------------------------------------------------------+
      | 0.00000000000000000000000001035 * 100000000000000000000000000000000000000000000 |
      +---------------------------------------------------------------------------------+
      |                               1000000000000000000.00000000000000000000000000000 |
      +---------------------------------------------------------------------------------+

      Same result on MySQL.
      Both values are within DECIMAL range, so there should be no loss.

      PostgeSQL returns the precise result:

      postgres=# select 0.000000000000000000000000001035 * 100000000000000000000000000000000000000000000000000;
                              ?column?                         
      ---------------------------------------------------------
       103500000000000000000000.000000000000000000000000000000
      (1 row)

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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