From 60d7d619ee7885ad065f178eb0cf1e5d432b1921 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 19 Feb 2004 06:27:22 +0000 Subject: [PATCH] Got rid of approx.h and replaced all references to approx_eq() by ==, approx_lt() by <, etc. --- src/ChangeLog | 13 +++++++++++ src/Makefile.am | 2 +- src/approx.h | 59 ------------------------------------------------- src/compute.c | 2 +- src/count.c | 9 ++++---- src/data-out.c | 5 ++--- src/descript.q | 4 +--- src/expr-evl.c | 33 +++++++++++++-------------- src/expr-opt.c | 35 ++++++++++++++--------------- src/file-type.c | 3 +-- src/loop.c | 13 +++++------ src/misc.h | 3 +++ src/output.c | 7 +++--- src/recode.c | 10 ++++----- src/sfm-write.c | 7 +++--- src/sort.c | 3 +-- src/val.h | 1 + src/vars-atr.c | 29 +++++++++--------------- src/vfm.c | 3 +-- 19 files changed, 89 insertions(+), 152 deletions(-) delete mode 100644 src/approx.h diff --git a/src/ChangeLog b/src/ChangeLog index 4f4f3eda..f28af403 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +Wed Feb 18 22:21:35 2004 Ben Pfaff + + Got rid of approx.h. In general, replaced all references to + approx_eq() by ==, approx_lt() by <, etc. Other types of changes + noted below. + + * Makefile.am: (pspp_SOURCES) Removed approx.h. + + * data-out.c: (try_F) Replaced test for approx_eq(number, 0.0) by + test for mag < EPSILON. + + * misc.h: Add definition of EPSILON. + Wed Feb 18 21:32:44 2004 Ben Pfaff * vfm.c: (procedure) Add check to prevent recursive call. diff --git a/src/Makefile.am b/src/Makefile.am index 5024da59..7a03566b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,7 +35,7 @@ frequencies.q list.q means.q set.q t-test.q pspp_SOURCES = $(q_sources_c) \ aggregate.c algorithm.c algorithm.h alloc.c alloc.h \ -apply-dict.c approx.h ascii.c autorecode.c bitvector.h \ +apply-dict.c ascii.c autorecode.c bitvector.h \ cmdline.c cmdline.h command.c command.def command.h compute.c \ count.c data-in.c data-in.h data-list.c \ data-out.c debug-print.h devind.c devind.h dfm.c dfm.h \ diff --git a/src/approx.h b/src/approx.h deleted file mode 100644 index 8dda9d2f..00000000 --- a/src/approx.h +++ /dev/null @@ -1,59 +0,0 @@ -/* PSPP - computes sample statistics. - Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. - Written by Ben Pfaff . - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#if !approx_h -#define approx_h 1 - -#include -#include - -/* Minimum difference to consider values to be distinct. */ -#define EPSILON (DBL_EPSILON*10) - -/* The boundary at EPSILON is considered to be equal. */ -/* Possible modification: insert frexp() into all these expressions. */ - -#define approx_eq(A, B) \ - (fabs((A)-(B))<=EPSILON) - -#define approx_ne(A, B) \ - (fabs((A)-(B))>EPSILON) - -#define approx_ge(A, B) \ - ((A) >= (B)-EPSILON) - -#define approx_gt(A, B) \ - ((A) > (B)+EPSILON) - -#define approx_le(A, B) \ - ((A) <= (B)+EPSILON) - -#define approx_lt(A, B) \ - ((A) < (B)-EPSILON) - -#define approx_floor(x) \ - (floor((x)+EPSILON)) - -#define approx_in_range(V, L, H) \ - (((V) >= (L)-EPSILON) && ((V) <= (H)+EPSILON)) - -#define approx_compare(A, B) \ - (approx_gt(A,B) ? 1 : (approx_lt(A,B) ? -1 : 0)) - -#endif /* !approx_h */ diff --git a/src/compute.c b/src/compute.c index ff127e35..0a1077d4 100644 --- a/src/compute.c +++ b/src/compute.c @@ -21,11 +21,11 @@ #include #include #include "alloc.h" -#include "approx.h" #include "command.h" #include "error.h" #include "expr.h" #include "lexer.h" +#include "misc.h" #include "str.h" #include "var.h" diff --git a/src/count.c b/src/count.c index cf8d0676..3b9a0ac0 100644 --- a/src/count.c +++ b/src/count.c @@ -21,7 +21,6 @@ #include #include #include "alloc.h" -#include "approx.h" #include "command.h" #include "error.h" #include "lexer.h" @@ -418,22 +417,22 @@ count_numeric (struct counting * cnt, struct ccase * c) assert (0); break; case CNT_SINGLE: - if (approx_ne (cmp, num->a)) + if (cmp != num->a) break; counter++; goto done; case CNT_HIGH: - if (approx_lt (cmp, num->a)) + if (cmp < num->a) break; counter++; goto done; case CNT_LOW: - if (approx_gt (cmp, num->a)) + if (cmp > num->a) break; counter++; goto done; case CNT_RANGE: - if (approx_lt (cmp, num->a) || approx_gt (cmp, num->b)) + if (cmp < num->a || cmp > num->b) break; counter++; goto done; diff --git a/src/data-out.c b/src/data-out.c index cc1292e5..c1f3ff81 100644 --- a/src/data-out.c +++ b/src/data-out.c @@ -24,7 +24,6 @@ #include #include #include -#include "approx.h" #include "error.h" #include "format.h" #include "julcal/julcal.h" @@ -1189,7 +1188,7 @@ try_F (char *dst, const struct fmt_spec *fp, double number) n_int = 0; /* Avoid printing `-.000'. 7/6/96. */ - if (approx_eq (number, 0.0)) + if (mag < EPSILON) number = 0.0; } else @@ -1198,7 +1197,7 @@ try_F (char *dst, const struct fmt_spec *fp, double number) digits in floor(number), including any sign. */ for (;;) { - if (mag >= power10[n_int]) /* Should this be approx_ge()? */ + if (mag >= power10[n_int]) { assert (delta[j]); n_int += delta[j++]; diff --git a/src/descript.q b/src/descript.q index cf33db69..3a3f7da7 100644 --- a/src/descript.q +++ b/src/descript.q @@ -30,7 +30,6 @@ #include "command.h" #include "lexer.h" #include "error.h" -#include "approx.h" #include "magic.h" #include "stats.h" #include "som.h" @@ -556,8 +555,7 @@ run_z_pass (void) } t->z[count].mean = v->p.dsc.stats[dsc_mean]; t->z[count].std_dev = v->p.dsc.stats[dsc_stddev]; - if (t->z[count].std_dev == SYSMIS - || approx_eq (t->z[count].std_dev, 0.0)) + if (t->z[count].std_dev == SYSMIS || t->z[count].std_dev == 0.0) t->z[count].mean = SYSMIS; count++; } diff --git a/src/expr-evl.c b/src/expr-evl.c index 3a6abca6..a1b540e4 100644 --- a/src/expr-evl.c +++ b/src/expr-evl.c @@ -37,11 +37,11 @@ #include #include #include -#include "approx.h" #include "data-in.h" #include "error.h" #include "julcal/julcal.h" #include "magic.h" +#include "misc.h" #include "pool.h" #include "random.h" #include "stats.h" @@ -102,7 +102,7 @@ expr_evaluate (struct expression *e, struct ccase *c, union value *v) sp--; if (sp[0].f == SYSMIS) { - if (approx_eq (sp[1].f, 0.0)) + if (sp[1].f == 0.0) sp->f = 1.0; } else if (sp[1].f == SYSMIS) @@ -113,16 +113,14 @@ expr_evaluate (struct expression *e, struct ccase *c, union value *v) else sp->f = SYSMIS; } - else if (approx_eq (sp[0].f, 0.0) && approx_eq (sp[1].f, 0.0)) + else if (sp[0].f == 0.0 && sp[1].f == 0.0) sp->f = SYSMIS; else sp->f = pow (sp[0].f, sp[1].f); break; case OP_AND: - /* Note that the equality operator (==) may be used here - (instead of approx_eq) because booleans are always - *exactly* 0, 1, or SYSMIS. + /* Note that booleans are always one of 0, 1, or SYSMIS. Truth table (in order of detection): @@ -193,7 +191,7 @@ expr_evaluate (struct expression *e, struct ccase *c, union value *v) if (sp[1].f == SYSMIS) sp->f = SYSMIS; else - sp->f = approx_eq (sp[0].f, sp[1].f); + sp->f = sp[0].f == sp[1].f; } break; case OP_GE: @@ -203,7 +201,7 @@ expr_evaluate (struct expression *e, struct ccase *c, union value *v) if (sp[1].f == SYSMIS) sp->f = SYSMIS; else - sp->f = approx_ge (sp[0].f, sp[1].f); + sp->f = sp[0].f >= sp[1].f; } break; case OP_GT: @@ -213,7 +211,7 @@ expr_evaluate (struct expression *e, struct ccase *c, union value *v) if (sp[1].f == SYSMIS) sp->f = SYSMIS; else - sp->f = approx_gt (sp[0].f, sp[1].f); + sp->f = sp[0].f > sp[1].f; } break; case OP_LE: @@ -223,7 +221,7 @@ expr_evaluate (struct expression *e, struct ccase *c, union value *v) if (sp[1].f == SYSMIS) sp->f = SYSMIS; else - sp->f = approx_le (sp[0].f, sp[1].f); + sp->f = sp[0].f <= sp[1].f; } break; case OP_LT: @@ -233,7 +231,7 @@ expr_evaluate (struct expression *e, struct ccase *c, union value *v) if (sp[1].f == SYSMIS) sp->f = SYSMIS; else - sp->f = approx_lt (sp[0].f, sp[1].f); + sp->f = sp[0].f < sp[1].f; } break; case OP_NE: @@ -243,7 +241,7 @@ expr_evaluate (struct expression *e, struct ccase *c, union value *v) if (sp[1].f == SYSMIS) sp->f = SYSMIS; else - sp->f = approx_ne (sp[0].f, sp[1].f); + sp->f = sp[0].f != sp[1].f; } break; @@ -396,7 +394,7 @@ expr_evaluate (struct expression *e, struct ccase *c, union value *v) if (sp->f == SYSMIS) break; for (i = 1; i <= n_args; i++) - if (approx_eq (sp[0].f, sp[i].f)) + if (sp[0].f == sp[i].f) { sp->f = 1.0; goto main_loop; @@ -537,8 +535,7 @@ expr_evaluate (struct expression *e, struct ccase *c, union value *v) for (i = 1; i <= n_args; i += 2) if (sp[i].f == SYSMIS || sp[i + 1].f == SYSMIS) continue; - else if (approx_ge (sp[0].f, sp[i].f) - && approx_le (sp[0].f, sp[i + 1].f)) + else if (sp[0].f >= sp[i].f && sp[0].f <= sp[i + 1].f) { sp->f = 1.0; goto main_loop; @@ -1109,9 +1106,9 @@ expr_evaluate (struct expression *e, struct ccase *c, union value *v) sp->f *= sp->f; break; case OP_NUM_TO_BOOL: - if (approx_eq (sp->f, 0.0)) + if (sp->f == 0.0) sp->f = 0.0; - else if (approx_eq (sp->f, 1.0)) + else if (sp->f == 1.0) sp->f = 1.0; else if (sp->f != SYSMIS) { @@ -1130,7 +1127,7 @@ expr_evaluate (struct expression *e, struct ccase *c, union value *v) { if (sp[1].f == SYSMIS) { - if (approx_ne (sp[0].f, 0.0)) + if (sp[0].f != 0.0) sp->f = SYSMIS; } else diff --git a/src/expr-opt.c b/src/expr-opt.c index 40358a77..0a0de2a7 100644 --- a/src/expr-opt.c +++ b/src/expr-opt.c @@ -26,7 +26,6 @@ #include #include #include "alloc.h" -#include "approx.h" #include "data-in.h" #include "error.h" #include "julcal/julcal.h" @@ -172,7 +171,7 @@ optimize_tree (struct nonterm_node * n) /* 0*SYSMIS=0, 0/SYSMIS=0; otherwise, SYSMIS and infinities produce SYSMIS. */ - if (approx_eq (cval, 0.0) && n->type == OP_MUL) + if (cval == 0.0 && n->type == OP_MUL) nvar = 0; else if (sysmis || !finite (cval)) { @@ -198,7 +197,7 @@ optimize_tree (struct nonterm_node * n) { /* Otherwise consolidate all the nonconstant terms. */ m = xmalloc (sizeof (struct nonterm_node) - + ((nvar + approx_ne (cval, def) - 1) + + ((nvar + (cval != def) - 1) * sizeof (union any_node *))); for (i = c = 0; i < n->n; i++) if (n->arg[i]->type != OP_NUM_CON) @@ -206,7 +205,7 @@ optimize_tree (struct nonterm_node * n) else free_node (n->arg[i]); - if (approx_ne (cval, def)) + if (cval != def) { m->arg[c] = xmalloc (sizeof (struct num_con_node)); m->arg[c]->num_con.type = OP_NUM_CON; @@ -224,7 +223,7 @@ optimize_tree (struct nonterm_node * n) { if (n->arg[1]->type == OP_NUM_CON) { - if (approx_eq (n1, 1.0)) + if (n1 == 1.0) { struct nonterm_node *m = (struct nonterm_node *) n->arg[0]; @@ -232,7 +231,7 @@ optimize_tree (struct nonterm_node * n) free (n); return m; } - else if (approx_eq (n1, 2.0)) + else if (n1 == 2.0) { n = xrealloc (n, sizeof (struct nonterm_node)); n->type = OP_SQUARE; @@ -286,7 +285,7 @@ evaluate_tree (struct nonterm_node * n) return optimize_tree (n); case OP_POW: - if (approx_eq (n0, 0.0) && approx_eq (n1, 0.0)) + if (n0 == 0.0 && n1 == 0.0) frnc (SYSMIS); else if (n0 == SYSMIS && n1 == 0.0) frnc (1.0); @@ -317,22 +316,22 @@ evaluate_tree (struct nonterm_node * n) break; case OP_EQ: - rnc (approx_eq (n0, n1)); + rnc (n0 == n1); break; case OP_GE: - rnc (approx_ge (n0, n1)); + rnc (n0 >= n1); break; case OP_GT: - rnc (approx_gt (n0, n1)); + rnc (n0 > n1); break; case OP_LE: - rnc (approx_le (n0, n1)); + rnc (n0 <= n1); break; case OP_LT: - rnc (approx_lt (n0, n1)); + rnc (n0 < n1); break; case OP_NE: - rnc (approx_ne (n0, n1)); + rnc (n0 != n1); break; /* String operators. */ @@ -414,7 +413,7 @@ evaluate_tree (struct nonterm_node * n) for (i = 1; i < n->n; i++) { ni = n->arg[i]->num_con.value; - if (approx_eq (n0, ni)) + if (n0 == ni) { frnc (1.0); goto any_done; @@ -519,7 +518,7 @@ evaluate_tree (struct nonterm_node * n) if (min == SYSMIS || max == SYSMIS) continue; sysmis = 0; - if (approx_ge (n0, min) && approx_le (n0, max)) + if (n0 >= min && n0 <= max) { frnc (1.0); goto range_done; @@ -867,15 +866,15 @@ evaluate_tree (struct nonterm_node * n) rnc (1.0 / n0); break; case OP_MOD: - if (approx_eq (n0, 0.0) && n1 == SYSMIS) + if (n0 == 0.0 && n1 == SYSMIS) frnc (0.0); else rnc (fmod (n0, n1)); break; case OP_NUM_TO_BOOL: - if (approx_eq (n0, 0.0)) + if (n0 == 0.0) n0 = 0.0; - else if (approx_eq (n0, 1.0)) + else if (n0 == 1.0) n0 = 1.0; else if (n0 != SYSMIS) { diff --git a/src/file-type.c b/src/file-type.c index 44aa9bd9..1e647ecb 100644 --- a/src/file-type.c +++ b/src/file-type.c @@ -21,7 +21,6 @@ #include #include #include "alloc.h" -#include "approx.h" #include "command.h" #include "data-in.h" #include "dfm.h" @@ -672,7 +671,7 @@ file_type_source_read (write_case_func *write_case UNUSED, if (iter->flags & RCT_OTHER) goto found; for (i = 0; i < iter->nv; i++) - if (approx_eq (iter->v[i].f, v.f)) + if (iter->v[i].f == v.f) goto found; } if (fty.wild) diff --git a/src/loop.c b/src/loop.c index 424e5aab..e9bb6747 100644 --- a/src/loop.c +++ b/src/loop.c @@ -20,12 +20,12 @@ #include #include #include "alloc.h" -#include "approx.h" #include "command.h" #include "do-ifP.h" #include "error.h" #include "expr.h" #include "lexer.h" +#include "misc.h" #include "settings.h" #include "str.h" #include "var.h" @@ -371,8 +371,7 @@ loop_1_trns_proc (struct trns_header * trns, struct ccase * c) c->data[two->index->fv].f = t1.f; /* Throw out various pathological cases. */ - if (!finite (t1.f) || !finite (t2.f) || !finite (t3.f) - || approx_eq (t2.f, 0.0)) + if (!finite (t1.f) || !finite (t2.f) || !finite (t3.f) || t2.f == 0.0) return two->loop_term; debug_printf (("LOOP %s=%g TO %g BY %g.\n", two->index->name, t1.f, t3.f, t2.f)); @@ -382,7 +381,7 @@ loop_1_trns_proc (struct trns_header * trns, struct ccase * c) two->flags &= ~LPC_RINDEX; /* incr>0 but init>term */ - if (approx_gt (t1.f, t3.f)) + if (t1.f > t3.f) return two->loop_term; } else @@ -391,7 +390,7 @@ loop_1_trns_proc (struct trns_header * trns, struct ccase * c) two->flags |= LPC_RINDEX; /* incr<0 but initloop_term; } @@ -432,7 +431,7 @@ loop_2_trns_proc (struct trns_header * trns, struct ccase * c) if (two->flags & LPC_RINDEX) { /* Test if we're at the end of the looping. */ - if (approx_lt (two->curr, two->term)) + if (two->curr < two->term) return two->loop_term; /* Set the current value into the case. */ @@ -445,7 +444,7 @@ loop_2_trns_proc (struct trns_header * trns, struct ccase * c) else if (two->flags & LPC_INDEX) { /* Test if we're at the end of the looping. */ - if (approx_gt (two->curr, two->term)) + if (two->curr > two->term) return two->loop_term; /* Set the current value into the case. */ diff --git a/src/misc.h b/src/misc.h index d8d19702..0f03b6df 100644 --- a/src/misc.h +++ b/src/misc.h @@ -20,8 +20,11 @@ #if !math_misc_h #define math_misc_h 1 +#include #include +#define EPSILON (10 * DBL_EPSILON) + /* HUGE_VAL is traditionally defined as positive infinity, or alternatively, DBL_MAX. */ #if !HAVE_ISINF diff --git a/src/output.c b/src/output.c index b804978d..6a4ed78d 100644 --- a/src/output.c +++ b/src/output.c @@ -25,7 +25,6 @@ #include #include #include "alloc.h" -#include "approx.h" #include "devind.h" #include "error.h" #include "filename.h" @@ -959,7 +958,7 @@ outp_evaluate_dimension (char *dimen, char **tail) if (c <= 0.0 || ptail == s) goto lossage; s = ptail; - if (approx_eq (c, 0.0)) + if (c == 0.0) goto lossage; if (value > 0) value += b / c; @@ -971,7 +970,7 @@ outp_evaluate_dimension (char *dimen, char **tail) double b; s = &ptail[1]; b = strtod (s, &ptail); - if (approx_le (b, 0.0) || ptail == s) + if (b <= 0.0 || ptail == s) goto lossage; s = ptail; value /= b; @@ -1030,7 +1029,7 @@ outp_evaluate_dimension (char *dimen, char **tail) ptail += 2; value *= factor; } - if (approx_lt (value, 0.0)) + if (value <= 0.0) goto lossage; if (tail) *tail = ptail; diff --git a/src/recode.c b/src/recode.c index 185067ba..543e45ad 100644 --- a/src/recode.c +++ b/src/recode.c @@ -20,9 +20,9 @@ #include #include #include +#include #include #include "alloc.h" -#include "approx.h" #include "command.h" #include "error.h" #include "lexer.h" @@ -716,19 +716,19 @@ find_src_numeric (struct rcd_var * v, struct ccase * c) return cp; break; case RCD_SINGLE: - if (approx_eq (cmp, cp->f1.f)) + if (cmp == cp->f1.f) return cp; break; case RCD_HIGH: - if (approx_ge (cmp, cp->f1.f)) + if (cmp >= cp->f1.f) return cp; break; case RCD_LOW: - if (approx_le (cmp, cp->f1.f)) + if (cmp <= cp->f1.f) return cp; break; case RCD_RANGE: - if (approx_in_range (cmp, cp->f1.f, cp->f2.f)) + if (cmp >= cp->f1.f && cmp <= cp->f2.f) return cp; break; case RCD_ELSE: diff --git a/src/sfm-write.c b/src/sfm-write.c index 67cdf231..fd500f45 100644 --- a/src/sfm-write.c +++ b/src/sfm-write.c @@ -29,7 +29,6 @@ #include /* Required by SunOS4. */ #endif #include "alloc.h" -#include "approx.h" #include "error.h" #include "file-handle.h" #include "getline.h" @@ -676,13 +675,13 @@ sfm_write_case (struct file_handle * h, const flt64 *elem, int n_elem) *ext->x++ = 255; continue; } - else + else if (*elem > INT_MIN && *elem < INT_MAX) { - int value = *elem < 0 ? *elem - EPSILON : *elem + EPSILON; + int value = *elem; if (value >= 1 - COMPRESSION_BIAS && value <= 251 - COMPRESSION_BIAS - && approx_eq (value, *elem)) + && value == *elem) { *ext->x++ = value + COMPRESSION_BIAS; continue; diff --git a/src/sort.c b/src/sort.c index f7f4bfcc..7949ea5e 100644 --- a/src/sort.c +++ b/src/sort.c @@ -24,7 +24,6 @@ #include #include #include "alloc.h" -#include "approx.h" #include "command.h" #include "error.h" #include "expr.h" @@ -849,7 +848,7 @@ compare_record (union value * a, union value * b) if (v->type == NUMERIC) { - if (approx_ne (a[v->fv].f, b[v->fv].f)) + if (a[v->fv].f != b[v->fv].f) { result = (a[v->fv].f > b[v->fv].f) ? 1 : -1; break; diff --git a/src/val.h b/src/val.h index 3b42a83b..fe35aad9 100644 --- a/src/val.h +++ b/src/val.h @@ -20,6 +20,7 @@ #if !val_h #define val_h 1 +#include /* Values. */ diff --git a/src/vars-atr.c b/src/vars-atr.c index 7efc5390..ee4d2302 100644 --- a/src/vars-atr.c +++ b/src/vars-atr.c @@ -22,7 +22,6 @@ #include #include #include "alloc.h" -#include "approx.h" #include "command.h" #include "do-ifP.h" #include "expr.h" @@ -84,31 +83,25 @@ is_num_user_missing (double x, const struct variable *v) case MISSING_NONE: return 0; case MISSING_1: - return approx_eq (x, v->missing[0].f); + return x == v->missing[0].f; case MISSING_2: - return (approx_eq (x, v->missing[0].f) - || approx_eq (x, v->missing[1].f)); + return x == v->missing[0].f || x == v->missing[1].f; case MISSING_3: - return (approx_eq (x, v->missing[0].f) - || approx_eq (x, v->missing[1].f) - || approx_eq (x, v->missing[2].f)); + return (x == v->missing[0].f || x == v->missing[1].f + || x == v->missing[2].f); case MISSING_RANGE: - return (approx_ge (x, v->missing[0].f) - && approx_le (x, v->missing[1].f)); + return x >= v->missing[0].f && x <= v->missing[1].f; case MISSING_LOW: - return approx_le (x, v->missing[0].f); + return x <= v->missing[0].f; case MISSING_HIGH: - return approx_ge (x, v->missing[0].f); + return x >= v->missing[0].f; case MISSING_RANGE_1: - return ((approx_ge (x, v->missing[0].f) - && approx_le (x, v->missing[1].f)) - || approx_eq (x, v->missing[2].f)); + return ((x >= v->missing[0].f && x <= v->missing[1].f) + || x == v->missing[2].f); case MISSING_LOW_1: - return (approx_le (x, v->missing[0].f) - || approx_eq (x, v->missing[1].f)); + return x <= v->missing[0].f || x == v->missing[1].f; case MISSING_HIGH_1: - return (approx_ge (x, v->missing[0].f) - || approx_eq (x, v->missing[1].f)); + return x >= v->missing[0].f || x == v->missing[1].f; default: assert (0); } diff --git a/src/vfm.c b/src/vfm.c index fb8c5feb..42e6b7cc 100644 --- a/src/vfm.c +++ b/src/vfm.c @@ -28,7 +28,6 @@ #include /* Required by SunOS4. */ #endif #include "alloc.h" -#include "approx.h" #include "do-ifP.h" #include "error.h" #include "expr.h" @@ -1149,7 +1148,7 @@ SPLIT_FILE_procfunc (struct ccase *c, void *data_) switch (v->type) { case NUMERIC: - if (approx_ne (c->data[v->fv].f, prev_case->data[v->fv].f)) + if (c->data[v->fv].f != prev_case->data[v->fv].f) goto not_equal; break; case ALPHA: -- 2.30.2