xref: /haiku/src/system/libroot/posix/glibc/arch/generic/s_casinf.c (revision f504f61099b010fbfa94b1cc63d2e9072c7f7185)
15acbf1f5SJérôme Duval /* Return arc sine of complex float value.
25acbf1f5SJérôme Duval    Copyright (C) 1997 Free Software Foundation, Inc.
35acbf1f5SJérôme Duval    This file is part of the GNU C Library.
45acbf1f5SJérôme Duval    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
55acbf1f5SJérôme Duval 
65acbf1f5SJérôme Duval    The GNU C Library is free software; you can redistribute it and/or
75acbf1f5SJérôme Duval    modify it under the terms of the GNU Lesser General Public
85acbf1f5SJérôme Duval    License as published by the Free Software Foundation; either
95acbf1f5SJérôme Duval    version 2.1 of the License, or (at your option) any later version.
105acbf1f5SJérôme Duval 
115acbf1f5SJérôme Duval    The GNU C Library is distributed in the hope that it will be useful,
125acbf1f5SJérôme Duval    but WITHOUT ANY WARRANTY; without even the implied warranty of
135acbf1f5SJérôme Duval    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
145acbf1f5SJérôme Duval    Lesser General Public License for more details.
155acbf1f5SJérôme Duval 
165acbf1f5SJérôme Duval    You should have received a copy of the GNU Lesser General Public
175acbf1f5SJérôme Duval    License along with the GNU C Library; if not, write to the Free
185acbf1f5SJérôme Duval    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
195acbf1f5SJérôme Duval    02111-1307 USA.  */
205acbf1f5SJérôme Duval 
215acbf1f5SJérôme Duval #include <complex.h>
225acbf1f5SJérôme Duval #include <math.h>
235acbf1f5SJérôme Duval 
245acbf1f5SJérôme Duval 
255acbf1f5SJérôme Duval __complex__ float
__casinf(__complex__ float x)265acbf1f5SJérôme Duval __casinf (__complex__ float x)
275acbf1f5SJérôme Duval {
285acbf1f5SJérôme Duval   __complex__ float res;
295acbf1f5SJérôme Duval 
305acbf1f5SJérôme Duval   if (isnan (__real__ x) || isnan (__imag__ x))
315acbf1f5SJérôme Duval     {
325acbf1f5SJérôme Duval       if (__real__ x == 0.0)
335acbf1f5SJérôme Duval 	{
345acbf1f5SJérôme Duval 	  res = x;
355acbf1f5SJérôme Duval 	}
365acbf1f5SJérôme Duval       else if (__isinff (__real__ x) || __isinff (__imag__ x))
375acbf1f5SJérôme Duval 	{
38*f504f610SAugustin Cavalier 	  __real__ res = nanf ("");
39*f504f610SAugustin Cavalier 	  __imag__ res = copysignf (HUGE_VALF, __imag__ x);
405acbf1f5SJérôme Duval 	}
415acbf1f5SJérôme Duval       else
425acbf1f5SJérôme Duval 	{
43*f504f610SAugustin Cavalier 	  __real__ res = nanf ("");
44*f504f610SAugustin Cavalier 	  __imag__ res = nanf ("");
455acbf1f5SJérôme Duval 	}
465acbf1f5SJérôme Duval     }
475acbf1f5SJérôme Duval   else
485acbf1f5SJérôme Duval     {
495acbf1f5SJérôme Duval       __complex__ float y;
505acbf1f5SJérôme Duval 
515acbf1f5SJérôme Duval       __real__ y = -__imag__ x;
525acbf1f5SJérôme Duval       __imag__ y = __real__ x;
535acbf1f5SJérôme Duval 
545acbf1f5SJérôme Duval       y = __casinhf (y);
555acbf1f5SJérôme Duval 
565acbf1f5SJérôme Duval       __real__ res = __imag__ y;
575acbf1f5SJérôme Duval       __imag__ res = -__real__ y;
585acbf1f5SJérôme Duval     }
595acbf1f5SJérôme Duval 
605acbf1f5SJérôme Duval   return res;
615acbf1f5SJérôme Duval }
625acbf1f5SJérôme Duval #ifndef __casinf
635acbf1f5SJérôme Duval weak_alias (__casinf, casinf)
645acbf1f5SJérôme Duval #endif
65