Bug #25938 | minus zero (-0.00) can't be... | ||
---|---|---|---|
Submitted: | 30 Jan 2007 11:27 | Modified: | 30 Jan 2007 22:57 |
Reporter: | Ali | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 5.0.19 | OS: | Windows (WINDOWS XP) |
Assigned to: | CPU Architecture: | Any |
[30 Jan 2007 11:27]
Ali
[30 Jan 2007 11:32]
Valeriy Kravchuk
Thank you for a problem report. Please, specify the exact MySQL server version used, 5.0.x. Send SHOW CREATE TABLE results for that TestTable also.
[30 Jan 2007 11:57]
Ali
CREATE TABLE `testschema`.`TestTable` ( `ID` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `Field_A` BOOLEAN NOT NULL DEFAULT 0, `Field_B` DOUBLE(15,2) UNSIGNED NOT NULL DEFAULT 0, `Field_C` INTEGER UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY(`ID`) ) ENGINE = InnoDB;
[30 Jan 2007 22:57]
Hartmut Holzgraefe
Not a bug then, just the typical binary to decimal rounding issues. If you want exact results use the DECIMAL type instead of FLOAT and DOUBLE. Slower and taking more storage space, but definetly more precise.
[2 Mar 2007 16:28]
Relu Botinant
select 1*-1*0.0; +----------+ | 1*-1*0.0 | +----------+ | -0.0 | +----------+ 1 row in set (0.00 sec)
[2 Mar 2007 16:32]
Relu Botinant
Workaround: Add a +0 at the end. mysql> select 1*-1*0.0000*1 + 0; +-----------------+ | 1*-1*0.0000*1+0 | +-----------------+ | 0.0000 | +-----------------+ 1 row in set (0.00 sec)