Hi,
Andrew Douglas Pitonyak schrieb:
[..]
>
> The real question becomes.... should it be changed to follow expected
> mathematical norms (breaking all existing correct code and fixing all
> broken code where people assumed it was done in the generally accepted
> way). I am glad I need not make that call.
No, it should not be changed. You cannot break existing macros after so
many years, and the behavior is not really "wrong", because it follows
the mathematical definition.
The problem is not, that Basic makes it different than some other
languages. The problem is, that it is so badly documented.
Other example: Basic has no shortcut evaluation of boolean expressions.
Kind regards
Regina
>
> On 10/12/2015 08:15 PM, Guenter Marxen wrote:
>> Hi,
>>
>> Am 12.10.2015 um 21:40 schrieb Mathias RĂ¶llig:
>>> ...
>>> What do you expect?
>>> For logical operations AND is equivalent to * and OR is equivalent to +.
>>
>> no, that's not true. AND and OR have the same priority, just as * and
>> / (division). (* and / have a higher priority than + and .)
>>
>>> AND should have a higher priority than OR, so I would expect in both
>>
>> Expressions have to be evaluated from left to right with respect to
>> priority and parenthesis.
>
> Only for those specific operators. And the complaint was that your
> statement is unexpectedly true.
>
>>
>> "and" and "or" are binary operators. Therfore your examples can be
>> written as "A or B" where "B = (C and D)". If you write your example as
>> "A or (C and D)" then it is the same and everyone sees immediatly, how
>> it is evaluated.
>
> I wrote an implementation for a proposed international standard in
> Fortran 90 many years back.... It was suggested that I assume that
> people would not know precedence rules so that I should use parenthesis
> for all statements.... and that I should avoid things like ternary
> operators since beginning programmers may not know what they were.
>
>>
>> In both cases, the result is TRUE, because
>> "TRUE or anything" is TRUE, just as "TRUE or (anything)".
>>
>> "(A or B) and C" is totally different.
>>
>> On http://www.proocks.de/truthtable2.php you can create "tables of
>> truth" (Wahrheitstabellen) for logical expressions like "A or B and C"
>> and more complex ones.
>>
>>> cases (because TRUE Or (<anything>) = TRUE):
>>> bResult = TRUE
>>> But you will get
>>> TRUE Or FALSE And TRUE = (TRUE Or FALSE) And TRUE = TRUE
>>> TRUE Or TRUE And FALSE = (TRUE Or TRUE) And FALSE = FALSE
>>>
>>> Is there any explanation that AND and OR have (and should have) the same
>>> priority?
>>
>> It is as it is!
>>
> You are correct in that!
>

To unsubscribe, email: devunsubscribe@openoffice.apache.org
For additional commands, email: devhelp@openoffice.apache.org
