3 Copyright 2001, 2003, 2003, 2005 Free Software Foundation, Inc.
5 This file is part of the GNU MP Library.
7 The GNU MP Library is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
12 The GNU MP Library is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 License for more details.
17 You should have received a copy of the GNU Lesser General Public License
18 along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
29 #define SGN(n) ((n) > 0 ? 1 : (n) < 0 ? -1 : 0)
32 check_one (const char *name, mpf_srcptr x, double y, int cmp)
36 got = mpf_cmp_d (x, y);
40 printf ("mpf_cmp_d wrong (from %s)\n", name);
41 printf (" got %d\n", got);
42 printf (" want %d\n", cmp);
44 printf (" y %g\n", y);
47 printf (" y %g\n", y);
49 for (i = 0; i < sizeof(y); i++)
50 printf (" %02X", (unsigned) ((unsigned char *) &y)[i]);
60 double y = tests_infinity_d ();
68 check_one ("check_infinity", x, y, -1);
69 check_one ("check_infinity", x, -y, 1);
73 check_one ("check_infinity", x, y, -1);
74 check_one ("check_infinity", x, -y, 1);
77 mpf_set_si (x, -123L);
78 check_one ("check_infinity", x, y, -1);
79 check_one ("check_infinity", x, -y, 1);
83 mpf_mul_2exp (x, x, 5000L);
84 check_one ("check_infinity", x, y, -1);
85 check_one ("check_infinity", x, -y, 1);
89 check_one ("check_infinity", x, y, -1);
90 check_one ("check_infinity", x, -y, 1);
96 main (int argc, char *argv[])