How to specify setprecision rounding

前端 未结 4 2150
不思量自难忘°
不思量自难忘° 2020-12-02 00:34

Can I specify setprecision to round double values when stream to std output?

ofile << std::setprecision(12) << total_run_time/TIME << \"\\n         


        
4条回答
  •  情深已故
    2020-12-02 01:03

    std::cout.write(std::to_string(0.756247615801).c_str(), 8);
    

    It looks really dirty, but it works!

提交回复
热议问题