vincentlaucsb / csv-parser

A high-performance, fully-featured CSV parser and serializer for modern C++.
MIT License
901 stars 150 forks source link

csv::set_decimal_places does not round decimals to width #182

Closed telmo-carmo closed 4 months ago

telmo-carmo commented 3 years ago

csv::set_decimal_places(2); writer << std::make_tuple(-1.043, 2.126, "Three"); // out => -1.04;2.12;Three

vincentlaucsb commented 4 months ago

Closing as this is the intended behavior. It is the user's responsibility to call std::round() on CSV writer inputs. I do not believe all users should be saddled with the cost of calling std::round on all floating point inputs.