[MDEV-23572] Possible inaccuracy in modulo operations with decimal (double) values Created: 2020-08-25  Updated: 2020-08-25

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

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


 Description   

65ee216c

MariaDB [test]>  select 6678771973.49019 % 0.34632873535156 AS a;
+------------------+
| a                |
+------------------+
| 0.00264360672516 |
+------------------+
1 row in set (0.001 sec)
 
MariaDB [test]>  select 6678771973.49019 % CAST(0.34632873535156 AS DOUBLE) AS a;
+-----------------------+
| a                     |
+-----------------------+
| 0.0026431204981313683 |
+-----------------------+
1 row in set (0.001 sec)

The difference is probably expected to be smaller.



 Comments   
Comment by Elena Stepanova [ 2020-08-25 ]

On PostgreSQL (assuming that the scientific notation makes any difference for PostgreSQL in this case):

postgres=# select 6678771973.49019 % 0.34632873535156 AS a;
        a         
------------------
 0.00264360672516
(1 row)
 
postgres=# select 6678771973.49019 % 0.34632873535156e0 AS a;
        a         
------------------
 0.00264360672516
(1 row)

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