ECF 1.5
Log.cpp
1#include "GPSymbRegEvalOp.h"
2
3#include "Log.h"
4#include <cmath>
5
6namespace Tree {
7namespace Primitives {
8
9Log::Log(void)
10{
11 nArguments_ = 1;
12 name_ = "log";
13}
14
15
16Log::~Log(void)
17{ }
18
19
20void Log::execute(void* result, Tree &tree)
21{
22 double& arg = *(double*)result;
23 getNextArgument(&arg, tree);
24 if (arg > 0) {
25 arg = log10(arg);
26 } else {
27 arg = 0;
28 }
29}
30
31}
32}
void execute(void *result, Tree &tree)
Execute the primitive.
Definition: Log.cpp:20
void getNextArgument(void *result, Tree &tree)
Execute next child node's primitive (execute next subtree).
Definition: Primitive.cpp:71
Tree class - implements genotype as a tree.
Definition: Tree_c.h:29