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:
(**)/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.
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 |
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
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 |
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
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 |
atan/1
Templates and modes for the predicate are as follows:
atan(float-exp) = float atan(int-exp) = float
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 |
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
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 |
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
First of all, let's start an appropriate fixture.
| Evaluable | value(String evaluable) |
|---|---|
| log(1.0). | 0.0 |
| log(2.7182818284590455). | 1.0 |
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
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 |