Logged In: NO

Have a wobbly diff; this makes it compile, but it might or might not work completely. Check for bogosities before applying, should you choose to apply it.

--- src/expr.c.orig 2008-08-05 07:26:36.000000000 -0500
+++ src/expr.c 2008-08-05 07:41:58.000000000 -0500
@@ -235,7 +235,11 @@
result = NULL;
break;
case TYPE_FLOAT:
+#ifdef NO_FLOAT
+ internal_error(__FILE__, __LINE__, "impossible float");
+#else
result = newfloat_fl(valfloat(result), file, line); break;
+#endif
default:
result = newSstr_fl(valstr(result), file, line); break;
}
@@ -566,12 +570,16 @@
break;
switch (res.type) {
case TYPE_FLOAT:
+#ifdef NO_FLOAT
+ internal_error(__FILE__, __LINE__, "impossible float");
+#else
if (res.u.fval == HUGE_VAL || res.u.fval == -HUGE_VAL) {
eprintf("%s operator: arithmetic overflow", oplabel(op));
} else {
val = newfloat(res.u.fval);
}
break;
+#endif
case TYPE_DECIMAL:
case TYPE_ATIME:
case TYPE_DTIME:
@@ -753,8 +761,12 @@
case '+': /* fall thru to '-' */
case '-': return resint(sum);
case '*': i = valint(val[0]) * valint(val[1]);
+#ifdef NO_FLOAT
+ return resint(i);
+#else
f = valfloat(val[0]) * valfloat(val[1]);
return (i == f) ? resint(i) : resfloat(f);
+#endif
case '/': if ((i = valint(val[1])) != 0)
return resint(valint(val[0]) / i);
eprintf("division by zero");
@@ -774,8 +786,13 @@
switch (op & ~OPF_SIDE) {
case '+': tvadd(&t, &t, &t1);
return restime(t.tv_sec, t.tv_usec, promoted_type);
+#ifdef NO_FLOAT
+ case '*': return 0;
+ case '/': return 0;
+#else
case '*': return resfloat(valfloat(val[0]) * valfloat(val[1]));
case '/': return resfloat(valfloat(val[0]) / valfloat(val[1]));
+#endif
default: break;
}

@@ -793,6 +810,9 @@
}

case TYPE_FLOAT:
+#ifdef NO_FLOAT
+ return 0;
+#else
f = valfloat(val[0]);
switch (op & ~OPF_SIDE) {
case '>': return resint(f > valfloat(val[1]));
@@ -807,6 +827,7 @@
case '/': return resfloat(f / valfloat(val[1]));
default: return 0;
}
+#endif

default:
internal_error(__FILE__, __LINE__,
@@ -1187,8 +1208,13 @@
{
clock_t t;
t = clock();
+#ifdef NO_FLOAT
+ /* Approximate. */
+ return newint((t + CLOCKS_PER_SEC/2) / CLOCKS_PER_SEC);
+#else
return t == -1 ? newint(-1) :
newfloat(t / (double)CLOCKS_PER_SEC);
+#endif
}

case FN_idle: