> Er, no, 
> 
> 12.33999999 < float_var < 12.34000000
> 
> works fine.
> 
> It is the = operation that doesn't.  Remember that floating 
> point numbers
....


I don't understand why you think inexact numbers won't compare, the
originators comparison works for '12.3' works with several other types of
databases.

When the record was inserted, the ascii string '12.3' from the sql INSERT
statement was converted to a binary float number and saved in the database.
The conversion was not perfectly accurate so it stored something very close.
When the SELECT...WHERE is executed, the engine should convert the '12.3'
ascii string from the select clause, cast it to the type of the column
(float) and then compare.  The conversion, again, won't be perfect but it
will be repeatable and should see the exact same result.

If the original insert was '12.300000001' then the conversion may result in
a different number and the equality won't match.  And it shouldn't.  But the
same ascii string (in the sql statement) should be converted reliably every
time.

I suspect the engine is not forcing the '12.3' in the where clause to a
float type before comparing it with the column in the database.

Mike

---------------------------------------------------------------------
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