>>mysql> select 798 between 75.2 and 999.1;
>>+----------------------------+
>>|                          1 |
>>+----------------------------+
>>
>>mysql> select 798 between 75.2 and 1e30;
>>+---------------------------+
>>|                         0 |    <<<-------- Really?
>>+---------------------------+
>>
>>mysql> select 798.1 between 75.2 and 1e30;
>>+-----------------------------+
>>|                           1 |
>>+-----------------------------+

OS> tested this against 3.23.45; it's reproducible. The problem
OS> appears if the upper range exceeds 0.92233e19 (signed bigint). But
OS> the manual states that this is NOT a bug:

OS> expr BETWEEN min AND max
OS>   ...
OS>   - If expr is an integer expression, an integer comparision is done.
OS>   - Otherwise, a floating-point (real) comparision is done.
OS>   ...


Hi Oliver,

Thanks for your response. I am sorry I did not check the doc's as it
struck me as _so_ bizarre that the inconsistency _appeared_ not just
to be an int-vs-real problem.

If I understand correctly: -

When the integer comparison is performed, the min & max are parsed as
integers and anything after the first non-digit is ignored, and that
works okay-ish for the decimal point for obvious reasons, but of course
the exponential syntax doesn't truncate so well!

                                 ===

I'm musing over the implications of this though. I can see that
forcing a parser error when the min/max don't match the expected
comparison type would have disadvantages, even if it was appropriate
just because I had a problem one day ;) I'll go and read the manual in
more depth around the S6.2 et seq to see if there's discussion there
about it .. if not I'll follow-up with more thoughts :)


-- 
Many thanks,
James.


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