🔧 Convertisseur Universel
Four outputs from one wire — the type bridge you didn't know you needed
- FLOAT
- INT
- STRING
- BOOLEAN
The single most annoying thing in ComfyUI after a week of use: you compute a nice FLOAT like 768.0 in a math node, and the Empty Latent Image node refuses to take it because it wants an INT. ComfyUI is strict about types on the wire - a float socket won't snap into an int socket - and there's no built-in "cast this" node. 🔧 Convertisseur Universel from CalculatorPro is the cast node. Give it any one of the four basic types and it hands you all four back.
What it is
This one breaks the pack's usual shape. Every other node in CalculatorPro has required inputs; this one has only optional inputs: float_in, int_in, string_in, and bool_in. You wire in whichever single value you actually have - or several, if you're feeling chaotic - and get four outputs named FLOAT, INT, STRING, and BOOLEAN. One node, one wire in, four typed values out, and you can grab whichever the next node demands.
The README's example is the classic: compute width = 1024 and height = width × 0.75 as floats, feed them into the Universal Converter, and connect the INT outputs to the width/height of an Empty Latent Image. That's the whole job, and it does it without you hunting through a giant "utils" pack for a float-to-int node.
How it decides
There's a priority order baked into the code: float_in wins, then int_in, then string_in, then bool_in. So if you wire in a float and a string, the float is what gets converted and everything else is ignored. The conversion is plain Python:
- Float in → int truncates (
768.9becomes768), string is the decimal text, bool isTruefor anything nonzero. - String in → it tries
float()/int()parsing, and treats"true","1","t","yes","vrai","oui"(and a few friends) as boolean true. Unparseable strings come out as0.0/0, which is worth remembering - a typo doesn't error, it silently zeroes. - Bool in →
1.0/0.0floats,1/0ints,"True"/"False"strings.
The traps
The silent-zero-on-bad-string thing is the main one. If you're feeding a string from a text node and the math downstream suddenly collapses to zero, your string didn't parse - you won't get an error, just nothing. The bool_in socket only shows up when you need it (all optional), so don't be confused by a node that appears to have no required inputs at all when you first drop it in - that's the point. And the display name is French, as with the whole pack; the input/output names themselves are plain English.
Install
Part of the CalculatorPro suite - one install, eight nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/orion4d/Calculator_Pro
then restart ComfyUI, or search "Calculator_Pro" in ComfyUI Manager. No dependencies beyond Python's stdlib, no model files, no API keys. It's the rare custom node you can trust to never be the thing that breaks your environment.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| float_inopt | FLOAT | 0.00 | — |
| int_inopt | INT | 0 | — |
| string_inopt | STRING | — | |
| bool_inopt | BOOLEAN | false | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |
| INT | INT | — |
| STRING | STRING | — |
| BOOLEAN | BOOLEAN | — |