1 /* Complex sine hyperbole function for float.
2 Copyright (C) 1997,1998 Free Software Foundation, Inc.
4 This file is part of the libstdc++ version 3 distribution.
6 This software is a copyrighted work licensed under the terms of the
7 Cygnus libstdc++ license. Please consult the file LICENSE.STD for
15 csinhf (__complex__ float x)
17 __complex__ float retval;
18 int negate = signbit (__real__ x);
20 __real__ x = fabsf (__real__ x);
22 if (FINITEF_P (__real__ x))
24 /* Real part is finite. */
25 if (FINITEF_P (__imag__ x))
27 /* Imaginary part is finite. */
28 float sinh_val = sinhf (__real__ x);
29 float cosh_val = coshf (__real__ x);
30 float sinix = sin (__imag__ x);
31 float cosix = cos (__imag__ x);
33 __real__ retval = sinh_val * cosix;
34 __imag__ retval = cosh_val * sinix;
37 __real__ retval = -__real__ retval;
41 if (__real__ x == 0.0)
43 /* Real part is 0.0. */
44 __real__ retval = copysignf (0.0, negate ? -1.0 : 1.0);
45 __imag__ retval = NAN + NAN;
49 __real__ retval = NAN;
50 __imag__ retval = NAN;
54 else if (INFINITEF_P (__real__ x))
56 /* Real part is infinite. */
57 if (__imag__ x == 0.0)
59 /* Imaginary part is 0.0. */
60 __real__ retval = negate ? -HUGE_VALF : HUGE_VALF;
61 __imag__ retval = __imag__ x;
63 else if (FINITEF_P (__imag__ x))
65 /* Imaginary part is finite. */
66 float sinix = sinf (__imag__ x);
67 float cosix = cosf (__imag__ x);
69 __real__ retval = copysignf (HUGE_VALF, cosix);
70 __imag__ retval = copysignf (HUGE_VALF, sinix);
73 __real__ retval = -__real__ retval;
77 /* The addition raises the invalid exception. */
78 __real__ retval = HUGE_VALF;
79 __imag__ retval = NAN + NAN;
84 __real__ retval = NAN;
85 __imag__ retval = __imag__ x == 0.0 ? __imag__ x : NAN;