{"uid":"cap_Edvlz8756JbpEWrmvHbyw","slug":"evaluate-math-expression-f1558f71","name":"Evaluate Math Expression","description":"Evaluate a math expression safely with functions, constants and parentheses. Pure CPU, instant.","url":"https://api.gadgethumans.com/math-eval?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"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}}}}},"responseSchema":{"type":"json","example":{"ok":true}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_NTwQFqpYFaelJX5RHW1qi","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Safely evaluates a mathematical expression string (with functions, constants, and parentheses) and returns the numeric result.","exampleAgentPrompt":"Can you evaluate the math expression 2*(3+4)^2 + sqrt(81) and give me the result?","exampleUseCases":[{"title":"Evaluate formula from user input","prompt":"The user typed in '(5^2 + 3*7) / (1 + sqrt(4))' — can you calculate that expression and show me the answer?"},{"title":"Scientific constant computation","prompt":"What is the result of sin(pi/4) * cos(pi/4) + log(e^2)?"},{"title":"Dynamic pricing formula check","prompt":"I have this pricing formula: 100 * (1 + 0.15)^3 — can you evaluate it so I know the final price after 3 years of 15% growth?"}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-19T23:54:15.593Z","isFirstParty":false,"canonicalSlug":"evaluate-math-expression-f1558f71"}