From 31dc00cc70ad46e541534256dbe37c38d8edda78 Mon Sep 17 00:00:00 2001 From: pelissip Date: Mon, 19 Jan 2004 16:03:30 +0000 Subject: 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 --- set_rnd.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'set_rnd.c') 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; } -- cgit v1.2.1