# openoffice-dev mailing list archives

##### Site index · List index
Message view
Top
From Guenter Marxen <guenter.mar...@gmail.com>
Subject Re: [API] Priority Problem with AND and OR
Date Tue, 13 Oct 2015 00:15:52 GMT
```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-unsubscribe@openoffice.apache.org