Skip to content

Commit 591e05c

Browse files
Update SqlBinder.cc
std::to_string(double)会丢失精度默认保留6位小数
1 parent ac0d4d0 commit 591e05c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

orm_lib/src/SqlBinder.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,9 @@ SqlBinder &SqlBinder::operator<<(double f)
259259
parameters_.push_back((char *)(obj.get()));
260260
return *this;
261261
}
262-
return operator<<(std::to_string(f));
262+
std::stringstream ss;
263+
ss << std::setprecision(17) << f;
264+
return operator<<(ss.str());
263265
}
264266

265267
SqlBinder &SqlBinder::operator<<(std::nullptr_t)

0 commit comments

Comments
 (0)