ComfyUI Node

Number

Nine derived values from one float

By yanhuifair·Created 2 years ago·Updated 3 months ago· 2
Number
    • float
    • int
    • absolute
    • round
    • ceil
    • floor
    • sqrt
    • exp
    • log
    number

    Feed Number one float and it hands you nine pre-computed relatives: truncation, absolute value, rounding, ceiling, floor, square root, exponential, and logarithm. It's the "breakdown" node of FairLab's logic pack - one source value, and whatever transformation you need is already there on a socket instead of a chain of math nodes.

    This is plumbing in the best sense. Say you have a scale factor of 2.0. From that single number you can wire sqrt into a resolution node, ceil into a batch count that must be a whole number, and abs somewhere you need a magnitude without a sign. In stock ComfyUI each of those is either a Primitive you retype or a math node you add. Here it's one node that fans out.

    Inputs and outputs

    • number (FLOAT) in → nine outputs: float, int, absolute, round, ceil, floor, sqrt, exp, log.

    Heads up, because the schema is genuinely confusing here: the first two outputs are mislabeled in a way that can bite you. The output named float is typed INT and the one named int is typed FLOAT - and per the source, both carry the truncated integer value. So if you grab the socket that says "int" expecting an int, you'll actually get a float, and vice versa. The remaining seven are plain FLOATs holding the math you'd expect: round/ceil/floor from the standard library, then sqrt, exp, and log.

    How it works

    Straightforward Python: it truncates to int, casts back, then applies abs, round, ceil, floor, sqrt, exp, log to the float. The one quirk beyond the label swap is that exp and log are natural (base e), not base 10 - fine for most uses, just don't assume log means log10.

    Where it fits

    Anywhere one number needs to become several differently-shaped numbers. It's the node you reach for when you catch yourself building a mini-calculator out of separate nodes. Just be aware of the swapped first two sockets before you wire them somewhere type-sensitive.

    Install

    FairLab installs as a single pack via ComfyUI Manager (search ComfyUI-FairLab) or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yanhuifair/ComfyUI-FairLab.git
    cd ComfyUI-FairLab
    pip install -r requirements.txt
    

    Restart after. This node needs no extra dependencies. You'll find it under Fair/logic.

    Gotchas

    • exp and log are natural (base e), not base 10. If you need base-10 log, divide by log(10) - or just reach for Python Script and RESULT = ..., keeping in mind that one also can't import math.
    • The float/int label swap is real and worth remembering - it's the one genuinely surprising thing about an otherwise predictable node.
    CategoryFair/logic

    Inputs (1)

    NameTypeDefaultDescription
    numberFLOAT

    Outputs (9)

    NameTypeDescription
    floatINT
    intFLOAT
    absoluteFLOAT
    roundFLOAT
    ceilFLOAT
    floorFLOAT
    sqrtFLOAT
    expFLOAT
    logFLOAT