Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit 3bdf7dba54.
PrevUpHomeNext
Floating-Point Precision

boost::cnv::strtol cnv;

BOOST_TEST(  "12.3" == convert<string>(12.3456, cnv(arg::precision = 1)).value());
BOOST_TEST( "12.35" == convert<string>(12.3456, cnv(arg::precision = 2)).value());
BOOST_TEST("12.346" == convert<string>(12.3456, cnv(arg::precision = 3)).value());

BOOST_TEST(  "-12.3" == convert<string>(-12.3456, cnv(arg::precision = 1)).value());
BOOST_TEST( "-12.35" == convert<string>(-12.3456, cnv(arg::precision = 2)).value());
BOOST_TEST("-12.346" == convert<string>(-12.3456, cnv(arg::precision = 3)).value());


PrevUpHomeNext