[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: BUG?
From:       Victor Medina <linux () epa ! com ! ve>
Date:       2004-03-01 18:13:04
Message-ID: 1078164784.7131.0.camel () linux ! epa ! com ! ve
[Download RAW message or body]

More of the same:

mysql> select 260.22000000000000 + 18.81000000000000 -
279.03000000000000;
+-------------------------------------------------------------+
| 260.22000000000000 + 18.81000000000000 - 279.03000000000000 |
+-------------------------------------------------------------+
|                                            0.00000000000006 |
+-------------------------------------------------------------+
1 row in set (0.11 sec)
 
mysql> select 279.03000000000000 - 279.03000000000000;
+-----------------------------------------+
| 279.03000000000000 - 279.03000000000000 |
+-----------------------------------------+
|                        0.00000000000000 |
+-----------------------------------------+
1 row in set (0.00 sec)
 
mysql> select 279.03000000000000 - (260.22000000000000 +
18.81000000000000);
+---------------------------------------------------------------+
| 279.03000000000000 - (260.22000000000000 + 18.81000000000000) |
+---------------------------------------------------------------+
|                                             -0.00000000000005 |
+---------------------------------------------------------------+
1 row in set (0.00 sec)
 
mysql> select 279.03000000000000 - 260.22000000000000 -
18.81000000000000;
+-------------------------------------------------------------+
| 279.03000000000000 - 260.22000000000000 - 18.81000000000000 |
+-------------------------------------------------------------+
|                                           -0.00000000000005 |
+-------------------------------------------------------------+
1 row in set (0.00 sec)
 
mysql> select 279.03000000000000 - 260.22000000000000;
+-----------------------------------------+
| 279.03000000000000 - 260.22000000000000 |
+-----------------------------------------+
|                       18.80999999999995 |
+-----------------------------------------+
1 row in set (0.00 sec)




On Mon, 2004-03-01 at 13:50, Fagyal, Csongor wrote:
> stairwaymail-mysql@yahoo.com wrote:
> 
> >Arithmetic results in a value of zero but mysql is
> >treating the value as > 0. This is reproducible in a
> >lot of different ways. Below is a pretty clear
> >example.
> >
> >mysql> select version();
> >+---------------+
> >| version()     |
> >+---------------+
> >| 4.0.17-max-nt |
> >+---------------+
> >1 row in set (0.00 sec)
> >
> >mysql> create table t (a decimal(12,2) not null, b
> >decimal(12,2) not null, c decimal(12,2) not null);
> >Query OK, 0 rows affected (0.72 sec)
> >
> >mysql> insert into t values (260.22,18.81,279.03);
> >Query OK, 1 row affected (0.00 sec)
> >
> >mysql> select a+b-c from t where a+b-c = 0;
> >Empty set (0.00 sec)
> >
> >mysql> select a+b-c as y from t having y = 0;
> >Empty set (0.00 sec)
> >
> >mysql> select a+b-c as y from t having y > 0;
> >+------+
> >| y    |
> >+------+
> >| 0.00 |
> >+------+
> >1 row in set (0.00 sec)
> >
> >mysql> select a+b-c from t where a+b-c > 0;
> >+-------+
> >| a+b-c |
> >+-------+
> >|  0.00 |
> >+-------+
> >1 row in set (0.00 sec)
> >
> >Anybody?
> >
> Isn't this an internal representation error - probably "decimal" handled 
> as "float"?
> 
> mysql> select 260.22000000000000 + 18.81000000000000 - 279.03000000000000;
> +-------------------------------------------------------------+
> | 260.22000000000000 + 18.81000000000000 - 279.03000000000000 |
> +-------------------------------------------------------------+
> | 0.00000000000006 |
> +-------------------------------------------------------------+
> 1 row in set (0.01 sec)
> 
> 
> - Cs.
> 
-- 

 |...........................................................|
 |____  _____ ____   _    |Victor Medina M                   |
 |\ \ \| ____|  _ \ / \   |Linux - Java - MySQL              |
 | \ \ \  _| | |_) / _ \  |Dpto. Sistemas - Ferreteria EPA   |
 | / / / |___|  __/ ___ \ |linux@epa.com.ve                  |
 |/_/_/|_____|_| /_/   \_\|ext. 325 - Tél: +58-241-8507325   |
 |                        |geek by nature - linux by choice  |
 |...........................................................|






















-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=mysql@progressive-comp.com


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic