Math Utilities

Multiply

Multiply performs exact multiplication of two or more numbers, returning precise decimal results without floating-point errors. Access via MCP in Cursor or Windsurf, or call GET /v1/math/multiply with comma-separated values. Example: multiply(2.5, 4, 1.2) returns 12.0. Handles large numbers and maintains precision for financial calculations.

API Endpoint

GET /v1/math/multiply

Code Examples

curl "https://tinyfn.io/v1/math/multiply" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/math/multiply', {
  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/multiply',
    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 multiply multiple numbers using the MCP tool?

Pass numbers as separate parameters: multiply(5, 3, 2) returns 30. The tool accepts any number of arguments and multiplies them sequentially.

Does TinyFn multiply handle decimal precision correctly?

Yes, it uses arbitrary precision arithmetic to avoid floating-point errors. multiply(0.1, 0.2, 0.3) returns exactly 0.006, not 0.005999999999999999.

What happens when I multiply by zero or negative numbers?

Zero returns zero as expected. Negative numbers follow standard rules: multiply(-5, 3, -2) returns 30 (negative × positive × negative = positive).

Can I use the multiply API for large number calculations?

Yes, it handles arbitrarily large integers and high-precision decimals. Useful for financial calculations, scientific computing, or when JavaScript's Number.MAX_SAFE_INTEGER isn't sufficient.

How does MCP multiply compare to JavaScript's * operator?

TinyFn's multiply avoids JavaScript's floating-point precision issues and supports unlimited precision arithmetic, making it reliable for exact decimal calculations.

Try Multiply Now

Get your free API key and start using Multiply in seconds.

Get Free API Key