1 /* predicates.c -- Predicates.
2 
3 Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2010,
4                      Spaces project, Inria Lorraine
5                      and Salsa project, INRIA Rocquencourt,
6                      and Arenaire project, Inria Rhone-Alpes, France
7                      and Lab. ANO, USTL (Univ. of Lille),  France
8 
9 This file is part of the MPFI Library.
10 
11 The MPFI Library is free software; you can redistribute it and/or modify
12 it under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or (at your
14 option) any later version.
15 
16 The MPFI Library is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
19 License for more details.
20 
21 You should have received a copy of the GNU Lesser General Public License
22 along with the MPFI Library; see the file COPYING.LIB.  If not, write to
23 the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24 MA 02110-1301, USA. */
25 
26 #include "mpfi-impl.h"
27 
28 int
mpfi_nan_p(mpfi_srcptr a)29 mpfi_nan_p (mpfi_srcptr a)
30 {
31   return (mpfr_nan_p (&(a->left)) || mpfr_nan_p (&(a->right)));
32 }
33 
34 int
mpfi_inf_p(mpfi_srcptr a)35 mpfi_inf_p (mpfi_srcptr a)
36 {
37   return (mpfr_inf_p (&(a->left)) || mpfr_inf_p (&(a->right)))
38     && !MPFI_NAN_P (a);
39 }
40 
41 int
mpfi_bounded_p(mpfi_srcptr a)42 mpfi_bounded_p (mpfi_srcptr a)
43 {
44   return (mpfr_number_p (&(a->left)) && mpfr_number_p (&(a->right))
45           && !MPFI_NAN_P (a));
46 }
47