Calculate what percentage one value represents of another total. Access via MCP in AI coding assistants or REST API at `/v1/math/percentage`. Pass a value and total to get precise decimal results like `42.857` for 15 out of 35. Eliminates floating-point calculation errors that plague manual percentage computations.
curl "https://tinyfn.io/v1/math/percentage" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/math/percentage', {
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/percentage',
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"
}
}
}
}
Send value=15 and total=35 to get 42.857142857142854 as the precise percentage result.
Division by zero returns an error since percentages cannot be calculated with a zero denominator.
Yes, the percentage tool works in Cursor and other MCP-compatible editors, perfect for calculating completion rates or success ratios programmatically.
Returns full floating-point precision without rounding, so you get exact decimal results for further calculations.
Provides consistent, deterministic results across platforms and eliminates potential floating-point precision issues in manual calculations.