Date: Thu, 29 Sep 2005 12:55:52 -0700 From: Steve Kargl <sgk@troutmask.apl.washington.edu> To: freebsd-standards@freebsd.org Subject: complex.h math functions Message-ID: <20050929195552.GA14982@troutmask.apl.washington.edu>
index | next in thread | raw e-mail
Is it permissible to implement the complex.h math
functions in terms of functions in math.h. For
example, if z = x + I * y, then
cos(z) = cos(x) * cosh(y) - I sin(x) * sinh(y)
This can be (naively?) implemented as
double complex
ccos(double complex z)
{
double x, y;
x = creal(z);
y = cimag(y);
return (cosh(y) * (cos(x) - I * sin(x) * tanh(y)));
}
I don't own a copy of C99, so I can't easily check
the wording of the standard.
--
Steve
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050929195552.GA14982>
