Simple Math Operations
Simple math that doubles as a type converter
- INT
- FLOAT
- STRING
Core ComfyUI gives you primitives, not arithmetic. Want to compute a latent size or a denoise value from two inputs? You're usually chaining a couple of Int/Number nodes and fighting float-versus-int conversions. NoxinSimpleMath collapses that into one node: two int boxes, two float boxes, two string boxes, and an operation - add, subtract, multiply, divide - and it hands you the result as an INT, a FLOAT, and a STRING at once. The author's pitch is that it does "simple math and conversion things," and the second half is the sleeper feature: because every operation emits all three types, the node doubles as a converter. Pass a value through with an ADD 0 and you've got it re-cast to whatever socket type you need.
How you drive it:
VAL1SRCandVAL2SRCeach pick which of the three types the first and second operand come from - INT, FLOAT, or STRING. String values are parsed withfloat(), so"12.5"works and"banana"does not.OPERATIONpicks ADD, SUB, MUL, or DIV.- The math itself runs as float, and the outputs are the result re-cast: INT gets
int(result), FLOAT getsfloat(result), STRING getsstr(result).
Two things the README tells you in advance, because they're the failure modes: there's no error protection - "watch those 0s" is the author's exact phrasing - so dividing by zero throws a plain ZeroDivisionError right in the console. And a non-numeric string raises ValueError. Neither is a subtle bug; they're loud and obvious, which is honestly fine for a utility node.
The subtler one nobody warns you about: int() truncates, it doesn't round. So 5 ÷ 2 gives INT 2, FLOAT 2.5, STRING "2.5". If you're wiring the INT output into something that wants an integer seed or step count, know that floor is coming. If you wanted a rounded int, add 0.5 to the value first, or just take the FLOAT output and let the next node do its own thing.
This is the kind of node that slots into a pack nobody installs for fame - it's a "I made this for me" utility, the same framing as the rest of ComfyUI_NoxinNodes. It earns its place when you're building a parameterised workflow and want one widget that both computes and converts instead of a tangle of primitives.
Install is the standard one for this pack, and it's the easiest kind: pure standard-library Python, no requirements.txt, no models to fetch.
cd ComfyUI/custom_nodes
git clone https://github.com/noxinias/ComfyUI_NoxinNodes.git
Restart, and "Simple Math Operations" appears under NoxinNodes. The pack is early and updates often - if you'd rather it never change under a saved workflow, delete the .git folder after cloning, per the README's own advice.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| INT1 | INT | 0 | — |
| INT2 | INT | 0 | — |
| FLOAT1 | FLOAT | 0.00 | — |
| FLOAT2 | FLOAT | 0.00 | — |
| STRING1 | STRING | 0 | — |
| STRING2 | STRING | 0 | — |
| VAL1SRC | COMBO | 3 options: INT, FLOAT, STRING | |
| VAL2SRC | COMBO | 3 options: INT, FLOAT, STRING | |
| OPERATION | COMBO | 4 options: ADD, SUB, MUL, DIV |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |
| FLOAT | FLOAT | — |
| STRING | STRING | — |