[math] Floating point equality with relative epsilon comparisons

This commit is contained in:
Al
2016-01-02 15:39:29 -05:00
parent 81624f8b6d
commit 7aea79281e
2 changed files with 45 additions and 0 deletions

16
src/float_utils.h Normal file
View File

@@ -0,0 +1,16 @@
#ifndef FLOAT_UTILS_H
#define FLOAT_UTILS_H
#include <stdlib.h>
#include <stdbool.h>
#include <float.h>
#include <math.h>
bool float_equals(float a, float b);
bool float_equals_epsilon(float a, float b, float epsilon);
bool double_equals(double a, double b);
bool double_equals_epsilon(double a, double b, double epsilon);
#endif