Which conditional expression is faster?


Results 1 to 5 of 5

Threaded View

  1. #5
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    Thanks to each and all of you. I appreciate especially the warnings about pitfalls in the summation test; I'll remember those.

    I failed to provide the limits/boundary conditions. I should have qualified the question and put it this way:

    Which of these is faster to execute?

    For A, B, C < 2 (and of course not negative!),

    IF A+B+C=0 THEN . . .

    or

    IF A=0 AND B=0 AND C=0 THEN . . .


    It looks as if Dave assumed the limits I had in mind.

    The reason for my question was that, back in the bad old days, the syntax of conditional statements in FORTRAN IIb (sometimes called "Weather Bureau FORTRAN") was extremely limited, so doing a test like this was easier, if not necessarily faster.

    I happened to try it with PBP in an application, and it worked. I just didn't know how economical it was in terms of generated code. Hence my question.
    Last edited by RussMartin; - 15th February 2009 at 19:30.
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

Similar Threads

  1. conditional defines in PBP?
    By rdxbam in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 13th March 2010, 14:40
  2. Replies: 5
    Last Post: - 28th May 2008, 10:20
  3. interrupt handling faster than if's?
    By mbw123 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 27th October 2006, 01:25
  4. OT - Firefox browser - faster performance
    By malc-c in forum Off Topic
    Replies: 2
    Last Post: - 14th August 2006, 10:33
  5. Conditional Compilation
    By milestag in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd March 2006, 20:29

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts