Hello.
If the space is so important to you, what do you think about 'LIKE' operator? It seems to work corectly and it is able to use indexes. See: create table fff (x float, key(x)); insert into fff values(0.1); insert into fff values(0.11); ............................ select * from fff where x like 0.1; +------+ | x | +------+ | 0.1 | | 0.1 | | 0.1 | +------+ mysql> explain select * from fff where x like 0.1 \G; *************************** 1. row *************************** id: 1 select_type: SIMPLE table: fff type: index possible_keys: x key: x key_len: 5 ref: NULL rows: 16 Extra: Using where; Using index; Jacek Becla <[EMAIL PROTECTED]> wrote: > 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 > -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Gleb Paharenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]