32 const long l = std::strtol(s, &
end, 10);
34 if ((errno == ERANGE && l == LONG_MAX) || l > INT_MAX) {
36 throw ReadError(
"range overflow occurred in conversion to int");
38 if ((errno == ERANGE && l == LONG_MIN) || l < INT_MIN) {
40 throw ReadError(
"range underflow occurred in conversion to int");
42 if (*s ==
'\0' || *
end !=
'\0') {
44 throw ReadError(
"cannot convert string to int");
49 return static_cast<int>(l);
58 const long l = std::strtol(s, &
end, 10);
60 if (errno == ERANGE && l == LONG_MAX) {
62 throw ReadError(
"range overflow occurred in conversion to long");
64 if (errno == ERANGE && l == LONG_MIN) {
66 throw ReadError(
"range underflow occurred in conversion to long");
68 if (*s ==
'\0' || *
end !=
'\0') {
70 throw ReadError(
"cannot convert string to long");
84 const double d = std::strtod(s, &
end);
86 if (errno == ERANGE) {
88 throw ReadError(
"range error occurred in conversion to double");
90 if (*s ==
'\0' || *
end !=
'\0') {
92 throw ReadError(
"cannot convert string to double");
double * end(GSL_vector &v)
iterator to end of GSL_vector
double to_double(const char *s)
long to_long(const char *s)
int to_int(const char *s)