Question about: OpenOffice Calc. =-1^2 like expressions
There is a some strange behaviour in OpenOffice Calc (and in Microsoft Office too). Did it was made in OpenOIffice for compability with MSO? This seems to concern all combinations of even degrees and minus sign in the begining of formula 1. Enter in cell the expression: =-1^2 The result will be equal 1 instead of -1 Note that =1-2^2 results in -3 and it's true but -2^2 results 4 instead of -4 2. Well, now enter the expression: =-(1)^2 The result will be equal 1 instead of -1 again (or expression like =-(1+2)^2 the result will be 9 instead of -9) 3. Only if enter the expression: = -(1^2) The result now will be right and equal -1 Such behaviour contradicts mathematical notation of formula. - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org
Re: Question about: OpenOffice Calc. =-1^2 like expressions
On 2013/05/27 11:20 AM, Torokhov Sergey wrote: There is a some strange behaviour in OpenOffice Calc (and in Microsoft Office too). Did it was made in OpenOIffice for compability with MSO? This seems to concern all combinations of even degrees and minus sign in the begining of formula 1. Enter in cell the expression: =-1^2 The result will be equal 1 instead of -1 Note that =1-2^2 results in -3 and it's true but -2^2 results 4 instead of -4 2. Well, now enter the expression: =-(1)^2 The result will be equal 1 instead of -1 again (or expression like =-(1+2)^2 the result will be 9 instead of -9) 3. Only if enter the expression: = -(1^2) The result now will be right and equal -1 Such behaviour contradicts mathematical notation of formula. I'm quite sure AOO's way of interpreting such an expression was determined by compatibility considerations. For what its worth Wikipedia [1| also states these different conventions: There exist differing conventions concerning the unary operator − (usually read minus). In written or printed mathematics, the expression −32 is interpreted to mean −(32) = −9,[3] but in some applications and programming languages, notably the application Microsoft Office Excel and the programming language bc, unary operators have a higher priority than binary operators, that is, the unary minus (negation) has higher precedence than exponentiation, so in those languages −32 will be interpreted as (−3)2 = 9.[4] In cases where there is the possibility that the notation might be misinterpreted, parentheses are usually used to clarify the intended meaning, however due to the syntax of most major programming languages, it is usually hard or impossible to be ambiguous. [1] http://en.wikipedia.org/wiki/Order_of_operations#Exceptions_to_the_standard Herbert - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org
Re: Question about: OpenOffice Calc. =-1^2 like expressions
On Mon, May 27, 2013 at 4:20 AM, Torokhov Sergey torokhov-...@yandex.ru wrote: There is a some strange behaviour in OpenOffice Calc (and in Microsoft Office too). Did it was made in OpenOIffice for compability with MSO? http://en.wikipedia.org/wiki/Order_of_operations#Exceptions_to_the_standard The behavior or OpenOffice and MSO and C in general in computing, is due to the way 'parsing' works, which in computing _must_ be un-ambiguous. There is a 'gramatical distinction between '- the binary operator as in a - b , which is (operator -)(a,b) and the unary operator - as in -a. The later is treated with a higher priority so that expression like a * -b can be parsed properly. (other wise it would be treated as a * (0 implicit) - b = -b instead of -ab Norbert - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org
Re: Question about: OpenOffice Calc. =-1^2 like expressions
Hi, On 27.05.2013 11:20, Torokhov Sergey wrote: There is a some strange behaviour in OpenOffice Calc (and in Microsoft Office too). Did it was made in OpenOIffice for compability with MSO? This seems to concern all combinations of even degrees and minus sign in the begining of formula 1. Enter in cell the expression: =-1^2 The result will be equal 1 instead of -1 Note that =1-2^2 results in -3 and it's true but -2^2 results 4 instead of -4 2. Well, now enter the expression: =-(1)^2 The result will be equal 1 instead of -1 again (or expression like =-(1+2)^2 the result will be 9 instead of -9) 3. Only if enter the expression: = -(1^2) The result now will be right and equal -1 Such behaviour contradicts mathematical notation of formula. I tried Microsoft Office Excel 2003, 2010 and 2013. All three applications showed the same results on the above formulas as OpenOffice Calc. Thus, I believe that your guess is true that the reason for OpenOffice's behavior is the compatibility with Microsoft Office. Best regards, Oliver. - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org
Re: Question about: OpenOffice Calc. =-1^2 like expressions
On 27.05.2013 13:33, Norbert Thiebaud wrote: On Mon, May 27, 2013 at 4:20 AM, Torokhov Sergey torokhov-...@yandex.ru wrote: There is a some strange behaviour in OpenOffice Calc (and in Microsoft Office too). Did it was made in OpenOIffice for compability with MSO? http://en.wikipedia.org/wiki/Order_of_operations#Exceptions_to_the_standard The behavior or OpenOffice and MSO and C in general in computing, is due to the way 'parsing' works, I don't think so. First you define what the precedence of your operators should be and only then you define your grammar to parse expressions accordingly. I think that these two reasons are more probably: 1. An error in the original implementation (of MS Office) 2. Maybe -1^2 = 1 is what the majority of (non-mathematical) users of MS Office expect. In any case, this is a problem with no good solution. -Andre which in computing _must_ be un-ambiguous. There is a 'gramatical distinction between '- the binary operator as in a - b , which is (operator -)(a,b) and the unary operator - as in -a. The later is treated with a higher priority so that expression like a * -b can be parsed properly. (other wise it would be treated as a * (0 implicit) - b = -b instead of -ab Norbert - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org
Re: Question about: OpenOffice Calc. =-1^2 like expressions
Andre Fischer wrote: In any case, this is a problem with no good solution. Indeed. Before this becomes another 0 ^ 0... there is an issue for this, it dates back to 2004 and it is marked invalid. That's it. https://issues.apache.org/ooo/show_bug.cgi?id=24271 If someone has strong feelings he can post comments there, even though I don't believe that marking the issue as REOPENED would have any practical effects. Regards, Andrea. - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org
Re: Question about: OpenOffice Calc. =-1^2 like expressions
Hi, please see the (long) discussions in https://issues.apache.org/ooo/show_bug.cgi?id=24271 and https://issues.apache.org/ooo/show_bug.cgi?id=26755 and its duplicates. Torokhov Sergey schrieb: There is a some strange behaviour in OpenOffice Calc (and in Microsoft Office too). Did it was made in OpenOIffice for compability with MSO? This seems to concern all combinations of even degrees and minus sign in the begining of formula 1. Enter in cell the expression: =-1^2 The result will be equal 1 instead of -1 Note that =1-2^2 results in -3 and it's true but -2^2 results 4 instead of -4 2. Well, now enter the expression: =-(1)^2 The result will be equal 1 instead of -1 again (or expression like =-(1+2)^2 the result will be 9 instead of -9) 3. Only if enter the expression: = -(1^2) The result now will be right and equal -1 Such behaviour contradicts mathematical notation of formula. My personal favorite is the way Gnumeric does it. It puts brackets around -1 when you enter the formula, so that there is no doubt about the meaning. Kind regards Regina - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org
Re: Question about: OpenOffice Calc. =-1^2 like expressions
On Mon, 27 May 2013 14:08:15 +0200 Andrea Pescetti pesce...@apache.org wrote: Andre Fischer wrote: In any case, this is a problem with no good solution. Indeed. Before this becomes another 0 ^ 0... there is an issue for this, it dates back to 2004 and it is marked invalid. That's it. https://issues.apache.org/ooo/show_bug.cgi?id=24271 If someone has strong feelings he can post comments there, even though I don't believe that marking the issue as REOPENED would have any practical effects. Regards, Andrea. I think whether this behaviour be mathematically correct or incorrect we must follow the behaviour of MS Excel. -- Rory O'Farrell ofarr...@iol.ie - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org
Re: Question about: OpenOffice Calc. =-1^2 like expressions
Thanks to all for explanations - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org
Re: Question about: OpenOffice Calc. =-1^2 like expressions
On 27.05.2013 14:08, Andrea Pescetti wrote: Andre Fischer wrote: In any case, this is a problem with no good solution. Indeed. Before this becomes another 0 ^ 0... there is an issue for this, it dates back to 2004 and it is marked invalid. That's it. https://issues.apache.org/ooo/show_bug.cgi?id=24271 If someone has strong feelings he can post comments there, even though I don't believe that marking the issue as REOPENED would have any practical effects. For what it's worth, I took the liberty to change the status from Closed/Invalid to Closed/Wontfix as requested in the last comment from two years ago: WONTFIX would be more honest and respectful than INVALID! I don't plan to do anything else with this issue. -Andre Regards, Andrea. - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org
Re: Question about: OpenOffice Calc. =-1^2 like expressions
27.05.2013, 16:16, Regina Henschel rb.hensc...@t-online.de: My personal favorite is the way Gnumeric does it. It puts brackets around -1 when you enter the formula, so that there is no doubt about the meaning. Kind regards Regina It looks currently like best solution without misunderstanding from view of user while rechecking the formula (especially in case of big formula) - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org
RE: Question about: OpenOffice Calc. =-1^2 like expressions
Without concern for rationale, it is part of the ODF 1.2 OpenFormula syntax that unary minus has precedence over all binary operators. It is not uncommon for there to be such a rule in programming languages (C/C++, Java, and JavaScript, for example). Some languages that have an exponentiation operator (not that common) might have different precedence cases, so that A^-b might be either illegal or A^(-b) -a^b might be either (-a)^b or -(a^b), the second being the case for Fortran In Openformula both forms are legal and the unary - has higher precedence (is done first) over ^. It is unfortunate that the built-in Help defines the operators in Calc but it does not specify the precedence. - Dennis PS: There are times when INVALID and WON'T FIX are inappropriate responses. One can be taken as saying something about the submitter, the other says something about the developer, although WON'T FIX is appropriate for a trivial defect that has no serious consequences or for an implementation-specific case that will be preserved. My preference over INVALID is BY DESIGN (it is meant to be that way) and even SPECIFIED or TO SPEC or STANDARD (when it is required to be that way). -Original Message- From: Rory O'Farrell [mailto:ofarr...@iol.ie] Sent: Monday, May 27, 2013 05:21 AM To: dev@openoffice.apache.org Subject: Re: Question about: OpenOffice Calc. =-1^2 like expressions On Mon, 27 May 2013 14:08:15 +0200 Andrea Pescetti pesce...@apache.org wrote: Andre Fischer wrote: In any case, this is a problem with no good solution. Indeed. Before this becomes another 0 ^ 0... there is an issue for this, it dates back to 2004 and it is marked invalid. That's it. https://issues.apache.org/ooo/show_bug.cgi?id=24271 If someone has strong feelings he can post comments there, even though I don't believe that marking the issue as REOPENED would have any practical effects. Regards, Andrea. I think whether this behaviour be mathematically correct or incorrect we must follow the behaviour of MS Excel. -- Rory O'Farrell ofarr...@iol.ie - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org
Re: Question about: OpenOffice Calc. =-1^2 like expressions
On Mon, May 27, 2013 at 2:27 PM, Dennis E. Hamilton dennis.hamil...@acm.org wrote: Without concern for rationale, it is part of the ODF 1.2 OpenFormula syntax that unary minus has precedence over all binary operators. It is not uncommon for there to be such a rule in programming languages (C/C++, Java, and JavaScript, for example). Some languages that have an exponentiation operator (not that common) might have different precedence cases, so that A^-b might be either illegal or A^(-b) -a^b might be either (-a)^b or -(a^b), the second being the case for Fortran In Openformula both forms are legal and the unary - has higher precedence (is done first) over ^. It is unfortunate that the built-in Help defines the operators in Calc but it does not specify the precedence. - Dennis PS: There are times when INVALID and WON'T FIX are inappropriate responses. One can be taken as saying something about the submitter, the other says something about the developer, although WON'T FIX is appropriate for a trivial defect that has no serious consequences or for an implementation-specific case that will be preserved. My preference over INVALID is BY DESIGN (it is meant to be that way) and even SPECIFIED or TO SPEC or STANDARD (when it is required to be that way). We use INVALID for two main things today: - user didn't submit a defect report at all, but posted a help request, how to question, etc. - user submitted a defect report but the behavior was not a defect WONTFIX mean something is a actually a valid defect, but for one reason or another it won't be fixed. IMHO, if what we're doing is in accordance with ODF, and is needed for compatibility with MS Office and past OpenOffice spreadsheets, then the defect report is INVALID. There is not other way to treat it, if we want to be consistent. Note: the distinction is important if we track defects by components, etc. Knowing how many real (non-invalid) defects are in a component, or are found in a given release, etc., is good information to know. We lose the value of that data if we mix it up by calling something WONTFIX for political reasons. This should be an engineering decision, not a public relations effort. Making best thing is to rename INVALID so it is less offensive? Maybe NOT-A-BUG or something like that? But still preserve the distinction between that at WONTFIX. Regards, -Rob -Original Message- From: Rory O'Farrell [mailto:ofarr...@iol.ie] Sent: Monday, May 27, 2013 05:21 AM To: dev@openoffice.apache.org Subject: Re: Question about: OpenOffice Calc. =-1^2 like expressions On Mon, 27 May 2013 14:08:15 +0200 Andrea Pescetti pesce...@apache.org wrote: Andre Fischer wrote: In any case, this is a problem with no good solution. Indeed. Before this becomes another 0 ^ 0... there is an issue for this, it dates back to 2004 and it is marked invalid. That's it. https://issues.apache.org/ooo/show_bug.cgi?id=24271 If someone has strong feelings he can post comments there, even though I don't believe that marking the issue as REOPENED would have any practical effects. Regards, Andrea. I think whether this behaviour be mathematically correct or incorrect we must follow the behaviour of MS Excel. -- Rory O'Farrell ofarr...@iol.ie - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org
RE: Question about: OpenOffice Calc. =-1^2 like expressions
Yes, NOT A BUG is definitely preferable to INVALID. - Dennis -Original Message- From: Rob Weir [mailto:robw...@apache.org] Sent: Monday, May 27, 2013 02:56 PM To: dev@openoffice.apache.org; Dennis Hamilton Subject: Re: Question about: OpenOffice Calc. =-1^2 like expressions [ ... ] Making best thing is to rename INVALID so it is less offensive? Maybe NOT-A-BUG or something like that? But still preserve the distinction between that at WONTFIX. Regards, -Rob [ ... ] - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org