summaryrefslogtreecommitdiff
path: root/tests/ttrunc.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2000-06-16 12:53:22 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2000-06-16 12:53:22 +0000
commit879e476dd72c898a794245cb6e4fe380910651f6 (patch)
treefd11bff17f34e1deeab33c424392f605c6c577aa /tests/ttrunc.c
parentaeb8fb7f758a13d9802d30f1de9cc9163bca10ea (diff)
downloadmpfr-879e476dd72c898a794245cb6e4fe380910651f6.tar.gz
added more tests
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@626 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/ttrunc.c')
-rw-r--r--tests/ttrunc.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/tests/ttrunc.c b/tests/ttrunc.c
index 74808cb72..1a51f95e7 100644
--- a/tests/ttrunc.c
+++ b/tests/ttrunc.c
@@ -40,8 +40,29 @@ int main()
mpfr_init2(t, SIZEX);
mpfr_init2(y2, SIZEX);
mpfr_init2(z2, SIZEX);
- mpfr_init2(t2, SIZEX);
-
+ mpfr_init2(t2, SIZEX);
+
+ mpfr_set_d(x, 0.5, GMP_RNDN);
+ mpfr_ceil(y, x);
+ if (mpfr_get_d(y) != 1.0) {
+ fprintf(stderr, "Error in mpfr_ceil for x=0.5: expected 1.0, got %f\n",
+ mpfr_get_d(y)); exit(1);
+ }
+
+ mpfr_set_d(x, 0.0, GMP_RNDN);
+ mpfr_ceil(y, x);
+ if (mpfr_get_d(y) != 0.0) {
+ fprintf(stderr, "Error in mpfr_ceil for x=0.0: expected 0.0, got %f\n",
+ mpfr_get_d(y)); exit(1);
+ }
+
+ mpfr_set_d(x, 1.0, GMP_RNDN);
+ mpfr_ceil(y, x);
+ if (mpfr_get_d(y) != 1.0) {
+ fprintf(stderr, "Error in mpfr_ceil for x=1.0: expected 1.0, got %f\n",
+ mpfr_get_d(y)); exit(1);
+ }
+
for (j=0;j<1000;j++) {
mpfr_random(x);
@@ -58,7 +79,7 @@ int main()
mpfr_floor(y, x);
mpfr_set(y2, x, GMP_RNDD);
-
+
mpfr_trunc(z, x);
mpfr_set(z2, x, GMP_RNDZ);