Not true or misstated, see 
https://technet.microsoft.com/en-us/library/ms186992%28v=sql.105%29.aspx for 
correct priority of operators.
Without parentheses AND is evaluated before OR

Attached is a little browser program I use to test Boolean arithmetic.
It is written in html && stands for AND, || stands for OR.
Use == to test if two things are equal, like (3 == 2+1)

Howard

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.

"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.

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.p-roocks.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!

-- 
Grüße

Günter Marxen


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus


---------------------------------------------------------------------
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

Reply via email to