Evolve supports the following mathematical statements
The following code shows the mathematic statements in use
//---------------------------------------
// File: MathematicalFunctions.e
//---------------------------------------
//---------------------------------------
// Block: go
//---------------------------------------
block Go
Answer = cos 2
outl "cos 2 = " Answer
Answer = acos Answer
outl "acos Answer = " Answer
Answer = sin 2
outl "sin 2 = " Answer
Answer = asin Answer
outl "asin Answer = " Answer
Answer = tan 2
outl "tan 2 = " Answer
Answer = atan Answer
outl "atan 2 = " Answer
Answer = cosh Answer
outl "cosh 2 = " Answer
Answer = sinh Answer
outl "sinh 2 = " Answer
Answer = abs -2.6
outl "abs -2.6 = " Answer
Answer = exp 5
outl "exp 5 = " Answer
Answer = ldexp 5 2
outl "ldexp 5 2 = " Answer
Answer = log 5
outl "log 5 = " Answer
Answer = log10 5
outl "log10 5 = " Answer
Answer = pow 2 10
outl "pow 2 10 = " Answer
Answer = sqrt 81
outl "sqrt 81 = " Answer
_block
The random statement creates a pseudo random number between 0 and 32766. The statement takes one argument which is maximum value for the statement to return.
The seed_rnd command can be used to set the starting point of the pseudo random number sequence. This is useful if you want to make sure your program always generates the same set of random numbers e.g. for a specific test.
The following code demonstrates the random number statements.
//---------------------------------------
// File: Random.e
//---------------------------------------
//---------------------------------------
// Block: go
//---------------------------------------
block Go
I = 0
while I < 10
RandomValue = rnd 1000000000
outl RandomValue
++ I
_while
I = 0
while I < 10
seed_rnd 30
RandomValue = rnd 100
outl RandomValue
++ I
_while
_block