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

incorrect result for rounding float and double value

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 10.6.10
    • N/A
    • Data types
    • None

    Description

      When we use round function on float or double not working correctly

      SELECT ROUND(CAST(118.5 AS FLOAT)),ROUND(CAST(118.5 AS double)) ,ROUND(118.5 )

      MariaDB [(none)]> SELECT ROUND(CAST(118.5 AS FLOAT)),ROUND(CAST(118.5 AS double)) , ROUND(118.5 );
      +-----------------------------+------------------------------+---------------+
      | ROUND(CAST(118.5 AS FLOAT)) | ROUND(CAST(118.5 AS double)) | ROUND(118.5 ) |
      +-----------------------------+------------------------------+---------------+
      |                         118 |                          118 |           119 |
      +-----------------------------+------------------------------+---------------+
      
      

      119 is the correct value.

      Attachments

        Activity

          People

            serg Sergei Golubchik
            bulepage bulepage
            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.