For when you cannot math but you can make a web request!
Lovingly shitposted by KrofDrakula. Source here.
To calculate a math expression, simply use the following URL to receive a JSON response:
https://expr.run/expression
Where expression
is a math expression that supports the following:
-123.456e-789
)Math
can be invoked as expressions (like atan2(1,2)
)pi
for 𝜋, e
for Euler's numberFor example, to compute the Earth's circumference based on mean radius across equator, in meters:
https://expr.run/6.378137e6*2*pi
This returns the JSON response:
{"result":40075016.68557849,"error":null}
If the result is not computable, result
will be null
. If there is a parsing error, the error
property will be populated with the error message.