Bug #42871 Inserting -0.0 to a float/double column in Falcon stores +0
Submitted: 16 Feb 2009 6:05 Modified: 30 Apr 2009 7:06
Reporter: Nidhi Shrotriya Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S3 (Non-critical)
Version:6.0 OS:Any
Assigned to: Lars-Erik Bjørk CPU Architecture:Any
Tags: F_ENCODING, F_ENCODING, handler, handler

[16 Feb 2009 6:05] Nidhi Shrotriya
Description:
Inserting -0.0 to a float column in Falcon stores +0 , different from other SEs.

How to repeat:
mysql> create table float_falcon(c1 float, c2 float(10)) engine=falcon;
Query OK, 0 rows affected (0.18 sec)

mysql> create table float_innodb(c1 float, c2 float(10)) engine=innodb;
Query OK, 0 rows affected (0.02 sec)

mysql> insert into float_falcon values("-0.0","-0.0");
Query OK, 1 row affected (0.01 sec)

mysql> insert into float_innodb values("-0.0","-0.0");
Query OK, 1 row affected (0.01 sec)

MyISAM, Innodb, Maria :
-----------------------------------
mysql> select * from float_innodb;
+------+------+
| c1   | c2   |
+------+------+
|   -0 |   -0 |
+------+------+
1 row in set (0.00 sec)

Falcon:
--------------
mysql> select * from float_falcon;
+------+------+
| c1   | c2   |
+------+------+
|    0 |    0 |
+------+------+
1 row in set (0.00 sec) 

Though it is a minor issue, recording it. In other cases it works fine. 

mysql> select * from float_falcon;
+-------+-------+
| c1    | c2    |
+-------+-------+
|     0 |     0 |
|   -32 |   -32 |
| -0.02 | -0.02 |
+-------+-------+
3 rows in set (0.00 sec)

mysql> select * from float_innodb;
+-------+-------+
| c1    | c2    |
+-------+-------+
|    -0 |    -0 |
|   -32 |   -32 |
| -0.02 | -0.02 |
+-------+-------+
3 rows in set (0.00 sec)

Also when scale is specified as below it works fine on -0.0.

mysql> create table float_falcon1(c1 float(10,2)) engine=falcon;
Query OK, 0 rows affected (0.01 sec)

mysql> create table float_innodb1(c1 float(10,2)) engine=falcon;
Query OK, 0 rows affected (0.01 sec)

mysql> insert into float_falcon1 values("-0.0");
Query OK, 1 row affected (0.01 sec)

mysql> insert into float_innodb1 values("-0.0");
Query OK, 1 row affected (0.00 sec)

mysql> select * from float_innodb1;
+------+
| c1   |
+------+
| 0.00 |
+------+
1 row in set (0.01 sec)

mysql> select * from float_falcon1;
+------+
| c1   |
+------+
| 0.00 |
+------+
1 row in set (0.00 sec)
[16 Feb 2009 7:00] Sveta Smirnova
Thank you for the report.

Verified as described.
[11 Mar 2009 6:10] Nidhi Shrotriya
Same happens with double.
[30 Apr 2009 7:06] Lars-Erik Bjørk
It is not a requirement by any SQL standard to maintain -0.0 as a different number than +0.  And we would be very surprised to find any customer that needs this
[30 Apr 2009 7:06] Lars-Erik Bjørk
It is not a requirement by any SQL standard to maintain -0.0 as a different number than +0.  And we would be very surprised to find any customer that needs this