From: oetiker Date: Wed, 10 Dec 2008 13:18:10 +0000 (+0000) Subject: On some architectures, strtod does not turn "NaN" into 'Not A Number (NAN)' X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=5e99083983ca186ad16f1e6a5f0aa9623611b6f3;p=rrdtool.git On some architectures, strtod does not turn "NaN" into 'Not A Number (NAN)' se we better provide our own code here. git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1705 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_restore.c b/src/rrd_restore.c index f803ab6..e9363c6 100644 --- a/src/rrd_restore.c +++ b/src/rrd_restore.c @@ -143,6 +143,13 @@ static int get_double_from_node( return (-1); } + if (strstr(str_ptr, "NaN") != NULL) + { + *value = DNAN; + xmlFree(str_ptr); + return 0; + } + end_ptr = NULL; temp = strtod(str_ptr, &end_ptr); xmlFree(str_ptr);