diff --git a/src/doomdef.h b/src/doomdef.h index 796221c9..d63c5038 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -410,6 +410,15 @@ INT32 I_GetKey(void); #define max(x, y) (((x) > (y)) ? (x) : (y)) #endif +// Floating point comparison epsilons from float.h +#ifndef FLT_EPSILON +#define FLT_EPSILON 1.1920928955078125e-7f +#endif + +#ifndef DBL_EPSILON +#define DBL_EPSILON 2.2204460492503131e-16 +#endif + // An assert-type mechanism. #ifdef PARANOIA #define I_Assert(e) ((e) ? (void)0 : I_Error("assert failed: %s, file %s, line %d", #e, __FILE__, __LINE__)) diff --git a/src/r_data.c b/src/r_data.c index e0b9a814..a21ba49a 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -1220,7 +1220,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3) continue; if (maskcolor == extra_colormaps[i].maskcolor && fadecolor == extra_colormaps[i].fadecolor - && fabsf((float)(maskamt - extra_colormaps[i].maskamt)) < 1.0E-36f + && fabs(maskamt - extra_colormaps[i].maskamt) < DBL_EPSILON && fadestart == extra_colormaps[i].fadestart && fadeend == extra_colormaps[i].fadeend && fog == extra_colormaps[i].fog)