使用 std::to_string()
将 double 转换为字符串时,有什么方法可以设置结果的精度?
最佳答案
没有。
Returns: Each function returns a string object holding the character representation of the value of its argument that would be generated by calling
sprintf(buf, fmt, val)
with a format specifier of"%d"
,"%u"
,"%ld"
,"%lu"
,"%lld"
,"%llu"
,"%f"
,"%f"
, or"%Lf"
, respectively, where buf designates an internal character buffer of sufficient size.
关于c++ - std::to_string(double) 的精度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14520309/