On Friday, 28 April 2017 at 18:08:38 UTC, H. S. Teoh wrote:
On Fri, Apr 28, 2017 at 04:42:28PM +0000, via Digitalmars-d-learn wrote: [...]
        writefln(text("%.", i, "f"), x);
[...]

There's no need to use text() here:

        writefln("%.*f", i, x);

does what you want.


T

Thanks, I missed the fact that * could be used for specifying the precision, in addition to the width.

Reply via email to