std.complex

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Nov 18 18:03:05 PST 2013


On 11/18/13 5:44 PM, Craig Dillabaugh wrote:
> 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.

The simple reason is we couldn't find appropriate applications. If you 
make a good argument, we'll include integral types as well. Submit an 
enhancement request on bugzilla including your example and let's take it 
from there.

Andrei



More information about the Digitalmars-d mailing list