diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-16 16:44:35 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-16 16:44:35 +0000 |
commit | e7b8ec290314a24d67f8256c75b34a6a627c5205 (patch) | |
tree | cbbd98da06ef06f334e26d4cd08eea03e60befdb /libquadmath/math/cprojq.c | |
parent | b12676a5853278cf006fbc0908d35cb9d5ba7adc (diff) | |
download | ppe42-gcc-e7b8ec290314a24d67f8256c75b34a6a627c5205.tar.gz ppe42-gcc-e7b8ec290314a24d67f8256c75b34a6a627c5205.zip |
PR fortran/46416
* quadmath.h (cbrtq, finiteq, isnanq, signbitq, sqrtq): Remove
const from prototype argument.
(cimagq, conjq, cprojq, crealq, fdimq, fmaxq, fminq, ilogbq,
llrintq, log2q, lrintq, nearbyintq, remquoq): New prototypes.
(__quadmath_extern_inline): Define.
(cimagq, conjq, crealq): New inlines.
* Makefile.am (libquadmath_la_SOURCES): Add math/cimagq.c,
math/conjq.c, math/cprojq.c, math/crealq.c, math/fdimq.c,
math/fmaxq.c, math/fminq.c, math/ilogbq.c, math/llrintq.c,
math/log2q.c, math/lrintq.c, math/nearbyintq.c and math/remquoq.c.
* Makefile.in: Regenerated.
* quadmath_weak.h (cimagq, conjq, cprojq, crealq, fdimq, fmaxq,
fminq, ilogbq, llrintq, log2q, lrintq, nearbyintq, remquoq): Add.
* quadmath-imp.h (__LITTLE_ENDIAN__): Don't define.
(ieee854_float128): Use __BYTE_ORDER == __ORDER_BIG_ENDIAN__
tests instead of __BIG_ENDIAN__.
* quadmath.map (QUADMATH_1.0): Add cimagq, conjq, cprojq, crealq,
fdimq, fmaxq, fminq, ilogbq, llrintq, log2q, lrintq, nearbyintq
and remquoq.
* libquadmath.texi (cimagq, conjq, cprojq, crealq, fdimq, fmaxq,
fminq, ilogbq, llrintq, log2q, lrintq, nearbyintq, remquoq): Add.
* math/cprojq.c: New file.
* math/ilogbq.c: New file.
* math/fminq.c: New file.
* math/llrintq.c: New file.
* math/log2q.c: New file.
* math/lrintq.c: New file.
* math/crealq.c: New file.
* math/nearbyintq.c: New file.
* math/fmaxq.c: New file.
* math/conjq.c: New file.
* math/remquoq.c: New file.
* math/cimagq.c: New file.
* math/fdimq.c: New file.
* math/ldexpq.c: Include errno.h. Set errno to ERANGE if needed.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168854 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libquadmath/math/cprojq.c')
-rw-r--r-- | libquadmath/math/cprojq.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/libquadmath/math/cprojq.c b/libquadmath/math/cprojq.c new file mode 100644 index 00000000000..6092c732503 --- /dev/null +++ b/libquadmath/math/cprojq.c @@ -0,0 +1,40 @@ +/* Compute projection of complex __float128 value to Riemann sphere. + Copyright (C) 1997, 1999, 2010 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "quadmath-imp.h" + + +__complex128 +cprojq (__complex128 x) +{ + if (isnanq (__real__ x) && isnanq (__imag__ x)) + return x; + else if (!finiteq (__real__ x) || !finiteq (__imag__ x)) + { + __complex128 res; + + __real__ res = __builtin_inf (); + __imag__ res = copysignq (0.0, __imag__ x); + + return res; + } + + return x; +} |