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

Decimal multiplication loses precision for no good reason

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.1.67, 5.2.14, 5.3.12, 10.1, 10.0, 5.5
    • Fix Version/s: 10.1, 10.0, 5.5
    • Component/s: OTHER
    • Labels:

      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)
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              There are no comments yet on this issue.

                People

                • Assignee:
                  serg Sergei Golubchik
                  Reporter:
                  elenst Elena Stepanova
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated: