Re: Complex Numbers

2005-01-21 Thread Paolo Carlini
Paolo Carlini wrote: We are already aware of this issue, since you have already reported it ;) The relevant PR is middle-end/18902. Forgot to add: for other issues, related in particular to multiplication, not only division, please file appropriate Bugzilla PRs. Thanks! Paolo.

Re: Complex Numbers

2005-01-21 Thread Paolo Carlini
I have looked at the implementation of complex arithmetic in gcc. We are already aware of this issue, since you have already reported it ;) The relevant PR is middle-end/18902. Indeed, our plan involves enabling the (*already available*) algorithm due to Smith. There are still some open issues, how

Re: complex numbers

2004-12-09 Thread Andreas Klein
Hello > > > Ok, thanks. The important section of the C99 standard is Annex G (IEC > 60559-compatible complex arithmetic): it even provides a reference > implementation of the division in Example2. Perhaps, you could have a > look to a public draft of the final standard, just Google a bit... ;) > Bu

Re: complex numbers

2004-12-08 Thread Paolo Carlini
Andreas Klein wrote: Unfortunally I have own no copy of the C99 standard. So I would be glade if you could give me an internet ressource which disscuss the C99 division algorithm or something like that. Then I will try to check what we can do. Ok, thanks. The important section of the C99 standar

Re: complex numbers

2004-12-08 Thread Andreas Klein
Hello > > | 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 di

Re: complex numbers

2004-12-08 Thread Andreas Klein
Hello > > > Have a look to the implementation: it looks like that even if we switch > to the > better algorithm, still we don't get fully right C99. Of course this > last point > must be better investigate (I'm not a floating point expert) but I > expect someone > replying: "let's implement C99 div

Re: complex numbers

2004-12-07 Thread Gabriel Dos Reis
Andreas Klein <[EMAIL PROTECTED]> writes: | This look like a good deal. However for floting point computations I | prevere good results over fast results. You're in the minority (including me :-)). -- Gaby

Re: complex numbers

2004-12-07 Thread Gabriel Dos Reis
Andreas Klein <[EMAIL PROTECTED]> writes: | On Mon, 6 Dec 2004, Gabriel Dos Reis wrote: | | > | > As a matter of fact, the implementation of 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 spec

Re: complex numbers

2004-12-07 Thread Paolo Carlini
Andreas Klein wrote: ... but notice that this issue is tricky: there are computational issues (we are adding at least a branch for each division) and correctness issues (what about C99?) As I see it the naive formula needs 6 multipications, 2 divisions and 3 additions/subtractions and the impr

Re: complex numbers

2004-12-07 Thread Andreas Klein
Hello > >However I think if flag_complex_divide_method = 1 fix the problem it would > >be a good idea to set it by default. > > > > > ... but notice that this issue is tricky: there are computational issues > (we are adding > at least a branch for each division) and correctness issues (what about

Re: complex numbers

2004-12-07 Thread Paolo Carlini
Paolo Carlini wrote: I will try to do the same as soon as possible... I can confirm that setting flag_complex_divide_method = 1 leads to (0, 0). Paolo.

Re: complex numbers

2004-12-07 Thread Paolo Carlini
Andreas Klein wrote: Have a look to expand_complex_division in gcc/tree-complex.c, then gcc/toplev.c for flag_complex_divide_method. Andreas, just for curiosity, are you willing to rebuild your gcc with flag_complex_divide_method = 1 and report??? Willing is not the problem. But I have only li

Re: complex numbers

2004-12-07 Thread Andreas Klein
Hello > Interestingly, it looks like the discussed improved algorithm is > *already* implemented, just not used! Curious > Have a look to expand_complex_division in gcc/tree-complex.c, then > gcc/toplev.c for flag_complex_divide_method. > > Andreas, just for curiosity, are you willing to rebuild

Re: complex numbers

2004-12-07 Thread Paolo Carlini
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, but I cannot change the code of __complex__ T in the complier. Interestingly, it looks like the discussed improved algorithm is *already* i

Re: complex numbers

2004-12-07 Thread Andreas Klein
On Mon, 6 Dec 2004, Gabriel Dos Reis wrote: > > As a matter of fact, the implementation of 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 compile

Re: complex numbers

2004-12-06 Thread Gabriel Dos Reis
Andreas Klein <[EMAIL PROTECTED]> writes: | Hello | | I have found a bug in the implementation of the complex library of | g++ and the complex.h library of the gcc (c99 support). | | The simplest program that demonstrates the bug is: | | | | #include | #include