|
Boost Users : |
Subject: Re: [Boost-users] [Format] How to format floating point values
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2019-01-19 22:06:56
On Sat, Jan 19, 2019 at 5:05 PM Larry via Boost-users
<boost-users_at_[hidden]> wrote:
>
> It's been a long time since I did it but I used '%.0lf' to format a
> double with no decimal places. '%6.6s' to format a string with exactly
> six characters. I am sure there are differences I have forgotten but it
> is similar to printf.
Thanks, I did figure that out after all, but it was a little difficult
to drill into the document through the printf notes.
> Larry
>
> On 1/19/2019 4:32 PM, Michael Powell via Boost-users wrote:
> > Hello,
> >
> > How do I format floating point values, either double or float? I want
> > to specify things like the precision during the formatting, i.e. how
> > many digits to include in the fractional digits, and so forth.
> >
> > Currently, I am using this, for instance:
> >
> > General: "%1$g"
> > Fixed: "%1$f"
> > Scientific: "%1$e" or "%1$E" (depending on whether lower or upper
> > case, respectively)
> >
> > Thanks!
> >
> > Best regards,
> >
> > Michael Powell
> > _______________________________________________
> > Boost-users mailing list
> > Boost-users_at_[hidden]
> > https://lists.boost.org/mailman/listinfo.cgi/boost-users
> >
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
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