[MDEV-6856] <negative value> MOD <fractional divisor> returns negative zero Created: 2014-10-08  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5.40
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-30044 The problem of the representation of ... Closed
is duplicated by MDEV-30546 The representation of 0 in division f... Closed
is duplicated by MDEV-30547 Problems when mod , division function... Closed
is duplicated by MDEV-30991 The representation of 0 in multiplica... Closed
Relates
relates to MDEV-6841 test decimal math Open

 Description   

It doesn't look very dangerous, just strange:

MariaDB [test]> select -1 % 0.1;
+----------+
| -1 % 0.1 |
+----------+
|     -0.0 |
+----------+
1 row in set (0.00 sec)

Same in MySQL 5.6. PostgreSQL returns a normal zero.



 Comments   
Comment by Sergei Golubchik [ 2022-11-20 ]

see also SELECT mod('-12',-4);

Comment by Sergei Golubchik [ 2023-02-02 ]

and many other cases. Likely, dtoa needs to be changed to never generate "-0" string

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