divide
Perform division of two numbers with 64-bit floating point precision. Input integers, decimals, or fractions to calculate quotients accurately.
Instructions
Divides two numbers with 64 bit floating point precision and returns a 64 bit float. For example, dividing 10 by 2 would return 5.0. You can also use fractions if you want to, like 1/2 for number_1 and 1/3 for number_2.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| number_1 | Yes | ||
| number_2 | Yes |
Implementation Reference
- src/math_server.py:91-105 (handler)The 'divide' tool handler: divides number_1 by number_2 using NumPy float64, checks for division by zero, rounds result, logs operation.@math_mcp.tool def divide( number_1: int | float, number_2: int | float, ) -> float: """Divides two numbers with 64 bit floating point precision and returns a 64 bit float. For example, dividing 10 by 2 would return 5.0. You can also use fractions if you want to, like 1/2 for number_1 and 1/3 for number_2. """ if number_2 == 0: logging.error("Division by zero error.") raise ValueError("Division by zero is not allowed.") result = np.round(np.float64(number_1) / np.float64(number_2), decimals=SIXTY_FOUR_BIT_FLOAT_DECIMAL_PLACES) logging.info(f"Doing division: {number_1} / {number_2} -> Result: {result}") return result