From: alex Date: Sun, 23 Jun 2002 22:28:06 +0000 (+0000) Subject: In stead of a zillion warnings, only one place gives a warning for DNAN X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=5cd0dd8d55ee429121205f8fa5c3dace5301631b;p=rrdtool.git In stead of a zillion warnings, only one place gives a warning for DNAN git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@147 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_format.h b/src/rrd_format.h index da0f1ba..b9fa2c2 100644 --- a/src/rrd_format.h +++ b/src/rrd_format.h @@ -22,19 +22,7 @@ #define RRD_VERSION "0002" #define FLOAT_COOKIE 8.642135E130 -#if defined(WIN32) -#define DNAN ((double)fmod(0.0,0.0)) -#define DINF ((double)log(0.0)) -#else - -#define DNAN ((double)(0.0/0.0)) /* we use a DNAN to - * represent the UNKNOWN - * */ -#define DINF ((double)(1.0/0.0)) /* we use a DINF to - * represent a value at the upper or - * lower border of the graph ... - * */ -#endif +#include "rrd_nan_inf.h" typedef union unival { unsigned long u_cnt; diff --git a/src/rrd_nan_inf.c b/src/rrd_nan_inf.c new file mode 100644 index 0000000..473f51b --- /dev/null +++ b/src/rrd_nan_inf.c @@ -0,0 +1,13 @@ +#include "rrd_nan_inf.h" + +#if defined(WIN32) + +double set_to_DNAN(void) { return (double)fmod(0.0,0.0); } +double set_to_DINF(void) { return (double)log(0.0); } + +#else + +double set_to_DNAN(void) { return (double)(0.0/0.0); } +double set_to_DINF(void) { return (double)(1.0/0.0); } + +#endif diff --git a/src/rrd_nan_inf.h b/src/rrd_nan_inf.h new file mode 100644 index 0000000..7934fdb --- /dev/null +++ b/src/rrd_nan_inf.h @@ -0,0 +1,5 @@ +#define DNAN set_to_DNAN() +#define DINF set_to_DINF() + +double set_to_DNAN(void); +double set_to_DINF(void);