[MDEV-5933] Wrong result for ROUND(1e308/3,-302) Created: 2014-03-23  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.1.67, 5.2.14, 5.3.12, 5.5.36, 10.0.10, 10.1, 10.2, 10.3, 10.4, 10.5, 10.10
Fix Version/s: 10.4, 10.5

Type: Bug Priority: Minor
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: upstream


 Description   

select round(1e308/3,-302);
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| round(1e308/3,-302)                                                                                                                                                                                                                                                                                                  |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 33333300000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

The above result is wrong: notice digit "4" after some zeros.
It should be "0" at this position.



 Comments   
Comment by Elena Stepanova [ 2014-04-12 ]

MySQL 5.5-5.7 are also affected.
MariaDB 5.1-5.3 return an essentially different result (not just one digit off).

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