On Thu, 18 Nov 2010 15:13:19 -0500, Don <[email protected]> wrote:
Lars T. Kyllingstad wrote:
First of all, I think Andrei has already implemented this in the
write*() functions. I use this toString() style also for
std.complex.Complex, and I can print complex numbers no problem.
Really? It doesn't work for me.
import std.complex;
import std.stdio;
void main()
{
cdouble z2 = 10 + 1.5e-6i;
Complex!(double) z;
z.re = 10;
z.im = 1.5e-6;
writefln("z= %.16f z2 = %.16f", z, z2);
}
Prints:
z = 10+1.5e-06i z2 = 10.0000000000000000+0.0000015000000000i
Haven't tested, but docs state that
"Note that complex numbers are floating point numbers, so the only valid
format characters are 'e', 'f', 'g', 'a', and 's', where 's' gives the
default behaviour. ***Positional parameters are not valid in this
context.***"
I'd suggest trying one of those other format types without the numeric
parts.
-Steve