Files
ausboss-ComfyUI-AusBoss/js/docs/AUSBOSS_NODES_MathExpression.md
T
ausboss 3f715a4af8 Ship the crush-list build-out: 7 new node files, replace button, video and LoRA polish
- New nodes: Image Resize plus the Utility group (Text, Integer, Float,
  Show Text, Math Expression, Select Every Nth, Split Batch, Merge
  Batches, Free Memory) - the dependency-free gaps that let shared
  workflows drop heavy packs.
- Replace with AusBoss nodes (prototype): preview-then-confirm graph
  rewrite swapping known third-party nodes for pack equivalents, with a
  tested translation map, per-node opt-out, and refuse-with-reason for
  nodes the pack cannot stand in for.
- Load Video: single-frame FRAME picker, an honest "what will load"
  label from the probed source rate, drop-a-video-to-restore. Save
  Video: format-aware widgets and a file_path output. Stitch Inpaint
  gained a blend_mask output, Select Frame negative from-the-end
  indexing, Image Size a batch count - all appended, saved workflows
  load unchanged.
- LoRA Loader: drag-to-reorder rows, hover thumbnails on rows, file
  size and date in the info card.
- Appearance: flagship scheme deepened to slate-teal; the retired
  bright-teal pair upgrades automatically via LEGACY_SCHEME_PAIRS.
  Optional queue-completion chime, off by default.
- Image Resize invariant: pixels are only invented on an explicit
  width+height pad request - scale-derived modes resolve divisible_by
  snaps with a sub-half-step resize, never bars.
- Docs refreshed for six stale pages, stale text and metadata fixed
  across the pack, the panel-height rule codified in AGENTS.md and the
  brand skill, and ausboss_node_tour.json added - a model-free example
  exercising 17 node types in one graph.

Validated: scripts/validate_nodes.py (24 files), 300 JS tests, all
Python suites under the ComfyUI embedded interpreter.
2026-08-27 13:30:35 -05:00

1.3 KiB

Math Expression

Evaluates one arithmetic expression over the inputs a, b and c and returns the result as both FLOAT and INT — width and height math, strength ramps, frame counts.

Controls

  • expression: The arithmetic to evaluate. Allowed: numbers, the names a/b/c, the operators + - * / // % **, parentheses, unary minus, and the functions min, max, abs, round, floor, ceil, sqrt. Examples: a * 2, floor(a / 64) * 64, min(a, b) + 0.5, sqrt(a*a + b*b).
  • a, b, c: The values the expression reads. Type them or convert them to inputs and wire numbers in; an unused one costs nothing and an unwired one reads as its widget value.

Outputs

  • float: The result as a float.
  • int: The result rounded to the nearest whole number; halves round away from zero (2.5 becomes 3, -2.5 becomes -3).

Safety

The expression is parsed with Python's ast module and walked against a whitelist — it is never passed to eval. Anything outside the grammar above (other names, attribute access, subscripts, strings, comparisons) stops the run with an error naming what to remove, so a workflow shared by someone else cannot smuggle code through this node. Division by zero and overflowing results are clear errors rather than a crash or an inf traveling downstream.