diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2016-02-17 15:17:20 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2016-02-17 15:17:20 +0000 |
commit | f8488be3f406deb12d29463493484d508d61fedd (patch) | |
tree | 71aaa00746b041a8742604fd6722e4c177081696 /tests/tfmod.c | |
parent | 84210b5d9df66ff9635260610bd594a75758f307 (diff) | |
download | mpfr-f8488be3f406deb12d29463493484d508d61fedd.tar.gz |
avoid computing with huge integers in mpfr_fmod when x/y is very small
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10054 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tfmod.c')
-rw-r--r-- | tests/tfmod.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/tfmod.c b/tests/tfmod.c index 2c620aef4..ed7f0febb 100644 --- a/tests/tfmod.c +++ b/tests/tfmod.c @@ -298,6 +298,15 @@ special (void) if (!mpfr_equal_p (r, x) || inexact != 0) test_failed (r, x, 0, inexact, x, y, MPFR_RNDN); + mpfr_set_prec (x, 380); + mpfr_set_prec (y, 385); + mpfr_set_str_binary (x, "0.11011010010110011101011000100100101100101011010001011100110001100101111001010100001011111110111100101110101010110011010101000100000100011101101100001011101110100111101111111010001001000010000110010110011100111000001110111010000100101001010111100100010001101001110100011110010000000001110001111001101100111011001000110110011100100011111110010100011001000001001011010111010000000000E0"); + mpfr_set_str_binary (y, "0.1100011000011101011010001100010111001110110111001101010010111100111100011010010011011101111101111001010111111110001001100001111101001000000010100101111001001110010110000111001000101010111001001000100101011111000010100110001111000110011011010101111101100110010101011010011101100001011101001000101111110110110110000001001101110111110110111110111111001001011110001110011111100000000000000E-1"); + mpfr_set_prec (r, 2); + inexact = mpfr_fmod (r, x, y, MPFR_RNDA); + if (mpfr_cmp_ui_2exp (r, 3, -5) || inexact <= 0) + test_failed (r, x, 0, inexact, x, y, MPFR_RNDA); + mpfr_clears (x, y, r, nan, (mpfr_ptr) 0); return; } |