This is a standard 1st quarter computer science topic.
You can't reliably test floating point numbers for equality.
0.1 has no exact floating point binary representation.
Perhaps you should use the DECIMAL type which is stored
internally as a string.

Guddack Thorsten ICM MP SCM SCCM PI wrote:

> Hi List,
> 
> I'm a little bit confused.
> 
> I do the following:
> 
> Create a table with 1 int and two floats.....
> 
> mysql> create table testfloat(z int, ll float, ul float);
> Query OK, 0 rows affected (0.00 sec)
> 
> inserting one row into the table........
> 
> mysql> insert into testfloat values(1,-0.1,0.1);
> Query OK, 1 row affected (0.00 sec)
> 
> check if values where inside........
> 
> mysql> select * from testfloat;
> +------+------+------+
> | z    | ll   | ul   |
> +------+------+------+
> |    1 | -0.1 |  0.1 |
> +------+------+------+
> 1 row in set (0.01 sec)
> 
> 
> and now I wants to take a look on special rows......
> 
> mysql> select * from testfloat where ul=0.1;
> Empty set (0.00 sec)
> 
> 
> I didn't understand why I didn't get what I expect.
> 
> Best regards
> 
> Thorsten Guddack
> 
> ---------------------------------------------------------------------
> 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


-- 
Gerald L. Clark
[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

  • Floats Guddack Thorsten ICM MP SCM SCCM PI
    • Gerald Clark

Reply via email to