Math Utilities

Log10

Calculate base-10 logarithms with precise floating-point accuracy. Use via MCP in Cursor or Windsurf for mathematical computations, or call GET /v1/math/log10?value=100 directly. Returns exactly 2.0 for input 100, avoiding JavaScript's floating-point quirks. Essential for scientific calculations, decibel conversions, and pH computations where precision matters.

API Endpoint

GET /v1/math/log10

Code Examples

curl "https://tinyfn.io/v1/math/log10" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/math/log10', {
  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/log10',
    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

What does log10 calculate and why use it over Math.log10?

Calculates base-10 logarithm (log₁₀). TinyFn provides consistent precision across platforms, avoiding JavaScript's occasional floating-point inconsistencies that can affect scientific calculations.

How do I use log10 in MCP tools like Cursor or Claude Code?

The AI agent calls the log10 tool directly with your number. Just ask 'what's log10 of 1000' and get the precise result without writing code.

What happens if I pass zero or negative numbers to log10?

Returns an error for zero or negative inputs, since log₁₀(0) is undefined and log₁₀(negative) produces complex numbers not supported by this function.

Can I convert natural logarithm results to base-10 logarithms?

Yes, use the change of base formula: log₁₀(x) = ln(x) / ln(10). However, calling log10 directly gives more accurate results than manual conversion.

What's the difference between log10 and regular logarithm functions?

log10 specifically uses base 10 (common logarithm), while 'log' typically means natural logarithm (base e). Use log10 for scientific notation, decibels, and pH calculations.

Try Log10 Now

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

Get Free API Key