Remove complex and imaginary types?

Georg Wrede georg at nospam.org
Mon Jan 7 19:03:44 PST 2008


Don Clugston wrote:
> Suppose you're writing a generic function product(T)(T[]) which returns 
> T[0]*T[1]*T[2]*... What's the return type?
> Suppose T is idouble. Then if the number of elements in T is odd, the 
> return type should be idouble, but if it's even, the return type should 
> be double!

I definitely don't pretend to understand any of that, but shouldn't it 
all follow the pertinent trails of mathematics?

As in, case one, idouble; case two, double -- and the latter should 
probably be an idouble where one of the parts of the result De Facto 
makes it double, while still technically being an idouble.

Any further calculation that wants to perceive a difference, might then 
start with checking whether the argument is "in practice a double, or 
really idouble".



More information about the Digitalmars-d mailing list