Skip to main content

Module arithmetic

Module arithmetic 

Source
Expand description

Arithmetic expression evaluation for shell-style $(( )) expressions.

Supports:

  • Integer arithmetic: +, -, *, /, %
  • Comparison operators: >, <, >=, <=, ==, != (return 1 or 0)
  • Parentheses for grouping: (expr)
  • Variable references: $VAR or bare VAR
  • Integer literals

Does NOT support:

  • Floating point (pipe to jq for float math)
  • Bitwise operations (shell-ism we’re skipping)
  • Assignment within expressions (confusing)

Functions§

eval_arithmetic
Evaluate an arithmetic expression string.