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

MD: Math Multiply (Int/Float)

Double it, halve it, or scale any parameter

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

    Of the four basic math nodes in MD Nodes, multiply is the one you'll actually live in. Scaling a value is the most common operation in a parameterized ComfyUI workflow - double the steps, halve the denoise, convert a 0-to-1 control into a 0-to-10 range, or gate a strength by a global multiplier. MD_Math_Multiply does a × b and hands back both an int and a float result, which is the whole selling point.

    You've probably already got a way to multiply in ComfyUI, so let's be honest about when this earns its slot: when you're tired of type-mismatch errors. The dual int_result / float_result outputs mean one node feeds whichever consumer you have - a steps input that wants an INT and a strength input that wants a FLOAT - without a converter in between.

    How it works

    Two FLOAT inputs, a and b. Result is a * b. The int output is the truncated product; the float output is exact. Inputs are full-range floats, so there's nothing to clamp or worry about - it's plain arithmetic in the wrapper.

    The inputs that matter

    • a - the base value being scaled.
    • b - the multiplier. The tooltip's examples are the ones you'll actually use: 2.0 doubles, 0.5 halves. For global-strength scaling, connect a shared multiplier value here so one knob scales everything.

    Outputs: int_result and float_result - take your pick.

    Installing

    It's in the MD Nodes pack:

    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 ComfyUI Manager → MD Nodes → install → restart. Pure Python, no dependencies; it loads fine even if you skip the pack's requirements file (those matter for the audio and plotting nodes).

    Common issues

    Two things worth knowing. First, the int result truncates: 1.5 × 2.1 gives 3, not 4. If a downstream INT input is rounding-sensitive, feed it the float and let it convert, or the truncation will bite you. Second, don't over-reach on a single multiplier - if you're scaling several different kinds of parameters with one shared value, a b that's perfect for one range will be nonsense for another. The pack's LFO generator or a per-parameter multiply node is the better home for sweeping things; this node is for the steady, per-value scale.

    CategoryMD_Nodes/Math

    Inputs (2)

    NameTypeDefaultDescription
    aFLOAT1.00-1.797e+308–1.797e+308VALUE A (PRIMARY) • Purpose: The first factor. • Range: Full float range. ⭐ Base value for scaling.
    bFLOAT1.00-1.797e+308–1.797e+308VALUE B (MULTIPLIER) • Purpose: The scaling factor. • Range: Full float range. ⭐ Recommended: 2.0 (Double), 0.5 (Half).

    Outputs (2)

    NameTypeDescription
    int_resultINT
    float_resultFLOAT