Boost logo

Boost Users :

Subject: Re: [Boost-users] [karma] auto_ + default floating point precisions
From: Michael Caisse (boost_at_[hidden])
Date: 2011-04-15 18:30:18


On 04/15/2011 01:08 PM, Brian Budge wrote:
> Hi all -
>
> I'm using boost karma to generically generate strings from many
> different types use auto_. I've noticed that if I specify some double
> precision numbers like 1.123456, I will only get "1.123" out as a
> string. While looking around the documentation, it seems that it is
> possible to specify the precision up to numeric_limits<real>::digits10
> + 1. I couldn't find an example for how to do this with double_ let
> alone auto_. Can anyone point me in the right direction? Is there
> documentation that google couldn't find for me?
>
> Thanks,
> Brian
> _______________________________________________
>

Hi Brian -

The important parts are here:
<http://www.boost.org/doc/libs/1_46_1/libs/spirit/doc/html/spirit/karma/reference/numeric/real_number.html#spirit.karma.reference.numeric.real_number.real_number_formatting_policies>

That little example shows you how to customize the real number
formatting to have whatever policies you want. The policy of interest to
you is precision as listed in the table below the example.

HTH
michael

-- 
Michael Caisse
Object Modeling Designs
www.objectmodelingdesigns.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net