Nodes/Comfyroll Studio/βš™οΈ CR Math Operation
ComfyUI Node Runs on cloud

βš™οΈ CR Math Operation

Sin, cos, sqrt and friends for one float value

By Suzie1Β·Created 3 years agoΒ·Updated 2 years agoΒ· 1,291
βš™οΈ CR Math Operation
    • a
    • show_help
    β—„a1.00β–Ί
    β—„operationβ–Ύβ–Ί
    β—„decimal_places2β–Ί

    A one-input, one-output math node: feed it a float, pick an operation (sin, cos, tan, sqrt, exp, log, neg, abs), and it hands back the result rounded to however many decimal places you want. No expression parser, no multi-variable formulas - just the eight functions you'd otherwise need Python for, wired straight into the graph.

    How it works

    Set a to your input value, pick operation from the dropdown, and decimal_places controls rounding on the output (0–10 places). The output is a single float also named a - same name as the input, which is worth noting so you don't confuse the two when reading a busy graph; it's the result, not a passthrough of what you typed in.

    The obvious use is driving some value with an oscillating or scaled function instead of a straight line - feed a frame counter through sin to get a value that rises and falls smoothly across an animation, or run a raw pixel count through sqrt to get something proportional to a linear dimension instead of an area. It's a small building block, useful wherever you need one specific math function rather than a general expression evaluator.

    Inputs and outputs that matter

    • a - the input float (default 1).
    • operation - one of sin, cos, tan, sqrt, exp, log, neg, abs.
    • decimal_places - rounding on the output, 0–10.
    • Output: a (the computed float) plus show_help.

    How to install it

    ComfyUI Manager: search "Comfyroll Studio", install, restart. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes.git, restart. Nothing to download beyond the pack - it's a pure arithmetic node, no models involved at all.

    Common issues

    The usual math-domain gotchas apply, and this node doesn't guard against them for you: sqrt of a negative number, or log of zero or a negative number, are both undefined - feed it a value outside the valid domain for whichever operation you picked and expect either an error or a nonsense result rather than a helpful message. Sanity-check your input range before wiring this into something that runs unattended, like a scheduled animation loop.

    tan is the other one to watch - it shoots toward infinity near 90Β°/270Β° (in whatever units your upstream value represents), so if you're driving an angle through it, know where those blow-up points fall relative to your input range before you build a whole schedule on top of it.

    Beyond that, it's about as low-risk as nodes in this pack get. If it's missing from your search menu, that's the standard Comfyroll pack-wide caveat - a broken import elsewhere in the roughly 200-node pack can hide unrelated nodes too, so check your ComfyUI console log before troubleshooting this node specifically.

    Category🧩 Comfyroll Studio/πŸ› οΈ Utils/βš™οΈ Other

    Inputs (3)

    NameTypeDefaultDescription
    aFLOAT1.00β€”
    operationCOMBO8 options: sin, cos, tan, sqrt, exp, log, +2
    decimal_placesINT20–10β€”

    Outputs (2)

    NameTypeDescription
    aFLOATβ€”
    show_helpSTRINGβ€”