[Genabel-commits] r1663 - branches/ProbABEL-0.50/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 27 22:16:16 CET 2014


Author: maartenk
Date: 2014-03-27 22:16:16 +0100 (Thu, 27 Mar 2014)
New Revision: 1663

Modified:
   branches/ProbABEL-0.50/src/gendata.cpp
Log:
mldose_strtod returns Na if the first character is a 'N' -> should fix examples

Modified: branches/ProbABEL-0.50/src/gendata.cpp
===================================================================
--- branches/ProbABEL-0.50/src/gendata.cpp	2014-03-27 20:43:25 UTC (rev 1662)
+++ branches/ProbABEL-0.50/src/gendata.cpp	2014-03-27 21:16:16 UTC (rev 1663)
@@ -45,8 +45,9 @@
     // eg question 5678932
     int sign = 0;
     double result = 0;
-    //check if not a null pointer
-    if (!*str_pointer ){
+    //check if not a null pointer or NaN (right now checks only first character)
+//TODO: make catching of NaN more rigid
+    if (!*str_pointer | *str_pointer == 'N'){
         return std::numeric_limits<double>::quiet_NaN();
     }
     //skip whitespace
@@ -222,6 +223,7 @@
 
     std::ifstream infile;
     infile.open(fname);
+
     if (!infile)
     {
         std::cerr << "gendata: cannot open file " << fname << endl;
@@ -316,6 +318,7 @@
                 infile >> tmpstr;
         }
     }
+
     infile.close();
 
 }



More information about the Genabel-commits mailing list