Details
Description
I'm not sure this is a bug or not, because there is no such configuration like auto round points.
I thought it connect to div_precision_increment. but seems not
all test configuration is same
MariaDB [(none)]> show variables like '%prec%';
|
+-------------------------+-------+
|
| Variable_name | Value |
|
+-------------------------+-------+
|
| div_precision_increment | 4 |
|
+-------------------------+-------+
|
MariaDB 10.3.24 && 10.4.14
MariaDB [(none)]> select (55/23244*1000);
|
+-----------------+
|
| (55/23244*1000) |
|
+-----------------+
|
| 2.4000 |
|
+-----------------+
|
|
select cast( (55/23244*1000) as decimal(5,4));
|
+----------------------------------------+
|
| cast( (55/23244*1000) as decimal(5,4)) |
|
+----------------------------------------+
|
| 2.4000 |
|
+----------------------------------------+
|
|
MariaDB [(none)]> set div_precision_increment=8;
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [(none)]> select cast( (55/23244*1000) as decimal(5,4));
|
+----------------------------------------+
|
| cast( (55/23244*1000) as decimal(5,4)) |
|
+----------------------------------------+
|
| 2.3662 |
|
+----------------------------------------+
|
|
MariaDB [(none)]> select (55/23244*1000);
|
+-----------------+
|
| (55/23244*1000) |
|
+-----------------+
|
| 2.36620000 |
|
+-----------------+
|
MariaDB 5.5 ~ 10.3.22
MariaDB [(none)]> show variables like '%prec%';
|
+-------------------------+-------+
|
| Variable_name | Value |
|
+-------------------------+-------+
|
| div_precision_increment | 4 |
|
+-------------------------+-------+
|
|
MariaDB [(none)]> select (55/23244*1000);
|
+-----------------+
|
| (55/23244*1000) |
|
+-----------------+
|
| 2.3662 |
|
+-----------------+
|
|
MariaDB [(none)]> select cast( (55/23244*1000) as decimal(5,4));
|
+----------------------------------------+
|
| cast( (55/23244*1000) as decimal(5,4)) |
|
+----------------------------------------+
|
| 2.3662 |
|
+----------------------------------------+
|
Attachments
Issue Links
- duplicates
-
MDEV-23762 Strange type-inference/rounding problem since >10.3.23
- Closed
-
MDEV-23953 Decimal precision
- Closed
- is caused by
-
MDEV-19232 Floating point precision / value comparison problem
- Closed
- relates to
-
MDEV-23712 Clarify the description of div_precision_increment
- Closed