Calculate the cosine of an angle using GET /v1/math/cos. Returns precise floating-point results for angles in radians. Example: cos(π/3) = 0.5. Essential for trigonometric calculations in AI agents working with geometry, physics simulations, or signal processing via MCP in Cursor and other editors.
curl "https://tinyfn.io/v1/math/cos" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/math/cos', {
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/cos',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
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"
}
}
}
}
The function expects angles in radians. For degrees, convert first: radians = degrees × π/180.
AI agents can generate trigonometric calculations for game development, 3D graphics, wave functions, or geometric transformations directly in your editor without approximation errors.
Returns standard IEEE 754 double-precision floating-point values. Output range is always [-1, 1] for any finite input angle.
Yes, follows IEEE 754 standards. cos(±∞) returns NaN, cos(NaN) returns NaN, maintaining mathematical consistency.
Provides identical IEEE 754 compliance but accessible via REST API and MCP, enabling consistent results across different environments and AI agent integrations.