xref: /openbsd-src/lib/libm/src/s_ccosh.c (revision 2f2c00629eff6a304ebffb255fc56f4fa7a1833b)
1*2f2c0062Sguenther /*	$OpenBSD: s_ccosh.c,v 1.7 2016/09/12 19:47:02 guenther Exp $	*/
27b36286aSmartynas /*
37b36286aSmartynas  * Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net>
47b36286aSmartynas  *
57b36286aSmartynas  * Permission to use, copy, modify, and distribute this software for any
67b36286aSmartynas  * purpose with or without fee is hereby granted, provided that the above
77b36286aSmartynas  * copyright notice and this permission notice appear in all copies.
87b36286aSmartynas  *
97b36286aSmartynas  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
107b36286aSmartynas  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
117b36286aSmartynas  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
127b36286aSmartynas  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
137b36286aSmartynas  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
147b36286aSmartynas  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
157b36286aSmartynas  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
167b36286aSmartynas  */
177b36286aSmartynas 
187b36286aSmartynas /*							ccosh
197b36286aSmartynas  *
207b36286aSmartynas  *	Complex hyperbolic cosine
217b36286aSmartynas  *
227b36286aSmartynas  *
237b36286aSmartynas  *
247b36286aSmartynas  * SYNOPSIS:
257b36286aSmartynas  *
267b36286aSmartynas  * double complex ccosh();
277b36286aSmartynas  * double complex z, w;
287b36286aSmartynas  *
297b36286aSmartynas  * w = ccosh (z);
307b36286aSmartynas  *
317b36286aSmartynas  *
327b36286aSmartynas  *
337b36286aSmartynas  * DESCRIPTION:
347b36286aSmartynas  *
357b36286aSmartynas  * ccosh(z) = cosh x  cos y + i sinh x sin y .
367b36286aSmartynas  *
377b36286aSmartynas  * ACCURACY:
387b36286aSmartynas  *
397b36286aSmartynas  *                      Relative error:
407b36286aSmartynas  * arithmetic   domain     # trials      peak         rms
417b36286aSmartynas  *    IEEE      -10,+10     30000       2.9e-16     8.1e-17
427b36286aSmartynas  *
437b36286aSmartynas  */
447b36286aSmartynas 
457b36286aSmartynas #include <complex.h>
46de3697aaSmartynas #include <float.h>
477b36286aSmartynas #include <math.h>
487b36286aSmartynas 
497b36286aSmartynas double complex
ccosh(double complex z)507b36286aSmartynas ccosh(double complex z)
517b36286aSmartynas {
527b36286aSmartynas 	double complex w;
537b36286aSmartynas 	double x, y;
547b36286aSmartynas 
557b36286aSmartynas 	x = creal(z);
567b36286aSmartynas 	y = cimag(z);
577b36286aSmartynas 	w = cosh (x) * cos (y)  +  (sinh (x) * sin (y)) * I;
587b36286aSmartynas 	return (w);
597b36286aSmartynas }
60*2f2c0062Sguenther DEF_STD(ccosh);
61*2f2c0062Sguenther LDBL_MAYBE_UNUSED_CLONE(ccosh);
62