DEVFS - Avoid clearing of hides that don't come from rules
[dragonfly.git] / contrib / mpfr / comparisons.c
blob6688bbf940830026d0c0536759765d79a7dd5416
1 /* comparison predicates
3 Copyright 2002, 2003, 2004, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
4 Contributed by the Arenaire and Cacao projects, INRIA.
6 This file is part of the GNU MPFR Library.
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.
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.
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. */
23 #include "mpfr-impl.h"
25 /* Note: these functions currently use mpfr_cmp; they could have their
26 own code to be faster. */
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
38 int
39 mpfr_greater_p (mpfr_srcptr x, mpfr_srcptr y)
41 return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) > 0);
44 int
45 mpfr_greaterequal_p (mpfr_srcptr x, mpfr_srcptr y)
47 return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) >= 0);
50 int
51 mpfr_less_p (mpfr_srcptr x, mpfr_srcptr y)
53 return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) < 0);
56 int
57 mpfr_lessequal_p (mpfr_srcptr x, mpfr_srcptr y)
59 return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) <= 0);
62 int
63 mpfr_lessgreater_p (mpfr_srcptr x, mpfr_srcptr y)
65 return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) != 0);
68 int
69 mpfr_equal_p (mpfr_srcptr x, mpfr_srcptr y)
71 return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) == 0);
74 int
75 mpfr_unordered_p (mpfr_srcptr x, mpfr_srcptr y)
77 return MPFR_IS_NAN(x) || MPFR_IS_NAN(y);