The precision of std::to_string(double)

后端 未结 3 1678
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-30 13:31

Is there any way to set the precision of the result when converting a double to string using std::to_string()?

3条回答
  •  借酒劲吻你
    2020-11-30 13:54

    No.

    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.

提交回复
热议问题