Other arithmetic functors

These subclauses define the format and the definitions of other evaluable functors.

Templates and modes represent a specification for the type of the values when the arguments of the evaluable functor are evaluated as an expression, and the type of its value. A specific notation is employed for the structure and type of the arguments and value:

1. (**)/2 (power)

'**'(X, Y) evaluates the expressions X and Y with values VX and VY , and has the value of VX raised to the power of VY . If VX and VY are both zero, the value is 1.0.

Templates and modes for the predicate are as follows:

'**'(int-exp, int-exp) = float
'**'(float-exp, int-exp) = float
'**'(int-exp, float-exp) = float
'**'(float-exp, float-exp) = float

Note that ** is an infix predefined operator.

1.1 Example tests

First of all, let's start an appropriate fixture.

Evaluable value(String evaluable)
'**'(5, 3). 125.0
'**'(-5.0, 3). -125.0
'**'(5, -1). 0.2
'**'(5, 3.0). 125.0
'**'(0.0, 0). 1.0

2. sin/1

sin(X) evaluates the expression X with value VX and has the value of the sine of VX (measured in radians).

Templates and modes for the predicate are as follows:

sin(float-exp) = float
sin(int-exp) = float

2.1 Example tests

First of all, let's start an appropriate fixture.

Evaluable value(String evaluable)
sin(0.0). 0.0
sin(0). 0.0

Now we run some tests also verifying the unification for some of the variables in goals.

First of all, let's start an appropriate fixture containing an engine.

Goal Theory Variable success(String goal,String theory,String variable)
PI is atan(1.0) * 4, X is sin(PI / 2.0). null X 1.0
PI is atan(1.0) * 4, X is sin(PI / 2.0). null PI 3.141592653589793

3. cos/1

cos(X) evaluates the expression X with value VX and has the value of the cosine of VX (measured in radians).

Templates and modes for the predicate are as follows:

cos(float-exp) = float
cos(int-exp) = float

3.1 Example tests

First of all, let's start an appropriate fixture.

Evaluable value(String evaluable)
cos(0.0). 1.0
cos(0). 1.0

Now we run some tests also verifying the unification for some of the variables in goals.

First of all, let's start an appropriate fixture containing an engine.

Goal Theory Variable success(String goal,String theory,String variable)
PI is atan(1.0) * 4, X is cos(PI / 2.0). null X 6.123233995736766E-17
PI is atan(1.0) * 4, X is cos(PI / 2.0). null PI 3.141592653589793

4. atan/1

Templates and modes for the predicate are as follows:

atan(float-exp) = float
atan(int-exp) = float

4.1 Example tests

First of all, let's start an appropriate fixture.

Evaluable value(String evaluable)
atan(0.0). 0.0
atan(0). 0.0

Now we run some tests also verifying the unification for some of the variables in goals.

First of all, let's start an appropriate fixture containing an engine.

Goal Theory Variable success(String goal,String theory,String variable)
PI is atan(1.0) * 4. null PI 3.141592653589793

5. exp/1

exp(X) evaluates the expression X with value VX and has the value of the exponential function of VX .

Templates and modes for the predicate are as follows:

exp(float-exp) = float
exp(int-exp) = float

5.1 Example tests

First of all, let's start an appropriate fixture.

Evaluable value(String evaluable)
exp(0.0). 1.0
exp(1.0). 2.7182818284590455
exp(0). 1.0

6. log/1

log(X) evaluates the expression X with value VX and has the value of the natural logarithm of VX .

Templates and modes for the predicate are as follows:

log(float-exp) = float
log(int-exp) = float

6.1 Example tests

First of all, let's start an appropriate fixture.

Evaluable value(String evaluable)
log(1.0). 0.0
log(2.7182818284590455). 1.0

7. sqrt/1

sqrt(X) evaluates the expression X with value VX and has the value of the square root of VX .

Templates and modes for the predicate are as follows:

sqrt(float-exp) = float
sqrt(int-exp) = float

7.1 Example tests

First of all, let's start an appropriate fixture.

Evaluable value(String evaluable)
sqrt(0.0). 0.0
sqrt(1.0). 1.0
sqrt(1.21). 1.1