DRAGOPS
DRAGOPS
DocumentationNode libraryMath

Math

Arithmetic, rounding, interpolation, range mapping, and random number generation nodes.

Math nodes perform numeric computations — from basic arithmetic to interpolation, clamping, and random number generation. All Math nodes are pure (blue header, no execution pins). They evaluate inline whenever a downstream node reads their output.


Add

Add two numbers.

PinDirectionTypeDescription
AInputFloatFirst operand
BInputFloatSecond operand
ResultOutputFloatSum of A and B

Pure. Use Add to combine numeric values — totaling scores, calculating offsets, or building sums.


Subtract

Subtract B from A.

PinDirectionTypeDescription
AInputFloatFirst operand
BInputFloatSecond operand
ResultOutputFloatA minus B

Pure. Use Subtract to compute differences — time deltas, remaining capacity, or balance changes.


Multiply

Multiply two numbers.

PinDirectionTypeDescription
AInputFloatFirst operand
BInputFloatSecond operand
ResultOutputFloatProduct of A and B

Pure. Use Multiply for scaling values, computing areas, or applying percentage multipliers.


Divide

Divide A by B.

PinDirectionTypeDescription
AInputFloatDividend
BInputFloatDivisor
ResultOutputFloatA divided by B

Pure. Use Divide for calculating averages, ratios, or per-unit costs.


Modulo

Get the remainder of dividing A by B.

PinDirectionTypeDescription
AInputFloatDividend
BInputFloatDivisor
ResultOutputFloatRemainder of A / B

Pure. Use Modulo for cycling values, checking even/odd, or distributing items across buckets.


Power

Raise a number to a power.

PinDirectionTypeDescription
BaseInputFloatThe base number
ExponentInputFloatThe exponent
ResultOutputFloatBase raised to Exponent

Pure. Use Power for exponential calculations — compound growth, squared distances, or backoff multipliers.


Absolute Value

Get the absolute (non-negative) value of a number.

PinDirectionTypeDescription
ValueInputFloatThe input number
ResultOutputFloatAbsolute value

Pure. Use Absolute Value to ensure a result is positive — computing distances or magnitudes regardless of sign.


Round

Round a number to a specified number of decimal places.

PinDirectionTypeDescription
ValueInputFloatThe number to round
DecimalsInputIntegerDecimal places (default: 0)
ResultOutputFloatRounded value

Pure. Use Round to clean up floating-point results for display or comparison.


Floor

Round down to the nearest integer.

PinDirectionTypeDescription
ValueInputFloatThe number to floor
ResultOutputIntegerLargest integer less than or equal to Value

Pure. Use Floor to truncate decimal values downward — calculating page numbers or whole-unit quantities.


Ceil

Round up to the nearest integer.

PinDirectionTypeDescription
ValueInputFloatThe number to ceil
ResultOutputIntegerSmallest integer greater than or equal to Value

Pure. Use Ceil to round up — calculating how many batches are needed to cover all items.


Min

Get the smallest value in an array.

PinDirectionTypeDescription
ArrayInputArrayArray of numbers
ResultOutputFloatThe smallest value

Pure. Use Min to find the lowest score, earliest timestamp as epoch, or minimum threshold.


Max

Get the largest value in an array.

PinDirectionTypeDescription
ArrayInputArrayArray of numbers
ResultOutputFloatThe largest value

Pure. Use Max to find the highest severity, latest value, or maximum reading.


Clamp

Constrain a value within a minimum and maximum range.

PinDirectionTypeDescription
ValueInputFloatThe value to clamp
MinInputFloatLower bound (default: 0)
MaxInputFloatUpper bound (default: 1)
ResultOutputFloatValue clamped to [Min, Max]

Pure. Use Clamp to enforce boundaries — keeping a confidence score between 0 and 100, or limiting retry counts.


Map Range

Remap a value from one numeric range to another.

PinDirectionTypeDescription
ValueInputFloatThe value to remap
In MinInputFloatSource range minimum (default: 0)
In MaxInputFloatSource range maximum (default: 1)
Out MinInputFloatTarget range minimum (default: 0)
Out MaxInputFloatTarget range maximum (default: 100)
ResultOutputFloatRemapped value

Pure. Use Map Range to convert between scales — normalizing sensor readings or converting scores to percentages.


Lerp

Linear interpolation between two values.

PinDirectionTypeDescription
AInputFloatStart value
BInputFloatEnd value
AlphaInputFloatInterpolation factor 0-1 (default: 0.5)
ResultOutputFloatInterpolated value

Pure. Use Lerp to blend between two values — transitioning thresholds or computing weighted averages.


Inverse Lerp

Find the alpha position of a value between two bounds. The inverse of Lerp.

PinDirectionTypeDescription
AInputFloatLower bound
BInputFloatUpper bound
ValueInputFloatThe value to locate
ResultOutputFloatAlpha position (0 = at A, 1 = at B)

Pure. Use Inverse Lerp to determine where a value falls within a known range.


Negate

Flip the sign of a number.

PinDirectionTypeDescription
ValueInputFloatThe number to negate
ResultOutputFloatValue with opposite sign

Pure. Use Negate to reverse direction or convert between positive and negative representations.


Sign

Get the sign of a number as -1, 0, or 1.

PinDirectionTypeDescription
ValueInputFloatThe number to check
ResultOutputInteger-1 (negative), 0 (zero), or 1 (positive)

Pure. Use Sign to determine direction or classify a value as negative, zero, or positive.


Square Root

Calculate the square root of a number.

PinDirectionTypeDescription
ValueInputFloatThe number
ResultOutputFloatSquare root of Value

Pure. Use Square Root for distance calculations or mathematical formulas.


Logarithm

Calculate the logarithm of a value with a configurable base.

PinDirectionTypeDescription
ValueInputFloatThe number
BaseInputFloatLogarithm base (default: 10)
ResultOutputFloatLogarithm of Value

Pure. Use Logarithm for exponential decay calculations, scoring algorithms, or data normalization.


Random

Generate a random integer within a range (inclusive).

PinDirectionTypeDescription
MinInputIntegerLower bound (default: 0)
MaxInputIntegerUpper bound (default: 100)
ResultOutputIntegerRandom integer in [Min, Max]

Pure. Use Random for jitter in retry delays, selecting random samples, or generating test data.


Snap

Snap a value to the nearest multiple of a step size.

PinDirectionTypeDescription
ValueInputFloatThe value to snap
StepInputFloatStep size (default: 1)
ResultOutputFloatNearest multiple of Step

Pure. Use Snap to quantize values — rounding timestamps to the nearest minute or prices to the nearest cent.


Wrap

Wrap a value around a range using modular arithmetic.

PinDirectionTypeDescription
ValueInputFloatThe value to wrap
MinInputFloatRange minimum (default: 0)
MaxInputFloatRange maximum (default: 360)
ResultOutputFloatValue wrapped into [Min, Max)

Pure. Use Wrap for cyclic values — keeping angles within 0-360 or hours within 0-24.


  • Comparison — compare computed math results to thresholds
  • Type Conversion — convert between integers, floats, and strings
  • Array — use math results with array operations like sort or reduce

On this page