Calculate logarithms with any base or natural log by default. Available via MCP in Cursor, Windsurf, and other AI tools, or REST at `/v1/math/log`. Pass a number and optional base — `log(100, 10)` returns `2.0` for log₁₀(100). Handles edge cases like negative numbers and provides IEEE 754 compliant results.
curl "https://tinyfn.io/v1/math/log" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/math/log', {
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/log',
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"
}
}
}
}
Natural log: just pass the number `log(2.718)` returns ~1.0. For base-10: `log(100, 10)` returns 2.0. No base parameter defaults to natural log (base e).
Returns `NaN` for negative numbers and zero, following IEEE 754 standards. `log(-5)` and `log(0)` both return `NaN`.
Yes, the log tool integrates with MCP-enabled editors like Cursor and Windsurf. Your AI agent gets precise logarithmic calculations instead of approximated results.
Pass the base as second parameter: `log(256, 2)` returns 8.0 for log₂(256), `log(256, 16)` returns 2.0 for log₁₆(256).
Similar functionality but accessible via MCP protocol and REST API. Supports custom bases directly unlike Math.log() which only does natural log.