KJNodes/miscgenerated

Simple Calculator KJ(SimpleCalculatorKJ)

It works through a customizable expression box, where you can use predefined variables (such as a, b, c) and a rich set of operators (addition, subtraction, multiplication, division, comparison, logical operations) as well as mathematical functions (such as sin, sqrt, round) to construct formulas.

Simple Calculator KJ

variables
FLOAT
INT
BOOLEAN
expression
a + b
KJNodes

The Simple Calculator KJ node operates through a customizable expression box, allowing you to build formulas using predefined variables (such as a, b, c), a rich set of operators (addition, subtraction, multiplication, division, comparison, logical operations), and mathematical functions (e.g., sin, sqrt, round).

The Simple Calculator KJ node allows you to write mathematical or logical expressions directly within your workflow and dynamically compute results, offering great flexibility for parameter control.

Node Functionality

It works via a customizable expression box where you can construct formulas using predefined variables (e.g., a, b, c), a rich set of operators (addition, subtraction, multiplication, division, comparison, logical operations), and mathematical functions (e.g., sin, sqrt, round). The node provides three outputs: FLOAT, INT, and BOOLEAN, each containing the result of the expression cast to that type. Depending on the result type of the expression, the relevant output(s) will hold the value, but all outputs are available for use. The expression input defaults to "a + b".

Use Cases

The Simple Calculator KJ is very useful when you need to calculate a new control parameter based on the output values from other nodes, such as adding two input values and then multiplying by a coefficient. It can also be used to create conditional logic, for example, determining whether a value exceeds a threshold to decide different branches of the workflow. Additionally, performing complex mathematical transformations, such as using trigonometric functions to generate waveform data, is a typical application scenario.

Notes

Please note when using it that the variable names (a, b, c...) in the expression must correspond to the order and quantity of variables actually connected in the "variables" input box below; otherwise, it may lead to calculation errors or failure to execute. Although powerful, avoid writing overly complex or lengthy expressions to maintain the readability of your workflow.

The Simple Calculator KJ node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…