1 /*
2 mpfrx_cmp
3
4 compares f and g
5
6 Copyright (C) 2009 Andreas Enge
7
8 This file is part of the MPFRCX Library.
9
10 The MPFRCX Library is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or (at your
13 option) any later version.
14
15 The MPFRCX Library is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with the MPFRCX library; see the file COPYING.LESSER. If not, write to
22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
23 MA 02111-1307, USA.
24 */
25
26 #include "mpfrcx-impl.h"
27
mpfrx_cmp(mpfrx_srcptr f,mpfrx_srcptr g)28 int mpfrx_cmp (mpfrx_srcptr f, mpfrx_srcptr g) {
29
30 if (f->deg != g->deg)
31 return -1;
32 else {
33 int i;
34 for (i = f->deg; i >= 0; i--)
35 if (mpfr_cmp (f->coeff [i], g->coeff [i]))
36 return -1;
37 return 0;
38 }
39 }
40