order of logical operations in CAS - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: order of logical operations in CAS (/thread-18957.html) |
order of logical operations in CAS - Wes Loewer - 10-14-2022 03:40 AM I noticed that in Home A OR B AND C is treated as A OR (B AND C) as expected with AND having a higher precedence than OR. However, in CAS a OR b AND c is treated as (a OR b) AND c, evaluating left to right with AND and OR having the same precedence. For example: Home: true OR false AND false --> 1 CAS (and XCAS) true OR false AND false --> false Is this a bug, or is this the intended behavior? RE: order of logical operations in CAS - parisse - 10-14-2022 06:18 AM Indeed, and and or have the same precedence in CAS because they are parsed with the same parser token in input_parser.yy (%left T_AND_OP), cf. input_lexer.ll Code:
RE: order of logical operations in CAS - Wes Loewer - 10-14-2022 01:36 PM (10-14-2022 06:18 AM)parisse Wrote: Indeed, and and or have the same precedence in CAS ... Okay, that's good to know. Thank you for clarifying. |