http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50880
--- Comment #7 from Richard B. Kreckel <kreckel at ginac dot de> 2011-10-28 21:52:08 UTC --- > As soon as I find a bit of > time, we can also *consistently over all those cases* use __builtin_signbit, > as > suggested by Gaby elsewhere. I have to double check with the middle-end people > that it doesn't generate library calls for the patch to be neat. We also better double check whether the results stay correct. Thinking of it... Big Ooops! It turns out the patch makes it much better but still not entirely correct. On systems that feature a signed zero, it gives incorrect results when either * __z.real() is -0.0 and signbit(__z.imag()) * __z.real() < -1.0 and __z.imag() is -0.0 The first problem can be fixed by using signbit instead of -0.0, as you proposed, but the second needs more correction. The patch BC1 I'm attaching should fix these cases, too. But this is starting to look cumbersome. We are trying to construct a formula that is continuous except on the branch cut defined in C99. Why not just use the formula mentioned in CLTL2 [0] like in patch BC2 that I'm attaching? (The branch cuts of inverse trig functinos in C99 and Common Lisp are the same.) [0] <http://www-prod-gif.supelec.fr/docs/cltl/clm/node129.html#SECTION001653000000000000000>