summaryrefslogtreecommitdiff
path: root/mpf
diff options
context:
space:
mode:
authortege <tege@gmplib.org>1999-03-17 20:06:59 +0100
committertege <tege@gmplib.org>1999-03-17 20:06:59 +0100
commit2055f358584fc66e511042486379d60bbdf85970 (patch)
tree4196582e69c778b8ed8ee9c5240cdac5c6111899 /mpf
parentd7f665ff8e71330493e363812734b060fd6702c4 (diff)
downloadgmp-2055f358584fc66e511042486379d60bbdf85970.tar.gz
*** empty log message ***
Diffstat (limited to 'mpf')
-rw-r--r--mpf/tests/t-get_d.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/mpf/tests/t-get_d.c b/mpf/tests/t-get_d.c
new file mode 100644
index 000000000..79c069c69
--- /dev/null
+++ b/mpf/tests/t-get_d.c
@@ -0,0 +1,46 @@
+/* Test mpf_set_d.
+
+ Copyright (C) 1996 Free Software Foundation, Inc.
+
+ This file is part of the GNU MP Library.
+
+ The GNU MP Library is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ The GNU MP Library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+ License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA. */
+
+#include "gmp.h"
+
+main (int argc, char **argv)
+{
+ double d, e, r;
+ mpf_t u, v;
+
+ mpf_init (u);
+ mpf_init (v);
+
+ mpf_set_d (u, 1e-201);
+ for (d = 1e-200; d < 1e200; d *= 1.01)
+ {
+ mpf_set_d (v, d);
+ if (mpf_cmp (u, v) >= 0)
+ abort ();
+ e = mpf_get_d (v);
+ r = e/d;
+ if (r < 0.9999999999 | r > 1.00000000001)
+ abort ();
+ mpf_set (u, v);
+ }
+
+ exit (0);
+}