Subject | A php niggle ... |
---|---|
Author | Lester Caine |
Post date | 2011-09-09T13:37:27Z |
Svein Erling Tysvær wrote:
Bounced this to support ...
checking what should happen. My own view - I think - is that the test is
'faulty' since trying to compare fractional numbers with integers is just wrong,
but since we are looking for integers, 7.5 rounds to 8 if I'm using the normal
rules, so returning 8 is correct - just a badly defined test?
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
> By the way, I'd say this is more appropriate for firebird-support than firebird-general.I though the history question was more appropriate here, and just followed on ;)
Bounced this to support ...
>> select * from test6 where v_integer between ? and ?I don't have any easy way to push parameters than via php, so I'm a little stuck
>> >
>> >Table has 4,5,6,7,8,9 as integers ...
>> >passing "5" and 7.5 as parameters returns 5,6,7 and 8 which I think is exactly
>> >as I would expect as 7.5 would be rounded up when converting to an integer?
>> >But the interbase test is saying that returning '8' is wrong. Feeding 7.499
>> >gives the expected result, but what is the 'right' result? More important is
>> >this a rounding happening in php or in firebird?
> Running a similar test in Firebird 1.5 and Firebird 2.5 (using DB Workbench) I get only one row returned when I specify between 5 and 5.7, it is only when I specify between 5 and cast(5.7 as integer) I get two rows. Hence, I guess the rounding is done by php.
checking what should happen. My own view - I think - is that the test is
'faulty' since trying to compare fractional numbers with integers is just wrong,
but since we are looking for integers, 7.5 rounds to 8 if I'm using the normal
rules, so returning 8 is correct - just a badly defined test?
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php