Bug #9596 » 0002-Prefer-stof-stod-over-boost-to-retain-precision.patch
src/Wt/Dbo/backend/Postgres.C | ||
---|---|---|
if (PQgetisnull(result_, row_, column))
|
||
return false;
|
||
*value = convert<float>("stof", boost::spirit::float_, PQgetvalue(result_, row_, column));
|
||
try {
|
||
// try to convert with std::stof for backwards-compatibility and better round-trip/precision
|
||
*value = std::stof(PQgetvalue(result_, row_, column));
|
||
} catch (std::out_of_range) {
|
||
// fall-back to boost::spirit for "out of range", e.g. subnormals in some implementations
|
||
*value = convert<float>("stof", boost::spirit::float_, PQgetvalue(result_, row_, column));
|
||
}
|
||
LOG_DEBUG(this << " result float " << column << " " << *value);
|
||
... | ... | |
if (PQgetisnull(result_, row_, column))
|
||
return false;
|
||
*value = convert<double>("stod", boost::spirit::double_, PQgetvalue(result_, row_, column));
|
||
try {
|
||
// try to convert with std::stod for backwards-compatibility and better round-trip/precision
|
||
*value = std::stod(PQgetvalue(result_, row_, column));
|
||
} catch (std::out_of_range) {
|
||
// fall-back to boost::spirit for "out of range", e.g. subnormals in some implementations
|
||
*value = convert<double>("stod", boost::spirit::double_, PQgetvalue(result_, row_, column));
|
||
}
|
||
LOG_DEBUG(this << " result double " << column << " " << *value);
|
||
- « Previous
- 1
- 2
- Next »