std.complex

eles eles at eles.com
Tue May 11 04:51:34 PDT 2010


the following test case also works:

Compiling

import std.stdio;
import std.complex;

Complex!(double) x,y;

int main(){
	writefln("salut!\n");
	x.re=1;
	x.im=1;
	y=x.conj();
	writefln("x=%f+%f*i\n",x.re,x.im);
	writefln("y=%f+%f*i\n",y.re,y.im);
	return 0;
}


results in

C:\dmd2>dmd test.d

C:\dmd2>test
salut!

x=1.000000+1.000000*i

y=1.000000+-1.000000*i

C:\dmd2>

Which is OK. However, displaying complex numbers in that way is not
very nice. Is there any dedicated formatting for that? (it would be
nice to be able displaying a complex number in both Cartesian and
Polar formats)

eles





More information about the Digitalmars-d-learn mailing list