summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Corrections for use with --with-gmp-build.vlefevre2017-08-282-5/+5
| | | | | | | | | * tests/tests.c: use __gmp_rands instead of mpfr_rands (which was introduced by r11666). * tests/turandom.c: use RANDS instead of mpfr_rands (which was introduced by r11649). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11672 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/turandom.c] Disabled the reprod_abi test with GMP < 4.2.0vlefevre2017-08-271-0/+2
| | | | | | | since the hardcoded values would be different. (merged changeset r11669 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11670 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/turandom.c] Check that the behavior does not depend on thevlefevre2017-08-271-0/+87
| | | | | | | | platform ABI or MPFR version. (merged changeset r11663 from the trunk, and updated the hardcoded values for this 3.1 branch) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11668 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/turandom.c] In bug20170123, use a local gmp_randstate_t variablevlefevre2017-08-271-2/+5
| | | | | | | instead of mpfr_rands, due to the gmp_randseed_ui. (merged changeset r11654 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11667 280ebfd0-de03-0410-8827-d642c229c3f4
* [src/mpfr-gmp.h,tests/tests.c] Got rid of __gmp_randstate_struct, whichvlefevre2017-08-271-5/+3
| | | | | | | | is internal to GMP: its use came from very old code (r2330 in 2003-06) and it is no longer needed. (marked changeset r11652 as merged from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11666 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/turandom.c] Disabled a test with GMP < 4.2.0 since it depends onvlefevre2017-08-271-1/+5
| | | | | | | | a specific behavior of the random generator, which changed in GMP 4.2.0 (the test would probably fail with such old GMP versions). (applied a part of r8787 and merged changeset r11651 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11665 280ebfd0-de03-0410-8827-d642c229c3f4
* [src/urandom.c] Generate the exception flags for mpfr_urandom almost asvlefevre2017-08-221-2/+160
| | | | | | | | | | | | | | | | | | | | expected: * Set the underflow flag if the drawn exponent is less than emin. This corresponds to "underflow before rounding" while the normal rule in MPFR is "underflow after rounding". This is not fixable in the 3.1 branch since the significand is not drawn in this case, and drawing the significand to determine whether there is an underflow would change the state of the PRNG at the end of the function, breaking the ABI and the users' expectations. * Set the inexact flag on underflow (this was not done before). [tests/turandom.c] Added underflow and overflow tests. [doc/mpfr.texi] Documented the above issue with the underflow flag for mpfr_urandom. (merged changesets r11220,11635,11637-11641,11643-11647 from the trunk; instead of merging the conflicting r11636, did all the changes manually; replaced mpfr_flags_t by unsigned int) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11649 280ebfd0-de03-0410-8827-d642c229c3f4
* [src/urandom.c] Fixed bug reported by Trevor Spiteri:vlefevre2017-08-221-0/+20
| | | | | | | | <https://sympa.inria.fr/sympa/arc/mpfr/2017-01/msg00020.html> [tests/turandom.c] Added non-regression test. (merged changesets r11218-11219,11221 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11648 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/mpf_compat.h] Include "mpfr-test.h" instead of "mpfr-impl.h",vlefevre2017-08-011-1/+1
| | | | | | | | in order to avoid a link failure under MS Windows with DLL. See: https://sympa.inria.fr/sympa/arc/mpfr/2017-07/msg00012.html https://sympa.inria.fr/sympa/arc/mpfr/2017-07/msg00017.html git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11606 280ebfd0-de03-0410-8827-d642c229c3f4
* [src/mpf2mpfr.h] Fixed mpf_fits_s* and mpf_get_si macros.vlefevre2017-06-051-8/+12
| | | | | | | | [tests/mpf_compat.h] Added non-regression tests. (merged changesets r11565,11571 from the trunk, and did some changes in the inclusions of header files due to the use of MPFR_ASSERTN) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11579 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/tsprintf.c] Fixed setlocale usage (problem detected with MinGWvlefevre2017-05-281-3/+2
| | | | | | | | | | | in the trunk) by not using the returned string any longer. Indeed, ISO C99 says that this string "may be overwritten by a subsequent call to the setlocale function". The tests in the 3.1 branch are different, so that this problem was not detected here on the tested platforms, including MinGW. (merged changeset r11533 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11540 280ebfd0-de03-0410-8827-d642c229c3f4
* [src] Moved "#include <errno.h>" from printf.c to vasprintf.c (thisvlefevre2017-05-281-2/+30
| | | | | | | | | | | should have been done in r5230, where EOVERFLOW was moved). (merged changeset r11532 from the trunk) [tests/tprintf.c] Added errno test for check_long_string(), which is called when MPFR_CHECK_LARGEMEM is defined, to trigger the above bug. A merge from the trunk was not possible due to many changes in the mpfr_*printf code and the tests. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11539 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests] Increase buffer sizes to avoid a build failure with GCC 7vlefevre2017-05-282-2/+2
| | | | | | | | | | under some conditions due to the following bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79257 This increase is not a problem for the tests, where optimal code is useless. (merged changesets r11469,11470 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11537 280ebfd0-de03-0410-8827-d642c229c3f4
* Copyright notice update: added 2017 withvlefevre2017-01-01172-172/+172
| | | | | | | | | perl -pi -e 's/ (\d{4}-)?(2016)(?= Free Software)/ " ".($1||"$2-").($2+1)/e' **/*(^/) under zsh (the m4 and tools/mbench directories were not modified). Removed 2016 from the example in the doc/README.dev file. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11119 280ebfd0-de03-0410-8827-d642c229c3f4
* [src/strtofr.c] Fixed bug in mpfr_strtofr(): in round-to-nearest,vlefevre2016-12-191-0/+19
| | | | | | | | | the ternary value could be incorrect. [tests/tstrtofr.c] Added test case. (merged changesets from the trunk: r11055, a part of r11056, and r11059,11066-11068) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11069 280ebfd0-de03-0410-8827-d642c229c3f4
* [src/vasprintf.c] Fixed a bug: spec.prec can be a negative number othervlefevre2016-12-151-0/+20
| | | | | | | | than -1 (when such a value is given as an argument with ".*"). [tests/tsprintf.c] Added non-regression test. (merged changesets r11037-11038 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11043 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/tdiv.c] Improved code readability, fixing a small bugvlefevre2016-09-141-2/+4
| | | | | | | | (found by David Binderman using cppcheck) at the same time. This bug could only affect the error message if the test failed. (merged changesets r10871-10872 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10873 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/tset_ld.c] In bug_20160907, fixed the method to get the smallestvlefevre2016-09-121-11/+14
| | | | | | | subnormal (now, OK with gcc -mpc64 or under NetBSD 6-). (merged changesets r10835-10839 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10855 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/tabs.c] Removed mpfr_test_init (not needed here).vlefevre2016-09-121-1/+0
| | | | | | (merged changeset r10822 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10854 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/tset_ld.c] Move tests_start_mpfr and mpfr_test_init earlier.vlefevre2016-09-121-3/+3
| | | | | | (merged changesets r8688,10821 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10853 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/tset_ld.c] Corrected a type (due to a printf with %ld) and fixedvlefevre2016-09-121-5/+7
| | | | | | | a loop in case an extended range is used. (merged changesets r10818-10819 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10852 280ebfd0-de03-0410-8827-d642c229c3f4
* [src/get_ld.c] Fixed bug for little-endian x86 extended precision.vlefevre2016-09-081-0/+58
| | | | | | | [tests/tset_ld.c] Added test case. (merged changesets r10807-10809,10811-10812 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10815 280ebfd0-de03-0410-8827-d642c229c3f4
* Fixed various bugs in mpfr_can_round_raw, which affected mpfr_can_round:vlefevre2016-09-051-6/+117
| | | | | | | | | | | | | | there could still be false positives (i.e. mpfr_can_round could say that rounding was possible while correct rounding was not guaranteed), and also false negatives, some of which could yield infinite Ziv loops in user code in practice. Added tests triggering these bugs, in particular a comprehensive test against a naive implementation. (merged changesets r10679-10686,10717-10718,10743,10746-10748,10752,10754,10756 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10792 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/tzeta.c] Updated test_generic invocation based on the trunkvlefevre2016-09-051-1/+4
| | | | | | | in order to reduce the test time (increased since r9849). (merged changesets r9955,10667,10672,10790 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10791 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/tmul.c] Added underflow test from the trunk (merged changesetsvlefevre2016-08-221-0/+105
| | | | | | from r10601 to r10716 for tmul.c only). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10742 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/tsi_op.c] Fixed a macro. There were no consequences exceptvlefevre2016-08-041-7/+9
| | | | | | | spurious null statements. (merged changeset r10724 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10728 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/tset_{si,sj}.c] Fixed macros. There were no consequences exceptvlefevre2016-08-042-2/+2
| | | | | | | spurious null statements. (merged changeset r10721 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10722 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests] C++ compatibility: avoid errors with "g++ -std=c++11" or later.vlefevre2016-08-044-11/+11
| | | | | | | | | | Note that as of GCC 6, "the default mode for C++ is now -std=gnu++14 instead of -std=gnu++98" <https://gcc.gnu.org/gcc-6/changes.html>. So, this fixes the failures in the build of the MPFR tests with g++ from GCC 6 without particular options. (merged changeset r10719 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10720 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/tsub.c] Added comments for check_max_almosteven.vlefevre2016-05-301-0/+23
| | | | | | (merged changeset r10386 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10387 280ebfd0-de03-0410-8827-d642c229c3f4
* [src/sub1.c] Fixed bug in mpfr_sub1 (real subtraction b - c, |b| > |c|):vlefevre2016-05-291-0/+130
| | | | | | | | | | | | | In MPFR_RNDN (rounding to nearest), when |b| is the midpoint between the maximum number and 2^emax (the maximum number + 1 ulp) and c is small, the obtained result is an infinity (with overflow) instead of ± the maximum number (no overflow). The cause is that an overflow is generated too early (in the rounding code). [tests/tsub.c] Added test cases. (merged changeset r10383 from the trunk, with conflict resolved in src/sub1.c and mpfr_flags_t replaced by unsigned int) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10384 280ebfd0-de03-0410-8827-d642c229c3f4
* For mpfr_add_ui and mpfr_sub_ui, make sure that all the expected flagsvlefevre2016-05-222-0/+4
| | | | | | | | | 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
* [tests/tversion.c] Improved output of compiler information.vlefevre2016-03-021-3/+24
| | | | | | (merge changesets r9695-9696,10170,10181-10182 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10184 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/tget_flt.c] Do tests that may involve subnormals onlyvlefevre2016-03-021-0/+2
| | | | | | | if HAVE_DENORMS is defined. (merged changeset r10173 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10174 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/tget_flt.c] Use DOUBLE_ISNAN() instead of f == f.vlefevre2016-03-011-1/+2
| | | | | | (merge changesets r10160,10163 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10167 280ebfd0-de03-0410-8827-d642c229c3f4
* Replaced the remaining ASSERT_ALWAYS by MPFR_ASSERTN.vlefevre2016-02-293-15/+15
| | | | | | (merged changeset r10145 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10146 280ebfd0-de03-0410-8827-d642c229c3f4
* fixed assert macroszimmerma2016-02-291-18/+18
| | | | git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10143 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/tversion.c]vlefevre2016-02-291-0/+51
| | | | | | | | | | * Output support status of modifiers in gmp_printf (a bit like r10123 and r10124 in the trunk, except that macros PRINTF_T and PRINTF_L do not exist and their absence means here "yes"). * Output availability of intmax_t/uintmax_t based functions and *printf functions (merged changeset r10127 from the trunk). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10133 280ebfd0-de03-0410-8827-d642c229c3f4
* In the tests, use tests_allocate and tests_free instead ofvlefevre2016-02-246-25/+25
| | | | | | | | | | | (*__gmp_allocate_func) / malloc and (*__gmp_free_func) / free. Note: This follows the discussion at https://sympa.inria.fr/sympa/arc/mpfr/2015-12/msg00055.html and should solve these problems under MS Windows (mingw32). (merged changesets r9891,10118 from the trunk, resolving conflicts to keep only the needed changes) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10119 280ebfd0-de03-0410-8827-d642c229c3f4
* [src/{cmp_d.c,cmp_ld.c}] Bug fixes: mpfr_cmp_d (resp. mpfr_cmp_ld) wasvlefevre2016-02-232-8/+54
| | | | | | | | | | | | setting the NaN flag when the double (resp. long double) was a NaN and could return an incorrect result (assertion failure in debug mode) in reduced exponent range. [tests/{tcmp_d.c,tcmp_ld.c}] Added a test in reduced exponent range. Full test of the flags for NaN. (merged changesets r10087-10089 from the trunk, with replacement of new features of the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10090 280ebfd0-de03-0410-8827-d642c229c3f4
* [src/sum.c] Fixed bugs in mpfr_sum, which could return wrong resultsvlefevre2016-02-221-1/+38
| | | | | | | | | | | | | | | | | | when not all the numbers have the same precision. A side effect is that this can make mpfr_sum much slower and/or take much more memory in some of such cases with the same program; this is normal and cannot easily be avoided with the current algorithm. Note: The full rewrite currently in the trunk has not been merged because this would not be a simple patch (and it is still incomplete when a number is reused as the output). [src/mpfr-impl.h] Updated the prototype of mpfr_sum_sort. Note: Since this function is used only internally and by the tests, this does not break the ABI. However the old and new tsum tests are source & binary incompatible. [tests/tsum.c] Updated the use of mpfr_sum_sort. Added a testcase. (merged changesets r8697,8699,8701,8851 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10083 280ebfd0-de03-0410-8827-d642c229c3f4
* [src/agm.c] Fixed bug in mpfr_agm in case the two FP inputs havevlefevre2016-02-221-0/+40
| | | | | | | | | the same value but the result cannot be exactly represented in the target precision: the ternary value was wrongly set to 0. [tests/tagm.c] Added testcase. (merged changesets r10060,10077 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10078 280ebfd0-de03-0410-8827-d642c229c3f4
* [src/rem1.c] Fixed bug in the mpfr_rem1 internal function (used byvlefevre2016-02-192-20/+83
| | | | | | | | mpfr_remainder, mpfr_remquo and mpfr_fmod): MPFR can take much memory or crash when using inputs with a huge difference in magnitude. [tests/{tfmod.c,tremquo.c}] Testcases. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10075 280ebfd0-de03-0410-8827-d642c229c3f4
* [src/gamma.c] Bug fix in case the argument is an integer fitting in anvlefevre2016-02-191-0/+12
| | | | | | | | unsigned long: flags may be set while they shouldn't, and the result may be incorrect in a very reduced exponent range. (merged changesets r10043-10045 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10071 280ebfd0-de03-0410-8827-d642c229c3f4
* [src/root.c] Fixed root(x,k) for large very values of k: MPFR couldvlefevre2016-02-151-39/+194
| | | | | | | | | | | | | | crash or take much memory, and the function could return incorrect values. This is done by changing the algorithm for k > 100. This patch is rather safe as applications that only use small values of k (≤ 100) won't see any change, and for applications that may use large values of k, this change may be needed. [tests/troot.c] Added tests. (merged changesets r9921-9928,9930-9931,9965-9970,9973-9974,10036,10038 from the trunk, with mpfr_flags_t replaced by unsigned int; for r9965, the merged was done only on the src directory) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10040 280ebfd0-de03-0410-8827-d642c229c3f4
* [src/{fits_intmax.c,fits_s.h,fits_u.h}] Fixed mpfr_fits_* functions: thevlefevre2016-02-151-225/+194
| | | | | | | | | | | flags could be modified, and an assertion failure could be triggered in debug mode (additional assertion checking) for non-integer numbers just above the positive limit. [tests/tfits.c] Many new tests. (merged changesets r9650,9653-9655,10030-10034 from the trunk, with mpfr_flags_t replaced by unsigned int) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10035 280ebfd0-de03-0410-8827-d642c229c3f4
* Fixed bug in mpfr_can_round_raw, which affected mpfr_can_round: thevlefevre2016-02-121-8/+89
| | | | | | | | | | | result could be true instead of false in case of a change of binade (exponent decrease) on the approximation interval. At the same time, make sure that the number is normalized, and ditto for mpfr_round_p; otherwise the semantic is not clear. Thus mpfr_div, which could call mpfr_round_p with an unnormalized number, had to be fixed. (merged changesets r9881,9883-9890,9896-9904,9932,10027 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10029 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/tgeneric_ui.c] Added tests of the extreme integer values,vlefevre2016-02-091-1/+10
| | | | | | | | so that tsi_op fails with a runtime error in si_op.c when using an UB sanitizer (bug fixed in r9999 in the trunk). (merged changeset r10001 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10002 280ebfd0-de03-0410-8827-d642c229c3f4
* Replacedvlefevre2016-02-04171-171/+171
| | | | | | | | Contributed by the AriC and Caramel projects by Contributed by the AriC and Caramba projects git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@9943 280ebfd0-de03-0410-8827-d642c229c3f4
* [tests/tsqrt.c] Improved testcase for the mpfr_sqrt bug fixed in r9860,vlefevre2016-01-211-4/+9
| | | | | | | | with detailed comment: the precision of the result has to be a multiple of the number of bits per word and rounding has to be to nearest. (merged changeset r9861 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@9862 280ebfd0-de03-0410-8827-d642c229c3f4
* Fixed bug in mpfr_sqrt reported by Fredrik Johansson, occurring whenvlefevre2016-01-211-0/+26
| | | | | | | the result has to be rounded up to a power of 2. (merged changesets r9857-9859 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@9860 280ebfd0-de03-0410-8827-d642c229c3f4