summaryrefslogtreecommitdiff
path: root/set_rnd.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-01-19 16:03:30 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-01-19 16:03:30 +0000
commit31dc00cc70ad46e541534256dbe37c38d8edda78 (patch)
tree80c667693f4f7bee07943c23cbb132c7564deb6b /set_rnd.c
parentd44793e4c78cf1a88d00046d32f8ff403dea655b (diff)
downloadmpfr-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 'set_rnd.c')
-rw-r--r--set_rnd.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/set_rnd.c b/set_rnd.c
index 4cb43dbdd..6505463a1 100644
--- a/set_rnd.c
+++ b/set_rnd.c
@@ -1,6 +1,7 @@
/* mpfr_set_default_rounding_mode -- set the default rounding mode
+ mpfr_get_default_rounding_mode -- get the default rounding mode
-Copyright 1999, 2001 Free Software Foundation, Inc.
+Copyright 1999, 2001, 2004 Free Software Foundation, Inc.
This file is part of the MPFR Library.
@@ -22,11 +23,19 @@ MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
#include "mpfr.h"
+#include "mpfr-impl.h"
-mp_rnd_t __gmpfr_default_rounding_mode = 0;
+mp_rnd_t __gmpfr_default_rounding_mode = GMP_RNDN;
void
mpfr_set_default_rounding_mode (mp_rnd_t rnd_mode)
{
- __gmpfr_default_rounding_mode = rnd_mode;
+ if (rnd_mode >= GMP_RNDN && rnd_mode <= GMP_RNDD)
+ __gmpfr_default_rounding_mode = rnd_mode;
+}
+
+mp_rnd_t
+mpfr_get_default_rounding_mode (void)
+{
+ return __gmpfr_default_rounding_mode;
}