11058Sant/* Return arc sine of complex double value.
22362Sohair   Copyright (C) 1997 Free Software Foundation, Inc.
31058Sant   This file is part of the GNU C Library.
41058Sant   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
51058Sant
61058Sant   The GNU C Library is free software; you can redistribute it and/or
71058Sant   modify it under the terms of the GNU Lesser General Public
81058Sant   License as published by the Free Software Foundation; either
91058Sant   version 2.1 of the License, or (at your option) any later version.
101058Sant
111058Sant   The GNU C Library is distributed in the hope that it will be useful,
121058Sant   but WITHOUT ANY WARRANTY; without even the implied warranty of
131058Sant   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
141058Sant   Lesser General Public License for more details.
151058Sant
161058Sant   You should have received a copy of the GNU Lesser General Public
171058Sant   License along with the GNU C Library; if not, write to the Free
181058Sant   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
192362Sohair   02111-1307 USA.  */
202362Sohair
212362Sohair#include <complex.h>
221058Sant#include <math.h>
231058Sant
241058Sant
251058Sant__complex__ double
2615235Sgoetz__casin (__complex__ double x)
271058Sant{
281058Sant  __complex__ double res;
291058Sant
301058Sant  if (isnan (__real__ x) || isnan (__imag__ x))
311058Sant    {
321058Sant      if (__real__ x == 0.0)
331058Sant	{
341058Sant	  res = x;
351058Sant	}
361058Sant      else if (__isinf (__real__ x) || __isinf (__imag__ x))
371058Sant	{
381058Sant	  __real__ res = __nan ("");
391058Sant	  __imag__ res = __copysign (HUGE_VAL, __imag__ x);
401058Sant	}
411058Sant      else
421058Sant	{
431058Sant	  __real__ res = __nan ("");
441058Sant	  __imag__ res = __nan ("");
451058Sant	}
461058Sant    }
471058Sant  else
481058Sant    {
491058Sant      __complex__ double y;
501058Sant
511058Sant      __real__ y = -__imag__ x;
521058Sant      __imag__ y = __real__ x;
531058Sant
541058Sant      y = __casinh (y);
551058Sant
561058Sant      __real__ res = __imag__ y;
571058Sant      __imag__ res = -__real__ y;
581058Sant    }
591058Sant
601058Sant  return res;
611058Sant}
621058Santweak_alias (__casin, casin)
631058Sant#ifdef NO_LONG_DOUBLE
641058Santstrong_alias (__casin, __casinl)
651058Santweak_alias (__casin, casinl)
661058Sant#endif
671058Sant