Nodes/ComfyUI-LogicMath/Number Convert
ComfyUI Node

Number Convert

The node for the day ComfyUI stops accepting your number

By silveroxides·Created 7 months ago·Updated 3 months ago· 3
Number Convert
  • number_value
  • result_int
  • result_float

Every ComfyUI user hits the wall eventually: you compute a perfectly good number, try to plug it into a node, and the wire won't connect - or worse, it connects and the node silently hates you. That's because ComfyUI's inputs are picky about INT vs FLOAT. Seeds, batch sizes, and latent dimensions want integers; denoise, CFG, and strengths want floats. MathNumberConvert is the adapter that settles the argument, in both directions at once.

It's part of silveroxides/ComfyUI-LogicMath ("Logic operators and Math nodes based on a PR that never got merged" - that's the whole README), the same author who maintains the Chroma-GGUF quant pack. Like the rest of the pack it's V3-native, written against ComfyUI's newer extension API, so it loads cleanly on current ComfyUI and not at all on ancient builds.

How it works

Feed it any number - int or float, doesn't matter - and it applies Python's int() and float() conversions, handing you both results on separate outputs.

  • result_int is int(number_value).
  • result_float is float(number_value).

The node doesn't guess or round-trip through a dropdown. You get both, you pick the wire you need. Two outputs, one node, no reconfiguration when your workflow's needs change later.

One thing worth knowing before you lean on result_int: Python's int() truncates toward zero, it doesn't round. int(3.7) is 3, int(2.9999) is 2. If you need proper rounding - 2.63 - that's the sibling MathRound node's job. Number Convert is for coercion, Round is for rounding. Mixing the two up is the classic newbie stumble.

Inputs and outputs that matter

  • number_value - a single int or float in. Nothing else to set.
  • result_int (INT) - the value as an integer (truncated). Wire this into seeds, batch sizes, dimensions, any input with a type-check on INT.
  • result_float (FLOAT) - the value as a float. Wire into denoise, CFG, strength, anything expecting a float.

That's the whole surface area. There's no mode selector, no decimal count, no hidden settings.

Installing it

The easy route is ComfyUI Manager: Manager → Install Custom Nodes → search "ComfyUI-LogicMath". Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-LogicMath

Restart ComfyUI afterward. There's no requirements.txt to fight and no model to download - the only dependency is comfy_api, which ships with ComfyUI.

Common gotchas

  • Truncation, not rounding. int(2.9999) is 2. If the value in your workflow should snap to the nearest integer, use MathRound instead of being surprised later.
  • V3-only. This pack registers through the new extension API with no legacy NODE_CLASS_MAPPINGS. On an outdated ComfyUI the node won't appear at all; update ComfyUI first.
  • Float noise is real. A "clean" 5.0 computed through several math steps can arrive as 5.0000001. If you're feeding something that demands a strict integer, convert it early and truncate with intent.

Number Convert is the kind of node you forget exists until you need it - and then it saves you a very annoying ten minutes of wiring workarounds.

Categoryutils/math

Inputs (1)

NameTypeDefaultDescription
number_valueCOMFY_MATCHTYPE_V3

Outputs (2)

NameTypeDescription
result_intINT
result_floatFLOAT