curatedapi
Browse the docs

Guides

Finance

Excel functions

Late payments

E-invoices

Accounting

Number checks

VAT and GST

Billing and pricing

Money and currencies

Dates and time

Math

Unit conversion

Everyday

Health

Scientific functions API

Roots, powers, logarithms, exponentials, trig and hyperbolic functions, and factorials, correctly rounded to up to 50 significant digits.

POST https://api.curatedapi.com/v1/calc/math/scientific

Each function is evaluated with certified interval arithmetic and rounded correctly, so every returned digit is right. Exact cases stay exact: sqrt(2.25) is 1.5, log10(1000) is 3, sin(30°) is 0.5 and the cube root of -8 is -2.

Formula

see function
  • Results larger than 1e100 in magnitude are rejected; results smaller than 1e-100 are reported as 0 with a warning.

Inputs

Send numbers as strings to keep every digit. options sets precision and rounding (see numbers and rounding).

InputTypeDescription
function required sqrt | cbrt | nth_root | power | reciprocal | exp | ln | log10 | log2 | log_base | sin | cos | tan | asin | acos | atan | sinh | cosh | tanh | factorial Function to apply. Options: sqrt: √x; cbrt: ∛x (real cube root); nth_root: the real y-th root of x (y a whole number from 2 to 1000); power: x^y; reciprocal: 1/x; exp: e^x; ln: natural logarithm of x; log10: base-10 logarithm of x; log2: base-2 logarithm of x; log_base: logarithm of x to base y; sin: sine of x; cos: cosine of x; tan: tangent of x; asin: inverse sine of x; acos: inverse cosine of x; atan: inverse tangent of x; sinh: hyperbolic sine of x; cosh: hyperbolic cosine of x; tanh: hyperbolic tangent of x; factorial: x! (x a whole number from 0 to 1000)
x required decimal (string) The argument.
y decimal (string) Second argument for power, nth_root and log_base.
angle_unit radians | degrees
default radians
Unit for trig inputs and inverse-trig outputs. Options: radians: radians; degrees: degrees
options.rounding half_even | half_up | half_down | up | down | ceiling | floor Rounding mode applied once to each result. Default half_even.
options.decimals integer Round results to this many digits after the decimal point.
options.significant_digits integer Round results to this many significant digits.

Result

Under result in the answer, next to exactness, precision, inputs, formula, references and warnings.

ResultTypeDescription
resultdecimal (string)The function value.

Examples

Square root of 2

Requestcurl
curl https://api.curatedapi.com/v1/calc/math/scientific \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "function": "sqrt",
    "x": "2"
  }'
200 OKResponse
{
  "calculator": "math/scientific@1",
  "result": {
    "result": "1.4142135623730950488"
  },
  "exactness": {
    "result": "rounded"
  },
  "precision": {
    "rounding": "half_even",
    "significant_digits": 20
  },
  "inputs": {
    "function": "sqrt",
    "x": "2",
    "angle_unit": "radians"
  },
  "formula": "see function",
  "references": [
    {
      "title": "NIST Digital Library of Mathematical Functions",
      "url": "https://dlmf.nist.gov/"
    },
    {
      "title": "mpmath interval arithmetic (iv)",
      "url": "https://mpmath.org/doc/current/contexts.html#arbitrary-precision-interval-arithmetic-iv"
    }
  ],
  "warnings": []
}

Exact cube root

Requestcurl
curl https://api.curatedapi.com/v1/calc/math/scientific \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "function": "cbrt",
    "x": "-8"
  }'
200 OKResponse
{
  "calculator": "math/scientific@1",
  "result": {
    "result": "-2"
  },
  "exactness": {
    "result": "exact"
  },
  "precision": {
    "rounding": "half_even",
    "significant_digits": 20
  },
  "inputs": {
    "function": "cbrt",
    "x": "-8",
    "angle_unit": "radians"
  },
  "formula": "see function",
  "references": [
    {
      "title": "NIST Digital Library of Mathematical Functions",
      "url": "https://dlmf.nist.gov/"
    },
    {
      "title": "mpmath interval arithmetic (iv)",
      "url": "https://mpmath.org/doc/current/contexts.html#arbitrary-precision-interval-arithmetic-iv"
    }
  ],
  "warnings": []
}

sin(30°)

Requestcurl
curl https://api.curatedapi.com/v1/calc/math/scientific \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "function": "sin",
    "x": "30",
    "angle_unit": "degrees"
  }'
200 OKResponse
{
  "calculator": "math/scientific@1",
  "result": {
    "result": "0.5"
  },
  "exactness": {
    "result": "exact"
  },
  "precision": {
    "rounding": "half_even",
    "significant_digits": 20
  },
  "inputs": {
    "function": "sin",
    "x": "30",
    "angle_unit": "degrees"
  },
  "formula": "see function",
  "references": [
    {
      "title": "NIST Digital Library of Mathematical Functions",
      "url": "https://dlmf.nist.gov/"
    },
    {
      "title": "mpmath interval arithmetic (iv)",
      "url": "https://mpmath.org/doc/current/contexts.html#arbitrary-precision-interval-arithmetic-iv"
    }
  ],
  "warnings": []
}

References

Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.

Errors share one format; see errors. Billing, retries and batches work the same for every endpoint.