std.complex

Craig Dillabaugh cdillaba at cg.scs.carleton.ca
Mon Nov 18 17:44:31 PST 2013


The complex type in std.complex restricts the real/imaginary
parts of the number to be float/double/real.  I am curious to
know if there is a reason why integral types are not permitted. I
checked the C++ equivalent and it does not have the same
requirement.

I mention this because some of my work is done with radar
satellite images. All pixels in such an images are stored as
complex numbers, but in all cases I am aware of they are stored a
short int values. Most software that operates on the images uses
complex<short> (most of it is C++).

Is there any reason why complex numbers in D's standard lib must
be of non-integral types?  I believe in C++ the type is optimized
for floating point values, but allows other types.


More information about the Digitalmars-d mailing list