root/maint/gnulib/tests/test-fma-ieee.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. test_function

   1 /* Test of ldexp*() function family.
   2    Copyright (C) 2012-2021 Free Software Foundation, Inc.
   3 
   4    This program is free software: you can redistribute it and/or modify
   5    it under the terms of the GNU General Public License as published by
   6    the Free Software Foundation; either version 3 of the License, or
   7    (at your option) any later version.
   8 
   9    This program is distributed in the hope that it will be useful,
  10    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12    GNU General Public License for more details.
  13 
  14    You should have received a copy of the GNU General Public License
  15    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
  16 
  17 static void
  18 test_function (void)
     /* [previous][next][first][last][top][bottom][index][help] */
  19 {
  20   /* [MX] shaded specification in POSIX.  */
  21 
  22   /* NaN.  */
  23   ASSERT (ISNAN (FMA (NAN, L_(3.0), L_(5.0))));
  24   ASSERT (ISNAN (FMA (NAN, L_(0.0), L_(5.0))));
  25   ASSERT (ISNAN (FMA (L_(2.0), NAN, L_(5.0))));
  26   ASSERT (ISNAN (FMA (L_(0.0), NAN, L_(5.0))));
  27   ASSERT (ISNAN (FMA (NAN, NAN, L_(5.0))));
  28   ASSERT (ISNAN (FMA (NAN, L_(3.0), NAN)));
  29   ASSERT (ISNAN (FMA (NAN, L_(0.0), NAN)));
  30   ASSERT (ISNAN (FMA (L_(2.0), NAN, NAN)));
  31   ASSERT (ISNAN (FMA (L_(0.0), NAN, NAN)));
  32   ASSERT (ISNAN (FMA (NAN, NAN, NAN)));
  33 
  34   /* Infinity.  */
  35   ASSERT (ISNAN (FMA (INFINITY, L_(2.0), - INFINITY)));
  36   ASSERT (ISNAN (FMA (INFINITY, - L_(2.0), INFINITY)));
  37   ASSERT (ISNAN (FMA (- INFINITY, L_(2.0), INFINITY)));
  38   ASSERT (ISNAN (FMA (- INFINITY, - L_(2.0), - INFINITY)));
  39   ASSERT (ISNAN (FMA (L_(2.0), INFINITY, - INFINITY)));
  40   ASSERT (ISNAN (FMA (L_(2.0), - INFINITY, INFINITY)));
  41   ASSERT (ISNAN (FMA (- L_(2.0), INFINITY, INFINITY)));
  42   ASSERT (ISNAN (FMA (- L_(2.0), - INFINITY, - INFINITY)));
  43 
  44   ASSERT (FMA (INFINITY, L_(2.0), INFINITY) == INFINITY);
  45   ASSERT (FMA (INFINITY, - L_(2.0), - INFINITY) == - INFINITY);
  46   ASSERT (FMA (- INFINITY, L_(2.0), - INFINITY) == - INFINITY);
  47   ASSERT (FMA (- INFINITY, - L_(2.0), INFINITY) == INFINITY);
  48   ASSERT (FMA (L_(2.0), INFINITY, INFINITY) == INFINITY);
  49   ASSERT (FMA (L_(2.0), - INFINITY, - INFINITY) == - INFINITY);
  50   ASSERT (FMA (- L_(2.0), INFINITY, - INFINITY) == - INFINITY);
  51   ASSERT (FMA (- L_(2.0), - INFINITY, INFINITY) == INFINITY);
  52 
  53   /* Infinity times zero is NaN.  */
  54   ASSERT (ISNAN (FMA (INFINITY, L_(0.0), L_(7.0))));
  55   ASSERT (ISNAN (FMA (INFINITY, L_(0.0), INFINITY)));
  56   ASSERT (ISNAN (FMA (INFINITY, L_(0.0), NAN)));
  57   ASSERT (ISNAN (FMA (- INFINITY, L_(0.0), L_(7.0))));
  58   ASSERT (ISNAN (FMA (- INFINITY, L_(0.0), INFINITY)));
  59   ASSERT (ISNAN (FMA (- INFINITY, L_(0.0), NAN)));
  60   ASSERT (ISNAN (FMA (L_(0.0), INFINITY, L_(7.0))));
  61   ASSERT (ISNAN (FMA (L_(0.0), INFINITY, INFINITY)));
  62   ASSERT (ISNAN (FMA (L_(0.0), INFINITY, NAN)));
  63   ASSERT (ISNAN (FMA (L_(0.0), - INFINITY, L_(7.0))));
  64   ASSERT (ISNAN (FMA (L_(0.0), - INFINITY, INFINITY)));
  65   ASSERT (ISNAN (FMA (L_(0.0), - INFINITY, NAN)));
  66 
  67   /* NaN in the z argument.  */
  68   ASSERT (ISNAN (FMA (L_(2.0), L_(3.0), NAN)));
  69   ASSERT (ISNAN (FMA (L_(2.0), INFINITY, NAN)));
  70   ASSERT (ISNAN (FMA (INFINITY, L_(3.0), NAN)));
  71   ASSERT (ISNAN (FMA (INFINITY, INFINITY, NAN)));
  72 }

/* [previous][next][first][last][top][bottom][index][help] */