Created attachment 74618 [details] LO 4 evaluates compound inequalities differently to another versions of software Tradionally, in spreadsheets formulae expressions like a < b < c are evaluated as a < (b < c) with implicit bool to int typecast. As a result, 10 < 11 < 12 is expected to return FALSE. In LO 4, however, the result is TRUE, like it was an abbrevation for (10<11) AND (11<12). This is another syntax, known from a lot of languages, but its introduction at user's level to spreadsheet is unexpected and undocumented. The attachment illustrates the problem.
It seems raher that subexpressions are left hand side grouped in LO, i.e. a < b < c ---> (a<b) < c. Compare the same with a=-2, b=-1, c=0 or with reversed inequalities: 12 > 11 > 10 returns FALSE. Thanks to gerard24 for the tip (http://forum.openoffice.org/en/forum/viewtopic.php?f=9&p=263535#p263533)
Comparison operators are defined to be left-associative, so calculating (a<b)<c for a<b<c is correct. This is similar to a-b-c being calculated as (a-b)-c, you would not expect the result to be a-(b-c) See also http://docs.oasis-open.org/office/v1.2/cs01/OpenDocument-v1.2-cs01-part2.html#Operators Note that in spreadsheet context the expression =a<b<c is not meaningful, the result is implementation-defined and depends on whether a boolean result is converted to an integer or not, and if it is not converted then the 2nd-step comparison depends on whether a boolean is sorted before an integer.
Seeing your pointer to the forum thread: Apache OO in this regard behaves identical to LibreOffice, there's no difference, both return TRUE for =10<11<12 Excel is different because it does not promote the boolean result to integer and sorts boolean behind numbers. Specifically it does not evaluate a<b<c as a<(b<c). Try =10<11<12 (=> FALSE) vs =10<(11<12) (=> TRUE). (10<11) is boolean TRUE and with boolean sorted behind numbers it becomes boolean<12 that evaluates to FALSE.
On Mon, 11 Feb 2013, bugzilla-daemon@freedesktop.org wrote: > https://bugs.freedesktop.org/show_bug.cgi?id=60671 > > --- Comment #3 from Eike Rathke <erack@redhat.com> --- > Seeing your pointer to the forum thread: Apache OO in this regard behaves > identical to LibreOffice, there's no difference, both return TRUE for =10<11<12 > > Excel is different because it does not promote the boolean result to integer > and sorts boolean behind numbers. Specifically it does not evaluate a<b<c as > a<(b<c). Try =10<11<12 (=> FALSE) vs =10<(11<12) (=> TRUE). (10<11) is boolean > TRUE and with boolean sorted behind numbers it becomes boolean<12 that > evaluates to FALSE. > Thanks, Eike you are absolutely right. I am too overloaded with my work today. It would be much better if I do not initialize this discussion. I have mismatched some facts. Sorry,
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.