From d3bd3632ac06bdb7f76b13494873b3567edabcbf Mon Sep 17 00:00:00 2001 From: Thomas Fitzsimmons Date: Fri, 16 Aug 2002 21:29:45 +0000 Subject: * libc/sys/linux/cmath: New directory. * libc/sys/linux/include/cmathcalls.h: New file. * libc/sys/linux/include/complex.h: New file. * libc/sys/linux/machine/i386/huge_val.h: New file * libm/math/w_sincos.c: New file * libm/math/wf_sincos.c: New file * libm/mathfp/s_sincos.c: New file * libm/mathfp/sf_sincos.c: New file * Makefile.am (LIBC_OBJECTLISTS): Add cmath/objectlist.awk.in. * libc/include/math.h: Add sincos and sincosf declarations. * libc/sys/linux/Makefile.am (SUBDIRS): Add cmath. (SUBLIBS): Likewise. * libc/sys/linux/configure.in (AC_OUTPUT): Add cmath. * libm/math/Makefile.am (src): Add w_sincos.c. (fsrc): Add wf_sincos.c. * libm/mathfp/Makefile.am (src): Add s_sincos.c (fsrc): Add sf_sincos.c. --- newlib/libc/sys/linux/include/cmathcalls.h | 158 +++++++++++++++++++++++++++++ newlib/libc/sys/linux/include/complex.h | 108 ++++++++++++++++++++ 2 files changed, 266 insertions(+) create mode 100644 newlib/libc/sys/linux/include/cmathcalls.h create mode 100644 newlib/libc/sys/linux/include/complex.h (limited to 'newlib/libc/sys/linux/include') diff --git a/newlib/libc/sys/linux/include/cmathcalls.h b/newlib/libc/sys/linux/include/cmathcalls.h new file mode 100644 index 000000000..c680c6d8e --- /dev/null +++ b/newlib/libc/sys/linux/include/cmathcalls.h @@ -0,0 +1,158 @@ +/* Prototype declarations for complex math functions; + helper file for . + Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* NOTE: Because of the special way this file is used by , this + file must NOT be protected from multiple inclusion as header files + usually are. + + This file provides prototype declarations for the math functions. + Most functions are declared using the macro: + + __MATHCALL (NAME, (ARGS...)); + + This means there is a function `NAME' returning `double' and a function + `NAMEf' returning `float'. Each place `_Mdouble_' appears in the + prototype, that is actually `double' in the prototype for `NAME' and + `float' in the prototype for `NAMEf'. Reentrant variant functions are + called `NAME_r' and `NAMEf_r'. + + Functions returning other types like `int' are declared using the macro: + + __MATHDECL (TYPE, NAME, (ARGS...)); + + This is just like __MATHCALL but for a function returning `TYPE' + instead of `_Mdouble_'. In all of these cases, there is still + both a `NAME' and a `NAMEf' that takes `float' arguments. */ + +#ifndef _COMPLEX_H +#error "Never use directly; include instead." +#endif + +#define _Mdouble_complex_ _Mdouble_ _Complex + + +/* Trigonometric functions. */ + +/* Arc cosine of Z. */ +__MATHCALL (cacos, (_Mdouble_complex_ __z)); +/* Arc sine of Z. */ +__MATHCALL (casin, (_Mdouble_complex_ __z)); +/* Arc tangent of Z. */ +__MATHCALL (catan, (_Mdouble_complex_ __z)); + +/* Cosine of Z. */ +__MATHCALL (ccos, (_Mdouble_complex_ __z)); +/* Sine of Z. */ +__MATHCALL (csin, (_Mdouble_complex_ __z)); +/* Tangent of Z. */ +__MATHCALL (ctan, (_Mdouble_complex_ __z)); + + +/* Hyperbolic functions. */ + +/* Hyperbolic arc cosine of Z. */ +__MATHCALL (cacosh, (_Mdouble_complex_ __z)); +/* Hyperbolic arc sine of Z. */ +__MATHCALL (casinh, (_Mdouble_complex_ __z)); +/* Hyperbolic arc tangent of Z. */ +__MATHCALL (catanh, (_Mdouble_complex_ __z)); + +/* Hyperbolic cosine of Z. */ +__MATHCALL (ccosh, (_Mdouble_complex_ __z)); +/* Hyperbolic sine of Z. */ +__MATHCALL (csinh, (_Mdouble_complex_ __z)); +/* Hyperbolic tangent of Z. */ +__MATHCALL (ctanh, (_Mdouble_complex_ __z)); + + +/* Exponential and logarithmic functions. */ + +/* Exponential function of Z. */ +__MATHCALL (cexp, (_Mdouble_complex_ __z)); + +/* Natural logarithm of Z. */ +__MATHCALL (clog, (_Mdouble_complex_ __z)); + +#ifdef __USE_GNU +/* The base 10 logarithm is not defined by the standard but to implement + the standard C++ library it is handy. */ +__MATHCALL (clog10, (_Mdouble_complex_ __z)); +#endif + +/* Power functions. */ + +/* Return X to the Y power. */ +__MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y)); + +/* Return the square root of Z. */ +__MATHCALL (csqrt, (_Mdouble_complex_ __z)); + + +/* Absolute value, conjugates, and projection. */ + +/* Absolute value of Z. */ +__MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z)); + +/* Argument value of Z. */ +__MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z)); + +/* Complex conjugate of Z. */ +__MATHCALL (conj, (_Mdouble_complex_ __z)); + +/* Projection of Z onto the Riemann sphere. */ +__MATHCALL (cproj, (_Mdouble_complex_ __z)); + + +/* Decomposing complex values. */ + +/* Imaginary part of Z. */ +__MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z)); + +/* Real part of Z. */ +__MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z)); + + +/* Now some optimized versions. GCC has handy notations for these + functions. Recent GCC handles these as builtin functions so does + not need inlines. */ +#if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__ + +/* Imaginary part of Z. */ +extern __inline _Mdouble_ +__MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW +{ + return __imag__ __z; +} + +/* Real part of Z. */ +extern __inline _Mdouble_ +__MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW +{ + return __real__ __z; +} + +/* Complex conjugate of Z. */ +extern __inline _Mdouble_complex_ +__MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW +{ + return __extension__ ~__z; +} + +#endif diff --git a/newlib/libc/sys/linux/include/complex.h b/newlib/libc/sys/linux/include/complex.h new file mode 100644 index 000000000..daa465674 --- /dev/null +++ b/newlib/libc/sys/linux/include/complex.h @@ -0,0 +1,108 @@ +/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99: 7.3 Complex arithmetic + */ + +#ifndef _COMPLEX_H +#define _COMPLEX_H 1 + +#include +#include + +__BEGIN_DECLS + +#define __CONCAT(x,y) x ## y +/* We might need to add support for more compilers here. But since ISO + C99 is out hopefully all maintained compilers will soon provide the data + types `float complex' and `double complex'. */ +#if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97) +# define _Complex __complex__ +#endif + +#define complex _Complex + +/* Narrowest imaginary unit. This depends on the floating-point + evaluation method. + XXX This probably has to go into a gcc related file. */ +#define _Complex_I (__extension__ 1.0iF) + +/* Another more descriptive name is `I'. + XXX Once we have the imaginary support switch this to _Imaginary_I. */ +#undef I +#define I _Complex_I + +/* The file contains the prototypes for all the + actual math functions. These macros are used for those prototypes, + so we can easily declare each function as both `name' and `__name', + and can declare the float versions `namef' and `__namef'. */ + +#define __MATHCALL(function, args) \ + __MATHDECL (_Mdouble_complex_,function, args) +#define __MATHDECL(type, function, args) \ + __MATHDECL_1(type, function, args); \ + __MATHDECL_1(type, __CONCAT(__,function), args) +#define __MATHDECL_1(type, function, args) \ + extern type __MATH_PRECNAME(function) args __THROW + +#define _Mdouble_ double +#define __MATH_PRECNAME(name) name +#include +#undef _Mdouble_ +#undef __MATH_PRECNAME + +/* Now the float versions. */ +#ifndef _Mfloat_ +# define _Mfloat_ float +#endif +#define _Mdouble_ _Mfloat_ +#ifdef __STDC__ +# define __MATH_PRECNAME(name) name##f +#else +# define __MATH_PRECNAME(name) name/**/f +#endif +#include +#undef _Mdouble_ +#undef __MATH_PRECNAME + +#if 0 +/* And the long double versions. It is non-critical to define them + here unconditionally since `long double' is required in ISO C99. */ +#if __STDC__ - 0 || __GNUC__ - 0 && !defined __NO_LONG_DOUBLE_MATH +# ifndef _Mlong_double_ +# define _Mlong_double_ long double +# endif +# define _Mdouble_ _Mlong_double_ +# ifdef __STDC__ +# define __MATH_PRECNAME(name) name##l +# else +# define __MATH_PRECNAME(name) name/**/l +# endif +# include +#endif +#endif +#undef _Mdouble_ +#undef __MATH_PRECNAME +#undef __MATHDECL_1 +#undef __MATHDECL +#undef __MATHCALL + +__END_DECLS + +#endif /* complex.h */ -- cgit v1.2.3