From: Paul Brook Date: Sun, 11 Jul 2004 16:05:08 +0000 (+0000) Subject: re PR fortran/16303 (Complex logarithm function sometimes chooses a non-principal... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1e38f159295f7d09b6dc6452a75c0b069ecd550a;p=gcc.git re PR fortran/16303 (Complex logarithm function sometimes chooses a non-principal branch) PR fortran/16303 * m4/cexp.m4 (carg): Return -pi to pi. * generated/exp_c?.c: Regenerate. From-SVN: r84516 --- diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 8458be34da2..eb4b29c6866 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2004-07-11 Paul Brook + + PR fortran/16303 + * m4/cexp.m4 (carg): Return -pi to pi. + * generated/exp_c?.c: Regenerate. + 2004-07-08 Andreas Krebbel PR fortran/16291 diff --git a/libgfortran/generated/exp_c4.c b/libgfortran/generated/exp_c4.c index d95213446ee..06e0103e3d8 100644 --- a/libgfortran/generated/exp_c4.c +++ b/libgfortran/generated/exp_c4.c @@ -30,17 +30,14 @@ cabsf (GFC_COMPLEX_4 z) return hypotf (REALPART (z), IMAGPART (z)); } -/* Complex argument. The angle made with the +ve real axis. Range 0-2pi. */ +/* Complex argument. The angle made with the +ve real axis. + Range -pi-pi. */ GFC_REAL_4 cargf (GFC_COMPLEX_4 z) { GFC_REAL_4 arg; - arg = atan2f (IMAGPART (z), REALPART (z)); - if (arg < 0) - return arg + 2 * M_PI; - else - return arg; + return atan2f (IMAGPART (z), REALPART (z)); } /* exp(z) = exp(a)*(cos(b) + isin(b)) */ diff --git a/libgfortran/generated/exp_c8.c b/libgfortran/generated/exp_c8.c index 74cbbdc5145..5bd96495b96 100644 --- a/libgfortran/generated/exp_c8.c +++ b/libgfortran/generated/exp_c8.c @@ -30,17 +30,14 @@ cabs (GFC_COMPLEX_8 z) return hypot (REALPART (z), IMAGPART (z)); } -/* Complex argument. The angle made with the +ve real axis. Range 0-2pi. */ +/* Complex argument. The angle made with the +ve real axis. + Range -pi-pi. */ GFC_REAL_8 carg (GFC_COMPLEX_8 z) { GFC_REAL_8 arg; - arg = atan2 (IMAGPART (z), REALPART (z)); - if (arg < 0) - return arg + 2 * M_PI; - else - return arg; + return atan2 (IMAGPART (z), REALPART (z)); } /* exp(z) = exp(a)*(cos(b) + isin(b)) */ diff --git a/libgfortran/m4/cexp.m4 b/libgfortran/m4/cexp.m4 index 1d22b089a92..c91945051e3 100644 --- a/libgfortran/m4/cexp.m4 +++ b/libgfortran/m4/cexp.m4 @@ -31,17 +31,14 @@ cabs`'q (complex_type z) return hypot`'q (REALPART (z), IMAGPART (z)); } -/* Complex argument. The angle made with the +ve real axis. Range 0-2pi. */ +/* Complex argument. The angle made with the +ve real axis. + Range -pi-pi. */ real_type carg`'q (complex_type z) { real_type arg; - arg = atan2`'q (IMAGPART (z), REALPART (z)); - if (arg < 0) - return arg + 2 * M_PI; - else - return arg; + return atan2`'q (IMAGPART (z), REALPART (z)); } /* exp(z) = exp(a)*(cos(b) + isin(b)) */