Nodes/CalculatorPro - Node Suite for ComfyUI/🧮 Calculatrice Scientifique
ComfyUI Node

🧮 Calculatrice Scientifique

The node for when 1/3 should drive your denoise

By orion4d·Created about a year ago·Updated about a year ago· 0
🧮 Calculatrice Scientifique
    • result
    • output_str
    a0.00
    b0.00
    c0.00
    functiona+b

    You've hit the wall that makes people leave ComfyUI for a week: a KSampler wants a denoise of 0.333, but you're not allowed to type an expression into its widget. ComfyUI's number boxes are dumb text fields - no calculator, no formulas. This node from the CalculatorPro pack is the fix: three number inputs, a dropdown of 47 functions, and a FLOAT output you can wire straight into any numeric input on the graph.

    What it actually is

    🧮 Calculatrice Scientifique (the pack's UI is in French - more on that below) is a three-operand scientific calculator that lives inside your workflow. Inputs a, b, and c are FLOATs, and the function dropdown picks what happens to them. It's not a generic expression parser; the author hardcoded a list of 47 named operations into the node's source. That's a real limitation - you get exactly the list, no arbitrary a * (b + c) - but for 95% of "I need a number computed here" cases it's enough.

    What you can do with those three values:

    • Pairwise arithmetic: a+b, a-b, a*b, a/b, a^b, a mod b (and the same combos on a+c, b+c, and so on).
    • Three-value shortcuts: a+b+c, a*b*c.
    • min(a,b), max(a,b) and every other pair.
    • One-arg math applied to any of the three: sin, cos, tan, sqrt, log, abs, round.

    The README's flagship example is the good one: compute 1 / 3 and wire result into the KSampler's denoise. Change a or b and your denoise changes with it - no editing a decimal in a widget by hand, and if you feed a or b from another node, it stays live. The same trick works for CFG, seed arithmetic, aspect-ratio math, or any float parameter your graph exposes.

    The mechanism, since it matters here

    Each operation is a Python branch using the stdlib math module - no numpy, no torch, no API, no key. Two details worth knowing because they'll trip you up:

    • log is natural log (math.log), not log10. If you wanted log10, you'll be off by a factor of ~2.3.
    • round(a) returns a whole number, and divide/modulo by zero, sqrt of a negative, or log of zero don't crash the graph - they return NaN plus an Err:Div/0-style string on output_str.

    The node always returns two outputs: result (FLOAT) and output_str (STRING). output_str is the human-readable line like 1 ÷ 3 = 0.333333 - pipe it into a Show Text node if you want to see your math, or into a prompt assembler if the answer should be words.

    Where people get burned

    The defaults are all 0. Pick a/b with both at zero and you get NaN, which then propagates silently through everything downstream - your KSampler will happily eat a NaN denoise and spit out garbage. If you see nan where you expect a number, check which operation you left selected. And the dropdown labels are in French (the author is French); a mod b is the only one that might make you blink, but the function names themselves are unambiguous.

    Install

    It's part of the CalculatorPro suite, so install the pack once and you get all eight nodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/orion4d/Calculator_Pro
    

    then restart ComfyUI. Or use ComfyUI Manager and search "Calculator_Pro". There's no requirements.txt, no model downloads, nothing to version-pin - it's a single pure-Python file. That alone is refreshing in an ecosystem where half your node installs are dependency roulette.

    CategoryCalculatorPro/Math

    Inputs (4)

    NameTypeDefaultDescription
    aFLOAT0.00
    bFLOAT0.00
    cFLOAT0.00
    functionCOMBOa+b47 options: a+b, a-b, a*b, a/b, a^b, a mod b, +41

    Outputs (2)

    NameTypeDescription
    resultFLOAT
    output_strSTRING