std.complex

Craig Dillabaugh cdillaba at cg.scs.carleton.ca
Mon Nov 18 18:35:10 PST 2013


On Tuesday, 19 November 2013 at 02:03:05 UTC, Andrei Alexandrescu
wrote:
> 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
I will see if I can put something together.

Regards,
Craig


More information about the Digitalmars-d mailing list