Math Utilities

Is Negative

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.

API Endpoint

GET /v1/math/is-negative

Code Examples

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)

Use via MCP

Add to your AI agent

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"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How does is-negative handle edge cases like -0 and NaN?

Returns false for -0 (follows IEEE 754 standard), and false for NaN since NaN comparisons are always false.

Can I use is-negative with scientific notation numbers?

Yes, works with any valid numeric format including scientific notation like -1.23e-4 or -5E10.

Why use is-negative instead of just checking num < 0 in my MCP agent?

Eliminates hallucination risks in AI agents and ensures consistent edge case handling across different programming contexts.

What's the difference between is-negative and is-positive for zero?

Both return false for zero (and -0), since zero is neither positive nor negative mathematically.

Does is-negative work with very large numbers?

Yes, handles any number within standard floating-point precision limits, including very large negative values.

Try Is Negative Now

Get your free API key and start using Is Negative in seconds.

Get Free API Key