It appears that the precision parameter in std.format differs from its
meaning in printf. Is that expected behavior?
Example:
import std.stdio;
import core.stdc.stdio;
void main()
{
auto f = 20.6;
writeln(f);
writefln("%0.3s", f);
printf("%0.3f\n", f);
}
prints:
20.6667
20
On Monday, 5 June 2017 at 15:37:42 UTC, Steven Schveighoffer
wrote:
It appears that the precision parameter in std.format differs
from its meaning in printf. Is that expected behavior?
Example:
import std.stdio;
import core.stdc.stdio;
void main()
{
auto f = 20.6;
writeln(f);
On Mon, Jun 05, 2017 at 04:29:06PM +, Seb via Digitalmars-d wrote:
> On Monday, 5 June 2017 at 15:37:42 UTC, Steven Schveighoffer wrote:
> > It appears that the precision parameter in std.format differs from its
> > meaning in printf. Is that expected behavior?
> >
> > Example:
> >
> > import
On 6/5/17 12:53 PM, H. S. Teoh via Digitalmars-d wrote:
On Mon, Jun 05, 2017 at 04:29:06PM +, Seb via Digitalmars-d wrote:
On Monday, 5 June 2017 at 15:37:42 UTC, Steven Schveighoffer wrote:
It appears that the precision parameter in std.format differs from its
meaning in printf. Is that ex
On 6/5/17 12:29 PM, Seb wrote:
You do realize that you have used "s" in the D version?
Yes, I thought it was a stand in for "use the type to determine the
specifier", and I mistakenly assumed that would be 'f', since that's
what I've always used for floating point. Apparently it is 'g', which
On Monday, June 05, 2017 13:23:38 Steven Schveighoffer via Digitalmars-d
wrote:
> On 6/5/17 12:29 PM, Seb wrote:
> > You do realize that you have used "s" in the D version?
>
> Yes, I thought it was a stand in for "use the type to determine the
> specifier", and I mistakenly assumed that would be