From 375568853aa7c9c6b01ab96261837132746ea7af Mon Sep 17 00:00:00 2001 From: jeggermo Date: Fri, 29 Jun 2001 12:15:15 +0000 Subject: [PATCH] checks for the existence of finite(x) and isinf(x) built into app/gpsymreg. Linux gcc compilers have the 'macros ??' but solaris gcc does not --- eo/app/gpsymreg/fitness.h | 3 +++ eo/app/gpsymreg/node.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/eo/app/gpsymreg/fitness.h b/eo/app/gpsymreg/fitness.h index 8f4b499d..e432b826 100644 --- a/eo/app/gpsymreg/fitness.h +++ b/eo/app/gpsymreg/fitness.h @@ -203,10 +203,13 @@ class RegFitness: public eoEvalFunc< eoParseTree > fit += pow(target - output, 2); } // check if the fitness is valid + // some versions of gcc (e.g. 2.95.2 on solaris) don't have isinf(x) defined + #ifdef isinf if (isinf(fit) == 0) fitness[NORMAL] = fit; else fitness[NORMAL] = MAXFLOAT; + #endif fitness[SMALLESTSIZE] = _eo.size() / (1.0*parameter.MaxSize); _eo.fitness(fitness); diff --git a/eo/app/gpsymreg/node.h b/eo/app/gpsymreg/node.h index df10bd18..6905138c 100644 --- a/eo/app/gpsymreg/node.h +++ b/eo/app/gpsymreg/node.h @@ -161,8 +161,11 @@ class Node } // if the result is infinite (positive or negative) or not_a_number (nan) then result becomes 0 + // however some versions of gcc (e.g. 2.95.2 on solaris) don't have the finite(x) defined + #ifdef finite if (!finite(result)) result=0; + #endif } template