Math Utilities

Sin

Computes the sine of an angle with mathematical precision. Available via GET /v1/math/sin or as an MCP tool in Cursor and other AI editors. Pass an angle in radians to get the exact sine value — sin(π/2) returns 1.0. Essential for trigonometric calculations in AI-assisted coding without floating-point approximation errors.

API Endpoint

GET /v1/math/sin

Code Examples

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

Does the sin function take degrees or radians?

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

How can I use the sine function with MCP in my AI editor?

Connect TinyFn's MCP server to Cursor, Windsurf, or other supported editors, then reference the sin tool in prompts for precise trigonometric calculations during development.

What's the difference between this and JavaScript's Math.sin()?

TinyFn's sin provides deterministic results across environments, eliminating potential floating-point inconsistencies that can occur with different JavaScript engines or math libraries.

Can I calculate sine for very large angle values?

Yes, the function handles large angles correctly by computing sine mathematically rather than using approximations that might lose precision with extreme values.

What format does the sine function return results in?

Returns a precise decimal number, typically with full floating-point precision. For example, sin(0) returns exactly 0, sin(π/6) returns 0.5.

Try Sin Now

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

Get Free API Key