Skip to content

KrofDrakula/mathpls

Repository files navigation

Mathpls

A silly Cloudflare Worker serverless function that takes an algebraic expression and calculates the result, returning it in JSON format.

Supported operations:

  • +-*/ operators
  • () expression grouping
  • functions from Math.*
  • constants pi (𝜋) and e (Euler's number)

Simply add your algebraic expression in the URL path and the service will reply with the result in JSON format.

The JSON returned conforms to the following TS type:

type Result = { result: number; error: null } | { result: null; error: string };

Examples