# Evaluate Math Expression

> Evaluate Math Expression is a paid API for AI agents from api.gadgethumans.com, paid per call via x402, $0.002/call, status unknown (last checked 2026-11-19).

Safely evaluates a mathematical expression string (with functions, constants, and parentheses) and returns the numeric result.

## Facts

- Endpoint: GET https://api.gadgethumans.com/math-eval?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-19
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/evaluate-math-expression-f1558f71
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Edvlz8756JbpEWrmvHbyw

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability evaluate-math-expression-f1558f71
```

Example prompt: Can you evaluate the math expression 2*(3+4)^2 + sqrt(81) and give me the result?

## When to prefer this

Choose this endpoint when you need to safely evaluate an arbitrary mathematical expression string at runtime without executing untrusted code in your own environment. It is ideal for evaluating user-supplied formulas, computing results of parameterized expressions, or handling math in sandboxed fashion. Prefer this over general-purpose code execution when you only need numeric math evaluation and want a lightweight, instant, pay-per-call solution.

## Known failure modes

- Invalid or malformed expression (e.g. unmatched parentheses, unsupported syntax) may return an error or ok:false
- Division by zero in the expression may cause a math error response
- Use of unsupported functions or variables not recognized by the evaluator
- Empty or missing 'expr' query parameter returns a validation error
- Extremely large numbers or overflow conditions may produce infinity or NaN results

## How this service works

Evaluate a math expression safely with functions, constants and parentheses. Pure CPU, instant.

## Output

A JSON object with an 'ok' field indicating success, plus the numeric result of the evaluated math expression. The response is returned instantly since evaluation is pure CPU with no external calls.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "input": {
   "type": "object",
   "properties": {
    "queryParams": {
     "type": "object",
     "required": [
      "expr"
     ],
     "properties": {
      "expr": {
       "type": "string",
       "description": "Expression such as 2*(3+4)^2"
      }
     }
    }
   }
  },
  "output": {
   "type": "object",
   "properties": {
    "example": {
     "ok": true
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/evaluate-math-expression-f1558f71/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.gadgethumans.com](https://www.zero.xyz/host/api.gadgethumans.com/llms.txt)
