Bug 60671 - Compound two-argument relation expressions calculated as abbevaition for AND
Summary: Compound two-argument relation expressions calculated as abbevaition for AND
Status: CLOSED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Spreadsheet (show other bugs)
Version: 4.0.0.3 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-11 15:14 UTC by Jan_J
Modified: 2013-02-12 10:33 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
LO 4 evaluates compound inequalities differently to another versions of software (7.64 KB, application/vnd.oasis.opendocument.spreadsheet)
2013-02-11 15:14 UTC, Jan_J
Details

Description Jan_J 2013-02-11 15:14:29 UTC
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.
Comment 1 Jan_J 2013-02-11 16:17:18 UTC
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)
Comment 2 Eike Rathke 2013-02-11 16:39:05 UTC
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.
Comment 3 Eike Rathke 2013-02-11 16:57:14 UTC
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.
Comment 4 Jan_J 2013-02-11 21:28:00 UTC
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.