#ulpNum=re.findall(r"([0-9]+)",ulpSize)[0]
text='''
static const char* INFORNAN;
- static %s ULPSIZE;
+ static %s ULPSIZE, ULPSIZE_FACTOR;
+
+ const char* env_strict = getenv("OCL_STRICT_CONFORMANCE");
+
+ if ( strcmp(env_strict, "0") == 0)
+ ULPSIZE_FACTOR = 1000;
+ else
+ ULPSIZE_FACTOR = 1;
if (isinf(cpu_data[index])){
INFORNAN="INF";
INFORNAN="NAN";
}
else{
- ULPSIZE=cl_%s(cpu_data[index]) * %s;
+ ULPSIZE=ULPSIZE_FACTOR * cl_%s((cpu_data[index] == 0) ? 1 : cpu_data[index])
+ * ((ULPSIZE_FACTOR == 1) ? %s : ( (%s == 0) ? 1 : %s));
}
#if udebug
}
}\n'''%(returnType,\
ulpUnit(ulpSize),ulpNum(ulpSize),\
+ ulpNum(ulpSize), ulpNum(ulpSize),\
paraTypeList['string'],paraTypeList['string'],\
paraTypeList['string'],paraTypeList['string'],\
paraTypeList['string'],paraTypeList['string'],\
#include <stdio.h>
#include <math.h>
#include <algorithm>
+#include <string.h>
#define udebug 0
#define FLT_MAX 0x1.fffffep127f