1*81418a27Smrg /* Compute projection of complex float type value to Riemann sphere.
2*81418a27Smrg    Copyright (C) 1997-2018 Free Software Foundation, Inc.
3*81418a27Smrg    This file is part of the GNU C Library.
4*81418a27Smrg    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
5*81418a27Smrg 
6*81418a27Smrg    The GNU C Library is free software; you can redistribute it and/or
7*81418a27Smrg    modify it under the terms of the GNU Lesser General Public
8*81418a27Smrg    License as published by the Free Software Foundation; either
9*81418a27Smrg    version 2.1 of the License, or (at your option) any later version.
10*81418a27Smrg 
11*81418a27Smrg    The GNU C Library is distributed in the hope that it will be useful,
12*81418a27Smrg    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*81418a27Smrg    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14*81418a27Smrg    Lesser General Public License for more details.
15*81418a27Smrg 
16*81418a27Smrg    You should have received a copy of the GNU Lesser General Public
17*81418a27Smrg    License along with the GNU C Library; if not, see
18*81418a27Smrg    <http://www.gnu.org/licenses/>.  */
19*81418a27Smrg 
20*81418a27Smrg #include "quadmath-imp.h"
21*81418a27Smrg 
22*81418a27Smrg __complex128
cprojq(__complex128 x)23*81418a27Smrg cprojq (__complex128 x)
24*81418a27Smrg {
25*81418a27Smrg   if (isinfq (__real__ x) || isinfq (__imag__ x))
26*81418a27Smrg     {
27*81418a27Smrg       __complex128 res;
28*81418a27Smrg 
29*81418a27Smrg       __real__ res = __builtin_inf ();
30*81418a27Smrg       __imag__ res = copysignq (0, __imag__ x);
31*81418a27Smrg 
32*81418a27Smrg       return res;
33*81418a27Smrg     }
34*81418a27Smrg 
35*81418a27Smrg   return x;
36*81418a27Smrg }
37