Bottom (CNS) (Read 1339 times)

Started by Ricepigeon, September 14, 2015, 08:47:20 pm
Share this topic:
Bottom (CNS)
New #1  September 14, 2015, 08:47:20 pm
  • *****
  • Gaps? Where we're going, we don't need gaps...
    • USA
Bottom is a special value used by the MUGEN engine that is returned whenever an expression would otherwise cause an unrecoverable error during computation. Examples of such expressions include division by zero, evaluating the square root of a negative number, or a trigger that redirects to a nonexistent location (e.g.: using helper(2010),stateno when no helper with an ID of 2010 exists). In these cases, condition-type triggers will consider "bottom" equivalent to 0 (boolean value for false), and thus will never trigger. A debug error will also be produced in the MUGEN engine's debug console.

5 + fvar(0) ** 0.5

In the above, if fvar(0) were equal to a negative number, such as -1, then the expression would equate to 5 + sqrt(-1). However, since the square root of negative numbers are mathematically undefined, the equation would return 5 + bottom, which would return bottom as its final result.

[State 200, VS]
type = varset
trigger1 = (2 / time) < 100
var(0) = 1

In the above expression, if time = 0, then trigger1 would evaluate to bottom < 100, since division by 0 is mathematically undefined, thus returning bottom. Since we are using a conditional trigger here that is comparing the value of (2 / time) to 100, bottom will cause the entirety of our trigger1 to equate to 0. Since 0 is boolean for false, our varset SCTRL will never activate when time = 0.

Do note that with the exception of the Cond and IfElse triggers, the entirety of the expression's value will equate to bottom, causing a debug error to be logged into the MUGEN engine's console.
Last Edit: September 18, 2015, 02:50:46 pm by Just No Point
Re: Bottom (CNS)
#2  September 14, 2015, 11:55:46 pm
  • ******
  • [E]
    • Mexico
as a side note in some version of the mugen docs bottom is also called sfalse; it's still the same thign being discuddes here, same rules, etc... just an alt name.