Simple arithmetic subtraction that returns a - b with precise decimal handling. Access via MCP in Cursor or Windsurf for AI-powered calculations, or call GET /v1/math/subtract directly. Example: subtract(10, 3) returns 7. Handles floating-point precision issues that can trip up JavaScript's native math operations.
curl "https://tinyfn.io/v1/math/subtract" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/math/subtract', {
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/subtract',
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"
}
}
}
}
Call the subtract function with two parameters: subtract(a, b) returns a - b. Via REST API: GET /v1/math/subtract?a=10&b=3 returns 7.
Yes, it provides accurate decimal arithmetic without JavaScript's floating-point errors like 0.1 - 0.2 = -0.09999999999999998.
Absolutely. Cursor, Windsurf, Claude Code, and other MCP tools can call subtract directly for reliable math in generated code or calculations.
It returns the correct negative result. For example, subtract(5, 8) returns -3.
Yes, it handles decimals, negative numbers, and scientific notation inputs like 1e6 or -0.0001 correctly.