Skip to content

Commit 68c616d

Browse files
committed
fix issue #120
1 parent 43c003d commit 68c616d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/basic_types.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,14 @@ unsigned convertFromString<unsigned>(StringView str)
121121
template <>
122122
double convertFromString<double>(StringView str)
123123
{
124-
return std::stod(str.data());
124+
// see issue #120
125+
// http://quick-bench.com/DWaXRWnxtxvwIMvZy2DxVPEKJnE
126+
127+
const auto old_locale = std::setlocale(LC_NUMERIC,nullptr);
128+
std::setlocale(LC_NUMERIC,"C");
129+
double val = std::stod(str.data());
130+
std::setlocale(LC_NUMERIC,old_locale);
131+
return val;
125132
}
126133

127134
template <>

0 commit comments

Comments
 (0)