[MDEV-23368] ROUND(18446744073709551615,-11) returns a wrong result Created: 2020-08-02  Updated: 2020-08-03  Resolved: 2020-08-02

Status: Closed
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 10.1, 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.4.14, 10.5.5

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None


 Description   

SELECT ROUND(18446744073709551615,-10), ROUND(18446744073709551615,-11);

+---------------------------------+---------------------------------+
| ROUND(18446744073709551615,-10) | ROUND(18446744073709551615,-11) |
+---------------------------------+---------------------------------+
|            18446744070000000000 |                     26290448384 |
+---------------------------------+---------------------------------+

The result for the second columns is wrong. The expected result is 18446744100000000000.



 Comments   
Comment by Alexander Barkov [ 2020-08-02 ]

The problem is also repeatable starting with 10.4 with a hex hybrid:

SELECT ROUND(18446744073709551615,-10), ROUND(18446744073709551615,-11);

+---------------------------------+---------------------------------+
| ROUND(18446744073709551615,-10) | ROUND(18446744073709551615,-11) |
+---------------------------------+---------------------------------+
|            18446744070000000000 |                     26290448384 |
+---------------------------------+---------------------------------+

Generated at Thu Feb 08 09:21:52 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.