logarithm
Calculate the base-10 logarithm of a given number. Errors on non-positive input.
Instructions
Base-10 logarithm. Errors on non-positive input.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| value | Yes |
Implementation Reference
- cruncher.js:462-479 (schema)Schema definition for the 'logarithm' tool. Defines name, annotations, description ('Base-10 logarithm. Errors on non-positive input.'), and inputSchema with a single required 'value' property of type number.
// --- Logarithms --- { name: "logarithm", annotations: { title: "Logarithm", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, description: "Base-10 logarithm. Errors on non-positive input.", inputSchema: { type: "object", properties: { value: { type: "number" } }, required: ["value"], }, }, - cruncher.js:1471-1475 (handler)Handler function for 'logarithm'. Validates that value > 0, throws error if non-positive, otherwise returns Math.log10(value).
logarithm: ({ value }) => { if (value <= 0) throw new Error("Logarithm is only defined for positive numbers."); return Math.log10(value); }, - cruncher.js:75-79 (registration)Tool name 'logarithm' listed in the 'standard' tool tier (line 79), which controls which tools are exposed to the LLM.
standard: [ "evaluate_expression", "add", "subtract", "multiply", "divide", "sqrt", "power", "absolute", "modulo", "factorial", "logarithm", "natural_log", "get_constant", - cruncher.js:136-148 (registration)'logarithm' is registered as a MAIN_THREAD_TOOL (line 148), meaning it runs on the main thread without worker overhead, enabling fast execution.
const MAIN_THREAD_TOOLS = new Set([ // Angle management "set_angle_mode", "get_angle_mode", // Trigonometry (instant Math calls) "sine", "cosine", "tangent", "asin", "acos", "atan", // Cache management "cache_clear", "cache_info", // Simple stats (zero-cost) "count", "min", "max", "variance", "std_dev", // Percentage "percentage_of", "percentage_change", "percentage_reverse", // Math one-liners "power", "sqrt", "logarithm", "natural_log", "absolute",