Debian Codegraph @

converter/other/pamtosvg/epsilon.c

raw
1 #include <math.h>
2
3 #include "epsilon.h"
4
5 /* Numerical errors sometimes make a floating point number just slightly
6 larger or smaller than its true value. When it matters, we need to
7 compare with some tolerance, REAL_EPSILON, defined in kbase.h. */
8
9 bool
10 epsilon_equal(float const v1,
11 float const v2) {
12
13 return
14 v1 == v2 /* Usually they'll be exactly equal, anyway. */
15 || fabs(v1 - v2) <= REAL_EPSILON;
16 }
17
18
19