std.complex

Iain Buclaw ibuclaw at gdcproject.org
Tue Nov 26 01:11:45 PST 2013


On 19 November 2013 02:03, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> 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.
>

Gaussian integers / Graph plotting?

IMO I don't see a reason why not to support in the library if it
requires no change on the compiler side.

Regards
Iain,


More information about the Digitalmars-d mailing list