ComfyUI Node

atan

The angle whose tangent is your number

By StableLlama·Created about a year ago·Updated 4 days ago· 48
atan
  • value
  • FLOAT
unitdegrees

Find the angle from a slope

Tangent is rise over run; arctangent is the reverse - give it the slope and it returns the angle. atan(1) gives you 45°, because a slope of 1 is a 45° rise. It's the trig function you want when you have a ratio (not a pair of coordinates - that's atan2's job) and need the angle that produced it.

It's the friendlier member of the pack's inverse-trig trio: unlike asin and acos, atan accepts any real number, no domain restrictions. Input -1 to 1, input 1000, doesn't matter - you always get a valid angle out. That makes it the one you can wire into a workflow without defensive clamping.

How it works

The node computes atan(value) and converts to degrees if that unit is selected (the default). Output range is -90° to 90° (or -π/2 to π/2 in radians) - the half-circle range that defines arctangent. One thing to remember: because a slope doesn't encode direction, atan(1) can't tell you whether the angle is 45° or 225°. For direction-aware angles you need both coordinates, which is exactly what the pack's atan2 node is for.

The value input is a text field that takes a plain number (it's float()-parsed) - 1.0 or -0.75 are fine, "1/1" is not. Wire another node's output in if the value is computed.

Inputs and outputs

  • value (FLOAT or INT, default 0) - the slope, any real number.
  • unit (enum, default degrees) - radians or degrees for the output.

Output is a single FLOAT: the angle whose tangent is the input.

Installing it

Ships in Basic data handling by StableLlama, the r/StableDiffusion regular whose long model comparisons (Flux Klein 9B, RealVisXL) are more famous than his code. The pack is featherweight by design - zero runtime dependencies, no model downloads, nothing that can break your environment.

Install via ComfyUI Manager (search "Basic data handling") or:

cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling

Restart ComfyUI; it's under Basic/maths.

Troubleshooting

About the only way to misuse this is to feed it a single value when you actually have x and y coordinates and want a quadrant-aware angle - that's atan2, two doors down in the same category. And as with every node in this math family, if the answer looks wrong by a factor of ~57, you've got the unit dropdown set to radians when you meant degrees.

CategoryBasic/maths

Inputs (2)

NameTypeDefaultDescription
valueFLOAT,INT0
unitCOMBOdegrees2 options: radians, degrees

Outputs (1)

NameTypeDescription
FLOATFLOAT