-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoperator.h
40 lines (35 loc) · 1010 Bytes
/
operator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Licensed under the MIT License.
/** Represents a binary mathematical operator in reverse Polish notation. */
typedef double (*Operator)(double left, double right);
/**
* Adds two operands.
*
* @param left the left addend.
* @param right the right addend.
* @return The sum of `left` and `right`.
*/
double add_operator(double left, double right);
/**
* Subtracts one operand from an other.
*
* @param left the left addend.
* @param right the right addend.
* @return The difference of `left` and `right`.
*/
double subtract_operator(double left, double right);
/**
* Multiplies two operands.
*
* @param left the left factor.
* @param right the right factor.
* @return The product of `left` and `right`.
*/
double multiply_operator(double left, double right);
/**
* Performs integer division between two operands.
*
* @param left the dividend.
* @param right the divisor.
* @return The integer quotient of `left div right`.
*/
double div_operator(double left, double right);