 Eric Y.

# How do I express that a value needs to be between two separate values (a minimum and a maximum), but should be used as is if it does fall within those limits?

More specifically, I currently have it written as X ≤ Y ≤ Z, but I want to also specify that Y is the default while X and Z only come into effect if Y falls outside of their limit. Or, if more information is needed, this is the formula I have as it currently stands:

Hit rate = ((1 + Attacker's Luk / 25) / 150) ≤ ((1 - (0 ≤ ((Defender's Melee or Pierce or Magic - Attacker's Bonus) / 150) ≤ 1)) * (1 - (0 ≤ ((Defender's Block or Parry or Dodge - Attacker's Bonus) / 150 * (1 - Attacker's Crit / 200)) ≤ 1))) ≤ 0.9933

(Defender's Melee or Pierce or Magic - Attacker's Bonus) / 150) for example needs to be ≤ 1 and ≥ 0 because it's a chance between 0 and 100%, and the final value should be solved down to X ≤ Y ≤ 0.9933, where Y is the final chance to successfully hit and should be the value used unless X is higher or 0.9933 is lower. Mark M.

1) "between" does not include equal, i.e., X < Y < Z.
2) If Y lies between the two values, then how can it be used as if it does?
Report

10/05/18

Eric Y.

Think of X and Z as constraints; Y is solved for and can be equal to one or both of them and still be valid, but if it's not equal to one of them or between the two of them, then it is not a valid result and will not be used, instead the value of the variable that it violates will be used.

For example, I need to illustrate a chance of something happening, so from 0% to 100%; anything outside of those bounds is not a logical result, so I need to show that if the number you solve for IS outside of them, you don't use it. So, say, 0% ≤ 200% ≤ 100%; there can't be a 200% chance of something happening, but the numbers I'm working with to solve the formula allow for this. Thus it would be, in the rest of the formula following this, replaced with the 100% constraint that it violated.

My question is whether there's a way to show this idea within the formula, without a lengthy explanation like this.
Report

10/05/18