[MDEV-29720] negativ zero value with double and float type Created: 2022-10-06  Updated: 2023-11-28

Status: Confirmed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.3, 10.4, 10.6.10, 10.5, 10.6, 10.7, 10.8, 10.9
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Minor
Reporter: bulepage Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None
Environment:

ubuntu 22.04



 Description   

Negativ zero value in result set

DROP TABLE if EXISTS test;
CREATE TABLE test(test_data_1  DOUBLE, test_data_2  DOUBLE ) ;
INSERT  test values( 0 , -5);
 
SELECT test_data_1, test_data_1 * -5,
test_data_2, test_data_2 * 0
FROM test t
;

+-------------+------------------+-------------+-----------------+
| test_data_1 | test_data_1 * -5 | test_data_2 | test_data_2 * 0 |
+-------------+------------------+-------------+-----------------+
|           0 |               -0 |          -5 |              -0 |
+-------------+------------------+-------------+-----------------+

in simple format:

SELECT CAST(0 as DOUBLE)*CAST(-5 as signed);

+--------------------------------------+
| CAST(0 as DOUBLE)*CAST(-5 as signed) |
+--------------------------------------+
|                                   -0 |
+--------------------------------------+



 Comments   
Comment by bulepage [ 2022-10-06 ]

Same result with float type

SELECT CAST(0 as FLOAT)*-5;

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