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

select max(float) returns the wrong float

    XMLWordPrintable

    Details

      Description

      Selecting the max of a float value does something wonky with the precision of the value. I can't make sense of the below example.

      {{MariaDB [imdb_small]> drop table example;
      Query OK, 0 rows affected (0.006 sec)

      MariaDB [imdb_small]> create table example (a float);
      Query OK, 0 rows affected (0.009 sec)

      MariaDB [imdb_small]> insert into example values (8.7);
      Query OK, 1 row affected (0.002 sec)

      MariaDB [imdb_small]> select max(a) from example;
      -------------------

      max(a)

      -------------------

      8.699999809265137

      -------------------
      1 row in set (0.000 sec)

      MariaDB [imdb_small]> select a from example;
      ------

      a

      ------

      8.7

      ------
      1 row in set (0.000 sec)

      MariaDB [imdb_small]> select * from example where a = 8.7;
      Empty set (0.000 sec)}}

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            sacrophyte C S
            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.