Simple boolean check returning true if a number is negative (< 0), false otherwise. Access via MCP in Cursor or Windsurf, or REST at `/v1/math/is-negative`. Perfect for validation logic: `is_negative(-5.2)` returns `true`. Handles integers, floats, and edge cases like -0 consistently.
curl "https://tinyfn.io/v1/math/is-negative" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/math/is-negative', {
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/is-negative',
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"
}
}
}
}
Returns false for -0 (follows IEEE 754 standard), and false for NaN since NaN comparisons are always false.
Yes, works with any valid numeric format including scientific notation like -1.23e-4 or -5E10.
Eliminates hallucination risks in AI agents and ensures consistent edge case handling across different programming contexts.
Both return false for zero (and -0), since zero is neither positive nor negative mathematically.
Yes, handles any number within standard floating-point precision limits, including very large negative values.