1*60d908e1Sguenther /* $OpenBSD: s_csinhf.c,v 1.2 2010/07/18 18:42:26 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 /* csinhf
197b36286aSmartynas *
207b36286aSmartynas * Complex hyperbolic sine
217b36286aSmartynas *
227b36286aSmartynas *
237b36286aSmartynas *
247b36286aSmartynas * SYNOPSIS:
257b36286aSmartynas *
267b36286aSmartynas * float complex csinhf();
277b36286aSmartynas * float complex z, w;
287b36286aSmartynas *
297b36286aSmartynas * w = csinhf (z);
307b36286aSmartynas *
317b36286aSmartynas * DESCRIPTION:
327b36286aSmartynas *
337b36286aSmartynas * csinh z = (cexp(z) - cexp(-z))/2
347b36286aSmartynas * = sinh x * cos y + i cosh x * sin y .
357b36286aSmartynas *
367b36286aSmartynas * ACCURACY:
377b36286aSmartynas *
387b36286aSmartynas * Relative error:
397b36286aSmartynas * arithmetic domain # trials peak rms
407b36286aSmartynas * IEEE -10,+10 30000 3.1e-16 8.2e-17
417b36286aSmartynas *
427b36286aSmartynas */
437b36286aSmartynas
447b36286aSmartynas #include <complex.h>
457b36286aSmartynas #include <math.h>
467b36286aSmartynas
477b36286aSmartynas float complex
csinhf(float complex z)487b36286aSmartynas csinhf(float complex z)
497b36286aSmartynas {
507b36286aSmartynas float complex w;
517b36286aSmartynas float x, y;
527b36286aSmartynas
53*60d908e1Sguenther x = crealf(z);
54*60d908e1Sguenther y = cimagf(z);
557b36286aSmartynas w = sinhf (x) * cosf (y) + (coshf (x) * sinf (y)) * I;
567b36286aSmartynas return (w);
577b36286aSmartynas }
58