NarraLeaf

Math

Arithmetic, rounding, randomness, boolean logic, and comparison — the pure value nodes.

Math is where a value gets worked out rather than stored: arithmetic, rounding, min and max, random numbers, boolean logic, and comparison. You reach for these whenever something downstream needs a number or a condition — an If branch in Flow, a widget size, the next value of a counter. The palette folds the Boolean and Compare node groups into this category as well, so all three are documented here.

Conventions

  • Every node on this page is Pure. None of them has an exec pin. Each computes when something reads its result, and each is legal in event, function and macro graphs, and inside a Blueprint Value.
  • Nothing is cached. A node runs again on every read, so two edges out of one node evaluate it twice. Harmless for +; not harmless for Random Float.
  • A wired edge beats the card field. Pins marked Accepts an on-card literal draw a field on the node card, and that field is read only while the pin has no edge.
  • Anything that is not a finite number reads as NaN. A numeric pin takes a finite number as-is, true and false as 1 and 0, and a numeric string by parsing it. Everything else — null, an empty card field, Infinity — is NaN, and a node handed NaN outputs NaN. One missing operand turns every result downstream of it into NaN.
  • integer flows into float, never the reverse. Round, Floor and Ceil output integer, which connects to any float input; a float output will not connect to an integer input. Both connect to a string input, which is how a computed number reaches Log.

Arithmetic

Two operands in, one number out.

PinDirectionTypeNotes
ain · datafloatAccepts an on-card literal.
bin · datafloatAccepts an on-card literal.
resultout · datafloat
NodeTypeResult
+blueprint.math.adda plus b, plus any further operands.
blueprint.math.subtracta minus b.
×blueprint.math.multiplya times b.
÷blueprint.math.dividea divided by b.
Moduloblueprint.math.moduloThe remainder of a divided by b, carrying the sign of a: −7 and 3 give −1, not 2.

+ is the only one of the five that takes more than two operands. The add-input control on its card appends in_1, in_2, … , labelled Input 3 onward, and the node sums every data input it has. The table above lists only the two pins it starts with.

÷ does not guard its divisor. Dividing by zero produces Infinity or −Infinity, and 0 ÷ 0 produces NaN. Neither survives the next node — a non-finite number reads as NaN everywhere on this page — so the fault surfaces several nodes away from the division that caused it. Compare the divisor against 0 first.

Rounding and sign

One operand in, one number out.

PinDirectionTypeNotes
valuein · datafloatAccepts an on-card literal.
resultout · datafloat or integerRound, Floor and Ceil output integer; the other three output float.
NodeTypeResult
+1blueprint.math.incrementvalue plus one.
−1blueprint.math.decrementvalue minus one.
Absblueprint.math.absThe magnitude of value, sign dropped.
Roundblueprint.math.roundThe nearest integer. Halves round upward, so 2.5 becomes 3 and −2.5 becomes −2.
Floorblueprint.math.floorThe largest integer no greater than value.
Ceilblueprint.math.ceilThe smallest integer no less than value.

+1 and −1 compute; they do not store. Advancing a counter is still Get Var into +1 into Set Var — see Variables.

Min and Max

PinDirectionTypeNotes
ain · datafloatAccepts an on-card literal.
bin · datafloatAccepts an on-card literal.
resultout · datafloat
NodeTypeResult
Minblueprint.math.minThe smallest of its operands.
Maxblueprint.math.maxThe largest of its operands.

Both take further operands the way + does: the add-input control appends in_1, in_2, … , and the comparison covers every data input on the node, not just the two above. If any one operand is not a finite number the node outputs NaN — it does not drop the bad operand and compare the rest.

Random Float

blueprint.math.randomFloat · Pure

PinDirectionTypeNotes
minin · datafloatAccepts an on-card literal. Falls back to 0 when it is not a number.
maxin · datafloatAccepts an on-card literal. Falls back to 1 when it is not a number.
resultout · datafloat

Uniform over [min, max): min can come out, max cannot. The two bounds are sorted before use, so wiring the larger number into min gives the same range rather than an error or an empty one.

Random Integer

blueprint.math.randomInteger · Pure

PinDirectionTypeNotes
minin · dataintegerAccepts an on-card literal. Falls back to 0 when it is not a number.
maxin · dataintegerAccepts an on-card literal. Falls back to 1 when it is not a number.
resultout · datainteger

Uniform over the whole numbers from min to max, both ends included1 and 6 is a die, not a five-sided one. The bounds are sorted, then pulled inward to whole numbers (min up, max down); if that leaves nothing between them, the result is min rounded up.

Neither random node takes a seed, and neither result is remembered. Every read re-rolls: one Random Integer wired to two pins hands each of them a different number, and reading it again later gives another. Write the roll into a variable when the same number has to be used twice.

Boolean

Inputs here are boolean and take no card literal, so both operands have to be wired; an unwired boolean pin reads as false.

PinDirectionTypeNotes
ain · databooleanLabelled Value on Not.
bin · databooleanNot does not have this pin.
resultout · databoolean
NodeTypeResult
Andblueprint.boolean.andTrue when both operands are true.
Orblueprint.boolean.orTrue when either operand is true.
Notblueprint.boolean.notThe inverse of a.
Xorblueprint.boolean.xorTrue when exactly one operand is true.

A non-boolean input is coerced rather than refused. A finite non-zero number is true, 0 is false, and Infinity is false. Strings are trimmed and matched case-insensitively: "true", "1" and "yes" are true; "", "false", "0" and "no" are false; every other non-empty string is true.

Compare

Equal and Not Equal take any on both sides and compare with JavaScript === and !==, without coercion. The number 1 and the string "1" are not equal, and two separately built arrays with identical contents are not equal either — identity is what is being tested.

PinDirectionTypeNotes
ain · dataany
bin · dataany
resultout · databoolean
NodeTypeResult
Equalblueprint.compare.equalTrue when a and b are strictly equal.
Not Equalblueprint.compare.notEqualTrue when they are not.

Neither pin accepts a card literal, and an unwired one resolves to nothing at all — so an Equal with both pins empty compares nothing against nothing and reports true. Wire both sides.

The four numeric comparisons take float instead, and coerce the way the rest of the page does.

PinDirectionTypeNotes
ain · datafloatAccepts an on-card literal.
bin · datafloatAccepts an on-card literal.
resultout · databoolean
NodeTypeResult
Greater Thanblueprint.compare.greaterThana is above b.
Greater Than Or Equalblueprint.compare.greaterThanOrEquala is above or level with b.
Less Thanblueprint.compare.lessThana is below b.
Less Than Or Equalblueprint.compare.lessThanOrEquala is below or level with b.

When either operand fails to resolve to a finite number, all four output false. A comparison and its opposite are then both false, so never treat one as the negation of the other: invert with Not rather than by picking the opposite node.

Symbol comparisons

The older comparison set, kept registered because existing graphs use it. Same shape as the numeric Compare nodes, different rules.

PinDirectionTypeNotes
ain · datafloatAccepts an on-card literal.
bin · datafloatAccepts an on-card literal.
resultout · databoolean
NodeTypeResult
=blueprint.math.equalThe two numbers are equal.
blueprint.math.notEqualThey are not.
<blueprint.math.lessa is below b.
blueprint.math.lessOrEquala is below or level with b.
>blueprint.math.greatera is above b.
blueprint.math.greaterOrEquala is above or level with b.

Both operands are coerced to numbers first, so = finds the number 1 and the string "1" equal where Equal does not. Choose by the question you are asking: = for numeric equality, Equal for identity.

When either operand is not a number, outputs true and the other five output false.

On this page