Hello Mike,

Wednesday, February 28, 2001, 3:55:35 AM, you wrote:

You should know what you can't do direct comparasions between float
number and float const as the number really stored in a database can
be slightly different i.e
355.61999999999999999999999999999999999999999999999999999999999



MM> There seems to be a matching bug in MySQL.

MM> Why will it match if I do a > of a number smaller that is in the 
MM> custom_price column, or if I do a strcmp(custom_price, '355.62'), but 
MM> will NOT match if I do "WHERE custom_price = '355.62'" OR if I try 
MM> "WHERE custom_price = 355.62"? This happens in both 3.23.28-gamma and 
MM> the latest 3.23.33. Tested on redhat 6.1,6.2 and 7.0.

MM> Here is an outline of the problem:


mysql>> desc service;
MM> 
+------------------+-------------+------+-----+---------------------+----------------+
MM> | Field            | Type        | Null | Key | Default             | 
MM> Extra          |
MM> 
+------------------+-------------+------+-----+---------------------+----------------+
MM> | id               | int(10)     |      | PRI | NULL                | 
MM> auto_increment |
MM> | accountid        | int(10)     |      | MUL | 0                   | 
MM>               |
MM> | servicetypeid    | int(10)     |      | MUL | 0                   | 
MM>               |
MM> | status           | varchar(32) |      |     | Pending             | 
MM>               |
MM> | date             | date        |      |     | 0000-00-00          | 
MM>               |
MM> | statuschangedate | datetime    |      |     | 0000-00-00 00:00:00 | 
MM>               |
MM> | addedby          | int(10)     |      |     | 0                   | 
MM>               |
MM> | updatedby        | int(10)     |      |     | 0                   | 
MM>               |
MM> | referral         | varchar(50) |      |     |                     | 
MM>               |
MM> | serverid         | int(10)     |      |     | 0                   | 
MM>               |
MM> | chargedate       | date        |      |     | 0000-00-00          | 
MM>               |
MM> | chargeinterval   | varchar(5)  |      |     |                     | 
MM>               |
MM> | quantity         | float(10,1) |      |     | 0.0                 | 
MM>               |
MM> | chargedsetup     | int(1)      |      |     | 0                   | 
MM>               |
MM> | discountid       | int(10)     |      |     | 0                   | 
MM>               |
MM> | custom_price     | float(10,2) |      |     | -1.00               | 
MM>               |
MM> 
+------------------+-------------+------+-----+---------------------+----------------+
MM> 16 rows in set (0.00 sec)


MM> (not work)
mysql>> select custom_price from service where accountid = 2625 and 
MM> custom_price = '355.62';
MM> Empty set (0.01 sec)

mysql>> select custom_price from service where accountid = 2625 and 
MM> custom_price = 355.62;
MM> Empty set (0.00 sec)


MM> (work)
mysql>> select custom_price from service where accountid = 2625 and 
custom_price >> '355.61';
MM> +--------------+
MM> | custom_price |
MM> +--------------+
MM> |       355.62 |
MM> |       355.62 |
MM> |       355.62 |
MM> |       355.62 |
MM> |       355.62 |
MM> |       355.62 |
MM> |       355.62 |
MM> |       355.62 |
MM> |       355.62 |
MM> +--------------+
MM> 9 rows in set (0.01 sec)


mysql>> select custom_price from service where accountid = 2625 and 
MM> strcmp(custom_price,'355.62') = 0;
MM> +--------------+
MM> | custom_price |
MM> +--------------+
MM> |       355.62 |
MM> |       355.62 |
MM> |       355.62 |
MM> |       355.62 |
MM> |       355.62 |
MM> |       355.62 |
MM> |       355.62 |
MM> |       355.62 |
MM> |       355.62 |
MM> +--------------+
MM> 9 rows in set (0.00 sec)





-- 
Best regards,
 Peter                            mailto:[EMAIL PROTECTED]



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to