diff options
author | Francois-Xavier Coudert <coudert@clipper.ens.fr> | 2005-09-25 23:39:58 +0200 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2005-09-25 21:39:58 +0000 |
commit | 1409cd0b8e101b5542cf92ee5378bc0a45f8f2ed (patch) | |
tree | 03f679a4e6e5541f1f29cf7b38a296b55f8061f8 /libgfortran/generated | |
parent | 86ab632081cc94593ab6c22842d084fce5cf54d4 (diff) | |
download | gcc-1409cd0b8e101b5542cf92ee5378bc0a45f8f2ed.zip gcc-1409cd0b8e101b5542cf92ee5378bc0a45f8f2ed.tar.gz gcc-1409cd0b8e101b5542cf92ee5378bc0a45f8f2ed.tar.bz2 |
c99_protos.h: Add prototypes for C99 complex functions.
* c99_protos.h: Add prototypes for C99 complex functions.
* libgfortran.h: Include complex.h before c99_protos.h.
* intrinsics/c99_functions.c: Define HAVE_ macros for the
fallback functions we provide.
(cabsf, cabs, cabsl, cargf, carg, cargl, cexpf, cexp, cexpl,
clogf, clog, clogl, clog10f, clog10, clog10l, cpowf, cpow, cpowl,
cqsrtf, csqrt, csqrtl, csinhf, csinh, csinhl, ccoshf, ccosh,
ccoshl, ctanhf, ctanh, ctanhl, csinf, csin, csinl, ccosf, ccos,
ccosl, ctanf, ctan, ctanl): New fallback functions.
* Makefile.am (gfor_math_trig_c, gfor_math_trig_obj,
gfor_specific_c, gfor_cmath_src, gfor_cmath_obj): Remove.
* Makefile.in: Regenerate.
* configure.ac: Remove checks for csin. Add checks for all C99
complex functions.
* config.h.in: Regenerate.
* configure: Regenerate.
* aclocal.m4: Regenerate.
From-SVN: r104626
Diffstat (limited to 'libgfortran/generated')
-rw-r--r-- | libgfortran/generated/exp_c4.c | 145 | ||||
-rw-r--r-- | libgfortran/generated/exp_c8.c | 145 | ||||
-rw-r--r-- | libgfortran/generated/hyp_c4.c | 80 | ||||
-rw-r--r-- | libgfortran/generated/hyp_c8.c | 80 | ||||
-rw-r--r-- | libgfortran/generated/trig_c4.c | 80 | ||||
-rw-r--r-- | libgfortran/generated/trig_c8.c | 80 |
6 files changed, 0 insertions, 610 deletions
diff --git a/libgfortran/generated/exp_c4.c b/libgfortran/generated/exp_c4.c deleted file mode 100644 index 0e49992..0000000 --- a/libgfortran/generated/exp_c4.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Complex exponential functions - Copyright 2002, 2004 Free Software Foundation, Inc. - Contributed by Paul Brook <paul@nowt.org> - -This file is part of the GNU Fortran 95 runtime library (libgfortran). - -Libgfortran is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -In addition to the permissions in the GNU General Public License, the -Free Software Foundation gives you unlimited permission to link the -compiled version of this file into combinations with other programs, -and to distribute those combinations without any restriction coming -from the use of this file. (The General Public License restrictions -do apply in other respects; for example, they cover modification of -the file, and distribution when not linked into a combine -executable.) - -Libgfortran is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public -License along with libgfortran; see the file COPYING. If not, -write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. */ -#include <math.h> -#include "libgfortran.h" - - -/* z = a + ib */ -/* Absolute value. */ -GFC_REAL_4 -cabsf (GFC_COMPLEX_4 z) -{ - return hypotf (REALPART (z), IMAGPART (z)); -} - -/* 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; - - return atan2f (IMAGPART (z), REALPART (z)); -} - -/* exp(z) = exp(a)*(cos(b) + isin(b)) */ -GFC_COMPLEX_4 -cexpf (GFC_COMPLEX_4 z) -{ - GFC_REAL_4 a; - GFC_REAL_4 b; - GFC_COMPLEX_4 v; - - a = REALPART (z); - b = IMAGPART (z); - COMPLEX_ASSIGN (v, cosf (b), sinf (b)); - return expf (a) * v; -} - -/* log(z) = log (cabs(z)) + i*carg(z) */ -GFC_COMPLEX_4 -clogf (GFC_COMPLEX_4 z) -{ - GFC_COMPLEX_4 v; - - COMPLEX_ASSIGN (v, logf (cabsf (z)), cargf (z)); - return v; -} - -/* log10(z) = log10 (cabs(z)) + i*carg(z) */ -GFC_COMPLEX_4 -clog10f (GFC_COMPLEX_4 z) -{ - GFC_COMPLEX_4 v; - - COMPLEX_ASSIGN (v, log10f (cabsf (z)), cargf (z)); - return v; -} - -/* pow(base, power) = cexp (power * clog (base)) */ -GFC_COMPLEX_4 -cpowf (GFC_COMPLEX_4 base, GFC_COMPLEX_4 power) -{ - return cexpf (power * clogf (base)); -} - -/* sqrt(z). Algorithm pulled from glibc. */ -GFC_COMPLEX_4 -csqrtf (GFC_COMPLEX_4 z) -{ - GFC_REAL_4 re; - GFC_REAL_4 im; - GFC_COMPLEX_4 v; - - re = REALPART (z); - im = IMAGPART (z); - if (im == 0.0) - { - if (re < 0.0) - { - COMPLEX_ASSIGN (v, 0.0, copysignf (sqrtf (-re), im)); - } - else - { - COMPLEX_ASSIGN (v, fabsf (sqrtf (re)), - copysignf (0.0, im)); - } - } - else if (re == 0.0) - { - GFC_REAL_4 r; - - r = sqrtf (0.5 * fabsf (im)); - - COMPLEX_ASSIGN (v, copysignf (r, im), r); - } - else - { - GFC_REAL_4 d, r, s; - - d = hypotf (re, im); - /* Use the identity 2 Re res Im res = Im x - to avoid cancellation error in d +/- Re x. */ - if (re > 0) - { - r = sqrtf (0.5 * d + 0.5 * re); - s = (0.5 * im) / r; - } - else - { - s = sqrtf (0.5 * d - 0.5 * re); - r = fabsf ((0.5 * im) / s); - } - - COMPLEX_ASSIGN (v, r, copysignf (s, im)); - } - return v; -} - diff --git a/libgfortran/generated/exp_c8.c b/libgfortran/generated/exp_c8.c deleted file mode 100644 index a122856..0000000 --- a/libgfortran/generated/exp_c8.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Complex exponential functions - Copyright 2002, 2004 Free Software Foundation, Inc. - Contributed by Paul Brook <paul@nowt.org> - -This file is part of the GNU Fortran 95 runtime library (libgfortran). - -Libgfortran is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -In addition to the permissions in the GNU General Public License, the -Free Software Foundation gives you unlimited permission to link the -compiled version of this file into combinations with other programs, -and to distribute those combinations without any restriction coming -from the use of this file. (The General Public License restrictions -do apply in other respects; for example, they cover modification of -the file, and distribution when not linked into a combine -executable.) - -Libgfortran is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public -License along with libgfortran; see the file COPYING. If not, -write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. */ -#include <math.h> -#include "libgfortran.h" - - -/* z = a + ib */ -/* Absolute value. */ -GFC_REAL_8 -cabs (GFC_COMPLEX_8 z) -{ - return hypot (REALPART (z), IMAGPART (z)); -} - -/* 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; - - return atan2 (IMAGPART (z), REALPART (z)); -} - -/* exp(z) = exp(a)*(cos(b) + isin(b)) */ -GFC_COMPLEX_8 -cexp (GFC_COMPLEX_8 z) -{ - GFC_REAL_8 a; - GFC_REAL_8 b; - GFC_COMPLEX_8 v; - - a = REALPART (z); - b = IMAGPART (z); - COMPLEX_ASSIGN (v, cos (b), sin (b)); - return exp (a) * v; -} - -/* log(z) = log (cabs(z)) + i*carg(z) */ -GFC_COMPLEX_8 -clog (GFC_COMPLEX_8 z) -{ - GFC_COMPLEX_8 v; - - COMPLEX_ASSIGN (v, log (cabs (z)), carg (z)); - return v; -} - -/* log10(z) = log10 (cabs(z)) + i*carg(z) */ -GFC_COMPLEX_8 -clog10 (GFC_COMPLEX_8 z) -{ - GFC_COMPLEX_8 v; - - COMPLEX_ASSIGN (v, log10 (cabs (z)), carg (z)); - return v; -} - -/* pow(base, power) = cexp (power * clog (base)) */ -GFC_COMPLEX_8 -cpow (GFC_COMPLEX_8 base, GFC_COMPLEX_8 power) -{ - return cexp (power * clog (base)); -} - -/* sqrt(z). Algorithm pulled from glibc. */ -GFC_COMPLEX_8 -csqrt (GFC_COMPLEX_8 z) -{ - GFC_REAL_8 re; - GFC_REAL_8 im; - GFC_COMPLEX_8 v; - - re = REALPART (z); - im = IMAGPART (z); - if (im == 0.0) - { - if (re < 0.0) - { - COMPLEX_ASSIGN (v, 0.0, copysign (sqrt (-re), im)); - } - else - { - COMPLEX_ASSIGN (v, fabs (sqrt (re)), - copysign (0.0, im)); - } - } - else if (re == 0.0) - { - GFC_REAL_8 r; - - r = sqrt (0.5 * fabs (im)); - - COMPLEX_ASSIGN (v, copysign (r, im), r); - } - else - { - GFC_REAL_8 d, r, s; - - d = hypot (re, im); - /* Use the identity 2 Re res Im res = Im x - to avoid cancellation error in d +/- Re x. */ - if (re > 0) - { - r = sqrt (0.5 * d + 0.5 * re); - s = (0.5 * im) / r; - } - else - { - s = sqrt (0.5 * d - 0.5 * re); - r = fabs ((0.5 * im) / s); - } - - COMPLEX_ASSIGN (v, r, copysign (s, im)); - } - return v; -} - diff --git a/libgfortran/generated/hyp_c4.c b/libgfortran/generated/hyp_c4.c deleted file mode 100644 index 5fdff7b..0000000 --- a/libgfortran/generated/hyp_c4.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Complex hyperbolic functions - Copyright 2002 Free Software Foundation, Inc. - Contributed by Paul Brook <paul@nowt.org> - -This file is part of the GNU Fortran 95 runtime library (libgfortran). - -Libgfortran is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -In addition to the permissions in the GNU General Public License, the -Free Software Foundation gives you unlimited permission to link the -compiled version of this file into combinations with other programs, -and to distribute those combinations without any restriction coming -from the use of this file. (The General Public License restrictions -do apply in other respects; for example, they cover modification of -the file, and distribution when not linked into a combine -executable.) - -Libgfortran is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public -License along with libgfortran; see the file COPYING. If not, -write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. */ -#include <math.h> -#include "libgfortran.h" - - -/* Complex number z = a + ib. */ - -/* sinh(z) = sinh(a)cos(b) + icosh(a)sin(b) */ -GFC_COMPLEX_4 -csinhf (GFC_COMPLEX_4 a) -{ - GFC_REAL_4 r; - GFC_REAL_4 i; - GFC_COMPLEX_4 v; - - r = REALPART (a); - i = IMAGPART (a); - COMPLEX_ASSIGN (v, sinhf (r) * cosf (i), coshf (r) * sinf (i)); - return v; -} - -/* cosh(z) = cosh(a)cos(b) - isinh(a)sin(b) */ -GFC_COMPLEX_4 -ccoshf (GFC_COMPLEX_4 a) -{ - GFC_REAL_4 r; - GFC_REAL_4 i; - GFC_COMPLEX_4 v; - - r = REALPART (a); - i = IMAGPART (a); - COMPLEX_ASSIGN (v, coshf (r) * cosf (i), - (sinhf (r) * sinf (i))); - return v; -} - -/* tanh(z) = (tanh(a) + itan(b)) / (1 - itanh(a)tan(b)) */ -GFC_COMPLEX_4 -ctanhf (GFC_COMPLEX_4 a) -{ - GFC_REAL_4 rt; - GFC_REAL_4 it; - GFC_COMPLEX_4 n; - GFC_COMPLEX_4 d; - - rt = tanhf (REALPART (a)); - it = tanf (IMAGPART (a)); - COMPLEX_ASSIGN (n, rt, it); - COMPLEX_ASSIGN (d, 1, - (rt * it)); - - return n / d; -} - diff --git a/libgfortran/generated/hyp_c8.c b/libgfortran/generated/hyp_c8.c deleted file mode 100644 index 436a6a6..0000000 --- a/libgfortran/generated/hyp_c8.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Complex hyperbolic functions - Copyright 2002 Free Software Foundation, Inc. - Contributed by Paul Brook <paul@nowt.org> - -This file is part of the GNU Fortran 95 runtime library (libgfortran). - -Libgfortran is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -In addition to the permissions in the GNU General Public License, the -Free Software Foundation gives you unlimited permission to link the -compiled version of this file into combinations with other programs, -and to distribute those combinations without any restriction coming -from the use of this file. (The General Public License restrictions -do apply in other respects; for example, they cover modification of -the file, and distribution when not linked into a combine -executable.) - -Libgfortran is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public -License along with libgfortran; see the file COPYING. If not, -write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. */ -#include <math.h> -#include "libgfortran.h" - - -/* Complex number z = a + ib. */ - -/* sinh(z) = sinh(a)cos(b) + icosh(a)sin(b) */ -GFC_COMPLEX_8 -csinh (GFC_COMPLEX_8 a) -{ - GFC_REAL_8 r; - GFC_REAL_8 i; - GFC_COMPLEX_8 v; - - r = REALPART (a); - i = IMAGPART (a); - COMPLEX_ASSIGN (v, sinh (r) * cos (i), cosh (r) * sin (i)); - return v; -} - -/* cosh(z) = cosh(a)cos(b) - isinh(a)sin(b) */ -GFC_COMPLEX_8 -ccosh (GFC_COMPLEX_8 a) -{ - GFC_REAL_8 r; - GFC_REAL_8 i; - GFC_COMPLEX_8 v; - - r = REALPART (a); - i = IMAGPART (a); - COMPLEX_ASSIGN (v, cosh (r) * cos (i), - (sinh (r) * sin (i))); - return v; -} - -/* tanh(z) = (tanh(a) + itan(b)) / (1 - itanh(a)tan(b)) */ -GFC_COMPLEX_8 -ctanh (GFC_COMPLEX_8 a) -{ - GFC_REAL_8 rt; - GFC_REAL_8 it; - GFC_COMPLEX_8 n; - GFC_COMPLEX_8 d; - - rt = tanh (REALPART (a)); - it = tan (IMAGPART (a)); - COMPLEX_ASSIGN (n, rt, it); - COMPLEX_ASSIGN (d, 1, - (rt * it)); - - return n / d; -} - diff --git a/libgfortran/generated/trig_c4.c b/libgfortran/generated/trig_c4.c deleted file mode 100644 index 30f7999..0000000 --- a/libgfortran/generated/trig_c4.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Complex trig functions - Copyright 2002 Free Software Foundation, Inc. - Contributed by Paul Brook <paul@nowt.org> - -This file is part of the GNU Fortran 95 runtime library (libgfortran). - -Libgfortran is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -In addition to the permissions in the GNU General Public License, the -Free Software Foundation gives you unlimited permission to link the -compiled version of this file into combinations with other programs, -and to distribute those combinations without any restriction coming -from the use of this file. (The General Public License restrictions -do apply in other respects; for example, they cover modification of -the file, and distribution when not linked into a combine -executable.) - -Libgfortran is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public -License along with libgfortran; see the file COPYING. If not, -write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. */ -#include <math.h> -#include "libgfortran.h" - - -/* Complex number z = a + ib. */ - -/* sin(z) = sin(a)cosh(b) + icos(a)sinh(b) */ -GFC_COMPLEX_4 -csinf (GFC_COMPLEX_4 a) -{ - GFC_REAL_4 r; - GFC_REAL_4 i; - GFC_COMPLEX_4 v; - - r = REALPART (a); - i = IMAGPART (a); - COMPLEX_ASSIGN (v, sinf (r) * coshf (i), cosf (r) * sinhf (i)); - return v; -} - -/* cos(z) = cos(a)cosh(b) - isin(a)sinh(b) */ -GFC_COMPLEX_4 -ccosf (GFC_COMPLEX_4 a) -{ - GFC_REAL_4 r; - GFC_REAL_4 i; - GFC_COMPLEX_4 v; - - r = REALPART (a); - i = IMAGPART (a); - COMPLEX_ASSIGN (v, cosf (r) * coshf (i), - (sinf (r) * sinhf (i))); - return v; -} - -/* tan(z) = (tan(a) + itanh(b)) / (1 - itan(a)tanh(b)) */ -GFC_COMPLEX_4 -ctanf (GFC_COMPLEX_4 a) -{ - GFC_REAL_4 rt; - GFC_REAL_4 it; - GFC_COMPLEX_4 n; - GFC_COMPLEX_4 d; - - rt = tanf (REALPART (a)); - it = tanhf (IMAGPART (a)); - COMPLEX_ASSIGN (n, rt, it); - COMPLEX_ASSIGN (d , 1, - (rt * it)); - - return n / d; -} - diff --git a/libgfortran/generated/trig_c8.c b/libgfortran/generated/trig_c8.c deleted file mode 100644 index 9734e99..0000000 --- a/libgfortran/generated/trig_c8.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Complex trig functions - Copyright 2002 Free Software Foundation, Inc. - Contributed by Paul Brook <paul@nowt.org> - -This file is part of the GNU Fortran 95 runtime library (libgfortran). - -Libgfortran is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -In addition to the permissions in the GNU General Public License, the -Free Software Foundation gives you unlimited permission to link the -compiled version of this file into combinations with other programs, -and to distribute those combinations without any restriction coming -from the use of this file. (The General Public License restrictions -do apply in other respects; for example, they cover modification of -the file, and distribution when not linked into a combine -executable.) - -Libgfortran is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public -License along with libgfortran; see the file COPYING. If not, -write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. */ -#include <math.h> -#include "libgfortran.h" - - -/* Complex number z = a + ib. */ - -/* sin(z) = sin(a)cosh(b) + icos(a)sinh(b) */ -GFC_COMPLEX_8 -csin (GFC_COMPLEX_8 a) -{ - GFC_REAL_8 r; - GFC_REAL_8 i; - GFC_COMPLEX_8 v; - - r = REALPART (a); - i = IMAGPART (a); - COMPLEX_ASSIGN (v, sin (r) * cosh (i), cos (r) * sinh (i)); - return v; -} - -/* cos(z) = cos(a)cosh(b) - isin(a)sinh(b) */ -GFC_COMPLEX_8 -ccos (GFC_COMPLEX_8 a) -{ - GFC_REAL_8 r; - GFC_REAL_8 i; - GFC_COMPLEX_8 v; - - r = REALPART (a); - i = IMAGPART (a); - COMPLEX_ASSIGN (v, cos (r) * cosh (i), - (sin (r) * sinh (i))); - return v; -} - -/* tan(z) = (tan(a) + itanh(b)) / (1 - itan(a)tanh(b)) */ -GFC_COMPLEX_8 -ctan (GFC_COMPLEX_8 a) -{ - GFC_REAL_8 rt; - GFC_REAL_8 it; - GFC_COMPLEX_8 n; - GFC_COMPLEX_8 d; - - rt = tan (REALPART (a)); - it = tanh (IMAGPART (a)); - COMPLEX_ASSIGN (n, rt, it); - COMPLEX_ASSIGN (d , 1, - (rt * it)); - - return n / d; -} - |