Floor rounds any number down to the nearest integer, essential for array indexing, pagination, and discrete calculations. Access via MCP in Cursor or Windsurf, or call GET /v1/math/floor with your number. Returns -4 for -3.7, 5 for 5.9. Unlike ceiling, always rounds toward negative infinity regardless of sign.
curl "https://tinyfn.io/v1/math/floor" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/math/floor', {
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/floor',
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"
}
}
}
}
Floor always rounds toward negative infinity, so -3.2 becomes -4, not -3. This differs from truncation which would give -3.
Floor rounds toward negative infinity while trunc removes decimals toward zero. For -2.7: floor gives -3, trunc gives -2.
Yes, floor is perfect for converting floating-point calculations to valid array indices. Claude Code and Cursor can use it for pagination offsets too.
Floor handles standard floating-point range but may lose precision with numbers beyond JavaScript's safe integer limit (2^53).
Floor returns integers unchanged since they're already whole numbers. 5 returns 5, -8 returns -8.