Performs precise division of two numbers via GET /v1/math/divide. Returns exact decimal results without floating-point errors that plague JavaScript's native division. Example: dividing 1 by 3 returns "0.3333333333333333" consistently. Essential for financial calculations, scientific computations, and any scenario where mathematical precision matters in MCP-enabled editors.
curl "https://tinyfn.io/v1/math/divide" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/math/divide', {
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/divide',
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"
}
}
}
}
TinyFn provides deterministic, consistent results across all environments, eliminating JavaScript's floating-point precision issues that can cause 0.1 + 0.2 ≠ 0.3 problems.
The API returns an error response with appropriate status code rather than JavaScript's Infinity result, allowing proper error handling in your application.
Yes, the deterministic results make it ideal for currency calculations where precision matters. AI agents in Cursor or Claude Code can rely on consistent decimal handling.
Yes, it processes positive/negative integers and decimals correctly, maintaining precision across all numeric types without rounding errors.
Use query parameters: GET /v1/math/divide?a=10&b=3 returns the division result in a structured JSON response format.