Code

In stead of a zillion warnings, only one place gives a warning for DNAN
authoralex <alex@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Sun, 23 Jun 2002 22:28:06 +0000 (22:28 +0000)
committeralex <alex@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Sun, 23 Jun 2002 22:28:06 +0000 (22:28 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@147 a5681a0c-68f1-0310-ab6d-d61299d08faa

program/src/rrd_format.h
program/src/rrd_nan_inf.c [new file with mode: 0644]
program/src/rrd_nan_inf.h [new file with mode: 0644]

index da0f1ba46c54329b78ab27a33c6a9608b0249403..b9fa2c266b8cef8d800c60ff3b163650c75dbc48 100644 (file)
 #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/program/src/rrd_nan_inf.c b/program/src/rrd_nan_inf.c
new file mode 100644 (file)
index 0000000..473f51b
--- /dev/null
@@ -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/program/src/rrd_nan_inf.h b/program/src/rrd_nan_inf.h
new file mode 100644 (file)
index 0000000..7934fdb
--- /dev/null
@@ -0,0 +1,5 @@
+#define DNAN          set_to_DNAN()
+#define DINF          set_to_DINF()
+
+double set_to_DNAN(void);
+double set_to_DINF(void);