stage3/constant_folding.cc
changeset 890 499486ece119
parent 792 78083edf93d5
child 945 477393b00f95
equal deleted inserted replaced
889:5f380b99e95e 890:499486ece119
   377       if (fixed_point_sym->value[i] != '_') str += fixed_point_sym->value[i];
   377       if (fixed_point_sym->value[i] != '_') str += fixed_point_sym->value[i];
   378   }
   378   }
   379   else ERROR;
   379   else ERROR;
   380     
   380     
   381   errno = 0; // since strtoXX() may legally return 0, we must set errno to 0 to detect errors correctly!
   381   errno = 0; // since strtoXX() may legally return 0, we must set errno to 0 to detect errors correctly!
   382   #if    (real64_t  == float)
   382   #if    (real64_tX  == float)
   383     ret = strtof(str.c_str(),  &endptr);
   383     ret = strtof(str.c_str(),  &endptr);
   384   #elif  (real64_t  == double)
   384   #elif  (real64_tX  == double)
   385     ret = strtod(str.c_str(),  &endptr);
   385     ret = strtod(str.c_str(),  &endptr);
   386   #elif  (real64_t  == long_double)
   386   #elif  (real64_tX  == long_double)
   387     ret = strtold(str.c_str(), &endptr);
   387     ret = strtold(str.c_str(), &endptr);
   388   #else 
   388   #else 
   389     #error Could not determine which data type is being used for real64_t (defined in absyntax.hh). Aborting!
   389     #error Could not determine which data type is being used for real64_t (defined in main.hh). Aborting!
   390   #endif
   390   #endif
   391   if (overflow != NULL)
   391   if (overflow != NULL)
   392     *overflow = (errno == ERANGE);
   392     *overflow = (errno == ERANGE);
   393   if (((errno != 0) && (errno != ERANGE)) || (*endptr != '\0'))
   393   if (((errno != 0) && (errno != ERANGE)) || (*endptr != '\0'))
   394     ERROR;
   394     ERROR;