Jump to content

how are the calculations of math formulas sequenced?


SonOfCapiz

Recommended Posts

In this formula:

 

set x to (75 - 1.5 (50 - 25))

 

Is it calculated as:

a) (75 - 1.5(25)) => (75 - 37.5) => 37.5 (btw this is the result i want so please tell me how to write this properly)

b) (75 - 1.5 * 50 - 25) => 73.5 * 50 - 25 => 3675 - 25 => 3650

 

In other words, can you control the sequence by the ()? or is

1) 75 - 1.5*50-25

2) (75 - 1.5)(50-25)

3) 75 - (1.5 * 50) - 25

the same?

 

I ask because of the way AND and OR is handled, in that OR sequences are lumped together such that (A & B) OR (C & D) is actually A and (B OR C) & D regardless of the ().

 

EDIT:

and is ((GetRandomPercent +1) / 50) + (Player.GetAV Survival / 50) going to do:

1) (GetRandomPercent + 1) first; then

2) divide the result by 50; then

3) add the result to Player.GetAV Survival / 50

Edited by SonOfCapiz
Link to comment
Share on other sites

set x to (75 - 1.5 (50 - 25))

Is it calculated as:

a) (75 - 1.5(25)) => (75 - 37.5) => 37.5 (btw this is the result i want so please tell me how to write this properly)

b) (75 - 1.5 * 50 - 25) => 73.5 * 50 - 25 => 3675 - 25 => 3650

Parentheses always control the order of operations. In your example you are missing the multiplication symbol *. To get 37.5 you write:

set x to 75 - (1.5 * (50 - 25))

I ask because of the way AND and OR is handled, in that OR sequences are lumped together such that (A & B) OR (C & D) is actually A and (B OR C) & D regardless of the ().

I am not sure where this example comes from. Any language which has parentheses will honor them, and will not regroup as you have described. When you are writing multiple conditions for a dialog topic, there is an "OR" button you can check. I am sure it is documented somewhere but I am uncertain of the order of operations for these "OR" buttons. However, that is because the conditions are separate items in a list. If you can write parentheses, the grouping you write is always the grouping you get.

is ((GetRandomPercent +1) / 50) + (Player.GetAV Survival / 50) going to do:

1) (GetRandomPercent + 1) first; then

2) divide the result by 50; then

3) add the result to Player.GetAV Survival / 50

Yes.

Edited by davidlallen
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...