modulus
Compute the remainder of a division between two numbers. Supply a dividend and divisor to get the exact remainder, with zero-division errors handled automatically.
Instructions
Calculate the modulus (remainder) of two numbers provided in the data object.
Args:
data (TwoNumberOperation): An object containing two numbers, a and b.
Returns:
Dict[str, Any]: A dictionary containing the operation result if successful,
or an error message if an exception occurs.
Raises:
ZeroDivisionError: If the second number (b) is zero, as modulus by zero is not allowed.
Logs:
Logs the operation and result in the format "MOD | a % b = result" if successful.
Example:
data = TwoNumberOperation(a=10, b=3)
result = modulus(data)
# result -> {"status": "success", "operation": "modulus", "result": 1}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||