Boost logo

Boost Users :

Subject: Re: [Boost-users] [Format] How to format floating point values
From: Larry (lknain_at_[hidden])
Date: 2019-01-19 21:57:04


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.

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 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