diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/Makefile | 4 | ||||
| -rw-r--r-- | include/complex.h | 122 | ||||
| -rw-r--r-- | include/math.h | 81 | ||||
| -rw-r--r-- | include/stdlib.h | 4 |
4 files changed, 141 insertions, 70 deletions
diff --git a/include/Makefile b/include/Makefile index d4ff6feb66b..13ea9e5629e 100644 --- a/include/Makefile +++ b/include/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.145 2008/08/22 13:02:53 kettenis Exp $ +# $OpenBSD: Makefile,v 1.146 2008/09/07 20:36:07 martynas Exp $ # $NetBSD: Makefile,v 1.59 1996/05/15 21:36:43 jtc Exp $ # @(#)Makefile 5.45.1.1 (Berkeley) 5/6/91 @@ -12,7 +12,7 @@ USE_GCC3?=No # Missing: mp.h FILES= a.out.h ar.h assert.h bitstring.h blf.h bm.h bsd_auth.h cast.h \ - cpio.h ctype.h curses.h db.h dbm.h des.h dirent.h disktab.h \ + complex.h cpio.h ctype.h curses.h db.h dbm.h des.h dirent.h disktab.h \ dlfcn.h elf_abi.h err.h errno.h fnmatch.h fstab.h fts.h ftw.h getopt.h \ glob.h grp.h ifaddrs.h inttypes.h iso646.h kvm.h langinfo.h \ libgen.h limits.h locale.h login_cap.h malloc.h math.h md4.h \ diff --git a/include/complex.h b/include/complex.h new file mode 100644 index 00000000000..36cc3f9994b --- /dev/null +++ b/include/complex.h @@ -0,0 +1,122 @@ +/* $OpenBSD: complex.h,v 1.1 2008/09/07 20:36:07 martynas Exp $ */ +/* + * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _COMPLEX_H_ +#define _COMPLEX_H_ + +#include <sys/cdefs.h> + +/* + * C99 + */ +#ifdef __GNUC__ +#if __STDC_VERSION__ < 199901 +#define _Complex __complex__ +#endif +#define _Complex_I 1.0fi +#endif + +#define complex _Complex + +/* XXX switch to _Imaginary_I */ +#undef I +#define I _Complex_I + +__BEGIN_DECLS +/* + * Double versions of C99 functions + */ +double complex cacos(double complex); +double complex casin(double complex); +double complex catan(double complex); +double complex ccos(double complex); +double complex csin(double complex); +double complex ctan(double complex); +double complex cacosh(double complex); +double complex casinh(double complex); +double complex catanh(double complex); +double complex ccosh(double complex); +double complex csinh(double complex); +double complex ctanh(double complex); +double complex cexp(double complex); +double complex clog(double complex); +double cabs(double complex); +double complex cpow(double complex, double complex); +double complex csqrt(double complex); +double carg(double complex); +double cimag(double complex); +double complex conj(double complex); +double complex cproj(double complex); +double creal(double complex); + +/* + * Float versions of C99 functions + */ +float complex cacosf(float complex); +float complex casinf(float complex); +float complex catanf(float complex); +float complex ccosf(float complex); +float complex csinf(float complex); +float complex ctanf(float complex); +float complex cacoshf(float complex); +float complex casinhf(float complex); +float complex catanhf(float complex); +float complex ccoshf(float complex); +float complex csinhf(float complex); +float complex ctanhf(float complex); +float complex cexpf(float complex); +float complex clogf(float complex); +float cabsf(float complex); +float complex cpowf(float complex, float complex); +float complex csqrtf(float complex); +float cargf(float complex); +float cimagf(float complex); +float complex conjf(float complex); +float complex cprojf(float complex); +float crealf(float complex); + +/* + * Long double versions of C99 functions + */ +#if 0 +long double complex cacosl(long double complex); +long double complex casinl(long double complex); +long double complex catanl(long double complex); +long double complex ccosl(long double complex); +long double complex csinl(long double complex); +long double complex ctanl(long double complex); +long double complex cacoshl(long double complex); +long double complex casinhl(long double complex); +long double complex catanhl(long double complex); +long double complex ccoshl(long double complex); +long double complex csinhl(long double complex); +long double complex ctanhl(long double complex); +long double complex cexpl(long double complex); +long double complex clogl(long double complex); +long double cabsl(long double complex); +long double complex cpowl(long double complex, + long double complex); +long double complex csqrtl(long double complex); +long double cargl(long double complex); +long double cimagl(long double complex); +long double complex conjl(long double complex); +long double complex cprojl(long double complex); +long double creall(long double complex); +#endif +__END_DECLS + +#endif _COMPLEX_H_ /* !_COMPLEX_H_ */ diff --git a/include/math.h b/include/math.h index ba64e75117c..bb953739684 100644 --- a/include/math.h +++ b/include/math.h @@ -1,4 +1,4 @@ -/* $OpenBSD: math.h,v 1.20 2008/07/24 09:41:58 martynas Exp $ */ +/* $OpenBSD: math.h,v 1.21 2008/09/07 20:36:07 martynas Exp $ */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -63,18 +63,6 @@ extern char __nan[]; : (sizeof (x) == sizeof (double)) ? \ __isfinite(x) \ : __isfinitel(x)) -#define isinf(x) \ - ((sizeof (x) == sizeof (float)) ? \ - isinff(x) \ - : (sizeof (x) == sizeof (double)) ? \ - __isinf(x) \ - : __isinfl(x)) -#define isnan(x) \ - ((sizeof (x) == sizeof (float)) ? \ - isnanf(x) \ - : (sizeof (x) == sizeof (double)) ? \ - __isnan(x) \ - : __isnanl(x)) #define isnormal(x) \ ((sizeof (x) == sizeof (float)) ? \ __isnormalf(x) \ @@ -97,6 +85,19 @@ extern char __nan[]; #define isunordered(x, y) (isnan(x) || isnan(y)) #endif /* __ISO_C_VISIBLE >= 1999 */ +#define isinf(x) \ + ((sizeof (x) == sizeof (float)) ? \ + isinff(x) \ + : (sizeof (x) == sizeof (double)) ? \ + __isinf(x) \ + : __isinfl(x)) +#define isnan(x) \ + ((sizeof (x) == sizeof (float)) ? \ + isnanf(x) \ + : (sizeof (x) == sizeof (double)) ? \ + __isnan(x) \ + : __isnanl(x)) + /* * XOPEN/SVID */ @@ -125,51 +126,7 @@ extern int signgam; #endif /* __BSD_VISIBLE || __XPG_VISIBLE */ #if __BSD_VISIBLE -enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix}; - -#define _LIB_VERSION_TYPE enum fdversion -#define _LIB_VERSION _fdlib_version - -/* if global variable _LIB_VERSION is not desirable, one may - * change the following to be a constant by: - * #define _LIB_VERSION_TYPE const enum version - * In that case, after one initializes the value _LIB_VERSION (see - * s_lib_version.c) during compile time, it cannot be modified - * in the middle of a program - */ -extern _LIB_VERSION_TYPE _LIB_VERSION; - -#define _IEEE_ fdlibm_ieee -#define _SVID_ fdlibm_svid -#define _XOPEN_ fdlibm_xopen -#define _POSIX_ fdlibm_posix - -#ifndef __cplusplus -struct exception { - int type; - char *name; - double arg1; - double arg2; - double retval; -}; -#endif /* !__cplusplus */ - #define HUGE MAXFLOAT - -/* - * set X_TLOSS = pi*2**52, which is possibly defined in <values.h> - * (one may replace the following line by "#include <values.h>") - */ - -#define X_TLOSS 1.41484755040568800000e+16 - -#define DOMAIN 1 -#define SING 2 -#define OVERFLOW 3 -#define UNDERFLOW 4 -#define TLOSS 5 -#define PLOSS 6 - #endif /* __BSD_VISIBLE */ __BEGIN_DECLS @@ -215,9 +172,7 @@ extern double exp2(double); extern double expm1(double); extern int ilogb(double); extern double log1p(double); -#if 0 extern double log2(double); -#endif extern double logb(double); extern double scalbn(double, int); #if 0 @@ -253,11 +208,9 @@ extern double nextafter(double, double); extern double nexttoward(double, long double); #endif -#if 0 extern double fdim(double, double); extern double fmax(double, double); extern double fmin(double, double); -#endif #if 0 extern double fma(double, double, double); @@ -292,10 +245,6 @@ extern int finite(double); extern double gamma_r(double, int *); extern double lgamma_r(double, int *); -#ifdef __LIBM_PRIVATE -extern int matherr(struct exception *); -#endif /* __LIBM_PRIVATE */ - /* * IEEE Test Vector */ @@ -375,11 +324,9 @@ extern float nextafterf(float, float); extern float nexttowardf(float, long double); #endif -#if 0 extern float fdimf(float, float); extern float fmaxf(float, float); extern float fminf(float, float); -#endif #if 0 extern float fmaf(float, float, float); diff --git a/include/stdlib.h b/include/stdlib.h index bd1a28386b8..496090a50db 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stdlib.h,v 1.44 2008/06/24 06:01:33 otto Exp $ */ +/* $OpenBSD: stdlib.h,v 1.45 2008/09/07 20:36:07 martynas Exp $ */ /* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */ /*- @@ -132,6 +132,8 @@ void srand(unsigned); double strtod(const char *, char **); float strtof(const char *, char **); long strtol(const char *, char **, int); +long double + strtold(const char *, char **); unsigned long strtoul(const char *, char **, int); int system(const char *); |
