[BACK]Return to complex.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / include

File: [cvs.NetBSD.org] / src / include / complex.h (download)

Revision 1.1, Mon Aug 20 16:01:29 2007 UTC (16 years, 8 months ago) by drochner
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, yamt-pf42, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-revivesa, simonb-wapbl-nbase, simonb-wapbl-base, simonb-wapbl, netbsd-5-base, netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, netbsd-5, mjf-devfs2-base, mjf-devfs2, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-base2, matt-armv6-prevmlocking, matt-armv6-nbase, matt-armv6-base, matt-armv6, keiichi-mipv6-base, keiichi-mipv6, jym-xensuspend-nbase, jym-xensuspend-base, jym-xensuspend, hpcarm-cleanup-nbase, hpcarm-cleanup-base, cube-autoconf-base, cube-autoconf, christos-time_t-nbase, christos-time_t-base, christos-time_t

Add C99 complex support, for double and float.
Most complex function implementations are from the "c9x-complex" library,
originating from the "cephes" math library, see
http://www.netlib.org/cephes/, from Stephen L. Moshier, incorporated and
redistributed with the NetBSD license by permission of the author.

Error behaviour and other boundary conditions (branch cuts)
need to be looked at.

For namespace sanity, I've done the rename/weak alias procedure to
most of the exported functions which are also used internally.
Didn't do so for sin/cos(f) yet because assembler implementations use
them directly, and renaming functions shared between the main libm
and the machine specific "overlay" might raise binary compatibility
issues.

/* $NetBSD: complex.h,v 1.1 2007/08/20 16:01:29 drochner Exp $ */

#define complex _Complex
#define _Complex_I 1.0fi
#define I _Complex_I

#include <sys/cdefs.h>

__BEGIN_DECLS

double creal(double complex);
double cimag(double complex);
double complex conj(double complex);
float crealf(float complex);
float cimagf(float complex);
float complex conjf(float complex);

#ifndef __LIBM0_SOURCE__
/* avoid conflict with historical cabs(struct complex) */
double cabs(double complex) __RENAME(__c99_cabs);
float cabsf(float complex) __RENAME(__c99_cabsf);
#endif
double carg(double complex);
float cargf(float complex);

double complex csqrt(double complex);
double complex cexp(double complex);
double complex clog(double complex);
double complex cpow(double complex, double complex);

double complex csin(double complex);
double complex ccos(double complex);
double complex ctan(double complex);
double complex csinh(double complex);
double complex ccosh(double complex);
double complex ctanh(double complex);

double complex casin(double complex);
double complex cacos(double complex);
double complex catan(double complex);
double complex casinh(double complex);
double complex cacosh(double complex);
double complex catanh(double complex);

float complex csqrtf(float complex);
float complex cexpf(float complex);
float complex clogf(float complex);
float complex cpowf(float complex, float complex);

float complex csinf(float complex);
float complex ccosf(float complex);
float complex ctanf(float complex);
float complex csinhf(float complex);
float complex ccoshf(float complex);
float complex ctanhf(float complex);

float complex casinf(float complex);
float complex cacosf(float complex);
float complex catanf(float complex);
float complex casinhf(float complex);
float complex cacoshf(float complex);
float complex catanhf(float complex);

__END_DECLS