Math: Arithmetic

This page documents the development version of Graphite at dev.graphite.art, which may differ from the current release.

Nodes in this category perform common arithmetic operations on numerical values (and where applicable, vec2 values).

Nodes

NodeDetailsPossible Types
Add

The addition operation (+) calculates the sum of two scalar numbers or vec2s.

Number → Number
Number[] → Number[]
Integer → Integer
Integer[] → Integer[]
Vec2 → Vec2
Vec2[] → Vec2[]
Number → Vec2
Number[] → Vec2[]
Divide

The division operation (÷) calculates the quotient of two scalar numbers or vec2s.

Produces 0 for any division by 0. With vec2 inputs, this applies separately to the X and Y components.

Number → Number
Number[] → Number[]
Integer → Integer
Integer[] → Integer[]
Vec2 → Vec2
Vec2[] → Vec2[]
Number → Vec2
Number[] → Vec2[]
Exponent

The exponent operation (^) calculates the result of raising a number to a power.

With vec2 inputs, this applies separately to the X and Y components.

Number → Number
Number[] → Number[]
Integer → Integer
Integer[] → Integer[]
Vec2 → Vec2
Vec2[] → Vec2[]
Number → Vec2
Number[] → Vec2[]
Logarithm

The logarithmic function (log) calculates the logarithm of a number with a specified base. If the natural logarithm function (ln) is desired, set the base to "e".

With vec2 inputs, this applies separately to the X and Y components.

Number → Number
Number[] → Number[]
Vec2 → Vec2
Vec2[] → Vec2[]
Number → Vec2
Number[] → Vec2[]
Modulo

The modulo operation (%) calculates the remainder from the division of two scalar numbers or vec2s.

The sign of the result shares the sign of the numerator, or of the modulus if Always Positive is enabled.

Number → Number
Number[] → Number[]
Integer → Integer
Integer[] → Integer[]
Vec2 → Vec2
Vec2[] → Vec2[]
Number → Vec2
Number[] → Vec2[]
Multiply

The multiplication operation (×) calculates the product of two scalar numbers, vec2s, or transforms.

Number → Number
Number[] → Number[]
Integer → Integer
Integer[] → Integer[]
Vec2 → Vec2
Vec2[] → Vec2[]
Number → Vec2
Number[] → Vec2[]
Transform → Transform
Transform[] → Transform[]
Reciprocal

The reciprocal operation (1/x) calculates the multiplicative inverse of a number.

Produces 0 if the input is 0. With a vec2 input, this applies separately to the X and Y components.

Number → Number
Number[] → Number[]
Vec2 → Vec2
Vec2[] → Vec2[]
Root

The nth root operation (√) calculates the inverse of exponentiation. Square root inverts squaring, cube root inverts cubing, and so on.

This is equivalent to raising the number to the power of 1/n. With vec2 inputs, this applies separately to the X and Y components.

Number → Number
Number[] → Number[]
Vec2 → Vec2
Vec2[] → Vec2[]
Number → Vec2
Number[] → Vec2[]
Subtract

The subtraction operation (-) calculates the difference between two scalar numbers or vec2s.

Number → Number
Number[] → Number[]
Integer → Integer
Integer[] → Integer[]
Vec2 → Vec2
Vec2[] → Vec2[]
Number → Vec2
Number[] → Vec2[]
Sum

Adds together all the numbers in the input list, producing their total.

Number[] → Number