Math Utilities

Hypotenuse

Calculates the hypotenuse of a right triangle using the Pythagorean theorem (c² = a² + b²). Access via MCP in Cursor, Windsurf, and other AI coding tools, or REST API at `/v1/math/hypotenuse`. Pass two side lengths, get precise decimal results. Essential for geometry calculations, distance formulas, and vector magnitude computations.

API Endpoint

GET /v1/math/hypotenuse

Code Examples

curl "https://tinyfn.io/v1/math/hypotenuse" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/math/hypotenuse', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/math/hypotenuse',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's math tools:

{
  "mcpServers": {
    "tinyfn-math": {
      "url": "https://tinyfn.io/mcp/math",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I calculate hypotenuse with two sides using MCP?

Call the hypotenuse tool with parameters for the two perpendicular sides (a and b). The MCP tool returns the exact hypotenuse length using the Pythagorean theorem.

What input formats does the hypotenuse calculator accept?

Accepts decimal numbers, integers, and fractions for both side lengths. Returns high-precision decimal results for accurate geometric calculations.

Can I use this for 3D distance calculations between points?

Yes, for 2D distance. For 3D points, calculate the 2D distance first, then use that result with the third dimension as inputs to get the 3D distance.

Does the hypotenuse tool handle very large or very small numbers?

Handles a wide range of numeric inputs with high precision. Useful for both microscopic measurements and astronomical distances in engineering calculations.

What's the difference between this and manual sqrt(a² + b²) calculation?

Provides deterministic, high-precision results without floating-point errors. AI agents get exact mathematical results instead of potentially inaccurate computed approximations.

Try Hypotenuse Now

Get your free API key and start using Hypotenuse in seconds.

Get Free API Key