ComfyUI Node

2🐕+-x÷

A basic calculator node, inline in your graph

By 11dogzi·Created 2 years ago·Updated 2 years ago· 102
2🐕+-x÷
    • result_int
    • result_float
    • result_str
    number1
    operation
    number2

    This isn't a subtle node and it doesn't need to be. +-x÷ is a four-function calculator that lives inside your ComfyUI graph: two numbers in, an operator, one of three typed results out. If you've ever needed to derive a batch count from a width, or offset a seed by a fixed amount, or scale a strength value by some other number that's itself coming out of another node, this is the thing that saves you from doing the math in your head and typing a hardcoded number.

    Worth setting expectations here: this is a small, unglamorous pack with almost no footprint in English-language ComfyUI discussion. If you get stuck, don't count on finding a tutorial thread - the schema and the README are pretty much the whole documentation surface for these utility nodes.

    How it works

    The two operands, number1 and number2, are typed as multiline STRING fields rather than raw numbers - which matters, because it means you can either type a literal number directly or wire in text output from some other node (say, the result of the pack's own text-splicing nodes, or a value read out of a filename) and have it parsed as a number at execution time. operation is a dropdown of the four basics: +, -, x, ÷.

    Outputs

    You get all three flavors back regardless of which one you actually need: result_int, result_float, and result_str. Grab whichever matches the socket you're feeding downstream - no separate conversion step required, unlike most math nodes that commit to one output type and make you convert afterward.

    Installing it

    ComfyUI Manager: search "Comfyui-ergouzi-Nodes" and install. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/11dogzi/Comfyui-ergouzi-Nodes.git
    

    Restart ComfyUI. No models, no dependencies beyond what ComfyUI already has - it's arithmetic. Same caveat as the rest of the pack: this English repo isn't getting new features; the author's active work is in a separate, Chinese-first sibling repo.

    Common issues & troubleshooting

    Division by zero. ÷ with a number2 of 0 is the one input combination guaranteed to blow up any calculator node, this one included - if your graph is generating number2 dynamically from somewhere upstream, make sure it can't land on zero.

    Result looks wrong and it turns out to be a string comparison, not a math error. Because both operands are STRING-typed, it's easy to accidentally feed in something that looks numeric but has stray whitespace or a non-numeric character attached (a unit suffix, a trailing comma from a splicing node) - that will fail to parse as a number rather than silently producing a wrong result, so check the exact text going into number1/number2 if you're getting an error rather than just a surprising number.

    You only need one of the three output types. That's fine - you're not obligated to wire up all three, just take the one you need and leave the rest unconnected.

    Category2🐕/🔢number

    Inputs (3)

    NameTypeDefaultDescription
    number1STRING
    operationCOMBO4 options: +, -, x, ÷
    number2STRING

    Outputs (3)

    NameTypeDescription
    result_intINT
    result_floatFLOAT
    result_strSTRING