ComfyUI Node Runs on cloud

Number to Int

Coerce a WAS number into a whole number

By WASasquatch·Created 3 years ago·Updated about a year ago· 1,812
Number to Int

      The other half of WAS's number type bridge, alongside Number to Float. WAS's number nodes mostly deal in a loose generic NUMBER type, but a lot of what you actually wire that number into - image width and height, step count, batch size, an index into a batch or a list - genuinely needs a whole number, not something that might secretly be 3.7. Number to Int takes a NUMBER and hands back an INT, cleanly typed for exactly those slots.

      Why it matters more than it looks

      Dimensions and counts are unforgiving about type. A width input that receives 1023.9999 instead of 1024 isn't going to round itself for you - depending on the receiving node it might error outright, or silently behave in a way you didn't expect. If you've been doing arithmetic upstream with Number Operation - halving a width, deriving a step count from a ratio - the result is very likely to have picked up some fractional residue along the way, even when you conceptually meant a whole number. Number to Int is the node that forces it back into a clean integer before it reaches something that expects exactly that.

      How it works

      A type conversion from NUMBER to INT. Expect it to coerce toward a whole number the way you'd expect any such converter to behave - rounding or truncating the fractional part - rather than rejecting a non-integer value outright. If you're chasing an off-by-one or a value that looks suspiciously truncated instead of rounded, the fastest way to know for sure is to print the value before and after the conversion with one of WAS's console/debug nodes rather than assuming which behavior it uses.

      The inputs and outputs that matter

      A NUMBER in, an INT out. Wire the output into anything that specifically wants a whole number - a width/height field, a steps count, a seed, an index. If the receiving node wants FLOAT instead, use Number to Float, its sibling in the opposite direction.

      Installing it

      ComfyUI Manager: search "WAS Node Suite," install, restart. Manually:

      cd ComfyUI/custom_nodes
      git clone https://github.com/WASasquatch/was-node-suite-comfyui
      

      install requirements.txt against your ComfyUI Python, restart. No model, no dependency of its own.

      Common issues & troubleshooting

      A dimension is off by one, or rounds the "wrong" way. This is the most common surprise with any number-to-int converter - verify with a console print exactly what value goes in and what comes out for your specific case before assuming a bug. Rounding-vs-truncating differences matter most right at a boundary (something intended to be exactly 1024 that arrives as 1023.999...).

      A downstream node still rejects the value. Confirm it genuinely wants INT and not FLOAT - this node solves one specific type mismatch, not every type mismatch a graph can produce.

      Whole pack fails to load. WAS Node Suite has been unmaintained since the author marked it retired in December 2023, and the recurring failure since is the entire suite throwing "Import Failed" after a ComfyUI update because a pinned shared dependency got bumped underneath it. Reinstall requirements.txt against the correct, embedded Python interpreter and restart - this node has no external dependency to break on its own.

      Categoryx

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs