intel gave me trouble, can we avoid regex? is there an alternative to the line I commented out?
Showing
-
Owner
Here's a simple way to test if a string is a floating point number. A modified version of the stackoverflow answer:
#include <cmath> #include <cstdlib> // https://stackoverflow.com/questions/29169153/how-do-i-verify-a-string-is-valid-double-even-if-it-has-a-point-in-it bool is_float(const char *s) { char *end = 0; double val = strtod(s, &end); return end != s && *end == '\0' && val != HUGE_VAL; }
This one will also treat e.g. "-inf" and "-nan" as valid floating point values.
-
Owner
What Intel compiler did you use? I can compile on panda with 2018.1.
Nevertheless, I will check what Ivica suggested and if it works as expected, I will remove the regex
Please register or sign in to comment