absyntax_utils/absyntax_utils.cc
changeset 568 5f79478142d7
parent 567 e5deeb6d4d2f
child 571 97b85630e496
--- a/absyntax_utils/absyntax_utils.cc	Wed Jun 06 13:28:50 2012 +0100
+++ b/absyntax_utils/absyntax_utils.cc	Wed Jun 06 16:39:54 2012 +0100
@@ -138,7 +138,7 @@
 
 /* extract the value of a real from an real_c object !! */
 /* NOTE: it must ignore underscores! */
-double extract_real_value(symbol_c *sym) {
+real64_t extract_real_value(symbol_c *sym) {
   std::string str = "";
   char *endptr;
   real_c * real_sym;
@@ -148,7 +148,15 @@
   for(unsigned int i = 3; i < strlen(real_sym->value); i++)
     if (real_sym->value[i] != '_') str += real_sym->value[i];
     
-  ret = strtod(str.c_str(), NULL);
+  #if    (real64_t  == float)
+    ret = strtof(str.c_str(), NULL);
+  #elif  (real64_t  == double)
+    ret = strtod(str.c_str(), NULL);
+  #elif  (real64_t  == long_double)
+    ret = strtold(str.c_str(), NULL);
+  #else 
+    #error Could not determine which data type is being used for real64_t (defined in absyntax.hh). Aborting!
+  #endif
   if (errno != 0) ERROR;
 
   return ret;