Hi,

I'm having problems with floats while doing comparisons.

create table fff (x float);
create table ddd (x double);
insert into fff (0.1);
insert into ddd (0.1);

"select * from ddd where x = 0.1" correctly returns one row, but
"select * from fff where x = 0.1" does not return anything.

I found on many websites that "If you are comparing FLOAT or
DOUBLE columns with numbers that have decimals, you can't use '='.
This problem is common in most computer languages because
floating-point values are not exact values. In most cases,
changing the FLOAT to a DOUBLE will fix this."

This solution is fine as long as involved data size is relatively small. We are planning to store ~500 millions rows per day, each containing many floats. Switching to double is not a viable option due to space overhead. I wonder if anyone has a better suggestion how to solve it.

Thanks,
Jacek

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to