summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-05-22 10:05:37 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-05-22 10:05:37 +0000
commit83df68ece4d8d6638c826cba1e75f24f6ab7b364 (patch)
tree1e0a4f00b82d4b93ddb6264ce71f0c86185f826b /src
parentea34a7d62ef06f0aaf59408ac9bea0028d822ad0 (diff)
downloadmpfr-83df68ece4d8d6638c826cba1e75f24f6ab7b364.tar.gz
For mpfr_add_ui and mpfr_sub_ui, make sure that all the expected flags
are set (in practice, only NaN was affected). Added testcases from the trunk (merged r10298 and r10303). Note: the trunk was fixed with a partial rewrite for some optimization and to improve consistency, but here, the changes are kept minimal. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10304 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src')
-rw-r--r--src/add_ui.c1
-rw-r--r--src/sub_ui.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/add_ui.c b/src/add_ui.c
index 49c6752a0..700ca6f94 100644
--- a/src/add_ui.c
+++ b/src/add_ui.c
@@ -49,6 +49,7 @@ mpfr_add_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mpfr_rnd_t rnd_mode
MPFR_SAVE_EXPO_MARK (expo);
MPFR_SET_EXP (uu, GMP_NUMB_BITS - cnt);
inex = mpfr_add(y, x, uu, rnd_mode);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
MPFR_SAVE_EXPO_FREE (expo);
return mpfr_check_range(y, inex, rnd_mode);
}
diff --git a/src/sub_ui.c b/src/sub_ui.c
index b366970eb..718db0a43 100644
--- a/src/sub_ui.c
+++ b/src/sub_ui.c
@@ -52,6 +52,7 @@ mpfr_sub_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mpfr_rnd_t rnd_mode
MPFR_SAVE_EXPO_MARK (expo);
MPFR_SET_EXP (uu, GMP_NUMB_BITS - cnt);
inex = mpfr_sub (y, x, uu, rnd_mode);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
MPFR_SAVE_EXPO_FREE (expo);
return mpfr_check_range (y, inex, rnd_mode);
}