Specifying precision in %(...%) print format

2012-10-14 Thread H. S. Teoh
I have an array of reals that I want to format with writefln, but the precision field needs to be passed in a variable. For a single real, it would be writefln(%.*f, precision, x); but when I try this: int precision = ...; real[] array = ...; writefln(%(%.*f, %),

Re: Specifying precision in %(...%) print format

2012-10-14 Thread Ali Çehreli
On 10/14/2012 10:43 PM, H. S. Teoh wrote: I have an array of reals that I want to format with writefln, but the precision field needs to be passed in a variable. For a single real, it would be writefln(%.*f, precision, x); but when I try this: int precision = ...; real[] array =