diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-01-19 16:03:30 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-01-19 16:03:30 +0000 |
commit | 31dc00cc70ad46e541534256dbe37c38d8edda78 (patch) | |
tree | 80c667693f4f7bee07943c23cbb132c7564deb6b /tests/texceptions.c | |
parent | d44793e4c78cf1a88d00046d32f8ff403dea655b (diff) | |
download | mpfr-31dc00cc70ad46e541534256dbe37c38d8edda78.tar.gz |
Add mpfr_get_default_rounding_mode.
Add the tests for mpfr_get/set_default_rounding_mode.
Fix mpfr_set_default_rounding_mode.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2633 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/texceptions.c')
-rw-r--r-- | tests/texceptions.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/tests/texceptions.c b/tests/texceptions.c index 82e6cd8c1..cf13f5a44 100644 --- a/tests/texceptions.c +++ b/tests/texceptions.c @@ -1,6 +1,6 @@ /* Test file for exceptions. -Copyright 2001, 2002, 2003 Free Software Foundation. +Copyright 2001, 2002, 2003, 2004 Free Software Foundation. This file is part of the MPFR Library. @@ -24,6 +24,35 @@ MA 02111-1307, USA. */ #include "mpfr-test.h" +/* Test default rounding mode */ +static void +check_default_rnd(void) +{ + mp_rnd_t r, t; + for(r = 0 ; r < 4 ; r++) + { + mpfr_set_default_rounding_mode (r); + t = mpfr_get_default_rounding_mode(); + if (r !=t) + { + printf("ERROR in setting / getting default rounding mode (1)\n"); + exit(1); + } + } + mpfr_set_default_rounding_mode(4); + if (mpfr_get_default_rounding_mode() != GMP_RNDD) + { + printf("ERROR in setting / getting default rounding mode (2)\n"); + exit(1); + } + mpfr_set_default_rounding_mode(-1); + if (mpfr_get_default_rounding_mode() != GMP_RNDD) + { + printf("ERROR in setting / getting default rounding mode (3)\n"); + exit(1); + } +} + static void mpfr_set_double_range (void) { @@ -141,6 +170,7 @@ main (int argc, char *argv[]) test_set_underflow (); test_set_overflow (); + check_default_rnd(); mpfr_init (x); mpfr_init (y); |