Floating-Point Precision

| Home | Libraries | People | FAQ | More

##### 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());