FloatToInt
Turn a decimal into a whole number, floor or ceiling
- int_value
This is the node you reach for when a downstream input wants a whole number - a frame count, a batch size, a pixel dimension - but what you've got is a FLOAT coming out of some math or a slider with decimals on it. FloatToInt takes that float and gives you back an integer, with your choice of which way to round.
ComfyUI's type system is the reason this needs to be its own node rather than something that just works automatically. INT and FLOAT are distinct socket types in the graph, and the validator won't silently coerce one into the other - you'll see Return type mismatch between linked nodes if you try to force it. That's usually the right call (you don't want a latent accidentally wired into a number field), but it means any pipeline that mixes integer-only nodes (batch counts, loop indices, image dimensions) with float-producing ones (a Simple Math node, a slider, a percentage calculation) eventually needs an explicit converter sitting in between. FloatToInt is that converter, for the direction where you actually have to make a decision: unlike casting an int up to a float, going the other way means throwing away the decimal part, and how you throw it away matters.
How it works
Unlike its sibling IntToFloat (a pure, no-decisions cast), this one has an actual choice to make, because converting 3.7 to an integer isn't unambiguous - do you get 3 or 4? FloatToInt exposes exactly two rounding modes:
down (floor)- rounds toward the smaller integer.3.7→3. This is the default.up (ceil)- rounds toward the larger integer.3.2→4.
Worth being precise about the direction here, because "down" and "up" can be misleading once negative numbers show up: floor and ceiling round toward negative and positive infinity respectively, not toward zero. -3.2 floors to -4, not -3. If your workflow only ever deals in positive values (frame counts, batch sizes, dimensions - which covers the overwhelming majority of real use), you'll never notice the distinction. If you're doing signed math somewhere in the graph, keep it in mind.
Note what's not on the menu: there's no "round to nearest" and no "truncate toward zero" option. If you need 3.5 to become 4 rather than 3, or you need negative floats to truncate toward zero instead of floor, this node can't do that - you'd want one of the other float-to-int nodes in the ecosystem that expose a proper round mode instead.
Inputs and outputs
Two inputs, both required:
float_value(FLOAT, default0) - the decimal value you're converting.rounding_mode- a dropdown with two choices,down (floor)andup (ceil), defaulting todown (floor).
The output is a single int_value (INT). Wire it into whatever integer-only input rejected your float - a batch count, a resolution field, a loop counter.
Installing it
FloatToInt ships in the same small extension as IntToFloat, so one install covers both nodes. Via ComfyUI Manager, search ComfyUI Int and Float Conversion Nodes (or comfyui-int-and-float) and install. It's a low-profile, single-author repo, so if Manager doesn't surface it, clone it directly:
cd ComfyUI/custom_nodes
git clone https://github.com/danTheMonk/comfyui-int-and-float
Restart ComfyUI and it'll appear in the node menu under Custom. No dependencies to install, no models to download - the whole pack is two small Python files.
Common issues
Since this is such a small, dependency-free node, most "problems" trace back to one of these rather than an actual bug:
- Wrong rounding mode picked by accident. The default is floor (
down), which is what you want most of the time for things like frame counts where over-shooting by one causes an out-of-range error. If you're consistently getting values one lower than you expect, check whether you actually wantedup (ceil). - You need real rounding, not floor/ceil. This node genuinely doesn't support round-to-nearest or truncate-toward-zero - that's not a bug, it's just not what it offers. Reach for a different float-to-int node (there are several across the bigger utility packs) if you need that behavior.
- Missing-node errors in a downloaded workflow. This is an obscure, single-author pack with essentially no community footprint, so some ComfyUI Manager mirrors may not have it indexed. If a workflow shows
FloatToIntas missing, a manual git clone (above) is the reliable fix rather than waiting on Manager's "install missing nodes" to find it. - You only need one of the two nodes. Installing the pack gets you both IntToFloat and FloatToInt regardless of which one your workflow actually calls - that's normal, it's a two-node repo, not a bug in either node.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| float_value | FLOAT | 0.00 | — |
| rounding_mode | COMBO | down (floor) | 2 options: down (floor), up (ceil) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| int_value | INT | — |