Math Utilities

Is Odd

Returns true/false for whether a number is odd using modulo arithmetic. Access via GET /v1/math/is-odd endpoint or through MCP in Cursor and other AI editors. Perfect for conditional logic, data filtering, and mathematical operations where parity matters. Handles integers, floats, and negative numbers reliably.

API Endpoint

GET /v1/math/is-odd

Code Examples

curl "https://tinyfn.io/v1/math/is-odd" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/math/is-odd', {
  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-odd',
    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 do I check if a number is odd using TinyFn?

Send a GET request to /v1/math/is-odd with your number parameter, or use the MCP tool in supported editors. Returns boolean true for odd numbers, false for even.

Does is-odd work with negative numbers and decimals?

Yes, it handles negative integers correctly (-3 returns true, -4 returns false). For decimals, it typically evaluates the integer portion or may return false depending on implementation.

Can I use is-odd in MCP-enabled AI agents for data processing?

Absolutely. AI agents in Cursor, Windsurf, and Cline can call this tool to filter arrays, implement alternating patterns, or validate user input requiring odd numbers.

What's the difference between is-odd and modulo operations?

is-odd encapsulates the modulo logic (n % 2 !== 0) in a clean API call, eliminating potential implementation errors and providing consistent results across different programming languages.

How fast is the is-odd API for bulk number checking?

Very fast for individual calls, but for bulk operations consider batching requests or using local modulo operations. Best for occasional checks or when you need guaranteed deterministic behavior.

Try Is Odd Now

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

Get Free API Key