View Poll Results: Which of the poll expressions will provide a different answer ?

Voters
5. You may not vote on this poll
  • ( 45 * ( 9 - 5 + 8 ) - 36 / 4 )

    1 20.00%
  • ( 45 * ( 9 - ( 5 + 8 ) ) - 36 / 4 )

    4 80.00%
  • ( 45 * ( 9 - 5 + 8 ) - ( 36 / 4 ) )

    0 0%
  • ( 45 * ( ( 9 - 5 ) + 8 ) - 36 / 4 )

    0 0%
Results 1 to 6 of 6

Thread: Operators precedences

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Operators precedences

    Which of the poll expressions will provide a different answer ?

    3 out 4 of the above expressions will return the same result.
    1 out of 4 will return a different result

    Reply quickly without looking at other's posts :)
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    I think the different one should be #2, because of the ( 9 - ( 5 + 8 ) ) member... such a brain damaging task in the morning...

    The first part of the expression (45*) is the same, the middle one (with 9,5, differs in the second formula and the last one (36,4) is the same, because "/" has bigger priority than "-", so brackets make no difference.


    Petr
    Last edited by Petr Schreiber; 07-02-2013 at 10:17.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10


    Of course this forum is just an "excuse" (I hope an enjoyable "excuse") to activate some interest in different matters all of you are interested in.
    Not great complication, just little "How to ...", "do you know ...", "are you able to ...", ...
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  4. #4
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,530
    Rep Power
    171
    I knew the solution and voted right - before your spoilers appeared. Now I just ask myself - who of you both, Petr or John voted the wrong result?
    When I voted, mine was the second vote, the first was of Eros since that time no other users who read this thread were displayed.
    There are four votes right now: 3 (75%) for the right solution, 1 (25%) was wrong.
    Now each of you (presumed you are the voters) knows, who did the wrong guess since I know that mine and Eros are right.
    If one of you did not vote yet - you should do it now and clear yourself from my suspicions
    I think there are missing some Forum-sections as beta-testing and support

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    ......

    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  6. #6
    It took a few seconds and I needed to delve into the memory banks for computational priority (don't know if that's a real term, but it sounds intelligent), then the inner parenthesis gave me the clue to go with #2.

    Now I'll go take a nap, as too much thinking is not a good thing at my age. As witnessed by me taking months trying to work out a looping routine, but I'll get there some day.

    Lance

Similar Threads

  1. Help file: Comparison operators
    By Petr Schreiber in forum Fixed or cleared errors in help material
    Replies: 2
    Last Post: 25-10-2012, 22:52
  2. New Data Types and Operators
    By Charles Pegge in forum O2h Compiler
    Replies: 0
    Last Post: 23-03-2009, 15:19
  3. bitwise operators
    By sandyrepope in forum UI (User Interface)
    Replies: 8
    Last Post: 14-03-2007, 04:43

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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