1 /* Compute x * y + z as ternary operation.
2 Copyright (C) 2011-2015 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by David Flaherty <flaherty@linux.vnet.ibm.com>.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
21 #include <math_ldbl_opt.h>
24 __fmal (long double x
, long double y
, long double z
)
26 /* An IBM long double 128 is really just 2 IEEE64 doubles, and in
27 * the case of inf/nan only the first double counts. So we use the
28 * (double) cast to avoid any data movement. */
29 if ((isfinite ((double)x
) && isfinite ((double)y
)) && isinf ((double)z
))
32 /* If z is zero and x are y are nonzero, compute the result
33 as x * y to avoid the wrong sign of a zero result if x * y
35 if (z
== 0 && x
!= 0 && y
!= 0)
41 long_double_symbol (libm
, __fmal
, fmal
);
43 long_double_symbol (libc
, __fmal
, fmal
);