{
  "id": "fn-math-arb",
  "dataComponent": "math",
  "heading": {
    "title": "arb",
    "badges": [
      "Arithmetic",
      "ArbPrec"
    ]
  },
  "synopsis": "Evaluates a custom string expression with arbitrary-precision decimal arithmetic.",
  "codeBlocks": [
    "extend(\"math\")\n\n# Basic usage: pass a string with an expression.\nsput( math:arb(\"0.1 + 0.2\") )\n# => \"0.3\"\n\nsput( math:arb(\"(1.5 - 0.5) * 10\") )\n# => \"10.0\"\n\n# Negative numbers\nsput( math:arb(\"(-1.2 + 0.2) * 10\") )\n# => \"-10.0\"\n\n# Large or integer math\nsput( math:arb(\"123456789 * 987654321\") )\n# => \"121932631112635269\"\n\n# For invalid syntax or if you pass multiple arguments, math:arb raises an error."
  ],
  "notes": [
    "math:arb(...) parses the given string expression (like \"0.1 + 0.2\") and calculates the result using a custom decimal approach for exact arithmetic, avoiding floating-point rounding issues.",
    "Supported operators include +, -, *, and /, along with parentheses. Division uses a fixed internal precision (e.g. 20 digits).",
    "Accepts exactly one argument: a single string representing the expression. If you pass something else (like multiple strings or an array), it raises an error.",
    "Returns the final decimal result as a single string, e.g. \"0.3\" or \"121932631112635269\"."
  ]
}
