Nodes/MD Nodes/MD: Math Add (Int/Float)
ComfyUI Node

MD: Math Add (Int/Float)

Get both the int and the float result

By MDMAchine·Created about a year ago·Updated 3 months ago· 15
MD: Math Add (Int/Float)
    • int_result
    • float_result
    a0.00
    b0.00

    MD_Math_Add is one of four basic math nodes in MD Nodes - add, subtract, multiply, divide - and it does exactly what the name says: adds two numbers. The one feature that earns it a second look is that it gives you both an integer result and a float result from the same inputs, so you never have to guess which type the next node wants.

    In the ComfyUI world of parameter automation - where you're computing a denoise from a step count, a latent size from an aspect ratio, or a batch offset from a counter - this kind of plumbing node is everywhere. ComfyUI's built-in math nodes exist, but they often lock you into one output type. A node that hands you both, cleanly, removes a whole class of "wait, it's an INT?" type-mismatch errors.

    How it works

    It takes two numeric inputs, a and b (FLOAT-typed, but any INT output plugs right in), and returns a + b as both an int_result (truncated) and a float_result (exact). Wire whichever one your consumer node accepts. The inputs are full-range floats, so it handles everything from step counts to small percentages without surprise.

    The inputs that matter

    • a - the primary value. The tooltip's point about connecting any INT or FLOAT output here is the real use case: it's a converter-as-much-as-an-adder.
    • b - the addend.

    Outputs: int_result and float_result. That's the whole surface area - there's nothing else to fiddle with, which is the point of a utility node.

    Installing

    It's part of MD Nodes, so you install the pack once:

    cd path/to/ComfyUI/custom_nodes
    git clone https://github.com/MDMAchine/ComfyUI_MD_Nodes.git
    cd ComfyUI_MD_Nodes
    pip install -r requirements.txt
    

    Or via ComfyUI Manager, search MD Nodes, install, restart. This node is pure Python with zero extra dependencies - it loads fine even if you skip the requirements install (the pack's audio nodes are the ones that need the heavy libraries).

    Common issues

    The honest take: for a single addition you probably already have a way to do this, so the question is whether the dual int/float output is worth swapping for. It is, if you find yourself hitting type errors - grab both outputs and stop caring which one a node accepts. One caveat: the int result truncates rather than rounds, so 2.9 + 2.1 gives you 4, not 5. If rounding matters, keep the float result and let the downstream node do its own conversion.

    CategoryMD_Nodes/Math

    Inputs (2)

    NameTypeDefaultDescription
    aFLOAT0.00-1.797e+308–1.797e+308VALUE A (PRIMARY) • Purpose: The first number to add. • Range: Full float range. ⭐ Connect any INT or FLOAT output here.
    bFLOAT0.00-1.797e+308–1.797e+308VALUE B (ADDEND) • Purpose: The value added to A. • Range: Full float range. ⭐ Standard addition operation.

    Outputs (2)

    NameTypeDescription
    int_resultINT
    float_resultFLOAT