about summary refs log tree commit diff
path: root/converter/other/pamtosvg/epsilon.c
blob: 0c914dae27fcabad0a62e560fa5108296e38e07d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <math.h>

#include "epsilon.h"

/* Numerical errors sometimes make a floating point number just slightly
   larger or smaller than its true value.  When it matters, we need to
   compare with some tolerance, REAL_EPSILON, defined in kbase.h.  */

bool
epsilon_equal(float const v1,
              float const v2) {

    return
        v1 == v2		       /* Usually they'll be exactly equal, anyway.  */
        || fabs(v1 - v2) <= REAL_EPSILON;
}