Andreas Klein <[EMAIL PROTECTED]> writes: | On Mon, 6 Dec 2004, Gabriel Dos Reis wrote: | | > | > As a matter of fact, the implementation of <complex> is criticized, | > once in a while, because it does NOT use the grammar school rule you | > present above. However, for float, double, long double it specializes | > to __complex__ T which is what the compiler uses to implement complex | > numbers in C99 and Fortran. So, the problem is a compiler problem not | > libstdc++ problem. | | I have testet my program with a 2.95 and several 3.x versionsions of gcc. | The lastet version I have is 3.3.3. | All versions gave the same result.
Yup. It is inside the compiler | What was the critice you mentioned above? I can not imagine a sitation in | which I would need the naive implementation. Oh, I got repeated complaints from users that the correct method of computation was slow -- look at the bugzilla archive. I believe there might alos be discussions on GCC main mailing list. The grammar school algorithms is needed for the primary template because it is the one that gets instantiated, for say, complex<int>. Notice that such datatypes are required by LIA-3 (in the last phase of development). We don't have overload on "concepts" so, for the moment that is what is used for anything other thand float, double, and long double. | But I think it can not be | good that if I get different result for complex and real arithmetic. If | the number are the same real numbers. | | > | > Did you look at the actual implementation? | > | | As you mentinon it if have missed the specilization at the end of | std_complex.h. Sorry. I still think that we should have and other | implementation for complex<floating_point>, but I cannot change the code | of __complex__ T in the complier. I don't think we need another implementation of complex<floating_point>. What we need is to improve the compiler. Convince people that we have correctness, then speed. -- Gaby