liblvm: Raise WARNS to 1.
[dragonfly.git] / contrib / mpfr / comparisons.c
1 /* comparison predicates
2
3 Copyright 2002, 2003, 2004, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
4 Contributed by the Arenaire and Cacao projects, INRIA.
5
6 This file is part of the GNU MPFR Library.
7
8 The GNU MPFR Library is free software; you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or (at your
11 option) any later version.
12
13 The GNU MPFR Library is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16 License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with the GNU MPFR Library; see the file COPYING.LIB.  If not, write to
20 the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
21 MA 02110-1301, USA. */
22
23 #include "mpfr-impl.h"
24
25 /* Note: these functions currently use mpfr_cmp; they could have their
26    own code to be faster. */
27
28 /*                          =     <     >     unordered
29  * mpfr_greater_p           0     0     1     0
30  * mpfr_greaterequal_p      1     0     1     0
31  * mpfr_less_p              0     1     0     0
32  * mpfr_lessequal_p         1     1     0     0
33  * mpfr_lessgreater_p       0     1     1     0
34  * mpfr_equal_p             1     0     0     0
35  * mpfr_unordered_p         0     0     0     1
36  */
37
38 int
39 mpfr_greater_p (mpfr_srcptr x, mpfr_srcptr y)
40 {
41   return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) > 0);
42 }
43
44 int
45 mpfr_greaterequal_p (mpfr_srcptr x, mpfr_srcptr y)
46 {
47   return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) >= 0);
48 }
49
50 int
51 mpfr_less_p (mpfr_srcptr x, mpfr_srcptr y)
52 {
53   return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) < 0);
54 }
55
56 int
57 mpfr_lessequal_p (mpfr_srcptr x, mpfr_srcptr y)
58 {
59   return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) <= 0);
60 }
61
62 int
63 mpfr_lessgreater_p (mpfr_srcptr x, mpfr_srcptr y)
64 {
65   return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) != 0);
66 }
67
68 int
69 mpfr_equal_p (mpfr_srcptr x, mpfr_srcptr y)
70 {
71   return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) == 0);
72 }
73
74 int
75 mpfr_unordered_p (mpfr_srcptr x, mpfr_srcptr y)
76 {
77   return MPFR_IS_NAN(x) || MPFR_IS_NAN(y);
78 }