xref: /netbsd-src/external/gpl3/gcc.old/dist/libquadmath/math/fmaxq.c (revision 627f7eb200a4419d89b531d55fccd2ee3ffdcde0)
1*627f7eb2Smrg /* Return maximum numeric value of X and Y.
2*627f7eb2Smrg    Copyright (C) 1997-2018 Free Software Foundation, Inc.
3*627f7eb2Smrg    This file is part of the GNU C Library.
4*627f7eb2Smrg    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
5*627f7eb2Smrg 
6*627f7eb2Smrg    The GNU C Library is free software; you can redistribute it and/or
7*627f7eb2Smrg    modify it under the terms of the GNU Lesser General Public
8*627f7eb2Smrg    License as published by the Free Software Foundation; either
9*627f7eb2Smrg    version 2.1 of the License, or (at your option) any later version.
10*627f7eb2Smrg 
11*627f7eb2Smrg    The GNU C Library is distributed in the hope that it will be useful,
12*627f7eb2Smrg    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*627f7eb2Smrg    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14*627f7eb2Smrg    Lesser General Public License for more details.
15*627f7eb2Smrg 
16*627f7eb2Smrg    You should have received a copy of the GNU Lesser General Public
17*627f7eb2Smrg    License along with the GNU C Library; if not, see
18*627f7eb2Smrg    <http://www.gnu.org/licenses/>.  */
19*627f7eb2Smrg 
20*627f7eb2Smrg #include "quadmath-imp.h"
21*627f7eb2Smrg 
22*627f7eb2Smrg __float128
fmaxq(__float128 x,__float128 y)23*627f7eb2Smrg fmaxq (__float128 x, __float128 y)
24*627f7eb2Smrg {
25*627f7eb2Smrg   if (__builtin_isgreaterequal (x, y))
26*627f7eb2Smrg     return x;
27*627f7eb2Smrg   else if (__builtin_isless (x, y))
28*627f7eb2Smrg     return y;
29*627f7eb2Smrg   else if (issignalingq (x) || issignalingq (y))
30*627f7eb2Smrg     return x + y;
31*627f7eb2Smrg   else
32*627f7eb2Smrg     return isnanq (y) ? x : y;
33*627f7eb2Smrg }
34