Post Reply 
Checking conditions [IF ... THEN ... ELSE] performance
09-15-2015, 05:25 AM
Post: #8
RE: Checking conditions [IF ... THEN ... ELSE] performance
Hello,

You are correct. All parameters are evaluated FIRST and then the AND operation is 'calculated'.

a statement of the form
a AND b AND c
will be represented as an evaluation tree of the form (in LISP)
(AND a, AND(b, c))

It will cause a to be evaluated, then b, then c, then the b AND c will be calculated, and finally the a AND result of AND(b,c)...
You can check that by replacing a, b and c by function call that print something on the screen and looking at the print order.

This difears from C type programming languages which do have OR/AND operator short circuiting.

This feels correct for math operation, but it is true that it is not optimal from a programming performance point of view.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Checking conditions [IF ... THEN ... ELSE] performance - cyrille de brébisson - 09-15-2015 05:25 AM



User(s) browsing this thread: 1 Guest(s)