logarithm
Calculate logarithms with any base for mathematical and financial analysis. This tool computes logarithmic values to support complex calculations in AI code assistants.
Instructions
Calculate logarithm with any base
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| value | Yes | ||
| base | No |
Implementation Reference
- index.js:185-187 (handler)The handler function computes the logarithm of the given value using the specified base (defaults to natural log if base not provided) using the change of base formula.async ({ value, base = Math.E }) => { return Math.log(value) / Math.log(base); }
- index.js:179-183 (schema)Defines the input schema with 'value' (required number) and 'base' (optional number), and output schema as a number.inputSchema: z.object({ value: z.number(), base: z.number().optional() }), outputSchema: z.number(),
- index.js:175-188 (registration)Registers the 'logarithm' tool using ai.defineTool, including name, description, schemas, and inline handler.ai.defineTool( { name: 'logarithm', description: 'Calculate logarithm with any base', inputSchema: z.object({ value: z.number(), base: z.number().optional() }), outputSchema: z.number(), }, async ({ value, base = Math.E }) => { return Math.log(value) / Math.log(base); } );