The Math API

This is a very simple API which specifies four mathematical operations and several modes of error handling. It is the model API for Catechesis examples.

Version

This is version 1.001 of 18 Jul 2010.

Operations

There are four valid operations:

add
Expects two integer operands. The operands will be added together and the result returned.
subtract
Expects two integer operands. The second will be subtracted from the first and the result returned.
multiply
Expects two integer operands. The operands will be multiplied together and the result returned.
divide
Expects two integer operands. The first will be divided by the second and the result returned.

Errors

If an operand is missing, the message "Missing operand: OPERATION requires X but Y were found" should be returned.

If an operand is not an integer where it is required to be, the message "Non-integer operand found: OPERAND" should be returned.

If the second operand of a divide command is zero, the message "Division by zero is undefined" should be returned.