Math Utilities

Tan

Computes the tangent of an angle using precise mathematical calculation rather than letting AI models guess. Access via MCP in Cursor or Windsurf for reliable trigonometry in code generation, or call GET /v1/math/tan directly. Returns exact floating-point results for radians input. Essential for geometric calculations, wave analysis, and scientific computing where accuracy matters.

API Endpoint

GET /v1/math/tan

Code Examples

curl "https://tinyfn.io/v1/math/tan" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/math/tan', {
  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/tan',
    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

What input format does the tan function expect?

The function expects angle values in radians. To convert degrees to radians, multiply by π/180 or use a conversion tool first.

How does MCP tan calculation help AI coding assistants?

Instead of hallucinating trigonometric values, AI agents get deterministic results for mathematical computations in generated code, ensuring accuracy in engineering and graphics applications.

What happens when calculating tan for angles like π/2?

For angles where tangent approaches infinity (like π/2), the function returns appropriate floating-point representations including positive/negative infinity values.

Can I use this for batch trigonometric calculations?

The REST API handles single angle calculations. For multiple values, make separate requests or combine with other math utilities for complex trigonometric workflows.

How precise are the tangent calculation results?

Results use standard floating-point precision, suitable for most engineering and scientific applications requiring reliable trigonometric computations.

Try Tan Now

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

Get Free API Key