From 1fd361a1ea06e44286c213ca1f814f49306fdc43 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 19 Aug 2006 03:12:28 +0000 Subject: Create Subversion repository git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/pamtosvg/epsilon-equal.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 converter/other/pamtosvg/epsilon-equal.c (limited to 'converter/other/pamtosvg/epsilon-equal.c') diff --git a/converter/other/pamtosvg/epsilon-equal.c b/converter/other/pamtosvg/epsilon-equal.c new file mode 100644 index 00000000..46d630c5 --- /dev/null +++ b/converter/other/pamtosvg/epsilon-equal.c @@ -0,0 +1,19 @@ +/* epsilon-equal.c: define a error resist compare. */ + +#include + +#include "epsilon-equal.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; +} + -- cgit 1.4.1