diff -Nru mpfr4-3.1.4/acinclude.m4 mpfr4-4.0.2/acinclude.m4 --- mpfr4-3.1.4/acinclude.m4 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/acinclude.m4 2019-01-27 18:30:16.000000000 +0000 @@ -1,6 +1,6 @@ dnl MPFR specific autoconf macros -dnl Copyright 2000, 2002-2016 Free Software Foundation, Inc. +dnl Copyright 2000, 2002-2019 Free Software Foundation, Inc. dnl Contributed by the AriC and Caramba projects, INRIA. dnl dnl This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ dnl dnl You should have received a copy of the GNU Lesser General Public License dnl along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -dnl http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +dnl https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., dnl 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. dnl autoconf 2.60 is necessary because of the use of AC_PROG_SED. @@ -40,9 +40,70 @@ [ AC_REQUIRE([AC_OBJEXT]) AC_REQUIRE([MPFR_CHECK_LIBM]) +AC_REQUIRE([MPFR_CHECK_LIBQUADMATH]) AC_REQUIRE([AC_HEADER_TIME]) AC_REQUIRE([AC_CANONICAL_HOST]) +dnl Features for the MPFR shared cache. This needs to be done +dnl quite early since this may change CC, CFLAGS and LIBS, which +dnl may affect the other tests. + +if test "$enable_shared_cache" = yes; then + +dnl Prefer ISO C11 threads (as in mpfr-thread.h). + MPFR_CHECK_C11_THREAD() + + if test "$mpfr_c11_thread_ok" != yes; then +dnl Check for POSIX threads. Since the AX_PTHREAD macro is not standard +dnl (it is provided by autoconf-archive), we need to detect whether it +dnl is left unexpanded, otherwise the configure script won't fail and +dnl "make distcheck" won't give any error, yielding buggy tarballs! +dnl The \b is necessary to avoid an error with recent ax_pthread.m4 +dnl (such as with Debian's autoconf-archive 20160320-1), which contains +dnl AX_PTHREAD_ZOS_MISSING, etc. It is not documented, but see: +dnl https://lists.gnu.org/archive/html/autoconf/2015-03/msg00011.html +dnl +dnl Note: each time a change is done in m4_pattern_forbid, autogen.sh +dnl should be tested with and without ax_pthread.m4 availability (in +dnl the latter case, there should be an error). + m4_pattern_forbid([AX_PTHREAD\b]) + AX_PTHREAD([]) + if test "$ax_pthread_ok" = yes; then + CC="$PTHREAD_CC" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$LIBS $PTHREAD_LIBS" +dnl Do a compilation test, as this is currently not done by AX_PTHREAD. +dnl Moreover, MPFR needs pthread_rwlock_t, which is conditionally defined +dnl in glibc's bits/pthreadtypes.h (via ), not sure why... + AC_MSG_CHECKING([for pthread_rwlock_t]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include +]], [[ +pthread_rwlock_t lock; (void) lock; +]])], + [AC_MSG_RESULT([yes]) + mpfr_pthread_ok=yes], + [AC_MSG_RESULT([no]) + mpfr_pthread_ok=no]) + else + mpfr_pthread_ok=no + fi + fi + + AC_MSG_CHECKING(if shared cache can be supported) + if test "$mpfr_c11_thread_ok" = yes; then + AC_MSG_RESULT([yes, with ISO C11 threads]) + elif test "$mpfr_pthread_ok" = yes; then + AC_MSG_RESULT([yes, with pthread]) + else + AC_MSG_RESULT(no) + AC_MSG_ERROR([shared cache needs C11 threads or pthread support]) + fi + +fi + +dnl End of features for the MPFR shared cache. + AC_CHECK_HEADER([limits.h],, AC_MSG_ERROR([limits.h not found])) AC_CHECK_HEADER([float.h],, AC_MSG_ERROR([float.h not found])) AC_CHECK_HEADER([string.h],, AC_MSG_ERROR([string.h not found])) @@ -68,9 +129,6 @@ dnl Check how to get `alloca' AC_FUNC_ALLOCA -dnl SIZE_MAX macro -gl_SIZE_MAX - dnl va_copy macro AC_MSG_CHECKING([how to copy va_list]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @@ -93,28 +151,35 @@ dnl MPFR, but if they are implemented as macros, this is also OK (in our dnl case). So, we do not return an error, but their tests are currently dnl useless. +dnl Moreover, for memmove and memset, when gcc -Werror is used, these +dnl functions are considered to be missing because of a "conflicting +dnl types for built-in function" error. Possible workarounds if the +dnl results of this test are used (thus one doesn't want an error): +dnl * If "$GCC" is set, disable built-ins by adding -fno-builtin +dnl to $CFLAGS for this test (this would yield a failure if such +dnl functions are defined only as built-ins, but does this occur +dnl in practice?). +dnl * Enable -Werror only for the main compilation (and possibly +dnl some particular tests) via a new configure option. dnl gettimeofday is not defined for MinGW -AC_CHECK_FUNCS([memmove memset setlocale strtol gettimeofday]) +AC_CHECK_FUNCS([memmove memset setlocale strtol gettimeofday signal]) -dnl Check for IEEE-754 switches on Alpha -case $host in -alpha*-*-*) - saved_CFLAGS="$CFLAGS" - AC_CACHE_CHECK([for IEEE-754 switches], mpfr_cv_ieee_switches, [ - if test -n "$GCC"; then - mpfr_cv_ieee_switches="-mfp-rounding-mode=d -mieee-with-inexact" - else - mpfr_cv_ieee_switches="-fprm d -ieee_with_inexact" - fi - CFLAGS="$CFLAGS $mpfr_cv_ieee_switches" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], , mpfr_cv_ieee_switches="none") - ]) - if test "$mpfr_cv_ieee_switches" = "none"; then - CFLAGS="$saved_CFLAGS" - else - CFLAGS="$saved_CFLAGS $mpfr_cv_ieee_switches" - fi -esac +dnl We cannot use AC_CHECK_FUNCS on sigaction, because while this +dnl function may be provided by the C library, its prototype and +dnl associated structure may not be available, e.g. when compiling +dnl with "gcc -std=c99". +AC_MSG_CHECKING(for sigaction and its associated structure) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include +static int f (int (*func)(int, const struct sigaction *, struct sigaction *)) +{ return 0; } +]], [[ + return f(sigaction); +]])], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SIGACTION, 1, + [Define if you have a working sigaction function.]) +],[AC_MSG_RESULT(no)]) dnl check for long long AC_CHECK_TYPE([long long int], @@ -136,6 +201,34 @@ if test "$mpfr_cv_have_intmax_max" = "yes"; then AC_DEFINE(MPFR_HAVE_INTMAX_MAX,1,[Define if you have a working INTMAX_MAX.]) fi + AC_CACHE_CHECK([for working printf length modifier for intmax_t], + mpfr_cv_printf_maxlm, [ + saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I$srcdir/src" + for modifier in j ll l + do + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include +#include +#include "mpfr-intmax.h" +]],[[ + char s[64]; + sprintf (s, "%${modifier}d %${modifier}u", + (intmax_t) -17, (uintmax_t) 42); + return strcmp (s, "-17 42") != 0; +]])], + mpfr_cv_printf_maxlm=${modifier}; break, + mpfr_cv_printf_maxlm=none, +dnl We assume that j is working when cross-compiling. + mpfr_cv_printf_maxlm=j; break + ) + done + CPPFLAGS="$saved_CPPFLAGS" + ]) + if test "$mpfr_cv_printf_maxlm" != "none"; then + AC_DEFINE_UNQUOTED([MPFR_PRINTF_MAXLM],["$mpfr_cv_printf_maxlm"], + [Define to a working printf length modifier for intmax_t]) + fi fi AC_CHECK_TYPE( [union fpc_csr], @@ -146,6 +239,33 @@ #endif ]) +dnl Check for _Noreturn function specifier (ISO C11) +AC_CACHE_CHECK([for _Noreturn], mpfr_cv_have_noreturn, [ + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[_Noreturn void foo(int);]])], + mpfr_cv_have_noreturn=yes, mpfr_cv_have_noreturn=no) +]) +if test "$mpfr_cv_have_noreturn" = "yes"; then + AC_DEFINE(MPFR_HAVE_NORETURN,1,[Define if the _Noreturn function specifier is supported.]) +fi + +dnl Check for __builtin_unreachable +AC_CACHE_CHECK([for __builtin_unreachable], mpfr_cv_have_builtin_unreachable, +[ + AC_LINK_IFELSE([AC_LANG_PROGRAM( + [[int x;]], + [[if (x) __builtin_unreachable(); ]] + )], + mpfr_cv_have_builtin_unreachable=yes, + mpfr_cv_have_builtin_unreachable=no) +]) +if test "$mpfr_cv_have_builtin_unreachable" = "yes"; then + AC_DEFINE(MPFR_HAVE_BUILTIN_UNREACHABLE, 1, + [Define if the __builtin_unreachable GCC built-in is supported.]) +fi + +dnl Check for attribute constructor and destructor +MPFR_CHECK_CONSTRUCTOR_ATTR() + dnl Check for fesetround AC_CACHE_CHECK([for fesetround], mpfr_cv_have_fesetround, [ saved_LIBS="$LIBS" @@ -204,13 +324,16 @@ fi dnl Check if subnormal (denormalized) numbers are supported -AC_CACHE_CHECK([for subnormal numbers], mpfr_cv_have_denorms, [ +dnl for the binary64 format, the smallest normal number is 2^(-1022) +dnl for the binary32 format, the smallest normal number is 2^(-126) +AC_CACHE_CHECK([for subnormal double-precision numbers], +mpfr_cv_have_denorms, [ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include int main (void) { double x = 2.22507385850720138309e-308; fprintf (stderr, "%e\n", x / 2.0); - return 2.0 * (x / 2.0) != x; + return 2.0 * (double) (x / 2.0) != x; } ]])], [mpfr_cv_have_denorms="yes"], @@ -218,7 +341,25 @@ [mpfr_cv_have_denorms="cannot test, assume no"]) ]) if test "$mpfr_cv_have_denorms" = "yes"; then - AC_DEFINE(HAVE_DENORMS,1,[Define if subnormal (denormalized) floats work.]) + AC_DEFINE(HAVE_DENORMS,1,[Define if subnormal (denormalized) doubles work.]) +fi +AC_CACHE_CHECK([for subnormal single-precision numbers], +mpfr_cv_have_denorms_flt, [ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include +int main (void) { + float x = 1.17549435082229e-38; + fprintf (stderr, "%e\n", x / 2.0); + return 2.0 * (float) (x / 2.0) != x; +} +]])], + [mpfr_cv_have_denorms_flt="yes"], + [mpfr_cv_have_denorms_flt="no"], + [mpfr_cv_have_denorms_flt="cannot test, assume no"]) +]) +if test "$mpfr_cv_have_denorms_flt" = "yes"; then + AC_DEFINE(HAVE_DENORMS_FLT,1, + [Define if subnormal (denormalized) floats work.]) fi dnl Check if signed zeros are supported. Note: the test will fail @@ -241,7 +382,7 @@ dnl In such a case, MPFR_ERRDIVZERO is defined to disable the tests dnl involving a FP division by 0. dnl For the developers: to check whether all these tests are disabled, -dnl configure MPFR with "-DMPFR_TEST_DIVBYZERO=1 -DMPFR_ERRDIVZERO=1". +dnl configure MPFR with "-DMPFR_TESTS_FPE_DIV -DMPFR_ERRDIVZERO". AC_CACHE_CHECK([if the FP division by 0 fails], mpfr_cv_errdivzero, [ AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main (void) { @@ -379,19 +520,32 @@ AC_DEFINE(HAVE_NEARBYINT, 1,[Have ISO C99 nearbyint function]) ],[AC_MSG_RESULT(no)]) +dnl Check if _mulx_u64 is provided +dnl Note: This intrinsic is not standard. We need a run because +dnl it may be provided but not working as expected (with ICC 15, +dnl one gets an "Illegal instruction"). +AC_MSG_CHECKING([for _mulx_u64]) +AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include +]], [[ + unsigned long long h1, h2; + _mulx_u64(17, 42, &h1); + _mulx_u64(-1, -1, &h2); + return h1 == 0 && h2 == -2 ? 0 : 1; +]])], + [AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MULX_U64, 1,[Have a working _mulx_u64 function]) + ], + [AC_MSG_RESULT(no) + ], + [AC_MSG_RESULT([cannot test, assume no]) + ]) + LIBS="$saved_LIBS" dnl Now try to check the long double format MPFR_C_LONG_DOUBLE_FORMAT -if test "$enable_logging" = yes; then - if test "$enable_thread_safe" = yes; then - AC_MSG_ERROR([Enable either `Logging' or `thread-safe', not both]) - else - enable_thread_safe=no - fi -fi - dnl Check if thread-local variables are supported. dnl At least two problems can occur in practice: dnl 1. The compilation fails, e.g. because the compiler doesn't know @@ -417,6 +571,7 @@ AC_DEFINE([MPFR_USE_THREAD_SAFE],1,[Build MPFR as thread safe]) AC_DEFINE([MPFR_USE_C11_THREAD_SAFE],1,[Build MPFR as thread safe using C11]) tls_c11_support=yes + enable_thread_safe=yes ], [AC_MSG_RESULT(no) ], @@ -440,6 +595,7 @@ ]])], [AC_MSG_RESULT(yes) AC_DEFINE([MPFR_USE_THREAD_SAFE],1,[Build MPFR as thread safe]) + enable_thread_safe=yes ], [AC_MSG_RESULT(no) if test "$enable_thread_safe" = yes; then @@ -456,6 +612,118 @@ CPPFLAGS="$saved_CPPFLAGS" fi fi + +dnl Check if decimal floats are available. +dnl For the different cases, we try to use values that will not be returned +dnl by build tools. For instance, 1 must not be used as it can be returned +dnl by ld in case of link failure. +if test "$enable_decimal_float" != no; then + AC_MSG_CHECKING(if compiler knows _Decimal64) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[_Decimal64 x;]])], + [AC_MSG_RESULT(yes) + AC_MSG_CHECKING(decimal float format) + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include +]], [[ +volatile _Decimal64 x = 1; +union { double d; _Decimal64 d64; } y; +if (x != x) return 83; +y.d64 = 1234567890123456.0dd; +return y.d == 0.14894469406741037E-123 ? 80 : + y.d == 0.59075095508629822E-68 ? 81 : 82; +]])], [AC_MSG_RESULT(internal error) + AC_MSG_FAILURE(unexpected exit status 0)], + [d64_exit_status=$? + case "$d64_exit_status" in + 80) AC_MSG_RESULT(DPD) + AC_DEFINE([DPD_FORMAT],1,[DPD format]) + AC_DEFINE([MPFR_WANT_DECIMAL_FLOATS],1, + [Build decimal float functions]) ;; + 81) AC_MSG_RESULT(BID) + AC_DEFINE([MPFR_WANT_DECIMAL_FLOATS],1, + [Build decimal float functions]) ;; + 82) AC_MSG_RESULT(neither DPD nor BID) + if test "$enable_decimal_float" = yes; then + AC_MSG_ERROR([unsupported decimal float format. +Please build MPFR without --enable-decimal-float.]) + fi ;; + *) AC_MSG_RESULT(unknown (exit status $d64_exit_status)) + if test "$enable_decimal_float" = yes; then + AC_MSG_ERROR([internal or link error. +Please build MPFR without --enable-decimal-float.]) + fi ;; + esac], + [AC_MSG_RESULT(assuming DPD) + AC_DEFINE([DPD_FORMAT],1,[]) + AC_DEFINE([MPFR_WANT_DECIMAL_FLOATS],1, + [Build decimal float functions])]) + ], + [AC_MSG_RESULT(no) + if test "$enable_decimal_float" = yes; then + AC_MSG_ERROR([compiler doesn't know _Decimal64 (ISO/IEC TR 24732). +Please use another compiler or build MPFR without --enable-decimal-float.]) + fi]) +fi + +dnl Check if __float128 is available. We also require the compiler +dnl to support C99 constants (this prevents the __float128 support +dnl with GCC's -std=c90, but who cares?). +dnl Note: We use AC_LINK_IFELSE instead of AC_COMPILE_IFELSE since an +dnl error may occur only at link time, such as under NetBSD: +dnl https://mail-index.netbsd.org/pkgsrc-users/2018/02/02/msg026220.html +dnl https://mail-index.netbsd.org/pkgsrc-users/2018/02/05/msg026238.html +dnl By using volatile and making the exit code depend on the value of +dnl this variable, we also make sure that optimization doesn't make +dnl the "undefined reference" error disappear. +if test "$enable_float128" != no; then + AC_MSG_CHECKING(if __float128 with hex constants is supported) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ +volatile __float128 x = 0x1.fp+16383q; +return x == 0; +]])], + [AC_MSG_RESULT(yes) + AC_DEFINE([MPFR_WANT_FLOAT128],1,[Build float128 functions])], + [AC_MSG_RESULT(no) + if test "$enable_float128" = yes; then + AC_MSG_ERROR([compiler doesn't know __float128 with C99 constants +Please use another compiler or build MPFR without --enable-float128.]) + fi]) +fi + +dnl Check if Static Assertions are supported. +AC_MSG_CHECKING(for Static Assertion support) +saved_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS -I$srcdir/src" +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +#define MPFR_USE_STATIC_ASSERT 1 +#include "mpfr-sassert.h" + +/* Test if Static Assertions work */ +MPFR_DECL_STATIC_ASSERT(sizeof(char) <= sizeof(int)); + +int main (void) { + MPFR_DECL_STATIC_ASSERT(sizeof(int) <= sizeof(long)); + int x; + (void) (x = 1); /* cast to void: avoid a warning, at least with GCC */ + /* Test of the macro after a declaraction and a statement. */ + MPFR_STAT_STATIC_ASSERT(sizeof(short) <= sizeof(int)); + return 0; +} + ]])], + [AC_MSG_RESULT(yes) + AC_DEFINE([MPFR_USE_STATIC_ASSERT],1,[Build MPFR with Static Assertions]) + ], + [AC_MSG_RESULT(no) + ], + [AC_MSG_RESULT([cannot test, assume no]) + ]) +CPPFLAGS="$saved_CPPFLAGS" + +if test "$enable_lto" = "yes" ; then + MPFR_LTO +fi + ]) dnl end of MPFR_CONFIGS @@ -569,6 +837,32 @@ esac ]) +dnl MPFR_CHECK_MP_LIMB_T_VS_LONG +dnl ---------------------------- +dnl Check that a long can fit in a mp_limb_t. +dnl If so, it set the define MPFR_LONG_WITHIN_LIMB +AC_DEFUN([MPFR_CHECK_MP_LIMB_T_VS_LONG], [ +AC_REQUIRE([MPFR_CONFIGS]) +AC_CACHE_CHECK([for long to fit in mp_limb_t], mpfr_cv_long_within_limb, [ +saved_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS -I$srcdir/src" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include +#include "mpfr-sassert.h" +]], [[ + MPFR_STAT_STATIC_ASSERT ((mp_limb_t) -1 >= (unsigned long) -1); + return 0; +]])], [mpfr_cv_long_within_limb="yes"], + [mpfr_cv_long_within_limb="no"], + [mpfr_cv_long_within_limb="cannot test, assume not present"]) +]) +case $mpfr_cv_long_within_limb in +yes*) + AC_DEFINE([MPFR_LONG_WITHIN_LIMB],1,[long can be stored in mp_limb_t]) +esac +CPPFLAGS="$saved_CPPFLAGS" +]) + dnl MPFR_PARSE_DIRECTORY dnl Input: $1 = a string to a relative or absolute directory dnl Output: $2 = the variable to set with the absolute directory @@ -576,10 +870,11 @@ [ dnl Check if argument is a directory if test -d $1 ; then - dnl Get the absolute path of the directory - dnl in case of relative directory. - dnl If realpath is not a valid command, - dnl an error is produced and we keep the given path. + dnl Get the absolute path of the directory in case of relative directory + dnl with the realpath command. If the output is empty, the cause may be + dnl that this command has not been found, and we do an alternate test, + dnl the same as what autoconf does for the generated configure script to + dnl determine whether a pathname is absolute or relative. local_tmp=`realpath $1 2>/dev/null` if test "$local_tmp" != "" ; then if test -d "$local_tmp" ; then @@ -588,7 +883,15 @@ $2=$1 fi else - $2=$1 + dnl The quadrigraphs @<:@, @:>@ and @:}@ produce [, ] and ) + dnl respectively (see Autoconf manual). We cannot use quoting here + dnl as the result depends on the context in which this macro is + dnl invoked! To detect that, one needs to look at every instance + dnl of the macro expansion in the generated configure script. + case $1 in + @<:@\\/@:>@* | ?:@<:@\\/@:>@* @:}@ $2=$1 ;; + *@:}@ $2="$PWD"/$1 ;; + esac fi dnl Check for space in the directory if test `echo $1|cut -d' ' -f1` != $1 ; then @@ -645,11 +948,13 @@ /* "before" is 16 bytes to ensure there's no padding between it and "x". We're not expecting any "long double" bigger than 16 bytes or with alignment requirements stricter than 16 bytes. */ -struct { +typedef struct { char before[16]; long double x; char after[8]; -} foo = { +} foo_t; + +foo_t foo = { { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' }, -123456789.0, @@ -904,6 +1209,29 @@ found = 1 exit } + + if (got[23] == "000" && \ + got[22] == "000" && \ + got[21] == "000" && \ + got[20] == "124" && \ + got[19] == "064" && \ + got[18] == "157" && \ + got[17] == "235" && \ + got[16] == "301" && \ + got[15] == "000" && \ + got[14] == "000" && \ + got[13] == "000" && \ + got[12] == "000" && \ + got[11] == "000" && \ + got[10] == "000" && \ + got[9] == "000" && \ + got[8] == "000") + { + # format used on ppc64le + print "possibly double-double, little endian" + found = 1 + exit + } } } } @@ -939,9 +1267,18 @@ #undef HAVE_LDOUBLE_IEEE_QUAD_BIG]) case $mpfr_cv_c_long_double_format in + "IEEE double, big endian") + AC_DEFINE(HAVE_LDOUBLE_IS_DOUBLE, 1) + ;; + "IEEE double, little endian") + AC_DEFINE(HAVE_LDOUBLE_IS_DOUBLE, 1) + ;; "IEEE extended, little endian") AC_DEFINE(HAVE_LDOUBLE_IEEE_EXT_LITTLE, 1) ;; + "IEEE extended, big endian") + AC_DEFINE(HAVE_LDOUBLE_IEEE_EXT_BIG, 1) + ;; "IEEE quad, big endian") AC_DEFINE(HAVE_LDOUBLE_IEEE_QUAD_BIG, 1) ;; @@ -952,17 +1289,22 @@ AC_MSG_WARN([This format is known on GCC/PowerPC platforms,]) AC_MSG_WARN([but due to GCC PR26374, we can't test further.]) AC_MSG_WARN([You can safely ignore this warning, though.]) - # Since we are not sure, we do not want to define a macro. + AC_DEFINE(HAVE_LDOUBLE_MAYBE_DOUBLE_DOUBLE, 1) + ;; + "possibly double-double, little endian") + AC_MSG_WARN([This format is known on GCC/PowerPC platforms,]) + AC_MSG_WARN([but due to GCC PR26374, we can't test further.]) + AC_MSG_WARN([You can safely ignore this warning, though.]) + AC_DEFINE(HAVE_LDOUBLE_MAYBE_DOUBLE_DOUBLE, 1) ;; unknown* | "not available") ;; *) - AC_MSG_WARN([oops, unrecognised float format: $mpfr_cv_c_long_double_format]) + AC_MSG_WARN([unrecognized long double FP format: $mpfr_cv_c_long_double_format]) ;; esac ]) - dnl MPFR_CHECK_LIBM dnl --------------- dnl Determine a math library -lm to use. @@ -991,6 +1333,18 @@ esac ]) +dnl MPFR_CHECK_LIBQUADMATH +dnl --------------- +dnl Determine a math library -lquadmath to use. +AC_DEFUN([MPFR_CHECK_LIBQUADMATH], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_SUBST(MPFR_LIBQUADMATH,'') +case $host in + *) + AC_CHECK_LIB(quadmath, main, MPFR_LIBQUADMATH="-lquadmath") + ;; +esac +]) dnl MPFR_LD_SEARCH_PATHS_FIRST dnl -------------------------- @@ -1017,7 +1371,7 @@ dnl dnl TODO: Replace this with a cleaner type size detection, as this dnl solution only works with gcc and assumes CHAR_BIT == 8. Probably use -dnl , and +dnl , and dnl as a fallback. AC_DEFUN([GMP_C_ATTRIBUTE_MODE], @@ -1094,7 +1448,8 @@ MPFR_FUNC_GMP_PRINTF_SPEC([Lf], [long double], [ #include - ],, + ], + [AC_DEFINE([PRINTF_L], 1, [gmp_printf can read long double])], [AC_DEFINE([NPRINTF_L], 1, [gmp_printf cannot read long double])]) MPFR_FUNC_GMP_PRINTF_SPEC([td], [ptrdiff_t], [ @@ -1104,6 +1459,160 @@ #include #endif #include - ],, + ], + [AC_DEFINE([PRINTF_T], 1, [gmp_printf can read ptrdiff_t])], [AC_DEFINE([NPRINTF_T], 1, [gmp_printf cannot read ptrdiff_t])]) ]) + +dnl MPFR_CHECK_PRINTF_GROUPFLAG +dnl --------------------------- +dnl Check the support of the group flag for native integers, which is +dnl a Single UNIX Specification extension. +dnl This will be used to enable some tests, as the implementation of +dnl the P length modifier for mpfr_*printf relies on this support. + +AC_DEFUN([MPFR_CHECK_PRINTF_GROUPFLAG], [ +AC_MSG_CHECKING(if gmp_printf supports the ' group flag) +AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include +#include +]], [[ + char s[256]; + + if (gmp_sprintf (s, "%'d", 17) == -1) return 1; + return (strcmp (s, "17") != 0); +]])], + [AC_MSG_RESULT(yes) + AC_DEFINE([PRINTF_GROUPFLAG], 1, [Define if gmp_printf supports the ' group flag])], + [AC_MSG_RESULT(no)], + [AC_MSG_RESULT(cannot test, assume no)]) +]) +]) + +dnl MPFR_LTO +dnl -------- +dnl To be representative, we need: +dnl * to compile a source, +dnl * to generate a library archive, +dnl * to generate a program with this archive. +AC_DEFUN([MPFR_LTO],[ +dnl Check for -flto support +CFLAGS="$CFLAGS -flto" + +AC_MSG_CHECKING([if Link Time Optimisation flag '-flto' is supported...]) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +int main(void) { return 0; } + ]])], + [AC_MSG_RESULT(yes) + ], + [AC_MSG_RESULT(no) + AC_MSG_ERROR([Link Time Optimisation flag '-flto' is not supported.]) + ]) + +dnl Check if it works... +mpfr_compile_and_link() +{ + echo "int f(int); int f(int n) { return n; }" > conftest-f.c + echo "int f(int); int main() { return f(0); }" > conftest-m.c + echo "$CC $CFLAGS -c -o conftest-f.o conftest-f.c" >&2 + $CC $CFLAGS -c -o conftest-f.o conftest-f.c || return 1 + echo "$AR cru conftest-lib.a conftest-f.o" >&2 + $AR cru conftest-lib.a conftest-f.o || return 1 + echo "$RANLIB conftest-lib.a" >&2 + $RANLIB conftest-lib.a || return 1 + echo "$CC $CFLAGS conftest-m.c conftest-lib.a" >&2 + $CC $CFLAGS conftest-m.c conftest-lib.a || return 1 + return 0 +} + AC_MSG_CHECKING([if Link Time Optimisation works with AR=$AR]) + if mpfr_compile_and_link 2> conftest-log1.txt ; then + cat conftest-log1.txt >&AS_MESSAGE_LOG_FD + AC_MSG_RESULT(yes) + else + cat conftest-log1.txt >&AS_MESSAGE_LOG_FD + AC_MSG_RESULT(no) + AR=gcc-ar + RANLIB=gcc-ranlib + AC_MSG_CHECKING([if Link Time Optimisation works with AR=$AR]) + if mpfr_compile_and_link 2> conftest-log2.txt; then + cat conftest-log2.txt >&AS_MESSAGE_LOG_FD + AC_MSG_RESULT(yes) + else + cat conftest-log2.txt >&AS_MESSAGE_LOG_FD + AC_MSG_RESULT(no) + AC_MSG_ERROR([Link Time Optimisation is not supported (see config.log for details).]) + fi + fi +rm -f conftest* +]) + +dnl MPFR_CHECK_CONSTRUCTOR_ATTR +dnl --------------------------- +dnl Check for constructor/destructor attributes to function. +dnl Output: Define +dnl * MPFR_HAVE_CONSTRUCTOR_ATTR C define +dnl * mpfr_have_constructor_destructor_attributes shell variable to yes +dnl if supported. +AC_DEFUN([MPFR_CHECK_CONSTRUCTOR_ATTR], [ +AC_MSG_CHECKING([for constructor and destructor attributes]) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include +int x = 0; +__attribute__((constructor)) static void +call_f(void) { x = 1742; } +__attribute__((destructor)) static void +call_g(void) { x = 1448; } +]], [[ + return (x == 1742) ? 0 : 1; +]])], [AC_MSG_RESULT(yes) + mpfr_have_constructor_destructor_attributes=yes ], + [AC_MSG_RESULT(no)] +) + +if test "$mpfr_have_constructor_destructor_attributes" = "yes"; then + AC_DEFINE(MPFR_HAVE_CONSTRUCTOR_ATTR, 1, + [Define if the constructor/destructor GCC attributes are supported.]) +fi +]) + +dnl MPFR_CHECK_C11_THREAD +dnl --------------------- +dnl Check for C11 thread support +dnl Output: Define +dnl * MPFR_HAVE_C11_LOCK C define +dnl * mpfr_c11_thread_ok shell variable to yes +dnl if supported. +dnl We don't check for __STDC_NO_THREADS__ define variable but rather try to mimic our usage. +AC_DEFUN([MPFR_CHECK_C11_THREAD], [ +AC_MSG_CHECKING([for ISO C11 thread support]) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include +#include + mtx_t lock; + once_flag once = ONCE_FLAG_INIT; + thrd_t thd_idx; + int x = 0; + void once_call (void) { x = 1; } +]], [[ + int err; + err = mtx_init(&lock, mtx_plain); + assert(err == thrd_success); + err = mtx_lock(&lock); + assert(err == thrd_success); + err = mtx_unlock(&lock); + assert(err == thrd_success); + mtx_destroy(&lock); + once_call(&once, once_call); + return x == 1 ? 0 : -1; +]])], [AC_MSG_RESULT(yes) + mpfr_c11_thread_ok=yes ], + [AC_MSG_RESULT(no)] +) + +if test "$mpfr_c11_thread_ok" = "yes"; then + AC_DEFINE(MPFR_HAVE_C11_LOCK, 1, + [Define if the ISO C11 Thread is supported.]) +fi +]) + + diff -Nru mpfr4-3.1.4/aclocal.m4 mpfr4-4.0.2/aclocal.m4 --- mpfr4-3.1.4/aclocal.m4 2016-03-06 11:33:17.000000000 +0000 +++ mpfr4-4.0.2/aclocal.m4 2019-01-31 20:43:19.000000000 +0000 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.15 -*- Autoconf -*- +# generated automatically by aclocal 1.16.1 -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,494 @@ If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_pthread.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro figures out how to build C programs using POSIX threads. It +# sets the PTHREAD_LIBS output variable to the threads library and linker +# flags, and the PTHREAD_CFLAGS output variable to any special C compiler +# flags that are needed. (The user can also force certain compiler +# flags/libs to be tested by setting these environment variables.) +# +# Also sets PTHREAD_CC to any special C compiler that is needed for +# multi-threaded programs (defaults to the value of CC otherwise). (This +# is necessary on AIX to use the special cc_r compiler alias.) +# +# NOTE: You are assumed to not only compile your program with these flags, +# but also to link with them as well. For example, you might link with +# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# +# If you are only building threaded programs, you may wish to use these +# variables in your default LIBS, CFLAGS, and CC: +# +# LIBS="$PTHREAD_LIBS $LIBS" +# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +# CC="$PTHREAD_CC" +# +# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant +# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to +# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +# +# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the +# PTHREAD_PRIO_INHERIT symbol is defined when compiling with +# PTHREAD_CFLAGS. +# +# ACTION-IF-FOUND is a list of shell commands to run if a threads library +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it +# is not found. If ACTION-IF-FOUND is not specified, the default action +# will define HAVE_PTHREAD. +# +# Please let the authors know if this macro fails on any platform, or if +# you have any other suggestions or comments. This macro was based on work +# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help +# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by +# Alejandro Forero Cuervo to the autoconf macro repository. We are also +# grateful for the helpful feedback of numerous users. +# +# Updated for Autoconf 2.68 by Daniel Richard G. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2011 Daniel Richard G. +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 24 + +AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) +AC_DEFUN([AX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_PROG_SED]) +AC_LANG_PUSH([C]) +ax_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on Tru64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then + ax_pthread_save_CC="$CC" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) + AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) + AC_MSG_RESULT([$ax_pthread_ok]) + if test "x$ax_pthread_ok" = "xno"; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + CC="$ax_pthread_save_CC" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 +# (Note: HP C rejects this with "bad form for `-t' option") +# -pthreads: Solaris/gcc (Note: HP C also rejects) +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads and +# -D_REENTRANT too), HP C (must be checked before -lpthread, which +# is present but should not be used directly; and before -mthreads, +# because the compiler interprets this as "-mt" + "-hreads") +# -mthreads: Mingw32/gcc, Lynx/gcc +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case $host_os in + + freebsd*) + + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + + ax_pthread_flags="-kthread lthread $ax_pthread_flags" + ;; + + hpux*) + + # From the cc(1) man page: "[-mt] Sets various -D flags to enable + # multi-threading and also sets -lpthread." + + ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" + ;; + + openedition*) + + # IBM z/OS requires a feature-test macro to be defined in order to + # enable POSIX threads at all, so give the user a hint if this is + # not set. (We don't define these ourselves, as they can affect + # other portions of the system API in unpredictable ways.) + + AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], + [ +# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) + AX_PTHREAD_ZOS_MISSING +# endif + ], + [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) + ;; + + solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (N.B.: The stubs are missing + # pthread_cleanup_push, or rather a function called by this macro, + # so we could check for that, but who knows whether they'll stub + # that too in a future libc.) So we'll check first for the + # standard Solaris way of linking pthreads (-mt -lpthread). + + ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags" + ;; +esac + +# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) + +AS_IF([test "x$GCC" = "xyes"], + [ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"]) + +# The presence of a feature test macro requesting re-entrant function +# definitions is, on some systems, a strong hint that pthreads support is +# correctly enabled + +case $host_os in + darwin* | hpux* | linux* | osf* | solaris*) + ax_pthread_check_macro="_REENTRANT" + ;; + + aix*) + ax_pthread_check_macro="_THREAD_SAFE" + ;; + + *) + ax_pthread_check_macro="--" + ;; +esac +AS_IF([test "x$ax_pthread_check_macro" = "x--"], + [ax_pthread_check_cond=0], + [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) + +# Are we compiling with Clang? + +AC_CACHE_CHECK([whether $CC is Clang], + [ax_cv_PTHREAD_CLANG], + [ax_cv_PTHREAD_CLANG=no + # Note that Autoconf sets GCC=yes for Clang as well as GCC + if test "x$GCC" = "xyes"; then + AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], + [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ +# if defined(__clang__) && defined(__llvm__) + AX_PTHREAD_CC_IS_CLANG +# endif + ], + [ax_cv_PTHREAD_CLANG=yes]) + fi + ]) +ax_pthread_clang="$ax_cv_PTHREAD_CLANG" + +ax_pthread_clang_warning=no + +# Clang needs special handling, because older versions handle the -pthread +# option in a rather... idiosyncratic way + +if test "x$ax_pthread_clang" = "xyes"; then + + # Clang takes -pthread; it has never supported any other flag + + # (Note 1: This will need to be revisited if a system that Clang + # supports has POSIX threads in a separate library. This tends not + # to be the way of modern systems, but it's conceivable.) + + # (Note 2: On some systems, notably Darwin, -pthread is not needed + # to get POSIX threads support; the API is always present and + # active. We could reasonably leave PTHREAD_CFLAGS empty. But + # -pthread does define _REENTRANT, and while the Darwin headers + # ignore this macro, third-party headers might not.) + + PTHREAD_CFLAGS="-pthread" + PTHREAD_LIBS= + + ax_pthread_ok=yes + + # However, older versions of Clang make a point of warning the user + # that, in an invocation where only linking and no compilation is + # taking place, the -pthread option has no effect ("argument unused + # during compilation"). They expect -pthread to be passed in only + # when source code is being compiled. + # + # Problem is, this is at odds with the way Automake and most other + # C build frameworks function, which is that the same flags used in + # compilation (CFLAGS) are also used in linking. Many systems + # supported by AX_PTHREAD require exactly this for POSIX threads + # support, and in fact it is often not straightforward to specify a + # flag that is used only in the compilation phase and not in + # linking. Such a scenario is extremely rare in practice. + # + # Even though use of the -pthread flag in linking would only print + # a warning, this can be a nuisance for well-run software projects + # that build with -Werror. So if the active version of Clang has + # this misfeature, we search for an option to squash it. + + AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], + [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], + [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown + # Create an alternate version of $ac_link that compiles and + # links in two steps (.c -> .o, .o -> exe) instead of one + # (.c -> exe), because the warning occurs only in the second + # step + ax_pthread_save_ac_link="$ac_link" + ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' + ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` + ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" + ax_pthread_save_CFLAGS="$CFLAGS" + for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do + AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) + CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" + ac_link="$ax_pthread_save_ac_link" + AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], + [ac_link="$ax_pthread_2step_ac_link" + AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], + [break]) + ]) + done + ac_link="$ax_pthread_save_ac_link" + CFLAGS="$ax_pthread_save_CFLAGS" + AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" + ]) + + case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in + no | unknown) ;; + *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; + esac + +fi # $ax_pthread_clang = yes + +if test "x$ax_pthread_ok" = "xno"; then +for ax_pthread_try_flag in $ax_pthread_flags; do + + case $ax_pthread_try_flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -mt,pthread) + AC_MSG_CHECKING([whether pthreads work with -mt -lpthread]) + PTHREAD_CFLAGS="-mt" + PTHREAD_LIBS="-lpthread" + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) + PTHREAD_CFLAGS="$ax_pthread_try_flag" + ;; + + pthread-config) + AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) + AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) + PTHREAD_LIBS="-l$ax_pthread_try_flag" + ;; + esac + + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include +# if $ax_pthread_check_cond +# error "$ax_pthread_check_macro must be defined" +# endif + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; }], + [pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */])], + [ax_pthread_ok=yes], + []) + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + AC_MSG_RESULT([$ax_pthread_ok]) + AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$ax_pthread_ok" = "xyes"; then + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_CACHE_CHECK([for joinable pthread attribute], + [ax_cv_PTHREAD_JOINABLE_ATTR], + [ax_cv_PTHREAD_JOINABLE_ATTR=unknown + for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [int attr = $ax_pthread_attr; return attr /* ; */])], + [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], + []) + done + ]) + AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ + test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ + test "x$ax_pthread_joinable_attr_defined" != "xyes"], + [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], + [$ax_cv_PTHREAD_JOINABLE_ATTR], + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + ax_pthread_joinable_attr_defined=yes + ]) + + AC_CACHE_CHECK([whether more special flags are required for pthreads], + [ax_cv_PTHREAD_SPECIAL_FLAGS], + [ax_cv_PTHREAD_SPECIAL_FLAGS=no + case $host_os in + solaris*) + ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" + ;; + esac + ]) + AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ + test "x$ax_pthread_special_flags_added" != "xyes"], + [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" + ax_pthread_special_flags_added=yes]) + + AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], + [ax_cv_PTHREAD_PRIO_INHERIT], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[int i = PTHREAD_PRIO_INHERIT; + return i;]])], + [ax_cv_PTHREAD_PRIO_INHERIT=yes], + [ax_cv_PTHREAD_PRIO_INHERIT=no]) + ]) + AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ + test "x$ax_pthread_prio_inherit_defined" != "xyes"], + [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) + ax_pthread_prio_inherit_defined=yes + ]) + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + # More AIX lossage: compile with *_r variant + if test "x$GCC" != "xyes"; then + case $host_os in + aix*) + AS_CASE(["x/$CC"], + [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], + [#handle absolute path differently from PATH based program lookup + AS_CASE(["x$CC"], + [x/*], + [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], + [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) + ;; + esac + fi +fi + +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + +AC_SUBST([PTHREAD_LIBS]) +AC_SUBST([PTHREAD_CFLAGS]) +AC_SUBST([PTHREAD_CC]) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test "x$ax_pthread_ok" = "xyes"; then + ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) + : +else + ax_pthread_ok=no + $2 +fi +AC_LANG_POP +])dnl AX_PTHREAD + +# Copyright (C) 2002-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -32,10 +519,10 @@ # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.15' +[am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.15], [], +m4_if([$1], [1.16.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,12 +538,12 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.15])dnl +[AM_AUTOMAKE_VERSION([1.16.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) -# Copyright (C) 2011-2014 Free Software Foundation, Inc. +# Copyright (C) 2011-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -118,7 +605,7 @@ # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -170,7 +657,7 @@ # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -201,7 +688,7 @@ Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -392,13 +879,12 @@ # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. - # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], @@ -406,49 +892,41 @@ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. Try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS @@ -457,18 +935,17 @@ # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each '.P' file that we will -# need in order to bootstrap the dependency handling code. +# This code is only required when automatic dependency tracking is enabled. +# This creates each '.Po' and '.Plo' makefile fragment that we'll need in +# order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) + [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -555,8 +1032,8 @@ AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# -# +# +# AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. @@ -623,7 +1100,7 @@ Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . +that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -665,7 +1142,7 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -686,7 +1163,7 @@ fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2014 Free Software Foundation, Inc. +# Copyright (C) 2003-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -708,7 +1185,7 @@ # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -743,7 +1220,7 @@ # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -751,49 +1228,42 @@ # AM_MAKE_INCLUDE() # ----------------- -# Check to see how make treats includes. +# Check whether make has an 'include' directive that can support all +# the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' +[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' am__doit: - @echo this is the am__doit target + @echo this is the am__doit target >confinc.out .PHONY: am__doit END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -832,7 +1302,7 @@ # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -861,7 +1331,7 @@ AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -908,7 +1378,7 @@ # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -927,7 +1397,7 @@ # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1008,7 +1478,7 @@ rm -f conftest.file ]) -# Copyright (C) 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 2009-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1068,7 +1538,7 @@ _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1096,7 +1566,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2014 Free Software Foundation, Inc. +# Copyright (C) 2006-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1115,7 +1585,7 @@ # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2014 Free Software Foundation, Inc. +# Copyright (C) 2004-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1251,5 +1721,4 @@ m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) -m4_include([m4/size_max.m4]) m4_include([acinclude.m4]) diff -Nru mpfr4-3.1.4/ar-lib mpfr4-4.0.2/ar-lib --- mpfr4-3.1.4/ar-lib 2016-03-06 11:33:18.000000000 +0000 +++ mpfr4-4.0.2/ar-lib 2019-01-31 20:43:20.000000000 +0000 @@ -4,7 +4,7 @@ me=ar-lib scriptversion=2012-03-01.08; # UTC -# Copyright (C) 2010-2014 Free Software Foundation, Inc. +# Copyright (C) 2010-2018 Free Software Foundation, Inc. # Written by Peter Rosin . # # This program is free software; you can redistribute it and/or modify @@ -18,7 +18,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a diff -Nru mpfr4-3.1.4/AUTHORS mpfr4-4.0.2/AUTHORS --- mpfr4-3.1.4/AUTHORS 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/AUTHORS 2018-07-06 07:21:18.000000000 +0000 @@ -17,7 +17,10 @@ Damien Stehlé Function mpfr_get_ld_2exp Philippe Théveny Main author Sylvain Chevillard Original version of ai.c +Charles Karney mpfr_nrandom and mpfr_erandom functions +Fredrik Johansson New version of mpfr_const_euler +Mickaël Gastineau MPFRbench program The main authors are included in the MPFR mailing-list . This is the preferred way to contact us. For further information, please -look at the MPFR web page . +look at the MPFR web page . diff -Nru mpfr4-3.1.4/BUGS mpfr4-4.0.2/BUGS --- mpfr4-3.1.4/BUGS 2016-03-06 11:33:02.000000000 +0000 +++ mpfr4-4.0.2/BUGS 2019-01-07 13:53:20.000000000 +0000 @@ -1,4 +1,4 @@ -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. ############################################################################## @@ -48,9 +48,8 @@ the MPFR_CAN_ROUND), the result should be correct (or MPFR gets into an infinite loop). TODO: check the code and the error analysis. -* Possible integer overflows on some machines. - -* Possible bugs with huge precisions (> 2^30). +* Possible bugs with huge precisions (> 2^30) and a 32-bit ABI, in particular + undetected integer overflows. TODO: use the MPFR_ADD_PREC macro. * Possible bugs if the chosen exponent range does not allow to represent the range [1/16, 16]. diff -Nru mpfr4-3.1.4/ChangeLog mpfr4-4.0.2/ChangeLog --- mpfr4-3.1.4/ChangeLog 2016-03-06 11:33:06.000000000 +0000 +++ mpfr4-4.0.2/ChangeLog 2019-01-31 20:38:43.000000000 +0000 @@ -1,4772 +1,28255 @@ ------------------------------------------------------------------------ -r10200 | vlefevre | 2016-03-06 11:20:09 +0000 (Sun, 06 Mar 2016) | 1 line +r13433 | vlefevre | 2019-01-31 20:33:50 +0000 (Thu, 31 Jan 2019) | 2 lines Changed paths: - M /branches/3.1/doc/mpfr.texi + M /branches/4.0/NEWS -[doc/mpfr.texi] Updated the month. +[NEWS] Put the "Option -pedantic is now always removed [...]" line +at the right place (4.0.2, not 4.0.1: r13422 was wrong). ------------------------------------------------------------------------ -r10199 | vlefevre | 2016-03-06 11:17:33 +0000 (Sun, 06 Mar 2016) | 1 line +r13432 | vlefevre | 2019-01-31 20:29:48 +0000 (Thu, 31 Jan 2019) | 1 line Changed paths: - M /branches/3.1/VERSION - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/version.c + M /branches/4.0/VERSION + M /branches/4.0/configure.ac + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/src/mpfr.h + M /branches/4.0/src/version.c + +Updated version to 4.0.2. +------------------------------------------------------------------------ +r13431 | vlefevre | 2019-01-31 15:59:16 +0000 (Thu, 31 Jan 2019) | 3 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/src/Makefile.am + +[src/Makefile.am] In check-exported-symbols, replaced grep by $(GREP) +as usual and like in check-gmp-symbols. +(merged changeset 13429 from the trunk) +------------------------------------------------------------------------ +r13424 | vlefevre | 2019-01-30 12:45:13 +0000 (Wed, 30 Jan 2019) | 2 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/configure.ac + +[configure.ac] Updated comment about default options in CFLAGS for GCC. +(merged changeset r13423 from the trunk) +------------------------------------------------------------------------ +r13422 | vlefevre | 2019-01-30 09:26:44 +0000 (Wed, 30 Jan 2019) | 8 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/INSTALL + M /branches/4.0/NEWS + M /branches/4.0/configure.ac + +Update about CC / CFLAGS settings from GMP (__GMP_CC / __GMP_CFLAGS). + * configure.ac: remove -pedantic unconditionally; since r7044, it was + removed only when logging was enabled, as at that time only logging + was using C extensions. + * NEWS: added a line about this change. + * INSTALL: updated the note about CC / CFLAGS, removing the obsolete + reference to GMP 4.3.0 at the same time. +(merged changeset r13421 from the trunk) +------------------------------------------------------------------------ +r13418 | vlefevre | 2019-01-27 23:08:51 +0000 (Sun, 27 Jan 2019) | 1 line +Changed paths: + M /branches/4.0/ChangeLog + +ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC0 svn log -rHEAD:0 -v". +------------------------------------------------------------------------ +r13417 | vlefevre | 2019-01-27 23:01:21 +0000 (Sun, 27 Jan 2019) | 1 line +Changed paths: + M /branches/4.0/VERSION + M /branches/4.0/configure.ac + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/src/mpfr.h + M /branches/4.0/src/version.c + +Updated version to 4.0.2-rc2. +------------------------------------------------------------------------ +r13416 | vlefevre | 2019-01-27 18:30:16 +0000 (Sun, 27 Jan 2019) | 38 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/NEWS + M /branches/4.0/acinclude.m4 + M /branches/4.0/configure.ac + M /branches/4.0/src/mpfr-impl.h + M /branches/4.0/src/mpfr-thread.h + M /branches/4.0/tests + M /branches/4.0/tests/tversion.c + +Shared cache: cleanup and various improvements / corrections. + * acinclude.m4: + - test $enable_shared_cache instead of $mpfr_want_shared_cache; + - check ISO C11 thread support and/or POSIX thread support + only when necessary; + - when checking support for POSIX threads (pthread), also check + that pthread_rwlock_t is supported, as it is needed by MPFR + and conditionally defined in glibc's bits/pthreadtypes.h (via + ); + - with POSIX threads, also set CC="$PTHREAD_CC" as documented by + ax_pthread (autoconf-archive). This is not guaranteed to work, + but according to the ax_pthread.m4 source, in the cases where + "$PTHREAD_CC" != "$CC", not setting it will probably not work + either; + - handle --enable-shared-cache early in MPFR_CONFIGS, because + the use of POSIX threads (pthread) may need to change CC, + CFLAGS, and LIBS (thus affecting other tests); + - removed the now useless MPFR_CHECK_SHARED_CACHE function. + * configure.ac: no longer set the mpfr_want_shared_cache variable, + as enable_shared_cache (now used) already has the same usage. + * acinclude.m4, configure.ac: moved the compatibility test of the + configure options even earlier, from acinclude.m4 to configure.ac, + just after the code that defines them. Also added an associated + AC_MSG_CHECKING message for better clarity. + * src/mpfr-impl.h: added a comment about the cache-related types, + which depend on the locking methods. + * src/mpfr-thread.h: fixed the lock macros: + - in case of failure, one must abort, otherwise this would + generally be undefined behavior; + - added missing "do {} while (0)" (currently not mandatory). + * tests/tversion.c: update concerning the shared cache, to be + consistent with the other mpfr_buildopt_*_p features: + - check that mpfr_buildopt_sharedcache_p() and + MPFR_WANT_SHARED_CACHE match; + - for the output of the value, test mpfr_buildopt_sharedcache_p() + instead of the macro. + * NEWS: update. +(merged changesets r13032,13390-13396,13410,13412 from the trunk) +------------------------------------------------------------------------ +r13409 | vlefevre | 2019-01-25 02:00:06 +0000 (Fri, 25 Jan 2019) | 6 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/acinclude.m4 + M /branches/4.0/configure.ac + M /branches/4.0/tests + M /branches/4.0/tests/trint.c + +[configure.ac] By default (i.e. if CFLAGS is not already set), if +the compiler is GCC not in C++ mode, add the -Wc++-compat warning +since we expect the code to compile with a C++ compiler. +[acinclude.m4,tests/trint.c] Fixed C++ compatibility issues detected +thanks to this option used with -Werror. +(merged changesets r13406-13408 from the trunk) +------------------------------------------------------------------------ +r13402 | vlefevre | 2019-01-13 15:39:13 +0000 (Sun, 13 Jan 2019) | 2 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/tcheck.c + +[tests/tcheck.c] Corrected meaningless error message. +(merged changeset r13401 from the trunk) +------------------------------------------------------------------------ +r13400 | vlefevre | 2019-01-13 01:15:11 +0000 (Sun, 13 Jan 2019) | 3 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/tversion.c + +[tests/tversion.c] Decimal formats: output the encoding type (DPD/BID). +(merged changeset r12776 from the trunk, and as a consequence, +completed the merge of r13003) +------------------------------------------------------------------------ +r13399 | vlefevre | 2019-01-13 00:17:11 +0000 (Sun, 13 Jan 2019) | 1 line +Changed paths: + M /branches/4.0/VERSION + M /branches/4.0/configure.ac + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/src/mpfr.h + M /branches/4.0/src/version.c + +Updated version to 4.0.2-dev. +------------------------------------------------------------------------ +r13398 | vlefevre | 2019-01-13 00:15:31 +0000 (Sun, 13 Jan 2019) | 3 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/doc/mpfr.texi + +[doc/mpfr.texi] Minor correction for non-tex versions. +Thanks to Trevor Spiteri for the bug report. +(merged changeset r13397 from the trunk) +------------------------------------------------------------------------ +r13387 | vlefevre | 2019-01-08 13:43:12 +0000 (Tue, 08 Jan 2019) | 1 line +Changed paths: + M /branches/4.0/ChangeLog + +ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC0 svn log -rHEAD:0 -v". +------------------------------------------------------------------------ +r13386 | vlefevre | 2019-01-08 13:30:18 +0000 (Tue, 08 Jan 2019) | 3 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/tstrtofr.c + +[tests/tstrtofr.c] Updated comment about GCC bug 86554: now fixed in +the GCC trunk. +(merged changeset r13385 from the trunk) +------------------------------------------------------------------------ +r13384 | vlefevre | 2019-01-07 16:11:57 +0000 (Mon, 07 Jan 2019) | 3 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/Makefile.am + +[tests/Makefile.am] Replaced "env -u DISPLAY" by "env DISPLAY=''" as +the -u option is not supported by NetBSD. +(merged changeset r13383 from the trunk) +------------------------------------------------------------------------ +r13382 | vlefevre | 2019-01-07 15:22:38 +0000 (Mon, 07 Jan 2019) | 1 line +Changed paths: + M /branches/4.0/ChangeLog + +ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC0 svn log -rHEAD:0 -v". +------------------------------------------------------------------------ +r13381 | vlefevre | 2019-01-07 15:17:51 +0000 (Mon, 07 Jan 2019) | 4 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/COPYING + M /branches/4.0/COPYING.LESSER + +Updated files: + * COPYING from https://www.gnu.org/licenses/gpl-3.0.txt + * COPYING.LESSER from https://www.gnu.org/licenses/lgpl-3.0.txt +These are URL updates and cosmetic changes. +------------------------------------------------------------------------ +r13379 | vlefevre | 2019-01-07 14:32:20 +0000 (Mon, 07 Jan 2019) | 4 lines +Changed paths: + M /branches/4.0/ChangeLog + +ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC0 svn log -rHEAD:0 -v". +Note: For r5400, this changes an incorrect update done via r13373 back +to the old log message, as the URL in this log message here describes +a change in one of the files. +------------------------------------------------------------------------ +r13377 | vlefevre | 2019-01-07 14:06:05 +0000 (Mon, 07 Jan 2019) | 2 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/doc/README.dev + +[doc/README.dev] Updated some URL's (http → https). +(merged changeset r13376 from the trunk) +------------------------------------------------------------------------ +r13375 | vlefevre | 2019-01-07 13:57:16 +0000 (Mon, 07 Jan 2019) | 1 line +Changed paths: + M /branches/4.0/doc/texinfo.tex + +[doc/texinfo.tex] Update to 2018-02-12.17 with "autoreconf -i -f". +------------------------------------------------------------------------ +r13373 | vlefevre | 2019-01-07 13:53:20 +0000 (Mon, 07 Jan 2019) | 3 lines +Changed paths: + M /branches/4.0/BUGS + M /branches/4.0/COPYING + M /branches/4.0/ChangeLog + M /branches/4.0/INSTALL + M /branches/4.0/NEWS + M /branches/4.0/README + M /branches/4.0/TODO + M /branches/4.0/acinclude.m4 + M /branches/4.0/configure.ac + M /branches/4.0/doc/FAQ.html + M /branches/4.0/doc/README.dev + M /branches/4.0/doc/faq.xsl + M /branches/4.0/doc/fdl.texi + M /branches/4.0/examples/can_round.c + M /branches/4.0/examples/divworst.c + M /branches/4.0/examples/rndo-add.c + M /branches/4.0/examples/sample.c + M /branches/4.0/examples/version.c + M /branches/4.0/src/abort_prec_max.c + M /branches/4.0/src/acos.c + M /branches/4.0/src/acosh.c + M /branches/4.0/src/add.c + M /branches/4.0/src/add1.c + M /branches/4.0/src/add1sp.c + M /branches/4.0/src/add_d.c + M /branches/4.0/src/add_ui.c + M /branches/4.0/src/agm.c + M /branches/4.0/src/ai.c + M /branches/4.0/src/amd/amdfam10/mparam.h + M /branches/4.0/src/amd/athlon/mparam.h + M /branches/4.0/src/amd/k8/mparam.h + M /branches/4.0/src/arm/mparam.h + M /branches/4.0/src/asin.c + M /branches/4.0/src/asinh.c + M /branches/4.0/src/atan.c + M /branches/4.0/src/atan2.c + M /branches/4.0/src/atanh.c + M /branches/4.0/src/bernoulli.c + M /branches/4.0/src/beta.c + M /branches/4.0/src/buildopt.c + M /branches/4.0/src/cache.c + M /branches/4.0/src/cbrt.c + M /branches/4.0/src/check.c + M /branches/4.0/src/clear.c + M /branches/4.0/src/clears.c + M /branches/4.0/src/cmp.c + M /branches/4.0/src/cmp2.c + M /branches/4.0/src/cmp_abs.c + M /branches/4.0/src/cmp_d.c + M /branches/4.0/src/cmp_ld.c + M /branches/4.0/src/cmp_si.c + M /branches/4.0/src/cmp_ui.c + M /branches/4.0/src/comparisons.c + M /branches/4.0/src/const_catalan.c + M /branches/4.0/src/const_euler.c + M /branches/4.0/src/const_log2.c + M /branches/4.0/src/const_pi.c + M /branches/4.0/src/constant.c + M /branches/4.0/src/copysign.c + M /branches/4.0/src/cos.c + M /branches/4.0/src/cosh.c + M /branches/4.0/src/cot.c + M /branches/4.0/src/coth.c + M /branches/4.0/src/csc.c + M /branches/4.0/src/csch.c + M /branches/4.0/src/d_div.c + M /branches/4.0/src/d_sub.c + M /branches/4.0/src/digamma.c + M /branches/4.0/src/dim.c + M /branches/4.0/src/div.c + M /branches/4.0/src/div_2exp.c + M /branches/4.0/src/div_2si.c + M /branches/4.0/src/div_2ui.c + M /branches/4.0/src/div_d.c + M /branches/4.0/src/div_ui.c + M /branches/4.0/src/dump.c + M /branches/4.0/src/eint.c + M /branches/4.0/src/eq.c + M /branches/4.0/src/erandom.c + M /branches/4.0/src/erf.c + M /branches/4.0/src/erfc.c + M /branches/4.0/src/exceptions.c + M /branches/4.0/src/exp.c + M /branches/4.0/src/exp10.c + M /branches/4.0/src/exp2.c + M /branches/4.0/src/exp3.c + M /branches/4.0/src/exp_2.c + M /branches/4.0/src/expm1.c + M /branches/4.0/src/extract.c + M /branches/4.0/src/factorial.c + M /branches/4.0/src/fits_intmax.c + M /branches/4.0/src/fits_s.h + M /branches/4.0/src/fits_sint.c + M /branches/4.0/src/fits_slong.c + M /branches/4.0/src/fits_sshort.c + M /branches/4.0/src/fits_u.h + M /branches/4.0/src/fits_uint.c + M /branches/4.0/src/fits_uintmax.c + M /branches/4.0/src/fits_ulong.c + M /branches/4.0/src/fits_ushort.c + M /branches/4.0/src/fma.c + M /branches/4.0/src/fmma.c + M /branches/4.0/src/fms.c + M /branches/4.0/src/fpif.c + M /branches/4.0/src/frac.c + M /branches/4.0/src/free_cache.c + M /branches/4.0/src/frexp.c + M /branches/4.0/src/gamma.c + M /branches/4.0/src/gamma_inc.c + M /branches/4.0/src/gammaonethird.c + M /branches/4.0/src/gen_inverse.h + M /branches/4.0/src/generic/coverage/mparam.h + M /branches/4.0/src/generic/mparam.h + M /branches/4.0/src/get_d.c + M /branches/4.0/src/get_d64.c + M /branches/4.0/src/get_exp.c + M /branches/4.0/src/get_f.c + M /branches/4.0/src/get_float128.c + M /branches/4.0/src/get_flt.c + M /branches/4.0/src/get_ld.c + M /branches/4.0/src/get_q.c + M /branches/4.0/src/get_si.c + M /branches/4.0/src/get_sj.c + M /branches/4.0/src/get_str.c + M /branches/4.0/src/get_ui.c + M /branches/4.0/src/get_uj.c + M /branches/4.0/src/get_z.c + M /branches/4.0/src/get_z_exp.c + M /branches/4.0/src/gmp_op.c + M /branches/4.0/src/grandom.c + M /branches/4.0/src/hppa/mparam.h + M /branches/4.0/src/hypot.c + M /branches/4.0/src/ia64/mparam.h + M /branches/4.0/src/ieee_floats.h + M /branches/4.0/src/init.c + M /branches/4.0/src/init2.c + M /branches/4.0/src/inits.c + M /branches/4.0/src/inits2.c + M /branches/4.0/src/inp_str.c + M /branches/4.0/src/int_ceil_log2.c + M /branches/4.0/src/invert_limb.h + M /branches/4.0/src/invsqrt_limb.h + M /branches/4.0/src/isinf.c + M /branches/4.0/src/isinteger.c + M /branches/4.0/src/isnan.c + M /branches/4.0/src/isnum.c + M /branches/4.0/src/isqrt.c + M /branches/4.0/src/isregular.c + M /branches/4.0/src/iszero.c + M /branches/4.0/src/jn.c + M /branches/4.0/src/jyn_asympt.c + M /branches/4.0/src/li2.c + M /branches/4.0/src/lngamma.c + M /branches/4.0/src/log.c + M /branches/4.0/src/log10.c + M /branches/4.0/src/log1p.c + M /branches/4.0/src/log2.c + M /branches/4.0/src/log_ui.c + M /branches/4.0/src/logging.c + M /branches/4.0/src/min_prec.c + M /branches/4.0/src/minmax.c + M /branches/4.0/src/mips/mparam.h + M /branches/4.0/src/modf.c + M /branches/4.0/src/mp_clz_tab.c + M /branches/4.0/src/mparam_h.in + M /branches/4.0/src/mpf2mpfr.h + M /branches/4.0/src/mpfr-cvers.h + M /branches/4.0/src/mpfr-gmp.c + M /branches/4.0/src/mpfr-gmp.h + M /branches/4.0/src/mpfr-impl.h + M /branches/4.0/src/mpfr-intmax.h + M /branches/4.0/src/mpfr-longlong.h + M /branches/4.0/src/mpfr-mini-gmp.c + M /branches/4.0/src/mpfr-mini-gmp.h + M /branches/4.0/src/mpfr-sassert.h + M /branches/4.0/src/mpfr-thread.h + M /branches/4.0/src/mpfr.h + M /branches/4.0/src/mpn_exp.c + M /branches/4.0/src/mul.c + M /branches/4.0/src/mul_2exp.c + M /branches/4.0/src/mul_2si.c + M /branches/4.0/src/mul_2ui.c + M /branches/4.0/src/mul_d.c + M /branches/4.0/src/mul_ui.c + M /branches/4.0/src/mulders.c + M /branches/4.0/src/neg.c + M /branches/4.0/src/next.c + M /branches/4.0/src/nrandom.c + M /branches/4.0/src/odd_p.c + M /branches/4.0/src/out_str.c + M /branches/4.0/src/pool.c + M /branches/4.0/src/pow.c + M /branches/4.0/src/pow_si.c + M /branches/4.0/src/pow_ui.c + M /branches/4.0/src/pow_z.c + M /branches/4.0/src/powerof2.c + M /branches/4.0/src/powerpc32/mparam.h + M /branches/4.0/src/powerpc64/mparam.h + M /branches/4.0/src/print_raw.c + M /branches/4.0/src/print_rnd_mode.c + M /branches/4.0/src/printf.c + M /branches/4.0/src/random_deviate.c + M /branches/4.0/src/random_deviate.h + M /branches/4.0/src/rec_sqrt.c + M /branches/4.0/src/reldiff.c + M /branches/4.0/src/rem1.c + M /branches/4.0/src/rint.c + M /branches/4.0/src/rndna.c + M /branches/4.0/src/root.c + M /branches/4.0/src/round_near_x.c + M /branches/4.0/src/round_p.c + M /branches/4.0/src/round_prec.c + M /branches/4.0/src/round_raw_generic.c + M /branches/4.0/src/scale2.c + M /branches/4.0/src/sec.c + M /branches/4.0/src/sech.c + M /branches/4.0/src/set.c + M /branches/4.0/src/set_d.c + M /branches/4.0/src/set_d64.c + M /branches/4.0/src/set_dfl_prec.c + M /branches/4.0/src/set_exp.c + M /branches/4.0/src/set_f.c + M /branches/4.0/src/set_float128.c + M /branches/4.0/src/set_flt.c + M /branches/4.0/src/set_inf.c + M /branches/4.0/src/set_ld.c + M /branches/4.0/src/set_nan.c + M /branches/4.0/src/set_prc_raw.c + M /branches/4.0/src/set_prec.c + M /branches/4.0/src/set_q.c + M /branches/4.0/src/set_rnd.c + M /branches/4.0/src/set_si.c + M /branches/4.0/src/set_si_2exp.c + M /branches/4.0/src/set_sj.c + M /branches/4.0/src/set_str.c + M /branches/4.0/src/set_str_raw.c + M /branches/4.0/src/set_ui.c + M /branches/4.0/src/set_ui_2exp.c + M /branches/4.0/src/set_uj.c + M /branches/4.0/src/set_z.c + M /branches/4.0/src/set_z_exp.c + M /branches/4.0/src/set_zero.c + M /branches/4.0/src/setmax.c + M /branches/4.0/src/setmin.c + M /branches/4.0/src/setsign.c + M /branches/4.0/src/sgn.c + M /branches/4.0/src/si_op.c + M /branches/4.0/src/signbit.c + M /branches/4.0/src/sin.c + M /branches/4.0/src/sin_cos.c + M /branches/4.0/src/sinh.c + M /branches/4.0/src/sinh_cosh.c + M /branches/4.0/src/sparc64/mparam.h + M /branches/4.0/src/sqr.c + M /branches/4.0/src/sqrt.c + M /branches/4.0/src/sqrt_ui.c + M /branches/4.0/src/stack_interface.c + M /branches/4.0/src/strtofr.c + M /branches/4.0/src/sub.c + M /branches/4.0/src/sub1.c + M /branches/4.0/src/sub1sp.c + M /branches/4.0/src/sub_d.c + M /branches/4.0/src/sub_ui.c + M /branches/4.0/src/subnormal.c + M /branches/4.0/src/sum.c + M /branches/4.0/src/swap.c + M /branches/4.0/src/tan.c + M /branches/4.0/src/tanh.c + M /branches/4.0/src/ubf.c + M /branches/4.0/src/uceil_exp2.c + M /branches/4.0/src/uceil_log2.c + M /branches/4.0/src/ufloor_log2.c + M /branches/4.0/src/ui_div.c + M /branches/4.0/src/ui_pow.c + M /branches/4.0/src/ui_pow_ui.c + M /branches/4.0/src/ui_sub.c + M /branches/4.0/src/urandom.c + M /branches/4.0/src/urandomb.c + M /branches/4.0/src/vasprintf.c + M /branches/4.0/src/version.c + M /branches/4.0/src/volatile.c + M /branches/4.0/src/x86/core2/mparam.h + M /branches/4.0/src/x86/mparam.h + M /branches/4.0/src/x86_64/core2/mparam.h + M /branches/4.0/src/x86_64/corei5/mparam.h + M /branches/4.0/src/x86_64/pentium4/mparam.h + M /branches/4.0/src/yn.c + M /branches/4.0/src/zeta.c + M /branches/4.0/src/zeta_ui.c + M /branches/4.0/tests/Makefile.am + M /branches/4.0/tests/cmp_str.c + M /branches/4.0/tests/data/digamma + M /branches/4.0/tests/data/li2 + M /branches/4.0/tests/memory.c + M /branches/4.0/tests/mpf_compat.c + M /branches/4.0/tests/mpf_compat.h + M /branches/4.0/tests/mpfr-test.h + M /branches/4.0/tests/mpfr_compat.c + M /branches/4.0/tests/random2.c + M /branches/4.0/tests/reuse.c + M /branches/4.0/tests/rnd_mode.c + M /branches/4.0/tests/tabort_defalloc1.c + M /branches/4.0/tests/tabort_defalloc2.c + M /branches/4.0/tests/tabort_prec_max.c + M /branches/4.0/tests/tabs.c + M /branches/4.0/tests/tacos.c + M /branches/4.0/tests/tacosh.c + M /branches/4.0/tests/tadd.c + M /branches/4.0/tests/tadd1sp.c + M /branches/4.0/tests/tadd_d.c + M /branches/4.0/tests/tadd_ui.c + M /branches/4.0/tests/tagm.c + M /branches/4.0/tests/tai.c + M /branches/4.0/tests/talloc-cache.c + M /branches/4.0/tests/talloc.c + M /branches/4.0/tests/tasin.c + M /branches/4.0/tests/tasinh.c + M /branches/4.0/tests/tassert.c + M /branches/4.0/tests/tatan.c + M /branches/4.0/tests/tatanh.c + M /branches/4.0/tests/taway.c + M /branches/4.0/tests/tbeta.c + M /branches/4.0/tests/tbuildopt.c + M /branches/4.0/tests/tcan_round.c + M /branches/4.0/tests/tcbrt.c + M /branches/4.0/tests/tcheck.c + M /branches/4.0/tests/tcmp.c + M /branches/4.0/tests/tcmp2.c + M /branches/4.0/tests/tcmp_d.c + M /branches/4.0/tests/tcmp_ld.c + M /branches/4.0/tests/tcmp_ui.c + M /branches/4.0/tests/tcmpabs.c + M /branches/4.0/tests/tcomparisons.c + M /branches/4.0/tests/tconst_catalan.c + M /branches/4.0/tests/tconst_euler.c + M /branches/4.0/tests/tconst_log2.c + M /branches/4.0/tests/tconst_pi.c + M /branches/4.0/tests/tcopysign.c + M /branches/4.0/tests/tcos.c + M /branches/4.0/tests/tcosh.c + M /branches/4.0/tests/tcot.c + M /branches/4.0/tests/tcoth.c + M /branches/4.0/tests/tcsc.c + M /branches/4.0/tests/tcsch.c + M /branches/4.0/tests/td_div.c + M /branches/4.0/tests/td_sub.c + M /branches/4.0/tests/tdigamma.c + M /branches/4.0/tests/tdim.c + M /branches/4.0/tests/tdiv.c + M /branches/4.0/tests/tdiv_d.c + M /branches/4.0/tests/tdiv_ui.c + M /branches/4.0/tests/teint.c + M /branches/4.0/tests/teq.c + M /branches/4.0/tests/terandom.c + M /branches/4.0/tests/terandom_chisq.c + M /branches/4.0/tests/terf.c + M /branches/4.0/tests/tests.c + M /branches/4.0/tests/texceptions.c + M /branches/4.0/tests/texp.c + M /branches/4.0/tests/texp10.c + M /branches/4.0/tests/texp2.c + M /branches/4.0/tests/texpm1.c + M /branches/4.0/tests/tfactorial.c + M /branches/4.0/tests/tfits.c + M /branches/4.0/tests/tfma.c + M /branches/4.0/tests/tfmma.c + M /branches/4.0/tests/tfmod.c + M /branches/4.0/tests/tfms.c + M /branches/4.0/tests/tfpif.c + M /branches/4.0/tests/tfprintf.c + M /branches/4.0/tests/tfrac.c + M /branches/4.0/tests/tfrexp.c + M /branches/4.0/tests/tgamma.c + M /branches/4.0/tests/tgamma_inc.c + M /branches/4.0/tests/tgeneric.c + M /branches/4.0/tests/tgeneric_ui.c + M /branches/4.0/tests/tget_d.c + M /branches/4.0/tests/tget_d_2exp.c + M /branches/4.0/tests/tget_f.c + M /branches/4.0/tests/tget_flt.c + M /branches/4.0/tests/tget_ld_2exp.c + M /branches/4.0/tests/tget_q.c + M /branches/4.0/tests/tget_set_d64.c + M /branches/4.0/tests/tget_sj.c + M /branches/4.0/tests/tget_str.c + M /branches/4.0/tests/tget_z.c + M /branches/4.0/tests/tgmpop.c + M /branches/4.0/tests/tgrandom.c + M /branches/4.0/tests/thyperbolic.c + M /branches/4.0/tests/thypot.c + M /branches/4.0/tests/tinits.c + M /branches/4.0/tests/tinp_str.c + M /branches/4.0/tests/tinternals.c + M /branches/4.0/tests/tisnan.c + M /branches/4.0/tests/tisqrt.c + M /branches/4.0/tests/tj0.c + M /branches/4.0/tests/tj1.c + M /branches/4.0/tests/tjn.c + M /branches/4.0/tests/tl2b.c + M /branches/4.0/tests/tlgamma.c + M /branches/4.0/tests/tli2.c + M /branches/4.0/tests/tlngamma.c + M /branches/4.0/tests/tlog.c + M /branches/4.0/tests/tlog10.c + M /branches/4.0/tests/tlog1p.c + M /branches/4.0/tests/tlog2.c + M /branches/4.0/tests/tlog_ui.c + M /branches/4.0/tests/tmin_prec.c + M /branches/4.0/tests/tminmax.c + M /branches/4.0/tests/tmodf.c + M /branches/4.0/tests/tmul.c + M /branches/4.0/tests/tmul_2exp.c + M /branches/4.0/tests/tmul_d.c + M /branches/4.0/tests/tmul_ui.c + M /branches/4.0/tests/tnext.c + M /branches/4.0/tests/tnrandom.c + M /branches/4.0/tests/tnrandom_chisq.c + M /branches/4.0/tests/tout_str.c + M /branches/4.0/tests/toutimpl.c + M /branches/4.0/tests/tpow.c + M /branches/4.0/tests/tpow3.c + M /branches/4.0/tests/tpow_all.c + M /branches/4.0/tests/tpow_z.c + M /branches/4.0/tests/tprintf.c + M /branches/4.0/tests/trandom.c + M /branches/4.0/tests/trandom_deviate.c + M /branches/4.0/tests/trec_sqrt.c + M /branches/4.0/tests/tremquo.c + M /branches/4.0/tests/trint.c + M /branches/4.0/tests/trndna.c + M /branches/4.0/tests/troot.c + M /branches/4.0/tests/trootn_ui.c + M /branches/4.0/tests/tround_prec.c + M /branches/4.0/tests/tsec.c + M /branches/4.0/tests/tsech.c + M /branches/4.0/tests/tset.c + M /branches/4.0/tests/tset_d.c + M /branches/4.0/tests/tset_exp.c + M /branches/4.0/tests/tset_f.c + M /branches/4.0/tests/tset_float128.c + M /branches/4.0/tests/tset_ld.c + M /branches/4.0/tests/tset_q.c + M /branches/4.0/tests/tset_si.c + M /branches/4.0/tests/tset_sj.c + M /branches/4.0/tests/tset_str.c + M /branches/4.0/tests/tset_z.c + M /branches/4.0/tests/tset_z_exp.c + M /branches/4.0/tests/tsgn.c + M /branches/4.0/tests/tsi_op.c + M /branches/4.0/tests/tsin.c + M /branches/4.0/tests/tsin_cos.c + M /branches/4.0/tests/tsinh.c + M /branches/4.0/tests/tsinh_cosh.c + M /branches/4.0/tests/tsprintf.c + M /branches/4.0/tests/tsqr.c + M /branches/4.0/tests/tsqrt.c + M /branches/4.0/tests/tsqrt_ui.c + M /branches/4.0/tests/tstckintc.c + M /branches/4.0/tests/tstdint.c + M /branches/4.0/tests/tstrtofr.c + M /branches/4.0/tests/tsub.c + M /branches/4.0/tests/tsub1sp.c + M /branches/4.0/tests/tsub_d.c + M /branches/4.0/tests/tsub_ui.c + M /branches/4.0/tests/tsubnormal.c + M /branches/4.0/tests/tsum.c + M /branches/4.0/tests/tswap.c + M /branches/4.0/tests/ttan.c + M /branches/4.0/tests/ttanh.c + M /branches/4.0/tests/ttrunc.c + M /branches/4.0/tests/tui_div.c + M /branches/4.0/tests/tui_pow.c + M /branches/4.0/tests/tui_sub.c + M /branches/4.0/tests/turandom.c + M /branches/4.0/tests/tvalist.c + M /branches/4.0/tests/tversion.c + M /branches/4.0/tests/ty0.c + M /branches/4.0/tests/ty1.c + M /branches/4.0/tests/tyn.c + M /branches/4.0/tests/tzeta.c + M /branches/4.0/tests/tzeta_ui.c + M /branches/4.0/tools/bench/benchtime.h + M /branches/4.0/tools/bench/mpfrbench.c + M /branches/4.0/tools/get_patches.sh + M /branches/4.0/tools/mbench/generate.c + M /branches/4.0/tools/mbench/mfv5-arprec.cc + M /branches/4.0/tools/mbench/mfv5-cln.cc + M /branches/4.0/tools/mbench/mfv5-crlibm.cc + M /branches/4.0/tools/mbench/mfv5-libc.cc + M /branches/4.0/tools/mbench/mfv5-lidia.cc + M /branches/4.0/tools/mbench/mfv5-mpf.cc + M /branches/4.0/tools/mbench/mfv5-mpfr.cc + M /branches/4.0/tools/mbench/mfv5-ntl.cc + M /branches/4.0/tools/mbench/mfv5-pari.cc + M /branches/4.0/tools/mbench/mfv5-void.cc + M /branches/4.0/tools/mbench/mfv5.cc + M /branches/4.0/tools/mbench/mfv5.h + M /branches/4.0/tools/mbench/mpfr-gfx.c + M /branches/4.0/tools/mbench/mpfr-v4.c + M /branches/4.0/tools/mbench/mpfr-v6.c + M /branches/4.0/tools/mbench/timp.h + M /branches/4.0/tools/timings-mpfr.c + M /branches/4.0/tune/bidimensional_sample.c + M /branches/4.0/tune/speed.c + M /branches/4.0/tune/tuneup.c -Updated version to 3.1.4. +Updated the www.gnu.org URL's (http → https) on all the files with: + perl -pi -e 's,http://www.gnu.org/,https://www.gnu.org/,g' **/*(.) +under zsh. ------------------------------------------------------------------------ -r10197 | vlefevre | 2016-03-04 14:08:33 +0000 (Fri, 04 Mar 2016) | 2 lines +r13371 | vlefevre | 2019-01-07 13:35:33 +0000 (Mon, 07 Jan 2019) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/INSTALL + M /branches/4.0/src/Makefile.am -[INSTALL] Some improvement about MinGW and __USE_MINGW_ANSI_STDIO. -(merged changeset r10196 from the trunk) +[src/Makefile.am] Updated libmpfr_la_LDFLAGS for MPFR 4.0.2. ------------------------------------------------------------------------ -r10184 | vlefevre | 2016-03-02 15:17:53 +0000 (Wed, 02 Mar 2016) | 2 lines +r13370 | vlefevre | 2019-01-07 13:22:53 +0000 (Mon, 07 Jan 2019) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tversion.c - -[tests/tversion.c] Improved output of compiler information. -(merge changesets r9695-9696,10170,10181-10182 from the trunk) + M /branches/4.0/VERSION + M /branches/4.0/configure.ac + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/src/mpfr.h + M /branches/4.0/src/version.c + +Updated version to 4.0.2-rc1. +------------------------------------------------------------------------ +r13366 | vlefevre | 2019-01-07 09:39:52 +0000 (Mon, 07 Jan 2019) | 14 lines +Changed paths: + M /branches/4.0/src/strtofr.c + M /branches/4.0/tests/tstrtofr.c + +[src/strtofr.c] Fixed various issues. In particular, the error analysis + with associated code was incorrect (due to the bad correction r8384 + of a past bug, later really fixed in r11056). Also adapted the code + to work with small-size limbs. +[tests/tstrtofr.c] Added tests, including random tests. In particular, + some part of the code was tested only on hard-to-round cases, meaning + that some potential issues could not be detected (intermediate results + were thrown out due to the next Ziv iteration). Moreover, in case of + failure of some particular test, output the probable cause of this + failure (GCC bug 86554) with a workaround. +(merged changesets associated with these files r12566-13306,13364-13365 +from the trunk) +Note: There may still remain issues with mpfr_strtofr, to be checked +later. At least, the tests do not fail. ------------------------------------------------------------------------ -r10176 | vlefevre | 2016-03-02 00:50:40 +0000 (Wed, 02 Mar 2016) | 3 lines +r13363 | vlefevre | 2019-01-04 12:11:10 +0000 (Fri, 04 Jan 2019) | 3 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src - M /branches/3.1/src/get_flt.c + M /branches/4.0/src/mpfr-impl.h -[src/get_flt.c] FIXME: The code assumes the IEEE-754 binary32 format -with subnormal support. -(merged changeset r10175 from the trunk) +[src/mpfr-impl.h] Added a comment with a warning concerning the meaning +of MPFR_EXP_FSPEC (corresponding to the merge of mpfr-impl.h r13299 +from the trunk; the other part of this commit with be merged later). ------------------------------------------------------------------------ -r10174 | vlefevre | 2016-03-02 00:32:46 +0000 (Wed, 02 Mar 2016) | 3 lines +r13362 | vlefevre | 2019-01-01 21:18:11 +0000 (Tue, 01 Jan 2019) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tget_flt.c + M /branches/4.0/doc/mpfr.texi -[tests/tget_flt.c] Do tests that may involve subnormals only -if HAVE_DENORMS is defined. -(merged changeset r10173 from the trunk) +[doc/mpfr.texi] Updated the month. ------------------------------------------------------------------------ -r10167 | vlefevre | 2016-03-01 15:44:58 +0000 (Tue, 01 Mar 2016) | 2 lines +r13360 | vlefevre | 2019-01-01 21:02:47 +0000 (Tue, 01 Jan 2019) | 4 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tget_flt.c + M /branches/4.0/BUGS + M /branches/4.0/INSTALL + M /branches/4.0/Makefile.am + M /branches/4.0/NEWS + M /branches/4.0/README + M /branches/4.0/TODO + M /branches/4.0/acinclude.m4 + M /branches/4.0/configure.ac + M /branches/4.0/doc/FAQ.html + M /branches/4.0/doc/Makefile.am + M /branches/4.0/doc/README.dev + M /branches/4.0/doc/check-typography + M /branches/4.0/doc/faq.xsl + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/examples/can_round.c + M /branches/4.0/examples/divworst.c + M /branches/4.0/examples/rndo-add.c + M /branches/4.0/examples/sample.c + M /branches/4.0/examples/version.c + M /branches/4.0/src/Makefile.am + M /branches/4.0/src/abort_prec_max.c + M /branches/4.0/src/acos.c + M /branches/4.0/src/acosh.c + M /branches/4.0/src/add.c + M /branches/4.0/src/add1.c + M /branches/4.0/src/add1sp.c + M /branches/4.0/src/add_d.c + M /branches/4.0/src/add_ui.c + M /branches/4.0/src/agm.c + M /branches/4.0/src/ai.c + M /branches/4.0/src/amd/amdfam10/mparam.h + M /branches/4.0/src/amd/athlon/mparam.h + M /branches/4.0/src/amd/k8/mparam.h + M /branches/4.0/src/arm/mparam.h + M /branches/4.0/src/asin.c + M /branches/4.0/src/asinh.c + M /branches/4.0/src/atan.c + M /branches/4.0/src/atan2.c + M /branches/4.0/src/atanh.c + M /branches/4.0/src/bernoulli.c + M /branches/4.0/src/beta.c + M /branches/4.0/src/buildopt.c + M /branches/4.0/src/cache.c + M /branches/4.0/src/cbrt.c + M /branches/4.0/src/check.c + M /branches/4.0/src/clear.c + M /branches/4.0/src/clears.c + M /branches/4.0/src/cmp.c + M /branches/4.0/src/cmp2.c + M /branches/4.0/src/cmp_abs.c + M /branches/4.0/src/cmp_d.c + M /branches/4.0/src/cmp_ld.c + M /branches/4.0/src/cmp_si.c + M /branches/4.0/src/cmp_ui.c + M /branches/4.0/src/comparisons.c + M /branches/4.0/src/const_catalan.c + M /branches/4.0/src/const_euler.c + M /branches/4.0/src/const_log2.c + M /branches/4.0/src/const_pi.c + M /branches/4.0/src/constant.c + M /branches/4.0/src/copysign.c + M /branches/4.0/src/cos.c + M /branches/4.0/src/cosh.c + M /branches/4.0/src/cot.c + M /branches/4.0/src/coth.c + M /branches/4.0/src/csc.c + M /branches/4.0/src/csch.c + M /branches/4.0/src/d_div.c + M /branches/4.0/src/d_sub.c + M /branches/4.0/src/digamma.c + M /branches/4.0/src/dim.c + M /branches/4.0/src/div.c + M /branches/4.0/src/div_2exp.c + M /branches/4.0/src/div_2si.c + M /branches/4.0/src/div_2ui.c + M /branches/4.0/src/div_d.c + M /branches/4.0/src/div_ui.c + M /branches/4.0/src/dump.c + M /branches/4.0/src/eint.c + M /branches/4.0/src/eq.c + M /branches/4.0/src/erandom.c + M /branches/4.0/src/erf.c + M /branches/4.0/src/erfc.c + M /branches/4.0/src/exceptions.c + M /branches/4.0/src/exp.c + M /branches/4.0/src/exp10.c + M /branches/4.0/src/exp2.c + M /branches/4.0/src/exp3.c + M /branches/4.0/src/exp_2.c + M /branches/4.0/src/expm1.c + M /branches/4.0/src/extract.c + M /branches/4.0/src/factorial.c + M /branches/4.0/src/fits_intmax.c + M /branches/4.0/src/fits_s.h + M /branches/4.0/src/fits_sint.c + M /branches/4.0/src/fits_slong.c + M /branches/4.0/src/fits_sshort.c + M /branches/4.0/src/fits_u.h + M /branches/4.0/src/fits_uint.c + M /branches/4.0/src/fits_uintmax.c + M /branches/4.0/src/fits_ulong.c + M /branches/4.0/src/fits_ushort.c + M /branches/4.0/src/fma.c + M /branches/4.0/src/fmma.c + M /branches/4.0/src/fms.c + M /branches/4.0/src/fpif.c + M /branches/4.0/src/frac.c + M /branches/4.0/src/free_cache.c + M /branches/4.0/src/frexp.c + M /branches/4.0/src/gamma.c + M /branches/4.0/src/gamma_inc.c + M /branches/4.0/src/gammaonethird.c + M /branches/4.0/src/gen_inverse.h + M /branches/4.0/src/generic/coverage/mparam.h + M /branches/4.0/src/generic/mparam.h + M /branches/4.0/src/get_d.c + M /branches/4.0/src/get_d64.c + M /branches/4.0/src/get_exp.c + M /branches/4.0/src/get_f.c + M /branches/4.0/src/get_float128.c + M /branches/4.0/src/get_flt.c + M /branches/4.0/src/get_ld.c + M /branches/4.0/src/get_q.c + M /branches/4.0/src/get_si.c + M /branches/4.0/src/get_sj.c + M /branches/4.0/src/get_str.c + M /branches/4.0/src/get_ui.c + M /branches/4.0/src/get_uj.c + M /branches/4.0/src/get_z.c + M /branches/4.0/src/get_z_exp.c + M /branches/4.0/src/gmp_op.c + M /branches/4.0/src/grandom.c + M /branches/4.0/src/hppa/mparam.h + M /branches/4.0/src/hypot.c + M /branches/4.0/src/ia64/mparam.h + M /branches/4.0/src/ieee_floats.h + M /branches/4.0/src/init.c + M /branches/4.0/src/init2.c + M /branches/4.0/src/inits.c + M /branches/4.0/src/inits2.c + M /branches/4.0/src/inp_str.c + M /branches/4.0/src/int_ceil_log2.c + M /branches/4.0/src/invert_limb.h + M /branches/4.0/src/invsqrt_limb.h + M /branches/4.0/src/isinf.c + M /branches/4.0/src/isinteger.c + M /branches/4.0/src/isnan.c + M /branches/4.0/src/isnum.c + M /branches/4.0/src/isqrt.c + M /branches/4.0/src/isregular.c + M /branches/4.0/src/iszero.c + M /branches/4.0/src/jn.c + M /branches/4.0/src/jyn_asympt.c + M /branches/4.0/src/li2.c + M /branches/4.0/src/lngamma.c + M /branches/4.0/src/log.c + M /branches/4.0/src/log10.c + M /branches/4.0/src/log1p.c + M /branches/4.0/src/log2.c + M /branches/4.0/src/log_ui.c + M /branches/4.0/src/logging.c + M /branches/4.0/src/min_prec.c + M /branches/4.0/src/minmax.c + M /branches/4.0/src/mips/mparam.h + M /branches/4.0/src/modf.c + M /branches/4.0/src/mp_clz_tab.c + M /branches/4.0/src/mparam_h.in + M /branches/4.0/src/mpf2mpfr.h + M /branches/4.0/src/mpfr-cvers.h + M /branches/4.0/src/mpfr-gmp.c + M /branches/4.0/src/mpfr-gmp.h + M /branches/4.0/src/mpfr-impl.h + M /branches/4.0/src/mpfr-intmax.h + M /branches/4.0/src/mpfr-longlong.h + M /branches/4.0/src/mpfr-mini-gmp.c + M /branches/4.0/src/mpfr-mini-gmp.h + M /branches/4.0/src/mpfr-sassert.h + M /branches/4.0/src/mpfr-thread.h + M /branches/4.0/src/mpfr.h + M /branches/4.0/src/mpn_exp.c + M /branches/4.0/src/mul.c + M /branches/4.0/src/mul_2exp.c + M /branches/4.0/src/mul_2si.c + M /branches/4.0/src/mul_2ui.c + M /branches/4.0/src/mul_d.c + M /branches/4.0/src/mul_ui.c + M /branches/4.0/src/mulders.c + M /branches/4.0/src/neg.c + M /branches/4.0/src/next.c + M /branches/4.0/src/nrandom.c + M /branches/4.0/src/odd_p.c + M /branches/4.0/src/out_str.c + M /branches/4.0/src/pool.c + M /branches/4.0/src/pow.c + M /branches/4.0/src/pow_si.c + M /branches/4.0/src/pow_ui.c + M /branches/4.0/src/pow_z.c + M /branches/4.0/src/powerof2.c + M /branches/4.0/src/powerpc32/mparam.h + M /branches/4.0/src/powerpc64/mparam.h + M /branches/4.0/src/print_raw.c + M /branches/4.0/src/print_rnd_mode.c + M /branches/4.0/src/printf.c + M /branches/4.0/src/random_deviate.c + M /branches/4.0/src/random_deviate.h + M /branches/4.0/src/rec_sqrt.c + M /branches/4.0/src/reldiff.c + M /branches/4.0/src/rem1.c + M /branches/4.0/src/rint.c + M /branches/4.0/src/rndna.c + M /branches/4.0/src/root.c + M /branches/4.0/src/round_near_x.c + M /branches/4.0/src/round_p.c + M /branches/4.0/src/round_prec.c + M /branches/4.0/src/round_raw_generic.c + M /branches/4.0/src/scale2.c + M /branches/4.0/src/sec.c + M /branches/4.0/src/sech.c + M /branches/4.0/src/set.c + M /branches/4.0/src/set_d.c + M /branches/4.0/src/set_d64.c + M /branches/4.0/src/set_dfl_prec.c + M /branches/4.0/src/set_exp.c + M /branches/4.0/src/set_f.c + M /branches/4.0/src/set_float128.c + M /branches/4.0/src/set_flt.c + M /branches/4.0/src/set_inf.c + M /branches/4.0/src/set_ld.c + M /branches/4.0/src/set_nan.c + M /branches/4.0/src/set_prc_raw.c + M /branches/4.0/src/set_prec.c + M /branches/4.0/src/set_q.c + M /branches/4.0/src/set_rnd.c + M /branches/4.0/src/set_si.c + M /branches/4.0/src/set_si_2exp.c + M /branches/4.0/src/set_sj.c + M /branches/4.0/src/set_str.c + M /branches/4.0/src/set_str_raw.c + M /branches/4.0/src/set_ui.c + M /branches/4.0/src/set_ui_2exp.c + M /branches/4.0/src/set_uj.c + M /branches/4.0/src/set_z.c + M /branches/4.0/src/set_z_exp.c + M /branches/4.0/src/set_zero.c + M /branches/4.0/src/setmax.c + M /branches/4.0/src/setmin.c + M /branches/4.0/src/setsign.c + M /branches/4.0/src/sgn.c + M /branches/4.0/src/si_op.c + M /branches/4.0/src/signbit.c + M /branches/4.0/src/sin.c + M /branches/4.0/src/sin_cos.c + M /branches/4.0/src/sinh.c + M /branches/4.0/src/sinh_cosh.c + M /branches/4.0/src/sparc64/mparam.h + M /branches/4.0/src/sqr.c + M /branches/4.0/src/sqrt.c + M /branches/4.0/src/sqrt_ui.c + M /branches/4.0/src/stack_interface.c + M /branches/4.0/src/strtofr.c + M /branches/4.0/src/sub.c + M /branches/4.0/src/sub1.c + M /branches/4.0/src/sub1sp.c + M /branches/4.0/src/sub_d.c + M /branches/4.0/src/sub_ui.c + M /branches/4.0/src/subnormal.c + M /branches/4.0/src/sum.c + M /branches/4.0/src/swap.c + M /branches/4.0/src/tan.c + M /branches/4.0/src/tanh.c + M /branches/4.0/src/ubf.c + M /branches/4.0/src/uceil_exp2.c + M /branches/4.0/src/uceil_log2.c + M /branches/4.0/src/ufloor_log2.c + M /branches/4.0/src/ui_div.c + M /branches/4.0/src/ui_pow.c + M /branches/4.0/src/ui_pow_ui.c + M /branches/4.0/src/ui_sub.c + M /branches/4.0/src/urandom.c + M /branches/4.0/src/urandomb.c + M /branches/4.0/src/vasprintf.c + M /branches/4.0/src/version.c + M /branches/4.0/src/volatile.c + M /branches/4.0/src/x86/core2/mparam.h + M /branches/4.0/src/x86/mparam.h + M /branches/4.0/src/x86_64/core2/mparam.h + M /branches/4.0/src/x86_64/corei5/mparam.h + M /branches/4.0/src/x86_64/pentium4/mparam.h + M /branches/4.0/src/yn.c + M /branches/4.0/src/zeta.c + M /branches/4.0/src/zeta_ui.c + M /branches/4.0/tests/Makefile.am + M /branches/4.0/tests/cmp_str.c + M /branches/4.0/tests/data/digamma + M /branches/4.0/tests/data/li2 + M /branches/4.0/tests/memory.c + M /branches/4.0/tests/mpf_compat.c + M /branches/4.0/tests/mpf_compat.h + M /branches/4.0/tests/mpfr-test.h + M /branches/4.0/tests/mpfr_compat.c + M /branches/4.0/tests/random2.c + M /branches/4.0/tests/reuse.c + M /branches/4.0/tests/rnd_mode.c + M /branches/4.0/tests/tabort_defalloc1.c + M /branches/4.0/tests/tabort_defalloc2.c + M /branches/4.0/tests/tabort_prec_max.c + M /branches/4.0/tests/tabs.c + M /branches/4.0/tests/tacos.c + M /branches/4.0/tests/tacosh.c + M /branches/4.0/tests/tadd.c + M /branches/4.0/tests/tadd1sp.c + M /branches/4.0/tests/tadd_d.c + M /branches/4.0/tests/tadd_ui.c + M /branches/4.0/tests/tagm.c + M /branches/4.0/tests/tai.c + M /branches/4.0/tests/talloc-cache.c + M /branches/4.0/tests/talloc.c + M /branches/4.0/tests/tasin.c + M /branches/4.0/tests/tasinh.c + M /branches/4.0/tests/tassert.c + M /branches/4.0/tests/tatan.c + M /branches/4.0/tests/tatanh.c + M /branches/4.0/tests/taway.c + M /branches/4.0/tests/tbeta.c + M /branches/4.0/tests/tbuildopt.c + M /branches/4.0/tests/tcan_round.c + M /branches/4.0/tests/tcbrt.c + M /branches/4.0/tests/tcheck.c + M /branches/4.0/tests/tcmp.c + M /branches/4.0/tests/tcmp2.c + M /branches/4.0/tests/tcmp_d.c + M /branches/4.0/tests/tcmp_ld.c + M /branches/4.0/tests/tcmp_ui.c + M /branches/4.0/tests/tcmpabs.c + M /branches/4.0/tests/tcomparisons.c + M /branches/4.0/tests/tconst_catalan.c + M /branches/4.0/tests/tconst_euler.c + M /branches/4.0/tests/tconst_log2.c + M /branches/4.0/tests/tconst_pi.c + M /branches/4.0/tests/tcopysign.c + M /branches/4.0/tests/tcos.c + M /branches/4.0/tests/tcosh.c + M /branches/4.0/tests/tcot.c + M /branches/4.0/tests/tcoth.c + M /branches/4.0/tests/tcsc.c + M /branches/4.0/tests/tcsch.c + M /branches/4.0/tests/td_div.c + M /branches/4.0/tests/td_sub.c + M /branches/4.0/tests/tdigamma.c + M /branches/4.0/tests/tdim.c + M /branches/4.0/tests/tdiv.c + M /branches/4.0/tests/tdiv_d.c + M /branches/4.0/tests/tdiv_ui.c + M /branches/4.0/tests/teint.c + M /branches/4.0/tests/teq.c + M /branches/4.0/tests/terandom.c + M /branches/4.0/tests/terandom_chisq.c + M /branches/4.0/tests/terf.c + M /branches/4.0/tests/tests.c + M /branches/4.0/tests/texceptions.c + M /branches/4.0/tests/texp.c + M /branches/4.0/tests/texp10.c + M /branches/4.0/tests/texp2.c + M /branches/4.0/tests/texpm1.c + M /branches/4.0/tests/tfactorial.c + M /branches/4.0/tests/tfits.c + M /branches/4.0/tests/tfma.c + M /branches/4.0/tests/tfmma.c + M /branches/4.0/tests/tfmod.c + M /branches/4.0/tests/tfms.c + M /branches/4.0/tests/tfpif.c + M /branches/4.0/tests/tfprintf.c + M /branches/4.0/tests/tfrac.c + M /branches/4.0/tests/tfrexp.c + M /branches/4.0/tests/tgamma.c + M /branches/4.0/tests/tgamma_inc.c + M /branches/4.0/tests/tgeneric.c + M /branches/4.0/tests/tgeneric_ui.c + M /branches/4.0/tests/tget_d.c + M /branches/4.0/tests/tget_d_2exp.c + M /branches/4.0/tests/tget_f.c + M /branches/4.0/tests/tget_flt.c + M /branches/4.0/tests/tget_ld_2exp.c + M /branches/4.0/tests/tget_q.c + M /branches/4.0/tests/tget_set_d64.c + M /branches/4.0/tests/tget_sj.c + M /branches/4.0/tests/tget_str.c + M /branches/4.0/tests/tget_z.c + M /branches/4.0/tests/tgmpop.c + M /branches/4.0/tests/tgrandom.c + M /branches/4.0/tests/thyperbolic.c + M /branches/4.0/tests/thypot.c + M /branches/4.0/tests/tinits.c + M /branches/4.0/tests/tinp_str.c + M /branches/4.0/tests/tinternals.c + M /branches/4.0/tests/tisnan.c + M /branches/4.0/tests/tisqrt.c + M /branches/4.0/tests/tj0.c + M /branches/4.0/tests/tj1.c + M /branches/4.0/tests/tjn.c + M /branches/4.0/tests/tl2b.c + M /branches/4.0/tests/tlgamma.c + M /branches/4.0/tests/tli2.c + M /branches/4.0/tests/tlngamma.c + M /branches/4.0/tests/tlog.c + M /branches/4.0/tests/tlog10.c + M /branches/4.0/tests/tlog1p.c + M /branches/4.0/tests/tlog2.c + M /branches/4.0/tests/tlog_ui.c + M /branches/4.0/tests/tmin_prec.c + M /branches/4.0/tests/tminmax.c + M /branches/4.0/tests/tmodf.c + M /branches/4.0/tests/tmul.c + M /branches/4.0/tests/tmul_2exp.c + M /branches/4.0/tests/tmul_d.c + M /branches/4.0/tests/tmul_ui.c + M /branches/4.0/tests/tnext.c + M /branches/4.0/tests/tnrandom.c + M /branches/4.0/tests/tnrandom_chisq.c + M /branches/4.0/tests/tout_str.c + M /branches/4.0/tests/toutimpl.c + M /branches/4.0/tests/tpow.c + M /branches/4.0/tests/tpow3.c + M /branches/4.0/tests/tpow_all.c + M /branches/4.0/tests/tpow_z.c + M /branches/4.0/tests/tprintf.c + M /branches/4.0/tests/trandom.c + M /branches/4.0/tests/trandom_deviate.c + M /branches/4.0/tests/trec_sqrt.c + M /branches/4.0/tests/tremquo.c + M /branches/4.0/tests/trint.c + M /branches/4.0/tests/trndna.c + M /branches/4.0/tests/troot.c + M /branches/4.0/tests/trootn_ui.c + M /branches/4.0/tests/tround_prec.c + M /branches/4.0/tests/tsec.c + M /branches/4.0/tests/tsech.c + M /branches/4.0/tests/tset.c + M /branches/4.0/tests/tset_d.c + M /branches/4.0/tests/tset_exp.c + M /branches/4.0/tests/tset_f.c + M /branches/4.0/tests/tset_float128.c + M /branches/4.0/tests/tset_ld.c + M /branches/4.0/tests/tset_q.c + M /branches/4.0/tests/tset_si.c + M /branches/4.0/tests/tset_sj.c + M /branches/4.0/tests/tset_str.c + M /branches/4.0/tests/tset_z.c + M /branches/4.0/tests/tset_z_exp.c + M /branches/4.0/tests/tsgn.c + M /branches/4.0/tests/tsi_op.c + M /branches/4.0/tests/tsin.c + M /branches/4.0/tests/tsin_cos.c + M /branches/4.0/tests/tsinh.c + M /branches/4.0/tests/tsinh_cosh.c + M /branches/4.0/tests/tsprintf.c + M /branches/4.0/tests/tsqr.c + M /branches/4.0/tests/tsqrt.c + M /branches/4.0/tests/tsqrt_ui.c + M /branches/4.0/tests/tstckintc.c + M /branches/4.0/tests/tstdint.c + M /branches/4.0/tests/tstrtofr.c + M /branches/4.0/tests/tsub.c + M /branches/4.0/tests/tsub1sp.c + M /branches/4.0/tests/tsub_d.c + M /branches/4.0/tests/tsub_ui.c + M /branches/4.0/tests/tsubnormal.c + M /branches/4.0/tests/tsum.c + M /branches/4.0/tests/tswap.c + M /branches/4.0/tests/ttan.c + M /branches/4.0/tests/ttanh.c + M /branches/4.0/tests/ttrunc.c + M /branches/4.0/tests/tui_div.c + M /branches/4.0/tests/tui_pow.c + M /branches/4.0/tests/tui_sub.c + M /branches/4.0/tests/turandom.c + M /branches/4.0/tests/tvalist.c + M /branches/4.0/tests/tversion.c + M /branches/4.0/tests/ty0.c + M /branches/4.0/tests/ty1.c + M /branches/4.0/tests/tyn.c + M /branches/4.0/tests/tzeta.c + M /branches/4.0/tests/tzeta_ui.c + M /branches/4.0/tools/bench/Makefile.am + M /branches/4.0/tools/bench/benchtime.h + M /branches/4.0/tools/bench/mpfrbench.c + M /branches/4.0/tools/ck-clz_tab + M /branches/4.0/tools/ck-copyright-notice + M /branches/4.0/tools/ck-news + M /branches/4.0/tools/ck-version-info + M /branches/4.0/tools/get_patches.sh + M /branches/4.0/tune/Makefile.am + M /branches/4.0/tune/bidimensional_sample.c + M /branches/4.0/tune/speed.c + M /branches/4.0/tune/tuneup.c -[tests/tget_flt.c] Use DOUBLE_ISNAN() instead of f == f. -(merge changesets r10160,10163 from the trunk) +Copyright notice update: added 2019 with + perl -pi -e 's/ (\d{4}-)?(2018)(?= Free Software)/ + " ".($1||"$2-").($2+1)/e' **/*(^/) +under zsh. Removed 2018 from the example in the doc/README.dev file. ------------------------------------------------------------------------ -r10166 | vlefevre | 2016-03-01 15:41:03 +0000 (Tue, 01 Mar 2016) | 2 lines +r13357 | vlefevre | 2018-12-31 11:11:10 +0000 (Mon, 31 Dec 2018) | 8 lines Changed paths: - M /branches/3.1 - M /branches/3.1/INSTALL + M /branches/4.0 + M /branches/4.0/src/set.c + M /branches/4.0/tests + M /branches/4.0/tests/tfmma.c + M /branches/4.0/tests/tset.c -[INSTALL] Updated "Notes on AIX/PowerPC". -(merged changeset r10161 from the trunk) +[src/set.c] Fixed double-rounding bug in the internal function + mpfr_set_1_2 (and simplified the generic algorithm, avoiding + the non-portable inex | inex2). +[tests/tset.c] Added corresponding tests. +[tests/tfmma.c] Added tests as this bug was affecting mpfr_fmma + (note: mpfr_set_1_2 is also called in mpfr_fma, but the buggy + code could not be executed in this case). +(merged changesets r13346-13347,13353-13356 from the trunk) ------------------------------------------------------------------------ -r10149 | zimmerma | 2016-02-29 20:29:40 +0000 (Mon, 29 Feb 2016) | 2 lines +r13330 | vlefevre | 2018-12-10 09:24:24 +0000 (Mon, 10 Dec 2018) | 2 lines Changed paths: - M /branches/3.1/configure.ac - M /branches/3.1/src/mpfr-gmp.h - -reverted commit 10144 (wrongly applied to branch 3.1 instead of trunk) + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/tdiv.c +[tests/tdiv.c] fixed test_20151023 (random number must not be 0). +(merged changeset r13329 from the trunk) ------------------------------------------------------------------------ -r10148 | vlefevre | 2016-02-29 18:07:10 +0000 (Mon, 29 Feb 2016) | 3 lines +r13310 | vlefevre | 2018-11-29 07:48:54 +0000 (Thu, 29 Nov 2018) | 5 lines Changed paths: - M /branches/3.1/tools/mpfrlint + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/Makefile.am + M /branches/4.0/tests/tversion.c -[tools/mpfrlint] ASSERT and ASSERT_ALWAYS must not be used for -assertion checking. -(merge changesets r8123,8589,10147 from the trunk, only for mpfrlint) +[tests/Makefile.am] Unset DISPLAY as it is not needed and it can yield +error messages when running the tests with LOG_COMPILER=wine (for builds +with MinGW). +[tests/tversion.c] Updated a comment about this issue. +(merged changesets r13305,13307-13309 from the trunk) ------------------------------------------------------------------------ -r10146 | vlefevre | 2016-02-29 17:47:01 +0000 (Mon, 29 Feb 2016) | 2 lines +r13301 | vlefevre | 2018-11-27 13:17:11 +0000 (Tue, 27 Nov 2018) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tget_d.c - M /branches/3.1/tests/tget_d_2exp.c - M /branches/3.1/tests/tget_ld_2exp.c + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/tdiv.c -Replaced the remaining ASSERT_ALWAYS by MPFR_ASSERTN. -(merged changeset r10145 from the trunk) +[tests/tdiv.c] Fixed test_20151023(). +(merged changesets r13149,13151,13298 from the trunk) ------------------------------------------------------------------------ -r10144 | zimmerma | 2016-02-29 17:31:52 +0000 (Mon, 29 Feb 2016) | 4 lines +r13297 | vlefevre | 2018-11-26 13:24:37 +0000 (Mon, 26 Nov 2018) | 2 lines Changed paths: - M /branches/3.1/configure.ac - M /branches/3.1/src/mpfr-gmp.h - -native detection of ieee_double_extract (work in progress), -this will allow to have decimal-float support without gmp-build -(and also faster set_d/get_d) + M /branches/4.0/tests + M /branches/4.0/tests/tset_str.c +[tests/tset_str.c] Added bug20180908() test. +(merged changesets r13164,13296 from the trunk, for the tests directory) ------------------------------------------------------------------------ -r10143 | zimmerma | 2016-02-29 17:22:30 +0000 (Mon, 29 Feb 2016) | 2 lines +r13294 | vlefevre | 2018-11-23 10:34:21 +0000 (Fri, 23 Nov 2018) | 1 line Changed paths: - M /branches/3.1/tests/tget_set_d64.c - -fixed assert macros + M /branches/4.0/doc/mpfr.texi +[doc/mpfr.texi] Updated the month. ------------------------------------------------------------------------ -r10142 | zimmerma | 2016-02-29 16:06:17 +0000 (Mon, 29 Feb 2016) | 2 lines +r13284 | vlefevre | 2018-11-22 15:36:13 +0000 (Thu, 22 Nov 2018) | 4 lines Changed paths: - M /branches/3.1/src/mpfr-gmp.h - -fixed typo + M /branches/4.0 + M /branches/4.0/NEWS + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/src/get_str.c + +MPFR manual: corrected/completed the mpfr_get_str description in order +to follow the historical behavior and GMP's mpf_get_str function. +(Discussion in the Trier meeting.) +(merged changeset r13283 from the trunk, with a correction in NEWS) +------------------------------------------------------------------------ +r13277 | vlefevre | 2018-11-20 08:17:39 +0000 (Tue, 20 Nov 2018) | 1 line +Changed paths: + M /branches/4.0 + M /branches/4.0/src/amd/amdfam10/mparam.h + M /branches/4.0/src/amd/k8/mparam.h + M /branches/4.0/src/arm/mparam.h + M /branches/4.0/src/generic/coverage/mparam.h + M /branches/4.0/src/hppa/mparam.h + M /branches/4.0/src/ia64/mparam.h + M /branches/4.0/src/mips/mparam.h + M /branches/4.0/src/powerpc64/mparam.h + M /branches/4.0/src/sparc64/mparam.h + M /branches/4.0/src/x86/core2/mparam.h + M /branches/4.0/src/x86/mparam.h + M /branches/4.0/src/x86_64/core2/mparam.h + M /branches/4.0/src/x86_64/corei5/mparam.h +Removed trailing whitespace. ------------------------------------------------------------------------ -r10139 | vlefevre | 2016-02-29 04:17:22 +0000 (Mon, 29 Feb 2016) | 1 line +r13252 | vlefevre | 2018-10-18 17:57:10 +0000 (Thu, 18 Oct 2018) | 3 lines Changed paths: - M /branches/3.1/ChangeLog + M /branches/4.0 + M /branches/4.0/src/mpfr-longlong.h -ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). +[src/mpfr-longlong.h] Fix obsolete ARC asm constraints; see patch posted +on . +(merged changeset r13251 from the trunk) ------------------------------------------------------------------------ -r10138 | vlefevre | 2016-02-29 04:07:54 +0000 (Mon, 29 Feb 2016) | 2 lines +r13245 | vlefevre | 2018-10-08 12:50:55 +0000 (Mon, 08 Oct 2018) | 2 lines Changed paths: - M /branches/3.1/NEWS + M /branches/4.0 + M /branches/4.0/codespell.ignore -[NEWS] Added "MinGW (MS Windows): Added support for thread-safe DLL -(shared library)." (fix in r10119,10130). +[codespell.ignore] Also ignore "ue" (codespell 1.14). +(merged changeset r13244 from the trunk) ------------------------------------------------------------------------ -r10136 | vlefevre | 2016-02-29 03:56:39 +0000 (Mon, 29 Feb 2016) | 2 lines +r13187 | vlefevre | 2018-09-13 13:06:47 +0000 (Thu, 13 Sep 2018) | 2 lines Changed paths: - M /branches/3.1/INSTALL + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/tdiv_ui.c -[INSTALL] Removed an obsolete sentence about MinGW and shared builds -with TLS (the failures in the test suite were avoided in r10119,10130). +[tests/tdiv_ui.c] fixed corner_cases() test +(merged changeset r13162 from the trunk) ------------------------------------------------------------------------ -r10133 | vlefevre | 2016-02-29 01:12:13 +0000 (Mon, 29 Feb 2016) | 6 lines +r13010 | vlefevre | 2018-08-22 13:52:40 +0000 (Wed, 22 Aug 2018) | 3 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tversion.c - -[tests/tversion.c] - * 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). ------------------------------------------------------------------------- -r10131 | vlefevre | 2016-02-26 14:43:04 +0000 (Fri, 26 Feb 2016) | 5 lines -Changed paths: - M /branches/3.1/acinclude.m4 - -[acinclude.m4] Replaced a "main()" (from the merge of r8245) by -"main (void)" (the other similar changes were done in r9418 for -the 3.1 branch and r8728 in the trunk, which is why r8245 did not -have this change). Useful to configure & build with -Werror (this -needs a patched autoconf). ------------------------------------------------------------------------- -r10130 | vlefevre | 2016-02-26 12:05:16 +0000 (Fri, 26 Feb 2016) | 6 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/acinclude.m4 - M /branches/3.1/src - M /branches/3.1/src/const_catalan.c - M /branches/3.1/src/const_euler.c - M /branches/3.1/src/const_log2.c - M /branches/3.1/src/const_pi.c - M /branches/3.1/src/exceptions.c - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/src/mpfr-thread.h - M /branches/3.1/src/set_dfl_prec.c - M /branches/3.1/src/set_rnd.c - -Better threading support: - * Support for _Thread_local (C11). - * Support build as thread-safe DLL on Windows (mainly changes - from Stephan Tolksdorf). -(merged changesets r7954,8245,9684,9778 from the trunk, with -mpfr_flags_t replaced by unsigned int) ------------------------------------------------------------------------- -r10129 | zimmerma | 2016-02-26 10:09:44 +0000 (Fri, 26 Feb 2016) | 2 lines -Changed paths: - M /branches/3.1/INSTALL - -changed according to suggestion from Eli Zaretskii - ------------------------------------------------------------------------- -r10120 | vlefevre | 2016-02-25 01:43:51 +0000 (Thu, 25 Feb 2016) | 2 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/INSTALL - -[INSTALL] Various updates for use with Windows applications. -(merged changesets r9750-9751,9756-9757,9762-9767 from the trunk) ------------------------------------------------------------------------- -r10119 | vlefevre | 2016-02-24 16:35:33 +0000 (Wed, 24 Feb 2016) | 7 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/tests/memory.c - M /branches/3.1/tests/mpfr-test.h - M /branches/3.1/tests/tests.c - M /branches/3.1/tests/tgrandom.c - M /branches/3.1/tests/tset_str.c - M /branches/3.1/tests/tsum.c - M /branches/3.1/tools/mpfrlint + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/tversion.c -In the tests, use tests_allocate and tests_free instead of -(*__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) +[tests/tversion.c] Portability corrections related to the use of the +preprocessor / code robustness. +(merged changeset r13003 from the trunk) ------------------------------------------------------------------------ -r10117 | vlefevre | 2016-02-24 15:27:21 +0000 (Wed, 24 Feb 2016) | 1 line +r12999 | vlefevre | 2018-08-21 13:18:23 +0000 (Tue, 21 Aug 2018) | 2 lines Changed paths: - M /branches/3.1/VERSION - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/version.c + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/tsub1sp.c -Updated version to 3.1.4-rc2. +[tests/tsub1sp.c] Added a test by merging r12997 from the trunk, and +modified the comment to say that the bug is only in the trunk. ------------------------------------------------------------------------ -r10116 | vlefevre | 2016-02-24 15:22:37 +0000 (Wed, 24 Feb 2016) | 8 lines +r12994 | vlefevre | 2018-08-20 07:44:49 +0000 (Mon, 20 Aug 2018) | 3 lines Changed paths: - M /branches/3.1 - M /branches/3.1/configure.ac + M /branches/4.0 + M /branches/4.0/src/mpfr-impl.h -[configure.ac] Try to link with GMP even when a DLL, since it seems -to work now: - https://sympa.inria.fr/sympa/arc/mpfr/2013-05/msg00010.html - https://sympa.inria.fr/sympa/arc/mpfr/2015-12/msg00037.html -Thus gmp_printf features (from the printf C function) are now tested, -avoiding failures in the tests with thread-safe shared Windows builds -using MinGW. -(merged changeset r8524 from the trunk) +[src/mpfr-impl.h] Added a cast to mp_bitcnt_t in order to fix potential +integer overflow in MPFR_MPZ_SIZEINBASE2. +(merged changeset r12988 from the trunk) ------------------------------------------------------------------------ -r10107 | vlefevre | 2016-02-24 01:51:14 +0000 (Wed, 24 Feb 2016) | 1 line +r12993 | vlefevre | 2018-08-20 07:40:42 +0000 (Mon, 20 Aug 2018) | 4 lines Changed paths: - M /branches/3.1/ChangeLog + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/tcan_round.c -ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). +[tests/tcan_round.c] Added missing casts for printf (error messages). +Bug detected under MS Windows, where size_t > unsigned long. See: + https://sympa.inria.fr/sympa/arc/mpfr/2018-08/msg00002.html +(merged changeset r12983 from the trunk) ------------------------------------------------------------------------ -r10106 | vlefevre | 2016-02-24 01:40:56 +0000 (Wed, 24 Feb 2016) | 2 lines +r12992 | vlefevre | 2018-08-20 06:47:44 +0000 (Mon, 20 Aug 2018) | 22 lines Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi + M /branches/4.0 + M /branches/4.0/src/mpfr-longlong.h + M /branches/4.0/tools/mpfrlint -[doc/mpfr.texi] Fixed a warning with "make info". -(merged changeset r10105 from the trunk) ------------------------------------------------------------------------- -r10104 | vlefevre | 2016-02-24 01:30:08 +0000 (Wed, 24 Feb 2016) | 1 line -Changed paths: - M /branches/3.1/ChangeLog +[tools/mpfrlint] Check that __GMP_DECLSPEC is not used by MPFR. +[src/mpfr-longlong.h] Replaced __GMP_DECLSPEC by __MPFR_DECLSPEC. -ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). ------------------------------------------------------------------------- -r10103 | vlefevre | 2016-02-24 01:27:46 +0000 (Wed, 24 Feb 2016) | 1 line -Changed paths: - M /branches/3.1/NEWS +Otherwise, with Windows DLL, __GMP_DECLSPEC is replaced by +__declspec(dllimport), which is wrong when building MPFR and +yields warning LNK4217 such as: + + eint.obj : warning LNK4217: locally defined symbol mpfr_clz_tab + imported in function mpfr_eint + +due to + + extern const unsigned char __GMP_DECLSPEC __clz_tab[129]; -[NEWS] Update for GNU MPFR 3.1.4. +(note that mpfr_clz_tab is defined with "#define __clz_tab mpfr_clz_tab" +only without the GMP build). + +See: + https://sympa.inria.fr/sympa/arc/mpfr/2018-08/msg00000.html + https://sympa.inria.fr/sympa/arc/mpfr/2018-08/msg00001.html + +(merged changesets r12975-12977 from the trunk) ------------------------------------------------------------------------ -r10102 | vlefevre | 2016-02-24 01:25:32 +0000 (Wed, 24 Feb 2016) | 5 lines +r12969 | vlefevre | 2018-07-31 09:01:08 +0000 (Tue, 31 Jul 2018) | 3 lines Changed paths: - M /branches/3.1 - M /branches/3.1/Makefile.am - A /branches/3.1/tools/ck-news (from /trunk/tools/ck-news:10101) + M /branches/4.0/tests/tversion.c -Added tools/ck-news Perl script to check the NEWS file. -In Makefile.am: - * run this script in dist-hook for "make dist"; - * added this script to EXTRA_DIST as it is used in dist-hook. -(merged changeset r10101 from the trunk) +[tests/tversion.c] Updated comment about missing output from the +first printf with i586-mingw32msvc-gcc -D__USE_MINGW_ANSI_STDIO +and run under Wine (issue not reproducible). ------------------------------------------------------------------------ -r10096 | vlefevre | 2016-02-23 22:17:20 +0000 (Tue, 23 Feb 2016) | 1 line +r12968 | vlefevre | 2018-07-30 16:31:52 +0000 (Mon, 30 Jul 2018) | 2 lines Changed paths: - M /branches/3.1/ChangeLog + M /branches/4.0/tests/tversion.c -ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). +[tests/tversion.c] Try to detect missing output from the first printf +with i586-mingw32msvc-gcc -D__USE_MINGW_ANSI_STDIO and run under Wine. ------------------------------------------------------------------------ -r10095 | vlefevre | 2016-02-23 22:15:13 +0000 (Tue, 23 Feb 2016) | 2 lines +r12967 | vlefevre | 2018-07-30 13:43:03 +0000 (Mon, 30 Jul 2018) | 5 lines Changed paths: - M /branches/3.1/VERSION - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/Makefile.am - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/version.c + M /branches/4.0 + M /branches/4.0/acinclude.m4 + M /branches/4.0/configure.ac + M /branches/4.0/src/vasprintf.c + M /branches/4.0/tests + M /branches/4.0/tests/tsprintf.c -Updated version to 3.1.4-rc1 and updated libmpfr_la_LDFLAGS in -src/Makefile.am for the next release. +[acinclude.m4,configure.ac] Check the support of the group flag for + native integers, which is a Single UNIX Specification extension. +[src/vasprintf.c] Fixed bug with the P length modifier (mpfr_prec_t). +[tests/tsprintf.c] Added testcases. +(merged changesets r12958-12959,12961-12964 from the trunk) ------------------------------------------------------------------------ -r10094 | vlefevre | 2016-02-23 22:09:55 +0000 (Tue, 23 Feb 2016) | 2 lines +r12966 | vlefevre | 2018-07-30 13:34:14 +0000 (Mon, 30 Jul 2018) | 3 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tools/update-version + M /branches/4.0 + M /branches/4.0/src/vasprintf.c -[tools/update-version] Correction for new perl versions. -(merged changeset r10093 from the trunk) +[src/vasprintf.c] Bug fix: in case of some errors (via "goto error;"), +va_end wasn't called, yielding undefined behavior. +(reverse-merged r12965; merged changesets r12955,12957 from the trunk) ------------------------------------------------------------------------ -r10090 | vlefevre | 2016-02-23 12:26:36 +0000 (Tue, 23 Feb 2016) | 8 lines +r12965 | vlefevre | 2018-07-30 09:32:15 +0000 (Mon, 30 Jul 2018) | 3 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src - M /branches/3.1/src/cmp_d.c - M /branches/3.1/src/cmp_ld.c - M /branches/3.1/tests/tcmp_d.c - M /branches/3.1/tests/tcmp_ld.c + M /branches/4.0 + M /branches/4.0/src/vasprintf.c -[src/{cmp_d.c,cmp_ld.c}] Bug fixes: mpfr_cmp_d (resp. mpfr_cmp_ld) was -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) ------------------------------------------------------------------------- -r10083 | vlefevre | 2016-02-22 14:46:51 +0000 (Mon, 22 Feb 2016) | 14 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/src - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/src/sum.c - M /branches/3.1/tests/tsum.c - -[src/sum.c] Fixed bugs in mpfr_sum, which could return wrong results - 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) ------------------------------------------------------------------------- -r10078 | vlefevre | 2016-02-22 12:46:41 +0000 (Mon, 22 Feb 2016) | 5 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/src - M /branches/3.1/src/agm.c - M /branches/3.1/tests/tagm.c - -[src/agm.c] Fixed bug in mpfr_agm in case the two FP inputs have - 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) ------------------------------------------------------------------------- -r10075 | vlefevre | 2016-02-19 17:03:45 +0000 (Fri, 19 Feb 2016) | 6 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/src - M /branches/3.1/src/rem1.c - M /branches/3.1/tests/tfmod.c - M /branches/3.1/tests/tremquo.c - -[src/rem1.c] Fixed bug in the mpfr_rem1 internal function (used by -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. -(merged changesets r10054,10056,10059,10061-10062,10064,10072-10074 -from the trunk) +[src/vasprintf.c] Fixed "store to null pointer" and free of bad pointer +in case of error. +(merged part of changeset r12957 from the trunk) ------------------------------------------------------------------------ -r10071 | vlefevre | 2016-02-19 16:08:41 +0000 (Fri, 19 Feb 2016) | 4 lines +r12950 | vlefevre | 2018-07-23 08:17:05 +0000 (Mon, 23 Jul 2018) | 8 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src - M /branches/3.1/src/gamma.c - M /branches/3.1/tests/tgamma.c + M /branches/4.0 + M /branches/4.0/src/erf.c + M /branches/4.0/tests + M /branches/4.0/tests/terf.c -[src/gamma.c] Bug fix in case the argument is an integer fitting in an -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) +[src/erf.c] In the computation of an error bound, replaced some + double's (which could overflow) by mpfr_t to fix bug reported + by Naoki Shibata: + https://sympa.inria.fr/sympa/arc/mpfr/2018-07/msg00028.html +[tests/terf.c] Added a testcase for this bug. Increased the number + of generic tests in order to reproduce the bug there too with the + default seed. +(merged changesets r12946-12949 from the trunk) ------------------------------------------------------------------------ -r10040 | vlefevre | 2016-02-15 12:57:57 +0000 (Mon, 15 Feb 2016) | 10 lines +r12938 | vlefevre | 2018-07-19 00:01:28 +0000 (Thu, 19 Jul 2018) | 11 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src - M /branches/3.1/src/root.c - M /branches/3.1/tests/troot.c + M /branches/4.0 + M /branches/4.0/acinclude.m4 + M /branches/4.0/configure.ac + M /branches/4.0/doc/README.dev + M /branches/4.0/src/buildopt.c + M /branches/4.0/src/free_cache.c + M /branches/4.0/src/mpfr-impl.h + M /branches/4.0/src/mpfr-thread.h + M /branches/4.0/tests + M /branches/4.0/tests/tconst_pi.c + M /branches/4.0/tests/tversion.c -[src/root.c] Fixed root(x,k) for large very values of k: MPFR could -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) +Shared caches: fix and minor changes. + * Fixed detection and use of C11 thread support: the C11 header is + , not . + * Renamed WANT_SHARED_CACHE to MPFR_WANT_SHARED_CACHE for consistency + with the other MPFR_WANT_* macros. + * Added MPFR_THREAD_LOCK_METHOD macro, giving the thread locking + method as a string (when shared caches are enabled). + * doc/README.dev: documented 4 macros for shared caches. + * tests/tversion.c: output MPFR_WANT_SHARED_CACHE and + MPFR_THREAD_LOCK_METHOD information. +(merged changeset r12937 from the trunk) ------------------------------------------------------------------------ -r10039 | vlefevre | 2016-02-15 12:34:15 +0000 (Mon, 15 Feb 2016) | 1 line +r12936 | vlefevre | 2018-07-18 23:17:03 +0000 (Wed, 18 Jul 2018) | 4 lines Changed paths: - M /branches/3.1/src/mpfr-impl.h + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/tconst_pi.c -[src/mpfr-impl.h] Merged r9970 to simplify a future patch generation. +[tests/tconst_pi.c] Removed an incorrect assertion, as the #else would +be applicable when WANT_SHARED_CACHE is defined but not HAVE_PTHREAD +(which may occur when MPFR_HAVE_C11_LOCK is defined). +(merged changeset r12935 from the trunk) ------------------------------------------------------------------------ -r10035 | vlefevre | 2016-02-15 10:20:38 +0000 (Mon, 15 Feb 2016) | 7 lines +r12923 | vlefevre | 2018-07-13 10:31:07 +0000 (Fri, 13 Jul 2018) | 4 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/fits_intmax.c - M /branches/3.1/src/fits_s.h - M /branches/3.1/src/fits_u.h - M /branches/3.1/tests/tfits.c + M /branches/4.0/acinclude.m4 -[src/{fits_intmax.c,fits_s.h,fits_u.h}] Fixed mpfr_fits_* functions: the -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) +[acinclude.m4] Fixed the __float128 detection for NetBSD: Optimization +made the "undefined reference" error disappear, so that __float128 was +misdetected as being supported. Also updated the message. +Note: this change is similar to the r12921-12922 ones in the trunk. ------------------------------------------------------------------------ -r10029 | vlefevre | 2016-02-12 14:19:46 +0000 (Fri, 12 Feb 2016) | 7 lines +r12918 | vlefevre | 2018-07-12 15:05:07 +0000 (Thu, 12 Jul 2018) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/div.c - M /branches/3.1/src/round_p.c - M /branches/3.1/src/round_prec.c - M /branches/3.1/tests/tcan_round.c + M /branches/4.0/NEWS -Fixed bug in mpfr_can_round_raw, which affected mpfr_can_round: the -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) +[NEWS] Update for GNU MPFR 4.0.2. ------------------------------------------------------------------------ -r10026 | vlefevre | 2016-02-12 13:26:58 +0000 (Fri, 12 Feb 2016) | 3 lines +r12917 | vlefevre | 2018-07-12 15:04:17 +0000 (Thu, 12 Jul 2018) | 6 lines Changed paths: - M /branches/3.1/src/exp3.c + M /branches/4.0 + M /branches/4.0/doc/mpfr.texi -[src/exp3.c] Merged r9883 to simplify a future patch generation -(fix of comment formatting, which shouldn't have been with the -other r9883 changes). +[doc/mpfr.texi] In Section "Nomenclature and Types": + * rewrote the paragraph defining "floating-point number", + avoiding ambiguities; + * removed all the @noindent, whose purpose is unclear; + * defined regular numbers and exponents. +(merged changesets r12906-12908 from the trunk) ------------------------------------------------------------------------ -r10023 | vlefevre | 2016-02-12 12:30:17 +0000 (Fri, 12 Feb 2016) | 4 lines +r12916 | vlefevre | 2018-07-12 14:32:51 +0000 (Thu, 12 Jul 2018) | 7 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/div_ui.c - M /branches/3.1/src/mul_ui.c - M /branches/3.1/src/si_op.c - M /branches/3.1/src/ui_div.c + M /branches/4.0/acinclude.m4 -Fixed bug in si operations (mpfr_add_si, mpfr_sub_si, mpfr_si_sub, -mpfr_mul_si, mpfr_div_si, mpfr_si_div) when the integer is LONG_MIN, -visible when using an UB sanitizer. -(merged changesets r9998-9999,10003,10005 from the trunk) +[acinclude.m4] For the __float128 detection, changed AC_COMPILE_IFELSE +to AC_LINK_IFELSE since an error may occur only at link time, such as +under NetBSD: + https://mail-index.netbsd.org/pkgsrc-users/2018/02/02/msg026220.html + https://mail-index.netbsd.org/pkgsrc-users/2018/02/05/msg026238.html +Note: this change is similar to the r12915 one in the trunk, except +that we do not try to detect _Float128 in the 4.0 branch. ------------------------------------------------------------------------ -r10009 | vlefevre | 2016-02-09 09:59:52 +0000 (Tue, 09 Feb 2016) | 1 line +r12914 | vlefevre | 2018-07-12 12:32:16 +0000 (Thu, 12 Jul 2018) | 5 lines Changed paths: - M /branches/3.1/src/eint.c + M /branches/4.0 + M /branches/4.0/src/Makefile.am -[src/eint.c] Typo in a comment. +[src/Makefile.am] Corrected check-exported-symbols to avoid a failure +when the default .SHELLFLAGS value is '-ec' (POSIX) instead of '-c' +(GNU Make, which is not in POSIX-conforming mode by default). +Bug found on FreeBSD 11.1 (Compile Farm @ HouseGordon.com). +(merged changeset r12913 from the trunk) ------------------------------------------------------------------------ -r10002 | vlefevre | 2016-02-09 01:34:37 +0000 (Tue, 09 Feb 2016) | 4 lines +r12909 | vlefevre | 2018-07-10 11:51:56 +0000 (Tue, 10 Jul 2018) | 22 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tgeneric_ui.c + M /branches/4.0/src/vasprintf.c -[tests/tgeneric_ui.c] Added tests of the extreme integer values, -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) +[src/vasprintf.c] Fixed several bugs in buffer_sandwich, which could +yield memory corruption with non-default memory allocators and other +undefined behavior; check the return value when this function is called. + +Details: + * check integer overflow on the size computations; + * computation of q and r without tests; + * fixed the case where r > len (e.g. len = 1 and tz = 1); + * in the loop, increase the str pointer only when needed, otherwise + str could be beyond of the end of the string of the digits, which + is undefined behavior. + +The first consequence of the r > len issue was an incorrect generated +string. Moreover, since the generated string was shorter than expected, +mpfr_free_str would provide an incorrect buffer size to the "free" +function of the current GMP memory allocator. By default, this size is +ignored, but it may matter if the memory allocators have been changed +with the mp_set_memory_functions GMP function, in which case a possible +consequence could be memory corruption. + +Note: This corresponds to r12869 from the trunk. Other changes in the +trunk (dead code removal...) have not been applied. +------------------------------------------------------------------------ +r12904 | vlefevre | 2018-07-06 14:36:05 +0000 (Fri, 06 Jul 2018) | 2 lines +Changed paths: + M /branches/4.0/tests/tprintf.c + M /branches/4.0/tests/tsprintf.c + +[tests/{tprintf.c,tsprintf.c}] Merged the latest tests from the trunk +(r12562:12903). ------------------------------------------------------------------------ -r9987 | vlefevre | 2016-02-08 11:07:06 +0000 (Mon, 08 Feb 2016) | 1 line +r12897 | vlefevre | 2018-07-06 13:27:41 +0000 (Fri, 06 Jul 2018) | 1 line Changed paths: - M /branches/3.1/doc/mpfr.texi + M /branches/4.0/doc/mpfr.texi [doc/mpfr.texi] Updated the month. ------------------------------------------------------------------------ -r9944 | vlefevre | 2016-02-04 15:15:38 +0000 (Thu, 04 Feb 2016) | 2 lines +r12890 | vlefevre | 2018-07-06 07:21:18 +0000 (Fri, 06 Jul 2018) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi + M /branches/4.0 + M /branches/4.0/AUTHORS + M /branches/4.0/doc/mpfr.texi -[doc/mpfr.texi] Mention the Caramba project-team. -(merged changeset r9942 from the trunk) +[AUTHORS,doc/mpfr.texi] Typo in Fredrik's name. +(merged changesets r12888-12889 from the trunk) ------------------------------------------------------------------------ -r9943 | vlefevre | 2016-02-04 15:13:15 +0000 (Thu, 04 Feb 2016) | 4 lines +r12872 | vlefevre | 2018-07-04 12:04:26 +0000 (Wed, 04 Jul 2018) | 5 lines Changed paths: - M /branches/3.1/BUGS - M /branches/3.1/INSTALL - M /branches/3.1/NEWS - M /branches/3.1/README - M /branches/3.1/TODO - M /branches/3.1/acinclude.m4 - M /branches/3.1/configure.ac - M /branches/3.1/doc/FAQ.html - M /branches/3.1/doc/README.dev - M /branches/3.1/doc/faq.xsl - M /branches/3.1/examples/divworst.c - M /branches/3.1/examples/rndo-add.c - M /branches/3.1/examples/sample.c - M /branches/3.1/examples/version.c - M /branches/3.1/src/abort_prec_max.c - M /branches/3.1/src/acos.c - M /branches/3.1/src/acosh.c - M /branches/3.1/src/add.c - M /branches/3.1/src/add1.c - M /branches/3.1/src/add1sp.c - M /branches/3.1/src/add_d.c - M /branches/3.1/src/add_ui.c - M /branches/3.1/src/agm.c - M /branches/3.1/src/ai.c - M /branches/3.1/src/asin.c - M /branches/3.1/src/asinh.c - M /branches/3.1/src/atan.c - M /branches/3.1/src/atan2.c - M /branches/3.1/src/atanh.c - M /branches/3.1/src/bernoulli.c - M /branches/3.1/src/buildopt.c - M /branches/3.1/src/cache.c - M /branches/3.1/src/cbrt.c - M /branches/3.1/src/check.c - M /branches/3.1/src/clear.c - M /branches/3.1/src/clears.c - M /branches/3.1/src/cmp.c - M /branches/3.1/src/cmp2.c - M /branches/3.1/src/cmp_abs.c - M /branches/3.1/src/cmp_d.c - M /branches/3.1/src/cmp_ld.c - M /branches/3.1/src/cmp_si.c - M /branches/3.1/src/cmp_ui.c - M /branches/3.1/src/comparisons.c - M /branches/3.1/src/const_catalan.c - M /branches/3.1/src/const_euler.c - M /branches/3.1/src/const_log2.c - M /branches/3.1/src/const_pi.c - M /branches/3.1/src/constant.c - M /branches/3.1/src/copysign.c - M /branches/3.1/src/cos.c - M /branches/3.1/src/cosh.c - M /branches/3.1/src/cot.c - M /branches/3.1/src/coth.c - M /branches/3.1/src/csc.c - M /branches/3.1/src/csch.c - M /branches/3.1/src/d_div.c - M /branches/3.1/src/d_sub.c - M /branches/3.1/src/digamma.c - M /branches/3.1/src/dim.c - M /branches/3.1/src/div.c - M /branches/3.1/src/div_2exp.c - M /branches/3.1/src/div_2si.c - M /branches/3.1/src/div_2ui.c - M /branches/3.1/src/div_d.c - M /branches/3.1/src/div_ui.c - M /branches/3.1/src/dump.c - M /branches/3.1/src/eint.c - M /branches/3.1/src/eq.c - M /branches/3.1/src/erf.c - M /branches/3.1/src/erfc.c - M /branches/3.1/src/exceptions.c - M /branches/3.1/src/exp.c - M /branches/3.1/src/exp10.c - M /branches/3.1/src/exp2.c - M /branches/3.1/src/exp3.c - M /branches/3.1/src/exp_2.c - M /branches/3.1/src/expm1.c - M /branches/3.1/src/extract.c - M /branches/3.1/src/factorial.c - M /branches/3.1/src/fits_intmax.c - M /branches/3.1/src/fits_s.h - M /branches/3.1/src/fits_sint.c - M /branches/3.1/src/fits_slong.c - M /branches/3.1/src/fits_sshort.c - M /branches/3.1/src/fits_u.h - M /branches/3.1/src/fits_uint.c - M /branches/3.1/src/fits_uintmax.c - M /branches/3.1/src/fits_ulong.c - M /branches/3.1/src/fits_ushort.c - M /branches/3.1/src/fma.c - M /branches/3.1/src/fms.c - M /branches/3.1/src/frac.c - M /branches/3.1/src/free_cache.c - M /branches/3.1/src/frexp.c - M /branches/3.1/src/gamma.c - M /branches/3.1/src/gammaonethird.c - M /branches/3.1/src/gen_inverse.h - M /branches/3.1/src/get_d.c - M /branches/3.1/src/get_d64.c - M /branches/3.1/src/get_exp.c - M /branches/3.1/src/get_f.c - M /branches/3.1/src/get_flt.c - M /branches/3.1/src/get_ld.c - M /branches/3.1/src/get_si.c - M /branches/3.1/src/get_sj.c - M /branches/3.1/src/get_str.c - M /branches/3.1/src/get_ui.c - M /branches/3.1/src/get_uj.c - M /branches/3.1/src/get_z.c - M /branches/3.1/src/get_z_exp.c - M /branches/3.1/src/gmp_op.c - M /branches/3.1/src/grandom.c - M /branches/3.1/src/hypot.c - M /branches/3.1/src/ieee_floats.h - M /branches/3.1/src/init.c - M /branches/3.1/src/init2.c - M /branches/3.1/src/inits.c - M /branches/3.1/src/inits2.c - M /branches/3.1/src/inp_str.c - M /branches/3.1/src/int_ceil_log2.c - M /branches/3.1/src/isinf.c - M /branches/3.1/src/isinteger.c - M /branches/3.1/src/isnan.c - M /branches/3.1/src/isnum.c - M /branches/3.1/src/isqrt.c - M /branches/3.1/src/isregular.c - M /branches/3.1/src/iszero.c - M /branches/3.1/src/jn.c - M /branches/3.1/src/jyn_asympt.c - M /branches/3.1/src/li2.c - M /branches/3.1/src/lngamma.c - M /branches/3.1/src/log.c - M /branches/3.1/src/log10.c - M /branches/3.1/src/log1p.c - M /branches/3.1/src/log2.c - M /branches/3.1/src/logging.c - M /branches/3.1/src/min_prec.c - M /branches/3.1/src/minmax.c - M /branches/3.1/src/modf.c - M /branches/3.1/src/mpf2mpfr.h - M /branches/3.1/src/mpfr-gmp.c - M /branches/3.1/src/mpfr-gmp.h - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/src/mpfr-intmax.h - M /branches/3.1/src/mpfr-thread.h - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/mpn_exp.c - M /branches/3.1/src/mul.c - M /branches/3.1/src/mul_2exp.c - M /branches/3.1/src/mul_2si.c - M /branches/3.1/src/mul_2ui.c - M /branches/3.1/src/mul_d.c - M /branches/3.1/src/mul_ui.c - M /branches/3.1/src/mulders.c - M /branches/3.1/src/neg.c - M /branches/3.1/src/next.c - M /branches/3.1/src/out_raw.c - M /branches/3.1/src/out_str.c - M /branches/3.1/src/pow.c - M /branches/3.1/src/pow_si.c - M /branches/3.1/src/pow_ui.c - M /branches/3.1/src/pow_z.c - M /branches/3.1/src/powerof2.c - M /branches/3.1/src/print_raw.c - M /branches/3.1/src/print_rnd_mode.c - M /branches/3.1/src/printf.c - M /branches/3.1/src/rec_sqrt.c - M /branches/3.1/src/reldiff.c - M /branches/3.1/src/rem1.c - M /branches/3.1/src/rint.c - M /branches/3.1/src/root.c - M /branches/3.1/src/round_near_x.c - M /branches/3.1/src/round_p.c - M /branches/3.1/src/round_prec.c - M /branches/3.1/src/round_raw_generic.c - M /branches/3.1/src/scale2.c - M /branches/3.1/src/sec.c - M /branches/3.1/src/sech.c - M /branches/3.1/src/set.c - M /branches/3.1/src/set_d.c - M /branches/3.1/src/set_d64.c - M /branches/3.1/src/set_dfl_prec.c - M /branches/3.1/src/set_exp.c - M /branches/3.1/src/set_f.c - M /branches/3.1/src/set_flt.c - M /branches/3.1/src/set_inf.c - M /branches/3.1/src/set_ld.c - M /branches/3.1/src/set_nan.c - M /branches/3.1/src/set_prc_raw.c - M /branches/3.1/src/set_prec.c - M /branches/3.1/src/set_q.c - M /branches/3.1/src/set_rnd.c - M /branches/3.1/src/set_si.c - M /branches/3.1/src/set_si_2exp.c - M /branches/3.1/src/set_sj.c - M /branches/3.1/src/set_str.c - M /branches/3.1/src/set_str_raw.c - M /branches/3.1/src/set_ui.c - M /branches/3.1/src/set_ui_2exp.c - M /branches/3.1/src/set_uj.c - M /branches/3.1/src/set_z.c - M /branches/3.1/src/set_z_exp.c - M /branches/3.1/src/set_zero.c - M /branches/3.1/src/setmax.c - M /branches/3.1/src/setmin.c - M /branches/3.1/src/setsign.c - M /branches/3.1/src/sgn.c - M /branches/3.1/src/si_op.c - M /branches/3.1/src/signbit.c - M /branches/3.1/src/sin.c - M /branches/3.1/src/sin_cos.c - M /branches/3.1/src/sinh.c - M /branches/3.1/src/sinh_cosh.c - M /branches/3.1/src/sqr.c - M /branches/3.1/src/sqrt.c - M /branches/3.1/src/sqrt_ui.c - M /branches/3.1/src/stack_interface.c - M /branches/3.1/src/strtofr.c - M /branches/3.1/src/sub.c - M /branches/3.1/src/sub1.c - M /branches/3.1/src/sub1sp.c - M /branches/3.1/src/sub_d.c - M /branches/3.1/src/sub_ui.c - M /branches/3.1/src/subnormal.c - M /branches/3.1/src/sum.c - M /branches/3.1/src/swap.c - M /branches/3.1/src/tan.c - M /branches/3.1/src/tanh.c - M /branches/3.1/src/uceil_exp2.c - M /branches/3.1/src/uceil_log2.c - M /branches/3.1/src/ufloor_log2.c - M /branches/3.1/src/ui_div.c - M /branches/3.1/src/ui_pow.c - M /branches/3.1/src/ui_pow_ui.c - M /branches/3.1/src/ui_sub.c - M /branches/3.1/src/urandom.c - M /branches/3.1/src/urandomb.c - M /branches/3.1/src/vasprintf.c - M /branches/3.1/src/version.c - M /branches/3.1/src/volatile.c - M /branches/3.1/src/yn.c - M /branches/3.1/src/zeta.c - M /branches/3.1/src/zeta_ui.c - M /branches/3.1/tests/cmp_str.c - M /branches/3.1/tests/data/digamma - M /branches/3.1/tests/data/li2 - M /branches/3.1/tests/memory.c - M /branches/3.1/tests/mpf_compat.c - M /branches/3.1/tests/mpf_compat.h - M /branches/3.1/tests/mpfr-test.h - M /branches/3.1/tests/mpfr_compat.c - M /branches/3.1/tests/random2.c - M /branches/3.1/tests/reuse.c - M /branches/3.1/tests/rnd_mode.c - M /branches/3.1/tests/tabs.c - M /branches/3.1/tests/tacos.c - M /branches/3.1/tests/tacosh.c - M /branches/3.1/tests/tadd.c - M /branches/3.1/tests/tadd1sp.c - M /branches/3.1/tests/tadd_d.c - M /branches/3.1/tests/tadd_ui.c - M /branches/3.1/tests/tagm.c - M /branches/3.1/tests/tai.c - M /branches/3.1/tests/tasin.c - M /branches/3.1/tests/tasinh.c - M /branches/3.1/tests/tatan.c - M /branches/3.1/tests/tatanh.c - M /branches/3.1/tests/taway.c - M /branches/3.1/tests/tbuildopt.c - M /branches/3.1/tests/tcan_round.c - M /branches/3.1/tests/tcbrt.c - M /branches/3.1/tests/tcheck.c - M /branches/3.1/tests/tcmp.c - M /branches/3.1/tests/tcmp2.c - M /branches/3.1/tests/tcmp_d.c - M /branches/3.1/tests/tcmp_ld.c - M /branches/3.1/tests/tcmp_ui.c - M /branches/3.1/tests/tcmpabs.c - M /branches/3.1/tests/tcomparisons.c - M /branches/3.1/tests/tconst_catalan.c - M /branches/3.1/tests/tconst_euler.c - M /branches/3.1/tests/tconst_log2.c - M /branches/3.1/tests/tconst_pi.c - M /branches/3.1/tests/tcopysign.c - M /branches/3.1/tests/tcos.c - M /branches/3.1/tests/tcosh.c - M /branches/3.1/tests/tcot.c - M /branches/3.1/tests/tcoth.c - M /branches/3.1/tests/tcsc.c - M /branches/3.1/tests/tcsch.c - M /branches/3.1/tests/td_div.c - M /branches/3.1/tests/td_sub.c - M /branches/3.1/tests/tdigamma.c - M /branches/3.1/tests/tdim.c - M /branches/3.1/tests/tdiv.c - M /branches/3.1/tests/tdiv_d.c - M /branches/3.1/tests/tdiv_ui.c - M /branches/3.1/tests/teint.c - M /branches/3.1/tests/teq.c - M /branches/3.1/tests/terf.c - M /branches/3.1/tests/tests.c - M /branches/3.1/tests/texceptions.c - M /branches/3.1/tests/texp.c - M /branches/3.1/tests/texp10.c - M /branches/3.1/tests/texp2.c - M /branches/3.1/tests/texpm1.c - M /branches/3.1/tests/tfactorial.c - M /branches/3.1/tests/tfits.c - M /branches/3.1/tests/tfma.c - M /branches/3.1/tests/tfmod.c - M /branches/3.1/tests/tfms.c - M /branches/3.1/tests/tfprintf.c - M /branches/3.1/tests/tfrac.c - M /branches/3.1/tests/tfrexp.c - M /branches/3.1/tests/tgamma.c - M /branches/3.1/tests/tgeneric.c - M /branches/3.1/tests/tgeneric_ui.c - M /branches/3.1/tests/tget_d.c - M /branches/3.1/tests/tget_d_2exp.c - M /branches/3.1/tests/tget_f.c - M /branches/3.1/tests/tget_flt.c - M /branches/3.1/tests/tget_ld_2exp.c - M /branches/3.1/tests/tget_set_d64.c - M /branches/3.1/tests/tget_sj.c - M /branches/3.1/tests/tget_str.c - M /branches/3.1/tests/tget_z.c - M /branches/3.1/tests/tgmpop.c - M /branches/3.1/tests/tgrandom.c - M /branches/3.1/tests/thyperbolic.c - M /branches/3.1/tests/thypot.c - M /branches/3.1/tests/tinits.c - M /branches/3.1/tests/tinp_str.c - M /branches/3.1/tests/tinternals.c - M /branches/3.1/tests/tisnan.c - M /branches/3.1/tests/tisqrt.c - M /branches/3.1/tests/tj0.c - M /branches/3.1/tests/tj1.c - M /branches/3.1/tests/tjn.c - M /branches/3.1/tests/tl2b.c - M /branches/3.1/tests/tlgamma.c - M /branches/3.1/tests/tli2.c - M /branches/3.1/tests/tlngamma.c - M /branches/3.1/tests/tlog.c - M /branches/3.1/tests/tlog10.c - M /branches/3.1/tests/tlog1p.c - M /branches/3.1/tests/tlog2.c - M /branches/3.1/tests/tmin_prec.c - M /branches/3.1/tests/tminmax.c - M /branches/3.1/tests/tmodf.c - M /branches/3.1/tests/tmul.c - M /branches/3.1/tests/tmul_2exp.c - M /branches/3.1/tests/tmul_d.c - M /branches/3.1/tests/tmul_ui.c - M /branches/3.1/tests/tnext.c - M /branches/3.1/tests/tout_str.c - M /branches/3.1/tests/toutimpl.c - M /branches/3.1/tests/tpow.c - M /branches/3.1/tests/tpow3.c - M /branches/3.1/tests/tpow_all.c - M /branches/3.1/tests/tpow_z.c - M /branches/3.1/tests/tprintf.c - M /branches/3.1/tests/trandom.c - M /branches/3.1/tests/trec_sqrt.c - M /branches/3.1/tests/tremquo.c - M /branches/3.1/tests/trint.c - M /branches/3.1/tests/troot.c - M /branches/3.1/tests/tround_prec.c - M /branches/3.1/tests/tsec.c - M /branches/3.1/tests/tsech.c - M /branches/3.1/tests/tset.c - M /branches/3.1/tests/tset_d.c - M /branches/3.1/tests/tset_exp.c - M /branches/3.1/tests/tset_f.c - M /branches/3.1/tests/tset_ld.c - M /branches/3.1/tests/tset_q.c - M /branches/3.1/tests/tset_si.c - M /branches/3.1/tests/tset_sj.c - M /branches/3.1/tests/tset_str.c - M /branches/3.1/tests/tset_z.c - M /branches/3.1/tests/tset_z_exp.c - M /branches/3.1/tests/tsgn.c - M /branches/3.1/tests/tsi_op.c - M /branches/3.1/tests/tsin.c - M /branches/3.1/tests/tsin_cos.c - M /branches/3.1/tests/tsinh.c - M /branches/3.1/tests/tsinh_cosh.c - M /branches/3.1/tests/tsprintf.c - M /branches/3.1/tests/tsqr.c - M /branches/3.1/tests/tsqrt.c - M /branches/3.1/tests/tsqrt_ui.c - M /branches/3.1/tests/tstckintc.c - M /branches/3.1/tests/tstdint.c - M /branches/3.1/tests/tstrtofr.c - M /branches/3.1/tests/tsub.c - M /branches/3.1/tests/tsub1sp.c - M /branches/3.1/tests/tsub_d.c - M /branches/3.1/tests/tsub_ui.c - M /branches/3.1/tests/tsubnormal.c - M /branches/3.1/tests/tsum.c - M /branches/3.1/tests/tswap.c - M /branches/3.1/tests/ttan.c - M /branches/3.1/tests/ttanh.c - M /branches/3.1/tests/ttrunc.c - M /branches/3.1/tests/tui_div.c - M /branches/3.1/tests/tui_pow.c - M /branches/3.1/tests/tui_sub.c - M /branches/3.1/tests/turandom.c - M /branches/3.1/tests/tvalist.c - M /branches/3.1/tests/tversion.c - M /branches/3.1/tests/ty0.c - M /branches/3.1/tests/ty1.c - M /branches/3.1/tests/tyn.c - M /branches/3.1/tests/tzeta.c - M /branches/3.1/tests/tzeta_ui.c - M /branches/3.1/tools/get_patches.sh - M /branches/3.1/tune/bidimensional_sample.c - M /branches/3.1/tune/speed.c - M /branches/3.1/tune/tuneup.c + M /branches/4.0 + M /branches/4.0/doc/README.dev + M /branches/4.0/tests + M /branches/4.0/tests/tprintf.c + M /branches/4.0/tests/tsprintf.c -Replaced - Contributed by the AriC and Caramel projects -by - Contributed by the AriC and Caramba projects +Added MPFR_CHECK_LOCALES environment variable for the tests (to be +used by developers): when set, terminate with an error if locales +cannot be tested. +(merged changeset r12870 from the trunk; merging tests/tprintf.c r12861 +was needed first) ------------------------------------------------------------------------ -r9894 | vlefevre | 2016-01-29 14:27:41 +0000 (Fri, 29 Jan 2016) | 2 lines +r12793 | vlefevre | 2018-06-20 12:17:11 +0000 (Wed, 20 Jun 2018) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/configure.ac + M /branches/4.0/tests/tget_set_d64.c -[configure.ac] Improved consistency in messages. -(merged changeset r9893 from the trunk) +[tests/tget_set_d64.c] Tests on powers of 10: test negative numbers too. +(merged part of changeset r12792 from the trunk) ------------------------------------------------------------------------ -r9862 | vlefevre | 2016-01-21 09:17:30 +0000 (Thu, 21 Jan 2016) | 4 lines +r12786 | vlefevre | 2018-06-19 13:10:42 +0000 (Tue, 19 Jun 2018) | 5 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tsqrt.c + M /branches/4.0/src/set_d64.c + M /branches/4.0/tests/tget_set_d64.c -[tests/tsqrt.c] Improved testcase for the mpfr_sqrt bug fixed in r9860, -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) +[src/set_d64.c] Fixed ternary value, which was always 0. This is done by + using mpfr_strtofr instead of mpfr_set_str (merged part of changeset + r12783 from the trunk). +[tests/tget_set_d64.c] Added tests on powers of 10, checking the ternary + value in particular (merged part of changeset r12782 from the trunk). ------------------------------------------------------------------------ -r9860 | vlefevre | 2016-01-21 00:52:24 +0000 (Thu, 21 Jan 2016) | 3 lines +r12785 | vlefevre | 2018-06-19 12:55:53 +0000 (Tue, 19 Jun 2018) | 5 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/sqrt.c - M /branches/3.1/tests/tsqrt.c + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/tstckintc.c -Fixed bug in mpfr_sqrt reported by Fredrik Johansson, occurring when -the result has to be rounded up to a power of 2. -(merged changesets r9857-9859 from the trunk) +[tests/tstckintc.c] Avoid false warnings with -Wcast-align=strict from +GCC 8.1 by adding casts "(long *) (void *)", still allowing checks of +other alignment requirements (which are not handled by the tstckintc.c +code). +(merged changeset r12698 from the trunk) ------------------------------------------------------------------------ -r9855 | vlefevre | 2016-01-20 15:29:28 +0000 (Wed, 20 Jan 2016) | 2 lines +r12760 | vlefevre | 2018-06-06 11:05:33 +0000 (Wed, 06 Jun 2018) | 6 lines Changed paths: - M /branches/3.1 - M /branches/3.1/doc/algorithms.tex - M /branches/3.1/src/zeta.c - M /branches/3.1/tests/tzeta.c + M /branches/4.0 + A /branches/4.0/codespell.exclude (from /trunk/codespell.exclude:12754) + M /branches/4.0/codespell.ignore + M /branches/4.0/tools/mpfrlint -Fixed bug for zeta(s) with s near an even negative integer. -(merged changesets r9852-9854 from the trunk) +codespell: simplified exceptions. + * Added codespell.exclude file. + * codespell.ignore: removed some words (particular cases). + * tools/mpfrlint: use the codespell.exclude exclude file, and for + the doc directory, replaced -S by an explicit list of files. +(merged changesets r12486,12497,12753-12754 from the trunk) ------------------------------------------------------------------------ -r9849 | vlefevre | 2016-01-20 13:57:31 +0000 (Wed, 20 Jan 2016) | 9 lines +r12750 | vlefevre | 2018-06-02 22:22:50 +0000 (Sat, 02 Jun 2018) | 4 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tgeneric.c + M /branches/4.0 + M /branches/4.0/src/invert_limb.h -[tests/tgeneric.c] Improved the generic tests in order to trigger the -mpfr_jn bug found by Fredrik Johansson (r9845) and potential similar -bugs: For half cases, the precision of the inputs was modified to be -smaller than the base precision (for the result). Here, this rule is -changed so that if the base precision is small (< 16), then the -precision of the inputs is chosen to be significantly *larger* than -the base precision in general. -Note: With this improvement, both tj0 and tj1 fail in r9844. -(merged changeset r9848 from the trunk; conflict resolved) +[src/invert_limb.h] fixed two typos reported by Marco Bodrato. +Note that with the current MPFR code, these typos did not have +any consequence. +(merged changeset r12749 from the trunk) ------------------------------------------------------------------------ -r9845 | vlefevre | 2016-01-20 09:25:16 +0000 (Wed, 20 Jan 2016) | 2 lines +r12743 | vlefevre | 2018-05-31 14:47:16 +0000 (Thu, 31 May 2018) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/doc/algorithms.tex - M /branches/3.1/src/jyn_asympt.c - M /branches/3.1/tests/tj0.c + M /branches/4.0/doc/mpfr.texi -Fixed bug found by Fredrik Johansson in the mpfr_jn family of functions. -(merged changesets r9841-9842,9844 from the trunk) +[doc/mpfr.texi] Updated the month. ------------------------------------------------------------------------ -r9782 | vlefevre | 2016-01-01 02:28:53 +0000 (Fri, 01 Jan 2016) | 1 line +r12741 | vlefevre | 2018-05-31 14:41:37 +0000 (Thu, 31 May 2018) | 2 lines Changed paths: - M /branches/3.1/doc/mpfr.texi + M /branches/4.0 + M /branches/4.0/AUTHORS + M /branches/4.0/INSTALL + M /branches/4.0/doc/algorithms.tex + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/examples/sample.c + M /branches/4.0/mpfr.pc.in + M /branches/4.0/tests + M /branches/4.0/tests/tests.c + M /branches/4.0/tools/cfarm.sh + M /branches/4.0/tools/update-version + +Updated mpfr.org URL's to use https (except in ChangeLog and NEWS). +(marked changeset r12740 as merged from the trunk) +------------------------------------------------------------------------ +r12736 | vlefevre | 2018-05-30 17:45:00 +0000 (Wed, 30 May 2018) | 2 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/tools/announce-text + +[tools/announce-text] http → https (for mpfr.org). +(merged changeset r12734 from the trunk) +------------------------------------------------------------------------ +r12735 | vlefevre | 2018-05-30 17:44:10 +0000 (Wed, 30 May 2018) | 6 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/doc/FAQ.html + M /branches/4.0/doc/faq.xsl + M /branches/4.0/doc/update-faq + +[doc] Changes due to the https support by mpfr.org. + * faq.xsl: for the visual.css, use a local URL since libxml2 does not + support https. + * update-faq: download visual.css from mpfr.org first. + * FAQ.html: update with update-faq. +(merged changesets r12731-12733 from the trunk) +------------------------------------------------------------------------ +r12680 | vlefevre | 2018-04-26 15:33:52 +0000 (Thu, 26 Apr 2018) | 8 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/src/inp_str.c + M /branches/4.0/src/out_str.c + +[src/{inp_str.c,out_str.c}] For mpfr_inp_str and mpfr_out_str, when +the stream was a null pointer, it was replaced by stdin and stdout, +respectively. No longer do that, since: + * This behavior was useless, not documented, and not consistent + with other I/O functions. + * Just in case a null pointer for the stream has a special meaning + with some C implementation, MPFR was not behaving as documented. +(merged changesets r12520-12521 from the trunk) +------------------------------------------------------------------------ +r12679 | vlefevre | 2018-04-26 15:17:30 +0000 (Thu, 26 Apr 2018) | 6 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/src/gmp_op.c + M /branches/4.0/tests + M /branches/4.0/tests/tgmpop.c + +[src/gmp_op.c] Fixed a bug in mpfr_cmp_q on NaN rational: the NaN flag + was set by mpfr_set_q, but the flags were not restored just after. +[tests/tgmpop.c] For mpfr_cmp_q, improved the test where x is NaN by + checking all the flags (not just erange) and added a test where y is + a NaN rational. +(merged changesets r12343,12677 from the trunk) +------------------------------------------------------------------------ +r12675 | vlefevre | 2018-04-26 13:13:57 +0000 (Thu, 26 Apr 2018) | 1 line +Changed paths: + M /branches/4.0/tests + M /branches/4.0/tests/tcan_round.c + M /branches/4.0/tests/tconst_pi.c + M /branches/4.0/tests/tfpif.c + M /branches/4.0/tests/tgrandom.c + M /branches/4.0/tests/tpow.c + M /branches/4.0/tests/ttan.c + +Merged recent tests from the trunk (r12500-12555,12558,12561). +------------------------------------------------------------------------ +r12674 | vlefevre | 2018-04-26 12:59:37 +0000 (Thu, 26 Apr 2018) | 5 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/Makefile.am + +[tests/Makefile.am] Update of the "check" rule: + * Output svnversion info when applicable. + * Do not echo (complex) commands. + * Do not output a useless "PASS ..." line at the end. +(merged changesets r12535-12536 from the trunk) +------------------------------------------------------------------------ +r12664 | vlefevre | 2018-04-25 15:06:34 +0000 (Wed, 25 Apr 2018) | 4 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/src/gmp_op.c + M /branches/4.0/tests + M /branches/4.0/tests/tgmpop.c + +[src/gmp_op.c] Fixed bug in mpfr_cmp_q when the denominator of the + mpq_t argument is 0. +[tests/tgmpop.c] Added tests. +(merged changesets r12499,12502 from the trunk) +------------------------------------------------------------------------ +r12663 | vlefevre | 2018-04-25 15:00:21 +0000 (Wed, 25 Apr 2018) | 1 line +Changed paths: + M /branches/4.0/doc/mpfr.texi [doc/mpfr.texi] Updated the month. ------------------------------------------------------------------------ -r9781 | vlefevre | 2016-01-01 02:27:59 +0000 (Fri, 01 Jan 2016) | 5 lines +r12662 | vlefevre | 2018-04-25 14:45:45 +0000 (Wed, 25 Apr 2018) | 1 line Changed paths: - M /branches/3.1/BUGS - M /branches/3.1/INSTALL - M /branches/3.1/Makefile.am - M /branches/3.1/NEWS - M /branches/3.1/README - M /branches/3.1/TODO - M /branches/3.1/acinclude.m4 - M /branches/3.1/configure.ac - M /branches/3.1/doc/FAQ.html - M /branches/3.1/doc/Makefile.am - M /branches/3.1/doc/README.dev - M /branches/3.1/doc/faq.xsl - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/examples/divworst.c - M /branches/3.1/examples/rndo-add.c - M /branches/3.1/examples/sample.c - M /branches/3.1/examples/version.c - M /branches/3.1/src/Makefile.am - M /branches/3.1/src/abort_prec_max.c - M /branches/3.1/src/acos.c - M /branches/3.1/src/acosh.c - M /branches/3.1/src/add.c - M /branches/3.1/src/add1.c - M /branches/3.1/src/add1sp.c - M /branches/3.1/src/add_d.c - M /branches/3.1/src/add_ui.c - M /branches/3.1/src/agm.c - M /branches/3.1/src/ai.c - M /branches/3.1/src/amd/amdfam10/mparam.h - M /branches/3.1/src/amd/athlon/mparam.h - M /branches/3.1/src/amd/k8/mparam.h - M /branches/3.1/src/arm/mparam.h - M /branches/3.1/src/asin.c - M /branches/3.1/src/asinh.c - M /branches/3.1/src/atan.c - M /branches/3.1/src/atan2.c - M /branches/3.1/src/atanh.c - M /branches/3.1/src/bernoulli.c - M /branches/3.1/src/buildopt.c - M /branches/3.1/src/cache.c - M /branches/3.1/src/cbrt.c - M /branches/3.1/src/check.c - M /branches/3.1/src/clear.c - M /branches/3.1/src/clears.c - M /branches/3.1/src/cmp.c - M /branches/3.1/src/cmp2.c - M /branches/3.1/src/cmp_abs.c - M /branches/3.1/src/cmp_d.c - M /branches/3.1/src/cmp_ld.c - M /branches/3.1/src/cmp_si.c - M /branches/3.1/src/cmp_ui.c - M /branches/3.1/src/comparisons.c - M /branches/3.1/src/const_catalan.c - M /branches/3.1/src/const_euler.c - M /branches/3.1/src/const_log2.c - M /branches/3.1/src/const_pi.c - M /branches/3.1/src/constant.c - M /branches/3.1/src/copysign.c - M /branches/3.1/src/cos.c - M /branches/3.1/src/cosh.c - M /branches/3.1/src/cot.c - M /branches/3.1/src/coth.c - M /branches/3.1/src/csc.c - M /branches/3.1/src/csch.c - M /branches/3.1/src/d_div.c - M /branches/3.1/src/d_sub.c - M /branches/3.1/src/digamma.c - M /branches/3.1/src/dim.c - M /branches/3.1/src/div.c - M /branches/3.1/src/div_2exp.c - M /branches/3.1/src/div_2si.c - M /branches/3.1/src/div_2ui.c - M /branches/3.1/src/div_d.c - M /branches/3.1/src/div_ui.c - M /branches/3.1/src/dump.c - M /branches/3.1/src/eint.c - M /branches/3.1/src/eq.c - M /branches/3.1/src/erf.c - M /branches/3.1/src/erfc.c - M /branches/3.1/src/exceptions.c - M /branches/3.1/src/exp.c - M /branches/3.1/src/exp10.c - M /branches/3.1/src/exp2.c - M /branches/3.1/src/exp3.c - M /branches/3.1/src/exp_2.c - M /branches/3.1/src/expm1.c - M /branches/3.1/src/extract.c - M /branches/3.1/src/factorial.c - M /branches/3.1/src/fits_intmax.c - M /branches/3.1/src/fits_s.h - M /branches/3.1/src/fits_sint.c - M /branches/3.1/src/fits_slong.c - M /branches/3.1/src/fits_sshort.c - M /branches/3.1/src/fits_u.h - M /branches/3.1/src/fits_uint.c - M /branches/3.1/src/fits_uintmax.c - M /branches/3.1/src/fits_ulong.c - M /branches/3.1/src/fits_ushort.c - M /branches/3.1/src/fma.c - M /branches/3.1/src/fms.c - M /branches/3.1/src/frac.c - M /branches/3.1/src/free_cache.c - M /branches/3.1/src/frexp.c - M /branches/3.1/src/gamma.c - M /branches/3.1/src/gammaonethird.c - M /branches/3.1/src/gen_inverse.h - M /branches/3.1/src/generic/mparam.h - M /branches/3.1/src/get_d.c - M /branches/3.1/src/get_d64.c - M /branches/3.1/src/get_exp.c - M /branches/3.1/src/get_f.c - M /branches/3.1/src/get_flt.c - M /branches/3.1/src/get_ld.c - M /branches/3.1/src/get_si.c - M /branches/3.1/src/get_sj.c - M /branches/3.1/src/get_str.c - M /branches/3.1/src/get_ui.c - M /branches/3.1/src/get_uj.c - M /branches/3.1/src/get_z.c - M /branches/3.1/src/get_z_exp.c - M /branches/3.1/src/gmp_op.c - M /branches/3.1/src/grandom.c - M /branches/3.1/src/hppa/mparam.h - M /branches/3.1/src/hypot.c - M /branches/3.1/src/ia64/mparam.h - M /branches/3.1/src/ieee_floats.h - M /branches/3.1/src/init.c - M /branches/3.1/src/init2.c - M /branches/3.1/src/inits.c - M /branches/3.1/src/inits2.c - M /branches/3.1/src/inp_str.c - M /branches/3.1/src/int_ceil_log2.c - M /branches/3.1/src/isinf.c - M /branches/3.1/src/isinteger.c - M /branches/3.1/src/isnan.c - M /branches/3.1/src/isnum.c - M /branches/3.1/src/isqrt.c - M /branches/3.1/src/isregular.c - M /branches/3.1/src/iszero.c - M /branches/3.1/src/jn.c - M /branches/3.1/src/jyn_asympt.c - M /branches/3.1/src/li2.c - M /branches/3.1/src/lngamma.c - M /branches/3.1/src/log.c - M /branches/3.1/src/log10.c - M /branches/3.1/src/log1p.c - M /branches/3.1/src/log2.c - M /branches/3.1/src/logging.c - M /branches/3.1/src/min_prec.c - M /branches/3.1/src/minmax.c - M /branches/3.1/src/modf.c - M /branches/3.1/src/mp_clz_tab.c - M /branches/3.1/src/mparam_h.in - M /branches/3.1/src/mpf2mpfr.h - M /branches/3.1/src/mpfr-gmp.c - M /branches/3.1/src/mpfr-gmp.h - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/src/mpfr-intmax.h - M /branches/3.1/src/mpfr-longlong.h - M /branches/3.1/src/mpfr-thread.h - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/mpn_exp.c - M /branches/3.1/src/mul.c - M /branches/3.1/src/mul_2exp.c - M /branches/3.1/src/mul_2si.c - M /branches/3.1/src/mul_2ui.c - M /branches/3.1/src/mul_d.c - M /branches/3.1/src/mul_ui.c - M /branches/3.1/src/mulders.c - M /branches/3.1/src/neg.c - M /branches/3.1/src/next.c - M /branches/3.1/src/out_raw.c - M /branches/3.1/src/out_str.c - M /branches/3.1/src/pow.c - M /branches/3.1/src/pow_si.c - M /branches/3.1/src/pow_ui.c - M /branches/3.1/src/pow_z.c - M /branches/3.1/src/powerof2.c - M /branches/3.1/src/powerpc32/mparam.h - M /branches/3.1/src/powerpc64/mparam.h - M /branches/3.1/src/print_raw.c - M /branches/3.1/src/print_rnd_mode.c - M /branches/3.1/src/printf.c - M /branches/3.1/src/rec_sqrt.c - M /branches/3.1/src/reldiff.c - M /branches/3.1/src/rem1.c - M /branches/3.1/src/rint.c - M /branches/3.1/src/root.c - M /branches/3.1/src/round_near_x.c - M /branches/3.1/src/round_p.c - M /branches/3.1/src/round_prec.c - M /branches/3.1/src/round_raw_generic.c - M /branches/3.1/src/scale2.c - M /branches/3.1/src/sec.c - M /branches/3.1/src/sech.c - M /branches/3.1/src/set.c - M /branches/3.1/src/set_d.c - M /branches/3.1/src/set_d64.c - M /branches/3.1/src/set_dfl_prec.c - M /branches/3.1/src/set_exp.c - M /branches/3.1/src/set_f.c - M /branches/3.1/src/set_flt.c - M /branches/3.1/src/set_inf.c - M /branches/3.1/src/set_ld.c - M /branches/3.1/src/set_nan.c - M /branches/3.1/src/set_prc_raw.c - M /branches/3.1/src/set_prec.c - M /branches/3.1/src/set_q.c - M /branches/3.1/src/set_rnd.c - M /branches/3.1/src/set_si.c - M /branches/3.1/src/set_si_2exp.c - M /branches/3.1/src/set_sj.c - M /branches/3.1/src/set_str.c - M /branches/3.1/src/set_str_raw.c - M /branches/3.1/src/set_ui.c - M /branches/3.1/src/set_ui_2exp.c - M /branches/3.1/src/set_uj.c - M /branches/3.1/src/set_z.c - M /branches/3.1/src/set_z_exp.c - M /branches/3.1/src/set_zero.c - M /branches/3.1/src/setmax.c - M /branches/3.1/src/setmin.c - M /branches/3.1/src/setsign.c - M /branches/3.1/src/sgn.c - M /branches/3.1/src/si_op.c - M /branches/3.1/src/signbit.c - M /branches/3.1/src/sin.c - M /branches/3.1/src/sin_cos.c - M /branches/3.1/src/sinh.c - M /branches/3.1/src/sinh_cosh.c - M /branches/3.1/src/sparc64/mparam.h - M /branches/3.1/src/sqr.c - M /branches/3.1/src/sqrt.c - M /branches/3.1/src/sqrt_ui.c - M /branches/3.1/src/stack_interface.c - M /branches/3.1/src/strtofr.c - M /branches/3.1/src/sub.c - M /branches/3.1/src/sub1.c - M /branches/3.1/src/sub1sp.c - M /branches/3.1/src/sub_d.c - M /branches/3.1/src/sub_ui.c - M /branches/3.1/src/subnormal.c - M /branches/3.1/src/sum.c - M /branches/3.1/src/swap.c - M /branches/3.1/src/tan.c - M /branches/3.1/src/tanh.c - M /branches/3.1/src/uceil_exp2.c - M /branches/3.1/src/uceil_log2.c - M /branches/3.1/src/ufloor_log2.c - M /branches/3.1/src/ui_div.c - M /branches/3.1/src/ui_pow.c - M /branches/3.1/src/ui_pow_ui.c - M /branches/3.1/src/ui_sub.c - M /branches/3.1/src/urandom.c - M /branches/3.1/src/urandomb.c - M /branches/3.1/src/vasprintf.c - M /branches/3.1/src/version.c - M /branches/3.1/src/volatile.c - M /branches/3.1/src/x86/core2/mparam.h - M /branches/3.1/src/x86/mparam.h - M /branches/3.1/src/x86_64/core2/mparam.h - M /branches/3.1/src/x86_64/pentium4/mparam.h - M /branches/3.1/src/yn.c - M /branches/3.1/src/zeta.c - M /branches/3.1/src/zeta_ui.c - M /branches/3.1/tests/Makefile.am - M /branches/3.1/tests/cmp_str.c - M /branches/3.1/tests/data/digamma - M /branches/3.1/tests/data/li2 - M /branches/3.1/tests/memory.c - M /branches/3.1/tests/mpf_compat.c - M /branches/3.1/tests/mpf_compat.h - M /branches/3.1/tests/mpfr-test.h - M /branches/3.1/tests/mpfr_compat.c - M /branches/3.1/tests/random2.c - M /branches/3.1/tests/reuse.c - M /branches/3.1/tests/rnd_mode.c - M /branches/3.1/tests/tabs.c - M /branches/3.1/tests/tacos.c - M /branches/3.1/tests/tacosh.c - M /branches/3.1/tests/tadd.c - M /branches/3.1/tests/tadd1sp.c - M /branches/3.1/tests/tadd_d.c - M /branches/3.1/tests/tadd_ui.c - M /branches/3.1/tests/tagm.c - M /branches/3.1/tests/tai.c - M /branches/3.1/tests/tasin.c - M /branches/3.1/tests/tasinh.c - M /branches/3.1/tests/tatan.c - M /branches/3.1/tests/tatanh.c - M /branches/3.1/tests/taway.c - M /branches/3.1/tests/tbuildopt.c - M /branches/3.1/tests/tcan_round.c - M /branches/3.1/tests/tcbrt.c - M /branches/3.1/tests/tcheck.c - M /branches/3.1/tests/tcmp.c - M /branches/3.1/tests/tcmp2.c - M /branches/3.1/tests/tcmp_d.c - M /branches/3.1/tests/tcmp_ld.c - M /branches/3.1/tests/tcmp_ui.c - M /branches/3.1/tests/tcmpabs.c - M /branches/3.1/tests/tcomparisons.c - M /branches/3.1/tests/tconst_catalan.c - M /branches/3.1/tests/tconst_euler.c - M /branches/3.1/tests/tconst_log2.c - M /branches/3.1/tests/tconst_pi.c - M /branches/3.1/tests/tcopysign.c - M /branches/3.1/tests/tcos.c - M /branches/3.1/tests/tcosh.c - M /branches/3.1/tests/tcot.c - M /branches/3.1/tests/tcoth.c - M /branches/3.1/tests/tcsc.c - M /branches/3.1/tests/tcsch.c - M /branches/3.1/tests/td_div.c - M /branches/3.1/tests/td_sub.c - M /branches/3.1/tests/tdigamma.c - M /branches/3.1/tests/tdim.c - M /branches/3.1/tests/tdiv.c - M /branches/3.1/tests/tdiv_d.c - M /branches/3.1/tests/tdiv_ui.c - M /branches/3.1/tests/teint.c - M /branches/3.1/tests/teq.c - M /branches/3.1/tests/terf.c - M /branches/3.1/tests/tests.c - M /branches/3.1/tests/texceptions.c - M /branches/3.1/tests/texp.c - M /branches/3.1/tests/texp10.c - M /branches/3.1/tests/texp2.c - M /branches/3.1/tests/texpm1.c - M /branches/3.1/tests/tfactorial.c - M /branches/3.1/tests/tfits.c - M /branches/3.1/tests/tfma.c - M /branches/3.1/tests/tfmod.c - M /branches/3.1/tests/tfms.c - M /branches/3.1/tests/tfprintf.c - M /branches/3.1/tests/tfrac.c - M /branches/3.1/tests/tfrexp.c - M /branches/3.1/tests/tgamma.c - M /branches/3.1/tests/tgeneric.c - M /branches/3.1/tests/tgeneric_ui.c - M /branches/3.1/tests/tget_d.c - M /branches/3.1/tests/tget_d_2exp.c - M /branches/3.1/tests/tget_f.c - M /branches/3.1/tests/tget_flt.c - M /branches/3.1/tests/tget_ld_2exp.c - M /branches/3.1/tests/tget_set_d64.c - M /branches/3.1/tests/tget_sj.c - M /branches/3.1/tests/tget_str.c - M /branches/3.1/tests/tget_z.c - M /branches/3.1/tests/tgmpop.c - M /branches/3.1/tests/tgrandom.c - M /branches/3.1/tests/thyperbolic.c - M /branches/3.1/tests/thypot.c - M /branches/3.1/tests/tinits.c - M /branches/3.1/tests/tinp_str.c - M /branches/3.1/tests/tinternals.c - M /branches/3.1/tests/tisnan.c - M /branches/3.1/tests/tisqrt.c - M /branches/3.1/tests/tj0.c - M /branches/3.1/tests/tj1.c - M /branches/3.1/tests/tjn.c - M /branches/3.1/tests/tl2b.c - M /branches/3.1/tests/tlgamma.c - M /branches/3.1/tests/tli2.c - M /branches/3.1/tests/tlngamma.c - M /branches/3.1/tests/tlog.c - M /branches/3.1/tests/tlog10.c - M /branches/3.1/tests/tlog1p.c - M /branches/3.1/tests/tlog2.c - M /branches/3.1/tests/tmin_prec.c - M /branches/3.1/tests/tminmax.c - M /branches/3.1/tests/tmodf.c - M /branches/3.1/tests/tmul.c - M /branches/3.1/tests/tmul_2exp.c - M /branches/3.1/tests/tmul_d.c - M /branches/3.1/tests/tmul_ui.c - M /branches/3.1/tests/tnext.c - M /branches/3.1/tests/tout_str.c - M /branches/3.1/tests/toutimpl.c - M /branches/3.1/tests/tpow.c - M /branches/3.1/tests/tpow3.c - M /branches/3.1/tests/tpow_all.c - M /branches/3.1/tests/tpow_z.c - M /branches/3.1/tests/tprintf.c - M /branches/3.1/tests/trandom.c - M /branches/3.1/tests/trec_sqrt.c - M /branches/3.1/tests/tremquo.c - M /branches/3.1/tests/trint.c - M /branches/3.1/tests/troot.c - M /branches/3.1/tests/tround_prec.c - M /branches/3.1/tests/tsec.c - M /branches/3.1/tests/tsech.c - M /branches/3.1/tests/tset.c - M /branches/3.1/tests/tset_d.c - M /branches/3.1/tests/tset_exp.c - M /branches/3.1/tests/tset_f.c - M /branches/3.1/tests/tset_ld.c - M /branches/3.1/tests/tset_q.c - M /branches/3.1/tests/tset_si.c - M /branches/3.1/tests/tset_sj.c - M /branches/3.1/tests/tset_str.c - M /branches/3.1/tests/tset_z.c - M /branches/3.1/tests/tset_z_exp.c - M /branches/3.1/tests/tsgn.c - M /branches/3.1/tests/tsi_op.c - M /branches/3.1/tests/tsin.c - M /branches/3.1/tests/tsin_cos.c - M /branches/3.1/tests/tsinh.c - M /branches/3.1/tests/tsinh_cosh.c - M /branches/3.1/tests/tsprintf.c - M /branches/3.1/tests/tsqr.c - M /branches/3.1/tests/tsqrt.c - M /branches/3.1/tests/tsqrt_ui.c - M /branches/3.1/tests/tstckintc.c - M /branches/3.1/tests/tstdint.c - M /branches/3.1/tests/tstrtofr.c - M /branches/3.1/tests/tsub.c - M /branches/3.1/tests/tsub1sp.c - M /branches/3.1/tests/tsub_d.c - M /branches/3.1/tests/tsub_ui.c - M /branches/3.1/tests/tsubnormal.c - M /branches/3.1/tests/tsum.c - M /branches/3.1/tests/tswap.c - M /branches/3.1/tests/ttan.c - M /branches/3.1/tests/ttanh.c - M /branches/3.1/tests/ttrunc.c - M /branches/3.1/tests/tui_div.c - M /branches/3.1/tests/tui_pow.c - M /branches/3.1/tests/tui_sub.c - M /branches/3.1/tests/turandom.c - M /branches/3.1/tests/tvalist.c - M /branches/3.1/tests/tversion.c - M /branches/3.1/tests/ty0.c - M /branches/3.1/tests/ty1.c - M /branches/3.1/tests/tyn.c - M /branches/3.1/tests/tzeta.c - M /branches/3.1/tests/tzeta_ui.c - M /branches/3.1/tools/ck-copyright-notice - M /branches/3.1/tools/ck-mparam - M /branches/3.1/tools/ck-version-info - M /branches/3.1/tools/get_patches.sh - M /branches/3.1/tune/Makefile.am - M /branches/3.1/tune/bidimensional_sample.c - M /branches/3.1/tune/speed.c - M /branches/3.1/tune/tuneup.c - -Copyright notice update: added 2016 with - perl -pi -e 's/ (\d{4}-)?(2015)(?= Free Software)/ - " ".($1||"$2-").($2+1)/e' **/*(^/) -under zsh (the m4 and tools/mbench directories were not modified). -Removed 2015 from the example in the doc/README.dev file. + M /branches/4.0/tests + M /branches/4.0/tests/tdiv_ui.c + M /branches/4.0/tests/tfma.c + M /branches/4.0/tests/tget_str.c + +Merged recent tests from the trunk (r12435-12453). +------------------------------------------------------------------------ +r12642 | vlefevre | 2018-04-19 15:51:55 +0000 (Thu, 19 Apr 2018) | 13 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/src/get_str.c + M /branches/4.0/tests + M /branches/4.0/tests/tget_str.c + +Fixed an issue with mpfr_get_str: The number 1 of significant digits +output in the string is now fully supported, i.e. + * the value 1 can be provided for n (4th argument); + * if n = 0, then the number of significant digits in the output string + can now be 1, as already implied by the documentation (but the code + was increasing it to 2). +Changes: + * doc/mpfr.texi: updated mpfr_get_str description to accept n = 1. + * src/get_str.c: fixed the code as explained above (for n = 0, + removed the increase to 2, and removed an MPFR_ASSERTN). + * tests/tget_str.c: added tests. +(merged changesets from the trunk: r12430 on tests/tget_str.c only; +r12432,12434,12440) +------------------------------------------------------------------------ +r12632 | vlefevre | 2018-04-19 13:33:00 +0000 (Thu, 19 Apr 2018) | 3 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/tget_flt.c + +[tests/tget_flt.c] Correction about the use of mpfr_signbit, in case +the implementation would change. +(merged changeset r12631 from the trunk) +------------------------------------------------------------------------ +r12630 | vlefevre | 2018-04-19 13:28:19 +0000 (Thu, 19 Apr 2018) | 1 line +Changed paths: + M /branches/4.0/tests + M /branches/4.0/tests/tbuildopt.c + M /branches/4.0/tests/tfma.c + M /branches/4.0/tests/tget_flt.c + M /branches/4.0/tests/tget_q.c + M /branches/4.0/tests/tget_set_d64.c + M /branches/4.0/tests/tset_z_exp.c + +Merged recent tests from the trunk (r12393-12424). +------------------------------------------------------------------------ +r12629 | vlefevre | 2018-04-19 13:17:34 +0000 (Thu, 19 Apr 2018) | 4 lines +Changed paths: + M /branches/4.0/src/sqr.c + M /branches/4.0/tests + M /branches/4.0/tests/tsqr.c + +[src/sqr.c] Fixed a bug in mpfr_sqr_1n in a rare case near underflow. +[tests/tsqr.c] Added tests, including non-regression for above bug +(manually patched src/sqr.c since r12398 had other, unrelated changes; +merged changesets r12398-12399 on tests/tsqr.c from the trunk) +------------------------------------------------------------------------ +r12624 | vlefevre | 2018-04-19 12:24:18 +0000 (Thu, 19 Apr 2018) | 4 lines +Changed paths: + M /branches/4.0/src/fma.c + M /branches/4.0/tests/tfma.c + +[src/fma.c] Fixed various bugs related to internal overflows/underflows. +[tests/tfma.c] Added tests. +(merged changesets r12393-12405,12583-12623 on these files from the +trunk) +------------------------------------------------------------------------ +r12581 | vlefevre | 2018-04-11 15:17:16 +0000 (Wed, 11 Apr 2018) | 8 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/terf.c + M /branches/4.0/tests/tpow.c + M /branches/4.0/tests/tpow_z.c + +[tests] Removed some useless #include's, in particular all the +unconditional #include occurrences. +Note: There is an incompatibility between glibc 2.27 and the math.h +provided by ICC 15 (at least), and this solves a compilation failure +in the build of the tests. +Moreover, is not required by freestanding implementations, +so that it may be better to avoid it if possible. +(merged changeset r12488 from the trunk) +------------------------------------------------------------------------ +r12580 | vlefevre | 2018-04-11 14:03:03 +0000 (Wed, 11 Apr 2018) | 3 lines +Changed paths: + M /branches/4.0/tests + M /branches/4.0/tests/tmul.c + +[tests] Merged the test from r12348, and replaced MUL_FFT_THRESHOLD +by its default value 8448 (since the definition of MUL_FFT_THRESHOLD +has not been moved in the 4.0 branch). +------------------------------------------------------------------------ +r12579 | vlefevre | 2018-04-11 13:54:39 +0000 (Wed, 11 Apr 2018) | 1 line +Changed paths: + M /branches/4.0/tests + M /branches/4.0/tests/tagm.c + M /branches/4.0/tests/tai.c + M /branches/4.0/tests/tdiv.c + M /branches/4.0/tests/tgmpop.c + M /branches/4.0/tests/tmul.c + M /branches/4.0/tests/tmul_2exp.c + M /branches/4.0/tests/tsqrt.c + M /branches/4.0/tests/tsub.c + M /branches/4.0/tests/tzeta.c + +Merged recent tests from the trunk (r12288-12347). +------------------------------------------------------------------------ +r12578 | vlefevre | 2018-04-11 13:16:15 +0000 (Wed, 11 Apr 2018) | 3 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/src/mul.c + M /branches/4.0/tests + M /branches/4.0/tests/tset_ld.c + M /branches/4.0/tests/tsub1sp.c + +Fixed type errors with -D_MPFR_PREC_FORMAT=2 in CFLAGS and the +--enable-assert=full configure option (signaled by GCC's -Wformat). +(merged changesets r12301-12302 from the trunk) +------------------------------------------------------------------------ +r12577 | vlefevre | 2018-04-11 13:06:53 +0000 (Wed, 11 Apr 2018) | 3 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/tests + M /branches/4.0/tests/tversion.c + +[tests/tversion.c] Output the sizes of long and intmax_t, and +"Generic ABI code" info (MPFR_GENERIC_ABI). +(merged changesets r12447,12575 from the trunk) +------------------------------------------------------------------------ +r12576 | vlefevre | 2018-04-11 13:02:27 +0000 (Wed, 11 Apr 2018) | 4 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/src/sub1sp.c + +[src/sub1sp.c] fixed bug in mpfr_sub1sp1n (corner case when a=c). +This fixes the failures from r12288. +(merged changeset r12285 from the trunk; note that the merge for +the tests directory had already been done via r12288) +------------------------------------------------------------------------ +r12480 | vlefevre | 2018-03-14 10:33:01 +0000 (Wed, 14 Mar 2018) | 2 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/src/mpfr-impl.h + +[src/mpfr-impl.h] Typo in a comment. +(merged changeset r12421 from the trunk) +------------------------------------------------------------------------ +r12475 | vlefevre | 2018-03-09 23:12:04 +0000 (Fri, 09 Mar 2018) | 2 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/TODO + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/src/atan.c + M /branches/4.0/src/cache.c + M /branches/4.0/src/fpif.c + M /branches/4.0/src/get_flt.c + M /branches/4.0/src/mpfr.h + M /branches/4.0/src/sum.c + M /branches/4.0/tests + M /branches/4.0/tests/terandom_chisq.c + M /branches/4.0/tests/tnrandom_chisq.c + +Fixed spelling mistakes found by codespell 1.12.0. +(merged changeset r12474 from the trunk) +------------------------------------------------------------------------ +r12470 | vlefevre | 2018-03-08 02:42:59 +0000 (Thu, 08 Mar 2018) | 6 lines +Changed paths: + M /branches/4.0 + A /branches/4.0/codespell.ignore (from /trunk/codespell.ignore:12469) + M /branches/4.0/doc/README.dev + M /branches/4.0/src/li2.c + M /branches/4.0/src/mpfr-gmp.h + M /branches/4.0/src/mpfr-thread.h + M /branches/4.0/src/vasprintf.c + M /branches/4.0/tests + M /branches/4.0/tests/tgmpop.c + M /branches/4.0/tests/tset_ld.c + M /branches/4.0/tools/mpfrlint + +Added codespell.ignore file with simple words to ignore with codespell +("cas"; "iff" as used in math; "nd" as the n comes from \n in printf, +but nd could also be a variable name; "te" as used as a variable name). +Updated tools/mpfrlint to use this file with codespell. +Fixed spelling mistakes found by codespell 1.11.0. +(merged changesets r12467-12469 from the trunk) ------------------------------------------------------------------------ -r9711 | vlefevre | 2015-10-29 13:39:59 +0000 (Thu, 29 Oct 2015) | 3 lines +r12465 | vlefevre | 2018-03-05 14:43:39 +0000 (Mon, 05 Mar 2018) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/mulders.c - M /branches/3.1/tests/tdiv.c + M /branches/4.0/doc/mpfr.texi -Fixed bug in mulders.c (affecting mpfr_div) reported by Ricky Farr: - -(merged changeset r9699 from the trunk; conflict resolved) +[doc/mpfr.texi] Updated the month. ------------------------------------------------------------------------ -r9698 | vlefevre | 2015-10-22 14:38:38 +0000 (Thu, 22 Oct 2015) | 3 lines +r12463 | vlefevre | 2018-03-05 10:46:53 +0000 (Mon, 05 Mar 2018) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/autogen.sh + M /branches/4.0 + M /branches/4.0/doc/mpfr.texi -[autogen.sh] Restore the INSTALL file also if the process receives -a usual signal (SIGHUP, SIGINT, SIGQUIT or SIGTERM). -(merged changeset r9697 from the trunk) +[doc/mpfr.texi] Typographic corrections for mpfr_subnormalize. +(merged changeset r12462 from the trunk) ------------------------------------------------------------------------ -r9664 | vlefevre | 2015-08-25 18:31:55 +0000 (Tue, 25 Aug 2015) | 3 lines +r12431 | vlefevre | 2018-02-23 17:00:13 +0000 (Fri, 23 Feb 2018) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/const_log2.c - M /branches/3.1/src/const_pi.c - M /branches/3.1/src/exceptions.c - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/src/set_dfl_prec.c - M /branches/3.1/src/set_rnd.c + M /branches/4.0/src/get_sj.c -Fixed warnings from GCC's -Wold-style-declaration option: -MPFR_THREAD_ATTR must be at beginning of declaration. -(merged changeset r8725 from the trunk) +[src/get_sj.c] And now that the incorrect assertions have been removed, +the condition sh >= 0 needs to be fixed to sh > 0... ------------------------------------------------------------------------ -r9644 | vlefevre | 2015-08-20 01:21:21 +0000 (Thu, 20 Aug 2015) | 2 lines +r12428 | vlefevre | 2018-02-23 16:24:21 +0000 (Fri, 23 Feb 2018) | 2 lines Changed paths: - M /branches/3.1/configure.ac + M /branches/4.0/src/get_sj.c -[configure.ac] Added test for usability of gmp.h at link time (needed -because of a known incompatibility between GMP 4.1 and GCC 5). +[src/get_sj.c] Removed unnecessary condition sh < GMP_NUMB_BITS, which +is incorrect with some C implementations. It came from r7047. ------------------------------------------------------------------------ -r9633 | vlefevre | 2015-07-20 22:20:21 +0000 (Mon, 20 Jul 2015) | 4 lines +r12288 | vlefevre | 2018-02-17 10:50:29 +0000 (Sat, 17 Feb 2018) | 3 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tversion.c - -[tests/tversion.c] - * Output MPFR_VERSION_STRING. - * Check and output additional mpfr_buildopt_* info. -(merged changesets r9630-9631 from the trunk) ------------------------------------------------------------------------- -r9621 | vlefevre | 2015-07-17 00:33:35 +0000 (Fri, 17 Jul 2015) | 4 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/src/frexp.c - M /branches/3.1/tests/tfrexp.c + M /branches/4.0/tests + M /branches/4.0/tests/tadd1sp.c + M /branches/4.0/tests/tfmma.c + M /branches/4.0/tests/tmul_2exp.c + M /branches/4.0/tests/tsub.c + M /branches/4.0/tests/tsub1sp.c -[src/frexp.c] Fixed a bug occurring when the current exponent range -does not contain 0. Handle internal overflow. -[tests/tfrexp.c] Added corresponding testcases. -(merged changesets r9592,9594,9599-9600,9613,9617,9619 from the trunk) ------------------------------------------------------------------------- -r9620 | vlefevre | 2015-07-17 00:26:03 +0000 (Fri, 17 Jul 2015) | 7 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/src/div_2si.c - M /branches/3.1/src/div_2ui.c - M /branches/3.1/src/mul_2si.c - M /branches/3.1/tests/tmul_2exp.c +Merged the latest tests from the trunk (r12258-12287). +tsub and tsub1sp fail (bug fixed in the trunk) with both 32-bit and +64-bit ABI's, except when MPFR is built with "-DMPFR_GENERIC_ABI". +------------------------------------------------------------------------ +r12258 | vlefevre | 2018-02-16 02:29:27 +0000 (Fri, 16 Feb 2018) | 3 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/tests/tsub.c -[src/{div_2si.c,div_2ui.c,mul_2si.c}] Fixed some underflow cases in -rounding to nearest when the exact result is -2^(emin-2), i.e. the -middle of 0 and the minimum negative number in absolute value (the -correction in r5517 was incorrect/incomplete). -[tests/tmul_2exp.c] Extended the underflow() test to negative numbers, -triggering the bug fixed here. -(merged changesets r9614,9616 from the trunk) +[tests/tsub.c] Added bug20180216 test currently failing in the trunk +in r12257. +(merged changesets r12256-12257 from the trunk) ------------------------------------------------------------------------ -r9608 | vlefevre | 2015-07-02 01:17:21 +0000 (Thu, 02 Jul 2015) | 4 lines +r12247 | vlefevre | 2018-02-15 14:31:18 +0000 (Thu, 15 Feb 2018) | 3 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/div_2si.c - M /branches/3.1/src/div_2ui.c - M /branches/3.1/src/mul_2si.c - M /branches/3.1/tests/tmul_2exp.c + M /branches/4.0 + M /branches/4.0/tests/tsub.c -[src/{div_2si.c,div_2ui.c,mul_2si.c}] Fixed overflow case when n = 0. -[tests/tmul_2exp.c] Added overflow tests (triggering the above bugs). -(merged changesets r9593,9595-9598 from the trunk, with mpfr_flags_t -replaced by unsigned int) +[tests/tsub.c] Added bug20180215 test currently failing in the trunk +in r12243. +(merged changeset r12246 from the trunk) ------------------------------------------------------------------------ -r9607 | vlefevre | 2015-07-02 00:51:31 +0000 (Thu, 02 Jul 2015) | 1 line +r12224 | vlefevre | 2018-02-13 12:17:25 +0000 (Tue, 13 Feb 2018) | 2 lines Changed paths: - M /branches/3.1/doc/mpfr.texi + M /branches/4.0 + M /branches/4.0/tests/tadd.c -[doc/mpfr.texi] Updated the month. +[tests/tadd.c] Added 2 tests that were failing in the trunk in r12220. +(merged changeset r12221 from the trunk) ------------------------------------------------------------------------ -r9606 | vlefevre | 2015-07-02 00:50:57 +0000 (Thu, 02 Jul 2015) | 7 lines +r12216 | vlefevre | 2018-02-08 02:11:23 +0000 (Thu, 08 Feb 2018) | 5 lines Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi + M /branches/4.0 + M /branches/4.0/tests/tfits.c + M /branches/4.0/tests/tfprintf.c + M /branches/4.0/tests/tget_set_d64.c + M /branches/4.0/tests/tget_sj.c + M /branches/4.0/tests/tprintf.c + M /branches/4.0/tests/tset_float128.c + M /branches/4.0/tests/tset_ld.c + M /branches/4.0/tests/tset_sj.c + M /branches/4.0/tests/tsprintf.c + M /branches/4.0/tests/tversion.c -[doc/mpfr.texi] Replaced periods ending a sentence by "@." in the -following cases: when the preceding character is a capital letter -or a closing parenthesis following a capital letter (e.g. "NaN.", -"MPFR.", "MPFR).", etc). This is needed to get correct spacing in -the generated .info and PDF files with the next sentence of the -paragraph (when there is one). -(merged changeset r8643 from the trunk) +[tests] + * tset_float128.c, tset_ld.c: removed obsolete WITH_FPU_CONTROL + related code. + * Added/updated comments about the config.h inclusion. +(merged changesets r12214-12215 from the trunk) ------------------------------------------------------------------------ -r9605 | vlefevre | 2015-07-02 00:47:18 +0000 (Thu, 02 Jul 2015) | 10 lines +r12213 | vlefevre | 2018-02-07 23:39:15 +0000 (Wed, 07 Feb 2018) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/lngamma.c - M /branches/3.1/tests/tlngamma.c - -[doc/mpfr.texi] Completed specification: - * on special numbers (±0, ±Inf); - * of mpfr_lngamma and mpfr_lgamma on 1 and 2 (result is +0); - * general rules for special values and on mpfr_lngamma. -[src/lngamma.c] Fixed mpfr_lngamma behavior on nonpositive integers - and -Inf. -[tests/tlngamma.c] Update. Test the flags for some special values. -See about -the behavior of mpfr_lngamma on zero and general rule for such limits. -(merged changesets r8629,8632-8633,8841,8847 from the trunk) + M /branches/4.0 + M /branches/4.0/INSTALL + +[INSTALL] Updated GMP URL. +(merged changeset r12212 from the trunk) ------------------------------------------------------------------------ -r9603 | vlefevre | 2015-07-02 00:15:21 +0000 (Thu, 02 Jul 2015) | 2 lines +r12211 | vlefevre | 2018-02-07 23:34:18 +0000 (Wed, 07 Feb 2018) | 1 line Changed paths: - M /branches/3.1/tools/mpfrlint + M /branches/4.0/NEWS -[tools/mpfrlint] Check a Texinfo rule (Section "Ending a Sentence") -with common words that end with a capital letter. +[NEWS] Update for GNU MPFR 4.0.2. ------------------------------------------------------------------------ -r9587 | vlefevre | 2015-06-19 22:39:52 +0000 (Fri, 19 Jun 2015) | 1 line +r12209 | vlefevre | 2018-02-07 23:31:36 +0000 (Wed, 07 Feb 2018) | 3 lines Changed paths: - M /branches/3.1/INSTALL - M /branches/3.1/VERSION - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/version.c + M /branches/4.0 + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/tools/mpfrlint -Updated version to 3.1.4-dev. +[doc/mpfr.texi] Corrected minimal GMP version. +[tools/mpfrlint] Updated test to detect minimal GMP version mismatch. +(merged changeset r12208 from the trunk) ------------------------------------------------------------------------ -r9583 | vlefevre | 2015-06-19 19:51:51 +0000 (Fri, 19 Jun 2015) | 1 line +r12207 | vlefevre | 2018-02-07 23:22:44 +0000 (Wed, 07 Feb 2018) | 3 lines Changed paths: - M /branches/3.1/ChangeLog + M /branches/4.0 + M /branches/4.0/INSTALL + M /branches/4.0/tools/mpfrlint -ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). +[INSTALL] Corrected minimal GMP version (thanks to David Edelsohn). +[tools/mpfrlint] Added a test to detect minimal GMP version mismatch. +(merged changeset r12206 from the trunk) ------------------------------------------------------------------------ -r9582 | vlefevre | 2015-06-19 19:50:16 +0000 (Fri, 19 Jun 2015) | 1 line +r12203 | vlefevre | 2018-02-07 16:18:16 +0000 (Wed, 07 Feb 2018) | 1 line Changed paths: - M /branches/3.1/VERSION - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/version.c + M /branches/4.0/INSTALL + M /branches/4.0/VERSION + M /branches/4.0/configure.ac + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/src/mpfr.h + M /branches/4.0/src/version.c -Updated version to 3.1.3. +Updated version to 4.0.2-dev. ------------------------------------------------------------------------ -r9577 | vlefevre | 2015-06-12 15:37:01 +0000 (Fri, 12 Jun 2015) | 1 line +r12201 | vlefevre | 2018-02-07 12:52:40 +0000 (Wed, 07 Feb 2018) | 1 line Changed paths: - M /branches/3.1/ChangeLog + M /branches/4.0/ChangeLog ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). ------------------------------------------------------------------------ -r9576 | vlefevre | 2015-06-12 15:34:37 +0000 (Fri, 12 Jun 2015) | 4 lines +r12200 | vlefevre | 2018-02-07 12:50:31 +0000 (Wed, 07 Feb 2018) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/doc/faq.xsl + M /branches/4.0/VERSION + M /branches/4.0/configure.ac + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/src/mpfr.h + M /branches/4.0/src/version.c -[doc/faq.xsl] Remove the indent="no" to get the same behavior as before -when using libxslt 1.1.27+. See: - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718535#10 -(merged changeset r9575 from the trunk) +Updated version to 4.0.1. ------------------------------------------------------------------------ -r9574 | vlefevre | 2015-06-12 15:22:10 +0000 (Fri, 12 Jun 2015) | 2 lines +r12199 | vlefevre | 2018-02-07 12:02:41 +0000 (Wed, 07 Feb 2018) | 3 lines Changed paths: - M /branches/3.1/VERSION - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/Makefile.am - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/version.c + M /branches/4.0 + M /branches/4.0/doc/README.dev + M /branches/4.0/tools/announce-text -Updated version to 3.1.3-rc1 and updated libmpfr_la_LDFLAGS in -src/Makefile.am for the next release. +[doc/README.dev] "To make a release": moved a sentence. +[tools/announce-text] For releases, check the VERSION file of the tag. +(merged changesets r12197-12198 from the trunk) ------------------------------------------------------------------------ -r9573 | vlefevre | 2015-06-12 14:04:56 +0000 (Fri, 12 Jun 2015) | 3 lines +r12195 | vlefevre | 2018-02-02 13:17:33 +0000 (Fri, 02 Feb 2018) | 4 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tfma.c + M /branches/4.0 + M /branches/4.0/tests/tdiv_ui.c -[tests/tfma.c] Improved the new underflow tests (test_underflow3) to -test FMA(-x,y,-z). -(merged changeset r9572 from the trunk) +[tests/tdiv_ui.c] Forcibly disable value coverage checking if +mp_limb_t > unsigned long (e.g. on mips64 with the n32 ABI). +Corrected comments. +(merged changesets r12193-12194 from the trunk) ------------------------------------------------------------------------ -r9570 | vlefevre | 2015-06-12 13:38:54 +0000 (Fri, 12 Jun 2015) | 4 lines +r12192 | vlefevre | 2018-02-02 12:34:56 +0000 (Fri, 02 Feb 2018) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/fma.c - M /branches/3.1/tests/tfma.c + M /branches/4.0/ChangeLog -[src/fma.c] Fixed the scaling in case of underflow. Added log messages. -[tests/tfma.c] Added testcases. Code clean-up. -(merged changesets r9560-9569 from the trunk, with mpfr_flags_t -replaced by unsigned int) +ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). ------------------------------------------------------------------------ -r9556 | vlefevre | 2015-06-11 00:55:01 +0000 (Thu, 11 Jun 2015) | 4 lines +r12191 | vlefevre | 2018-02-02 12:32:02 +0000 (Fri, 02 Feb 2018) | 6 lines Changed paths: - M /branches/3.1/src/urandomb.c - -[src/urandomb.c] Replaced mpn_copyd by MPN_COPY for GMP 4 compatibility. -Note: The trunk does something better (see r8813), but let's keep the -change minimal in this branch, in particular for code that is executed -very rarely (1/2^32 or 1/2^64 probability). + M /branches/4.0 + M /branches/4.0/tests/terandom.c + M /branches/4.0/tests/terandom_chisq.c + M /branches/4.0/tests/tgrandom.c + M /branches/4.0/tests/tnrandom.c + M /branches/4.0/tests/tnrandom_chisq.c + M /branches/4.0/tests/trandom.c + M /branches/4.0/tests/trandom_deviate.c + M /branches/4.0/tests/tset_ld.c + M /branches/4.0/tests/tsub_d.c + M /branches/4.0/tests/turandom.c + +[tests] + * Replaced calloc + free by tests_allocate + tests_free as usual. + * Replaced some fprintf with stderr by printf. + * Do bitwise operations in unsigned arithmetic. + * Formatting. +(merged changesets r12188-12190 from the trunk) +------------------------------------------------------------------------ +r12187 | vlefevre | 2018-02-02 10:57:17 +0000 (Fri, 02 Feb 2018) | 16 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/tests/tests.c + M /branches/4.0/tests/tremquo.c + M /branches/4.0/tests/tset_float128.c + M /branches/4.0/tests/tset_ld.c + +[tests] Fixed the cases where tests_start_mpfr was called too late, +i.e. after potential output (to stdout). + * tremquo.c: moved the call to tests_start_mpfr to the beginning. + * tset_float128.c, tset_ld.c: removed the optional, obsolete code + setting the FPU control word; MPFR_FPU_PREC can be used instead + (see tests.c). + +[tests/tests.c] Make stderr unbuffered again. +Note for the history: both stdout and stderr were made unbuffered in +r2361, then all stderr were changed to stdout (and the corresponding +setbuf on stderr removed) in r2449 for consistency, but stderr was +used later for specific cases (e.g. memory allocation errors or when +stdout is already used for something else), and it is also used for +assertion failures. Thus the setbuf on stderr is still needed. + +(merged changesets r12185-12186 from the trunk) +------------------------------------------------------------------------ +r12184 | vlefevre | 2018-02-02 10:14:04 +0000 (Fri, 02 Feb 2018) | 3 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/tests/tabort_defalloc1.c + M /branches/4.0/tests/tabort_defalloc2.c + M /branches/4.0/tests/tabort_prec_max.c + +Reverse-merged r12182 since tests_start_mpfr disables stdout buffering, +so that the fflush() are unnecessary. +(merged changeset r12183 from the trunk) +------------------------------------------------------------------------ +r12182 | vlefevre | 2018-02-02 09:55:12 +0000 (Fri, 02 Feb 2018) | 4 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/tests/tabort_defalloc1.c + M /branches/4.0/tests/tabort_defalloc2.c + M /branches/4.0/tests/tabort_prec_max.c + +[tests/tabort_*.c] Flush stdout after a printf(), as an abort() is +expected. This is needed on platforms where abort() does not flush +the stdio streams, such as with the GNU C Library (glibc) 2.27. +(merged changeset r12181 from the trunk) ------------------------------------------------------------------------ -r9555 | vlefevre | 2015-06-11 00:34:36 +0000 (Thu, 11 Jun 2015) | 2 lines +r12180 | vlefevre | 2018-02-01 14:31:06 +0000 (Thu, 01 Feb 2018) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/urandomb.c + M /branches/4.0/ChangeLog -[src/urandomb.c] Replaced mpn_copyi by mpn_copyd. -(merged changeset r8763 from the trunk) +ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). ------------------------------------------------------------------------ -r9554 | vlefevre | 2015-06-10 23:56:37 +0000 (Wed, 10 Jun 2015) | 5 lines +r12179 | vlefevre | 2018-02-01 14:28:02 +0000 (Thu, 01 Feb 2018) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tests/trandom.c + M /branches/4.0/NEWS -[tests/trandom.c] The use of mpfr_rands yielded a compilation failure -of trandom.c with --with-gmp-build; it should have been __gmp_rands or -RANDS. But let's do better by using a new gmp_randstate_t as done in -bug20100914(). -(merged changeset r9553 from the trunk) +[NEWS] Mention "make check-exported-symbols" (experimental). ------------------------------------------------------------------------ -r9552 | vlefevre | 2015-06-10 15:40:11 +0000 (Wed, 10 Jun 2015) | 4 lines +r12177 | vlefevre | 2018-02-01 14:22:32 +0000 (Thu, 01 Feb 2018) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/urandomb.c - M /branches/3.1/tests/trandom.c + M /branches/4.0/VERSION + M /branches/4.0/configure.ac + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/src/mpfr.h + M /branches/4.0/src/version.c -[src/urandomb.c] Fixed bug which could appear with probability 1/2^32 - (32-bit limbs) or 1/2^64 (64-bit limbs). -[tests/trandom.c] Added testcase for 32-bit limbs. -(merged changesets r8762,9550-9551 from the trunk) +Updated version to 4.0.1-rc2. ------------------------------------------------------------------------ -r9548 | vlefevre | 2015-06-10 10:47:35 +0000 (Wed, 10 Jun 2015) | 10 lines +r12176 | vlefevre | 2018-02-01 14:21:13 +0000 (Thu, 01 Feb 2018) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/cos.c - M /branches/3.1/src/sin.c + M /branches/4.0/doc/mpfr.texi -[src/{cos.c,sin.c}] Fixed bug related to the exponent range, introduced -in r6461 with the use of mpfr_sincos_fast. -Details: - For mpfr_sin, the exponent range was not restored, and restoring it - before calling mpfr_sincos_fast as this was done for mpfr_cos did - not work; indeed the source of this function shows that it needs an - extended exponent range. So, changed both mpfr_cos and mpfr_sin to - call mpfr_sincos_fast in the extended exponent range and restore the - exponent range at the end, like in usual code. -(merged changeset r9542 from the trunk) +[doc/mpfr.texi] Updated the month. ------------------------------------------------------------------------ -r9547 | vlefevre | 2015-06-10 10:45:39 +0000 (Wed, 10 Jun 2015) | 3 lines +r12175 | vlefevre | 2018-02-01 13:47:27 +0000 (Thu, 01 Feb 2018) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tsin.c + M /branches/4.0/NEWS -[tests/tsin.c] Added tests to check the mpfr_sin_fast call in src/sin.c, -which is currently buggy, modifying the exponent range in particular. -(merged changeset r8273 from the trunk) +[NEWS] Mention the mpfr_div_ui bug. ------------------------------------------------------------------------ -r9546 | vlefevre | 2015-06-10 10:41:54 +0000 (Wed, 10 Jun 2015) | 4 lines +r12170 | vlefevre | 2018-01-31 16:21:15 +0000 (Wed, 31 Jan 2018) | 3 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tgeneric.c + M /branches/4.0 + M /branches/4.0/src/div_ui.c + M /branches/4.0/src/mpfr-impl.h + M /branches/4.0/tests/tdiv_ui.c -[tests/tgeneric.c] Added overflow/underflow tests. Check whether the -exponent range has been modified by the tested function (which should -never happen). -(merged/ported changesets r9539,9541,9544 from the trunk) +Added value coverage for tdiv_ui (combinations of rb and sb in the +different cases of the mpfr_div_ui code) and other tests. +(merged changesets r12164-12169 from the trunk) ------------------------------------------------------------------------ -r9524 | vlefevre | 2015-06-08 00:54:03 +0000 (Mon, 08 Jun 2015) | 6 lines +r12164 | vlefevre | 2018-01-31 09:57:51 +0000 (Wed, 31 Jan 2018) | 5 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/zeta_ui.c - M /branches/3.1/tests/tzeta_ui.c + M /branches/4.0 + M /branches/4.0/src/div_ui.c + M /branches/4.0/tests/tdiv.c + M /branches/4.0/tests/tdiv_ui.c + M /branches/4.0/tools/mpfrlint -[src/zeta_ui.c] - * Support reduced exponent range for the generic case. - * Added logging. -[tests/tzeta_ui.c] Added tests in reduced exponent range. -(merged changesets r9518-9523 from the trunk, with mpfr_flags_t -replaced by unsigned int) +[src/div_ui.c] Major rewrite to fix a mpfr_div_ui bug. +[tests/tdiv.c] Updated comment for bug20180126. +[tests/tdiv_ui.c] Added tests triggering the bug just fixed. +[tools/mpfrlint] Improved a regexp (avoiding false positives). +(merged the remaining changesets starting at r12123 from the trunk) ------------------------------------------------------------------------ -r9522 | vlefevre | 2015-06-08 00:29:04 +0000 (Mon, 08 Jun 2015) | 2 lines +r12138 | vlefevre | 2018-01-27 03:52:35 +0000 (Sat, 27 Jan 2018) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/add_ui.c + M /branches/4.0 + M /branches/4.0/tests/tdiv.c -[src/add_ui.c] Fixed format string in MPFR_LOG_FUNC. -(merged changeset r9521 from the trunk) +[tests/tdiv.c] mpfr_div bug bug20180126: also test negative values. +(merged changeset r12137 from the trunk) ------------------------------------------------------------------------ -r9517 | vlefevre | 2015-06-05 08:53:56 +0000 (Fri, 05 Jun 2015) | 28 lines +r12135 | vlefevre | 2018-01-27 03:21:15 +0000 (Sat, 27 Jan 2018) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/set_q.c - M /branches/3.1/src/ui_div.c - M /branches/3.1/src/ui_sub.c - M /branches/3.1/tests/tadd_ui.c - M /branches/3.1/tests/tdiv_ui.c - M /branches/3.1/tests/tgeneric.c - M /branches/3.1/tests/tmul_ui.c - M /branches/3.1/tests/tpow_all.c - M /branches/3.1/tests/tset_q.c - M /branches/3.1/tests/tsub_ui.c - M /branches/3.1/tests/tui_div.c - M /branches/3.1/tests/tui_sub.c - -Various fixes, improvements and new tests concerning the exponent range -and exceptions (flags). Details: - -[src/set_q.c] - * Added missing MPFR_SAVE_EXPO_FREE in case of preliminary overflow - or underflow (extreme cases). - * Replaced a "return" by MPFR_RET: this is at least needed in the - extreme case cd != 0, and safer in general. - -[src/{ui_div.c,ui_sub.c}] Correction for reduced exponent range. - -[tests/tgeneric.c] Major clean-up, with some minor corrections. -Added support for unsigned long argument, which can be the first -or the second one (another intent is to replace tgeneric_ui.c, -which does fewer tests concerning the flags). - -[tests/t{add,div,mul,sub}_ui.c] Replaced tgeneric_ui.c by tgeneric.c, -showing the mpfr_mul_ui bug fixed in r9516 (missing inexact flag). + M /branches/4.0 + M /branches/4.0/tests/tdiv.c -[tests/tpow_all.c] Better flags output in error message. - -[tests/tset_q.c] Check the flags. - -[tests/{tui_div.c,tui_sub.c}] Added generic tests, yielding assertion -failures without the above fix when assertions are checked. Added a -new test checking overflow. - -(merged changesets r9494-9514 from the trunk) +[tests/tdiv.c] mpfr_div bug bug20180126 was introduced by r9086. +(merged changeset r12134 from the trunk) ------------------------------------------------------------------------ -r9516 | vlefevre | 2015-06-05 08:34:34 +0000 (Fri, 05 Jun 2015) | 2 lines +r12133 | vlefevre | 2018-01-26 17:04:38 +0000 (Fri, 26 Jan 2018) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/mul_ui.c + M /branches/4.0 + M /branches/4.0/tests/tdiv.c -[src/mul_ui.c] Fixed bug in mpfr_mul_ui/si: the inexact flag wasn't set. -(merged changeset r9505 from the trunk) +[tests/tdiv.c] Completed r12128 test with new comments and an assert. +(merged changeset r12132 from the trunk) ------------------------------------------------------------------------ -r9501 | vlefevre | 2015-06-04 10:08:54 +0000 (Thu, 04 Jun 2015) | 2 lines +r12130 | vlefevre | 2018-01-26 15:29:25 +0000 (Fri, 26 Jan 2018) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tdiv_d.c + M /branches/4.0/VERSION + M /branches/4.0/configure.ac + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/src/mpfr.h + M /branches/4.0/src/version.c -[tests/tdiv_d.c] Corrected the tested function for the generic tests. -(merged changeset r9500 from the trunk) +Updated version to 4.0.1-dev. ------------------------------------------------------------------------ -r9499 | vlefevre | 2015-06-04 10:04:47 +0000 (Thu, 04 Jun 2015) | 2 lines +r12129 | vlefevre | 2018-01-26 15:28:39 +0000 (Fri, 26 Jan 2018) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/td_div.c + M /branches/4.0 + M /branches/4.0/tests/tdiv.c -[tests/td_div.c] Corrected the tested function for the generic tests. -(merged changeset r9498 from the trunk) +[tests/tdiv.c] Added test case for a mpfr_div bug of MPFR 4. +(merged changeset r12128 from the trunk) ------------------------------------------------------------------------ -r9496 | vlefevre | 2015-06-04 02:07:49 +0000 (Thu, 04 Jun 2015) | 2 lines +r12127 | vlefevre | 2018-01-25 15:19:15 +0000 (Thu, 25 Jan 2018) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tgeneric_ui.c + M /branches/4.0 + M /branches/4.0/doc/README.dev -[tests/tgeneric_ui.c] Added missing \n. Minor improvements. -(merged changeset r9495 from the trunk) +[doc/README.dev] Added information about symbol checking. +(merged changeset r12126 from the trunk) ------------------------------------------------------------------------ -r9493 | vlefevre | 2015-06-03 14:27:31 +0000 (Wed, 03 Jun 2015) | 8 lines +r12125 | vlefevre | 2018-01-25 14:46:21 +0000 (Thu, 25 Jan 2018) | 8 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/rint.c - M /branches/3.1/tests/trint.c - -[src/rint.c] Simplified and fixed the mpfr_rint_* functions: in some - corner cases, an intermediate overflow would not be propagated. - Handle reduced exponent range. -[tests/trint.c] Added generic tests for the mpfr_rint_* functions. - Since all numbers in ]0,1/2[ round to the same value, in order to - avoid redundant tests, increased the TEST_RANDOM_EMIN value to -20 - and set TEST_RANDOM_ALWAYS_SCALE to 1. Added basic tests. -(merged changesets r8953,9472-9473,9476-9492 from the trunk) ------------------------------------------------------------------------- -r9491 | vlefevre | 2015-06-03 14:16:59 +0000 (Wed, 03 Jun 2015) | 12 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/tests/mpfr-test.h - M /branches/3.1/tests/tests.c - M /branches/3.1/tests/tfprintf.c - M /branches/3.1/tests/tgeneric.c - M /branches/3.1/tests/tprintf.c - M /branches/3.1/tests/tsin_cos.c - -[tests] Added always_scale argument (boolean) to tests_default_random() -so that when it is true, scaling is always performed on random numbers -generated by mpfr_urandomb(), instead of preferring numbers of the order -of magnitude of 1 for half outputs. This will be useful for mpfr_rint_* -tests. - -For tgeneric.c, the value of this argument is controlled by a new macro -TEST_RANDOM_ALWAYS_SCALE (0 by default, which corresponds to the current -behavior). For the other tests that call tests_default_random(), the -argument is set to 0, so that the behavior remains the same. + M /branches/4.0 + M /branches/4.0/Makefile.am + M /branches/4.0/doc/README.dev + M /branches/4.0/src/Makefile.am -(merged changeset r9471 from the trunk) +* Added check-exported-symbols make rule to check that MPFR does not + define symbols with a GMP reserved prefix. +* For the check-gmp-symbols and check-exported-symbols make rules, if + the library is not $(top_builddir)/src/.libs/libmpfr.so, these rules + do nothing instead of potentially failing. +* doc/README.dev, "To make a release": mention "make check-gmp-symbols" + and "make check-exported-symbols". +(merged changesets r12111-12114 from the trunk) ------------------------------------------------------------------------ -r9483 | vlefevre | 2015-06-02 12:20:53 +0000 (Tue, 02 Jun 2015) | 3 lines +r12123 | vlefevre | 2018-01-23 09:41:27 +0000 (Tue, 23 Jan 2018) | 4 lines Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi + M /branches/4.0 + M /branches/4.0/tests/tests.c -[doc/mpfr.texi] Added description of the flags for the mpfr_rint, -mpfr_ceil, mpfr_floor, mpfr_round, mpfr_trunc functions. -(merged changeset r9482 from the trunk) +[tests/tests.c] Mention a libtool 2.4.6 bug concerning Solaris, yielding +potential failures if a compatible MPFR version is already installed: +this MPFR library is tested instead of the one that has just been built. +(merged changeset r12122 from the trunk) ------------------------------------------------------------------------ -r9479 | vlefevre | 2015-05-31 09:49:05 +0000 (Sun, 31 May 2015) | 3 lines +r12121 | vlefevre | 2018-01-22 13:58:27 +0000 (Mon, 22 Jan 2018) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/configure.ac + M /branches/4.0/ChangeLog -[configure.ac] For the gcc compiler, better choice of the -W flags -when the selected language is C++ (e.g. when CC=g++). -(merged changeset r9478 from the trunk) +ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). ------------------------------------------------------------------------ -r9475 | vlefevre | 2015-05-29 11:19:54 +0000 (Fri, 29 May 2015) | 2 lines +r12120 | vlefevre | 2018-01-22 13:56:18 +0000 (Mon, 22 Jan 2018) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi + M /branches/4.0/src/Makefile.am -[doc/mpfr.texi] Added blank lines to improve readability. -(merged changeset r9474 from the trunk) +[src/Makefile.am] Updated libmpfr_la_LDFLAGS for MPFR 4.0.1. ------------------------------------------------------------------------ -r9470 | vlefevre | 2015-05-29 08:55:40 +0000 (Fri, 29 May 2015) | 2 lines +r12119 | vlefevre | 2018-01-22 13:53:01 +0000 (Mon, 22 Jan 2018) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi + M /branches/4.0/VERSION + M /branches/4.0/configure.ac + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/src/mpfr.h + M /branches/4.0/src/version.c + +Updated version to 4.0.1-rc1. +------------------------------------------------------------------------ +r12118 | vlefevre | 2018-01-22 12:21:10 +0000 (Mon, 22 Jan 2018) | 1 line +Changed paths: + M /branches/4.0/NEWS + +[NEWS] + Improved __GMP_CC and __GMP_CFLAGS retrieval. +------------------------------------------------------------------------ +r12116 | vlefevre | 2018-01-22 01:51:10 +0000 (Mon, 22 Jan 2018) | 4 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/configure.ac + +[configure.ac] In the CC and CFLAGS setup from gmp.h, added to the +cpp list: "clang -E"; "cl -E" and "icl -E" for Windows ICC and MSVC +(suggested by Alexander). +(merged changeset r12115 from the trunk) +------------------------------------------------------------------------ +r12110 | vlefevre | 2018-01-19 11:36:10 +0000 (Fri, 19 Jan 2018) | 1 line +Changed paths: + M /branches/4.0/NEWS + +[NEWS] Mention the bug fix r12109. +------------------------------------------------------------------------ +r12109 | vlefevre | 2018-01-19 00:27:24 +0000 (Fri, 19 Jan 2018) | 6 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/src/mp_clz_tab.c + M /branches/4.0/src/mpfr-gmp.h + +Correct fix for the use of __clz_tab when the GMP build is used. + * src/mpfr-gmp.h: reverse-merged r11969, which is incorrect and + yields a build failure under some conditions. + * src/mp_clz_tab.c: fixed the condition that tests whether the + GMP build is used. +(merged changesets r12107-12108 from the trunk) +------------------------------------------------------------------------ +r12106 | vlefevre | 2018-01-18 10:52:25 +0000 (Thu, 18 Jan 2018) | 1 line +Changed paths: + M /branches/4.0/NEWS + +[NEWS] Update for GNU MPFR 4.0.1. +------------------------------------------------------------------------ +r12096 | vlefevre | 2018-01-10 17:03:36 +0000 (Wed, 10 Jan 2018) | 1 line +Changed paths: + M /branches/4.0 + M /branches/4.0/src/check.c + +Typo in a comment (cherry-picked everything from r12073 of the trunk). +------------------------------------------------------------------------ +r12095 | vlefevre | 2018-01-10 16:58:10 +0000 (Wed, 10 Jan 2018) | 4 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/src/lngamma.c + M /branches/4.0/tests/tlgamma.c + +[src/lngamma.c] Fixed handling of reduced exponent range in mpfr_lgamma + (also removed a useless cast). +[tests/tlgamma.c] Added a corresponding test case. +(merged changesets r12089-12092 from the trunk) +------------------------------------------------------------------------ +r12094 | vlefevre | 2018-01-10 16:48:57 +0000 (Wed, 10 Jan 2018) | 4 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/src/ai.c + M /branches/4.0/tests/tai.c + +[src/ai.c] Fixed handling of reduced exponent range. +[tests/tai.c] Added corresponding test cases (in addition to what + has been done in tgeneric.c). +(merged changesets r12070-12072,12074-12075 from the trunk) +------------------------------------------------------------------------ +r12093 | vlefevre | 2018-01-10 16:38:44 +0000 (Wed, 10 Jan 2018) | 8 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/tests/tgeneric.c + +[tests/tgeneric.c] Tests in a reduced exponent range: + * Do several overflow/underflow tests instead of 1, and this for each + precision. This allows one to detect 2 bugs (fixed in the trunk) + that did not handle reduced exponent ranges correctly: + - in mpfr_ai, making tai fail; + - in mpfr_lgamma, making tlgamma hang with a 32-bit ABI. + * Added some comments. +(merged changesets r12087-12088 from the trunk) +------------------------------------------------------------------------ +r12086 | vlefevre | 2018-01-10 10:15:30 +0000 (Wed, 10 Jan 2018) | 4 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/tests/tsprintf.c + +[tests/tsprintf.c] Fixed/simplified code with incorrect strncpy +usage (bug detected by gcc-snapshot 20180107-1 under Debian with +-Werror=stringop-truncation). +(merged changesets r12084-12085 from the trunk) +------------------------------------------------------------------------ +r12083 | vlefevre | 2018-01-09 15:17:48 +0000 (Tue, 09 Jan 2018) | 6 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/doc/mpfr.texi + +[doc/mpfr.texi] Misc improvements and corrections affecting the +description of the following functions: + * mpfr_ai: fixed font encoding issue for PDF/DVI/PS (—x— → |x|). + * mpfr_custom_init_set: fixed typography; improved text. + * mpfr_custom_get_exp: improved text. +(merged changesets r12077-12082 from the trunk) +------------------------------------------------------------------------ +r12078 | vlefevre | 2018-01-09 12:34:03 +0000 (Tue, 09 Jan 2018) | 5 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/doc/texinfo.tex + +[doc] + * texinfo.tex: update to the latest version 2018-01-09.11, which + supports @var with script font size without any drawback. + * mpfr.texi: replaced the now useless @svar by @var. +(merged changeset r12076 from the trunk) +------------------------------------------------------------------------ +r12077 | vlefevre | 2018-01-09 12:30:58 +0000 (Tue, 09 Jan 2018) | 6 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/BUGS + M /branches/4.0/INSTALL + M /branches/4.0/Makefile.am + M /branches/4.0/NEWS + M /branches/4.0/README + M /branches/4.0/TODO + M /branches/4.0/acinclude.m4 + M /branches/4.0/configure.ac + M /branches/4.0/doc/FAQ.html + M /branches/4.0/doc/Makefile.am + M /branches/4.0/doc/README.dev + M /branches/4.0/doc/check-typography + M /branches/4.0/doc/faq.xsl + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/examples/can_round.c + M /branches/4.0/examples/divworst.c + M /branches/4.0/examples/rndo-add.c + M /branches/4.0/examples/sample.c + M /branches/4.0/examples/version.c + M /branches/4.0/src/Makefile.am + M /branches/4.0/src/abort_prec_max.c + M /branches/4.0/src/acos.c + M /branches/4.0/src/acosh.c + M /branches/4.0/src/add.c + M /branches/4.0/src/add1.c + M /branches/4.0/src/add1sp.c + M /branches/4.0/src/add_d.c + M /branches/4.0/src/add_ui.c + M /branches/4.0/src/agm.c + M /branches/4.0/src/ai.c + M /branches/4.0/src/amd/amdfam10/mparam.h + M /branches/4.0/src/amd/athlon/mparam.h + M /branches/4.0/src/amd/k8/mparam.h + M /branches/4.0/src/arm/mparam.h + M /branches/4.0/src/asin.c + M /branches/4.0/src/asinh.c + M /branches/4.0/src/atan.c + M /branches/4.0/src/atan2.c + M /branches/4.0/src/atanh.c + M /branches/4.0/src/bernoulli.c + M /branches/4.0/src/beta.c + M /branches/4.0/src/buildopt.c + M /branches/4.0/src/cache.c + M /branches/4.0/src/cbrt.c + M /branches/4.0/src/check.c + M /branches/4.0/src/clear.c + M /branches/4.0/src/clears.c + M /branches/4.0/src/cmp.c + M /branches/4.0/src/cmp2.c + M /branches/4.0/src/cmp_abs.c + M /branches/4.0/src/cmp_d.c + M /branches/4.0/src/cmp_ld.c + M /branches/4.0/src/cmp_si.c + M /branches/4.0/src/cmp_ui.c + M /branches/4.0/src/comparisons.c + M /branches/4.0/src/const_catalan.c + M /branches/4.0/src/const_euler.c + M /branches/4.0/src/const_log2.c + M /branches/4.0/src/const_pi.c + M /branches/4.0/src/constant.c + M /branches/4.0/src/copysign.c + M /branches/4.0/src/cos.c + M /branches/4.0/src/cosh.c + M /branches/4.0/src/cot.c + M /branches/4.0/src/coth.c + M /branches/4.0/src/csc.c + M /branches/4.0/src/csch.c + M /branches/4.0/src/d_div.c + M /branches/4.0/src/d_sub.c + M /branches/4.0/src/digamma.c + M /branches/4.0/src/dim.c + M /branches/4.0/src/div.c + M /branches/4.0/src/div_2exp.c + M /branches/4.0/src/div_2si.c + M /branches/4.0/src/div_2ui.c + M /branches/4.0/src/div_d.c + M /branches/4.0/src/div_ui.c + M /branches/4.0/src/dump.c + M /branches/4.0/src/eint.c + M /branches/4.0/src/eq.c + M /branches/4.0/src/erandom.c + M /branches/4.0/src/erf.c + M /branches/4.0/src/erfc.c + M /branches/4.0/src/exceptions.c + M /branches/4.0/src/exp.c + M /branches/4.0/src/exp10.c + M /branches/4.0/src/exp2.c + M /branches/4.0/src/exp3.c + M /branches/4.0/src/exp_2.c + M /branches/4.0/src/expm1.c + M /branches/4.0/src/extract.c + M /branches/4.0/src/factorial.c + M /branches/4.0/src/fits_intmax.c + M /branches/4.0/src/fits_s.h + M /branches/4.0/src/fits_sint.c + M /branches/4.0/src/fits_slong.c + M /branches/4.0/src/fits_sshort.c + M /branches/4.0/src/fits_u.h + M /branches/4.0/src/fits_uint.c + M /branches/4.0/src/fits_uintmax.c + M /branches/4.0/src/fits_ulong.c + M /branches/4.0/src/fits_ushort.c + M /branches/4.0/src/fma.c + M /branches/4.0/src/fmma.c + M /branches/4.0/src/fms.c + M /branches/4.0/src/fpif.c + M /branches/4.0/src/frac.c + M /branches/4.0/src/free_cache.c + M /branches/4.0/src/frexp.c + M /branches/4.0/src/gamma.c + M /branches/4.0/src/gamma_inc.c + M /branches/4.0/src/gammaonethird.c + M /branches/4.0/src/gen_inverse.h + M /branches/4.0/src/generic/coverage/mparam.h + M /branches/4.0/src/generic/mparam.h + M /branches/4.0/src/get_d.c + M /branches/4.0/src/get_d64.c + M /branches/4.0/src/get_exp.c + M /branches/4.0/src/get_f.c + M /branches/4.0/src/get_float128.c + M /branches/4.0/src/get_flt.c + M /branches/4.0/src/get_ld.c + M /branches/4.0/src/get_q.c + M /branches/4.0/src/get_si.c + M /branches/4.0/src/get_sj.c + M /branches/4.0/src/get_str.c + M /branches/4.0/src/get_ui.c + M /branches/4.0/src/get_uj.c + M /branches/4.0/src/get_z.c + M /branches/4.0/src/get_z_exp.c + M /branches/4.0/src/gmp_op.c + M /branches/4.0/src/grandom.c + M /branches/4.0/src/hppa/mparam.h + M /branches/4.0/src/hypot.c + M /branches/4.0/src/ia64/mparam.h + M /branches/4.0/src/ieee_floats.h + M /branches/4.0/src/init.c + M /branches/4.0/src/init2.c + M /branches/4.0/src/inits.c + M /branches/4.0/src/inits2.c + M /branches/4.0/src/inp_str.c + M /branches/4.0/src/int_ceil_log2.c + M /branches/4.0/src/invert_limb.h + M /branches/4.0/src/invsqrt_limb.h + M /branches/4.0/src/isinf.c + M /branches/4.0/src/isinteger.c + M /branches/4.0/src/isnan.c + M /branches/4.0/src/isnum.c + M /branches/4.0/src/isqrt.c + M /branches/4.0/src/isregular.c + M /branches/4.0/src/iszero.c + M /branches/4.0/src/jn.c + M /branches/4.0/src/jyn_asympt.c + M /branches/4.0/src/li2.c + M /branches/4.0/src/lngamma.c + M /branches/4.0/src/log.c + M /branches/4.0/src/log10.c + M /branches/4.0/src/log1p.c + M /branches/4.0/src/log2.c + M /branches/4.0/src/log_ui.c + M /branches/4.0/src/logging.c + M /branches/4.0/src/min_prec.c + M /branches/4.0/src/minmax.c + M /branches/4.0/src/mips/mparam.h + M /branches/4.0/src/modf.c + M /branches/4.0/src/mp_clz_tab.c + M /branches/4.0/src/mparam_h.in + M /branches/4.0/src/mpf2mpfr.h + M /branches/4.0/src/mpfr-cvers.h + M /branches/4.0/src/mpfr-gmp.c + M /branches/4.0/src/mpfr-gmp.h + M /branches/4.0/src/mpfr-impl.h + M /branches/4.0/src/mpfr-intmax.h + M /branches/4.0/src/mpfr-longlong.h + M /branches/4.0/src/mpfr-mini-gmp.c + M /branches/4.0/src/mpfr-mini-gmp.h + M /branches/4.0/src/mpfr-sassert.h + M /branches/4.0/src/mpfr-thread.h + M /branches/4.0/src/mpfr.h + M /branches/4.0/src/mpn_exp.c + M /branches/4.0/src/mul.c + M /branches/4.0/src/mul_2exp.c + M /branches/4.0/src/mul_2si.c + M /branches/4.0/src/mul_2ui.c + M /branches/4.0/src/mul_d.c + M /branches/4.0/src/mul_ui.c + M /branches/4.0/src/mulders.c + M /branches/4.0/src/neg.c + M /branches/4.0/src/next.c + M /branches/4.0/src/nrandom.c + M /branches/4.0/src/odd_p.c + M /branches/4.0/src/out_str.c + M /branches/4.0/src/pool.c + M /branches/4.0/src/pow.c + M /branches/4.0/src/pow_si.c + M /branches/4.0/src/pow_ui.c + M /branches/4.0/src/pow_z.c + M /branches/4.0/src/powerof2.c + M /branches/4.0/src/powerpc32/mparam.h + M /branches/4.0/src/powerpc64/mparam.h + M /branches/4.0/src/print_raw.c + M /branches/4.0/src/print_rnd_mode.c + M /branches/4.0/src/printf.c + M /branches/4.0/src/random_deviate.c + M /branches/4.0/src/random_deviate.h + M /branches/4.0/src/rec_sqrt.c + M /branches/4.0/src/reldiff.c + M /branches/4.0/src/rem1.c + M /branches/4.0/src/rint.c + M /branches/4.0/src/rndna.c + M /branches/4.0/src/root.c + M /branches/4.0/src/round_near_x.c + M /branches/4.0/src/round_p.c + M /branches/4.0/src/round_prec.c + M /branches/4.0/src/round_raw_generic.c + M /branches/4.0/src/scale2.c + M /branches/4.0/src/sec.c + M /branches/4.0/src/sech.c + M /branches/4.0/src/set.c + M /branches/4.0/src/set_d.c + M /branches/4.0/src/set_d64.c + M /branches/4.0/src/set_dfl_prec.c + M /branches/4.0/src/set_exp.c + M /branches/4.0/src/set_f.c + M /branches/4.0/src/set_float128.c + M /branches/4.0/src/set_flt.c + M /branches/4.0/src/set_inf.c + M /branches/4.0/src/set_ld.c + M /branches/4.0/src/set_nan.c + M /branches/4.0/src/set_prc_raw.c + M /branches/4.0/src/set_prec.c + M /branches/4.0/src/set_q.c + M /branches/4.0/src/set_rnd.c + M /branches/4.0/src/set_si.c + M /branches/4.0/src/set_si_2exp.c + M /branches/4.0/src/set_sj.c + M /branches/4.0/src/set_str.c + M /branches/4.0/src/set_str_raw.c + M /branches/4.0/src/set_ui.c + M /branches/4.0/src/set_ui_2exp.c + M /branches/4.0/src/set_uj.c + M /branches/4.0/src/set_z.c + M /branches/4.0/src/set_z_exp.c + M /branches/4.0/src/set_zero.c + M /branches/4.0/src/setmax.c + M /branches/4.0/src/setmin.c + M /branches/4.0/src/setsign.c + M /branches/4.0/src/sgn.c + M /branches/4.0/src/si_op.c + M /branches/4.0/src/signbit.c + M /branches/4.0/src/sin.c + M /branches/4.0/src/sin_cos.c + M /branches/4.0/src/sinh.c + M /branches/4.0/src/sinh_cosh.c + M /branches/4.0/src/sparc64/mparam.h + M /branches/4.0/src/sqr.c + M /branches/4.0/src/sqrt.c + M /branches/4.0/src/sqrt_ui.c + M /branches/4.0/src/stack_interface.c + M /branches/4.0/src/strtofr.c + M /branches/4.0/src/sub.c + M /branches/4.0/src/sub1.c + M /branches/4.0/src/sub1sp.c + M /branches/4.0/src/sub_d.c + M /branches/4.0/src/sub_ui.c + M /branches/4.0/src/subnormal.c + M /branches/4.0/src/sum.c + M /branches/4.0/src/swap.c + M /branches/4.0/src/tan.c + M /branches/4.0/src/tanh.c + M /branches/4.0/src/ubf.c + M /branches/4.0/src/uceil_exp2.c + M /branches/4.0/src/uceil_log2.c + M /branches/4.0/src/ufloor_log2.c + M /branches/4.0/src/ui_div.c + M /branches/4.0/src/ui_pow.c + M /branches/4.0/src/ui_pow_ui.c + M /branches/4.0/src/ui_sub.c + M /branches/4.0/src/urandom.c + M /branches/4.0/src/urandomb.c + M /branches/4.0/src/vasprintf.c + M /branches/4.0/src/version.c + M /branches/4.0/src/volatile.c + M /branches/4.0/src/x86/core2/mparam.h + M /branches/4.0/src/x86/mparam.h + M /branches/4.0/src/x86_64/core2/mparam.h + M /branches/4.0/src/x86_64/corei5/mparam.h + M /branches/4.0/src/x86_64/pentium4/mparam.h + M /branches/4.0/src/yn.c + M /branches/4.0/src/zeta.c + M /branches/4.0/src/zeta_ui.c + M /branches/4.0/tests/Makefile.am + M /branches/4.0/tests/cmp_str.c + M /branches/4.0/tests/data/digamma + M /branches/4.0/tests/data/li2 + M /branches/4.0/tests/memory.c + M /branches/4.0/tests/mpf_compat.c + M /branches/4.0/tests/mpf_compat.h + M /branches/4.0/tests/mpfr-test.h + M /branches/4.0/tests/mpfr_compat.c + M /branches/4.0/tests/random2.c + M /branches/4.0/tests/reuse.c + M /branches/4.0/tests/rnd_mode.c + M /branches/4.0/tests/tabort_defalloc1.c + M /branches/4.0/tests/tabort_defalloc2.c + M /branches/4.0/tests/tabort_prec_max.c + M /branches/4.0/tests/tabs.c + M /branches/4.0/tests/tacos.c + M /branches/4.0/tests/tacosh.c + M /branches/4.0/tests/tadd.c + M /branches/4.0/tests/tadd1sp.c + M /branches/4.0/tests/tadd_d.c + M /branches/4.0/tests/tadd_ui.c + M /branches/4.0/tests/tagm.c + M /branches/4.0/tests/tai.c + M /branches/4.0/tests/talloc-cache.c + M /branches/4.0/tests/talloc.c + M /branches/4.0/tests/tasin.c + M /branches/4.0/tests/tasinh.c + M /branches/4.0/tests/tassert.c + M /branches/4.0/tests/tatan.c + M /branches/4.0/tests/tatanh.c + M /branches/4.0/tests/taway.c + M /branches/4.0/tests/tbeta.c + M /branches/4.0/tests/tbuildopt.c + M /branches/4.0/tests/tcan_round.c + M /branches/4.0/tests/tcbrt.c + M /branches/4.0/tests/tcheck.c + M /branches/4.0/tests/tcmp.c + M /branches/4.0/tests/tcmp2.c + M /branches/4.0/tests/tcmp_d.c + M /branches/4.0/tests/tcmp_ld.c + M /branches/4.0/tests/tcmp_ui.c + M /branches/4.0/tests/tcmpabs.c + M /branches/4.0/tests/tcomparisons.c + M /branches/4.0/tests/tconst_catalan.c + M /branches/4.0/tests/tconst_euler.c + M /branches/4.0/tests/tconst_log2.c + M /branches/4.0/tests/tconst_pi.c + M /branches/4.0/tests/tcopysign.c + M /branches/4.0/tests/tcos.c + M /branches/4.0/tests/tcosh.c + M /branches/4.0/tests/tcot.c + M /branches/4.0/tests/tcoth.c + M /branches/4.0/tests/tcsc.c + M /branches/4.0/tests/tcsch.c + M /branches/4.0/tests/td_div.c + M /branches/4.0/tests/td_sub.c + M /branches/4.0/tests/tdigamma.c + M /branches/4.0/tests/tdim.c + M /branches/4.0/tests/tdiv.c + M /branches/4.0/tests/tdiv_d.c + M /branches/4.0/tests/tdiv_ui.c + M /branches/4.0/tests/teint.c + M /branches/4.0/tests/teq.c + M /branches/4.0/tests/terandom.c + M /branches/4.0/tests/terandom_chisq.c + M /branches/4.0/tests/terf.c + M /branches/4.0/tests/tests.c + M /branches/4.0/tests/texceptions.c + M /branches/4.0/tests/texp.c + M /branches/4.0/tests/texp10.c + M /branches/4.0/tests/texp2.c + M /branches/4.0/tests/texpm1.c + M /branches/4.0/tests/tfactorial.c + M /branches/4.0/tests/tfits.c + M /branches/4.0/tests/tfma.c + M /branches/4.0/tests/tfmma.c + M /branches/4.0/tests/tfmod.c + M /branches/4.0/tests/tfms.c + M /branches/4.0/tests/tfpif.c + M /branches/4.0/tests/tfprintf.c + M /branches/4.0/tests/tfrac.c + M /branches/4.0/tests/tfrexp.c + M /branches/4.0/tests/tgamma.c + M /branches/4.0/tests/tgamma_inc.c + M /branches/4.0/tests/tgeneric.c + M /branches/4.0/tests/tgeneric_ui.c + M /branches/4.0/tests/tget_d.c + M /branches/4.0/tests/tget_d_2exp.c + M /branches/4.0/tests/tget_f.c + M /branches/4.0/tests/tget_flt.c + M /branches/4.0/tests/tget_ld_2exp.c + M /branches/4.0/tests/tget_q.c + M /branches/4.0/tests/tget_set_d64.c + M /branches/4.0/tests/tget_sj.c + M /branches/4.0/tests/tget_str.c + M /branches/4.0/tests/tget_z.c + M /branches/4.0/tests/tgmpop.c + M /branches/4.0/tests/tgrandom.c + M /branches/4.0/tests/thyperbolic.c + M /branches/4.0/tests/thypot.c + M /branches/4.0/tests/tinits.c + M /branches/4.0/tests/tinp_str.c + M /branches/4.0/tests/tinternals.c + M /branches/4.0/tests/tisnan.c + M /branches/4.0/tests/tisqrt.c + M /branches/4.0/tests/tj0.c + M /branches/4.0/tests/tj1.c + M /branches/4.0/tests/tjn.c + M /branches/4.0/tests/tl2b.c + M /branches/4.0/tests/tlgamma.c + M /branches/4.0/tests/tli2.c + M /branches/4.0/tests/tlngamma.c + M /branches/4.0/tests/tlog.c + M /branches/4.0/tests/tlog10.c + M /branches/4.0/tests/tlog1p.c + M /branches/4.0/tests/tlog2.c + M /branches/4.0/tests/tlog_ui.c + M /branches/4.0/tests/tmin_prec.c + M /branches/4.0/tests/tminmax.c + M /branches/4.0/tests/tmodf.c + M /branches/4.0/tests/tmul.c + M /branches/4.0/tests/tmul_2exp.c + M /branches/4.0/tests/tmul_d.c + M /branches/4.0/tests/tmul_ui.c + M /branches/4.0/tests/tnext.c + M /branches/4.0/tests/tnrandom.c + M /branches/4.0/tests/tnrandom_chisq.c + M /branches/4.0/tests/tout_str.c + M /branches/4.0/tests/toutimpl.c + M /branches/4.0/tests/tpow.c + M /branches/4.0/tests/tpow3.c + M /branches/4.0/tests/tpow_all.c + M /branches/4.0/tests/tpow_z.c + M /branches/4.0/tests/tprintf.c + M /branches/4.0/tests/trandom.c + M /branches/4.0/tests/trandom_deviate.c + M /branches/4.0/tests/trec_sqrt.c + M /branches/4.0/tests/tremquo.c + M /branches/4.0/tests/trint.c + M /branches/4.0/tests/trndna.c + M /branches/4.0/tests/troot.c + M /branches/4.0/tests/trootn_ui.c + M /branches/4.0/tests/tround_prec.c + M /branches/4.0/tests/tsec.c + M /branches/4.0/tests/tsech.c + M /branches/4.0/tests/tset.c + M /branches/4.0/tests/tset_d.c + M /branches/4.0/tests/tset_exp.c + M /branches/4.0/tests/tset_f.c + M /branches/4.0/tests/tset_float128.c + M /branches/4.0/tests/tset_ld.c + M /branches/4.0/tests/tset_q.c + M /branches/4.0/tests/tset_si.c + M /branches/4.0/tests/tset_sj.c + M /branches/4.0/tests/tset_str.c + M /branches/4.0/tests/tset_z.c + M /branches/4.0/tests/tset_z_exp.c + M /branches/4.0/tests/tsgn.c + M /branches/4.0/tests/tsi_op.c + M /branches/4.0/tests/tsin.c + M /branches/4.0/tests/tsin_cos.c + M /branches/4.0/tests/tsinh.c + M /branches/4.0/tests/tsinh_cosh.c + M /branches/4.0/tests/tsprintf.c + M /branches/4.0/tests/tsqr.c + M /branches/4.0/tests/tsqrt.c + M /branches/4.0/tests/tsqrt_ui.c + M /branches/4.0/tests/tstckintc.c + M /branches/4.0/tests/tstdint.c + M /branches/4.0/tests/tstrtofr.c + M /branches/4.0/tests/tsub.c + M /branches/4.0/tests/tsub1sp.c + M /branches/4.0/tests/tsub_d.c + M /branches/4.0/tests/tsub_ui.c + M /branches/4.0/tests/tsubnormal.c + M /branches/4.0/tests/tsum.c + M /branches/4.0/tests/tswap.c + M /branches/4.0/tests/ttan.c + M /branches/4.0/tests/ttanh.c + M /branches/4.0/tests/ttrunc.c + M /branches/4.0/tests/tui_div.c + M /branches/4.0/tests/tui_pow.c + M /branches/4.0/tests/tui_sub.c + M /branches/4.0/tests/turandom.c + M /branches/4.0/tests/tvalist.c + M /branches/4.0/tests/tversion.c + M /branches/4.0/tests/ty0.c + M /branches/4.0/tests/ty1.c + M /branches/4.0/tests/tyn.c + M /branches/4.0/tests/tzeta.c + M /branches/4.0/tests/tzeta_ui.c + M /branches/4.0/tools/bench/Makefile.am + M /branches/4.0/tools/bench/benchtime.h + M /branches/4.0/tools/bench/mpfrbench.c + M /branches/4.0/tools/ck-clz_tab + M /branches/4.0/tools/ck-copyright-notice + M /branches/4.0/tools/ck-mparam + M /branches/4.0/tools/ck-news + M /branches/4.0/tools/ck-version-info + M /branches/4.0/tools/get_patches.sh + M /branches/4.0/tune/Makefile.am + M /branches/4.0/tune/bidimensional_sample.c + M /branches/4.0/tune/speed.c + M /branches/4.0/tune/tuneup.c + +Minor date-related changes as in the trunk: +* Copyright notice update in most files: added 2018. +* tools/ck-mparam: in the copyright notice, just keep the year 2011 + since this file is not part of the tarball (just used by mpfrlint). +* doc/mpfr.texi: updated the month. +(merged changesets r12067-12069 from the trunk) +------------------------------------------------------------------------ +r12060 | vlefevre | 2017-12-25 15:04:55 +0000 (Mon, 25 Dec 2017) | 1 line +Changed paths: + M /branches/4.0/INSTALL + M /branches/4.0/VERSION + M /branches/4.0/configure.ac + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/src/mpfr.h + M /branches/4.0/src/version.c + +Updated version to 4.0.1-dev. +------------------------------------------------------------------------ +r12057 | vlefevre | 2017-12-25 11:17:31 +0000 (Mon, 25 Dec 2017) | 2 lines +Changed paths: + M /branches/4.0 + M /branches/4.0/NEWS -[doc/mpfr.texi] Added a remark concerning the mpfr_rint_* functions. -(merged changeset r9469 from the trunk) +[NEWS] Minor corrections for GNU MPFR 4.0.0. +(merged changeset r12056 from the trunk) ------------------------------------------------------------------------ -r9468 | vlefevre | 2015-05-28 21:04:37 +0000 (Thu, 28 May 2015) | 2 lines +r12051 | vlefevre | 2017-12-23 10:19:32 +0000 (Sat, 23 Dec 2017) | 1 line Changed paths: - M /branches/3.1/tests/tstdint.c + M /branches/4.0/ChangeLog -[tests/tstdint.c] Added missing #include needed since r9448 -(this #include was not necessary in the trunk thanks to r8053). +ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC svn log -rHEAD:0 -v". ------------------------------------------------------------------------ -r9467 | vlefevre | 2015-05-28 17:57:17 +0000 (Thu, 28 May 2015) | 9 lines +r12050 | vlefevre | 2017-12-23 10:17:50 +0000 (Sat, 23 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/mpfr-gmp.c - M /branches/3.1/src/mpfr-gmp.h - M /branches/3.1/src/mpfr-impl.h + M /branches/4.0/VERSION + M /branches/4.0/configure.ac + M /branches/4.0/doc/mpfr.texi + M /branches/4.0/src/mpfr.h + M /branches/4.0/src/version.c -[src] Fixed allocation issue for multithreaded applications: -https://sympa.inria.fr/sympa/arc/mpfr/2015-05/msg00001.html - * mpfr-gmp.{c,h}: made mpfr_allocate_func, mpfr_reallocate_func and - mpfr_free_func thread-local; updated MPFR_GET_MEMFUNC to execute - mp_get_memory_functions only when these pointers have not been set - to the actual function pointers yet. - * mpfr-impl.h: #include "mpfr-thread.h" earlier (before mpfr-gmp.h, - where MPFR_THREAD_ATTR is now used). -(merged changeset r9466 from the trunk) +Updated version to 4.0.0. ------------------------------------------------------------------------ -r9458 | vlefevre | 2015-05-23 23:42:14 +0000 (Sat, 23 May 2015) | 1 line +r12049 | vlefevre | 2017-12-23 10:15:10 +0000 (Sat, 23 Dec 2017) | 1 line Changed paths: - M /branches/3.1/src/frexp.c + M /branches/4.0 + M /branches/4.0/src/exp_2.c + M /branches/4.0/src/subnormal.c + M /branches/4.0/tests/texp.c -Added svn:keywords on src/frexp.c for consistency. +Merged changesets r12046-12048 from the trunk (bug fix and test). ------------------------------------------------------------------------ -r9454 | vlefevre | 2015-05-23 23:09:18 +0000 (Sat, 23 May 2015) | 4 lines +r12046 | vlefevre | 2017-12-23 01:39:00 +0000 (Sat, 23 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tstdint.c - M /branches/3.1/tests/tvalist.c + M /branches/4.0 + M /branches/4.0/src/hypot.c + M /branches/4.0/src/lngamma.c + M /branches/4.0/src/sin.c + M /branches/4.0/src/subnormal.c + M /branches/4.0/tests/thypot.c + M /branches/4.0/tests/tj1.c + M /branches/4.0/tests/tlngamma.c -[tests/{tstdint.c,tvalist.c}] Added missing #include "mpfr-test.h" -(detected with gcc -Werror=implicit-function-declaration), needed -since r9448. -(merged changeset r9453 from the trunk) +Merged changesets r12026-12045 from the trunk (bug fixes and tests). ------------------------------------------------------------------------ -r9452 | vlefevre | 2015-05-23 08:13:46 +0000 (Sat, 23 May 2015) | 2 lines +r12027 | vlefevre | 2017-12-20 01:59:31 +0000 (Wed, 20 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tstckintc.c + M /branches/4.0/ChangeLog -[tests/tstckintc.c] Fixed undefined behavior (invalid pointer). -(merged changeset r9450 from the trunk) +ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC svn log -rHEAD:0 -v". ------------------------------------------------------------------------ -r9448 | vlefevre | 2015-05-22 09:22:44 +0000 (Fri, 22 May 2015) | 3 lines +r12026 | vlefevre | 2017-12-20 01:57:34 +0000 (Wed, 20 Dec 2017) | 4 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tstdint.c - M /branches/3.1/tests/tvalist.c + M /branches/4.0 + M /branches/4.0/NEWS + M /branches/4.0/doc/FAQ.html -[tests/{tstdint.c,tvalist.c}] Use tests_start_mpfr / tests_end_mpfr, -in particular to detect a wrong MPFR version (due to a libtool bug). -(merged changeset r9447 from the trunk) +Re-added changes specific to the old 4.0 branch: + * doc/FAQ.html: assume MPFR 4.0.0 has been released (since this is + a file for the MPFR 4.0.0 release). + * NEWS: added test coverage for MPFR 4.0.0. ------------------------------------------------------------------------ -r9446 | vlefevre | 2015-05-21 15:09:16 +0000 (Thu, 21 May 2015) | 3 lines +r12024 | vlefevre | 2017-12-20 01:53:52 +0000 (Wed, 20 Dec 2017) | 4 lines Changed paths: - M /branches/3.1 - M /branches/3.1/autogen.sh + R /branches/4.0 (from /trunk:12023) -[autogen.sh] Exit with the exit status of autoreconf. Thus a failure -will be noticed more easily. -(merged changeset r9445 from the trunk) +Replaced the 4.0 branch by a copy of the trunk (in order to keep the +history of the latest changes of the trunk); this replacement is due +to a limitation of Subversion where a merge is regarded as a single +commit, and is OK here since the 4.0 branch is new. ------------------------------------------------------------------------ -r9444 | vlefevre | 2015-05-21 14:15:50 +0000 (Thu, 21 May 2015) | 1 line +r12023 | vlefevre | 2017-12-20 01:52:21 +0000 (Wed, 20 Dec 2017) | 1 line Changed paths: - M /branches/3.1/NEWS + M /trunk/INSTALL + M /trunk/VERSION + M /trunk/configure.ac + M /trunk/doc/mpfr.texi + M /trunk/src/mpfr.h + M /trunk/src/version.c -[NEWS] Update for GNU MPFR 3.1.3. +Updated version to 4.0.0-rc2 for an attempt to replace the 4.0 branch. ------------------------------------------------------------------------ -r9442 | vlefevre | 2015-05-21 14:05:16 +0000 (Thu, 21 May 2015) | 1 line +r12022 | vlefevre | 2017-12-20 01:34:49 +0000 (Wed, 20 Dec 2017) | 1 line Changed paths: - M /branches/3.1/tools/ck-copyright-notice + M /trunk/src/fma.c -[tools/ck-copyright-notice] Update from the trunk. +[src/fma.c] Minor improvements. Added an assert. ------------------------------------------------------------------------ -r9439 | vlefevre | 2015-05-21 11:15:52 +0000 (Thu, 21 May 2015) | 5 lines +r12021 | vlefevre | 2017-12-20 01:17:36 +0000 (Wed, 20 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/acinclude.m4 + M /trunk/src/tanh.c -[acinclude.m4] Various corrections in the tests: - * MPFR_FUNC_GMP_PRINTF_SPEC: missing #include for strcmp. - * Replaced rint by nearbyint in messages (as nearbyint is tested). - * Avoid warnings to avoid failures when -Werror is used. -(merged changeset r9438 from the trunk) +[src/tanh.c] GNU coding style. ------------------------------------------------------------------------ -r9437 | vlefevre | 2015-05-21 01:39:10 +0000 (Thu, 21 May 2015) | 2 lines +r12020 | vlefevre | 2017-12-20 01:13:09 +0000 (Wed, 20 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/Makefile.am + M /trunk/src/mul.c -[Makefile.am] Added a comment about ACLOCAL_AMFLAGS. -(merged changesets r8520,9379 from the trunk) +[src/mul.c] Reindentation. ------------------------------------------------------------------------ -r9436 | vlefevre | 2015-05-21 01:37:16 +0000 (Thu, 21 May 2015) | 2 lines +r12019 | vlefevre | 2017-12-20 01:10:54 +0000 (Wed, 20 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/README + M /trunk/src/exp2.c -[README] Added ar-lib (from AM_PROG_AR) and test-driver (Automake 1.12+). -(merged changeset r8578 from the trunk) +[src/exp2.c] Replaced two MPFR_ASSERTN by MPFR_STAT_STATIC_ASSERT. ------------------------------------------------------------------------ -r9435 | vlefevre | 2015-05-21 01:34:16 +0000 (Thu, 21 May 2015) | 2 lines +r12018 | vlefevre | 2017-12-19 16:30:09 +0000 (Tue, 19 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 + M /trunk/src/exp2.c -Added ar-lib to svn:ignore property (this script comes from Automake, -due to the use of AM_PROG_AR in configure.ac). +[src/exp2.c] Fixed the double rounding problem in an underflow case, +triggered by the test added in r12017. ------------------------------------------------------------------------ -r9434 | vlefevre | 2015-05-21 01:31:08 +0000 (Thu, 21 May 2015) | 7 lines +r12017 | vlefevre | 2017-12-19 16:13:48 +0000 (Tue, 19 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/INSTALL - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi + M /trunk/tests/texp2.c -To take into account that Automake 1.13 or later will be used: - * doc/mpfr.texi, INSTALL: updates related to "make check". - * configure.ac: require Automake 1.13 since the documentation now - assumes that 1.13 or later is used (and because previous Automake - versions are no longer tested); also added AM_PROG_AR to support - unusual archivers (after a warning from Automake 1.13). -(merged changesets r8546,8572-8573,8611,9375,9380 from the trunk) +[tests/texp2.c] Added test of underflow in MPFR_RNDN with exact value +close to 2^(emin-2). Currently fails due to double rounding. ------------------------------------------------------------------------ -r9433 | vlefevre | 2015-05-21 01:01:32 +0000 (Thu, 21 May 2015) | 2 lines +r12016 | vlefevre | 2017-12-19 14:45:00 +0000 (Tue, 19 Dec 2017) | 3 lines Changed paths: - M /branches/3.1/configure.ac + M /trunk/tests/tdiv.c -[configure.ac] Updated URL's. -(merged changeset r9081 for configure.ac from the trunk) +[tests/tdiv.c] Added new non-regression test: the was the real cause of +the ttanh failure in r11993 without the tanh.c fix in this same commit. +But this mpfr_div was fixed in r12002. ------------------------------------------------------------------------ -r9432 | vlefevre | 2015-05-21 00:58:31 +0000 (Thu, 21 May 2015) | 4 lines +r12015 | vlefevre | 2017-12-19 08:56:43 +0000 (Tue, 19 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/configure.ac + M /trunk/doc/mpfr.texi -[configure.ac] Improved error message when the compiler doesn't know -_Decimal64 (if MPFR is built with --enable-decimal-float). -Detect broken _Decimal64 support on powerpc64 with the mode32 ABI. -(merged changesets r8415,8679 from the trunk) +[doc/mpfr.texi] Added a comment about a bug/limitation in makeinfo 5.2. ------------------------------------------------------------------------ -r9431 | vlefevre | 2015-05-21 00:52:04 +0000 (Thu, 21 May 2015) | 2 lines +r12014 | vlefevre | 2017-12-19 08:21:55 +0000 (Tue, 19 Dec 2017) | 2 lines Changed paths: - M /branches/3.1/configure.ac - M /branches/3.1/doc/README.dev - M /branches/3.1/src/add1sp.c - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/src/mul.c - M /branches/3.1/src/round_p.c - M /branches/3.1/src/set_d.c - M /branches/3.1/src/sub1sp.c + M /trunk/doc/mpfr.texi -Renamed WANT_ASSERT to MPFR_WANT_ASSERT in order to avoid a clash -with GMP when MPFR is configured with --with-gmp-build. +[doc/mpfr.texi] Improved svar macro for nottex, in case it is used +in the future. ------------------------------------------------------------------------ -r9430 | vlefevre | 2015-05-21 00:41:06 +0000 (Thu, 21 May 2015) | 2 lines +r12013 | vlefevre | 2017-12-19 08:20:18 +0000 (Tue, 19 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/configure.ac + M /trunk/doc/mpfr.texi -[configure.ac] Added a comment mentioning a problem with GNU gold ld. -(merged changeset r8024 from the trunk) +[doc/mpfr.texi] Define svar even for nottex, though it is not used +(attempt to avoid a failure with makeinfo 5.2). ------------------------------------------------------------------------ -r9429 | vlefevre | 2015-05-21 00:32:21 +0000 (Thu, 21 May 2015) | 5 lines +r12012 | zimmerma | 2017-12-19 06:51:47 +0000 (Tue, 19 Dec 2017) | 3 lines Changed paths: - M /branches/3.1 - M /branches/3.1/configure.ac + M /trunk/src/fma.c + M /trunk/tests/tfma.c + +[src/fma.c] fixed bug in mpfr_fma +[tests/tfma.c] added non-regression test -[configure.ac] If the gmp.h vs libgmp test fails, also output the value -of some variables (in case config.log is available, information can -also be retrieved from "Cache variables" and "Output variables" near -the end). -(merged changesets r8056,8616 from the trunk) ------------------------------------------------------------------------ -r9428 | vlefevre | 2015-05-21 00:28:44 +0000 (Thu, 21 May 2015) | 4 lines +r12011 | vlefevre | 2017-12-19 03:38:58 +0000 (Tue, 19 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/configure.ac + M /trunk/src/exp2.c -[configure.ac] In the CC and CFLAGS setup from gmp.h, modified the -list of commands to select the C preprocessor since /lib/cpp isn't -the best choice under Solaris. -(merged changeset r8612 from the trunk) +[src/exp2.c] Update concerning the underflow/overflow cases. +Still incomplete. ------------------------------------------------------------------------ -r9427 | vlefevre | 2015-05-21 00:25:47 +0000 (Thu, 21 May 2015) | 3 lines +r12010 | vlefevre | 2017-12-19 02:32:33 +0000 (Tue, 19 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/configure.ac + M /trunk/doc/mpfr.texi -[configure.ac] The test of CC and CFLAGS was done too late! Moved this -test earlier. -(merged changeset r8610 from the trunk) +[doc/mpfr.texi] Updated a comment. ------------------------------------------------------------------------ -r9426 | vlefevre | 2015-05-21 00:12:59 +0000 (Thu, 21 May 2015) | 2 lines +r12009 | vlefevre | 2017-12-19 02:29:51 +0000 (Tue, 19 Dec 2017) | 8 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tests.c + M /trunk/doc/mpfr.texi + M /trunk/doc/texinfo.tex -[tests/tests.c] Changed an error message. -(merged changesets r9208-9209,9211-9212 from the trunk) +[doc] + * texinfo.tex: update to the latest version 2017-12-18.20, which + reverts the change done in 2017-12-01.13 attempting to support + @var with script font size (e.g. in exponent); but this change + didn't work correctly. + * mpfr.texi: introduced a @svar macro to handle this case. It + currently disables the use of @var, the other workaround being + worse. ------------------------------------------------------------------------ -r9425 | vlefevre | 2015-05-21 00:04:47 +0000 (Thu, 21 May 2015) | 2 lines +r12008 | vlefevre | 2017-12-18 17:59:35 +0000 (Mon, 18 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tests.c + M /trunk/src/mul.c -[tests/tests.c] Fixed tests_default_random in case mpfr_exp_t > long. -(merged changeset r8853 from the trunk) +Removed trailing whitespace. ------------------------------------------------------------------------ -r9424 | vlefevre | 2015-05-20 23:58:59 +0000 (Wed, 20 May 2015) | 21 lines +r12007 | vlefevre | 2017-12-18 17:05:28 +0000 (Mon, 18 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/Makefile.am - M /branches/3.1/tests/mpfr-test.h - M /branches/3.1/tests/tests.c - M /branches/3.1/tests/tversion.c + M /trunk/doc/algorithms.tex + M /trunk/src/tanh.c -Test suite improvement with Automake 1.13. - * Moved GMP version check from tversion.c to the test_version() - function of tests.c, so that this check is done in every test. - This function now returns an int, as there are now 3 cases: - 1. An error in MPFR version check is a fatal error: test_version() - exits with an error (exit status = 1). - 2. An error in GMP version check is a non-fatal error: if there - are no errors in MPFR version check, test_version() returns - with value 1. - 3. Otherwise test_version() returns with value 0 (everything is - fine). - * tversion.c still runs test_version(), but fails if this function - returns with an error, i.e. any error is fatal for this test. - Note: for the other tests, one just has a message in the output - in case of GMP version mismatch. - * mpfr-test.h: updated test_version() prototype. - * Makefile.am: removed the second tversion invocation, and output - the contents of tversion.log if this file exists (typically with - Automake 1.13+, for which one no longer gets tversion output by - default). -(merged changesets r8821,8849 from the trunk) +[doc/algorithms.tex,src/tanh.c] Fixed the bound, in particular from +the recent improvements in the error analysis. ------------------------------------------------------------------------ -r9423 | vlefevre | 2015-05-20 23:44:39 +0000 (Wed, 20 May 2015) | 2 lines +r12006 | zimmerma | 2017-12-18 16:21:36 +0000 (Mon, 18 Dec 2017) | 3 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tversion.c + M /trunk/src/mul.c + +[src/mul.c] we should compare the smaller size and not the larger one to + MPFR_MUL_THRESHOLD or MPFR_SQR_THRESHOLD for Mulders' short product -[tests/tversion.c] Output the applied patches (if any). -(merged changeset r8265 from the trunk) ------------------------------------------------------------------------ -r9422 | vlefevre | 2015-05-20 23:43:02 +0000 (Wed, 20 May 2015) | 2 lines +r12005 | zimmerma | 2017-12-18 16:17:19 +0000 (Mon, 18 Dec 2017) | 3 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tversion.c + M /trunk/src/mul.c + M /trunk/tests/tmul_d.c + +[src/mul.c] with Mulders', convert RNDF to RNDZ +[tests/tmul_d.c] added a non-regression test -[tests/tversion.c] Test mpfr_buildopt_tune_case() vs MPFR_TUNE_CASE. -(merged changeset r8223 from the trunk) ------------------------------------------------------------------------ -r9421 | vlefevre | 2015-05-20 16:17:19 +0000 (Wed, 20 May 2015) | 5 lines +r12004 | vlefevre | 2017-12-18 16:04:59 +0000 (Mon, 18 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/acinclude.m4 - M /branches/3.1/configure.ac + M /trunk/doc/algorithms.tex -[acinclude.m4,configure.ac] Check that a directory passed to -a --with-gmp* configure option exists and doesn't contain any -space, and canonicalize the name if the realpath utility is -available (patch by Patrick Pélissier). -(merged changeset r8840 from the trunk) +[doc/algorithms.tex] mpfr_tanh: corrected bounds (thanks to Paul). ------------------------------------------------------------------------ -r9420 | vlefevre | 2015-05-20 16:15:46 +0000 (Wed, 20 May 2015) | 2 lines +r12003 | vlefevre | 2017-12-18 15:54:05 +0000 (Mon, 18 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tests/Makefile.am + M /trunk/doc/algorithms.tex -[tests/Makefile.am] In LOADLIBES, replaced $(INCLUDES) by $(AM_CPPFLAGS) -(completing r9411; merged changeset r8743 from the trunk) +[doc/algorithms.tex] mpfr_tanh: detailed some inequalities. ------------------------------------------------------------------------ -r9419 | vlefevre | 2015-05-20 16:11:33 +0000 (Wed, 20 May 2015) | 3 lines +r12002 | zimmerma | 2017-12-18 15:06:45 +0000 (Mon, 18 Dec 2017) | 4 lines Changed paths: - M /branches/3.1 - M /branches/3.1/acinclude.m4 + M /trunk/src/div.c + M /trunk/tests/tdiv.c + M /trunk/tests/ttan.c + +[src/div.c] fixed bug in mpfr_div2_approx() +[tests/tdiv.c] added non-regression test +[tests/ttan.c] added test triggering bug in mpfr_div2_approx() -[acinclude.m4] Avoid a warning due to variable set but not used in a -test, making the test fail with gcc -Werror=unused-but-set-variable. -(merged changeset r8729 from the trunk) ------------------------------------------------------------------------ -r9418 | vlefevre | 2015-05-20 16:04:22 +0000 (Wed, 20 May 2015) | 1 line +r12001 | vlefevre | 2017-12-18 14:44:33 +0000 (Mon, 18 Dec 2017) | 1 line Changed paths: - M /branches/3.1/acinclude.m4 + M /trunk/doc/algorithms.tex -[acinclude.m4] Replaced "main()" by "main (void)". +[doc/algorithms.tex] mpfr_tanh: resolved both FIXME's. ------------------------------------------------------------------------ -r9417 | vlefevre | 2015-05-20 15:57:51 +0000 (Wed, 20 May 2015) | 3 lines +r12000 | vlefevre | 2017-12-18 13:37:07 +0000 (Mon, 18 Dec 2017) | 4 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tcmp_d.c - M /branches/3.1/tests/tcmp_ld.c - M /branches/3.1/tests/tests.c - M /branches/3.1/tests/tget_d.c - M /branches/3.1/tests/trint.c - -[tests] Avoid warnings concerning unused variables under some conditions -in order to avoid failures when -Werror is used. -(merged changesets r8730,9415-9416 from the trunk) ------------------------------------------------------------------------- -r9414 | vlefevre | 2015-05-20 14:33:30 +0000 (Wed, 20 May 2015) | 11 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/acinclude.m4 - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/tests/tsprintf.c + M /trunk/doc/algorithms.tex -[acinclude.m4] Check struct lconv members (from ) to avoid a - build failure under Android, which does not have them; see - https://sympa.inria.fr/sympa/arc/mpfr/2012-10/msg00002.html -[src/mpfr-impl.h] Decimal point / thousands separator support can now be - detected automatically by configure (from the presence of - and the above members) or explicitly disabled/enabled by the user by - defining the MPFR_LCONV_DPTS macro to 0 or 1 via CFLAGS (a configure - switch might be added in the future). -[tests/tsprintf.c] Do the locale_da_DK test only if MPFR_LCONV_DPTS is - true. -(merged changeset r8423 from the trunk) +[doc/algorithms.tex] mpfr_tanh: corrected a part of the error analysis +(2^k+4 ≤ |theta_4|^(−1/2) was not necessarily true, since theta_4 can +be very small). As a consequence, the lemma can be simplified/improved +(first FIXME). Added a second FIXME on a condition that is not checked. ------------------------------------------------------------------------ -r9413 | vlefevre | 2015-05-20 13:33:13 +0000 (Wed, 20 May 2015) | 6 lines +r11999 | vlefevre | 2017-12-18 12:22:26 +0000 (Mon, 18 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/acinclude.m4 - M /branches/3.1/tests/tget_flt.c - M /branches/3.1/tests/tset_d.c + M /trunk/doc/algorithms.tex -[acinclude.m4] Added a test for signed zeros (defines HAVE_SIGNEDZ). -[tests/{tset_d.c,tget_flt.c}] Disabled two tests when HAVE_SIGNEDZ -isn't defined, because these tests rely on signed zeros. -Note: this is needed for compilers that don't support signed zeros, -like tcc 0.9.26 and before. -(merged changesets r8339-8340 from the trunk) ------------------------------------------------------------------------- -r9412 | vlefevre | 2015-05-20 12:52:26 +0000 (Wed, 20 May 2015) | 8 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/acinclude.m4 - M /branches/3.1/configure.ac - -[acinclude.m4,configure.ac] - * Added test for double-to-integer conversion bug. - * Corrected a gmp.h inclusion. - * Added MPFR_CHECK_GMP configure check. Without this test, one could - get an error in MPFR_CHECK_PRINTF_SPEC (or MPFR_CHECK_DBL2INT_BUG, - taking into account the above addition), though the error is not - related to printf or a double-to-integer conversion bug. -(merged changesets r8353-8355,8432,8601-8602,8606,8614,8900 from the trunk) ------------------------------------------------------------------------- -r9411 | vlefevre | 2015-05-20 12:29:48 +0000 (Wed, 20 May 2015) | 3 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/acinclude.m4 - M /branches/3.1/configure.ac - M /branches/3.1/m4/size_max.m4 - M /branches/3.1/tests/Makefile.am - M /branches/3.1/tune/Makefile.am - -Updated autotools files to get rid of obsolete macros. Removed -useless "#include " in the test for subnormal numbers. -(merged changesets r8337-8338,8364 from the trunk) ------------------------------------------------------------------------- -r9410 | vlefevre | 2015-05-20 11:52:40 +0000 (Wed, 20 May 2015) | 2 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/acinclude.m4 - M /branches/3.1/doc/README.dev - M /branches/3.1/src/round_raw_generic.c - M /branches/3.1/src/set_d.c - M /branches/3.1/tests/tests.c - M /branches/3.1/tests/tset_d.c +[doc/algorithms.tex] mpfr_tanh: missing absolute value; added a \cdot. +------------------------------------------------------------------------ +r11998 | vlefevre | 2017-12-18 12:15:31 +0000 (Mon, 18 Dec 2017) | 1 line +Changed paths: + M /trunk/src/exp2.c + M /trunk/tests/texp2.c -Replaced "denormalized" by the official term "subnormal". -(merged changeset r8334 from the trunk) +Removed trailing whitespace. ------------------------------------------------------------------------ -r9409 | vlefevre | 2015-05-20 11:47:38 +0000 (Wed, 20 May 2015) | 2 lines +r11997 | vlefevre | 2017-12-18 12:08:36 +0000 (Mon, 18 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tests.c + M /trunk/doc/algorithms.tex -[tests/tests.c] Improved a type, avoiding a compiler warning. -(merged changeset r8117 from the trunk) +[doc/algorithms.tex] Added another \cdot for readability. ------------------------------------------------------------------------ -r9408 | vlefevre | 2015-05-20 11:19:53 +0000 (Wed, 20 May 2015) | 1 line +r11996 | zimmerma | 2017-12-18 12:01:41 +0000 (Mon, 18 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tversion.c + M /trunk/src/exp2.c + +[src/exp2.c] added FIXME -[tests/tversion.c] Added GCC version (merged r8662 from the trunk). ------------------------------------------------------------------------ -r9406 | vlefevre | 2015-05-20 08:35:52 +0000 (Wed, 20 May 2015) | 1 line +r11995 | vlefevre | 2017-12-18 11:55:11 +0000 (Mon, 18 Dec 2017) | 7 lines Changed paths: - M /branches/3.1/doc/mpfr.texi + M /trunk/doc/algorithms.tex -[doc/mpfr.texi] Updated the month. +[doc/algorithms.tex] Minor corrections for hyperbolic tangent function: + * "e" had two different meanings (BTW, the constant e should actually + be written \mathrm{e} everywhere in the document). + * Use \left...\right instead of |...| when it contains an expression + starting with \log (the latter was confusing pdflatex, which added + a spurious space before \log). + * Added some \cdot for better readability. ------------------------------------------------------------------------ -r9405 | vlefevre | 2015-05-20 08:35:02 +0000 (Wed, 20 May 2015) | 1 line +r11994 | zimmerma | 2017-12-18 11:36:15 +0000 (Mon, 18 Dec 2017) | 3 lines Changed paths: - M /branches/3.1/doc/mpfr.texi + M /trunk/src/exp2.c + M /trunk/tests/texp2.c + +[src/exp2.c] fixed bug near underflow +[tests/texp2.c] added non-regression test -[doc/mpfr.texi] Correction of the latest changes. ------------------------------------------------------------------------ -r9404 | vlefevre | 2015-05-20 08:32:09 +0000 (Wed, 20 May 2015) | 2 lines +r11993 | zimmerma | 2017-12-18 08:51:06 +0000 (Mon, 18 Dec 2017) | 9 lines Changed paths: - M /branches/3.1 - M /branches/3.1/INSTALL - M /branches/3.1/README - M /branches/3.1/TODO - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/vasprintf.c - -Merged some documentation changes from the trunk. Added a note in -the mpfr_get_str description (in mpfr.texi) about the flags. ------------------------------------------------------------------------- -r9403 | vlefevre | 2015-05-20 08:00:07 +0000 (Wed, 20 May 2015) | 5 lines -Changed paths: - M /branches/3.1/BUGS - M /branches/3.1/INSTALL - M /branches/3.1/Makefile.am - M /branches/3.1/NEWS - M /branches/3.1/README - M /branches/3.1/TODO - M /branches/3.1/acinclude.m4 - M /branches/3.1/configure.ac - M /branches/3.1/doc/FAQ.html - M /branches/3.1/doc/Makefile.am - M /branches/3.1/doc/README.dev - M /branches/3.1/doc/faq.xsl - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/examples/divworst.c - M /branches/3.1/examples/rndo-add.c - M /branches/3.1/examples/sample.c - M /branches/3.1/examples/version.c - M /branches/3.1/src/Makefile.am - M /branches/3.1/src/abort_prec_max.c - M /branches/3.1/src/acos.c - M /branches/3.1/src/acosh.c - M /branches/3.1/src/add.c - M /branches/3.1/src/add1.c - M /branches/3.1/src/add1sp.c - M /branches/3.1/src/add_d.c - M /branches/3.1/src/add_ui.c - M /branches/3.1/src/agm.c - M /branches/3.1/src/ai.c - M /branches/3.1/src/amd/amdfam10/mparam.h - M /branches/3.1/src/amd/athlon/mparam.h - M /branches/3.1/src/amd/k8/mparam.h - M /branches/3.1/src/arm/mparam.h - M /branches/3.1/src/asin.c - M /branches/3.1/src/asinh.c - M /branches/3.1/src/atan.c - M /branches/3.1/src/atan2.c - M /branches/3.1/src/atanh.c - M /branches/3.1/src/bernoulli.c - M /branches/3.1/src/buildopt.c - M /branches/3.1/src/cache.c - M /branches/3.1/src/cbrt.c - M /branches/3.1/src/check.c - M /branches/3.1/src/clear.c - M /branches/3.1/src/clears.c - M /branches/3.1/src/cmp.c - M /branches/3.1/src/cmp2.c - M /branches/3.1/src/cmp_abs.c - M /branches/3.1/src/cmp_d.c - M /branches/3.1/src/cmp_ld.c - M /branches/3.1/src/cmp_si.c - M /branches/3.1/src/cmp_ui.c - M /branches/3.1/src/comparisons.c - M /branches/3.1/src/const_catalan.c - M /branches/3.1/src/const_euler.c - M /branches/3.1/src/const_log2.c - M /branches/3.1/src/const_pi.c - M /branches/3.1/src/constant.c - M /branches/3.1/src/copysign.c - M /branches/3.1/src/cos.c - M /branches/3.1/src/cosh.c - M /branches/3.1/src/cot.c - M /branches/3.1/src/coth.c - M /branches/3.1/src/csc.c - M /branches/3.1/src/csch.c - M /branches/3.1/src/d_div.c - M /branches/3.1/src/d_sub.c - M /branches/3.1/src/digamma.c - M /branches/3.1/src/dim.c - M /branches/3.1/src/div.c - M /branches/3.1/src/div_2exp.c - M /branches/3.1/src/div_2si.c - M /branches/3.1/src/div_2ui.c - M /branches/3.1/src/div_d.c - M /branches/3.1/src/div_ui.c - M /branches/3.1/src/dump.c - M /branches/3.1/src/eint.c - M /branches/3.1/src/eq.c - M /branches/3.1/src/erf.c - M /branches/3.1/src/erfc.c - M /branches/3.1/src/exceptions.c - M /branches/3.1/src/exp.c - M /branches/3.1/src/exp10.c - M /branches/3.1/src/exp2.c - M /branches/3.1/src/exp3.c - M /branches/3.1/src/exp_2.c - M /branches/3.1/src/expm1.c - M /branches/3.1/src/extract.c - M /branches/3.1/src/factorial.c - M /branches/3.1/src/fits_intmax.c - M /branches/3.1/src/fits_s.h - M /branches/3.1/src/fits_sint.c - M /branches/3.1/src/fits_slong.c - M /branches/3.1/src/fits_sshort.c - M /branches/3.1/src/fits_u.h - M /branches/3.1/src/fits_uint.c - M /branches/3.1/src/fits_uintmax.c - M /branches/3.1/src/fits_ulong.c - M /branches/3.1/src/fits_ushort.c - M /branches/3.1/src/fma.c - M /branches/3.1/src/fms.c - M /branches/3.1/src/frac.c - M /branches/3.1/src/free_cache.c - M /branches/3.1/src/frexp.c - M /branches/3.1/src/gamma.c - M /branches/3.1/src/gammaonethird.c - M /branches/3.1/src/gen_inverse.h - M /branches/3.1/src/generic/mparam.h - M /branches/3.1/src/get_d.c - M /branches/3.1/src/get_d64.c - M /branches/3.1/src/get_exp.c - M /branches/3.1/src/get_f.c - M /branches/3.1/src/get_flt.c - M /branches/3.1/src/get_ld.c - M /branches/3.1/src/get_si.c - M /branches/3.1/src/get_sj.c - M /branches/3.1/src/get_str.c - M /branches/3.1/src/get_ui.c - M /branches/3.1/src/get_uj.c - M /branches/3.1/src/get_z.c - M /branches/3.1/src/get_z_exp.c - M /branches/3.1/src/gmp_op.c - M /branches/3.1/src/grandom.c - M /branches/3.1/src/hppa/mparam.h - M /branches/3.1/src/hypot.c - M /branches/3.1/src/ia64/mparam.h - M /branches/3.1/src/ieee_floats.h - M /branches/3.1/src/init.c - M /branches/3.1/src/init2.c - M /branches/3.1/src/inits.c - M /branches/3.1/src/inits2.c - M /branches/3.1/src/inp_str.c - M /branches/3.1/src/int_ceil_log2.c - M /branches/3.1/src/isinf.c - M /branches/3.1/src/isinteger.c - M /branches/3.1/src/isnan.c - M /branches/3.1/src/isnum.c - M /branches/3.1/src/isqrt.c - M /branches/3.1/src/isregular.c - M /branches/3.1/src/iszero.c - M /branches/3.1/src/jn.c - M /branches/3.1/src/jyn_asympt.c - M /branches/3.1/src/li2.c - M /branches/3.1/src/lngamma.c - M /branches/3.1/src/log.c - M /branches/3.1/src/log10.c - M /branches/3.1/src/log1p.c - M /branches/3.1/src/log2.c - M /branches/3.1/src/logging.c - M /branches/3.1/src/min_prec.c - M /branches/3.1/src/minmax.c - M /branches/3.1/src/modf.c - M /branches/3.1/src/mp_clz_tab.c - M /branches/3.1/src/mparam_h.in - M /branches/3.1/src/mpf2mpfr.h - M /branches/3.1/src/mpfr-gmp.c - M /branches/3.1/src/mpfr-gmp.h - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/src/mpfr-intmax.h - M /branches/3.1/src/mpfr-longlong.h - M /branches/3.1/src/mpfr-thread.h - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/mpn_exp.c - M /branches/3.1/src/mul.c - M /branches/3.1/src/mul_2exp.c - M /branches/3.1/src/mul_2si.c - M /branches/3.1/src/mul_2ui.c - M /branches/3.1/src/mul_d.c - M /branches/3.1/src/mul_ui.c - M /branches/3.1/src/mulders.c - M /branches/3.1/src/neg.c - M /branches/3.1/src/next.c - M /branches/3.1/src/out_raw.c - M /branches/3.1/src/out_str.c - M /branches/3.1/src/pow.c - M /branches/3.1/src/pow_si.c - M /branches/3.1/src/pow_ui.c - M /branches/3.1/src/pow_z.c - M /branches/3.1/src/powerof2.c - M /branches/3.1/src/powerpc32/mparam.h - M /branches/3.1/src/powerpc64/mparam.h - M /branches/3.1/src/print_raw.c - M /branches/3.1/src/print_rnd_mode.c - M /branches/3.1/src/printf.c - M /branches/3.1/src/rec_sqrt.c - M /branches/3.1/src/reldiff.c - M /branches/3.1/src/rem1.c - M /branches/3.1/src/rint.c - M /branches/3.1/src/root.c - M /branches/3.1/src/round_near_x.c - M /branches/3.1/src/round_p.c - M /branches/3.1/src/round_prec.c - M /branches/3.1/src/round_raw_generic.c - M /branches/3.1/src/scale2.c - M /branches/3.1/src/sec.c - M /branches/3.1/src/sech.c - M /branches/3.1/src/set.c - M /branches/3.1/src/set_d.c - M /branches/3.1/src/set_d64.c - M /branches/3.1/src/set_dfl_prec.c - M /branches/3.1/src/set_exp.c - M /branches/3.1/src/set_f.c - M /branches/3.1/src/set_flt.c - M /branches/3.1/src/set_inf.c - M /branches/3.1/src/set_ld.c - M /branches/3.1/src/set_nan.c - M /branches/3.1/src/set_prc_raw.c - M /branches/3.1/src/set_prec.c - M /branches/3.1/src/set_q.c - M /branches/3.1/src/set_rnd.c - M /branches/3.1/src/set_si.c - M /branches/3.1/src/set_si_2exp.c - M /branches/3.1/src/set_sj.c - M /branches/3.1/src/set_str.c - M /branches/3.1/src/set_str_raw.c - M /branches/3.1/src/set_ui.c - M /branches/3.1/src/set_ui_2exp.c - M /branches/3.1/src/set_uj.c - M /branches/3.1/src/set_z.c - M /branches/3.1/src/set_z_exp.c - M /branches/3.1/src/set_zero.c - M /branches/3.1/src/setmax.c - M /branches/3.1/src/setmin.c - M /branches/3.1/src/setsign.c - M /branches/3.1/src/sgn.c - M /branches/3.1/src/si_op.c - M /branches/3.1/src/signbit.c - M /branches/3.1/src/sin.c - M /branches/3.1/src/sin_cos.c - M /branches/3.1/src/sinh.c - M /branches/3.1/src/sinh_cosh.c - M /branches/3.1/src/sparc64/mparam.h - M /branches/3.1/src/sqr.c - M /branches/3.1/src/sqrt.c - M /branches/3.1/src/sqrt_ui.c - M /branches/3.1/src/stack_interface.c - M /branches/3.1/src/strtofr.c - M /branches/3.1/src/sub.c - M /branches/3.1/src/sub1.c - M /branches/3.1/src/sub1sp.c - M /branches/3.1/src/sub_d.c - M /branches/3.1/src/sub_ui.c - M /branches/3.1/src/subnormal.c - M /branches/3.1/src/sum.c - M /branches/3.1/src/swap.c - M /branches/3.1/src/tan.c - M /branches/3.1/src/tanh.c - M /branches/3.1/src/uceil_exp2.c - M /branches/3.1/src/uceil_log2.c - M /branches/3.1/src/ufloor_log2.c - M /branches/3.1/src/ui_div.c - M /branches/3.1/src/ui_pow.c - M /branches/3.1/src/ui_pow_ui.c - M /branches/3.1/src/ui_sub.c - M /branches/3.1/src/urandom.c - M /branches/3.1/src/urandomb.c - M /branches/3.1/src/vasprintf.c - M /branches/3.1/src/version.c - M /branches/3.1/src/volatile.c - M /branches/3.1/src/x86/core2/mparam.h - M /branches/3.1/src/x86/mparam.h - M /branches/3.1/src/x86_64/core2/mparam.h - M /branches/3.1/src/x86_64/pentium4/mparam.h - M /branches/3.1/src/yn.c - M /branches/3.1/src/zeta.c - M /branches/3.1/src/zeta_ui.c - M /branches/3.1/tests/Makefile.am - M /branches/3.1/tests/cmp_str.c - M /branches/3.1/tests/data/digamma - M /branches/3.1/tests/data/li2 - M /branches/3.1/tests/memory.c - M /branches/3.1/tests/mpf_compat.c - M /branches/3.1/tests/mpf_compat.h - M /branches/3.1/tests/mpfr-test.h - M /branches/3.1/tests/mpfr_compat.c - M /branches/3.1/tests/random2.c - M /branches/3.1/tests/reuse.c - M /branches/3.1/tests/rnd_mode.c - M /branches/3.1/tests/tabs.c - M /branches/3.1/tests/tacos.c - M /branches/3.1/tests/tacosh.c - M /branches/3.1/tests/tadd.c - M /branches/3.1/tests/tadd1sp.c - M /branches/3.1/tests/tadd_d.c - M /branches/3.1/tests/tadd_ui.c - M /branches/3.1/tests/tagm.c - M /branches/3.1/tests/tai.c - M /branches/3.1/tests/tasin.c - M /branches/3.1/tests/tasinh.c - M /branches/3.1/tests/tatan.c - M /branches/3.1/tests/tatanh.c - M /branches/3.1/tests/taway.c - M /branches/3.1/tests/tbuildopt.c - M /branches/3.1/tests/tcan_round.c - M /branches/3.1/tests/tcbrt.c - M /branches/3.1/tests/tcheck.c - M /branches/3.1/tests/tcmp.c - M /branches/3.1/tests/tcmp2.c - M /branches/3.1/tests/tcmp_d.c - M /branches/3.1/tests/tcmp_ld.c - M /branches/3.1/tests/tcmp_ui.c - M /branches/3.1/tests/tcmpabs.c - M /branches/3.1/tests/tcomparisons.c - M /branches/3.1/tests/tconst_catalan.c - M /branches/3.1/tests/tconst_euler.c - M /branches/3.1/tests/tconst_log2.c - M /branches/3.1/tests/tconst_pi.c - M /branches/3.1/tests/tcopysign.c - M /branches/3.1/tests/tcos.c - M /branches/3.1/tests/tcosh.c - M /branches/3.1/tests/tcot.c - M /branches/3.1/tests/tcoth.c - M /branches/3.1/tests/tcsc.c - M /branches/3.1/tests/tcsch.c - M /branches/3.1/tests/td_div.c - M /branches/3.1/tests/td_sub.c - M /branches/3.1/tests/tdigamma.c - M /branches/3.1/tests/tdim.c - M /branches/3.1/tests/tdiv.c - M /branches/3.1/tests/tdiv_d.c - M /branches/3.1/tests/tdiv_ui.c - M /branches/3.1/tests/teint.c - M /branches/3.1/tests/teq.c - M /branches/3.1/tests/terf.c - M /branches/3.1/tests/tests.c - M /branches/3.1/tests/texceptions.c - M /branches/3.1/tests/texp.c - M /branches/3.1/tests/texp10.c - M /branches/3.1/tests/texp2.c - M /branches/3.1/tests/texpm1.c - M /branches/3.1/tests/tfactorial.c - M /branches/3.1/tests/tfits.c - M /branches/3.1/tests/tfma.c - M /branches/3.1/tests/tfmod.c - M /branches/3.1/tests/tfms.c - M /branches/3.1/tests/tfprintf.c - M /branches/3.1/tests/tfrac.c - M /branches/3.1/tests/tfrexp.c - M /branches/3.1/tests/tgamma.c - M /branches/3.1/tests/tgeneric.c - M /branches/3.1/tests/tgeneric_ui.c - M /branches/3.1/tests/tget_d.c - M /branches/3.1/tests/tget_d_2exp.c - M /branches/3.1/tests/tget_f.c - M /branches/3.1/tests/tget_flt.c - M /branches/3.1/tests/tget_ld_2exp.c - M /branches/3.1/tests/tget_set_d64.c - M /branches/3.1/tests/tget_sj.c - M /branches/3.1/tests/tget_str.c - M /branches/3.1/tests/tget_z.c - M /branches/3.1/tests/tgmpop.c - M /branches/3.1/tests/tgrandom.c - M /branches/3.1/tests/thyperbolic.c - M /branches/3.1/tests/thypot.c - M /branches/3.1/tests/tinits.c - M /branches/3.1/tests/tinp_str.c - M /branches/3.1/tests/tinternals.c - M /branches/3.1/tests/tisnan.c - M /branches/3.1/tests/tisqrt.c - M /branches/3.1/tests/tj0.c - M /branches/3.1/tests/tj1.c - M /branches/3.1/tests/tjn.c - M /branches/3.1/tests/tl2b.c - M /branches/3.1/tests/tlgamma.c - M /branches/3.1/tests/tli2.c - M /branches/3.1/tests/tlngamma.c - M /branches/3.1/tests/tlog.c - M /branches/3.1/tests/tlog10.c - M /branches/3.1/tests/tlog1p.c - M /branches/3.1/tests/tlog2.c - M /branches/3.1/tests/tmin_prec.c - M /branches/3.1/tests/tminmax.c - M /branches/3.1/tests/tmodf.c - M /branches/3.1/tests/tmul.c - M /branches/3.1/tests/tmul_2exp.c - M /branches/3.1/tests/tmul_d.c - M /branches/3.1/tests/tmul_ui.c - M /branches/3.1/tests/tnext.c - M /branches/3.1/tests/tout_str.c - M /branches/3.1/tests/toutimpl.c - M /branches/3.1/tests/tpow.c - M /branches/3.1/tests/tpow3.c - M /branches/3.1/tests/tpow_all.c - M /branches/3.1/tests/tpow_z.c - M /branches/3.1/tests/tprintf.c - M /branches/3.1/tests/trandom.c - M /branches/3.1/tests/trec_sqrt.c - M /branches/3.1/tests/tremquo.c - M /branches/3.1/tests/trint.c - M /branches/3.1/tests/troot.c - M /branches/3.1/tests/tround_prec.c - M /branches/3.1/tests/tsec.c - M /branches/3.1/tests/tsech.c - M /branches/3.1/tests/tset.c - M /branches/3.1/tests/tset_d.c - M /branches/3.1/tests/tset_exp.c - M /branches/3.1/tests/tset_f.c - M /branches/3.1/tests/tset_ld.c - M /branches/3.1/tests/tset_q.c - M /branches/3.1/tests/tset_si.c - M /branches/3.1/tests/tset_sj.c - M /branches/3.1/tests/tset_str.c - M /branches/3.1/tests/tset_z.c - M /branches/3.1/tests/tset_z_exp.c - M /branches/3.1/tests/tsgn.c - M /branches/3.1/tests/tsi_op.c - M /branches/3.1/tests/tsin.c - M /branches/3.1/tests/tsin_cos.c - M /branches/3.1/tests/tsinh.c - M /branches/3.1/tests/tsinh_cosh.c - M /branches/3.1/tests/tsprintf.c - M /branches/3.1/tests/tsqr.c - M /branches/3.1/tests/tsqrt.c - M /branches/3.1/tests/tsqrt_ui.c - M /branches/3.1/tests/tstckintc.c - M /branches/3.1/tests/tstdint.c - M /branches/3.1/tests/tstrtofr.c - M /branches/3.1/tests/tsub.c - M /branches/3.1/tests/tsub1sp.c - M /branches/3.1/tests/tsub_d.c - M /branches/3.1/tests/tsub_ui.c - M /branches/3.1/tests/tsubnormal.c - M /branches/3.1/tests/tsum.c - M /branches/3.1/tests/tswap.c - M /branches/3.1/tests/ttan.c - M /branches/3.1/tests/ttanh.c - M /branches/3.1/tests/ttrunc.c - M /branches/3.1/tests/tui_div.c - M /branches/3.1/tests/tui_pow.c - M /branches/3.1/tests/tui_sub.c - M /branches/3.1/tests/turandom.c - M /branches/3.1/tests/tvalist.c - M /branches/3.1/tests/tversion.c - M /branches/3.1/tests/ty0.c - M /branches/3.1/tests/ty1.c - M /branches/3.1/tests/tyn.c - M /branches/3.1/tests/tzeta.c - M /branches/3.1/tests/tzeta_ui.c - M /branches/3.1/tools/ck-copyright-notice - M /branches/3.1/tools/ck-mparam - M /branches/3.1/tools/ck-version-info - M /branches/3.1/tools/get_patches.sh - M /branches/3.1/tune/Makefile.am - M /branches/3.1/tune/bidimensional_sample.c - M /branches/3.1/tune/speed.c - M /branches/3.1/tune/tuneup.c + M /trunk/doc/algorithms.tex + M /trunk/src/tanh.c + M /trunk/tests/ttanh.c -Copyright notice update: added 2015 with - perl -pi -e 's/ (\d{4}-)?(2014)(?= Free Software)/ - " ".($1||"$2-").($2+1)/e' **/*(^/) -under zsh (the m4 and tools/mbench directories were not modified). -Removed 2014 from the example in the doc/README.dev file. +[tests/ttanh.c] added test for bug in mpfr_tanh +[doc/algorithms.tex] fixed error analysis for mpfr_tanh +[src/tanh.c] fixed error analysis +Note after r12016: Even though mpfr_tanh was incorrect, the failure +of the test added in ttanh.c was actually *only* due to a bug in the +mpfr_div code specific to the trunk (fixed in r12002), i.e. this was +not a non-regression test for the mpfr_tanh bug itself (in particular, +this test does not introduce a failure in the 3.1 branch, which still +has the same incorrect mpfr_tanh code but a correct mpfr_div). ------------------------------------------------------------------------ -r9243 | vlefevre | 2014-12-04 01:04:28 +0000 (Thu, 04 Dec 2014) | 6 lines +r11991 | vlefevre | 2017-12-18 00:04:58 +0000 (Mon, 18 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/strtofr.c + M /trunk/INSTALL + M /trunk/VERSION + M /trunk/configure.ac + M /trunk/doc/mpfr.texi + M /trunk/src/mpfr.h + M /trunk/src/version.c -[src/strtofr.c] Fix of a buffer overflow due to incorrect -GMP documentation for mpn_set_str. See discussion: - https://gmplib.org/list-archives/gmp-bugs/2013-December/003267.html -and the first fix in the GMP documentation: - https://gmplib.org/repo/gmp-5.1/raw-rev/d19172622a74 -(merged changeset r8722 from the trunk) +Updated version to 4.1.0-dev again. ------------------------------------------------------------------------ -r9110 | vlefevre | 2014-06-26 10:59:38 +0000 (Thu, 26 Jun 2014) | 5 lines +r11989 | vlefevre | 2017-12-17 23:57:39 +0000 (Sun, 17 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/vasprintf.c - M /branches/3.1/tests/tsprintf.c + M /trunk/INSTALL + M /trunk/VERSION + M /trunk/configure.ac + M /trunk/doc/mpfr.texi + M /trunk/src/mpfr.h + M /trunk/src/version.c -[src/vasprintf.c] Fixed assertion failures for tiny numbers (the code -was correct, but the assertions didn't check against the right bound). -[tests/tsprintf.c] Added a test with the minimum exponent, triggering -as assertion failure in vasprintf.c without this correction. -(merged changesets r9099-9100,9108-9109 from the trunk) +Updated version to 4.0.0-rc2 for an attempt to replace the 4.0 branch. ------------------------------------------------------------------------ -r9105 | vlefevre | 2014-06-26 00:40:26 +0000 (Thu, 26 Jun 2014) | 2 lines +r11988 | vlefevre | 2017-12-17 23:52:26 +0000 (Sun, 17 Dec 2017) | 1 line Changed paths: - M /branches/3.1/src/div.c + M /trunk/ChangeLog -[src/div.c] Bug fix: avoid an integer overflow when dividing the -largest finite MPFR number by the smallest positive one. +ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC svn log -rHEAD:0 -v". ------------------------------------------------------------------------ -r9104 | vlefevre | 2014-06-26 00:17:33 +0000 (Thu, 26 Jun 2014) | 1 line +r11987 | zimmerma | 2017-12-17 16:23:21 +0000 (Sun, 17 Dec 2017) | 2 lines Changed paths: - M /branches/3.1/tests/tdiv.c + M /trunk/src/add1sp.c + +[src/add1sp.c] fix bug in mpfr_add1sp3() in case d=GMP_NUMB_BITS -[tests/tdiv.c] Forgot "exit (1);". ------------------------------------------------------------------------ -r9102 | vlefevre | 2014-06-26 00:05:24 +0000 (Thu, 26 Jun 2014) | 3 lines +r11986 | zimmerma | 2017-12-17 15:16:48 +0000 (Sun, 17 Dec 2017) | 14 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tdiv.c + M /trunk/tests/tadd1sp.c + +[tests/tadd1sp.c] added test for new bug (still to be fixed): + +Seed GMP_CHECK_RANDOMIZE=1514385177 (include this in bug reports) +add1 & add1sp return different values for MPFR_RNDN +Prec_a = 137, Prec_b = 137, Prec_c = 137 +B = 0.11111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000E-66 +C = 0.11111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000110000E-2 + +add1 : 0.10000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000001000E-1 +add1sp: 0.11111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000010000E-2 +Inexact sp = 0 | Inexact = 0 +Flags sp = 8 | Flags = 8 +add1sp.c:89: MPFR assertion failed: 0 -[tests/tdiv.c] Merged mpfr_div tests r9101 from the trunk. -Note: the test actually fails (see output), but the "exit (1);" -was forgotten (added later in r9104). ------------------------------------------------------------------------ -r9055 | vlefevre | 2014-05-22 00:15:28 +0000 (Thu, 22 May 2014) | 1 line +r11981 | vlefevre | 2017-12-15 02:44:49 +0000 (Fri, 15 Dec 2017) | 1 line Changed paths: - M /branches/3.1/README - M /branches/3.1/doc/README.dev + M /trunk/src/root.c -Changed "INRIAGForge" to "InriaForge" (due to the rename). +[src/root.c] Minor comment correction. ------------------------------------------------------------------------ -r9034 | vlefevre | 2014-04-15 21:27:48 +0000 (Tue, 15 Apr 2014) | 9 lines +r11980 | vlefevre | 2017-12-15 02:36:50 +0000 (Fri, 15 Dec 2017) | 4 lines Changed paths: - M /branches/3.1 - M /branches/3.1/configure.ac - M /branches/3.1/src/init2.c - M /branches/3.1/src/mpfr-gmp.h - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/src/mul.c - M /branches/3.1/src/stack_interface.c + M /trunk/src/root.c + M /trunk/tests/troot.c -BYTES_PER_MP_LIMB -> MPFR_BYTES_PER_MP_LIMB for GMP 6 compatibility -when --with-gmp-build is used. See mailing-list discussion: - https://sympa.inria.fr/sympa/arc/mpfr/2014-04/msg00000.html -Updated configure test on GMP_NUMB_BITS and sizeof(mp_limb_t): - * BYTES_PER_MP_LIMB is no longer tested. - * The test is now always run, not just when --with-gmp-build is used. - * Results are output in config.log in case of failure. - * The error message has been updated. -(merged changesets r9029,9030 from the trunk, with conflict resolution) +[src/root.c] Completed fix from r11978, as x=-1 was affected too. Also + added comments explaining that mpfr_root_aux assumes |x| ≠ 1 and why. + Hence the need of a filter on |x| = 1. +[tests/troot.c] Added test for x = -1. ------------------------------------------------------------------------ -r9004 | vlefevre | 2014-03-14 11:40:57 +0000 (Fri, 14 Mar 2014) | 1 line +r11979 | vlefevre | 2017-12-15 01:44:11 +0000 (Fri, 15 Dec 2017) | 1 line Changed paths: - M /branches/3.1/doc/mpfr.texi + M /trunk/tests/troot.c -[doc/mpfr.texi] Updated the month. +[tests/troot.c] Replaced mpfr_root by TF (like in the other tests). ------------------------------------------------------------------------ -r9003 | vlefevre | 2014-03-14 11:39:59 +0000 (Fri, 14 Mar 2014) | 2 lines +r11978 | zimmerma | 2017-12-14 10:22:32 +0000 (Thu, 14 Dec 2017) | 3 lines Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi + M /trunk/src/root.c + M /trunk/tests/troot.c + +[src/root.c] fixed bug when x=1 +[tests/troot.c] added non-regression test -[doc/mpfr.texi] Correction in the mpfr_set_str description. -(merged changeset r9001 from the trunk) ------------------------------------------------------------------------ -r8803 | vlefevre | 2014-01-20 14:24:44 +0000 (Mon, 20 Jan 2014) | 3 lines +r11977 | vlefevre | 2017-12-14 07:57:05 +0000 (Thu, 14 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/exp3.c - M /branches/3.1/tests/texp.c + M /trunk/tests/tsub1sp.c -[src/exp3.c] Fixed bug in mpfr_exp_3 (affecting mpfr_exp). -[tests/texp.c] Added corresponding testcase. -(merged changesets r8797,8802 from the trunk) +[tests/tsub1sp.c] Corrected a type. And mpfr_equal_p being a predicate +function, it's better to use Boolean operators on it. ------------------------------------------------------------------------ -r8801 | vlefevre | 2014-01-20 11:22:00 +0000 (Mon, 20 Jan 2014) | 4 lines +r11976 | zimmerma | 2017-12-14 07:35:35 +0000 (Thu, 14 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/li2.c + M /trunk/tests/tsub1sp.c + +[tests/tsub1sp.c] added a generic test for bug20171213() -[src/li2.c] Use MPFR_RET_NEVER_GO_HERE () instead of MPFR_ASSERTN (0) -to avoid an error with: - ./configure --enable-logging CFLAGS="-Werror=return-type"; make -(merged changeset r8799 from the trunk) ------------------------------------------------------------------------ -r8800 | vlefevre | 2014-01-20 11:18:34 +0000 (Mon, 20 Jan 2014) | 3 lines +r11975 | vlefevre | 2017-12-14 02:17:05 +0000 (Thu, 14 Dec 2017) | 7 lines Changed paths: - A /branches/3.1/autogen.sh (from /trunk/autogen.sh:8797) + M /trunk/src/mul.c + M /trunk/src/sqr.c -Added autogen.sh sh script from Daniel Richard G. to install/update the -autotools files and clean up caches (useful before a release). -[copied from the trunk] +[src/{mul.c,sqr.c}] Minor changes, making code similar to sub1sp.c. +Checked with + grep -A 1 'sb *>>' src/*.c +that the bug fixed in r11974 does not occur in other parts of the code. +BTW, there is much duplicate code, as shown by the grep output, and +using macros could have avoided that, making bugs easier to reproduce +(since a same bug would be duplicate several times). ------------------------------------------------------------------------ -r8735 | vlefevre | 2014-01-07 00:53:51 +0000 (Tue, 07 Jan 2014) | 2 lines +r11974 | zimmerma | 2017-12-13 21:18:23 +0000 (Wed, 13 Dec 2017) | 3 lines Changed paths: - M /branches/3.1 - M /branches/3.1/TODO - M /branches/3.1/doc/README.dev - M /branches/3.1/src/div_ui.c - M /branches/3.1/src/eint.c - M /branches/3.1/src/erfc.c - M /branches/3.1/src/strtofr.c - M /branches/3.1/src/sub1sp.c - M /branches/3.1/src/vasprintf.c + M /trunk/src/sub1sp.c + M /trunk/tests/tsub1sp.c + +[src/sub1sp.c] fixed bug in mpfr_sub1sp2() +[tests/tsub1sp.c] added non-regression test -Fixed misspellings, using codespell. -(merged changesets r8733-8734 from the trunk) ------------------------------------------------------------------------ -r8727 | vlefevre | 2014-01-04 03:03:01 +0000 (Sat, 04 Jan 2014) | 1 line +r11973 | vlefevre | 2017-12-13 18:00:00 +0000 (Wed, 13 Dec 2017) | 1 line Changed paths: - M /branches/3.1/doc/mpfr.texi + M /trunk/src/mpf2mpfr.h -[doc/mpfr.texi] Updated the month. +[src/mpf2mpfr.h] Added a comment. ------------------------------------------------------------------------ -r8724 | vlefevre | 2014-01-03 20:39:49 +0000 (Fri, 03 Jan 2014) | 6 lines +r11972 | zimmerma | 2017-12-13 17:25:07 +0000 (Wed, 13 Dec 2017) | 2 lines Changed paths: - M /branches/3.1/BUGS - M /branches/3.1/INSTALL - M /branches/3.1/Makefile.am - M /branches/3.1/NEWS - M /branches/3.1/README - M /branches/3.1/TODO - M /branches/3.1/acinclude.m4 - M /branches/3.1/configure.ac - M /branches/3.1/doc/FAQ.html - M /branches/3.1/doc/Makefile.am - M /branches/3.1/doc/README.dev - M /branches/3.1/doc/faq.xsl - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/examples/divworst.c - M /branches/3.1/examples/rndo-add.c - M /branches/3.1/examples/sample.c - M /branches/3.1/examples/version.c - M /branches/3.1/src/Makefile.am - M /branches/3.1/src/abort_prec_max.c - M /branches/3.1/src/acos.c - M /branches/3.1/src/acosh.c - M /branches/3.1/src/add.c - M /branches/3.1/src/add1.c - M /branches/3.1/src/add1sp.c - M /branches/3.1/src/add_d.c - M /branches/3.1/src/add_ui.c - M /branches/3.1/src/agm.c - M /branches/3.1/src/ai.c - M /branches/3.1/src/amd/amdfam10/mparam.h - M /branches/3.1/src/amd/athlon/mparam.h - M /branches/3.1/src/amd/k8/mparam.h - M /branches/3.1/src/arm/mparam.h - M /branches/3.1/src/asin.c - M /branches/3.1/src/asinh.c - M /branches/3.1/src/atan.c - M /branches/3.1/src/atan2.c - M /branches/3.1/src/atanh.c - M /branches/3.1/src/bernoulli.c - M /branches/3.1/src/buildopt.c - M /branches/3.1/src/cache.c - M /branches/3.1/src/cbrt.c - M /branches/3.1/src/check.c - M /branches/3.1/src/clear.c - M /branches/3.1/src/clears.c - M /branches/3.1/src/cmp.c - M /branches/3.1/src/cmp2.c - M /branches/3.1/src/cmp_abs.c - M /branches/3.1/src/cmp_d.c - M /branches/3.1/src/cmp_ld.c - M /branches/3.1/src/cmp_si.c - M /branches/3.1/src/cmp_ui.c - M /branches/3.1/src/comparisons.c - M /branches/3.1/src/const_catalan.c - M /branches/3.1/src/const_euler.c - M /branches/3.1/src/const_log2.c - M /branches/3.1/src/const_pi.c - M /branches/3.1/src/constant.c - M /branches/3.1/src/copysign.c - M /branches/3.1/src/cos.c - M /branches/3.1/src/cosh.c - M /branches/3.1/src/cot.c - M /branches/3.1/src/coth.c - M /branches/3.1/src/csc.c - M /branches/3.1/src/csch.c - M /branches/3.1/src/d_div.c - M /branches/3.1/src/d_sub.c - M /branches/3.1/src/digamma.c - M /branches/3.1/src/dim.c - M /branches/3.1/src/div.c - M /branches/3.1/src/div_2exp.c - M /branches/3.1/src/div_2si.c - M /branches/3.1/src/div_2ui.c - M /branches/3.1/src/div_d.c - M /branches/3.1/src/div_ui.c - M /branches/3.1/src/dump.c - M /branches/3.1/src/eint.c - M /branches/3.1/src/eq.c - M /branches/3.1/src/erf.c - M /branches/3.1/src/erfc.c - M /branches/3.1/src/exceptions.c - M /branches/3.1/src/exp.c - M /branches/3.1/src/exp10.c - M /branches/3.1/src/exp2.c - M /branches/3.1/src/exp3.c - M /branches/3.1/src/exp_2.c - M /branches/3.1/src/expm1.c - M /branches/3.1/src/extract.c - M /branches/3.1/src/factorial.c - M /branches/3.1/src/fits_intmax.c - M /branches/3.1/src/fits_s.h - M /branches/3.1/src/fits_sint.c - M /branches/3.1/src/fits_slong.c - M /branches/3.1/src/fits_sshort.c - M /branches/3.1/src/fits_u.h - M /branches/3.1/src/fits_uint.c - M /branches/3.1/src/fits_uintmax.c - M /branches/3.1/src/fits_ulong.c - M /branches/3.1/src/fits_ushort.c - M /branches/3.1/src/fma.c - M /branches/3.1/src/fms.c - M /branches/3.1/src/frac.c - M /branches/3.1/src/free_cache.c - M /branches/3.1/src/frexp.c - M /branches/3.1/src/gamma.c - M /branches/3.1/src/gammaonethird.c - M /branches/3.1/src/gen_inverse.h - M /branches/3.1/src/generic/mparam.h - M /branches/3.1/src/get_d.c - M /branches/3.1/src/get_d64.c - M /branches/3.1/src/get_exp.c - M /branches/3.1/src/get_f.c - M /branches/3.1/src/get_flt.c - M /branches/3.1/src/get_ld.c - M /branches/3.1/src/get_si.c - M /branches/3.1/src/get_sj.c - M /branches/3.1/src/get_str.c - M /branches/3.1/src/get_ui.c - M /branches/3.1/src/get_uj.c - M /branches/3.1/src/get_z.c - M /branches/3.1/src/get_z_exp.c - M /branches/3.1/src/gmp_op.c - M /branches/3.1/src/grandom.c - M /branches/3.1/src/hppa/mparam.h - M /branches/3.1/src/hypot.c - M /branches/3.1/src/ia64/mparam.h - M /branches/3.1/src/ieee_floats.h - M /branches/3.1/src/init.c - M /branches/3.1/src/init2.c - M /branches/3.1/src/inits.c - M /branches/3.1/src/inits2.c - M /branches/3.1/src/inp_str.c - M /branches/3.1/src/int_ceil_log2.c - M /branches/3.1/src/isinf.c - M /branches/3.1/src/isinteger.c - M /branches/3.1/src/isnan.c - M /branches/3.1/src/isnum.c - M /branches/3.1/src/isqrt.c - M /branches/3.1/src/isregular.c - M /branches/3.1/src/iszero.c - M /branches/3.1/src/jn.c - M /branches/3.1/src/jyn_asympt.c - M /branches/3.1/src/li2.c - M /branches/3.1/src/lngamma.c - M /branches/3.1/src/log.c - M /branches/3.1/src/log10.c - M /branches/3.1/src/log1p.c - M /branches/3.1/src/log2.c - M /branches/3.1/src/logging.c - M /branches/3.1/src/min_prec.c - M /branches/3.1/src/minmax.c - M /branches/3.1/src/modf.c - M /branches/3.1/src/mp_clz_tab.c - M /branches/3.1/src/mparam_h.in - M /branches/3.1/src/mpf2mpfr.h - M /branches/3.1/src/mpfr-gmp.c - M /branches/3.1/src/mpfr-gmp.h - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/src/mpfr-intmax.h - M /branches/3.1/src/mpfr-longlong.h - M /branches/3.1/src/mpfr-thread.h - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/mpn_exp.c - M /branches/3.1/src/mul.c - M /branches/3.1/src/mul_2exp.c - M /branches/3.1/src/mul_2si.c - M /branches/3.1/src/mul_2ui.c - M /branches/3.1/src/mul_d.c - M /branches/3.1/src/mul_ui.c - M /branches/3.1/src/mulders.c - M /branches/3.1/src/neg.c - M /branches/3.1/src/next.c - M /branches/3.1/src/out_raw.c - M /branches/3.1/src/out_str.c - M /branches/3.1/src/pow.c - M /branches/3.1/src/pow_si.c - M /branches/3.1/src/pow_ui.c - M /branches/3.1/src/pow_z.c - M /branches/3.1/src/powerof2.c - M /branches/3.1/src/powerpc32/mparam.h - M /branches/3.1/src/powerpc64/mparam.h - M /branches/3.1/src/print_raw.c - M /branches/3.1/src/print_rnd_mode.c - M /branches/3.1/src/printf.c - M /branches/3.1/src/rec_sqrt.c - M /branches/3.1/src/reldiff.c - M /branches/3.1/src/rem1.c - M /branches/3.1/src/rint.c - M /branches/3.1/src/root.c - M /branches/3.1/src/round_near_x.c - M /branches/3.1/src/round_p.c - M /branches/3.1/src/round_prec.c - M /branches/3.1/src/round_raw_generic.c - M /branches/3.1/src/scale2.c - M /branches/3.1/src/sec.c - M /branches/3.1/src/sech.c - M /branches/3.1/src/set.c - M /branches/3.1/src/set_d.c - M /branches/3.1/src/set_d64.c - M /branches/3.1/src/set_dfl_prec.c - M /branches/3.1/src/set_exp.c - M /branches/3.1/src/set_f.c - M /branches/3.1/src/set_flt.c - M /branches/3.1/src/set_inf.c - M /branches/3.1/src/set_ld.c - M /branches/3.1/src/set_nan.c - M /branches/3.1/src/set_prc_raw.c - M /branches/3.1/src/set_prec.c - M /branches/3.1/src/set_q.c - M /branches/3.1/src/set_rnd.c - M /branches/3.1/src/set_si.c - M /branches/3.1/src/set_si_2exp.c - M /branches/3.1/src/set_sj.c - M /branches/3.1/src/set_str.c - M /branches/3.1/src/set_str_raw.c - M /branches/3.1/src/set_ui.c - M /branches/3.1/src/set_ui_2exp.c - M /branches/3.1/src/set_uj.c - M /branches/3.1/src/set_z.c - M /branches/3.1/src/set_z_exp.c - M /branches/3.1/src/set_zero.c - M /branches/3.1/src/setmax.c - M /branches/3.1/src/setmin.c - M /branches/3.1/src/setsign.c - M /branches/3.1/src/sgn.c - M /branches/3.1/src/si_op.c - M /branches/3.1/src/signbit.c - M /branches/3.1/src/sin.c - M /branches/3.1/src/sin_cos.c - M /branches/3.1/src/sinh.c - M /branches/3.1/src/sinh_cosh.c - M /branches/3.1/src/sparc64/mparam.h - M /branches/3.1/src/sqr.c - M /branches/3.1/src/sqrt.c - M /branches/3.1/src/sqrt_ui.c - M /branches/3.1/src/stack_interface.c - M /branches/3.1/src/strtofr.c - M /branches/3.1/src/sub.c - M /branches/3.1/src/sub1.c - M /branches/3.1/src/sub1sp.c - M /branches/3.1/src/sub_d.c - M /branches/3.1/src/sub_ui.c - M /branches/3.1/src/subnormal.c - M /branches/3.1/src/sum.c - M /branches/3.1/src/swap.c - M /branches/3.1/src/tan.c - M /branches/3.1/src/tanh.c - M /branches/3.1/src/uceil_exp2.c - M /branches/3.1/src/uceil_log2.c - M /branches/3.1/src/ufloor_log2.c - M /branches/3.1/src/ui_div.c - M /branches/3.1/src/ui_pow.c - M /branches/3.1/src/ui_pow_ui.c - M /branches/3.1/src/ui_sub.c - M /branches/3.1/src/urandom.c - M /branches/3.1/src/urandomb.c - M /branches/3.1/src/vasprintf.c - M /branches/3.1/src/version.c - M /branches/3.1/src/volatile.c - M /branches/3.1/src/x86/core2/mparam.h - M /branches/3.1/src/x86/mparam.h - M /branches/3.1/src/x86_64/core2/mparam.h - M /branches/3.1/src/x86_64/pentium4/mparam.h - M /branches/3.1/src/yn.c - M /branches/3.1/src/zeta.c - M /branches/3.1/src/zeta_ui.c - M /branches/3.1/tests/Makefile.am - M /branches/3.1/tests/cmp_str.c - M /branches/3.1/tests/data/digamma - M /branches/3.1/tests/data/li2 - M /branches/3.1/tests/memory.c - M /branches/3.1/tests/mpf_compat.c - M /branches/3.1/tests/mpf_compat.h - M /branches/3.1/tests/mpfr-test.h - M /branches/3.1/tests/mpfr_compat.c - M /branches/3.1/tests/random2.c - M /branches/3.1/tests/reuse.c - M /branches/3.1/tests/rnd_mode.c - M /branches/3.1/tests/tabs.c - M /branches/3.1/tests/tacos.c - M /branches/3.1/tests/tacosh.c - M /branches/3.1/tests/tadd.c - M /branches/3.1/tests/tadd1sp.c - M /branches/3.1/tests/tadd_d.c - M /branches/3.1/tests/tadd_ui.c - M /branches/3.1/tests/tagm.c - M /branches/3.1/tests/tai.c - M /branches/3.1/tests/tasin.c - M /branches/3.1/tests/tasinh.c - M /branches/3.1/tests/tatan.c - M /branches/3.1/tests/tatanh.c - M /branches/3.1/tests/taway.c - M /branches/3.1/tests/tbuildopt.c - M /branches/3.1/tests/tcan_round.c - M /branches/3.1/tests/tcbrt.c - M /branches/3.1/tests/tcheck.c - M /branches/3.1/tests/tcmp.c - M /branches/3.1/tests/tcmp2.c - M /branches/3.1/tests/tcmp_d.c - M /branches/3.1/tests/tcmp_ld.c - M /branches/3.1/tests/tcmp_ui.c - M /branches/3.1/tests/tcmpabs.c - M /branches/3.1/tests/tcomparisons.c - M /branches/3.1/tests/tconst_catalan.c - M /branches/3.1/tests/tconst_euler.c - M /branches/3.1/tests/tconst_log2.c - M /branches/3.1/tests/tconst_pi.c - M /branches/3.1/tests/tcopysign.c - M /branches/3.1/tests/tcos.c - M /branches/3.1/tests/tcosh.c - M /branches/3.1/tests/tcot.c - M /branches/3.1/tests/tcoth.c - M /branches/3.1/tests/tcsc.c - M /branches/3.1/tests/tcsch.c - M /branches/3.1/tests/td_div.c - M /branches/3.1/tests/td_sub.c - M /branches/3.1/tests/tdigamma.c - M /branches/3.1/tests/tdim.c - M /branches/3.1/tests/tdiv.c - M /branches/3.1/tests/tdiv_d.c - M /branches/3.1/tests/tdiv_ui.c - M /branches/3.1/tests/teint.c - M /branches/3.1/tests/teq.c - M /branches/3.1/tests/terf.c - M /branches/3.1/tests/tests.c - M /branches/3.1/tests/texceptions.c - M /branches/3.1/tests/texp.c - M /branches/3.1/tests/texp10.c - M /branches/3.1/tests/texp2.c - M /branches/3.1/tests/texpm1.c - M /branches/3.1/tests/tfactorial.c - M /branches/3.1/tests/tfits.c - M /branches/3.1/tests/tfma.c - M /branches/3.1/tests/tfmod.c - M /branches/3.1/tests/tfms.c - M /branches/3.1/tests/tfprintf.c - M /branches/3.1/tests/tfrac.c - M /branches/3.1/tests/tfrexp.c - M /branches/3.1/tests/tgamma.c - M /branches/3.1/tests/tgeneric.c - M /branches/3.1/tests/tgeneric_ui.c - M /branches/3.1/tests/tget_d.c - M /branches/3.1/tests/tget_d_2exp.c - M /branches/3.1/tests/tget_f.c - M /branches/3.1/tests/tget_flt.c - M /branches/3.1/tests/tget_ld_2exp.c - M /branches/3.1/tests/tget_set_d64.c - M /branches/3.1/tests/tget_sj.c - M /branches/3.1/tests/tget_str.c - M /branches/3.1/tests/tget_z.c - M /branches/3.1/tests/tgmpop.c - M /branches/3.1/tests/tgrandom.c - M /branches/3.1/tests/thyperbolic.c - M /branches/3.1/tests/thypot.c - M /branches/3.1/tests/tinits.c - M /branches/3.1/tests/tinp_str.c - M /branches/3.1/tests/tinternals.c - M /branches/3.1/tests/tisnan.c - M /branches/3.1/tests/tisqrt.c - M /branches/3.1/tests/tj0.c - M /branches/3.1/tests/tj1.c - M /branches/3.1/tests/tjn.c - M /branches/3.1/tests/tl2b.c - M /branches/3.1/tests/tlgamma.c - M /branches/3.1/tests/tli2.c - M /branches/3.1/tests/tlngamma.c - M /branches/3.1/tests/tlog.c - M /branches/3.1/tests/tlog10.c - M /branches/3.1/tests/tlog1p.c - M /branches/3.1/tests/tlog2.c - M /branches/3.1/tests/tmin_prec.c - M /branches/3.1/tests/tminmax.c - M /branches/3.1/tests/tmodf.c - M /branches/3.1/tests/tmul.c - M /branches/3.1/tests/tmul_2exp.c - M /branches/3.1/tests/tmul_d.c - M /branches/3.1/tests/tmul_ui.c - M /branches/3.1/tests/tnext.c - M /branches/3.1/tests/tout_str.c - M /branches/3.1/tests/toutimpl.c - M /branches/3.1/tests/tpow.c - M /branches/3.1/tests/tpow3.c - M /branches/3.1/tests/tpow_all.c - M /branches/3.1/tests/tpow_z.c - M /branches/3.1/tests/tprintf.c - M /branches/3.1/tests/trandom.c - M /branches/3.1/tests/trec_sqrt.c - M /branches/3.1/tests/tremquo.c - M /branches/3.1/tests/trint.c - M /branches/3.1/tests/troot.c - M /branches/3.1/tests/tround_prec.c - M /branches/3.1/tests/tsec.c - M /branches/3.1/tests/tsech.c - M /branches/3.1/tests/tset.c - M /branches/3.1/tests/tset_d.c - M /branches/3.1/tests/tset_exp.c - M /branches/3.1/tests/tset_f.c - M /branches/3.1/tests/tset_ld.c - M /branches/3.1/tests/tset_q.c - M /branches/3.1/tests/tset_si.c - M /branches/3.1/tests/tset_sj.c - M /branches/3.1/tests/tset_str.c - M /branches/3.1/tests/tset_z.c - M /branches/3.1/tests/tset_z_exp.c - M /branches/3.1/tests/tsgn.c - M /branches/3.1/tests/tsi_op.c - M /branches/3.1/tests/tsin.c - M /branches/3.1/tests/tsin_cos.c - M /branches/3.1/tests/tsinh.c - M /branches/3.1/tests/tsinh_cosh.c - M /branches/3.1/tests/tsprintf.c - M /branches/3.1/tests/tsqr.c - M /branches/3.1/tests/tsqrt.c - M /branches/3.1/tests/tsqrt_ui.c - M /branches/3.1/tests/tstckintc.c - M /branches/3.1/tests/tstdint.c - M /branches/3.1/tests/tstrtofr.c - M /branches/3.1/tests/tsub.c - M /branches/3.1/tests/tsub1sp.c - M /branches/3.1/tests/tsub_d.c - M /branches/3.1/tests/tsub_ui.c - M /branches/3.1/tests/tsubnormal.c - M /branches/3.1/tests/tsum.c - M /branches/3.1/tests/tswap.c - M /branches/3.1/tests/ttan.c - M /branches/3.1/tests/ttanh.c - M /branches/3.1/tests/ttrunc.c - M /branches/3.1/tests/tui_div.c - M /branches/3.1/tests/tui_pow.c - M /branches/3.1/tests/tui_sub.c - M /branches/3.1/tests/turandom.c - M /branches/3.1/tests/tvalist.c - M /branches/3.1/tests/tversion.c - M /branches/3.1/tests/ty0.c - M /branches/3.1/tests/ty1.c - M /branches/3.1/tests/tyn.c - M /branches/3.1/tests/tzeta.c - M /branches/3.1/tests/tzeta_ui.c - M /branches/3.1/tools/ck-copyright-notice - M /branches/3.1/tools/ck-mparam - M /branches/3.1/tools/ck-version-info - M /branches/3.1/tools/get_patches.sh - M /branches/3.1/tune/Makefile.am - M /branches/3.1/tune/bidimensional_sample.c - M /branches/3.1/tune/speed.c - M /branches/3.1/tune/tuneup.c + M /trunk/src/mpf2mpfr.h + +[src/mpf2mpfr.h] missing mpf_inits/mpf_clears -Copyright notice update: added 2014 with - perl -pi -e 's/ (\d{4}-)?(2013)(?= Free Software)/ - " ".($1||"$2-").($2+1)/e' **/*(^/) -under zsh, reverting the ChangeLog file (the m4 and tools/mbench -directories were not modified). -Removed 2013 from the example in the doc/README.dev file. ------------------------------------------------------------------------ -r8718 | vlefevre | 2013-11-28 18:19:35 +0000 (Thu, 28 Nov 2013) | 2 lines +r11969 | zimmerma | 2017-12-13 07:05:01 +0000 (Wed, 13 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tstckintc.c + M /trunk/src/mpfr-gmp.h + +[src/mpfr-gmp.h] redefine __clz_tab also with gmp-build -[tests/tstckintc.c] Correction and test improvements. -(merged changesets r8264,8716 from the trunk) ------------------------------------------------------------------------ -r8717 | vlefevre | 2013-11-28 18:15:18 +0000 (Thu, 28 Nov 2013) | 6 lines +r11968 | vlefevre | 2017-12-12 22:20:41 +0000 (Tue, 12 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/mpfr.h + M /trunk/configure.ac -[src/mpfr.h] Fixed bug in the mpfr_custom_init_set macro (typo in -variable name, which can yield incorrect behavior if the second -argument is not a simple expression). -Thanks to Andreas Enge for the bug report: - https://sympa.inria.fr/sympa/arc/mpfr/2013-11/msg00029.html -(merged changeset r8715 from the trunk) +[configure.ac] Improved error message. ------------------------------------------------------------------------ -r8710 | vlefevre | 2013-11-15 00:47:50 +0000 (Fri, 15 Nov 2013) | 2 lines +r11967 | vlefevre | 2017-12-12 15:38:37 +0000 (Tue, 12 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tsprintf.c + M /trunk/tests/talloc.c -[tests/tsprintf.c] Added a few tests. -(merged changeset r8709 from the trunk) +[tests/talloc.c] Added a comment about why talloc requires ISO C99. ------------------------------------------------------------------------ -r8708 | vlefevre | 2013-11-15 00:37:30 +0000 (Fri, 15 Nov 2013) | 5 lines +r11966 | vlefevre | 2017-12-12 15:35:34 +0000 (Tue, 12 Dec 2017) | 4 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/vasprintf.c - M /branches/3.1/tests/tsprintf.c + M /trunk/src/mpfr-cvers.h -[src/vasprintf.c] Fixed bug reported by David Binderman, occurring when - outputting 0 with the '#' flag, a positive precision, and the 'g'/'G' - conversion specifier: there was one additional trailing 0. -[tests/tsprintf.c] Corrected the corresponding test. -(merged changesets r8705-8706 from the trunk) +[src/mpfr-cvers.h] Removed a useless test for __MPFR_STDC, as one just +needs to check whether we have a C99, C11, etc. implementation (if not +done via a configure test). Particular incompatibilities with the C90 +standard should always be checked via a configure test. ------------------------------------------------------------------------ -r8704 | vlefevre | 2013-11-06 15:15:12 +0000 (Wed, 06 Nov 2013) | 2 lines +r11965 | vlefevre | 2017-12-12 12:04:01 +0000 (Tue, 12 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tests/thypot.c + M /trunk/tests -[tests/thypot.c] Fix use of non explicitly initialized variable in NaN test. -(merged changesets r8702-8703 from the trunk) +[tests] Added *.exe to svn:ignore property (files from MinGW builds). ------------------------------------------------------------------------ -r8691 | vlefevre | 2013-09-27 13:50:16 +0000 (Fri, 27 Sep 2013) | 8 lines +r11964 | zimmerma | 2017-12-12 11:07:36 +0000 (Tue, 12 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/tests/tget_flt.c - M /branches/3.1/tests/tset_ld.c + M /trunk/tools/timings-mpfr.c -Made changes to avoid test failures with: - clang -O2 -fsanitize=undefined -fno-sanitize-recover -[src/mpfr-impl.h] With clang, disable division by zero using constants -due to a bug in its sanitizer and because IEEE 754 division by zero is -currently not properly supported. -[tests/{tget_flt.c,tset_ld.c}] Avoid divisions by 0 if MPFR_ERRDIVZERO -and avoid an overflow on double. -(merged changesets r8685-8687,8690 from the trunk) ------------------------------------------------------------------------- -r8684 | vlefevre | 2013-09-26 10:47:05 +0000 (Thu, 26 Sep 2013) | 7 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/src/fits_u.h - M /branches/3.1/src/fits_uintmax.c - M /branches/3.1/tests/tfits.c +[tools/timings-mpfr.c] always use clock() [now very accurate under Linux] -[src/{fits_u.h,fits_uintmax.c}] Fixed the mpfr_fits_u*_p functions, - which incorrectly returned 0 ("doesn't fit") on negative arguments - when the rounding to an integer was 0. The fits_uintmax.c file now - uses fits_u.h for consistency. -[tests/tfits.c] Added tests, in particular for small negative op - (triggering the above bug) and in non-RNDN rounding modes. -(merged changesets r8494,8501-8503 from the trunk) ------------------------------------------------------------------------ -r8683 | vlefevre | 2013-09-26 10:28:49 +0000 (Thu, 26 Sep 2013) | 3 lines +r11963 | vlefevre | 2017-12-12 10:15:50 +0000 (Tue, 12 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/exp_2.c + M /trunk/tools/timings-mpfr.c -[src/exp_2.c] Fixed undefined behavior (present in all MPFR versions) -detected by "clang -fsanitize=undefined". -(merged changeset r8604 from the trunk) +[tools/timings-mpfr.c] Updated years in copyright notice. ------------------------------------------------------------------------ -r8545 | vlefevre | 2013-05-30 15:59:08 +0000 (Thu, 30 May 2013) | 2 lines +r11962 | vlefevre | 2017-12-12 10:14:08 +0000 (Tue, 12 Dec 2017) | 1 line Changed paths: - M /branches/3.1/tools/ck-copyright-notice + M /trunk/tools/timings-mpfr.c -[tools/ck-copyright-notice] Update for copyright year ranges. -(merged changeset r8544 from the trunk) +[tools/timings-mpfr.c] Fixed prototypes. ------------------------------------------------------------------------ -r8543 | vlefevre | 2013-05-30 15:55:09 +0000 (Thu, 30 May 2013) | 1 line +r11961 | vlefevre | 2017-12-12 10:12:48 +0000 (Tue, 12 Dec 2017) | 2 lines Changed paths: - M /branches/3.1/doc/mpfr.texi + M /trunk/tools/timings-mpfr.c -[doc/mpfr.texi] Updated the month. +[tools/timings-mpfr.c] Added a defined(_MSC_VER). But clock() is +standard, so why not always using it? ------------------------------------------------------------------------ -r8541 | vlefevre | 2013-05-30 15:53:34 +0000 (Thu, 30 May 2013) | 2 lines +r11960 | vlefevre | 2017-12-12 01:17:00 +0000 (Tue, 12 Dec 2017) | 1 line Changed paths: - M /branches/3.1/BUGS - M /branches/3.1/INSTALL - M /branches/3.1/Makefile.am - M /branches/3.1/NEWS - M /branches/3.1/README - M /branches/3.1/TODO - M /branches/3.1/acinclude.m4 - M /branches/3.1/configure.ac - M /branches/3.1/doc/FAQ.html - M /branches/3.1/doc/Makefile.am - M /branches/3.1/doc/README.dev - M /branches/3.1/doc/faq.xsl - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/examples/divworst.c - M /branches/3.1/examples/rndo-add.c - M /branches/3.1/examples/sample.c - M /branches/3.1/examples/version.c - M /branches/3.1/src/Makefile.am - M /branches/3.1/src/abort_prec_max.c - M /branches/3.1/src/acos.c - M /branches/3.1/src/acosh.c - M /branches/3.1/src/add.c - M /branches/3.1/src/add1.c - M /branches/3.1/src/add1sp.c - M /branches/3.1/src/add_d.c - M /branches/3.1/src/add_ui.c - M /branches/3.1/src/agm.c - M /branches/3.1/src/ai.c - M /branches/3.1/src/amd/amdfam10/mparam.h - M /branches/3.1/src/amd/athlon/mparam.h - M /branches/3.1/src/amd/k8/mparam.h - M /branches/3.1/src/arm/mparam.h - M /branches/3.1/src/asin.c - M /branches/3.1/src/asinh.c - M /branches/3.1/src/atan.c - M /branches/3.1/src/atan2.c - M /branches/3.1/src/atanh.c - M /branches/3.1/src/bernoulli.c - M /branches/3.1/src/buildopt.c - M /branches/3.1/src/cache.c - M /branches/3.1/src/cbrt.c - M /branches/3.1/src/check.c - M /branches/3.1/src/clear.c - M /branches/3.1/src/clears.c - M /branches/3.1/src/cmp.c - M /branches/3.1/src/cmp2.c - M /branches/3.1/src/cmp_abs.c - M /branches/3.1/src/cmp_d.c - M /branches/3.1/src/cmp_ld.c - M /branches/3.1/src/cmp_si.c - M /branches/3.1/src/cmp_ui.c - M /branches/3.1/src/comparisons.c - M /branches/3.1/src/const_catalan.c - M /branches/3.1/src/const_euler.c - M /branches/3.1/src/const_log2.c - M /branches/3.1/src/const_pi.c - M /branches/3.1/src/constant.c - M /branches/3.1/src/copysign.c - M /branches/3.1/src/cos.c - M /branches/3.1/src/cosh.c - M /branches/3.1/src/cot.c - M /branches/3.1/src/coth.c - M /branches/3.1/src/csc.c - M /branches/3.1/src/csch.c - M /branches/3.1/src/d_div.c - M /branches/3.1/src/d_sub.c - M /branches/3.1/src/digamma.c - M /branches/3.1/src/dim.c - M /branches/3.1/src/div.c - M /branches/3.1/src/div_2exp.c - M /branches/3.1/src/div_2si.c - M /branches/3.1/src/div_2ui.c - M /branches/3.1/src/div_d.c - M /branches/3.1/src/div_ui.c - M /branches/3.1/src/dump.c - M /branches/3.1/src/eint.c - M /branches/3.1/src/eq.c - M /branches/3.1/src/erf.c - M /branches/3.1/src/erfc.c - M /branches/3.1/src/exceptions.c - M /branches/3.1/src/exp.c - M /branches/3.1/src/exp10.c - M /branches/3.1/src/exp2.c - M /branches/3.1/src/exp3.c - M /branches/3.1/src/exp_2.c - M /branches/3.1/src/expm1.c - M /branches/3.1/src/extract.c - M /branches/3.1/src/factorial.c - M /branches/3.1/src/fits_intmax.c - M /branches/3.1/src/fits_s.h - M /branches/3.1/src/fits_sint.c - M /branches/3.1/src/fits_slong.c - M /branches/3.1/src/fits_sshort.c - M /branches/3.1/src/fits_u.h - M /branches/3.1/src/fits_uint.c - M /branches/3.1/src/fits_uintmax.c - M /branches/3.1/src/fits_ulong.c - M /branches/3.1/src/fits_ushort.c - M /branches/3.1/src/fma.c - M /branches/3.1/src/fms.c - M /branches/3.1/src/frac.c - M /branches/3.1/src/free_cache.c - M /branches/3.1/src/frexp.c - M /branches/3.1/src/gamma.c - M /branches/3.1/src/gammaonethird.c - M /branches/3.1/src/gen_inverse.h - M /branches/3.1/src/generic/mparam.h - M /branches/3.1/src/get_d.c - M /branches/3.1/src/get_d64.c - M /branches/3.1/src/get_exp.c - M /branches/3.1/src/get_f.c - M /branches/3.1/src/get_flt.c - M /branches/3.1/src/get_ld.c - M /branches/3.1/src/get_si.c - M /branches/3.1/src/get_sj.c - M /branches/3.1/src/get_str.c - M /branches/3.1/src/get_ui.c - M /branches/3.1/src/get_uj.c - M /branches/3.1/src/get_z.c - M /branches/3.1/src/get_z_exp.c - M /branches/3.1/src/gmp_op.c - M /branches/3.1/src/grandom.c - M /branches/3.1/src/hppa/mparam.h - M /branches/3.1/src/hypot.c - M /branches/3.1/src/ia64/mparam.h - M /branches/3.1/src/ieee_floats.h - M /branches/3.1/src/init.c - M /branches/3.1/src/init2.c - M /branches/3.1/src/inits.c - M /branches/3.1/src/inits2.c - M /branches/3.1/src/inp_str.c - M /branches/3.1/src/int_ceil_log2.c - M /branches/3.1/src/isinf.c - M /branches/3.1/src/isinteger.c - M /branches/3.1/src/isnan.c - M /branches/3.1/src/isnum.c - M /branches/3.1/src/isqrt.c - M /branches/3.1/src/isregular.c - M /branches/3.1/src/iszero.c - M /branches/3.1/src/jn.c - M /branches/3.1/src/jyn_asympt.c - M /branches/3.1/src/li2.c - M /branches/3.1/src/lngamma.c - M /branches/3.1/src/log.c - M /branches/3.1/src/log10.c - M /branches/3.1/src/log1p.c - M /branches/3.1/src/log2.c - M /branches/3.1/src/logging.c - M /branches/3.1/src/min_prec.c - M /branches/3.1/src/minmax.c - M /branches/3.1/src/modf.c - M /branches/3.1/src/mp_clz_tab.c - M /branches/3.1/src/mparam_h.in - M /branches/3.1/src/mpf2mpfr.h - M /branches/3.1/src/mpfr-gmp.c - M /branches/3.1/src/mpfr-gmp.h - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/src/mpfr-intmax.h - M /branches/3.1/src/mpfr-thread.h - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/mpn_exp.c - M /branches/3.1/src/mul.c - M /branches/3.1/src/mul_2exp.c - M /branches/3.1/src/mul_2si.c - M /branches/3.1/src/mul_2ui.c - M /branches/3.1/src/mul_d.c - M /branches/3.1/src/mul_ui.c - M /branches/3.1/src/mulders.c - M /branches/3.1/src/neg.c - M /branches/3.1/src/next.c - M /branches/3.1/src/out_raw.c - M /branches/3.1/src/out_str.c - M /branches/3.1/src/pow.c - M /branches/3.1/src/pow_si.c - M /branches/3.1/src/pow_ui.c - M /branches/3.1/src/pow_z.c - M /branches/3.1/src/powerof2.c - M /branches/3.1/src/powerpc32/mparam.h - M /branches/3.1/src/powerpc64/mparam.h - M /branches/3.1/src/print_raw.c - M /branches/3.1/src/print_rnd_mode.c - M /branches/3.1/src/printf.c - M /branches/3.1/src/rec_sqrt.c - M /branches/3.1/src/reldiff.c - M /branches/3.1/src/rem1.c - M /branches/3.1/src/rint.c - M /branches/3.1/src/root.c - M /branches/3.1/src/round_near_x.c - M /branches/3.1/src/round_p.c - M /branches/3.1/src/round_prec.c - M /branches/3.1/src/round_raw_generic.c - M /branches/3.1/src/scale2.c - M /branches/3.1/src/sec.c - M /branches/3.1/src/sech.c - M /branches/3.1/src/set.c - M /branches/3.1/src/set_d.c - M /branches/3.1/src/set_d64.c - M /branches/3.1/src/set_dfl_prec.c - M /branches/3.1/src/set_exp.c - M /branches/3.1/src/set_f.c - M /branches/3.1/src/set_flt.c - M /branches/3.1/src/set_inf.c - M /branches/3.1/src/set_ld.c - M /branches/3.1/src/set_nan.c - M /branches/3.1/src/set_prc_raw.c - M /branches/3.1/src/set_prec.c - M /branches/3.1/src/set_q.c - M /branches/3.1/src/set_rnd.c - M /branches/3.1/src/set_si.c - M /branches/3.1/src/set_si_2exp.c - M /branches/3.1/src/set_sj.c - M /branches/3.1/src/set_str.c - M /branches/3.1/src/set_str_raw.c - M /branches/3.1/src/set_ui.c - M /branches/3.1/src/set_ui_2exp.c - M /branches/3.1/src/set_uj.c - M /branches/3.1/src/set_z.c - M /branches/3.1/src/set_z_exp.c - M /branches/3.1/src/set_zero.c - M /branches/3.1/src/setmax.c - M /branches/3.1/src/setmin.c - M /branches/3.1/src/setsign.c - M /branches/3.1/src/sgn.c - M /branches/3.1/src/si_op.c - M /branches/3.1/src/signbit.c - M /branches/3.1/src/sin.c - M /branches/3.1/src/sin_cos.c - M /branches/3.1/src/sinh.c - M /branches/3.1/src/sinh_cosh.c - M /branches/3.1/src/sparc64/mparam.h - M /branches/3.1/src/sqr.c - M /branches/3.1/src/sqrt.c - M /branches/3.1/src/sqrt_ui.c - M /branches/3.1/src/stack_interface.c - M /branches/3.1/src/strtofr.c - M /branches/3.1/src/sub.c - M /branches/3.1/src/sub1.c - M /branches/3.1/src/sub1sp.c - M /branches/3.1/src/sub_d.c - M /branches/3.1/src/sub_ui.c - M /branches/3.1/src/subnormal.c - M /branches/3.1/src/sum.c - M /branches/3.1/src/swap.c - M /branches/3.1/src/tan.c - M /branches/3.1/src/tanh.c - M /branches/3.1/src/uceil_exp2.c - M /branches/3.1/src/uceil_log2.c - M /branches/3.1/src/ufloor_log2.c - M /branches/3.1/src/ui_div.c - M /branches/3.1/src/ui_pow.c - M /branches/3.1/src/ui_pow_ui.c - M /branches/3.1/src/ui_sub.c - M /branches/3.1/src/urandom.c - M /branches/3.1/src/urandomb.c - M /branches/3.1/src/vasprintf.c - M /branches/3.1/src/version.c - M /branches/3.1/src/volatile.c - M /branches/3.1/src/x86/core2/mparam.h - M /branches/3.1/src/x86/mparam.h - M /branches/3.1/src/x86_64/core2/mparam.h - M /branches/3.1/src/x86_64/pentium4/mparam.h - M /branches/3.1/src/yn.c - M /branches/3.1/src/zeta.c - M /branches/3.1/src/zeta_ui.c - M /branches/3.1/tests/Makefile.am - M /branches/3.1/tests/cmp_str.c - M /branches/3.1/tests/data/digamma - M /branches/3.1/tests/data/li2 - M /branches/3.1/tests/memory.c - M /branches/3.1/tests/mpf_compat.c - M /branches/3.1/tests/mpf_compat.h - M /branches/3.1/tests/mpfr-test.h - M /branches/3.1/tests/mpfr_compat.c - M /branches/3.1/tests/random2.c - M /branches/3.1/tests/reuse.c - M /branches/3.1/tests/rnd_mode.c - M /branches/3.1/tests/tabs.c - M /branches/3.1/tests/tacos.c - M /branches/3.1/tests/tacosh.c - M /branches/3.1/tests/tadd.c - M /branches/3.1/tests/tadd1sp.c - M /branches/3.1/tests/tadd_d.c - M /branches/3.1/tests/tadd_ui.c - M /branches/3.1/tests/tagm.c - M /branches/3.1/tests/tai.c - M /branches/3.1/tests/tasin.c - M /branches/3.1/tests/tasinh.c - M /branches/3.1/tests/tatan.c - M /branches/3.1/tests/tatanh.c - M /branches/3.1/tests/taway.c - M /branches/3.1/tests/tbuildopt.c - M /branches/3.1/tests/tcan_round.c - M /branches/3.1/tests/tcbrt.c - M /branches/3.1/tests/tcheck.c - M /branches/3.1/tests/tcmp.c - M /branches/3.1/tests/tcmp2.c - M /branches/3.1/tests/tcmp_d.c - M /branches/3.1/tests/tcmp_ld.c - M /branches/3.1/tests/tcmp_ui.c - M /branches/3.1/tests/tcmpabs.c - M /branches/3.1/tests/tcomparisons.c - M /branches/3.1/tests/tconst_catalan.c - M /branches/3.1/tests/tconst_euler.c - M /branches/3.1/tests/tconst_log2.c - M /branches/3.1/tests/tconst_pi.c - M /branches/3.1/tests/tcopysign.c - M /branches/3.1/tests/tcos.c - M /branches/3.1/tests/tcosh.c - M /branches/3.1/tests/tcot.c - M /branches/3.1/tests/tcoth.c - M /branches/3.1/tests/tcsc.c - M /branches/3.1/tests/tcsch.c - M /branches/3.1/tests/td_div.c - M /branches/3.1/tests/td_sub.c - M /branches/3.1/tests/tdigamma.c - M /branches/3.1/tests/tdim.c - M /branches/3.1/tests/tdiv.c - M /branches/3.1/tests/tdiv_d.c - M /branches/3.1/tests/tdiv_ui.c - M /branches/3.1/tests/teint.c - M /branches/3.1/tests/teq.c - M /branches/3.1/tests/terf.c - M /branches/3.1/tests/tests.c - M /branches/3.1/tests/texceptions.c - M /branches/3.1/tests/texp.c - M /branches/3.1/tests/texp10.c - M /branches/3.1/tests/texp2.c - M /branches/3.1/tests/texpm1.c - M /branches/3.1/tests/tfactorial.c - M /branches/3.1/tests/tfits.c - M /branches/3.1/tests/tfma.c - M /branches/3.1/tests/tfmod.c - M /branches/3.1/tests/tfms.c - M /branches/3.1/tests/tfprintf.c - M /branches/3.1/tests/tfrac.c - M /branches/3.1/tests/tfrexp.c - M /branches/3.1/tests/tgamma.c - M /branches/3.1/tests/tgeneric.c - M /branches/3.1/tests/tgeneric_ui.c - M /branches/3.1/tests/tget_d.c - M /branches/3.1/tests/tget_d_2exp.c - M /branches/3.1/tests/tget_f.c - M /branches/3.1/tests/tget_flt.c - M /branches/3.1/tests/tget_ld_2exp.c - M /branches/3.1/tests/tget_set_d64.c - M /branches/3.1/tests/tget_sj.c - M /branches/3.1/tests/tget_str.c - M /branches/3.1/tests/tget_z.c - M /branches/3.1/tests/tgmpop.c - M /branches/3.1/tests/tgrandom.c - M /branches/3.1/tests/thyperbolic.c - M /branches/3.1/tests/thypot.c - M /branches/3.1/tests/tinits.c - M /branches/3.1/tests/tinp_str.c - M /branches/3.1/tests/tinternals.c - M /branches/3.1/tests/tisnan.c - M /branches/3.1/tests/tisqrt.c - M /branches/3.1/tests/tj0.c - M /branches/3.1/tests/tj1.c - M /branches/3.1/tests/tjn.c - M /branches/3.1/tests/tl2b.c - M /branches/3.1/tests/tlgamma.c - M /branches/3.1/tests/tli2.c - M /branches/3.1/tests/tlngamma.c - M /branches/3.1/tests/tlog.c - M /branches/3.1/tests/tlog10.c - M /branches/3.1/tests/tlog1p.c - M /branches/3.1/tests/tlog2.c - M /branches/3.1/tests/tmin_prec.c - M /branches/3.1/tests/tminmax.c - M /branches/3.1/tests/tmodf.c - M /branches/3.1/tests/tmul.c - M /branches/3.1/tests/tmul_2exp.c - M /branches/3.1/tests/tmul_d.c - M /branches/3.1/tests/tmul_ui.c - M /branches/3.1/tests/tnext.c - M /branches/3.1/tests/tout_str.c - M /branches/3.1/tests/toutimpl.c - M /branches/3.1/tests/tpow.c - M /branches/3.1/tests/tpow3.c - M /branches/3.1/tests/tpow_all.c - M /branches/3.1/tests/tpow_z.c - M /branches/3.1/tests/tprintf.c - M /branches/3.1/tests/trandom.c - M /branches/3.1/tests/trec_sqrt.c - M /branches/3.1/tests/tremquo.c - M /branches/3.1/tests/trint.c - M /branches/3.1/tests/troot.c - M /branches/3.1/tests/tround_prec.c - M /branches/3.1/tests/tsec.c - M /branches/3.1/tests/tsech.c - M /branches/3.1/tests/tset.c - M /branches/3.1/tests/tset_d.c - M /branches/3.1/tests/tset_exp.c - M /branches/3.1/tests/tset_f.c - M /branches/3.1/tests/tset_ld.c - M /branches/3.1/tests/tset_q.c - M /branches/3.1/tests/tset_si.c - M /branches/3.1/tests/tset_sj.c - M /branches/3.1/tests/tset_str.c - M /branches/3.1/tests/tset_z.c - M /branches/3.1/tests/tset_z_exp.c - M /branches/3.1/tests/tsgn.c - M /branches/3.1/tests/tsi_op.c - M /branches/3.1/tests/tsin.c - M /branches/3.1/tests/tsin_cos.c - M /branches/3.1/tests/tsinh.c - M /branches/3.1/tests/tsinh_cosh.c - M /branches/3.1/tests/tsprintf.c - M /branches/3.1/tests/tsqr.c - M /branches/3.1/tests/tsqrt.c - M /branches/3.1/tests/tsqrt_ui.c - M /branches/3.1/tests/tstckintc.c - M /branches/3.1/tests/tstdint.c - M /branches/3.1/tests/tstrtofr.c - M /branches/3.1/tests/tsub.c - M /branches/3.1/tests/tsub1sp.c - M /branches/3.1/tests/tsub_d.c - M /branches/3.1/tests/tsub_ui.c - M /branches/3.1/tests/tsubnormal.c - M /branches/3.1/tests/tsum.c - M /branches/3.1/tests/tswap.c - M /branches/3.1/tests/ttan.c - M /branches/3.1/tests/ttanh.c - M /branches/3.1/tests/ttrunc.c - M /branches/3.1/tests/tui_div.c - M /branches/3.1/tests/tui_pow.c - M /branches/3.1/tests/tui_sub.c - M /branches/3.1/tests/turandom.c - M /branches/3.1/tests/tvalist.c - M /branches/3.1/tests/tversion.c - M /branches/3.1/tests/ty0.c - M /branches/3.1/tests/ty1.c - M /branches/3.1/tests/tyn.c - M /branches/3.1/tests/tzeta.c - M /branches/3.1/tests/tzeta_ui.c - M /branches/3.1/tools/ck-copyright-notice - M /branches/3.1/tools/ck-mparam - M /branches/3.1/tools/ck-version-info - M /branches/3.1/tools/get_patches.sh - M /branches/3.1/tools/mbench/Makefile - M /branches/3.1/tools/mbench/generate.c - M /branches/3.1/tools/mbench/mfv5-arprec.cc - M /branches/3.1/tools/mbench/mfv5-cln.cc - M /branches/3.1/tools/mbench/mfv5-crlibm.cc - M /branches/3.1/tools/mbench/mfv5-libc.cc - M /branches/3.1/tools/mbench/mfv5-lidia.cc - M /branches/3.1/tools/mbench/mfv5-mpf.cc - M /branches/3.1/tools/mbench/mfv5-mpfr.cc - M /branches/3.1/tools/mbench/mfv5-ntl.cc - M /branches/3.1/tools/mbench/mfv5-pari.cc - M /branches/3.1/tools/mbench/mfv5-void.cc - M /branches/3.1/tools/mbench/mfv5.cc - M /branches/3.1/tools/mbench/mfv5.h - M /branches/3.1/tools/mbench/mpfr-gfx.c - M /branches/3.1/tools/mbench/mpfr-v4.c - M /branches/3.1/tools/mbench/mpfr-v6.c - M /branches/3.1/tools/mbench/timp.h - M /branches/3.1/tune/Makefile.am - M /branches/3.1/tune/bidimensional_sample.c - M /branches/3.1/tune/speed.c - M /branches/3.1/tune/tuneup.c + M /trunk/doc/README.dev -Use copyright year ranges, following - http://www.gnu.org/prep/maintain/maintain.html#Copyright-Notices +[doc/README.dev] Correction. ------------------------------------------------------------------------ -r8538 | vlefevre | 2013-05-30 13:51:40 +0000 (Thu, 30 May 2013) | 1 line +r11959 | vlefevre | 2017-12-12 01:11:31 +0000 (Tue, 12 Dec 2017) | 1 line Changed paths: - M /branches/3.1/tests + M /trunk/doc/README.dev -[tests] Added *.log and *.trs to svn:ignore property. +[doc/README.dev] Made formatting consistent (same as configure --help). ------------------------------------------------------------------------ -r8535 | vlefevre | 2013-05-30 13:22:23 +0000 (Thu, 30 May 2013) | 1 line +r11958 | vlefevre | 2017-12-12 00:58:43 +0000 (Tue, 12 Dec 2017) | 5 lines Changed paths: - M /branches/3.1 + M /trunk/tests/reuse.c + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tsum.c -Added test-driver (from Automake 1.12+) to svn:ignore property. +Completed r11955: There were also DEBUG macros under the "tests" +directory. Since such macros can still be useful in case a test failure, +replaced them by MPFR_DEBUG to avoid issues with CI builds that define +the DEBUG macro. But an environment variable would be a better solution +(see MPFR_DEBUG_BADCASES as an example). ------------------------------------------------------------------------ -r8486 | vlefevre | 2013-03-13 21:48:23 +0000 (Wed, 13 Mar 2013) | 1 line +r11957 | vlefevre | 2017-12-12 00:44:45 +0000 (Tue, 12 Dec 2017) | 1 line Changed paths: - M /branches/3.1/INSTALL - M /branches/3.1/VERSION - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/version.c + M /trunk/TODO -Updated version to 3.1.3-dev. +[TODO] Removed item on the DEBUG macro (done in r11955). ------------------------------------------------------------------------ -r8484 | vlefevre | 2013-03-13 15:33:33 +0000 (Wed, 13 Mar 2013) | 1 line +r11956 | zimmerma | 2017-12-11 17:36:36 +0000 (Mon, 11 Dec 2017) | 3 lines Changed paths: - M /branches/3.1/ChangeLog + M /trunk/doc/README.dev + M /trunk/src/mpfr-impl.h + M /trunk/tests/tgeneric.c + +DEBUG_TGENERIC -> MPFR_DEBUG_TGENERIC +XDEBUG -> MPFR_DISABLE_IEEE_FLOATS -ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). ------------------------------------------------------------------------ -r8482 | vlefevre | 2013-03-13 15:29:32 +0000 (Wed, 13 Mar 2013) | 1 line +r11955 | zimmerma | 2017-12-11 17:02:05 +0000 (Mon, 11 Dec 2017) | 3 lines Changed paths: - M /branches/3.1/VERSION - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/version.c + M /trunk/src/add1sp.c + M /trunk/src/div.c + M /trunk/src/exp.c + M /trunk/src/exp_2.c + M /trunk/src/mpfr-impl.h + M /trunk/src/sub1.c + M /trunk/src/sub1sp.c + M /trunk/src/zeta.c + +get rid of DEBUG macro (but keep corresponding commands in comment to help +understanding of the code and debugging) -Updated version to 3.1.2. ------------------------------------------------------------------------ -r8480 | vlefevre | 2013-03-13 01:00:16 +0000 (Wed, 13 Mar 2013) | 2 lines +r11954 | vlefevre | 2017-12-11 15:33:31 +0000 (Mon, 11 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/configure.ac + M /trunk/tests/tget_q.c -[configure.ac] Corrected comment on clock_gettime. -(merged changeset r8446 from the trunk) +[tests/tget_q.c] Removed trailing whitespace. ------------------------------------------------------------------------ -r8479 | zimmerma | 2013-03-12 09:37:20 +0000 (Tue, 12 Mar 2013) | 4 lines +r11953 | zimmerma | 2017-12-10 07:42:03 +0000 (Sun, 10 Dec 2017) | 2 lines Changed paths: - M /branches/3.1/configure.ac - M /branches/3.1/tune/Makefile.am + M /trunk/tests/tget_q.c -(merged changeset 8443-8445 from the trunk) -Tuning: reverted changeset r8444 and applied patch by Patrick Pélissier -for GMP 5.1.0 to link against librt conditionally. +[tests/tget_q.c] replaced MPFR_ASSERTN(0) by exit(1) ------------------------------------------------------------------------ -r8478 | vlefevre | 2013-03-12 02:20:01 +0000 (Tue, 12 Mar 2013) | 2 lines +r11952 | vlefevre | 2017-12-10 02:02:43 +0000 (Sun, 10 Dec 2017) | 2 lines Changed paths: - M /branches/3.1/INSTALL + M /trunk/src/get_q.c -[INSTALL] Added a paragraph about Cygwin and threading. -(merged changeset r8477 from the trunk) +[src/get_q.c] Optimization of r11951 suggested by Trevor Spiteri: +https://sympa.inria.fr/sympa/arc/mpfr/2017-12/msg00040.html ------------------------------------------------------------------------ -r8476 | vlefevre | 2013-03-12 00:11:18 +0000 (Tue, 12 Mar 2013) | 3 lines +r11951 | zimmerma | 2017-12-09 21:59:21 +0000 (Sat, 09 Dec 2017) | 3 lines Changed paths: - M /branches/3.1/INSTALL + M /trunk/src/get_q.c + M /trunk/tests/tget_q.c + +[src/get_q.c] make result of mpfr_get_q in canonical form +[tests/tget_q.c] added non-regression test -[INSTALL] Improved information on patches. -(merged changeset r8475 from the trunk, after temporarily reverted -to 3.2.0-dev with tools/update-version for the merge) ------------------------------------------------------------------------ -r8471 | vlefevre | 2013-03-08 12:06:54 +0000 (Fri, 08 Mar 2013) | 1 line +r11950 | zimmerma | 2017-12-09 21:46:01 +0000 (Sat, 09 Dec 2017) | 2 lines Changed paths: - M /branches/3.1/ChangeLog + M /trunk/src/lngamma.c + +[src/lngamma.c] replace call to __gmpfr_ceil_log2 by __gmpfr_int_ceil_log2 -ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). ------------------------------------------------------------------------ -r8470 | vlefevre | 2013-03-08 11:59:32 +0000 (Fri, 08 Mar 2013) | 2 lines +r11949 | vlefevre | 2017-12-09 11:18:20 +0000 (Sat, 09 Dec 2017) | 1 line Changed paths: - M /branches/3.1/VERSION - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/Makefile.am - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/version.c + M /trunk/TODO -Updated version to 3.1.2-rc1 and updated libmpfr_la_LDFLAGS in -src/Makefile.am for the next release. +[TODO] Rename the DEBUG macro to MPFR_DEBUG? ------------------------------------------------------------------------ -r8468 | vlefevre | 2013-03-08 11:44:47 +0000 (Fri, 08 Mar 2013) | 1 line +r11945 | vlefevre | 2017-12-08 16:15:36 +0000 (Fri, 08 Dec 2017) | 2 lines Changed paths: - M /branches/3.1/NEWS + M /trunk/src/Makefile.am -[NEWS] Update for GNU MPFR 3.1.2. +[src/Makefile.am] Also distribute generic/coverage/mparam.h +(at least useful for testing the distributed tarballs). ------------------------------------------------------------------------ -r8466 | vlefevre | 2013-03-08 00:34:36 +0000 (Fri, 08 Mar 2013) | 1 line +r11942 | vlefevre | 2017-12-08 14:53:52 +0000 (Fri, 08 Dec 2017) | 1 line Changed paths: - M /branches/3.1/doc/mpfr.texi + M /trunk/doc/FAQ.html -[doc/mpfr.texi] Updated the month. +[doc] Updated FAQ.html with update-faq. ------------------------------------------------------------------------ -r8465 | vlefevre | 2013-03-08 00:33:22 +0000 (Fri, 08 Mar 2013) | 5 lines +r11939 | vlefevre | 2017-12-08 14:30:37 +0000 (Fri, 08 Dec 2017) | 1 line Changed paths: - M /branches/3.1/BUGS - M /branches/3.1/INSTALL - M /branches/3.1/Makefile.am - M /branches/3.1/NEWS - M /branches/3.1/README - M /branches/3.1/TODO - M /branches/3.1/acinclude.m4 - M /branches/3.1/configure.ac - M /branches/3.1/doc/FAQ.html - M /branches/3.1/doc/Makefile.am - M /branches/3.1/doc/README.dev - M /branches/3.1/doc/faq.xsl - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/examples/divworst.c - M /branches/3.1/examples/rndo-add.c - M /branches/3.1/examples/sample.c - M /branches/3.1/examples/version.c - M /branches/3.1/src/Makefile.am - M /branches/3.1/src/abort_prec_max.c - M /branches/3.1/src/acos.c - M /branches/3.1/src/acosh.c - M /branches/3.1/src/add.c - M /branches/3.1/src/add1.c - M /branches/3.1/src/add1sp.c - M /branches/3.1/src/add_d.c - M /branches/3.1/src/add_ui.c - M /branches/3.1/src/agm.c - M /branches/3.1/src/ai.c - M /branches/3.1/src/amd/amdfam10/mparam.h - M /branches/3.1/src/amd/athlon/mparam.h - M /branches/3.1/src/amd/k8/mparam.h - M /branches/3.1/src/arm/mparam.h - M /branches/3.1/src/asin.c - M /branches/3.1/src/asinh.c - M /branches/3.1/src/atan.c - M /branches/3.1/src/atan2.c - M /branches/3.1/src/atanh.c - M /branches/3.1/src/bernoulli.c - M /branches/3.1/src/buildopt.c - M /branches/3.1/src/cache.c - M /branches/3.1/src/cbrt.c - M /branches/3.1/src/check.c - M /branches/3.1/src/clear.c - M /branches/3.1/src/clears.c - M /branches/3.1/src/cmp.c - M /branches/3.1/src/cmp2.c - M /branches/3.1/src/cmp_abs.c - M /branches/3.1/src/cmp_d.c - M /branches/3.1/src/cmp_ld.c - M /branches/3.1/src/cmp_si.c - M /branches/3.1/src/cmp_ui.c - M /branches/3.1/src/comparisons.c - M /branches/3.1/src/const_catalan.c - M /branches/3.1/src/const_euler.c - M /branches/3.1/src/const_log2.c - M /branches/3.1/src/const_pi.c - M /branches/3.1/src/constant.c - M /branches/3.1/src/copysign.c - M /branches/3.1/src/cos.c - M /branches/3.1/src/cosh.c - M /branches/3.1/src/cot.c - M /branches/3.1/src/coth.c - M /branches/3.1/src/csc.c - M /branches/3.1/src/csch.c - M /branches/3.1/src/d_div.c - M /branches/3.1/src/d_sub.c - M /branches/3.1/src/digamma.c - M /branches/3.1/src/dim.c - M /branches/3.1/src/div.c - M /branches/3.1/src/div_2exp.c - M /branches/3.1/src/div_2si.c - M /branches/3.1/src/div_2ui.c - M /branches/3.1/src/div_d.c - M /branches/3.1/src/div_ui.c - M /branches/3.1/src/dump.c - M /branches/3.1/src/eint.c - M /branches/3.1/src/eq.c - M /branches/3.1/src/erf.c - M /branches/3.1/src/erfc.c - M /branches/3.1/src/exceptions.c - M /branches/3.1/src/exp.c - M /branches/3.1/src/exp10.c - M /branches/3.1/src/exp2.c - M /branches/3.1/src/exp3.c - M /branches/3.1/src/exp_2.c - M /branches/3.1/src/expm1.c - M /branches/3.1/src/extract.c - M /branches/3.1/src/factorial.c - M /branches/3.1/src/fits_intmax.c - M /branches/3.1/src/fits_s.h - M /branches/3.1/src/fits_sint.c - M /branches/3.1/src/fits_slong.c - M /branches/3.1/src/fits_sshort.c - M /branches/3.1/src/fits_u.h - M /branches/3.1/src/fits_uint.c - M /branches/3.1/src/fits_uintmax.c - M /branches/3.1/src/fits_ulong.c - M /branches/3.1/src/fits_ushort.c - M /branches/3.1/src/fma.c - M /branches/3.1/src/fms.c - M /branches/3.1/src/frac.c - M /branches/3.1/src/free_cache.c - M /branches/3.1/src/frexp.c - M /branches/3.1/src/gamma.c - M /branches/3.1/src/gammaonethird.c - M /branches/3.1/src/gen_inverse.h - M /branches/3.1/src/generic/mparam.h - M /branches/3.1/src/get_d.c - M /branches/3.1/src/get_d64.c - M /branches/3.1/src/get_exp.c - M /branches/3.1/src/get_f.c - M /branches/3.1/src/get_flt.c - M /branches/3.1/src/get_ld.c - M /branches/3.1/src/get_si.c - M /branches/3.1/src/get_sj.c - M /branches/3.1/src/get_str.c - M /branches/3.1/src/get_ui.c - M /branches/3.1/src/get_uj.c - M /branches/3.1/src/get_z.c - M /branches/3.1/src/get_z_exp.c - M /branches/3.1/src/gmp_op.c - M /branches/3.1/src/grandom.c - M /branches/3.1/src/hppa/mparam.h - M /branches/3.1/src/hypot.c - M /branches/3.1/src/ia64/mparam.h - M /branches/3.1/src/ieee_floats.h - M /branches/3.1/src/init.c - M /branches/3.1/src/init2.c - M /branches/3.1/src/inits.c - M /branches/3.1/src/inits2.c - M /branches/3.1/src/inp_str.c - M /branches/3.1/src/int_ceil_log2.c - M /branches/3.1/src/isinf.c - M /branches/3.1/src/isinteger.c - M /branches/3.1/src/isnan.c - M /branches/3.1/src/isnum.c - M /branches/3.1/src/isqrt.c - M /branches/3.1/src/isregular.c - M /branches/3.1/src/iszero.c - M /branches/3.1/src/jn.c - M /branches/3.1/src/jyn_asympt.c - M /branches/3.1/src/li2.c - M /branches/3.1/src/lngamma.c - M /branches/3.1/src/log.c - M /branches/3.1/src/log10.c - M /branches/3.1/src/log1p.c - M /branches/3.1/src/log2.c - M /branches/3.1/src/logging.c - M /branches/3.1/src/min_prec.c - M /branches/3.1/src/minmax.c - M /branches/3.1/src/modf.c - M /branches/3.1/src/mp_clz_tab.c - M /branches/3.1/src/mparam_h.in - M /branches/3.1/src/mpf2mpfr.h - M /branches/3.1/src/mpfr-gmp.c - M /branches/3.1/src/mpfr-gmp.h - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/src/mpfr-intmax.h - M /branches/3.1/src/mpfr-longlong.h - M /branches/3.1/src/mpfr-thread.h - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/mpn_exp.c - M /branches/3.1/src/mul.c - M /branches/3.1/src/mul_2exp.c - M /branches/3.1/src/mul_2si.c - M /branches/3.1/src/mul_2ui.c - M /branches/3.1/src/mul_d.c - M /branches/3.1/src/mul_ui.c - M /branches/3.1/src/mulders.c - M /branches/3.1/src/neg.c - M /branches/3.1/src/next.c - M /branches/3.1/src/out_raw.c - M /branches/3.1/src/out_str.c - M /branches/3.1/src/pow.c - M /branches/3.1/src/pow_si.c - M /branches/3.1/src/pow_ui.c - M /branches/3.1/src/pow_z.c - M /branches/3.1/src/powerof2.c - M /branches/3.1/src/powerpc32/mparam.h - M /branches/3.1/src/powerpc64/mparam.h - M /branches/3.1/src/print_raw.c - M /branches/3.1/src/print_rnd_mode.c - M /branches/3.1/src/printf.c - M /branches/3.1/src/rec_sqrt.c - M /branches/3.1/src/reldiff.c - M /branches/3.1/src/rem1.c - M /branches/3.1/src/rint.c - M /branches/3.1/src/root.c - M /branches/3.1/src/round_near_x.c - M /branches/3.1/src/round_p.c - M /branches/3.1/src/round_prec.c - M /branches/3.1/src/round_raw_generic.c - M /branches/3.1/src/scale2.c - M /branches/3.1/src/sec.c - M /branches/3.1/src/sech.c - M /branches/3.1/src/set.c - M /branches/3.1/src/set_d.c - M /branches/3.1/src/set_d64.c - M /branches/3.1/src/set_dfl_prec.c - M /branches/3.1/src/set_exp.c - M /branches/3.1/src/set_f.c - M /branches/3.1/src/set_flt.c - M /branches/3.1/src/set_inf.c - M /branches/3.1/src/set_ld.c - M /branches/3.1/src/set_nan.c - M /branches/3.1/src/set_prc_raw.c - M /branches/3.1/src/set_prec.c - M /branches/3.1/src/set_q.c - M /branches/3.1/src/set_rnd.c - M /branches/3.1/src/set_si.c - M /branches/3.1/src/set_si_2exp.c - M /branches/3.1/src/set_sj.c - M /branches/3.1/src/set_str.c - M /branches/3.1/src/set_str_raw.c - M /branches/3.1/src/set_ui.c - M /branches/3.1/src/set_ui_2exp.c - M /branches/3.1/src/set_uj.c - M /branches/3.1/src/set_z.c - M /branches/3.1/src/set_z_exp.c - M /branches/3.1/src/set_zero.c - M /branches/3.1/src/setmax.c - M /branches/3.1/src/setmin.c - M /branches/3.1/src/setsign.c - M /branches/3.1/src/sgn.c - M /branches/3.1/src/si_op.c - M /branches/3.1/src/signbit.c - M /branches/3.1/src/sin.c - M /branches/3.1/src/sin_cos.c - M /branches/3.1/src/sinh.c - M /branches/3.1/src/sinh_cosh.c - M /branches/3.1/src/sparc64/mparam.h - M /branches/3.1/src/sqr.c - M /branches/3.1/src/sqrt.c - M /branches/3.1/src/sqrt_ui.c - M /branches/3.1/src/stack_interface.c - M /branches/3.1/src/strtofr.c - M /branches/3.1/src/sub.c - M /branches/3.1/src/sub1.c - M /branches/3.1/src/sub1sp.c - M /branches/3.1/src/sub_d.c - M /branches/3.1/src/sub_ui.c - M /branches/3.1/src/subnormal.c - M /branches/3.1/src/sum.c - M /branches/3.1/src/swap.c - M /branches/3.1/src/tan.c - M /branches/3.1/src/tanh.c - M /branches/3.1/src/uceil_exp2.c - M /branches/3.1/src/uceil_log2.c - M /branches/3.1/src/ufloor_log2.c - M /branches/3.1/src/ui_div.c - M /branches/3.1/src/ui_pow.c - M /branches/3.1/src/ui_pow_ui.c - M /branches/3.1/src/ui_sub.c - M /branches/3.1/src/urandom.c - M /branches/3.1/src/urandomb.c - M /branches/3.1/src/vasprintf.c - M /branches/3.1/src/version.c - M /branches/3.1/src/volatile.c - M /branches/3.1/src/x86/core2/mparam.h - M /branches/3.1/src/x86/mparam.h - M /branches/3.1/src/x86_64/core2/mparam.h - M /branches/3.1/src/x86_64/pentium4/mparam.h - M /branches/3.1/src/yn.c - M /branches/3.1/src/zeta.c - M /branches/3.1/src/zeta_ui.c - M /branches/3.1/tests/Makefile.am - M /branches/3.1/tests/cmp_str.c - M /branches/3.1/tests/data/digamma - M /branches/3.1/tests/data/li2 - M /branches/3.1/tests/memory.c - M /branches/3.1/tests/mpf_compat.c - M /branches/3.1/tests/mpf_compat.h - M /branches/3.1/tests/mpfr-test.h - M /branches/3.1/tests/mpfr_compat.c - M /branches/3.1/tests/random2.c - M /branches/3.1/tests/reuse.c - M /branches/3.1/tests/rnd_mode.c - M /branches/3.1/tests/tabs.c - M /branches/3.1/tests/tacos.c - M /branches/3.1/tests/tacosh.c - M /branches/3.1/tests/tadd.c - M /branches/3.1/tests/tadd1sp.c - M /branches/3.1/tests/tadd_d.c - M /branches/3.1/tests/tadd_ui.c - M /branches/3.1/tests/tagm.c - M /branches/3.1/tests/tai.c - M /branches/3.1/tests/tasin.c - M /branches/3.1/tests/tasinh.c - M /branches/3.1/tests/tatan.c - M /branches/3.1/tests/tatanh.c - M /branches/3.1/tests/taway.c - M /branches/3.1/tests/tbuildopt.c - M /branches/3.1/tests/tcan_round.c - M /branches/3.1/tests/tcbrt.c - M /branches/3.1/tests/tcheck.c - M /branches/3.1/tests/tcmp.c - M /branches/3.1/tests/tcmp2.c - M /branches/3.1/tests/tcmp_d.c - M /branches/3.1/tests/tcmp_ld.c - M /branches/3.1/tests/tcmp_ui.c - M /branches/3.1/tests/tcmpabs.c - M /branches/3.1/tests/tcomparisons.c - M /branches/3.1/tests/tconst_catalan.c - M /branches/3.1/tests/tconst_euler.c - M /branches/3.1/tests/tconst_log2.c - M /branches/3.1/tests/tconst_pi.c - M /branches/3.1/tests/tcopysign.c - M /branches/3.1/tests/tcos.c - M /branches/3.1/tests/tcosh.c - M /branches/3.1/tests/tcot.c - M /branches/3.1/tests/tcoth.c - M /branches/3.1/tests/tcsc.c - M /branches/3.1/tests/tcsch.c - M /branches/3.1/tests/td_div.c - M /branches/3.1/tests/td_sub.c - M /branches/3.1/tests/tdigamma.c - M /branches/3.1/tests/tdim.c - M /branches/3.1/tests/tdiv.c - M /branches/3.1/tests/tdiv_d.c - M /branches/3.1/tests/tdiv_ui.c - M /branches/3.1/tests/teint.c - M /branches/3.1/tests/teq.c - M /branches/3.1/tests/terf.c - M /branches/3.1/tests/tests.c - M /branches/3.1/tests/texceptions.c - M /branches/3.1/tests/texp.c - M /branches/3.1/tests/texp10.c - M /branches/3.1/tests/texp2.c - M /branches/3.1/tests/texpm1.c - M /branches/3.1/tests/tfactorial.c - M /branches/3.1/tests/tfits.c - M /branches/3.1/tests/tfma.c - M /branches/3.1/tests/tfmod.c - M /branches/3.1/tests/tfms.c - M /branches/3.1/tests/tfprintf.c - M /branches/3.1/tests/tfrac.c - M /branches/3.1/tests/tfrexp.c - M /branches/3.1/tests/tgamma.c - M /branches/3.1/tests/tgeneric.c - M /branches/3.1/tests/tgeneric_ui.c - M /branches/3.1/tests/tget_d.c - M /branches/3.1/tests/tget_d_2exp.c - M /branches/3.1/tests/tget_f.c - M /branches/3.1/tests/tget_flt.c - M /branches/3.1/tests/tget_ld_2exp.c - M /branches/3.1/tests/tget_set_d64.c - M /branches/3.1/tests/tget_sj.c - M /branches/3.1/tests/tget_str.c - M /branches/3.1/tests/tget_z.c - M /branches/3.1/tests/tgmpop.c - M /branches/3.1/tests/tgrandom.c - M /branches/3.1/tests/thyperbolic.c - M /branches/3.1/tests/thypot.c - M /branches/3.1/tests/tinits.c - M /branches/3.1/tests/tinp_str.c - M /branches/3.1/tests/tinternals.c - M /branches/3.1/tests/tisnan.c - M /branches/3.1/tests/tisqrt.c - M /branches/3.1/tests/tj0.c - M /branches/3.1/tests/tj1.c - M /branches/3.1/tests/tjn.c - M /branches/3.1/tests/tl2b.c - M /branches/3.1/tests/tlgamma.c - M /branches/3.1/tests/tli2.c - M /branches/3.1/tests/tlngamma.c - M /branches/3.1/tests/tlog.c - M /branches/3.1/tests/tlog10.c - M /branches/3.1/tests/tlog1p.c - M /branches/3.1/tests/tlog2.c - M /branches/3.1/tests/tmin_prec.c - M /branches/3.1/tests/tminmax.c - M /branches/3.1/tests/tmodf.c - M /branches/3.1/tests/tmul.c - M /branches/3.1/tests/tmul_2exp.c - M /branches/3.1/tests/tmul_d.c - M /branches/3.1/tests/tmul_ui.c - M /branches/3.1/tests/tnext.c - M /branches/3.1/tests/tout_str.c - M /branches/3.1/tests/toutimpl.c - M /branches/3.1/tests/tpow.c - M /branches/3.1/tests/tpow3.c - M /branches/3.1/tests/tpow_all.c - M /branches/3.1/tests/tpow_z.c - M /branches/3.1/tests/tprintf.c - M /branches/3.1/tests/trandom.c - M /branches/3.1/tests/trec_sqrt.c - M /branches/3.1/tests/tremquo.c - M /branches/3.1/tests/trint.c - M /branches/3.1/tests/troot.c - M /branches/3.1/tests/tround_prec.c - M /branches/3.1/tests/tsec.c - M /branches/3.1/tests/tsech.c - M /branches/3.1/tests/tset.c - M /branches/3.1/tests/tset_d.c - M /branches/3.1/tests/tset_exp.c - M /branches/3.1/tests/tset_f.c - M /branches/3.1/tests/tset_ld.c - M /branches/3.1/tests/tset_q.c - M /branches/3.1/tests/tset_si.c - M /branches/3.1/tests/tset_sj.c - M /branches/3.1/tests/tset_str.c - M /branches/3.1/tests/tset_z.c - M /branches/3.1/tests/tset_z_exp.c - M /branches/3.1/tests/tsgn.c - M /branches/3.1/tests/tsi_op.c - M /branches/3.1/tests/tsin.c - M /branches/3.1/tests/tsin_cos.c - M /branches/3.1/tests/tsinh.c - M /branches/3.1/tests/tsinh_cosh.c - M /branches/3.1/tests/tsprintf.c - M /branches/3.1/tests/tsqr.c - M /branches/3.1/tests/tsqrt.c - M /branches/3.1/tests/tsqrt_ui.c - M /branches/3.1/tests/tstckintc.c - M /branches/3.1/tests/tstdint.c - M /branches/3.1/tests/tstrtofr.c - M /branches/3.1/tests/tsub.c - M /branches/3.1/tests/tsub1sp.c - M /branches/3.1/tests/tsub_d.c - M /branches/3.1/tests/tsub_ui.c - M /branches/3.1/tests/tsubnormal.c - M /branches/3.1/tests/tsum.c - M /branches/3.1/tests/tswap.c - M /branches/3.1/tests/ttan.c - M /branches/3.1/tests/ttanh.c - M /branches/3.1/tests/ttrunc.c - M /branches/3.1/tests/tui_div.c - M /branches/3.1/tests/tui_pow.c - M /branches/3.1/tests/tui_sub.c - M /branches/3.1/tests/turandom.c - M /branches/3.1/tests/tvalist.c - M /branches/3.1/tests/tversion.c - M /branches/3.1/tests/ty0.c - M /branches/3.1/tests/ty1.c - M /branches/3.1/tests/tyn.c - M /branches/3.1/tests/tzeta.c - M /branches/3.1/tests/tzeta_ui.c - M /branches/3.1/tools/ck-copyright-notice - M /branches/3.1/tools/ck-mparam - M /branches/3.1/tools/ck-version-info - M /branches/3.1/tools/get_patches.sh - M /branches/3.1/tune/Makefile.am - M /branches/3.1/tune/bidimensional_sample.c - M /branches/3.1/tune/speed.c - M /branches/3.1/tune/tuneup.c + M /trunk/doc/FAQ.html -Copyright notice update: added 2013 with - perl -pi -e 's/2012 Free Software/2012, 2013 Free Software/' **/*(^/) -under zsh, reverting the ChangeLog file (the m4 and tools/mbench -directories were not modified). -Removed 2012 from the example in the doc/README.dev file. +[doc] Updated FAQ.html with update-faq. ------------------------------------------------------------------------ -r8464 | vlefevre | 2013-03-08 00:28:01 +0000 (Fri, 08 Mar 2013) | 3 lines +r11934 | vlefevre | 2017-12-08 13:56:42 +0000 (Fri, 08 Dec 2017) | 5 lines Changed paths: - M /branches/3.1 - M /branches/3.1/examples/ReadMe - M /branches/3.1/examples/divworst.c - M /branches/3.1/examples/rndo-add.c - M /branches/3.1/examples/sample.c - M /branches/3.1/examples/version.c + M /trunk/doc/README.dev -[examples] Replaced the old rounding mode macros (GMP_RNDN, etc.) by the -new ones (MPFR_RNDN, etc.) in the *.c files; updated ReadMe file. -(merged changeset r8461 from the trunk) +[doc/README.dev] "To make a release": + * Note that this needs to be done in a branch. + * Swapped (1) and (2), in particular because the coverage might be + different in -dev versions and it is better to give results closer + to the release. ------------------------------------------------------------------------ -r8463 | vlefevre | 2013-03-08 00:26:52 +0000 (Fri, 08 Mar 2013) | 5 lines +r11933 | vlefevre | 2017-12-08 13:40:19 +0000 (Fri, 08 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/doc/faq.xsl - M /branches/3.1/doc/update-faq + M /trunk/INSTALL + M /trunk/VERSION + M /trunk/configure.ac + M /trunk/doc/mpfr.texi + M /trunk/src/mpfr.h + M /trunk/src/version.c -[doc] Slightly modified faq.xsl to avoid libxslt bug 377440, and -moved the addition of special CSS comments for XML compatibility -from update-faq to faq.xsl file. Removed the now useless -s/GMP_RND/MPFR_RND/ rewriting in update-faq. -(merged changesets r8458,8460 from the trunk) +Updated version to 4.1.0-dev. ------------------------------------------------------------------------ -r8454 | vlefevre | 2013-02-22 12:11:37 +0000 (Fri, 22 Feb 2013) | 3 lines +r11931 | vlefevre | 2017-12-08 13:17:51 +0000 (Fri, 08 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/get_f.c - M /branches/3.1/src/mpfr-gmp.h - M /branches/3.1/tests/tadd.c - M /branches/3.1/tests/tgeneric.c + M /trunk/ChangeLog -Compatibility with GMP 5.1.0 and later when gmp-impl.h is included, -i.e. with --with-gmp-build (thanks to Rob for the fix); clean-up. -(merged changeset r8439 from the trunk) +ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC svn log -rHEAD:0 -v". ------------------------------------------------------------------------ -r8399 | vlefevre | 2012-08-29 13:54:55 +0000 (Wed, 29 Aug 2012) | 8 lines +r11930 | vlefevre | 2017-12-08 13:09:08 +0000 (Fri, 08 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/strtofr.c - M /branches/3.1/tests/tstrtofr.c + D /trunk/tests/timings-mpfr.c + A /trunk/tools/timings-mpfr.c (from /trunk/tests/timings-mpfr.c:11929) -[src/strtofr.c] Fixed bug in mpfr_strtofr in case: - (1) the input string was used entirely - (2) the conversion was done by a division - (3) and the division was exact - In such a case the "reconstruction" of the ternary value was inexact. -[tests/tstrtofr.c] Added various testcases (for this bug and for bugs - in intermediate revisions). -(merged changesets r8371,8384,8389-8398 from the trunk) +Moved tests/timings-mpfr.c into directory "tools" as it is not part +of the test suite. ------------------------------------------------------------------------ -r8387 | vlefevre | 2012-08-28 15:06:27 +0000 (Tue, 28 Aug 2012) | 1 line +r11929 | vlefevre | 2017-12-07 15:10:29 +0000 (Thu, 07 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/doc/FAQ.html + M /trunk/src/fpif.c -[doc] Updated FAQ.html (changeset r8386 from the trunk). +[src/fpif.c] Removed FIXME about the sign bit of NaN: done in +r11910 and r11920 (documentation + tests). ------------------------------------------------------------------------ -r8380 | vlefevre | 2012-08-16 09:12:57 +0000 (Thu, 16 Aug 2012) | 5 lines +r11928 | vlefevre | 2017-12-07 14:58:38 +0000 (Thu, 07 Dec 2017) | 4 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/get_d64.c - M /branches/3.1/tests/tget_set_d64.c + M /trunk/src/div.c + M /trunk/src/mul.c + M /trunk/src/sqr.c + M /trunk/src/sqrt.c + M /trunk/src/sub1sp.c -[src/get_d64.c] mpfr_get_decimal64 was buggy in MPFR_RNDN on some - values x such that 0.5e-398 < |x| < 1e-398 (smallest subnormal): - it was returning 0 instead of +/- 1e-398. -[tests/tget_set_d64.c] Added testcases. -(merged changesets r8370,8379 from the trunk) +[src] Replaced some "return 0" by "MPFR_RET (0)" (the generated code +is the same as shown by gcc, thanks to an obvious optimization; this +is semantically better, which could help provers, and would allow +code instrumentation in the future, if need be). ------------------------------------------------------------------------ -r8378 | vlefevre | 2012-08-15 23:41:21 +0000 (Wed, 15 Aug 2012) | 7 lines +r11927 | zimmerma | 2017-12-06 19:54:25 +0000 (Wed, 06 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/get_d64.c - M /branches/3.1/tests/tget_set_d64.c + M /trunk/src/mpfr-mini-gmp.c + M /trunk/src/mpfr-mini-gmp.h + M /trunk/tests/tget_z.c + M /trunk/tests/tgmpop.c + +got rid of mpz_dump (undocumented in GMP) -[src/get_d64.c] Fixed get_decimal64_max by simplifying it completely, -and changed get_decimal64_min in the same way. -Thanks to Rob (Sisyphus) for the idea. -[tests/tget_set_d64.c] Added some tests for large numbers and overflow -tests (they cover the two bad tests fixed in r8373 and trigger the bug -in get_decimal64_max fixed here). -(merged changesets r8375-8377 from the trunk) ------------------------------------------------------------------------ -r8373 | vlefevre | 2012-08-14 10:37:10 +0000 (Tue, 14 Aug 2012) | 2 lines +r11926 | zimmerma | 2017-12-06 17:14:27 +0000 (Wed, 06 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/get_d64.c + M /trunk/src/mpfr-mini-gmp.c + +[src/mpfr-mini-gmp.c] updated with GMP 6.1.2 -[src/get_d64.c] Fixed overflow cases. -(merged changeset r8372 from the trunk) ------------------------------------------------------------------------ -r8361 | vlefevre | 2012-07-26 14:21:40 +0000 (Thu, 26 Jul 2012) | 1 line +r11925 | vlefevre | 2017-12-06 17:01:14 +0000 (Wed, 06 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/configure.ac + M /trunk/doc/mpfr.texi -[configure.ac] Replaced "sed" by "$SED" and "grep" by "$EGREP". +[doc/mpfr.texi] Corrected a Texinfo typography issue. ------------------------------------------------------------------------ -r8330 | vlefevre | 2012-07-05 10:44:31 +0000 (Thu, 05 Jul 2012) | 2 lines +r11924 | vlefevre | 2017-12-06 16:45:15 +0000 (Wed, 06 Dec 2017) | 2 lines Changed paths: - M /branches/3.1/tools/coverage + M /trunk/src/pool.c -[tools/coverage] Added a comment about the non-reproducibility of the -coverage results. +[src/pool.c] Updated description. Corrected copyright years as the +pool code itself was introduced in 2014. ------------------------------------------------------------------------ -r8318 | vlefevre | 2012-07-04 09:30:08 +0000 (Wed, 04 Jul 2012) | 1 line +r11923 | vlefevre | 2017-12-06 16:41:54 +0000 (Wed, 06 Dec 2017) | 2 lines Changed paths: - M /branches/3.1/INSTALL - M /branches/3.1/VERSION - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/version.c + M /trunk/tests/timings-mpfr.c -Updated version to 3.1.2-dev. +[tests/timings-mpfr.c] Removed trailing whitespace, untabified, +changed GMP_RNDN to MPFR_RNDN. ------------------------------------------------------------------------ -r8309 | vlefevre | 2012-07-03 14:23:23 +0000 (Tue, 03 Jul 2012) | 1 line +r11922 | vlefevre | 2017-12-06 16:34:16 +0000 (Wed, 06 Dec 2017) | 15 lines Changed paths: - M /branches/3.1/ChangeLog + M /trunk/NEWS + M /trunk/doc/README.dev + M /trunk/doc/mpfr.texi + M /trunk/src/Makefile.am + M /trunk/src/free_cache.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + A /trunk/src/pool.c (from /trunk/src/free_cache.c:11921) -ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). +Cleanup and fixes for the mpz_t pool. + * Split src/free_cache.c to itself and a new source file src/pool.c + containing pool related code. + * src/mpfr-impl.h, src/pool.c: cleanup and fixes. In particular: + - renamed MPFR_MY_MPZ_INIT to MPFR_POOL_NENTRIES; + - no longer use GMP's symbols __gmpz_init, etc. directly; + - improved the condition for mpfr_mpz_init2; + - fixed the condition in mpfr_mpz_clear (we want to consider + the allocated size, not the size of the current number). + * src/Makefile.am: added pool.c. + * src/mpfr.h: added mpfr_free_pool prototype. + * doc/mpfr.texi: updated pool description in "Memory Handling"; + new function mpfr_free_pool. + * doc/README.dev: update due to the rename of MPFR_MY_MPZ_INIT. + * NEWS: better announcement of the mpz_t pool. ------------------------------------------------------------------------ -r8307 | vlefevre | 2012-07-03 14:19:10 +0000 (Tue, 03 Jul 2012) | 1 line +r11921 | vlefevre | 2017-12-06 14:45:08 +0000 (Wed, 06 Dec 2017) | 1 line Changed paths: - M /branches/3.1/NEWS + M /trunk/doc/mpfr.texi -[NEWS] Added test coverage for MPFR 3.1.1. +[doc/mpfr.texi] Small correction concerning the caches. ------------------------------------------------------------------------ -r8306 | vlefevre | 2012-07-03 14:17:16 +0000 (Tue, 03 Jul 2012) | 2 lines +r11920 | vlefevre | 2017-12-06 14:06:06 +0000 (Wed, 06 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tools/coverage + M /trunk/doc/mpfr.texi -[tools/coverage] Some changes from the trunk (r8263,8275,8277,8305), -in particular detailed coverage. +[doc/mpfr.texi] More details for mpfr_fpif_export and mpfr_fpif_import. ------------------------------------------------------------------------ -r8303 | vlefevre | 2012-07-03 13:52:02 +0000 (Tue, 03 Jul 2012) | 1 line +r11919 | zimmerma | 2017-12-06 12:58:31 +0000 (Wed, 06 Dec 2017) | 2 lines Changed paths: - M /branches/3.1/doc/mpfr.texi + A /trunk/tests/timings-mpfr.c + +[timings-mpfr.c] test file for measuring timings (added -p option) -[doc/mpfr.texi] Updated the month. ------------------------------------------------------------------------ -r8301 | vlefevre | 2012-07-03 13:49:45 +0000 (Tue, 03 Jul 2012) | 1 line +r11918 | vlefevre | 2017-12-06 12:45:40 +0000 (Wed, 06 Dec 2017) | 1 line Changed paths: - M /branches/3.1/VERSION - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/version.c - -Updated version to 3.1.1. ------------------------------------------------------------------------- -r8300 | vlefevre | 2012-07-03 13:47:34 +0000 (Tue, 03 Jul 2012) | 4 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/tests/td_div.c - M /branches/3.1/tests/tests.c - M /branches/3.1/tests/tget_d.c + M /trunk/INSTALL + M /trunk/src/rec_sqrt.c -[tests/tests.c] Improved an error message. -[tests/{td_div.c,tget_d.c}] Disable tests with a division by 0 if - MPFR_ERRDIVZERO is defined. -(merged changesets r8298-8299 from the trunk) +Updated the remaining www.loria.fr URL's. ------------------------------------------------------------------------ -r8290 | vlefevre | 2012-06-27 12:00:38 +0000 (Wed, 27 Jun 2012) | 1 line +r11917 | vlefevre | 2017-12-06 12:44:04 +0000 (Wed, 06 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi + M /trunk/doc/algorithms.bib -[mpfr.texi] added support by ERC grant of Andreas +[doc/algorithms.bib] Updated URL's. ------------------------------------------------------------------------ -r8288 | vlefevre | 2012-06-27 09:15:26 +0000 (Wed, 27 Jun 2012) | 1 line +r11916 | vlefevre | 2017-12-06 12:37:48 +0000 (Wed, 06 Dec 2017) | 1 line Changed paths: - M /branches/3.1/doc/mpfr.texi + M /trunk/doc/mpfr.texi -[doc/mpfr.texi] Document MPFR_WANT_DECIMAL_FLOATS. +[doc/mpfr.texi] References: typography; updated a URL. ------------------------------------------------------------------------ -r8284 | vlefevre | 2012-06-27 08:37:21 +0000 (Wed, 27 Jun 2012) | 2 lines +r11914 | zimmerma | 2017-12-06 10:15:40 +0000 (Wed, 06 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tgrandom.c + M /trunk/doc/mpfr.texi + +[mpfr.texi] updated reference to "Modern Computer Arithmetic" -[tests/tgrandom.c] Replaced GMP_RNDN by MPFR_RNDN. -(merged changeset r8283 from the trunk) ------------------------------------------------------------------------ -r8282 | vlefevre | 2012-06-27 08:33:41 +0000 (Wed, 27 Jun 2012) | 1 line +r11913 | zimmerma | 2017-12-06 09:59:31 +0000 (Wed, 06 Dec 2017) | 2 lines Changed paths: - M /branches/3.1/NEWS + M /trunk/src/free_cache.c + +[free_cache.c] limit the size of objects in the mpz_t pool -[NEWS] Update. ------------------------------------------------------------------------ -r8281 | vlefevre | 2012-06-27 08:23:11 +0000 (Wed, 27 Jun 2012) | 4 lines +r11912 | vlefevre | 2017-12-06 09:43:02 +0000 (Wed, 06 Dec 2017) | 3 lines Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/tests/tgrandom.c + M /trunk/src/free_cache.c -[doc/mpfr.texi] Completed spec of mpfr_grandom. -[tests/tgrandom.c] Improved a test and added a new one for - mpfr_grandom(x, NULL, ...). -(merged changesets r8279-8280 from the trunk) +[src/free_cache.c] Added a comment for the mpz_t pool, and a suggestion +for mpfr_mpz_clear so that the pool will not take too much memory while +keeping a possible benefit for very small precision. ------------------------------------------------------------------------ -r8278 | vlefevre | 2012-06-27 08:10:45 +0000 (Wed, 27 Jun 2012) | 2 lines +r11911 | vlefevre | 2017-12-05 23:33:58 +0000 (Tue, 05 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/NEWS + M /trunk/src/mpfr.h -[NEWS] Update: test coverage. -(merged changeset r8276 from the trunk) +[src/mpfr.h] Made box around code examples for clarity and grep. ------------------------------------------------------------------------ -r8259 | vlefevre | 2012-06-26 15:02:18 +0000 (Tue, 26 Jun 2012) | 1 line +r11910 | vlefevre | 2017-12-05 16:17:36 +0000 (Tue, 05 Dec 2017) | 2 lines Changed paths: - M /branches/3.1/ChangeLog + M /trunk/doc/mpfr.texi + M /trunk/tests/tfpif.c -ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). +[doc/mpfr.texi] For mpfr_fpif_export: the sign of a NaN is stored. +[tests/tfpif.c] Test the sign of NaN (in particular). ------------------------------------------------------------------------ -r8257 | vlefevre | 2012-06-26 14:51:13 +0000 (Tue, 26 Jun 2012) | 1 line +r11909 | vlefevre | 2017-12-05 15:57:33 +0000 (Tue, 05 Dec 2017) | 1 line Changed paths: - M /branches/3.1/doc/mpfr.texi + M /trunk/doc/mpfr.texi -[doc/mpfr.texi] Updated the month. +[doc/mpfr.texi] Updated references. ------------------------------------------------------------------------ -r8256 | vlefevre | 2012-06-26 14:50:17 +0000 (Tue, 26 Jun 2012) | 2 lines +r11908 | vlefevre | 2017-12-05 15:00:52 +0000 (Tue, 05 Dec 2017) | 2 lines Changed paths: - M /branches/3.1/VERSION - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/Makefile.am - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/version.c + M /trunk/doc/mpfr.texi -Updated version to 3.1.1-rc1 and updated libmpfr_la_LDFLAGS in -src/Makefile.am for the next release. +[doc/mpfr.texi] Update about 0 of type without signed zeros, as in +mpfr_div_ui. ------------------------------------------------------------------------ -r8255 | vlefevre | 2012-06-26 14:41:27 +0000 (Tue, 26 Jun 2012) | 1 line +r11907 | vlefevre | 2017-12-05 13:43:39 +0000 (Tue, 05 Dec 2017) | 2 lines Changed paths: - M /branches/3.1/NEWS + M /trunk/doc/mpfr.texi -[NEWS] Update for GNU MPFR 3.1.1. +[doc/mpfr.texi] Document the behavior of mpfr_ui_pow and mpfr_ui_pow_ui +on the integer 0 (0 does not have a sign here). ------------------------------------------------------------------------ -r8254 | vlefevre | 2012-06-26 14:03:44 +0000 (Tue, 26 Jun 2012) | 2 lines +r11906 | zimmerma | 2017-12-05 10:24:20 +0000 (Tue, 05 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tinternals.c + M /trunk/doc/mini-gmp + +[doc/mini-gmp] added information about result of "make check" -[tests/tinternals.c] mpfr_set_prec_raw missing tests (thanks to Patrick). -(merged changeset r8253 from the trunk) ------------------------------------------------------------------------ -r8252 | vlefevre | 2012-06-26 13:57:32 +0000 (Tue, 26 Jun 2012) | 2 lines +r11905 | vlefevre | 2017-12-05 10:21:46 +0000 (Tue, 05 Dec 2017) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tset_si.c + M /trunk/src/mpfr-gmp.h -[tests/tset_si.c] Also test the mpfr_set_ui function (instead of macro). -(merged changeset r8251 from the trunk) +[src/mpfr-gmp.h] Removed old code for pre-GMP-5 versions. ------------------------------------------------------------------------ -r8220 | vlefevre | 2012-06-21 23:03:44 +0000 (Thu, 21 Jun 2012) | 3 lines +r11904 | vlefevre | 2017-12-05 10:20:06 +0000 (Tue, 05 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tset_ld.c + M /trunk/src/urandomb.c -[tests/tset_ld.c] For _GMP_IEEE_FLOATS, use #if instead of #ifdef -since mpfr-impl.h defines it to 0 if it was undefined. -(merged changeset r8219 from the trunk) +[src/urandomb.c] Removed an obsolete "#if __MPFR_GMP(5,0,0)" as we now +require GMP 5.0+ and mp_bitcnt_t is also defined by mini-gmp. ------------------------------------------------------------------------ -r8205 | vlefevre | 2012-05-09 00:07:18 +0000 (Wed, 09 May 2012) | 2 lines +r11902 | vlefevre | 2017-12-05 10:01:32 +0000 (Tue, 05 Dec 2017) | 4 lines Changed paths: - M /branches/3.1 - M /branches/3.1/configure.ac - M /branches/3.1/tests/Makefile.am + M /trunk/src/mpfr-gmp.h -Patch from Nitin A Kamble for automake 1.12 -(merged changeset r8204 from the trunk) +[src/mpfr-gmp.h] Removed the code that defined mpn_copyi and mpn_copyd +macros for GMP < 5, since MPFR now requires GMP 5.0+ and these functions +are also defined by mini-gmp (these macros were used by mini-gmp only +because mini-gmp does not define GMP_VERSION). ------------------------------------------------------------------------ -r8202 | vlefevre | 2012-05-07 18:13:13 +0000 (Mon, 07 May 2012) | 5 lines +r11901 | vlefevre | 2017-12-05 09:52:56 +0000 (Tue, 05 Dec 2017) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/AUTHORS - M /branches/3.1/INSTALL - M /branches/3.1/doc/mpfr.texi + M /trunk/src/mpfr-gmp.h + +[src/mpfr-gmp.h] Missing parentheses around parameters in mpn_copyi +and mpn_copyd macro definitions. +------------------------------------------------------------------------ +r11900 | zimmerma | 2017-12-05 09:44:49 +0000 (Tue, 05 Dec 2017) | 2 lines +Changed paths: + M /trunk/src/mpfr-gmp.h + +fixed bug in replacement function for copyi and copyd (found with mini-gmp) + +------------------------------------------------------------------------ +r11899 | zimmerma | 2017-12-05 09:43:54 +0000 (Tue, 05 Dec 2017) | 2 lines +Changed paths: + M /trunk/doc/mini-gmp + +add --disable-shared for mini-gmp (not tested yet with dynamic linking) + +------------------------------------------------------------------------ +r11898 | vlefevre | 2017-12-05 09:09:16 +0000 (Tue, 05 Dec 2017) | 2 lines +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Explain how to avoid the "... is deprecated" warning when +testing a deprecated function. +------------------------------------------------------------------------ +r11897 | vlefevre | 2017-12-05 08:52:43 +0000 (Tue, 05 Dec 2017) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Removed a -Wno-error=deprecated-declarations as +the specific warnings are now avoided (r11896). +------------------------------------------------------------------------ +r11896 | vlefevre | 2017-12-05 08:47:25 +0000 (Tue, 05 Dec 2017) | 2 lines +Changed paths: + M /trunk/src/mpfr.h + M /trunk/tests/tgrandom.c + M /trunk/tests/tpow.c + M /trunk/tests/troot.c + +Disable the "deprecated" attribute of deprecated functions *only* for +the tests of these functions, to avoid the corresponding warnings. +------------------------------------------------------------------------ +r11895 | vlefevre | 2017-12-05 08:34:13 +0000 (Tue, 05 Dec 2017) | 1 line +Changed paths: + M /trunk/src/dump.c + M /trunk/tests/trint.c + +Removed trailing whietespace. +------------------------------------------------------------------------ +r11894 | zimmerma | 2017-12-05 08:16:00 +0000 (Tue, 05 Dec 2017) | 2 lines +Changed paths: + M /trunk/src/mpfr-mini-gmp.c + M /trunk/src/mpfr-mini-gmp.h + M /trunk/tests/terandom.c + M /trunk/tests/tgrandom.c + M /trunk/tests/tnrandom.c + M /trunk/tests/trandom.c + M /trunk/tests/turandom.c + +fixed compiler warnings with mini-gmp + +------------------------------------------------------------------------ +r11893 | vlefevre | 2017-12-04 22:47:09 +0000 (Mon, 04 Dec 2017) | 2 lines +Changed paths: + M /trunk/src/dump.c + M /trunk/src/fpif.c + M /trunk/src/inp_str.c + M /trunk/src/mpfr-impl.h + M /trunk/src/out_str.c + M /trunk/tests/mpfr-test.h + M /trunk/tests/tvalist.c + +Simplified the use of MPFR_USE_FILE since ( for C++) +is unconditionally included. +------------------------------------------------------------------------ +r11892 | vlefevre | 2017-12-04 22:20:08 +0000 (Mon, 04 Dec 2017) | 1 line +Changed paths: + R /trunk/doc/texinfo.tex (from /trunk/doc/texinfo.tex:11890) + +Restored the history (and mergedinfo) of doc/texinfo.tex +------------------------------------------------------------------------ +r11891 | zimmerma | 2017-12-04 19:01:20 +0000 (Mon, 04 Dec 2017) | 2 lines +Changed paths: + M /trunk/doc/mini-gmp + R /trunk/doc/texinfo.tex + M /trunk/src/dump.c + M /trunk/src/fpif.c + M /trunk/src/get_q.c + M /trunk/src/gmp_op.c + M /trunk/src/inp_str.c + M /trunk/src/mpfr-mini-gmp.c + M /trunk/src/mpfr-mini-gmp.h + M /trunk/src/mpfr.h + M /trunk/src/out_str.c + M /trunk/src/set_q.c + M /trunk/tests/mpfr-test.h + M /trunk/tests/tget_q.c + M /trunk/tests/tget_z.c + M /trunk/tests/trint.c + +make compilation work again (make + make check) with mini-gmp + +------------------------------------------------------------------------ +r11890 | vlefevre | 2017-12-04 15:05:05 +0000 (Mon, 04 Dec 2017) | 1 line +Changed paths: + M /trunk/src/Makefile.am + +Improved portability of the check-gmp-symbols make rule. +------------------------------------------------------------------------ +r11889 | vlefevre | 2017-12-04 13:43:59 +0000 (Mon, 04 Dec 2017) | 1 line +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] Clarification. +------------------------------------------------------------------------ +r11888 | vlefevre | 2017-12-04 13:37:19 +0000 (Mon, 04 Dec 2017) | 3 lines +Changed paths: + M /trunk/tests/tfpif.c + M /trunk/tests/tfpif_r1.dat + +[tests] + * tfpif.c: in doit(), also test the negative versions of the numbers. + * tfpif_r1.dat: update. +------------------------------------------------------------------------ +r11887 | vlefevre | 2017-12-04 11:36:07 +0000 (Mon, 04 Dec 2017) | 3 lines +Changed paths: + M /trunk/src/get_str.c + M /trunk/src/vasprintf.c + +[src] Update about the internal use of mpfr_get_str. + * get_str.c: updated a comment. + * vasprintf.c: added assertions. +------------------------------------------------------------------------ +r11886 | vlefevre | 2017-12-04 11:11:37 +0000 (Mon, 04 Dec 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r11885 | vlefevre | 2017-12-04 10:28:55 +0000 (Mon, 04 Dec 2017) | 1 line +Changed paths: + M /trunk/src/get_str.c + +[src/get_str.c] Corrected a comment. +------------------------------------------------------------------------ +r11884 | vlefevre | 2017-12-04 10:20:34 +0000 (Mon, 04 Dec 2017) | 3 lines +Changed paths: + M /trunk + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Update about the memory allocation (added references +to Section "Memory Handling"). +(merged changeset r11632 from the 3.1 branch) +------------------------------------------------------------------------ +r11883 | vlefevre | 2017-12-04 10:09:02 +0000 (Mon, 04 Dec 2017) | 4 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Update for mpfr_get_str: + * Added a texi comment explaining why m+1 (so that if the mpfr_get_str + implementation is improved, we know whether this is still the case). + * Improved the documentation for the case str = null pointer. +------------------------------------------------------------------------ +r11882 | vlefevre | 2017-12-03 14:16:40 +0000 (Sun, 03 Dec 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated comments about the latest change (r11881). +------------------------------------------------------------------------ +r11881 | vlefevre | 2017-12-03 14:14:18 +0000 (Sun, 03 Dec 2017) | 5 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Typography fixes for TeX (DVI/PS/PDF) in math mode. + * Corrected the use of \lceil and \rceil. + * Added missing @var, including 2 in exponent, as allowed by + texinfo.tex 2017-12-01.13. + * Removed old comments about Texinfo. +------------------------------------------------------------------------ +r11880 | vlefevre | 2017-12-03 13:55:51 +0000 (Sun, 03 Dec 2017) | 2 lines +Changed paths: + M /trunk/doc/texinfo.tex + +[doc/texinfo.tex] Update to the latest version 2017-12-01.13 from +. +------------------------------------------------------------------------ +r11878 | vlefevre | 2017-12-01 16:27:09 +0000 (Fri, 01 Dec 2017) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] In r11876, forgot to define MPFR_WANT_DECIMAL_FLOATS in +the cross-compiling case. +------------------------------------------------------------------------ +r11877 | vlefevre | 2017-12-01 15:04:21 +0000 (Fri, 01 Dec 2017) | 6 lines +Changed paths: + M /trunk/doc/README.dev + M /trunk/tests/tests.c + M /trunk/tests/tversion.c + +Solved an output issue on AIX due to the use of setbuf() after output +in tversion. Indeed, this is disallowed by ISO C. + * doc/README.dev: added a note about tests_start_mpfr and this issue. + * tests/tests.c: moved test_version() after setbuf(). + * tests/tversion.c: moved tests_start_mpfr() earlier, before any + printf(). +------------------------------------------------------------------------ +r11876 | vlefevre | 2017-12-01 14:06:07 +0000 (Fri, 01 Dec 2017) | 3 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Attempt to fix detection of decimal floats: if _Decimal64 +is known but does not work, no longer fail when --enable-decimal-float +has not been used; just disable decimal floats. +------------------------------------------------------------------------ +r11875 | vlefevre | 2017-12-01 13:37:40 +0000 (Fri, 01 Dec 2017) | 3 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Attempt to fix detection of decimal floats (BID was +incorrectly assumed in case of link failure, if ld returned 1, which +was observed on powerpc-ibm-aix7.2.0.0 [gcc119.fsffrance.org]). +------------------------------------------------------------------------ +r11874 | vlefevre | 2017-12-01 12:28:45 +0000 (Fri, 01 Dec 2017) | 1 line +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] Updated comments about the format. +------------------------------------------------------------------------ +r11871 | vlefevre | 2017-11-30 17:27:20 +0000 (Thu, 30 Nov 2017) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Typo. +------------------------------------------------------------------------ +r11870 | vlefevre | 2017-11-30 17:13:25 +0000 (Thu, 30 Nov 2017) | 5 lines +Changed paths: + M /trunk/Makefile.am + M /trunk/src/Makefile.am + +Two fixes for the check-gmp-symbols make rule: + * Use $(COMPILE) instead of $(CC) to get the usual compilation flags + (in particular, the -I flags may be important to find gmp.h and to + get the correct one). + * Run the test only if libmpfr.so exists. +------------------------------------------------------------------------ +r11869 | vlefevre | 2017-11-30 15:32:33 +0000 (Thu, 30 Nov 2017) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Internal GMP symbols: mention "make check-gmp-symbols". +------------------------------------------------------------------------ +r11868 | vlefevre | 2017-11-30 15:30:30 +0000 (Thu, 30 Nov 2017) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Mention "make check-gmp-symbols" (experimental). +------------------------------------------------------------------------ +r11867 | vlefevre | 2017-11-30 15:27:00 +0000 (Thu, 30 Nov 2017) | 2 lines +Changed paths: + M /trunk/INSTALL + +[INSTALL] Added an optional step "make check-gmp-symbols" to check +that MPFR does not use GMP internal symbols. +------------------------------------------------------------------------ +r11866 | vlefevre | 2017-11-30 15:17:10 +0000 (Thu, 30 Nov 2017) | 1 line +Changed paths: + M /trunk/Makefile.am + M /trunk/src/Makefile.am + +Added comment about the check-gmp-symbols make rule (added in r11865). +------------------------------------------------------------------------ +r11865 | vlefevre | 2017-11-30 15:12:20 +0000 (Thu, 30 Nov 2017) | 2 lines +Changed paths: + M /trunk/Makefile.am + M /trunk/src/Makefile.am + +Added check-gmp-symbols make rule to check that MPFR does not use +GMP internal symbols. +------------------------------------------------------------------------ +r11864 | vlefevre | 2017-11-30 13:57:29 +0000 (Thu, 30 Nov 2017) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Detailed the note about the list of GMP symbols. +------------------------------------------------------------------------ +r11863 | vlefevre | 2017-11-30 13:44:10 +0000 (Thu, 30 Nov 2017) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Document how to get the list of GMP symbols used +by MPFR and how to detect GMP internal symbols used by MPFR. +------------------------------------------------------------------------ +r11862 | vlefevre | 2017-11-30 13:19:03 +0000 (Thu, 30 Nov 2017) | 2 lines +Changed paths: + M /trunk/INSTALL + +[INSTALL] Added a paragraph about the potential incorrect use of +GMP internals. +------------------------------------------------------------------------ +r11861 | vlefevre | 2017-11-29 15:26:52 +0000 (Wed, 29 Nov 2017) | 1 line +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] Fixed the sign bug for mpfr_fpif_import. +------------------------------------------------------------------------ +r11860 | vlefevre | 2017-11-29 15:05:28 +0000 (Wed, 29 Nov 2017) | 4 lines +Changed paths: + M /trunk/tests/tfpif.c + +[tests/tfpif.c] In doit(), before the call to mpfr_fpif_import(), set +the sign of the target to the opposite of the expected sign. Thus, if +mpfr_fpif_import forgets to set the sign, this will be detected. And +a failure actually occurs now! +------------------------------------------------------------------------ +r11859 | vlefevre | 2017-11-29 14:59:03 +0000 (Wed, 29 Nov 2017) | 1 line +Changed paths: + M /trunk/tests/tfpif.c + +[tests/tfpif.c] For mpfr_fpif_import, check the precision too. +------------------------------------------------------------------------ +r11858 | vlefevre | 2017-11-29 02:37:57 +0000 (Wed, 29 Nov 2017) | 3 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/fpif.c + +[doc/mpfr.texi,src/fpif.c] For mpfr_fpif_import, in case of failure, +the argument x is either unchanged or set to NaN, to make sure that +x has valid contents (otherwise this could yield erratic behavior). +------------------------------------------------------------------------ +r11857 | vlefevre | 2017-11-29 02:25:19 +0000 (Wed, 29 Nov 2017) | 3 lines +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] For mpfr_fpif_import, replaced an assertion by a failure +(since the full format is not described in the manual and MPFR cannot +currently generate such a case, this is OK). +------------------------------------------------------------------------ +r11856 | vlefevre | 2017-11-29 02:06:02 +0000 (Wed, 29 Nov 2017) | 1 line +Changed paths: + M /trunk/tests/tfpif_r1.dat + +[tests/tfpif_r1.dat] Fixed an obvious error (incorrect sign of 0). +------------------------------------------------------------------------ +r11855 | vlefevre | 2017-11-29 01:49:34 +0000 (Wed, 29 Nov 2017) | 1 line +Changed paths: + M /trunk/tests/tfpif.c + +[tests/tfpif.c] Output more information in case of error. +------------------------------------------------------------------------ +r11853 | vlefevre | 2017-11-28 16:46:55 +0000 (Tue, 28 Nov 2017) | 2 lines +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] Fixed some bugs (though unlikely to occur in practice). +Added comments. Minor code improvement. +------------------------------------------------------------------------ +r11852 | vlefevre | 2017-11-28 15:41:17 +0000 (Tue, 28 Nov 2017) | 7 lines +Changed paths: + M /trunk/acinclude.m4 + D /trunk/m4/size_max.m4 + M /trunk/src/vasprintf.c + +Got rid of the useless SIZE_MAX macro. + * src/vasprintf.c: replaced SIZE_MAX by (size_t) -1, already used + in some other files. + * acinclude.m4: no longer use gl_SIZE_MAX (from m4/size_max.m4). + * Removed m4/size_max.m4 as it is no longer needed (note that the + definition of SIZE_MAX by this file was unnecessarily complex + and potentially incorrect on some platforms). +------------------------------------------------------------------------ +r11851 | vlefevre | 2017-11-28 15:07:33 +0000 (Tue, 28 Nov 2017) | 1 line +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] Added static assertions in mpfr_fpif_import(). +------------------------------------------------------------------------ +r11850 | vlefevre | 2017-11-28 14:41:45 +0000 (Tue, 28 Nov 2017) | 1 line +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] Improved a test (mpfr_regular_p → !MPFR_IS_SINGULAR). +------------------------------------------------------------------------ +r11849 | vlefevre | 2017-11-28 14:38:47 +0000 (Tue, 28 Nov 2017) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Added a note about the use of the MPFR_IS_PURE_*(x) +and MPFR_IS_SINGULAR*(x) macros. +------------------------------------------------------------------------ +r11848 | vlefevre | 2017-11-27 16:07:23 +0000 (Mon, 27 Nov 2017) | 2 lines +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] Added format description from past mail messages, to be +checked in case of change (+ FIXME for NaN). Minor code improvement. +------------------------------------------------------------------------ +r11847 | vlefevre | 2017-11-27 15:04:59 +0000 (Mon, 27 Nov 2017) | 1 line +Changed paths: + M /trunk/tests/tfpif.c + +[tests/tfpif.c] Added TODO's (but the failure should be fixed first). +------------------------------------------------------------------------ +r11846 | vlefevre | 2017-11-27 14:33:53 +0000 (Mon, 27 Nov 2017) | 1 line +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] Clarified sign variable. +------------------------------------------------------------------------ +r11845 | vlefevre | 2017-11-27 14:17:52 +0000 (Mon, 27 Nov 2017) | 2 lines +Changed paths: + M /trunk/tests/tfpif.c + +[tests/tfpif.c] Use SAME_VAL instead of mpfr_cmp. This triggers a bug +that was not detected yet. +------------------------------------------------------------------------ +r11844 | vlefevre | 2017-11-27 14:15:52 +0000 (Mon, 27 Nov 2017) | 3 lines +Changed paths: + M /trunk/tests/tfpif.c + +[tests/tfpif.c] Split the main test function into: + * doit(): keep only the tests that depend on the precisions. + * check_bad(): tests for bad file/data; precisions are not involved. +------------------------------------------------------------------------ +r11843 | vlefevre | 2017-11-27 13:58:24 +0000 (Mon, 27 Nov 2017) | 1 line +Changed paths: + M /trunk/tests/tfpif.c + +[tests/tfpif.c] Improved a test (NaN checking). Added comments. +------------------------------------------------------------------------ +r11842 | vlefevre | 2017-11-27 13:53:43 +0000 (Mon, 27 Nov 2017) | 1 line +Changed paths: + M /trunk/tests/tfpif.c + +[tests/tfpif.c] Removed a TODO done in r10326 and r10338. +------------------------------------------------------------------------ +r11841 | vlefevre | 2017-11-27 10:31:33 +0000 (Mon, 27 Nov 2017) | 1 line +Changed paths: + M /trunk/autogen.sh + +Updated autogen.sh so that doc/texinfo.tex isn't replaced. +------------------------------------------------------------------------ +r11840 | vlefevre | 2017-11-27 10:25:01 +0000 (Mon, 27 Nov 2017) | 3 lines +Changed paths: + A /trunk/doc/texinfo.tex + +Added doc/texinfo.tex file from Texinfo 6.5 since the version installed +by Automake (via "autoreconf -i" as called by autogen.sh) is obsolete: +more than 4 years older than the current version! +------------------------------------------------------------------------ +r11839 | vlefevre | 2017-11-27 09:17:37 +0000 (Mon, 27 Nov 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated a comment about a bug in Texinfo. +------------------------------------------------------------------------ +r11838 | vlefevre | 2017-11-23 14:33:18 +0000 (Thu, 23 Nov 2017) | 2 lines +Changed paths: + M /trunk/tests/tset_exp.c + +[tests/tset_exp.c] Check mpfr_get_exp too (with two additional tests +for mpfr_set_exp). +------------------------------------------------------------------------ +r11837 | vlefevre | 2017-11-23 13:58:12 +0000 (Thu, 23 Nov 2017) | 1 line +Changed paths: + M /trunk/tests/texceptions.c + +[tests/texceptions.c] Minor improvements. +------------------------------------------------------------------------ +r11836 | vlefevre | 2017-11-23 13:53:24 +0000 (Thu, 23 Nov 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] For mpfr_get_exp, document that x can be outside of +the current range of acceptable values (this was ambiguous). +------------------------------------------------------------------------ +r11835 | vlefevre | 2017-11-21 15:03:59 +0000 (Tue, 21 Nov 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Corrected Texinfo typography issues. +------------------------------------------------------------------------ +r11834 | zimmerma | 2017-11-21 14:11:23 +0000 (Tue, 21 Nov 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +added another example where we can have an overflow + +------------------------------------------------------------------------ +r11833 | zimmerma | 2017-11-21 13:14:23 +0000 (Tue, 21 Nov 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +added pointer to mpfr_subnormalize + +------------------------------------------------------------------------ +r11832 | vlefevre | 2017-11-21 12:52:40 +0000 (Tue, 21 Nov 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Major update of "MPFR and the IEEE 754 Standard". +------------------------------------------------------------------------ +r11831 | vlefevre | 2017-11-21 11:44:50 +0000 (Tue, 21 Nov 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added "MPFR and the IEEE 754 Standard" to the main menu +as required. Title capitalization. +------------------------------------------------------------------------ +r11830 | vlefevre | 2017-11-21 11:41:29 +0000 (Tue, 21 Nov 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Correction of a @node. +------------------------------------------------------------------------ +r11829 | zimmerma | 2017-11-21 10:27:43 +0000 (Tue, 21 Nov 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +added section "MPFR and the IEEE 754 standard" + +------------------------------------------------------------------------ +r11828 | vlefevre | 2017-11-20 17:48:30 +0000 (Mon, 20 Nov 2017) | 3 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] mpfr_can_round: corrected the example; removed +a reference to "ternary value" as there is already one in the +previous sentence; clarification. +------------------------------------------------------------------------ +r11827 | vlefevre | 2017-11-20 17:37:54 +0000 (Mon, 20 Nov 2017) | 4 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Faithful rounding (MPFR_RNDF): + * Document that this feature is experimental and partially supported. + * Update Section "API Compatibility". +Note: the NEWS file was up-to-date. +------------------------------------------------------------------------ +r11822 | vlefevre | 2017-11-15 16:17:14 +0000 (Wed, 15 Nov 2017) | 5 lines +Changed paths: + M /trunk/tests/talloc-cache.c + +[tests/talloc-cache.c] + * Replaced test + abort() by the more informative MPFR_ASSERTN(). + * Also check that the allocator is the current GMP one (this would + fail with MPFR 3.1.6, where the allocation functions are memorized + the first time they are seen). +------------------------------------------------------------------------ +r11821 | vlefevre | 2017-11-15 12:35:39 +0000 (Wed, 15 Nov 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/free_cache.c + M /trunk/src/mpfr.h + M /trunk/tests/talloc-cache.c + +mpfr_mp_memory_cleanup() now returns an error code (currently always 0) +to avoid a future prototype change in case errors would be possible. +------------------------------------------------------------------------ +r11820 | vlefevre | 2017-11-10 16:48:39 +0000 (Fri, 10 Nov 2017) | 6 lines +Changed paths: + M /trunk/TODO + M /trunk/src/ai.c + M /trunk/src/bernoulli.c + M /trunk/src/clear.c + M /trunk/src/exp3.c + M /trunk/src/fpif.c + M /trunk/src/get_str.c + M /trunk/src/init2.c + M /trunk/src/inp_str.c + M /trunk/src/lngamma.c + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/out_str.c + M /trunk/src/rndna.c + M /trunk/src/round_prec.c + M /trunk/src/set_prec.c + M /trunk/src/strtofr.c + M /trunk/src/vasprintf.c + M /trunk/src/zeta.c + M /trunk/tests/tabort_defalloc1.c + M /trunk/tests/tabort_defalloc2.c + +Cleanup: In src/mpfr-gmp.h, exchanged + mpfr_allocate_func and *__gmp_allocate_func + mpfr_reallocate_func and *__gmp_reallocate_func + mpfr_free_func and *__gmp_free_func +and in the code, replaced *__gmp_{allocate,reallocate,free}_func +by mpfr_{allocate,reallocate,free}_func; updated TODO file. +------------------------------------------------------------------------ +r11819 | vlefevre | 2017-11-10 13:58:25 +0000 (Fri, 10 Nov 2017) | 3 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] The sign bit of a NaN is now specified for mpfr_abs, +mpfr_neg and mpfr_set, in order to mimic the IEEE-754 abs, negate +and copy operations. +------------------------------------------------------------------------ +r11818 | vlefevre | 2017-11-10 13:13:13 +0000 (Fri, 10 Nov 2017) | 2 lines +Changed paths: + M /trunk/tests/tabs.c + +[tests/tabs.c] More tests on mpfr_abs, including the ternary value +and the NaN flag and sign bit for ±NaN. +------------------------------------------------------------------------ +r11817 | vlefevre | 2017-11-10 12:53:48 +0000 (Fri, 10 Nov 2017) | 1 line +Changed paths: + M /trunk/tests/tabs.c + +[tests/tabs.c] Coding style. +------------------------------------------------------------------------ +r11816 | vlefevre | 2017-11-10 12:47:09 +0000 (Fri, 10 Nov 2017) | 2 lines +Changed paths: + M /trunk/tests/tset.c + +[tests/tset.c] For mpfr_neg on NaN, also check that the variable is +set to NaN and that the ternary value is 0. +------------------------------------------------------------------------ +r11815 | vlefevre | 2017-11-10 12:43:04 +0000 (Fri, 10 Nov 2017) | 1 line +Changed paths: + M /trunk/tests/tset.c + +[tests/tset.c] More NaN tests for mpfr_set. +------------------------------------------------------------------------ +r11814 | vlefevre | 2017-11-10 12:34:17 +0000 (Fri, 10 Nov 2017) | 2 lines +Changed paths: + M /trunk/tests/tset.c + +[tests/tset.c] More tests of the NaN flag and the sign bit for mpfr_neg +on NaN. +------------------------------------------------------------------------ +r11813 | vlefevre | 2017-11-10 12:22:26 +0000 (Fri, 10 Nov 2017) | 1 line +Changed paths: + M /trunk/tests/tset.c + +[tests/tset.c] The global variable "error" is better as static. +------------------------------------------------------------------------ +r11812 | vlefevre | 2017-11-10 12:17:15 +0000 (Fri, 10 Nov 2017) | 2 lines +Changed paths: + M /trunk/tests/tset.c + +[tests/tset.c] For mpfr_neg on NaN, check that the sign bit is flipped +in both ways. +------------------------------------------------------------------------ +r11811 | vlefevre | 2017-11-10 12:02:02 +0000 (Fri, 10 Nov 2017) | 1 line +Changed paths: + M /trunk/tests + +[tests] Added talloc-cache to svn:ignore property. +------------------------------------------------------------------------ +r11810 | vlefevre | 2017-11-09 14:49:39 +0000 (Thu, 09 Nov 2017) | 3 lines +Changed paths: + M /trunk/tests/tset.c + +[tests/tset.c] In the mpfr_neg test on the sign of NaN: +C90 compatibility; improved robustness since as specified, +mpfr_signbit can return any value (not just 0 or 1). +------------------------------------------------------------------------ +r11809 | vlefevre | 2017-11-09 14:35:17 +0000 (Thu, 09 Nov 2017) | 2 lines +Changed paths: + M /trunk/src/neg.c + +[src/neg.c] Refactored code (BTW, this was not a bug as the sign of NaN +is currently unspecified for mpfr_neg). +------------------------------------------------------------------------ +r11808 | zimmerma | 2017-11-09 13:57:40 +0000 (Thu, 09 Nov 2017) | 3 lines +Changed paths: + M /trunk/src/neg.c + M /trunk/tests/tset.c + +fixed bug reported by Trevor Spiteri +(https://sympa.inria.fr/sympa/arc/mpfr/2017-11/msg00003.html) + +------------------------------------------------------------------------ +r11807 | vlefevre | 2017-11-08 17:04:45 +0000 (Wed, 08 Nov 2017) | 7 lines +Changed paths: + M /trunk/NEWS + M /trunk/TODO + M /trunk/doc/mpfr.texi + M /trunk/src/free_cache.c + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + M /trunk/tests/talloc-cache.c + +Change the way memory is allocated (as discussed partly in private). + * src/mpfr-gmp.c, src/mpfr-gmp.h, src/mpfr-impl.h: update. + * src/free_cache.c, src/mpfr.h: added mpfr_mp_memory_cleanup function. + * NEWS: describe API change. + * TODO: added 2 related items (future clean-up and feature). + * doc/mpfr.texi: update. + * tests/talloc-cache.c: take API change into account. +------------------------------------------------------------------------ +r11806 | vlefevre | 2017-11-07 15:59:03 +0000 (Tue, 07 Nov 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated Section "Compatibility With MPF". +------------------------------------------------------------------------ +r11805 | vlefevre | 2017-11-07 15:34:11 +0000 (Tue, 07 Nov 2017) | 4 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Removed a paragraph from r2962 concerning mpf2mpfr.h +and mpf_init / mpf_init2: since r2985, the mpf_init / mpf_init2 macros +initialize to 0 like MPF, so that users shouldn't see differences from +MPF. +------------------------------------------------------------------------ +r11804 | zimmerma | 2017-11-07 15:33:40 +0000 (Tue, 07 Nov 2017) | 2 lines +Changed paths: + M /trunk/TODO + +added reference + +------------------------------------------------------------------------ +r11803 | vlefevre | 2017-11-07 09:21:02 +0000 (Tue, 07 Nov 2017) | 1 line +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Formatting. +------------------------------------------------------------------------ +r11802 | vlefevre | 2017-11-07 09:14:30 +0000 (Tue, 07 Nov 2017) | 2 lines +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] mpfr_free_cache_t: added comments to show that these are +flags. +------------------------------------------------------------------------ +r11801 | vlefevre | 2017-11-07 09:09:03 +0000 (Tue, 07 Nov 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated mpfr_free_cache / mpfr_free_cache2 description. +------------------------------------------------------------------------ +r11800 | vlefevre | 2017-11-07 08:31:45 +0000 (Tue, 07 Nov 2017) | 2 lines +Changed paths: + M /trunk/src/free_cache.c + +[src/free_cache.c] Minor portability improvement for mpfr_free_cache2 +to accept way = 0 (no effect on two's complement machines). +------------------------------------------------------------------------ +r11799 | vlefevre | 2017-11-06 16:39:40 +0000 (Mon, 06 Nov 2017) | 8 lines +Changed paths: + M /trunk/tests/talloc-cache.c + M /trunk/tests/tests.c + +[tests] + * tests.c: for test programs that use GMP's mp_set_memory_functions, + tests_rand_start and tests_rand_end also need to be disabled; to do + that, require that tests_memory_disabled be set to 2 in this case + (the value 1 is already used for the use with mini-gmp, where only + tests_memory_start and tests_memory_end need to be disabled). + * talloc-cache.c: call tests_start_mpfr and tests_end_mpfr as usual, + with tests_memory_disabled set to 2. +------------------------------------------------------------------------ +r11798 | vlefevre | 2017-11-06 16:01:32 +0000 (Mon, 06 Nov 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r11797 | vlefevre | 2017-11-06 14:22:11 +0000 (Mon, 06 Nov 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Minor change. +------------------------------------------------------------------------ +r11796 | vlefevre | 2017-11-06 14:17:51 +0000 (Mon, 06 Nov 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] + explicit information on pools (in addition to caches). +------------------------------------------------------------------------ +r11795 | vlefevre | 2017-11-06 12:19:43 +0000 (Mon, 06 Nov 2017) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + +[NEWS,doc/mpfr.texi] mpfr_free_cache2 is a new function in MPFR 4.0, +as a consequence of shared caches for multithreaded applications. +------------------------------------------------------------------------ +r11794 | vlefevre | 2017-11-06 12:07:28 +0000 (Mon, 06 Nov 2017) | 1 line +Changed paths: + M /trunk/src/free_cache.c + +[src/free_cache.c] GNU coding style. +------------------------------------------------------------------------ +r11793 | vlefevre | 2017-11-06 12:03:04 +0000 (Mon, 06 Nov 2017) | 7 lines +Changed paths: + M /trunk/tests/Makefile.am + M /trunk/tests/talloc-cache.c + +[tests] + * Makefile.am: added talloc-cache to check_PROGRAMS. + * talloc-cache.c: improved the test allocators so that an incorrect + use is detected by this code instead of relying on the C library + checking bad use of malloc/realloc/free (which was UB). + NOTE: The test currently fails in the trunk due to the mpz_t pool. + But anyway, the memory allocation method will change soon. +------------------------------------------------------------------------ +r11792 | vlefevre | 2017-11-06 10:29:06 +0000 (Mon, 06 Nov 2017) | 1 line +Changed paths: + M /trunk/tests/talloc-cache.c + +[tests/talloc-cache.c] Corrected indentation. +------------------------------------------------------------------------ +r11791 | vlefevre | 2017-10-30 12:46:57 +0000 (Mon, 30 Oct 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Improved the mpfr_nexttoward description w.r.t. flags. +------------------------------------------------------------------------ +r11790 | zimmerma | 2017-10-27 19:12:45 +0000 (Fri, 27 Oct 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +added note about mpfr_beta + +------------------------------------------------------------------------ +r11788 | vlefevre | 2017-10-26 14:39:53 +0000 (Thu, 26 Oct 2017) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + +[NEWS,doc/mpfr.texi] mpfr_beta is incomplete, experimental. +See . +------------------------------------------------------------------------ +r11787 | zimmerma | 2017-10-26 09:06:02 +0000 (Thu, 26 Oct 2017) | 2 lines +Changed paths: + M /trunk/TODO + +added functions from C++17 + +------------------------------------------------------------------------ +r11784 | zimmerma | 2017-10-23 07:18:05 +0000 (Mon, 23 Oct 2017) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +fixed typo + +------------------------------------------------------------------------ +r11782 | vlefevre | 2017-10-11 13:13:32 +0000 (Wed, 11 Oct 2017) | 4 lines +Changed paths: + M /trunk/src/get_float128.c + M /trunk/tests/tset_float128.c + +[src/get_float128.c] Fixed failure in mpfr_get_float128 when called with + a very reduced exponent range. +[tests/tset_float128.c] Also test mpfr_get_float128 in reduced exponent + range (triggering a failure before the fix). +------------------------------------------------------------------------ +r11781 | vlefevre | 2017-10-10 08:09:02 +0000 (Tue, 10 Oct 2017) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] "To make a release": + Check the generic code. +------------------------------------------------------------------------ +r11779 | vlefevre | 2017-10-09 15:02:46 +0000 (Mon, 09 Oct 2017) | 3 lines +Changed paths: + M /trunk/src/get_ld.c + +[src/get_ld.c] Fixed the generic code when called with a very reduced +exponent range. The tset_ld failure could be triggered on x86 by running +"./configure ... mpfr_cv_c_long_double_format=unknown". +------------------------------------------------------------------------ +r11778 | vlefevre | 2017-10-09 12:17:18 +0000 (Mon, 09 Oct 2017) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Also test mpfr_get_ld in reduced exponent range +(no failures on x86). +------------------------------------------------------------------------ +r11777 | vlefevre | 2017-10-09 11:39:32 +0000 (Mon, 09 Oct 2017) | 6 lines +Changed paths: + M /trunk/src/get_z.c + M /trunk/tests/tget_z.c + +[src/get_z.c] Fixed failure in mpfr_get_z when called with a very + reduced exponent range. +[tests/tget_z.c] Added tests in the various rounding modes (triggering + a failure before the above fix). Also call check_one() on an integer + congruent to 1 mod 4 (useful to check even rounding). Fixed 2 issues + in the error message (for inex and the flags). +------------------------------------------------------------------------ +r11776 | vlefevre | 2017-10-09 09:17:50 +0000 (Mon, 09 Oct 2017) | 2 lines +Changed paths: + M /trunk/tests/tget_z.c + +[tests/tget_z.c] Also test mpfr_get_z in reduced exponent range +(no failures though its code seems incorrect). +------------------------------------------------------------------------ +r11775 | vlefevre | 2017-10-06 15:08:25 +0000 (Fri, 06 Oct 2017) | 2 lines +Changed paths: + M /trunk/src/get_si.c + M /trunk/src/get_sj.c + +[src/{get_si.c,get_sj.c}] Minor improvement, removing an obsolete note +in get_sj.c at the same time. +------------------------------------------------------------------------ +r11774 | vlefevre | 2017-10-06 14:17:38 +0000 (Fri, 06 Oct 2017) | 3 lines +Changed paths: + M /trunk/src/get_sj.c + M /trunk/src/get_uj.c + M /trunk/tests/tget_sj.c + +[src/{get_sj.c,get_uj.c}] Fixed failure in mpfr_get_sj and mpfr_get_uj + when called with a very reduced exponent range. +[tests/tget_sj.c] Added corresponding test cases. +------------------------------------------------------------------------ +r11773 | vlefevre | 2017-10-06 13:52:29 +0000 (Fri, 06 Oct 2017) | 1 line +Changed paths: + M /trunk/tests/tset_si.c + +[tests/tset_si.c] Minor correction in error message. +------------------------------------------------------------------------ +r11772 | vlefevre | 2017-10-05 12:52:59 +0000 (Thu, 05 Oct 2017) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Function multiversioning (FMV): more details. +------------------------------------------------------------------------ +r11771 | vlefevre | 2017-10-05 12:47:27 +0000 (Thu, 05 Oct 2017) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Mention function multiversioning (FMV). +------------------------------------------------------------------------ +r11770 | vlefevre | 2017-10-04 15:25:26 +0000 (Wed, 04 Oct 2017) | 2 lines +Changed paths: + M /trunk/src/get_si.c + M /trunk/src/get_ui.c + +[src/{get_si.c,get_ui.c}] Fixed failure in mpfr_get_si and mpfr_get_ui +when called with a very reduced exponent range. +------------------------------------------------------------------------ +r11769 | vlefevre | 2017-10-04 15:07:56 +0000 (Wed, 04 Oct 2017) | 2 lines +Changed paths: + M /trunk/tests/tset_si.c + +[tests/tset_si.c] get_tests: added comments and tests in a reduced +exponent range, which currently trigger an assertion failure. +------------------------------------------------------------------------ +r11768 | vlefevre | 2017-10-02 08:53:14 +0000 (Mon, 02 Oct 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r11767 | vlefevre | 2017-10-02 08:39:52 +0000 (Mon, 02 Oct 2017) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Mention mpfr_dump. +------------------------------------------------------------------------ +r11766 | vlefevre | 2017-10-02 08:37:28 +0000 (Mon, 02 Oct 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Describe the current output format of mpfr_dump. +------------------------------------------------------------------------ +r11765 | vlefevre | 2017-10-02 08:22:37 +0000 (Mon, 02 Oct 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Replaced @code by @samp for things that are not +actually code, but parts of character strings. +------------------------------------------------------------------------ +r11764 | vlefevre | 2017-09-29 15:58:51 +0000 (Fri, 29 Sep 2017) | 2 lines +Changed paths: + M /trunk/src/dump.c + M /trunk/tests/toutimpl.c + +[src/dump.c] mpfr_dump now outputs specific info for invalid data. +[tests/toutimpl.c] Added mpfr_dump tests. +------------------------------------------------------------------------ +r11763 | vlefevre | 2017-09-29 13:44:52 +0000 (Fri, 29 Sep 2017) | 6 lines +Changed paths: + M /trunk/src/dump.c + +[src/dump.c] + * Output the sign even for NaN, since this can be useful information + (the sign of a NaN has an effect with some functions, following + IEEE 754-2008). + * This changes allows one to get rid of the mpfr_fprint_binary + static function at the same time. +------------------------------------------------------------------------ +r11762 | vlefevre | 2017-09-29 13:31:25 +0000 (Fri, 29 Sep 2017) | 1 line +Changed paths: + M /trunk/src/dump.c + M /trunk/src/print_raw.c + +[src/{dump.c,print_raw.c}] Updated the description. +------------------------------------------------------------------------ +r11761 | vlefevre | 2017-09-29 13:25:34 +0000 (Fri, 29 Sep 2017) | 20 lines +Changed paths: + M /trunk/src/add1sp.c + M /trunk/src/dump.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mul.c + M /trunk/src/print_raw.c + M /trunk/src/sub1sp.c + +[src] Clean up of debugging output functions: + * Replaced the internal function mpfr_fprint_binary by a new + internal function mpfr_fdump, similar to mpfr_dump, but with + a FILE * argument. + * Got rid of mpfr_print_binary entirely (it became internal in + r2466 for MPFR 2.0.2, released in 2003). + +Details: + * print_raw.c: + - moved the mpfr_fprint_binary code to dump.c; + - removed mpfr_print_binary. + * dump.c: + - mpfr_fprint_binary (from print_raw.c) is now defined as static; + - added function mpfr_fdump, using mpfr_fprint_binary; + - mpfr_dump: use mpfr_fdump instead of the old mpfr_print_binary. + * mpfr-impl.h: + - replaced mpfr_fprint_binary declaration by mpfr_fdump; + - removed mpfr_print_binary declaration. + * add1sp.c, mul.c, sub1sp.c: replaced mpfr_fprint_binary by mpfr_fdump + and removed the '\n', now output by mpfr_fdump. +------------------------------------------------------------------------ +r11759 | vlefevre | 2017-09-28 11:27:54 +0000 (Thu, 28 Sep 2017) | 1 line +Changed paths: + M /trunk/tests + +[tests] Added trootn_ui to svn:ignore property. +------------------------------------------------------------------------ +r11758 | vlefevre | 2017-09-20 14:11:30 +0000 (Wed, 20 Sep 2017) | 3 lines +Changed paths: + M /trunk/tests/toutimpl.c + +[tests/toutimpl.c] + * Check mpfr_print_mant_binary() too. + * GNU coding style. +------------------------------------------------------------------------ +r11757 | vlefevre | 2017-09-20 13:57:58 +0000 (Wed, 20 Sep 2017) | 4 lines +Changed paths: + M /trunk/src/print_raw.c + +[src/print_raw.c] Changes in mpfr_print_mant_binary(): + * Output a ']' when a '[' was output earlier. + * Correction: putchar() takes an int (or unsigned char), not a char. + * GNU coding style. +------------------------------------------------------------------------ +r11756 | zimmerma | 2017-09-18 14:02:23 +0000 (Mon, 18 Sep 2017) | 2 lines +Changed paths: + M /trunk/tools/mbench/timp.h + +changed .align 64 into .p2align 6 (cf https://trac.sagemath.org/ticket/19233) + +------------------------------------------------------------------------ +r11755 | vlefevre | 2017-09-15 11:51:18 +0000 (Fri, 15 Sep 2017) | 21 lines +Changed paths: + M /trunk/tests/mpfr-test.h + M /trunk/tests/tacos.c + M /trunk/tests/tasin.c + M /trunk/tests/tasinh.c + M /trunk/tests/tatanh.c + M /trunk/tests/tcbrt.c + M /trunk/tests/tdim.c + M /trunk/tests/tdiv.c + M /trunk/tests/terf.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/texpm1.c + M /trunk/tests/tgmpop.c + M /trunk/tests/tmul.c + M /trunk/tests/tset.c + M /trunk/tests/tset_str.c + M /trunk/tests/tsgn.c + M /trunk/tests/tui_div.c + +[tests] Solve issues with the incorrect use of mpfr_sgn, and make sure +that this cannot happen again without being detected: on zero, +1 or -1 +was sometimes expected to check the sign of zero, but mpfr_sgn actually +returned 0, so that the check always succeeded whatever the sign of the +null result. + * mpfr-test.h: define a new mpfr_sgn macro that fails when used on NaN + or zero (whose sign is not +1 or -1), except when MPFR_TESTS_TSGN is + defined. + * tacos.c, tasin.c, tasinh.c, tatanh.c, tcbrt.c, tdim.c, terf.c, + texp.c, texp10.c, texp2.c, texpm1.c, tset.c, tset_str.c: replaced + the incorrect use of mpfr_sgn; some other related improvements. + Note: in tset.c, a "mpfr_sgn (x) < 0" test had to be replaced by + "MPFR_IS_POS (x)" since we really want to test whether the sign + is positive (not negative). + * tdiv.c, tmul.c, tui_div.c: simplified some tests, in particular to + avoid a failure with the new mpfr_sgn macro for the tests; here, + the use of mpfr_sgn was correct, but one could do simpler. + * tgmpop.c: replaced "mpfr_sgn (z)" by "(mpfr_sgn) (z)" to avoid the + new mpfr_sgn macro (here, we really want the mathematical sign). + * tsgn.c: define MPFR_TESTS_TSGN as the goal of this program is to + test mpfr_sgn itself (both the function and the macro in mpfr.h). +------------------------------------------------------------------------ +r11754 | vlefevre | 2017-09-15 07:45:21 +0000 (Fri, 15 Sep 2017) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] "To make a release": Enhanced step 5 (tarballs). +------------------------------------------------------------------------ +r11753 | zimmerma | 2017-09-14 18:55:02 +0000 (Thu, 14 Sep 2017) | 2 lines +Changed paths: + M /trunk/tools/mbench/Makefile + +patch to avoid using the system mpfr.h + +------------------------------------------------------------------------ +r11752 | vlefevre | 2017-09-14 15:41:35 +0000 (Thu, 14 Sep 2017) | 4 lines +Changed paths: + M /trunk/tests/tfms.c + +[tests/tfms.c] Similar changes to what was done in tfma.c: + * replaced "mpfr_cmp" by "! mpfr_equal_p"; + * code formatting (mainly reindentation); + * use of SAME_SIGN for better clarity. +------------------------------------------------------------------------ +r11751 | vlefevre | 2017-09-14 15:39:24 +0000 (Thu, 14 Sep 2017) | 2 lines +Changed paths: + M /trunk/tests/tfma.c + +[tests/tfma.c] Similar change to what was done in tfms.c (may be useful +in the future). +------------------------------------------------------------------------ +r11750 | vlefevre | 2017-09-14 15:28:21 +0000 (Thu, 14 Sep 2017) | 4 lines +Changed paths: + M /trunk/tests/tabs.c + M /trunk/tests/tcmp2.c + M /trunk/tests/tconst_euler.c + M /trunk/tests/tcos.c + M /trunk/tests/tcoth.c + M /trunk/tests/tdiv.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/tfactorial.c + M /trunk/tests/tfma.c + M /trunk/tests/tfms.c + M /trunk/tests/tgeneric_ui.c + M /trunk/tests/tgmpop.c + M /trunk/tests/toutimpl.c + M /trunk/tests/tpow3.c + M /trunk/tests/trint.c + M /trunk/tests/tsec.c + M /trunk/tests/tsech.c + M /trunk/tests/tset_d.c + M /trunk/tests/tset_q.c + M /trunk/tests/tset_si.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tsqrt.c + M /trunk/tests/tsub.c + M /trunk/tests/tsub_ui.c + M /trunk/tests/ttan.c + M /trunk/tests/tui_pow.c + M /trunk/tests/tzeta.c + +[tests] Got rid of the use of mpfr_print_binary, in general with +mpfr_dump. Replaced some "mpfr_out_str (stdout, 2, ...)" by mpfr_dump +for consistency or as improvements. Some other corrections in the +related error messages. +------------------------------------------------------------------------ +r11749 | zimmerma | 2017-09-14 14:03:59 +0000 (Thu, 14 Sep 2017) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +added info about autoconf-archive + +------------------------------------------------------------------------ +r11748 | vlefevre | 2017-09-14 09:23:39 +0000 (Thu, 14 Sep 2017) | 1 line +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + M /trunk/src/mpfr.h + +Old, deprecated macros mpfr_add_one_ulp and mpfr_sub_one_ulp removed. +------------------------------------------------------------------------ +r11747 | vlefevre | 2017-09-13 15:06:51 +0000 (Wed, 13 Sep 2017) | 3 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Do the tests_start_mpfr / tests_end_mpfr check only if +the .c file has a main() function; this avoids an error on trootn_ui.c, +which just does a #include. +------------------------------------------------------------------------ +r11746 | vlefevre | 2017-09-13 14:46:00 +0000 (Wed, 13 Sep 2017) | 4 lines +Changed paths: + M /trunk/tests/troot.c + +[tests/troot.c] + * Use mpfr_set_zero instead of mpfr_set_ui / mpfr_neg (like what was + done for the infinity, using mpfr_set_inf). + * For exact cases (NaN, ±Inf, ±0), check that the ternary value is 0. +------------------------------------------------------------------------ +r11745 | vlefevre | 2017-09-13 14:36:25 +0000 (Wed, 13 Sep 2017) | 3 lines +Changed paths: + M /trunk/tests/troot.c + +[tests/troot.c] For the root(±0,k) tests, before calling the function, +we set the target y to NaN with the wrong sign, so that if the code of +the function forgets to do something, this will be detected. +------------------------------------------------------------------------ +r11744 | vlefevre | 2017-09-13 14:17:46 +0000 (Wed, 13 Sep 2017) | 1 line +Changed paths: + M /trunk/tests/troot.c + +[tests/troot.c] Also check root(+0,42) and root(-0,17) for completeness. +------------------------------------------------------------------------ +r11743 | vlefevre | 2017-09-13 14:11:35 +0000 (Wed, 13 Sep 2017) | 2 lines +Changed paths: + M /trunk/tests/troot.c + +[tests/troot.c] Really check the sign of the result 0 (the old test +was always false, thus useless!). +------------------------------------------------------------------------ +r11742 | vlefevre | 2017-09-13 14:00:15 +0000 (Wed, 13 Sep 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r11741 | vlefevre | 2017-09-13 13:59:20 +0000 (Wed, 13 Sep 2017) | 11 lines +Changed paths: + M /trunk/NEWS + M /trunk/TODO + M /trunk/doc/mpfr.texi + M /trunk/src/mpfr.h + M /trunk/src/root.c + M /trunk/tests/Makefile.am + M /trunk/tests/troot.c + A /trunk/tests/trootn_ui.c + +New mpfr_rootn_ui function; mpfr_root deprecated. + * src/root.c: mpfr_rootn_ui is now the main code, and mpfr_root calls + mpfr_rootn_ui. + * src/mpfr.h: added mpfr_rootn_ui prototype; marked mpfr_root as + deprecated. + * Added tests/trootn_ui.c (includes troot.c). + * tests/troot.c: made it usable (via #include) by the new trootn_ui.c + test. + * tests/Makefile.am: added trootn_ui; at the same time, corrected the + order of the test programs (lexicographic, with exceptions). + * NEWS, TODO, doc/mpfr.texi: update. +------------------------------------------------------------------------ +r11740 | vlefevre | 2017-09-13 13:28:05 +0000 (Wed, 13 Sep 2017) | 1 line +Changed paths: + M /trunk/doc/add-with-carry.c + M /trunk/tests/talloc-cache.c + +Removed the text/x-csrc svn:mime-type property present on 2 files. +------------------------------------------------------------------------ +r11739 | vlefevre | 2017-09-13 13:22:33 +0000 (Wed, 13 Sep 2017) | 2 lines +Changed paths: + M /trunk/tests/mpfr-test.h + M /trunk/tests/tgeneric.c + M /trunk/tests/tversion.c + +[tests] Avoid duplicate code by defining the MAKE_STR() macro in +mpfr-test.h only instead of tgeneric.c and tversion.c. +------------------------------------------------------------------------ +r11734 | vlefevre | 2017-09-08 10:26:37 +0000 (Fri, 08 Sep 2017) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] "To make a release": Updated the warning, as the issue +concerns the .ps file only (the .dvi file has no papersize info). +------------------------------------------------------------------------ +r11733 | vlefevre | 2017-09-08 10:07:03 +0000 (Fri, 08 Sep 2017) | 3 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] "To make a release": Added a warning to check the +papersize of the generated dvi and ps files, which may be incorrect +(bug in texinfo(?) reported as Debian bug 874632). +------------------------------------------------------------------------ +r11729 | vlefevre | 2017-09-08 08:34:24 +0000 (Fri, 08 Sep 2017) | 1 line +Changed paths: + M /trunk/NEWS + M /trunk/configure.ac + M /trunk/tests/tstrtofr.c + +Switched other gmplib.org URL's to https. +------------------------------------------------------------------------ +r11728 | vlefevre | 2017-09-08 08:31:36 +0000 (Fri, 08 Sep 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated URL: + http://gmplib.org → https://gmplib.org/ +------------------------------------------------------------------------ +r11727 | vlefevre | 2017-09-08 08:29:52 +0000 (Fri, 08 Sep 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated URL: + ftp://ftp.gnu.org/gnu/mpfr/ → https://ftp.gnu.org/gnu/mpfr/ +------------------------------------------------------------------------ +r11726 | vlefevre | 2017-09-08 08:25:49 +0000 (Fri, 08 Sep 2017) | 1 line +Changed paths: + M /trunk/tools/announce-text + +[tools/announce-text] Switched to https for ftp.gnu.org. +------------------------------------------------------------------------ +r11724 | vlefevre | 2017-09-07 14:20:45 +0000 (Thu, 07 Sep 2017) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] "To make a release": update about the uploads. +------------------------------------------------------------------------ +r11715 | vlefevre | 2017-09-06 15:30:04 +0000 (Wed, 06 Sep 2017) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Completed item on thread-safe DLL (shared library) support. +------------------------------------------------------------------------ +r11714 | vlefevre | 2017-09-06 13:49:07 +0000 (Wed, 06 Sep 2017) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Completed the fix in r11713. +------------------------------------------------------------------------ +r11713 | vlefevre | 2017-09-06 13:47:45 +0000 (Wed, 06 Sep 2017) | 4 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Fixed thread-safe DLL support with ICC and MSVC +on MS Windows without the GMP build directory (r11712 contained +inconsistent function names, yielding "unresolved external symbol" +errors in tabort_defalloc1.obj), second try. +------------------------------------------------------------------------ +r11712 | vlefevre | 2017-09-06 11:48:21 +0000 (Wed, 06 Sep 2017) | 7 lines +Changed paths: + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + +[src] Attempt to fix thread-safe DLL support with ICC and MSVC on +MS Windows without the GMP build directory. See: + https://sympa.inria.fr/sympa/arc/mpfr/2017-09/msg00009.html + https://sympa.inria.fr/sympa/arc/mpfr/2017-09/msg00014.html +i.e. for the mpfr_allocate_func, mpfr_reallocate_func & mpfr_free_func +external TLS variables, one does the same thing as what had been done +for the other ones (__gmpfr_flags, __gmpfr_emin, __gmpfr_emax, etc.). +------------------------------------------------------------------------ +r11711 | vlefevre | 2017-09-06 11:11:13 +0000 (Wed, 06 Sep 2017) | 1 line +Changed paths: + M /trunk/tests + +[tests] Added tget_q to svn:ignore property. +------------------------------------------------------------------------ +r11706 | vlefevre | 2017-09-05 12:48:04 +0000 (Tue, 05 Sep 2017) | 3 lines +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] With MPFR_CHECK_LIBC_PRINTF, disable the test of +the "'" flag with a non-glibc C library (SUS extension in printf). +In particular, it is not supported by AIX 7.2. +------------------------------------------------------------------------ +r11705 | vlefevre | 2017-09-05 12:37:19 +0000 (Tue, 05 Sep 2017) | 4 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] In case decimal_point and/or thousands_sep are +non-single-byte characters (as found on FreeBSD 11 in fr_FR.UTF-8), +revert to the default value. Added a FIXME to support multibyte +decimal_point and thousands_sep. +------------------------------------------------------------------------ +r11704 | vlefevre | 2017-09-05 11:46:44 +0000 (Tue, 05 Sep 2017) | 1 line +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Formatting. +------------------------------------------------------------------------ +r11702 | vlefevre | 2017-09-05 10:33:34 +0000 (Tue, 05 Sep 2017) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added a paragraph about temporary result files created +by test programs. +------------------------------------------------------------------------ +r11701 | vlefevre | 2017-09-05 10:19:58 +0000 (Tue, 05 Sep 2017) | 1 line +Changed paths: + M /trunk/tests/Makefile.am + +[tests/Makefile.am] Added tfpif_rw.dat to CLEANFILES. +------------------------------------------------------------------------ +r11700 | vlefevre | 2017-09-05 10:17:34 +0000 (Tue, 05 Sep 2017) | 2 lines +Changed paths: + M /trunk/tests/Makefile.am + D /trunk/tests/mpfrtest.dat + D /trunk/tests/mpfrtest2.dat + M /trunk/tests/tfpif.c + A /trunk/tests/tfpif_r1.dat (from /trunk/tests/mpfrtest.dat:11699) + A /trunk/tests/tfpif_r2.dat (from /trunk/tests/mpfrtest2.dat:11699) + +[tests] Renamed mpfrtest.txt, mpfrtest.dat and mpfrtest2.dat to +tfpif_rw.dat, tfpif_r1.dat and tfpif_r2.dat respectively. +------------------------------------------------------------------------ +r11699 | vlefevre | 2017-09-05 09:32:11 +0000 (Tue, 05 Sep 2017) | 8 lines +Changed paths: + M /trunk/tests/Makefile.am + M /trunk/tests/toutimpl.c + +[tests] + * toutimpl.c: Changed the filename of the result file like what + has been done in other test programs, to make sure that it will + not be reused by mistake. Removed comments about tmpname (which + does not exist). + * Makefile.am: Added this filename to CLEANFILES (even though the + file is removed by the test program, an error could occur before + its actual removal). +------------------------------------------------------------------------ +r11698 | vlefevre | 2017-09-05 09:13:13 +0000 (Tue, 05 Sep 2017) | 10 lines +Changed paths: + M /trunk/tests/Makefile.am + M /trunk/tests/tfprintf.c + M /trunk/tests/tout_str.c + M /trunk/tests/tprintf.c + +[tests] + * tfprintf.c, tout_str.c, tprintf.c: Do not use the same filename + for result files created in these test programs, as this breaks + parallel tests (note that such files are used only if /dev/null + does not work, so that Unix-like systems were not affected). + This should fix the bug reported in + https://sympa.inria.fr/sympa/arc/mpfr/2017-09/msg00000.html + as said in + https://sympa.inria.fr/sympa/arc/mpfr/2017-09/msg00005.html + * Makefile.am: added a CLEANFILES line with these files. +------------------------------------------------------------------------ +r11695 | vlefevre | 2017-09-01 15:24:42 +0000 (Fri, 01 Sep 2017) | 2 lines +Changed paths: + M /trunk + M /trunk/tests/turandom.c + +[tests/turandom.c] Added test_underflow(). +(merged changesets r11691-11694 from the 3.1 branch) +------------------------------------------------------------------------ +r11690 | zimmerma | 2017-08-29 12:26:42 +0000 (Tue, 29 Aug 2017) | 2 lines +Changed paths: + M /trunk/tools/cfarm.sh + +update + +------------------------------------------------------------------------ +r11688 | zimmerma | 2017-08-29 12:00:05 +0000 (Tue, 29 Aug 2017) | 2 lines +Changed paths: + M /trunk/tools/cfarm.sh + +updated for mpfr-3.1.6-rc1 + +------------------------------------------------------------------------ +r11679 | vlefevre | 2017-08-28 10:29:23 +0000 (Mon, 28 Aug 2017) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Run tools/ck-version-info. +------------------------------------------------------------------------ +r11678 | vlefevre | 2017-08-28 10:27:04 +0000 (Mon, 28 Aug 2017) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Updated a message due to the change in r11673. +------------------------------------------------------------------------ +r11677 | vlefevre | 2017-08-28 10:22:44 +0000 (Mon, 28 Aug 2017) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] "To make a release": The DLL version may need to be +updated too. +------------------------------------------------------------------------ +r11676 | vlefevre | 2017-08-28 10:18:44 +0000 (Mon, 28 Aug 2017) | 1 line +Changed paths: + M /trunk/configure.ac + +[configure.ac] Added a comment about the DLL version. +------------------------------------------------------------------------ +r11675 | vlefevre | 2017-08-28 10:12:35 +0000 (Mon, 28 Aug 2017) | 1 line +Changed paths: + M /trunk/configure.ac + +[configure.ac] Updated DLL version to 6 (cur - age). +------------------------------------------------------------------------ +r11674 | vlefevre | 2017-08-28 10:04:47 +0000 (Mon, 28 Aug 2017) | 2 lines +Changed paths: + M /trunk/tools/ck-copyright-notice + M /trunk/tools/ck-inits-clears + +[tools/{ck-copyright-notice,ck-inits-clears}] Ignore Emacs lock files +(symbolic links) to avoid a failure when a file is being edited. +------------------------------------------------------------------------ +r11673 | vlefevre | 2017-08-28 09:53:35 +0000 (Mon, 28 Aug 2017) | 5 lines +Changed paths: + D /trunk/tools/check_inits_clears + A /trunk/tools/ck-inits-clears (from /trunk/tools/check_inits_clears:11672) + M /trunk/tools/mpfrlint + +[tools] Clean up. + * Renamed check_inits_clears to ck-inits-clears (the other "check" + scripts have a name starting with "ck-"). + * mpfrlint: updated the invocation of this test, simplifying it to + make it similar to the other ones (it was based on old code). +------------------------------------------------------------------------ +r11669 | vlefevre | 2017-08-27 22:06:31 +0000 (Sun, 27 Aug 2017) | 2 lines +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Disabled the reprod_abi test with GMP < 4.2.0 +since the hardcoded values would be different. +------------------------------------------------------------------------ +r11664 | vlefevre | 2017-08-25 14:11:40 +0000 (Fri, 25 Aug 2017) | 6 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Replaced + (MPFR_LIKELY(expr)) || (ASSERT_FAIL(expr),0) +by + (MPFR_LIKELY(expr)) || (ASSERT_FAIL(expr),MPFR_ASSUME(expr),0) +as a workaround to the fact that mpfr_assert_fail is not marked as +"no return" (bug 21415). Thus, after this code, expr must be true. +------------------------------------------------------------------------ +r11663 | vlefevre | 2017-08-25 12:23:31 +0000 (Fri, 25 Aug 2017) | 2 lines +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Check that the behavior does not depend on the +platform ABI or MPFR version. +------------------------------------------------------------------------ +r11662 | vlefevre | 2017-08-25 12:19:08 +0000 (Fri, 25 Aug 2017) | 1 line +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Corrected error messages after r11661. +------------------------------------------------------------------------ +r11661 | vlefevre | 2017-08-25 11:42:36 +0000 (Fri, 25 Aug 2017) | 3 lines +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Renamed "reprod" to "reprod_rnd_exp" (reproducibility +test with several rounding modes and exponent ranges), because a second +reproducibility test will be added. +------------------------------------------------------------------------ +r11660 | vlefevre | 2017-08-25 10:41:21 +0000 (Fri, 25 Aug 2017) | 7 lines +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] + * In underflow_tests, test the flags in all cases (not just when the + returned result is 0), possibly by first computing the result in a + large exponent range. + * Since the flags are now well tested in underflow_tests, no longer + test them in the second test of test_urandom for k = 0, which was + the incorrect test that was failing (see r11659). +------------------------------------------------------------------------ +r11659 | vlefevre | 2017-08-25 08:00:19 +0000 (Fri, 25 Aug 2017) | 6 lines +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Do some test several times in order to trigger +a "mpfr_urandom() returns incorrect flags for emin = 1" failure +when GMP_CHECK_RANDOMIZE is not set (default). +Note: It is this test that is actually wrong (it corresponds to the +old behavior, currently found in the 3.1 branch, and was not updated +after the mpfr_urandom code was fixed). +------------------------------------------------------------------------ +r11658 | vlefevre | 2017-08-25 07:56:42 +0000 (Fri, 25 Aug 2017) | 1 line +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Code formatting. Added an assertion. +------------------------------------------------------------------------ +r11657 | vlefevre | 2017-08-24 14:34:33 +0000 (Thu, 24 Aug 2017) | 2 lines +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Check that the behavior of mpfr_urandom() does not +depend on the rounding mode. +------------------------------------------------------------------------ +r11656 | vlefevre | 2017-08-24 07:38:38 +0000 (Thu, 24 Aug 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Completed the description of mpfr_urandom. +------------------------------------------------------------------------ +r11655 | vlefevre | 2017-08-24 07:32:30 +0000 (Thu, 24 Aug 2017) | 1 line +Changed paths: + M /trunk/src/urandom.c + +[src/urandom.c] Completed comment. +------------------------------------------------------------------------ +r11654 | vlefevre | 2017-08-23 14:30:59 +0000 (Wed, 23 Aug 2017) | 2 lines +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] In bug20170123, use a local gmp_randstate_t variable +instead of mpfr_rands, due to the gmp_randseed_ui (see r11653). +------------------------------------------------------------------------ +r11653 | vlefevre | 2017-08-23 14:26:42 +0000 (Wed, 23 Aug 2017) | 4 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Detect the use of gmp_randseed* functions on mpfr_rands +(this is bad practice: this would affect later tests, defeating the +purpose of GMP_CHECK_RANDOMIZE; another gmp_randstate_t variable should +be used instead of mpfr_rands). +------------------------------------------------------------------------ +r11652 | vlefevre | 2017-08-23 14:09:13 +0000 (Wed, 23 Aug 2017) | 3 lines +Changed paths: + M /trunk/tests/mpfr-test.h + M /trunk/tests/tests.c + +[tests/{mpfr-test.h,tests.c}] Got rid of __gmp_randstate_struct, which +is internal to GMP: its use came from very old code (r2330 in 2003-06) +and it is no longer needed. +------------------------------------------------------------------------ +r11651 | vlefevre | 2017-08-23 13:40:39 +0000 (Wed, 23 Aug 2017) | 3 lines +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Disabled a test with GMP < 4.2.0 since it depends on +a specific behavior of the random generator, which changed in GMP 4.2.0 +(the test would probably fail with such old GMP versions). +------------------------------------------------------------------------ +r11650 | vlefevre | 2017-08-23 10:08:57 +0000 (Wed, 23 Aug 2017) | 8 lines +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + M /trunk/src/urandom.c + +[src/urandom.c] Partly rewrote mpfr_urandom() so that the next + random state no longer depends on the current exponent range + and the rounding mode, and that the exceptions due to the + rounding of the random number are now correctly generated. +[doc/mpfr.texi] Updated the mpfr_urandom() documentation and + updated Section "API Compatibility / Changed Functions" to + mention the change in MPFR 4.0. +[NEWS] Mentioned the change for MPFR 4.0. +------------------------------------------------------------------------ +r11647 | vlefevre | 2017-08-22 09:24:45 +0000 (Tue, 22 Aug 2017) | 1 line +Changed paths: + M /trunk/src/urandom.c + +[src/urandom.c] Minor change about underflow, following the usage. +------------------------------------------------------------------------ +r11646 | vlefevre | 2017-08-22 09:08:38 +0000 (Tue, 22 Aug 2017) | 1 line +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Added inex test for the underflow & overflow tests. +------------------------------------------------------------------------ +r11645 | vlefevre | 2017-08-22 08:00:54 +0000 (Tue, 22 Aug 2017) | 1 line +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Added overflow tests. +------------------------------------------------------------------------ +r11644 | vlefevre | 2017-08-22 07:46:21 +0000 (Tue, 22 Aug 2017) | 1 line +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Indentation. +------------------------------------------------------------------------ +r11643 | vlefevre | 2017-08-22 07:44:38 +0000 (Tue, 22 Aug 2017) | 1 line +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Added underflow tests. +------------------------------------------------------------------------ +r11642 | vlefevre | 2017-08-22 07:11:23 +0000 (Tue, 22 Aug 2017) | 2 lines +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] With mini-gmp, omit another test that assumes +a deterministic random generator. +------------------------------------------------------------------------ +r11641 | vlefevre | 2017-08-22 06:57:27 +0000 (Tue, 22 Aug 2017) | 1 line +Changed paths: + M /trunk/src/urandom.c + +[src/urandom.c] Bug fix: the inexact flag was not set on underflow. +------------------------------------------------------------------------ +r11640 | vlefevre | 2017-08-22 06:55:11 +0000 (Tue, 22 Aug 2017) | 2 lines +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Added tests of the flags. This currently yields +a failure (inexact flag not set on underflow). +------------------------------------------------------------------------ +r11639 | vlefevre | 2017-08-22 06:40:13 +0000 (Tue, 22 Aug 2017) | 1 line +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Added a test of the underflow flag. +------------------------------------------------------------------------ +r11638 | vlefevre | 2017-08-21 15:12:51 +0000 (Mon, 21 Aug 2017) | 10 lines +Changed paths: + M /trunk/src/urandom.c + +[src/urandom.c] 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". Thus this needs to +be fixed. +Note: This simple change has been done so that it can be merged with +the 3.1 branch. But this will not be 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. +------------------------------------------------------------------------ +r11637 | vlefevre | 2017-08-21 14:17:20 +0000 (Mon, 21 Aug 2017) | 1 line +Changed paths: + M /trunk/src/urandom.c + +[src/urandom.c] Updated comments about overflow and its flag. +------------------------------------------------------------------------ +r11636 | vlefevre | 2017-08-21 14:12:20 +0000 (Mon, 21 Aug 2017) | 5 lines +Changed paths: + M /trunk/src/urandom.c + +[src/urandom.c] Simplified the code, but, except for precision 1, +without changing the state of the PRNG. +Note: The code could be simplified even further, but the goal of the +current change is to allow it to be merged with the 3.1 branch (where +precision 1 is not supported) without too many conflicts. +------------------------------------------------------------------------ +r11635 | vlefevre | 2017-08-21 13:54:51 +0000 (Mon, 21 Aug 2017) | 1 line +Changed paths: + M /trunk/src/urandom.c + +[src/urandom.c] Moved some code without consequences. Updated comments. +------------------------------------------------------------------------ +r11634 | vlefevre | 2017-08-21 13:08:47 +0000 (Mon, 21 Aug 2017) | 1 line +Changed paths: + M /trunk/src/urandom.c + +[src/urandom.c] Useless parentheses; reformatting. +------------------------------------------------------------------------ +r11629 | vlefevre | 2017-08-17 11:17:51 +0000 (Thu, 17 Aug 2017) | 6 lines +Changed paths: + M /trunk/src/set_float128.c + +[src/set_float128.c] No longer depend on the native FP type "double" +(via mpfr_set_d), avoiding the usual precision issues with the x87 +traditional FPU in particular. Use the internal representation with +limbs, instead. The code is simpler and should also be faster. +Note: together with r11627, this avoids the tset_float128 failure +with the "-m32 -mpc32" GCC options. +------------------------------------------------------------------------ +r11628 | vlefevre | 2017-08-17 08:49:11 +0000 (Thu, 17 Aug 2017) | 1 line +Changed paths: + M /trunk/src/get_float128.c + +[src/get_float128.c] Removed variable z (no longer useful). +------------------------------------------------------------------------ +r11627 | vlefevre | 2017-08-17 08:34:45 +0000 (Thu, 17 Aug 2017) | 4 lines +Changed paths: + M /trunk/src/get_float128.c + +[src/get_float128.c] No longer depend on the native FP type "double" +(via mpfr_get_d), avoiding the usual precision issues with the x87 +traditional FPU in particular. Use the internal representation with +limbs, instead. The code is simpler and should also be faster. +------------------------------------------------------------------------ +r11626 | vlefevre | 2017-08-14 18:19:46 +0000 (Mon, 14 Aug 2017) | 2 lines +Changed paths: + M /trunk/src/get_float128.c + +[src/get_float128.c] Fixed the remaining cases of mpfr_get_float128 +(when the value is below the smallest subnormal in absolute value). +------------------------------------------------------------------------ +r11625 | vlefevre | 2017-08-14 17:31:33 +0000 (Mon, 14 Aug 2017) | 3 lines +Changed paths: + M /trunk/src/get_float128.c + M /trunk/tests/tset_float128.c + +[src/get_float128.c] Partly fixed mpfr_get_float128 when it underflows. +[tests/tset_float128.c] Added tests for small values, in particular + involving underflows (and subnormals). +------------------------------------------------------------------------ +r11624 | vlefevre | 2017-08-13 00:35:17 +0000 (Sun, 13 Aug 2017) | 2 lines +Changed paths: + M /trunk/src/get_float128.c + +[src/get_float128.c] Reverted r11623 (a note mainly for the 3.1 branch, +which actually doesn't support __float128). +------------------------------------------------------------------------ +r11623 | vlefevre | 2017-08-12 15:54:07 +0000 (Sat, 12 Aug 2017) | 1 line +Changed paths: + M /trunk/src/get_float128.c + +[src/get_float128.c] Updated the FIXME. +------------------------------------------------------------------------ +r11622 | vlefevre | 2017-08-08 14:46:54 +0000 (Tue, 08 Aug 2017) | 2 lines +Changed paths: + M /trunk/src/get_float128.c + +[src/get_float128.c] Added a FIXME after a bug report by Rob: +https://sympa.inria.fr/sympa/arc/mpfr/2017-08/msg00003.html +------------------------------------------------------------------------ +r11621 | vlefevre | 2017-08-03 16:12:26 +0000 (Thu, 03 Aug 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Section "Getting the Best Efficiency Out of MPFR" moved +from "Installing MPFR" to "MPFR Basics". Added corresponding node. +------------------------------------------------------------------------ +r11620 | zimmerma | 2017-08-03 14:21:38 +0000 (Thu, 03 Aug 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +new section "How to get the best out of MPFR" + +------------------------------------------------------------------------ +r11619 | vlefevre | 2017-08-03 08:27:12 +0000 (Thu, 03 Aug 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added a FIXME about memory allocation. +------------------------------------------------------------------------ +r11617 | vlefevre | 2017-08-03 08:16:17 +0000 (Thu, 03 Aug 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r11615 | vlefevre | 2017-08-03 08:06:38 +0000 (Thu, 03 Aug 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Removed obsolete comments. +------------------------------------------------------------------------ +r11614 | vlefevre | 2017-08-03 08:04:20 +0000 (Thu, 03 Aug 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated paragraph on the MPFR formatted output functions +and overflow on the return type int. +------------------------------------------------------------------------ +r11612 | vlefevre | 2017-08-02 11:15:01 +0000 (Wed, 02 Aug 2017) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Mention the use of the old dtags under Linux (see r11588). +------------------------------------------------------------------------ +r11611 | vlefevre | 2017-08-02 09:20:39 +0000 (Wed, 02 Aug 2017) | 3 lines +Changed paths: + M /trunk/src/printf.c + M /trunk/src/vasprintf.c + +[src] Moved mpfr_vasprintf from vasprintf.c to printf.c and updated +file descriptions for consistency (vasprintf.c should probably be +renamed later to something like printf_aux.c). +------------------------------------------------------------------------ +r11610 | vlefevre | 2017-08-02 09:05:11 +0000 (Wed, 02 Aug 2017) | 1 line +Changed paths: + M /trunk/src/printf.c + +[src/printf.c] Updated a comment (taking r11269 into account). +------------------------------------------------------------------------ +r11609 | vlefevre | 2017-08-02 08:55:34 +0000 (Wed, 02 Aug 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Added an assertion. +------------------------------------------------------------------------ +r11608 | vlefevre | 2017-08-02 08:53:13 +0000 (Wed, 02 Aug 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Completed mpfr_vasnprintf_aux description. +------------------------------------------------------------------------ +r11604 | vlefevre | 2017-08-01 09:31:49 +0000 (Tue, 01 Aug 2017) | 2 lines +Changed paths: + M /trunk/tests/tstdint.c + M /trunk/tests/tvalist.c + +[tests/{tstdint.c,tvalist.c}] Include "mpfr-test.h" instead of +"mpfr-impl.h" (this is done only when compiling with mini-gmp). +------------------------------------------------------------------------ +r11603 | vlefevre | 2017-08-01 09:29:27 +0000 (Tue, 01 Aug 2017) | 3 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Detect "mpfr-impl.h" inclusion by the test programs: +"mpfr-test.h" should be included instead; otherwise __MPFR_WITHIN_MPFR +will be defined, yielding failures under MS Windows with DLL. +------------------------------------------------------------------------ +r11601 | zimmerma | 2017-07-28 10:30:27 +0000 (Fri, 28 Jul 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +fixed typo + +------------------------------------------------------------------------ +r11600 | vlefevre | 2017-07-28 10:12:10 +0000 (Fri, 28 Jul 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added important details for the example from r11595. +------------------------------------------------------------------------ +r11599 | vlefevre | 2017-07-27 17:27:03 +0000 (Thu, 27 Jul 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Minor changes. +------------------------------------------------------------------------ +r11598 | vlefevre | 2017-07-27 06:30:53 +0000 (Thu, 27 Jul 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r11597 | zimmerma | 2017-07-27 06:24:49 +0000 (Thu, 27 Jul 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +fixed FIXME related to r11595 + +------------------------------------------------------------------------ +r11596 | vlefevre | 2017-07-27 00:23:22 +0000 (Thu, 27 Jul 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added FIXME on example from r11595. +------------------------------------------------------------------------ +r11595 | zimmerma | 2017-07-26 10:07:35 +0000 (Wed, 26 Jul 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[mpfr.texi] added example showing how to emulate fixed-point arithmetic + +------------------------------------------------------------------------ +r11590 | vlefevre | 2017-07-17 23:10:45 +0000 (Mon, 17 Jul 2017) | 3 lines +Changed paths: + M /trunk/src/sin_cos.c + +[src/sin_cos.c] Avoid integer overflows with precision 1100000 and +the 32-bit ABI (32-bit long), fixing bug reported by Simon Byrne: +https://sympa.inria.fr/sympa/arc/mpfr/2017-07/msg00002.html +------------------------------------------------------------------------ +r11589 | vlefevre | 2017-07-17 13:55:35 +0000 (Mon, 17 Jul 2017) | 1 line +Changed paths: + M /trunk/tests/tcos.c + M /trunk/tests/texp.c + M /trunk/tests/tget_f.c + M /trunk/tests/tsub1sp.c + M /trunk/tests/tui_sub.c + +[tests] Re-indented some RND_LOOP / RND_LOOP_NO_RNDF blocks. +------------------------------------------------------------------------ +r11588 | vlefevre | 2017-07-17 12:33:27 +0000 (Mon, 17 Jul 2017) | 5 lines +Changed paths: + M /trunk + M /trunk/configure.ac + +[configure.ac] Under Linux, make sure that the old dtags are used +if LD_LIBRARY_PATH is defined, avoiding the following issue: + https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859732 + https://lists.gnu.org/archive/html/libtool/2017-05/msg00000.html +(merged changeset r11587 from the 3.1 branch) +------------------------------------------------------------------------ +r11586 | vlefevre | 2017-07-10 11:53:17 +0000 (Mon, 10 Jul 2017) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Forgot casts for printf in r11585. +------------------------------------------------------------------------ +r11585 | vlefevre | 2017-07-10 11:17:31 +0000 (Mon, 10 Jul 2017) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Added ABI information & tests. +------------------------------------------------------------------------ +r11584 | vlefevre | 2017-06-20 23:25:49 +0000 (Tue, 20 Jun 2017) | 1 line +Changed paths: + M /trunk/src/subnormal.c + +[src/subnormal.c] Correction in comment (English). +------------------------------------------------------------------------ +r11583 | vlefevre | 2017-06-19 13:09:48 +0000 (Mon, 19 Jun 2017) | 4 lines +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] + * Better organization; moved MPFR patches info below MPFR version. + * Output __GMP_CC and __GMP_CFLAGS values. + * Output GMP ABI info (to be completed with MPFR ABI info). +------------------------------------------------------------------------ +r11578 | vlefevre | 2017-06-03 09:43:37 +0000 (Sat, 03 Jun 2017) | 1 line +Changed paths: + M /trunk/configure.ac + +[configure.ac] Improved some AC_DEFINE comments. +------------------------------------------------------------------------ +r11577 | vlefevre | 2017-06-03 00:34:15 +0000 (Sat, 03 Jun 2017) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added quotes for clarity. +------------------------------------------------------------------------ +r11576 | vlefevre | 2017-06-03 00:11:12 +0000 (Sat, 03 Jun 2017) | 1 line +Changed paths: + M /trunk/tests/mpf_compat.h + +[tests/mpf_compat.h] Always use stdout for failure messages. +------------------------------------------------------------------------ +r11575 | vlefevre | 2017-06-03 00:04:19 +0000 (Sat, 03 Jun 2017) | 2 lines +Changed paths: + M /trunk/src/get_str.c + +[src/get_str.c] Improved comments (avoid the confusion between a +negative base argument and a negative base). +------------------------------------------------------------------------ +r11574 | vlefevre | 2017-06-02 23:52:24 +0000 (Fri, 02 Jun 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Punctuation. +------------------------------------------------------------------------ +r11573 | zimmerma | 2017-06-02 20:49:29 +0000 (Fri, 02 Jun 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +added mpfr_get_q in Added Functions + +------------------------------------------------------------------------ +r11572 | zimmerma | 2017-06-02 15:36:52 +0000 (Fri, 02 Jun 2017) | 3 lines +Changed paths: + M /trunk/src/get_str.c + M /trunk/tests/tget_str.c + +src/get_str.c: fixed for negative base +tests/tget_str.c: added tests for negative base + +------------------------------------------------------------------------ +r11571 | zimmerma | 2017-06-02 15:11:50 +0000 (Fri, 02 Jun 2017) | 2 lines +Changed paths: + M /trunk/tests/mpf_compat.h + +tests/mpf_compat.h: non-regression tests for bugs fixed in revision 11565 + +------------------------------------------------------------------------ +r11570 | zimmerma | 2017-06-02 14:52:45 +0000 (Fri, 02 Jun 2017) | 3 lines +Changed paths: + M /trunk/src/get_str.c + +src/get_str.c: allow -36 <= b <= -2 too (work in progress) with the same + meaning as in mpf_get_str + +------------------------------------------------------------------------ +r11569 | zimmerma | 2017-06-02 14:12:17 +0000 (Fri, 02 Jun 2017) | 3 lines +Changed paths: + M /trunk/src/mul.c + M /trunk/tests/tmul.c + +fixed a bug in mpfr_mul for RNDF when Mulders' algorithm is used +(and resolved a FIXME) + +------------------------------------------------------------------------ +r11568 | vlefevre | 2017-06-02 14:03:58 +0000 (Fri, 02 Jun 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Corrected mpfr_get_q documentation. +------------------------------------------------------------------------ +r11567 | vlefevre | 2017-06-02 13:58:47 +0000 (Fri, 02 Jun 2017) | 2 lines +Changed paths: + M /trunk/src/get_q.c + +[src/get_q.c] Added assertions to detect integer overflows, in case +mpfr_exp_t is larger than mp_bitcnt_t. +------------------------------------------------------------------------ +r11566 | zimmerma | 2017-06-02 12:15:59 +0000 (Fri, 02 Jun 2017) | 2 lines +Changed paths: + M /trunk/src/mpf2mpfr.h + +src/mpf2mpfr.h: replaced __MPFR_GMP (requires internal mpfr-gmp.h) + +------------------------------------------------------------------------ +r11565 | zimmerma | 2017-06-02 11:43:32 +0000 (Fri, 02 Jun 2017) | 2 lines +Changed paths: + M /trunk/src/mpf2mpfr.h + +src/mpf2mpfr.h: fixed fits_s* functions and get_si + +------------------------------------------------------------------------ +r11564 | zimmerma | 2017-06-02 11:22:07 +0000 (Fri, 02 Jun 2017) | 2 lines +Changed paths: + M /trunk/src/mpf2mpfr.h + +use macro __MPFR_GMP + +------------------------------------------------------------------------ +r11563 | zimmerma | 2017-06-02 10:44:12 +0000 (Fri, 02 Jun 2017) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + M /trunk/src/Makefile.am + A /trunk/src/get_q.c + M /trunk/src/mpf2mpfr.h + M /trunk/src/mpfr.h + M /trunk/tests/Makefile.am + A /trunk/tests/tget_q.c + +added new function mpfr_get_q + +------------------------------------------------------------------------ +r11562 | zimmerma | 2017-06-02 07:03:25 +0000 (Fri, 02 Jun 2017) | 2 lines +Changed paths: + M /trunk/src/mpf2mpfr.h + +src/mpf2mpfr.h: added mpf_cmp_z (appeared in GMP 6.1.0) + +------------------------------------------------------------------------ +r11561 | vlefevre | 2017-06-01 15:03:24 +0000 (Thu, 01 Jun 2017) | 5 lines +Changed paths: + M /trunk/Makefile.am + M /trunk/README + +[Makefile.am] Put doc/README.dev in EXTRA_DIST to provide this file in + tarballs too (it is not installed by "make install", though), since + it contains information that may be useful for users of tarballs and + various distributed files mention it. +[README] Update about the "doc" directory and "doc/README.dev". +------------------------------------------------------------------------ +r11560 | vlefevre | 2017-06-01 09:15:31 +0000 (Thu, 01 Jun 2017) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] More information about the DEBUG macro. +------------------------------------------------------------------------ +r11559 | vlefevre | 2017-06-01 00:26:46 +0000 (Thu, 01 Jun 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r11558 | vlefevre | 2017-06-01 00:25:16 +0000 (Thu, 01 Jun 2017) | 6 lines +Changed paths: + M /trunk/NEWS + M /trunk/TODO + M /trunk/doc/mpfr.texi + +Update about MPFR_RNDF (faithful rounding): + * NEWS: mention that it is partially supported (should be updated + once MPFR_RNDF is completely supported). + * TODO: moved an item to the right place (MPFR_RNDF is not removed + from the TODO because it is not completely supported yet). + * doc/mpfr.texi: added a FIXME about the partial support. +------------------------------------------------------------------------ +r11557 | vlefevre | 2017-05-31 23:59:06 +0000 (Wed, 31 May 2017) | 4 lines +Changed paths: + M /trunk/src/atanh.c + M /trunk/src/log1p.c + +[src/{atanh.c,log1p.c}] + * Replaced mpfr_get_exp by MPFR_GET_EXP (so that the exponent is + checked with --enable-assert). + * For a test, doing the division first should be better. +------------------------------------------------------------------------ +r11556 | zimmerma | 2017-05-31 20:37:02 +0000 (Wed, 31 May 2017) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/src/atanh.c + M /trunk/src/log1p.c + +improved log1p and atanh for small inputs + +------------------------------------------------------------------------ +r11555 | zimmerma | 2017-05-31 12:39:19 +0000 (Wed, 31 May 2017) | 2 lines +Changed paths: + M /trunk/tools/mbench/mfv5-mpfr.cc + +added expm1 to mbench + +------------------------------------------------------------------------ +r11554 | zimmerma | 2017-05-31 12:33:48 +0000 (Wed, 31 May 2017) | 2 lines +Changed paths: + M /trunk/tools/mbench/mfv5-mpfr.cc + +added log1p to mbench + +------------------------------------------------------------------------ +r11553 | vlefevre | 2017-05-29 22:55:34 +0000 (Mon, 29 May 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r11552 | vlefevre | 2017-05-29 22:54:46 +0000 (Mon, 29 May 2017) | 1 line +Changed paths: + M /trunk/tests/tfmma.c + +Removed trailing spaces. +------------------------------------------------------------------------ +r11551 | vlefevre | 2017-05-29 22:48:06 +0000 (Mon, 29 May 2017) | 1 line +Changed paths: + M /trunk/tests/tdiv.c + M /trunk/tests/tests.c + M /trunk/tests/tpow_all.c + M /trunk/tests/tsum.c + +[tests] Code simplification and improvement by using SAME_VAL(). +------------------------------------------------------------------------ +r11550 | vlefevre | 2017-05-29 22:39:49 +0000 (Mon, 29 May 2017) | 1 line +Changed paths: + M /trunk/tests/tbeta.c + +[tests/tbeta.c] Replaced not_same() by the simpler ! SAME_VAL(). +------------------------------------------------------------------------ +r11549 | vlefevre | 2017-05-29 21:48:21 +0000 (Mon, 29 May 2017) | 2 lines +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Code reindentation due to a new test for MPFR_RNDF support, +and other minor changes in formatting and comments. +------------------------------------------------------------------------ +r11548 | vlefevre | 2017-05-29 21:37:27 +0000 (Mon, 29 May 2017) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Typo in the MPFR_RNDF text. +------------------------------------------------------------------------ +r11546 | vlefevre | 2017-05-29 17:26:28 +0000 (Mon, 29 May 2017) | 2 lines +Changed paths: + M /trunk + M /trunk/TODO + M /trunk/doc/mpfr.texi + M /trunk/doc/sum.txt + M /trunk/src/add1.c + M /trunk/src/add1sp.c + M /trunk/src/div.c + M /trunk/src/div_ui.c + M /trunk/src/fits_intmax.c + M /trunk/src/fits_s.h + M /trunk/src/fits_u.h + M /trunk/src/get_str.c + M /trunk/src/hypot.c + M /trunk/src/jyn_asympt.c + M /trunk/src/li2.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + M /trunk/src/mul.c + M /trunk/src/print_rnd_mode.c + M /trunk/src/round_near_x.c + M /trunk/src/round_prec.c + M /trunk/src/round_raw_generic.c + M /trunk/src/sqr.c + M /trunk/src/sqrt.c + M /trunk/src/sub1.c + M /trunk/src/sub1sp.c + M /trunk/src/sum.c + M /trunk/src/vasprintf.c + M /trunk/src/zeta_ui.c + M /trunk/tests/mpfr-test.h + M /trunk/tests/reuse.c + M /trunk/tests/tabs.c + M /trunk/tests/tadd.c + M /trunk/tests/tadd1sp.c + M /trunk/tests/tcan_round.c + M /trunk/tests/tconst_euler.c + M /trunk/tests/tconst_log2.c + M /trunk/tests/tconst_pi.c + M /trunk/tests/tcos.c + M /trunk/tests/tcot.c + M /trunk/tests/tcoth.c + M /trunk/tests/tdiv.c + M /trunk/tests/texceptions.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/tfactorial.c + M /trunk/tests/tfits.c + M /trunk/tests/tfma.c + M /trunk/tests/tfmma.c + M /trunk/tests/tfms.c + M /trunk/tests/tgamma.c + M /trunk/tests/tgeneric.c + M /trunk/tests/tgeneric_ui.c + M /trunk/tests/tget_f.c + M /trunk/tests/tget_sj.c + M /trunk/tests/tgmpop.c + M /trunk/tests/tinternals.c + M /trunk/tests/tmul.c + M /trunk/tests/tmul_2exp.c + M /trunk/tests/tmul_ui.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow3.c + M /trunk/tests/tpow_all.c + M /trunk/tests/trint.c + M /trunk/tests/troot.c + M /trunk/tests/tsec.c + M /trunk/tests/tsech.c + M /trunk/tests/tset.c + M /trunk/tests/tset_si.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tsqr.c + M /trunk/tests/tsqrt.c + M /trunk/tests/tstrtofr.c + M /trunk/tests/tsub.c + M /trunk/tests/tsub1sp.c + M /trunk/tests/tsum.c + M /trunk/tests/tui_div.c + M /trunk/tests/tui_pow.c + M /trunk/tests/tui_sub.c + M /trunk/tests/tzeta_ui.c + +Merged the "faithful" branch into the trunk: +faithful rounding (MPFR_RNDF). +------------------------------------------------------------------------ +r11542 | zimmerma | 2017-05-29 09:04:44 +0000 (Mon, 29 May 2017) | 2 lines +Changed paths: + M /trunk/TODO + +added new reference + +------------------------------------------------------------------------ +r11533 | vlefevre | 2017-05-24 11:33:50 +0000 (Wed, 24 May 2017) | 4 lines +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Fixed setlocale usage (problem detected with MinGW) +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". +------------------------------------------------------------------------ +r11532 | vlefevre | 2017-05-24 09:15:54 +0000 (Wed, 24 May 2017) | 4 lines +Changed paths: + M /trunk/src/printf.c + M /trunk/src/vasprintf.c + +[src] Moved "#include " from printf.c to vasprintf.c +(this should have been done in r5230, where EOVERFLOW was moved). +This fixes the "Got r = -1, errno = 0" errors in tprintf with +MPFR_CHECK_LARGEMEM=1. +------------------------------------------------------------------------ +r11531 | vlefevre | 2017-05-24 09:09:53 +0000 (Wed, 24 May 2017) | 6 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Added overflow detection at the end (due to the switch +to mpfr_intmax_t for the string length in the string_buffer structure, +it was no longer detected; however, this bug was not normally visible in +the tests because here, a negative value was returned thanks to wrapping +in a type conversion and the negative value was changed to the expected +-1 value in printf.c). +------------------------------------------------------------------------ +r11530 | vlefevre | 2017-05-24 08:47:36 +0000 (Wed, 24 May 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Added log messages. +------------------------------------------------------------------------ +r11529 | vlefevre | 2017-05-24 08:30:55 +0000 (Wed, 24 May 2017) | 2 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] In case of overflow, do not stop before everything has +been processed, allowing the %...n arguments to be filled, as decided. +------------------------------------------------------------------------ +r11528 | vlefevre | 2017-05-24 08:12:56 +0000 (Wed, 24 May 2017) | 2 lines +Changed paths: + M /trunk/tests/tprintf.c + +[tests/tprintf.c] check_long_string() error handling: initialize n2 to +an invalid value and do all tests before exiting. +------------------------------------------------------------------------ +r11527 | vlefevre | 2017-05-24 08:01:28 +0000 (Wed, 24 May 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Fixed some parts of overflow tracking. +------------------------------------------------------------------------ +r11526 | vlefevre | 2017-05-24 07:49:39 +0000 (Wed, 24 May 2017) | 1 line +Changed paths: + M /trunk/tests/tprintf.c + +[tests/tprintf.c] More detailed error message. +------------------------------------------------------------------------ +r11525 | vlefevre | 2017-05-24 07:46:26 +0000 (Wed, 24 May 2017) | 1 line +Changed paths: + M /trunk/tests/tprintf.c + +[tests/tprintf.c] Added tests with %ln. +------------------------------------------------------------------------ +r11524 | vlefevre | 2017-05-24 07:15:40 +0000 (Wed, 24 May 2017) | 1 line +Changed paths: + M /trunk/tests/tprintf.c + +[tests/tprintf.c] Improved check_vprintf_failure(). +------------------------------------------------------------------------ +r11523 | vlefevre | 2017-05-24 07:10:21 +0000 (Wed, 24 May 2017) | 7 lines +Changed paths: + M /trunk/src/vasprintf.c + M /trunk/tests/tprintf.c + +[src/vasprintf.c] Fixed the handling of the 'n' format specifier + for size = 0, still allowing its support in case of overflow on + the return value (i.e. when the number of characters that would + have been output is > INT_MAX). + Note: full support in case of overflow is still limited by GMP + and the C library. +[tests/tprintf.c] Increased the memory needed in check_long_string(). +------------------------------------------------------------------------ +r11522 | vlefevre | 2017-05-23 13:17:12 +0000 (Tue, 23 May 2017) | 5 lines +Changed paths: + M /trunk/src/mpfr-intmax.h + +[src/mpfr-intmax.h] Define mpfr_uintmax_t and MPFR_INTMAX_MAX too. +However, this will not necessarily be used by src/vasprintf.c, as +this can be regarded as an EOVERFLOW error for which the behavior +on the %...n values is not specified, i.e. we may not need to +support size values larger than INT_MAX. +------------------------------------------------------------------------ +r11521 | vlefevre | 2017-05-22 15:07:36 +0000 (Mon, 22 May 2017) | 2 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] In a macro definition, changed a parameter to +lowercase so that it doesn't look like a constant to mpfrlint. +------------------------------------------------------------------------ +r11520 | vlefevre | 2017-05-22 14:08:07 +0000 (Mon, 22 May 2017) | 4 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Added a FIXME for the percent_n() / mixed() bug due +to the 'n' format specifier with size = 0. The way to fix this issue +depends on the specifications in case of overflow on the return value, +and for POSIX, they are unclear. Waiting for comments... +------------------------------------------------------------------------ +r11519 | vlefevre | 2017-05-22 12:33:48 +0000 (Mon, 22 May 2017) | 7 lines +Changed paths: + M /trunk/src/mpfr-intmax.h + +[src/mpfr-intmax.h] Define mpfr_intmax_t as being the largest +signed integer type available for the MPFR build. It will be +useful for the formatted output functions (src/vasprintf.c) to +handle the 'n' format specifier, assuming that the value may +be larger than INT_MAX, which is possible assuming that the +C standard has a defect in the corresponding specification: +https://sourceware.org/bugzilla/show_bug.cgi?id=21360 +------------------------------------------------------------------------ +r11518 | vlefevre | 2017-05-22 11:38:10 +0000 (Mon, 22 May 2017) | 2 lines +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Added explanation for the bugs triggered by +percent_n() and mixed(). +------------------------------------------------------------------------ +r11517 | vlefevre | 2017-05-22 11:31:16 +0000 (Mon, 22 May 2017) | 2 lines +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Added percent_n() test to reproduce the bug found +in mixed(), test without random data. +------------------------------------------------------------------------ +r11516 | vlefevre | 2017-05-22 10:53:50 +0000 (Mon, 22 May 2017) | 2 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] In partition_number(), complete check for overflow +on total. +------------------------------------------------------------------------ +r11515 | vlefevre | 2017-05-22 09:29:51 +0000 (Mon, 22 May 2017) | 2 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Partially fixed check for integer overflow when +the long and int types have the same size. +------------------------------------------------------------------------ +r11514 | vlefevre | 2017-05-22 09:23:57 +0000 (Mon, 22 May 2017) | 3 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] With assertions enabled, check that the number of +characters to be written computed in partition_number() corresponds +to what is really written. +------------------------------------------------------------------------ +r11513 | vlefevre | 2017-05-22 09:17:51 +0000 (Mon, 22 May 2017) | 7 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Fixed the bug triggered by the da_DK locale test: the +computation of the number of characters to be written was incorrect in +partition_number() when the thousands separator was not empty. This bug +was visible with size = 0 and could be visible near overflow on the +number of characters. +Note: the buggy code was introduced in r5288 (2008-02-15), which fixed +other issues with the thousands separator. +------------------------------------------------------------------------ +r11512 | vlefevre | 2017-05-22 09:13:33 +0000 (Mon, 22 May 2017) | 2 lines +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Do more tests in the da_DK locale (these are the +only tests for which the thousands separator is not empty). +------------------------------------------------------------------------ +r11511 | vlefevre | 2017-05-22 08:56:55 +0000 (Mon, 22 May 2017) | 3 lines +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Do more tests involving check_sprintf() in a loop +(to test mpfr_snprintf with size = 0 more often), and call mixed() +later in order to get failures without the use of %n first. +------------------------------------------------------------------------ +r11510 | zimmerma | 2017-05-19 15:04:24 +0000 (Fri, 19 May 2017) | 2 lines +Changed paths: + M /trunk/src/zeta.c + +get rid of computations with 'double' in mpfr_zeta + +------------------------------------------------------------------------ +r11509 | vlefevre | 2017-05-19 14:47:51 +0000 (Fri, 19 May 2017) | 1 line +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Added a TODO about %n test. +------------------------------------------------------------------------ +r11508 | vlefevre | 2017-05-19 14:04:46 +0000 (Fri, 19 May 2017) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added MPFR_TESTS_FPE_TRAP documentation. +------------------------------------------------------------------------ +r11507 | vlefevre | 2017-05-19 13:59:19 +0000 (Fri, 19 May 2017) | 1 line +Changed paths: + M /trunk/tests/tests.c + +[tests/tests.c] Corrected comment about MPFR_TESTS_FPE_TRAP. +------------------------------------------------------------------------ +r11506 | vlefevre | 2017-05-19 13:57:15 +0000 (Fri, 19 May 2017) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/doc/README.dev + M /trunk/tests/tests.c + +Renamed MPFR_TESTS_DIVBYZERO to MPFR_TESTS_FPE_DIV (less confusing). +In doc/README.dev, updated the corresponding description. +------------------------------------------------------------------------ +r11505 | vlefevre | 2017-05-19 13:49:50 +0000 (Fri, 19 May 2017) | 1 line +Changed paths: + M /trunk/tests/tests.c + +[tests] Renamed MPFR_RAISE_EXCEPTIONS to MPFR_TESTS_FPE_TRAP. +------------------------------------------------------------------------ +r11504 | vlefevre | 2017-05-19 13:45:10 +0000 (Fri, 19 May 2017) | 13 lines +Changed paths: + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + M /trunk/tests/td_div.c + M /trunk/tests/tests.c + M /trunk/tests/tget_d.c + M /trunk/tests/tget_d_2exp.c + M /trunk/tests/tget_flt.c + M /trunk/tests/tget_ld_2exp.c + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tset_d.c + M /trunk/tests/tset_float128.c + M /trunk/tests/tset_ld.c + +[tests] Got rid of MPFR_TESTS_EXCEPTIONS (added in r11489 and above), +which is redundant with MPFR_TESTS_DIVBYZERO and MPFR_ERRDIVZERO. The +code related to these exceptions is now like r11488 (see the output of +"svn diff -r11488"), but keeping the following changes: + * Missing !defined(MPFR_ERRDIVZERO) tests added in r11498,11499. + * In tests.c: + - code related to traps (macro MPFR_RAISE_EXCEPTIONS, which will + be renamed); + - more detailed output about which FP exceptions occurred; + - removal of "#ifdef MPFR_ERRDIVZERO" (as in r11493), as this is + better with Automake 1.13+ (required by MPFR since r9375). +Note: EXCEPTIONS_FLAG renamed to FPE_FLAGS, since EXCEPTIONS_FLAG is +reserved by ISO C when is included. +------------------------------------------------------------------------ +r11503 | vlefevre | 2017-05-19 11:54:29 +0000 (Fri, 19 May 2017) | 2 lines +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Do the locale_da_DK() test several times to yield +a failure by default once the bug triggered by mixed() is fixed. +------------------------------------------------------------------------ +r11502 | vlefevre | 2017-05-19 11:24:03 +0000 (Fri, 19 May 2017) | 2 lines +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Updated comment about r11501: the failure occurs +with %n when the size argument of mpfr_vsnprintf is 0. +------------------------------------------------------------------------ +r11501 | vlefevre | 2017-05-19 11:08:14 +0000 (Fri, 19 May 2017) | 2 lines +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Do more tests with %n. One now gets a failure +by default (which occurs when one gets randsize <= 0). +------------------------------------------------------------------------ +r11500 | vlefevre | 2017-05-19 10:45:25 +0000 (Fri, 19 May 2017) | 4 lines +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Fixed portability issues: The va_end(3) man page +of Linux Programmer's Manual says: "On some systems, va_end contains +a closing '}' matching a '{' in va_start, so that both macros must +occur in the same function, and in a way that allows this." +------------------------------------------------------------------------ +r11499 | vlefevre | 2017-05-19 09:26:18 +0000 (Fri, 19 May 2017) | 2 lines +Changed paths: + M /trunk/tests/tget_set_d64.c + +[tests/tget_set_d64.c] Disable tests with a division by 0 (which now +occurs only with -DXDEBUG) if MPFR_ERRDIVZERO is defined. +------------------------------------------------------------------------ +r11498 | vlefevre | 2017-05-19 09:20:19 +0000 (Fri, 19 May 2017) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Disable an overflow test with a division by 0 +(now occurs only with -DXDEBUG) if MPFR_ERRDIVZERO is defined. +------------------------------------------------------------------------ +r11497 | vlefevre | 2017-05-19 08:54:32 +0000 (Fri, 19 May 2017) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Details for "-DMPFR_TESTS_DIVBYZERO -DMPFR_ERRDIVZERO". +------------------------------------------------------------------------ +r11496 | vlefevre | 2017-05-19 08:34:00 +0000 (Fri, 19 May 2017) | 2 lines +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] In mixed(), initialize n2 to an invalid value +in order to ease failure analysis. +------------------------------------------------------------------------ +r11495 | zimmerma | 2017-05-19 08:15:46 +0000 (Fri, 19 May 2017) | 2 lines +Changed paths: + M /trunk/src/set_d.c + +removed leftover debug statement in last commit + +------------------------------------------------------------------------ +r11494 | zimmerma | 2017-05-19 08:14:58 +0000 (Fri, 19 May 2017) | 2 lines +Changed paths: + M /trunk/src/set_d.c + +fix for clang bug (https://bugs.llvm.org//show_bug.cgi?id=17686) + +------------------------------------------------------------------------ +r11493 | vlefevre | 2017-05-19 08:04:05 +0000 (Fri, 19 May 2017) | 8 lines +Changed paths: + M /trunk/tests/tests.c + +[tests/tests.c] Change for MPFR_TESTS_DIVBYZERO: in case of FE_DIVBYZERO +or FE_INVALID, fail unconditionally, not just when MPFR_ERRDIVZERO is +defined, otherwise one cannot see the output about the floating-point +exceptions with "make check" (the test of MPFR_ERRDIVZERO here should +have been removed after switching to Automake 1.13, which discards the +output when the test program succeeds). +Note: defining MPFR_TESTS_DIVBYZERO without MPFR_ERRDIVZERO is just for +debugging. +------------------------------------------------------------------------ +r11492 | zimmerma | 2017-05-19 08:03:19 +0000 (Fri, 19 May 2017) | 2 lines +Changed paths: + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + M /trunk/tests/td_div.c + M /trunk/tests/tests.c + M /trunk/tests/tget_d.c + M /trunk/tests/tget_d_2exp.c + M /trunk/tests/tget_flt.c + M /trunk/tests/tget_ld_2exp.c + M /trunk/tests/tset_d.c + M /trunk/tests/tset_float128.c + M /trunk/tests/tset_ld.c + +more work on MPFR_TESTS_EXCEPTIONS + +------------------------------------------------------------------------ +r11491 | vlefevre | 2017-05-19 07:29:24 +0000 (Fri, 19 May 2017) | 3 lines +Changed paths: + M /trunk/tests/tests.c + +[tests/tests.c] Re-added code testing FE_DIVBYZERO and FE_INVALID with +-DMPFR_TESTS_DIVBYZERO -DMPFR_ERRDIVZERO, because MPFR_TESTS_EXCEPTIONS +is not ready yet. +------------------------------------------------------------------------ +r11490 | vlefevre | 2017-05-19 07:04:23 +0000 (Fri, 19 May 2017) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Output IEEE floats status. +------------------------------------------------------------------------ +r11489 | zimmerma | 2017-05-19 06:09:23 +0000 (Fri, 19 May 2017) | 2 lines +Changed paths: + M /trunk/tests/tests.c + +check for fp exceptions (experimental) + +------------------------------------------------------------------------ +r11488 | vlefevre | 2017-05-17 14:08:40 +0000 (Wed, 17 May 2017) | 1 line +Changed paths: + M /trunk/src/cmp2.c + +[src/cmp2.c] Added/updated comments. +------------------------------------------------------------------------ +r11487 | vlefevre | 2017-05-17 13:34:28 +0000 (Wed, 17 May 2017) | 2 lines +Changed paths: + M /trunk/tests/tcmp2.c + +[tests/tcmp2.c] Added tests with equal numbers, possibly of different +sizes. +------------------------------------------------------------------------ +r11486 | vlefevre | 2017-05-17 10:15:30 +0000 (Wed, 17 May 2017) | 1 line +Changed paths: + M /trunk/src/cmp2.c + +[src/cmp2.c] Corrected comments. +------------------------------------------------------------------------ +r11485 | vlefevre | 2017-05-17 06:46:27 +0000 (Wed, 17 May 2017) | 2 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] In the detection of reserved macro names, skip ERR +from src/mpfr-gmp.h (this is a special case). +------------------------------------------------------------------------ +r11484 | vlefevre | 2017-05-17 06:31:23 +0000 (Wed, 17 May 2017) | 1 line +Changed paths: + M /trunk/tests/tget_set_d64.c + +[tests/tget_set_d64.c] Made PRINT_ERR_MISC more robust. +------------------------------------------------------------------------ +r11483 | vlefevre | 2017-05-17 06:27:14 +0000 (Wed, 17 May 2017) | 2 lines +Changed paths: + M /trunk/tests/tfma.c + M /trunk/tests/tfms.c + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tsi_op.c + +[tests/*.c] Renamed the remaining macros whose names are reserved +by ISO C when is included. +------------------------------------------------------------------------ +r11482 | vlefevre | 2017-05-16 13:44:56 +0000 (Tue, 16 May 2017) | 1 line +Changed paths: + M /trunk/tests/texceptions.c + +[tests/texceptions.c] Made code formatting consistent. +------------------------------------------------------------------------ +r11481 | vlefevre | 2017-05-16 13:41:49 +0000 (Tue, 16 May 2017) | 3 lines +Changed paths: + M /trunk/tests/tcmpabs.c + M /trunk/tests/texceptions.c + M /trunk/tests/tpow_z.c + M /trunk/tests/tset_si.c + M /trunk/tests/tset_sj.c + +[tests/*.c] Renamed "ERROR" macro (macro name reserved by ISO C +when is included) to "PRINT_ERROR", and made the macro +more robust. +------------------------------------------------------------------------ +r11480 | vlefevre | 2017-05-16 13:21:15 +0000 (Tue, 16 May 2017) | 2 lines +Changed paths: + M /trunk/src/get_f.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/set_f.c + M /trunk/tests/tget_f.c + +Define the EXP() macro in src/mpfr-gmp.h only when needed (macro name +reserved by ISO C when is included). +------------------------------------------------------------------------ +r11479 | vlefevre | 2017-05-16 10:35:35 +0000 (Tue, 16 May 2017) | 5 lines +Changed paths: + M /trunk/src/gamma.c + +[src/gamma.c] Got rid of the EXPM1_STR macro (macro name reserved +by ISO C when is included), made no longer interesting by +using mpfr_set_str_binary only once and another temporary variable. +At the same time, replaced the usual allocation by a GROUP allocation +(more efficient). +------------------------------------------------------------------------ +r11478 | vlefevre | 2017-05-15 15:39:18 +0000 (Mon, 15 May 2017) | 1 line +Changed paths: + M /trunk/tests/tcheck.c + +[tests/tcheck.c] Code reformatting (GNU coding style). +------------------------------------------------------------------------ +r11477 | vlefevre | 2017-05-15 15:27:29 +0000 (Mon, 15 May 2017) | 2 lines +Changed paths: + M /trunk/tests/tcheck.c + +[tests/tcheck.c] Renamed "ERROR" macro (macro name reserved by ISO C +when is included) to "PRINT_ERROR". +------------------------------------------------------------------------ +r11476 | vlefevre | 2017-05-15 15:19:11 +0000 (Mon, 15 May 2017) | 8 lines +Changed paths: + M /trunk/src/jn.c + M /trunk/src/mpfr-impl.h + M /trunk/tests/mpfr-test.h + M /trunk/tests/tabs.c + M /trunk/tests/tagm.c + M /trunk/tests/tasin.c + M /trunk/tests/tatan.c + M /trunk/tests/terf.c + M /trunk/tests/tgamma.c + M /trunk/tests/tmul_2exp.c + M /trunk/tests/tpow_all.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tstckintc.c + M /trunk/tests/tstrtofr.c + +Do not define macro names starting with "SIG" (+ uppercase letter) +as they are reserved when is included (ISO C, 7.31.7), +which happens to be the case in tests/tests.c, which also includes +tests/mpfr-test.h and src/mpfr-impl.h indirectly. + * src/mpfr-impl.h, tests/mpfr-test.h: renamed macros: + SIGN → VSIGN + SIGN_RAND → RAND_SIGN + * {src,tests}/*.{c,h}: updated the names in the use of these macros. +------------------------------------------------------------------------ +r11475 | vlefevre | 2017-05-15 14:53:04 +0000 (Mon, 15 May 2017) | 2 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Added a comment about the definition of reserved +identifiers (in particular, macro names). +------------------------------------------------------------------------ +r11474 | vlefevre | 2017-05-15 14:47:06 +0000 (Mon, 15 May 2017) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Detect the definition of reserved macro names. +------------------------------------------------------------------------ +r11473 | vlefevre | 2017-05-15 14:20:37 +0000 (Mon, 15 May 2017) | 4 lines +Changed paths: + M /trunk/src/bernoulli.c + +[src/bernoulli.c] Changed isprime to is_prime in order to avoid obscure +problems if is added to mpfr-impl.h in the future (or if this +function is made external). See ISO C "Future library directions", +Clause 7.31.2 "Character handling ". +------------------------------------------------------------------------ +r11472 | vlefevre | 2017-05-12 13:01:17 +0000 (Fri, 12 May 2017) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Improved comments about assertions and MPFR_ASSUME(). +------------------------------------------------------------------------ +r11471 | vlefevre | 2017-05-09 15:33:20 +0000 (Tue, 09 May 2017) | 2 lines +Changed paths: + M /trunk/INSTALL + +[INSTALL] Mention the problem when almost all the tests fails with a +message "Incorrect MPFR version! ...". +------------------------------------------------------------------------ +r11470 | vlefevre | 2017-05-09 13:02:22 +0000 (Tue, 09 May 2017) | 3 lines +Changed paths: + M /trunk/tests/tl2b.c + M /trunk/tests/tpow_all.c + +Increase the buffer sizes even more, and added a comment. This may +be better in case of quick future changes (possibly for debugging), +without checking carefully. For the tests, optimal code is useless. +------------------------------------------------------------------------ +r11469 | zimmerma | 2017-05-09 10:47:36 +0000 (Tue, 09 May 2017) | 3 lines +Changed paths: + M /trunk/tests/tl2b.c + M /trunk/tests/tpow_all.c + +fixed bugs found by gcc 7.1.0 (-Werror=format-overflow=) +[VL] The MPFR code was correct. This is actually a bug in GCC: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79257 +------------------------------------------------------------------------ +r11468 | vlefevre | 2017-05-09 09:11:57 +0000 (Tue, 09 May 2017) | 1 line +Changed paths: + M /trunk/doc/FAQ.html + +[doc] Updated FAQ.html with update-faq. +------------------------------------------------------------------------ +r11461 | vlefevre | 2017-05-05 08:17:09 +0000 (Fri, 05 May 2017) | 6 lines +Changed paths: + M /trunk/tools/mbench/timp.h + +[tools/mbench/timp.h] Updated TIMP_MEASURE() to handle the case where +the return value is 0: this probably means that timp_overhead was too +large and incorrect. In this case, TIMP_OVERHEAD() is called again to +recompute timp_overhead and the timing is redone. +Note: if we do not call TIMP_OVERHEAD() again, then TIMP_MEASURE() +loops indefinitely, meaning that timp_overhead was really too large. +------------------------------------------------------------------------ +r11460 | vlefevre | 2017-05-05 07:42:06 +0000 (Fri, 05 May 2017) | 1 line +Changed paths: + M /trunk/tools/mbench/timp.h + +[tools/mbench/timp.h] Comment at the wrong place. Fixed. +------------------------------------------------------------------------ +r11459 | vlefevre | 2017-05-05 07:40:54 +0000 (Fri, 05 May 2017) | 1 line +Changed paths: + M /trunk/tools/mbench/timp.h + +[tools/mbench/timp.h] Added a comment about r11458. +------------------------------------------------------------------------ +r11458 | vlefevre | 2017-05-04 17:07:27 +0000 (Thu, 04 May 2017) | 1 line +Changed paths: + M /trunk/tools/mbench/timp.h + +[tools/mbench/timp.h] Fixed overflows on unsigned arithmetic. +------------------------------------------------------------------------ +r11457 | vlefevre | 2017-05-04 16:56:59 +0000 (Thu, 04 May 2017) | 2 lines +Changed paths: + M /trunk/tools/mbench/mfv5.h + +[tools/mbench/mfv5.h] Increased values from 2^60-1 to 2^64-1 +(it is possible to get more than 2^60-1 cycles in practice!). +------------------------------------------------------------------------ +r11452 | vlefevre | 2017-05-02 14:28:40 +0000 (Tue, 02 May 2017) | 1 line +Changed paths: + M /trunk/src/gamma.c + +[src/gamma.c] Clarified proof for tiny arguments again. +------------------------------------------------------------------------ +r11451 | vlefevre | 2017-05-02 14:07:25 +0000 (Tue, 02 May 2017) | 1 line +Changed paths: + M /trunk/src/gamma.c + +[src/gamma.c] Clarified proof for tiny arguments. +------------------------------------------------------------------------ +r11450 | vlefevre | 2017-05-02 12:38:02 +0000 (Tue, 02 May 2017) | 3 lines +Changed paths: + M /trunk/src/gamma.c + +[src/gamma.c] In the proof for tiny arguments: + * Simplification suggested by Paul. + * Attempt to clarify the end. +------------------------------------------------------------------------ +r11449 | zimmerma | 2017-05-02 09:23:25 +0000 (Tue, 02 May 2017) | 2 lines +Changed paths: + M /trunk/tools/mbench/timp.h + +added comment + +------------------------------------------------------------------------ +r11448 | zimmerma | 2017-05-02 08:10:53 +0000 (Tue, 02 May 2017) | 2 lines +Changed paths: + M /trunk/tools/mbench/timp.h + +added reference for mbench (rdtsc vs rdtscp) + +------------------------------------------------------------------------ +r11447 | vlefevre | 2017-04-28 15:41:36 +0000 (Fri, 28 Apr 2017) | 2 lines +Changed paths: + M /trunk/src/gamma.c + +[src/gamma.c] Tiny arguments: corrected a typo and added a TODO +(one might get a better condition). +------------------------------------------------------------------------ +r11446 | vlefevre | 2017-04-28 15:19:16 +0000 (Fri, 28 Apr 2017) | 1 line +Changed paths: + M /trunk/src/gamma.c + +[src/gamma.c] Corrections in a proof for tiny arguments. Added a TODO. +------------------------------------------------------------------------ +r11445 | vlefevre | 2017-04-27 12:00:50 +0000 (Thu, 27 Apr 2017) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Update about the MPFR_GENERIC_ABI macro. +------------------------------------------------------------------------ +r11444 | vlefevre | 2017-04-27 11:45:24 +0000 (Thu, 27 Apr 2017) | 1 line +Changed paths: + M /trunk/src/sqr.c + +[src/sqr.c] Corrected a comment. +------------------------------------------------------------------------ +r11443 | vlefevre | 2017-04-27 11:44:22 +0000 (Thu, 27 Apr 2017) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Blank line like in add1sp.c, sub1sp.c, etc. +------------------------------------------------------------------------ +r11442 | vlefevre | 2017-04-27 11:42:50 +0000 (Thu, 27 Apr 2017) | 1 line +Changed paths: + M /trunk/src/sqr.c + +[src/sqr.c] Blank lines and comment like in add1sp.c, sub1sp.c, etc. +------------------------------------------------------------------------ +r11441 | vlefevre | 2017-04-27 11:38:51 +0000 (Thu, 27 Apr 2017) | 3 lines +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] Like in add1sp.c and sub1sp.c, do not define the specific +functions for low precision if MPFR_GENERIC_ABI is defined (they are +not called in such a case). +------------------------------------------------------------------------ +r11440 | vlefevre | 2017-04-27 11:31:50 +0000 (Thu, 27 Apr 2017) | 1 line +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Added blank lines for readability (like in add1sp.c). +------------------------------------------------------------------------ +r11439 | vlefevre | 2017-04-27 11:12:24 +0000 (Thu, 27 Apr 2017) | 1 line +Changed paths: + M /trunk/tools/mbench/timp.h + +s/interruption/interrupt/ +------------------------------------------------------------------------ +r11438 | vlefevre | 2017-04-27 09:23:51 +0000 (Thu, 27 Apr 2017) | 1 line +Changed paths: + M /trunk/tools/mbench/Makefile + M /trunk/tools/mbench/timp.h + +[mbench] Updated copyright years. Added a comment. +------------------------------------------------------------------------ +r11437 | zimmerma | 2017-04-27 08:22:31 +0000 (Thu, 27 Apr 2017) | 2 lines +Changed paths: + M /trunk/tools/mbench/Makefile + M /trunk/tools/mbench/timp.h + +better detection of rdtscp + +------------------------------------------------------------------------ +r11436 | vlefevre | 2017-04-18 17:18:54 +0000 (Tue, 18 Apr 2017) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Updated a comment, with reference to GCC bug 80454. +------------------------------------------------------------------------ +r11434 | vlefevre | 2017-04-09 13:06:36 +0000 (Sun, 09 Apr 2017) | 1 line +Changed paths: + M /trunk/tests/tprintf.c + +[tests/tprintf.c] Avoid integer overflow from r11411 with 32-bit long. +------------------------------------------------------------------------ +r11433 | vlefevre | 2017-04-07 15:15:34 +0000 (Fri, 07 Apr 2017) | 2 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Updated test to check that the snprintf function (C99) +is not used. +------------------------------------------------------------------------ +r11430 | vlefevre | 2017-04-07 14:52:12 +0000 (Fri, 07 Apr 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Corrected an English error. +------------------------------------------------------------------------ +r11429 | vlefevre | 2017-04-07 13:59:03 +0000 (Fri, 07 Apr 2017) | 3 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Fixed bug triggered by the test added in r11428: +the size field of struct printf_spec must have type size_t, not int, +because the size argument of mpfr_snprintf has type size_t. +------------------------------------------------------------------------ +r11428 | vlefevre | 2017-04-07 13:53:58 +0000 (Fri, 07 Apr 2017) | 3 lines +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Added a test that fails on 64-bit machines +(4-byte int, 8-byte size_t), due to the use of mpfr_snprintf +with required size = (size_t) UINT_MAX + 1. +------------------------------------------------------------------------ +r11427 | vlefevre | 2017-04-07 08:18:47 +0000 (Fri, 07 Apr 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Minor changes. +------------------------------------------------------------------------ +r11426 | vlefevre | 2017-04-07 08:09:46 +0000 (Fri, 07 Apr 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Comment re-indentation. +------------------------------------------------------------------------ +r11425 | vlefevre | 2017-04-07 07:21:47 +0000 (Fri, 07 Apr 2017) | 1 line +Changed paths: + M /trunk/src/ubf.c + +[src/ubf.c] Renamed mpfr_get_zexp to mpfr_init_get_zexp for clarity. +------------------------------------------------------------------------ +r11424 | vlefevre | 2017-04-06 23:37:51 +0000 (Thu, 06 Apr 2017) | 3 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Fixed silly typo in MPFR_UBF_CLEAR_EXP() yielding +either an obscure memory leak or a crash in some mpfr_fmma calls. +We would really need formal proofs on the code... Or avoid macros. +------------------------------------------------------------------------ +r11423 | zimmerma | 2017-04-06 17:51:39 +0000 (Thu, 06 Apr 2017) | 2 lines +Changed paths: + M /trunk/tests/tfmma.c + +[tests/tfmma.c] added one test + +------------------------------------------------------------------------ +r11422 | zimmerma | 2017-04-06 17:15:03 +0000 (Thu, 06 Apr 2017) | 2 lines +Changed paths: + M /trunk/tests/tfmma.c + +[tests/tfmma.c] fixed test + +------------------------------------------------------------------------ +r11421 | vlefevre | 2017-04-06 17:06:12 +0000 (Thu, 06 Apr 2017) | 1 line +Changed paths: + M /trunk/src/add1.c + +[src/add1.c] Updated comment about underflow. +------------------------------------------------------------------------ +r11420 | vlefevre | 2017-04-06 17:01:59 +0000 (Thu, 06 Apr 2017) | 3 lines +Changed paths: + M /trunk/src/add1.c + +[src/add1.c] Handling of UBF and overflow/underflow. + * Added a MPFR_ASSERTD related to the overflow code. + * Bug fix: handle underflow, possible if UBF input(s). +------------------------------------------------------------------------ +r11419 | zimmerma | 2017-04-06 16:02:27 +0000 (Thu, 06 Apr 2017) | 2 lines +Changed paths: + M /trunk/tests/tfmma.c + +[tests/tfmma.c] added another test (currently fails) + +------------------------------------------------------------------------ +r11418 | vlefevre | 2017-04-06 15:24:33 +0000 (Thu, 06 Apr 2017) | 2 lines +Changed paths: + M /trunk/src/sub1.c + +[src/sub1.c] Bug fix: underflow was not detected in the case cancel = 0 +with UBF numbers. At the same time, refactored the related code a bit. +------------------------------------------------------------------------ +r11417 | vlefevre | 2017-04-06 13:45:27 +0000 (Thu, 06 Apr 2017) | 1 line +Changed paths: + M /trunk/tests + +[tests] Added tbeta to svn:ignore property. +------------------------------------------------------------------------ +r11416 | vlefevre | 2017-04-06 13:24:35 +0000 (Thu, 06 Apr 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Formatting of the mpfr_can_round example for 80-column +terminals + GNU coding style. +------------------------------------------------------------------------ +r11415 | vlefevre | 2017-04-06 12:53:23 +0000 (Thu, 06 Apr 2017) | 1 line +Changed paths: + M /trunk/tests/tfmma.c + +[tests/tfmma.c] Updated comment about bug20170405 (fixed in r11414). +------------------------------------------------------------------------ +r11414 | vlefevre | 2017-04-06 12:47:03 +0000 (Thu, 06 Apr 2017) | 1 line +Changed paths: + M /trunk/src/sub1.c + +[src/sub1.c] Also corrected the comment about overflow detection. +------------------------------------------------------------------------ +r11413 | vlefevre | 2017-04-06 12:45:14 +0000 (Thu, 06 Apr 2017) | 1 line +Changed paths: + M /trunk/src/sub1.c + +[src/sub1.c] Really fixed overflow detection (r11412 is broken). +------------------------------------------------------------------------ +r11412 | vlefevre | 2017-04-06 12:43:01 +0000 (Thu, 06 Apr 2017) | 4 lines +Changed paths: + M /trunk/src/sub1.c + +[src/sub1.c] Fixed/improved UBF cases. + * Added an assertion (usual MPFR limitation with huge precisions, + affecting 32-bit ABI only in practice). + * Fixed overflow detection. +------------------------------------------------------------------------ +r11411 | vlefevre | 2017-04-06 11:56:58 +0000 (Thu, 06 Apr 2017) | 3 lines +Changed paths: + M /trunk/tests/tprintf.c + +[tests/tprintf.c] In check_long_string(), which is called when +MPFR_CHECK_LARGEMEM is defined, increase tests_memory_limit if need be +in order to avoid an obvious failure due to insufficient memory. +------------------------------------------------------------------------ +r11410 | vlefevre | 2017-04-06 11:47:59 +0000 (Thu, 06 Apr 2017) | 3 lines +Changed paths: + M /trunk/tests/memory.c + +[tests/memory.c] Write all error messages to stderr in order to make +sure that they remain visible when the standard output is redirected +(e.g. in tprintf). Rewrote the messages in a consistent way. +------------------------------------------------------------------------ +r11409 | vlefevre | 2017-04-06 11:20:31 +0000 (Thu, 06 Apr 2017) | 1 line +Changed paths: + M /trunk/tests/tfmma.c + +[tests/tfmma.c] Fixed return type of test added in r11407. +------------------------------------------------------------------------ +r11408 | vlefevre | 2017-04-06 11:18:53 +0000 (Thu, 06 Apr 2017) | 3 lines +Changed paths: + M /trunk/tests/tinits.c + +[tests/tinits.c] When MPFR_CHECK_LARGEMEM is defined, increase +tests_memory_limit if need be in order to avoid an obvious failure +due to insufficient memory. +------------------------------------------------------------------------ +r11407 | zimmerma | 2017-04-06 11:00:38 +0000 (Thu, 06 Apr 2017) | 3 lines +Changed paths: + M /trunk/tests/tfmma.c + +added test that triggers an error +(see https://sympa.inria.fr/sympa/arc/mpfr/2017-04/msg00016.html) + +------------------------------------------------------------------------ +r11406 | vlefevre | 2017-04-05 12:46:15 +0000 (Wed, 05 Apr 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r11405 | vlefevre | 2017-04-05 08:35:18 +0000 (Wed, 05 Apr 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] More details about errno. +------------------------------------------------------------------------ +r11404 | vlefevre | 2017-04-04 14:43:40 +0000 (Tue, 04 Apr 2017) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added a paragraph about the use of errno. +------------------------------------------------------------------------ +r11403 | vlefevre | 2017-04-04 14:19:31 +0000 (Tue, 04 Apr 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Details about EOVERFLOW. +------------------------------------------------------------------------ +r11402 | zimmerma | 2017-04-04 06:22:46 +0000 (Tue, 04 Apr 2017) | 2 lines +Changed paths: + M /trunk/tests/tstrtofr.c + +[tests/tstrtofr.c] added test in bug20161217() + +------------------------------------------------------------------------ +r11401 | vlefevre | 2017-04-03 13:04:23 +0000 (Mon, 03 Apr 2017) | 2 lines +Changed paths: + M /trunk/TODO + +[TODO] Update about functions returning a native floating-point value +and underflow/overflow. +------------------------------------------------------------------------ +r11400 | vlefevre | 2017-04-03 11:46:48 +0000 (Mon, 03 Apr 2017) | 2 lines +Changed paths: + M /trunk/src/atanh.c + +[src/atanh.c] Removed comment giving the "optimal" working precision +(I do not see any proof in algorithms.tex, and it seems incorrect). +------------------------------------------------------------------------ +r11399 | vlefevre | 2017-04-03 11:28:24 +0000 (Mon, 03 Apr 2017) | 2 lines +Changed paths: + M /trunk/TODO + M /trunk/src/log1p.c + +[TODO,src/log1p.c] log1p(x) on small x should also be improved instead +of computing log(1+x). +------------------------------------------------------------------------ +r11398 | vlefevre | 2017-04-03 09:16:27 +0000 (Mon, 03 Apr 2017) | 1 line +Changed paths: + M /trunk/TODO + M /trunk/src/atanh.c + +[TODO,src/atanh.c] Suggest a faster formula for atanh(x) on small x. +------------------------------------------------------------------------ +r11397 | vlefevre | 2017-04-03 09:04:04 +0000 (Mon, 03 Apr 2017) | 1 line +Changed paths: + M /trunk/src/atanh.c + +[src/atanh.c] Cosmetic changes (comments and whitespace). +------------------------------------------------------------------------ +r11396 | vlefevre | 2017-04-03 08:24:03 +0000 (Mon, 03 Apr 2017) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Update about ERANGE. +------------------------------------------------------------------------ +r11395 | vlefevre | 2017-03-27 14:57:20 +0000 (Mon, 27 Mar 2017) | 1 line +Changed paths: + M /trunk/tests/tbeta.c + +[tests/tbeta.c] Fixed a macro (use of mpfr_printf, missing cast). +------------------------------------------------------------------------ +r11390 | vlefevre | 2017-03-09 10:58:49 +0000 (Thu, 09 Mar 2017) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Mention how to find the full list of bug fixes. +------------------------------------------------------------------------ +r11388 | vlefevre | 2017-03-09 09:45:02 +0000 (Thu, 09 Mar 2017) | 1 line +Changed paths: + M /trunk/tests/tstrtofr.c + +[tests/tstrtofr.c] Updated comments about bug20161217 and bug20170308. +------------------------------------------------------------------------ +r11386 | vlefevre | 2017-03-09 09:28:47 +0000 (Thu, 09 Mar 2017) | 1 line +Changed paths: + M /trunk/tests/tstrtofr.c + +[tests/tstrtofr.c] Added comments about bug20161217 and bug20170308. +------------------------------------------------------------------------ +r11385 | vlefevre | 2017-03-09 01:34:37 +0000 (Thu, 09 Mar 2017) | 2 lines +Changed paths: + M /trunk/tests/tstrtofr.c + +[tests/tstrtofr.c] Updated comment: bug20170308 checks the same bug +as bug20161217. +------------------------------------------------------------------------ +r11384 | vlefevre | 2017-03-09 01:27:39 +0000 (Thu, 09 Mar 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r11383 | zimmerma | 2017-03-08 20:58:00 +0000 (Wed, 08 Mar 2017) | 2 lines +Changed paths: + M /trunk/tests/tstrtofr.c + +added non-regression test + +------------------------------------------------------------------------ +r11382 | zimmerma | 2017-03-07 14:12:39 +0000 (Tue, 07 Mar 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] results should not depend on machine rounding mode/precision + +------------------------------------------------------------------------ +r11381 | vlefevre | 2017-03-06 10:55:45 +0000 (Mon, 06 Mar 2017) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Minor corrections. +------------------------------------------------------------------------ +r11380 | vlefevre | 2017-03-05 02:11:52 +0000 (Sun, 05 Mar 2017) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Added a comment about shiftq. +------------------------------------------------------------------------ +r11379 | vlefevre | 2017-02-28 11:11:29 +0000 (Tue, 28 Feb 2017) | 1 line +Changed paths: + M /trunk/tests/tbeta.c + +[tests/tbeta.c] C89 compatibility and some code reformatting. +------------------------------------------------------------------------ +r11378 | vlefevre | 2017-02-28 10:10:44 +0000 (Tue, 28 Feb 2017) | 1 line +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Slightly improved comments. +------------------------------------------------------------------------ +r11377 | vlefevre | 2017-02-28 10:06:10 +0000 (Tue, 28 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Fixed a bug in reduced exponent range (not detected by +the current tests). +------------------------------------------------------------------------ +r11376 | vlefevre | 2017-02-28 10:02:51 +0000 (Tue, 28 Feb 2017) | 1 line +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Added a comment for Beta(0,negative integer). +------------------------------------------------------------------------ +r11375 | vlefevre | 2017-02-28 09:53:31 +0000 (Tue, 28 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Eventually fixed the case z or w is 0 (note: r11374 +did also other unwanted changes, reverted here). +------------------------------------------------------------------------ +r11374 | vlefevre | 2017-02-28 09:40:01 +0000 (Tue, 28 Feb 2017) | 1 line +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Reverted my changes (this was incorrect). +------------------------------------------------------------------------ +r11373 | vlefevre | 2017-02-28 09:32:01 +0000 (Tue, 28 Feb 2017) | 1 line +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Fixed special cases. +------------------------------------------------------------------------ +r11372 | vlefevre | 2017-02-28 09:10:28 +0000 (Tue, 28 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Added comments and some corrections (incomplete) for the +case "z or w is 0". +------------------------------------------------------------------------ +r11371 | zimmerma | 2017-02-28 08:06:05 +0000 (Tue, 28 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] fixed case z or w is 0 + +------------------------------------------------------------------------ +r11370 | zimmerma | 2017-02-28 07:11:09 +0000 (Tue, 28 Feb 2017) | 4 lines +Changed paths: + M /trunk/tests/tbeta.c + +[tests/tbeta.c] patch from Cade Brown +- signed zeros are checked in is_same +- the case above (summing non-integer negative z, w which sum to a negative integer) + +------------------------------------------------------------------------ +r11369 | zimmerma | 2017-02-27 22:00:55 +0000 (Mon, 27 Feb 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] added mpfr_beta in "Added Functions" + +------------------------------------------------------------------------ +r11368 | vlefevre | 2017-02-27 15:48:12 +0000 (Mon, 27 Feb 2017) | 1 line +Changed paths: + M /trunk/src/jn.c + +[src/jn.c] Use MPFR_ADD_PREC. +------------------------------------------------------------------------ +r11367 | vlefevre | 2017-02-27 15:42:30 +0000 (Mon, 27 Feb 2017) | 1 line +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Updated comments; added a FIXME. +------------------------------------------------------------------------ +r11366 | zimmerma | 2017-02-27 15:10:45 +0000 (Mon, 27 Feb 2017) | 3 lines +Changed paths: + M /trunk/src/jn.c + +[src/jn.c] in case the first Ziv loop failed, take into account the number of + lost bits + +------------------------------------------------------------------------ +r11365 | vlefevre | 2017-02-27 15:06:41 +0000 (Mon, 27 Feb 2017) | 1 line +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Use MPFR_ARE_SINGULAR. +------------------------------------------------------------------------ +r11364 | zimmerma | 2017-02-27 14:22:29 +0000 (Mon, 27 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] fix in case z and w are not integers and z+w is a nonpositive integer + +------------------------------------------------------------------------ +r11363 | zimmerma | 2017-02-27 12:07:35 +0000 (Mon, 27 Feb 2017) | 2 lines +Changed paths: + A /trunk/src/odd_p.c + +[src/odd_p.c] new source file + +------------------------------------------------------------------------ +r11362 | zimmerma | 2017-02-27 12:07:15 +0000 (Mon, 27 Feb 2017) | 5 lines +Changed paths: + M /trunk/src/Makefile.am + M /trunk/src/beta.c + M /trunk/src/mpfr-impl.h + M /trunk/src/pow.c + +[src/Makefile.am] new file odd_p.c +[src/beta.c] fixed bug +[src/mpfr-impl.h] renamed mpfr_is_odd into mpfr_odd_p +[src/pow.c] moved mpfr_is_odd (renamed mpfr_odd_p) into separate file + +------------------------------------------------------------------------ +r11361 | vlefevre | 2017-02-27 11:10:11 +0000 (Mon, 27 Feb 2017) | 1 line +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Added a FIXME (test failure with assertions). +------------------------------------------------------------------------ +r11360 | vlefevre | 2017-02-27 10:48:32 +0000 (Mon, 27 Feb 2017) | 1 line +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Removed an unusual space. +------------------------------------------------------------------------ +r11359 | vlefevre | 2017-02-27 10:42:30 +0000 (Mon, 27 Feb 2017) | 1 line +Changed paths: + M /trunk/tests/tbuildopt.c + +[tests/tbuildopt.c] Added calls to tests_start_mpfr and tests_end_mpfr. +------------------------------------------------------------------------ +r11358 | vlefevre | 2017-02-27 10:35:25 +0000 (Mon, 27 Feb 2017) | 2 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Added a test to check that the usual test programs +call tests_start_mpfr and tests_end_mpfr. +------------------------------------------------------------------------ +r11357 | zimmerma | 2017-02-27 10:27:40 +0000 (Mon, 27 Feb 2017) | 5 lines +Changed paths: + M /trunk/src/beta.c + M /trunk/src/mpfr-impl.h + M /trunk/src/pow.c + M /trunk/tests/tbeta.c + +[src/beta.c] several fixes +[src/pow.c] renamed is_odd to mpfr_is_odd, and export it +[src/mpfr-impl.h] export mpfr_is_odd as internal function +[tests/tbeta.c] added generic tests + +------------------------------------------------------------------------ +r11356 | vlefevre | 2017-02-27 09:43:46 +0000 (Mon, 27 Feb 2017) | 1 line +Changed paths: + M /trunk/tests/tbeta.c + +[tests/tbeta.c] Added missing void in prototype. +------------------------------------------------------------------------ +r11355 | vlefevre | 2017-02-27 09:32:39 +0000 (Mon, 27 Feb 2017) | 1 line +Changed paths: + M /trunk/NEWS + M /trunk/src/set.c + +Removed trailing spaces. +------------------------------------------------------------------------ +r11354 | vlefevre | 2017-02-27 08:30:31 +0000 (Mon, 27 Feb 2017) | 1 line +Changed paths: + M /trunk/tests/tbeta.c + +[tests/tbeta.c] Fixed the usage of MPFR types. +------------------------------------------------------------------------ +r11353 | vlefevre | 2017-02-27 08:28:03 +0000 (Mon, 27 Feb 2017) | 1 line +Changed paths: + M /trunk/tests/tbeta.c + +[tests/tbeta.c] Minor correction. Added a FIXME and a TODO. +------------------------------------------------------------------------ +r11352 | zimmerma | 2017-02-27 07:11:05 +0000 (Mon, 27 Feb 2017) | 2 lines +Changed paths: + M /trunk/tests/tbeta.c + +[tests/tbeta.c] GNU style and C89 portability + +------------------------------------------------------------------------ +r11351 | zimmerma | 2017-02-27 06:56:40 +0000 (Mon, 27 Feb 2017) | 2 lines +Changed paths: + M /trunk/TODO + +[TODO] removed beta entry + +------------------------------------------------------------------------ +r11350 | zimmerma | 2017-02-27 06:56:03 +0000 (Mon, 27 Feb 2017) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + M /trunk/src/Makefile.am + M /trunk/src/mpfr.h + M /trunk/tests/Makefile.am + +new function mpfr_beta + +------------------------------------------------------------------------ +r11349 | zimmerma | 2017-02-27 06:55:23 +0000 (Mon, 27 Feb 2017) | 4 lines +Changed paths: + A /trunk/tests/tbeta.c + +[tests/tbeta.c] test file for mpfr_beta, contributed by Cade Brown from + ChemicalDevelopment (this commit is the file as it was + contributed, except the mpfr-test.h include) + +------------------------------------------------------------------------ +r11348 | vlefevre | 2017-02-27 02:25:55 +0000 (Mon, 27 Feb 2017) | 1 line +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Portability corrections. +------------------------------------------------------------------------ +r11347 | zimmerma | 2017-02-26 22:13:00 +0000 (Sun, 26 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] fix for exact case beta(1,2^k) for k negative integer + +------------------------------------------------------------------------ +r11346 | zimmerma | 2017-02-26 15:47:17 +0000 (Sun, 26 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] special values are now implemented (should be reviewed) + +------------------------------------------------------------------------ +r11343 | vlefevre | 2017-02-25 22:52:23 +0000 (Sat, 25 Feb 2017) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] mpfr_root: replace "obsolete" by "deprecated" (the right word). +------------------------------------------------------------------------ +r11342 | vlefevre | 2017-02-25 22:46:23 +0000 (Sat, 25 Feb 2017) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Update about rootn. +------------------------------------------------------------------------ +r11341 | vlefevre | 2017-02-25 22:31:48 +0000 (Sat, 25 Feb 2017) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Added some propositions about rootn. +------------------------------------------------------------------------ +r11340 | zimmerma | 2017-02-25 13:58:10 +0000 (Sat, 25 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/root.c + +[src/root.c] added comment + +------------------------------------------------------------------------ +r11339 | zimmerma | 2017-02-25 07:21:08 +0000 (Sat, 25 Feb 2017) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + +added reference + +------------------------------------------------------------------------ +r11338 | vlefevre | 2017-02-23 13:00:06 +0000 (Thu, 23 Feb 2017) | 1 line +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Call mpfr_check_range as usual. +------------------------------------------------------------------------ +r11337 | vlefevre | 2017-02-23 12:18:10 +0000 (Thu, 23 Feb 2017) | 1 line +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Extended the exponent range for the generic case. +------------------------------------------------------------------------ +r11336 | vlefevre | 2017-02-23 12:15:45 +0000 (Thu, 23 Feb 2017) | 1 line +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Added a comment. +------------------------------------------------------------------------ +r11335 | vlefevre | 2017-02-23 12:14:19 +0000 (Thu, 23 Feb 2017) | 1 line +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Various code improvement / fixes. +------------------------------------------------------------------------ +r11334 | vlefevre | 2017-02-23 11:49:35 +0000 (Thu, 23 Feb 2017) | 1 line +Changed paths: + M /trunk/src/beta.c + +[src/beta.c] Added a FIXME. +------------------------------------------------------------------------ +r11333 | zimmerma | 2017-02-23 11:10:39 +0000 (Thu, 23 Feb 2017) | 3 lines +Changed paths: + M /trunk/src/Makefile.am + A /trunk/src/beta.c + M /trunk/src/mpfr.h + +[src/beta.c] added beta function (work in progress, not yet fully implemented, + and not tested) + +------------------------------------------------------------------------ +r11332 | zimmerma | 2017-02-21 14:06:56 +0000 (Tue, 21 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/fmma.c + M /trunk/src/set.c + M /trunk/src/ubf.c + +[src/fmma.c] speedup of mpfr_fmma and mpfr_fmms + +------------------------------------------------------------------------ +r11331 | zimmerma | 2017-02-21 12:40:52 +0000 (Tue, 21 Feb 2017) | 3 lines +Changed paths: + M /trunk/src/fma.c + M /trunk/src/mpfr-impl.h + M /trunk/src/set.c + +[src/fma.c] speedup of mpfr_fma when all operands have the same precision + (less than one full limb) + +------------------------------------------------------------------------ +r11330 | vlefevre | 2017-02-21 10:28:04 +0000 (Tue, 21 Feb 2017) | 2 lines +Changed paths: + M /trunk/NEWS + +[NEWS] Note that the position of "const" in the mpfr_sum prototype +has been fixed (in case writers of interfaces for MPFR use that). +------------------------------------------------------------------------ +r11328 | vlefevre | 2017-02-21 09:44:35 +0000 (Tue, 21 Feb 2017) | 1 line +Changed paths: + M /trunk/src/get_d64.c + M /trunk/src/set_d64.c + +"a IEEE 754r decimal64 float" → "an IEEE 754-2008 decimal64 float". +------------------------------------------------------------------------ +r11327 | zimmerma | 2017-02-20 18:03:00 +0000 (Mon, 20 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/fma.c + +[src/fma.c] speedup mpfr_fma for 1 limb + +------------------------------------------------------------------------ +r11326 | zimmerma | 2017-02-20 18:01:15 +0000 (Mon, 20 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/fms.c + +754R -> 754-2008 + +------------------------------------------------------------------------ +r11325 | vlefevre | 2017-02-20 02:36:50 +0000 (Mon, 20 Feb 2017) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +Removed trailing spaces. +------------------------------------------------------------------------ +r11324 | vlefevre | 2017-02-20 02:32:10 +0000 (Mon, 20 Feb 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Solved the FIXME for %g on easy cases. +------------------------------------------------------------------------ +r11323 | vlefevre | 2017-02-17 12:54:47 +0000 (Fri, 17 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] mpfr_reflection_overflow: reverted r11322 as the rounding +direction was correct; it was a comment that was incorrect, now fixed. +------------------------------------------------------------------------ +r11322 | vlefevre | 2017-02-17 12:47:41 +0000 (Fri, 17 Feb 2017) | 1 line +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] mpfr_reflection_overflow: fixed a rounding direction. +------------------------------------------------------------------------ +r11321 | vlefevre | 2017-02-17 12:39:56 +0000 (Fri, 17 Feb 2017) | 5 lines +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] Improvements of mpfr_reflection_overflow: + * Moved identical parts of the code at the beginning of if/else blocks + as a single part before the "if". + * When the rounding mode doesn't matter (exact result), use MPFR_RNDN. + * Updated comments (making them more consistent at the same time). +------------------------------------------------------------------------ +r11320 | zimmerma | 2017-02-16 19:16:58 +0000 (Thu, 16 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] added more comments for the overflow case + +------------------------------------------------------------------------ +r11319 | vlefevre | 2017-02-14 15:37:03 +0000 (Tue, 14 Feb 2017) | 3 lines +Changed paths: + M /trunk/doc/sum.txt + M /trunk/src/sum.c + +[src/sum.c] Added a note about why one uses "const mpfr_ptr *x" in the + prototypes instead of "const mpfr_srcptr *x" (old info from r5381). +[doc/sum.txt] Fixed the const position (see r11316) and added this note. +------------------------------------------------------------------------ +r11318 | vlefevre | 2017-02-14 11:57:11 +0000 (Tue, 14 Feb 2017) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + +[src/{mpfr-impl.h,mpfr.h}] Code reformatting and other cosmetic changes. +------------------------------------------------------------------------ +r11317 | vlefevre | 2017-02-14 11:30:50 +0000 (Tue, 14 Feb 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] For mpfr_sum, changed "mpfr_ptr const" to the equivalent +"const mpfr_ptr" (usual style, less confusing). +------------------------------------------------------------------------ +r11316 | vlefevre | 2017-02-14 11:28:28 +0000 (Tue, 14 Feb 2017) | 3 lines +Changed paths: + M /trunk/src/mpfr.h + M /trunk/src/sum.c + +For mpfr_sum and its auxiliary functions, moved the const type qualifier +to the right place (mpfr_ptr *const → const mpfr_ptr *). This bug had +been introduced in r3642 (2005-06-10). +------------------------------------------------------------------------ +r11315 | vlefevre | 2017-02-13 17:03:16 +0000 (Mon, 13 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] mpfr_reflection_overflow: added comments and FIXME's; +fixed obvious typos in a comment and the code. +------------------------------------------------------------------------ +r11314 | vlefevre | 2017-02-13 15:44:56 +0000 (Mon, 13 Feb 2017) | 1 line +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] mpfr_reflection_overflow: typo in a comment. +------------------------------------------------------------------------ +r11313 | vlefevre | 2017-02-13 12:13:11 +0000 (Mon, 13 Feb 2017) | 1 line +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] Untabified. +------------------------------------------------------------------------ +r11312 | vlefevre | 2017-02-13 12:11:18 +0000 (Mon, 13 Feb 2017) | 1 line +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] mpfr_reflection_overflow: added an assertion and a comment. +------------------------------------------------------------------------ +r11311 | vlefevre | 2017-02-13 09:37:17 +0000 (Mon, 13 Feb 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Added a comment in a FIXME. +------------------------------------------------------------------------ +r11310 | vlefevre | 2017-02-13 09:28:06 +0000 (Mon, 13 Feb 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Added MPFR_ASSERTD's. +------------------------------------------------------------------------ +r11309 | vlefevre | 2017-02-13 09:17:03 +0000 (Mon, 13 Feb 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Avoid some potential integer overflows. +------------------------------------------------------------------------ +r11308 | zimmerma | 2017-02-13 09:11:19 +0000 (Mon, 13 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] improved overflow detection + +------------------------------------------------------------------------ +r11307 | vlefevre | 2017-02-13 08:57:06 +0000 (Mon, 13 Feb 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Added FIXME's: possible integer overflows. +------------------------------------------------------------------------ +r11306 | zimmerma | 2017-02-12 08:06:55 +0000 (Sun, 12 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/zeta.c + +fix for mpfr_zeta overflow on 32-bit computers + +------------------------------------------------------------------------ +r11305 | zimmerma | 2017-02-11 15:26:07 +0000 (Sat, 11 Feb 2017) | 3 lines +Changed paths: + M /trunk/src/sqr.c + +[src/sqr.c] revert detection of leading bit in sqr_1 and sqr_2 + (not clear it is faster) + +------------------------------------------------------------------------ +r11304 | vlefevre | 2017-02-10 18:25:21 +0000 (Fri, 10 Feb 2017) | 3 lines +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Added a mpfr_snprintf test with a null pointer, +"%#.*RDg" and a large precision (it currently takes too much memory, +like the similar ones). +------------------------------------------------------------------------ +r11303 | vlefevre | 2017-02-10 16:03:47 +0000 (Fri, 10 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/vasprintf.c + M /trunk/tests/tsprintf.c + +[src/vasprintf.c] Added a FIXME for %g on easy cases (too much memory). +[tests/tsprintf.c] Added corresponding tests. +------------------------------------------------------------------------ +r11302 | vlefevre | 2017-02-09 17:47:38 +0000 (Thu, 09 Feb 2017) | 4 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Fix for mpfr_snprintf with size=0: do not allocate +a buffer for the output if not needed. This really fixes bug #21056. +The case size_t < unsigned int could not be solved completely due to +limitations from the C standard and GMP. +------------------------------------------------------------------------ +r11301 | vlefevre | 2017-02-09 17:04:03 +0000 (Thu, 09 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Avoid a warning due to an unused variable with +MPFR_GENERIC_ABI defined or GMP_NUMB_BITS != 64. +------------------------------------------------------------------------ +r11300 | vlefevre | 2017-02-09 13:45:53 +0000 (Thu, 09 Feb 2017) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Added MPFR_ASSERTD's from comments. +------------------------------------------------------------------------ +r11299 | zimmerma | 2017-02-09 12:03:41 +0000 (Thu, 09 Feb 2017) | 2 lines +Changed paths: + M /trunk/tests/tzeta.c + +[tests/tzeta.c] interm_overflow -> intermediate_overflow + +------------------------------------------------------------------------ +r11298 | vlefevre | 2017-02-09 11:34:52 +0000 (Thu, 09 Feb 2017) | 1 line +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] Updated a FIXME. +------------------------------------------------------------------------ +r11297 | zimmerma | 2017-02-09 10:48:50 +0000 (Thu, 09 Feb 2017) | 2 lines +Changed paths: + M /trunk/tools/mbench/Makefile + M /trunk/tools/mbench/mfv5-mpfr.cc + +improved detection of fmma and fmms + +------------------------------------------------------------------------ +r11296 | zimmerma | 2017-02-09 10:21:54 +0000 (Thu, 09 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] fixed long-standing failure in tzeta + +------------------------------------------------------------------------ +r11295 | zimmerma | 2017-02-08 20:55:18 +0000 (Wed, 08 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + M /trunk/tests/tsqrt.c + +[src/sqrt.c] fixed a bug, and simplified code (sb=0 implies rb=0) + +------------------------------------------------------------------------ +r11294 | vlefevre | 2017-02-08 17:36:48 +0000 (Wed, 08 Feb 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Updated FIXME. +------------------------------------------------------------------------ +r11293 | zimmerma | 2017-02-08 17:22:22 +0000 (Wed, 08 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] new code for prec=GMP_NUMB_BITS + +------------------------------------------------------------------------ +r11292 | vlefevre | 2017-02-08 17:00:18 +0000 (Wed, 08 Feb 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Moved the size_t vs int FIXME, with details added. +------------------------------------------------------------------------ +r11291 | vlefevre | 2017-02-08 16:51:51 +0000 (Wed, 08 Feb 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Added a MPFR_ASSERTN for security. +------------------------------------------------------------------------ +r11290 | vlefevre | 2017-02-08 16:44:16 +0000 (Wed, 08 Feb 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Added a FIXME for the case size_t < unsigned int. +------------------------------------------------------------------------ +r11289 | vlefevre | 2017-02-08 16:34:31 +0000 (Wed, 08 Feb 2017) | 4 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Solved the r11288 FIXME, introducing new ones +with a more visible failure. Not fixed yet because there seems +to be another issue (already present at the beginning in r4993), +which should be considered first. +------------------------------------------------------------------------ +r11288 | vlefevre | 2017-02-08 16:00:28 +0000 (Wed, 08 Feb 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Added a FIXME (related to the cause of the failure). +------------------------------------------------------------------------ +r11287 | vlefevre | 2017-02-08 15:44:53 +0000 (Wed, 08 Feb 2017) | 7 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Added some precondition assertions, as the buffer_cat +implementation requires that the current buffer position contains \0. +Note[VL]: tsprintf is still failing with assertions on my machine in +the 32-bit Linux/x86 ABI, but now on the new precondition instead of +postcondition. The behavior with size = 0 actually depends on the state +of uninitialized memory (even in the 64-bit ABI), so that the failures +may be random; the problem is detected by valgrind. +------------------------------------------------------------------------ +r11286 | vlefevre | 2017-02-08 15:33:32 +0000 (Wed, 08 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] Declare variables used by GMP_NUMB_BITS == 64 only in the +related code. +------------------------------------------------------------------------ +r11285 | zimmerma | 2017-02-08 15:07:28 +0000 (Wed, 08 Feb 2017) | 3 lines +Changed paths: + M /trunk/src/div.c + M /trunk/src/mul.c + +[src/mul.c] simplified logic for special code +[src/div.c] fixed bug in mpfr_div_1n when extra=0 + +------------------------------------------------------------------------ +r11284 | zimmerma | 2017-02-08 14:28:56 +0000 (Wed, 08 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] special code for prec=GMP_NUMB_BITS + +------------------------------------------------------------------------ +r11283 | zimmerma | 2017-02-08 14:04:11 +0000 (Wed, 08 Feb 2017) | 3 lines +Changed paths: + M /trunk/src/mul.c + M /trunk/src/sqr.c + +[src/sqr.c] new code for p = GMP_NUMB_BITS, and small improvement in mpfr_sqr_1 +[src/mul.c] cosmetic changes + +------------------------------------------------------------------------ +r11282 | vlefevre | 2017-02-08 13:28:21 +0000 (Wed, 08 Feb 2017) | 1 line +Changed paths: + M /trunk/tests/tsub1sp.c + +[tests/tsub1sp.c] Fix: C++ compatibility. +------------------------------------------------------------------------ +r11281 | zimmerma | 2017-02-08 13:17:45 +0000 (Wed, 08 Feb 2017) | 4 lines +Changed paths: + M /trunk/src/add1sp.c + M /trunk/src/mul.c + M /trunk/src/sub1sp.c + +[src/mul.c] added special code for prec=GMP_NUMB_BITS +[src/add1sp.c] use special code only when MPFR_GENERIC_ABI is not defined +[src/sub1sp.c] idem as above + +------------------------------------------------------------------------ +r11280 | vlefevre | 2017-02-08 13:09:44 +0000 (Wed, 08 Feb 2017) | 5 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Declare the mpfr_vasnprintf_aux prototype (which +uses va_list) only if has been included, otherwise the +build was failing with GCC in C90 mode under Linux (and could fail +with other C implementations where this header isn't automatically +included as a consequence of the inclusion of some other header). +------------------------------------------------------------------------ +r11279 | zimmerma | 2017-02-08 12:58:43 +0000 (Wed, 08 Feb 2017) | 3 lines +Changed paths: + M /trunk/src/sub1sp.c + M /trunk/tests/tsub1sp.c + +[src/sub1sp.c] new function for p=GMP_NUMB_BITS, fixed bug in mpfr_sub1sp3 +[tests/tsub1sp.c] added new tests + +------------------------------------------------------------------------ +r11278 | vlefevre | 2017-02-08 12:02:40 +0000 (Wed, 08 Feb 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Fixed bug introduced in r11273. +------------------------------------------------------------------------ +r11277 | vlefevre | 2017-02-08 11:54:14 +0000 (Wed, 08 Feb 2017) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Updated the "simple mp_limb_t constants" test. +------------------------------------------------------------------------ +r11276 | vlefevre | 2017-02-08 11:51:37 +0000 (Wed, 08 Feb 2017) | 1 line +Changed paths: + M /trunk/src/add_ui.c + M /trunk/src/div_ui.c + M /trunk/src/exp_2.c + M /trunk/src/sub_ui.c + M /trunk/src/ui_sub.c + +Made some assertions a bit more readable. +------------------------------------------------------------------------ +r11275 | vlefevre | 2017-02-08 11:18:51 +0000 (Wed, 08 Feb 2017) | 1 line +Changed paths: + M /trunk/tests/tsub1sp.c + +[tests/tsub1sp.c] Fixed mpfr_inits2/mpfr_clears sentinel → (mpfr_ptr) 0 +------------------------------------------------------------------------ +r11274 | vlefevre | 2017-02-08 11:13:57 +0000 (Wed, 08 Feb 2017) | 1 line +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] C90 compatibility. +------------------------------------------------------------------------ +r11273 | zimmerma | 2017-02-08 10:28:58 +0000 (Wed, 08 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/vasprintf.c + M /trunk/tests/tsprintf.c + +[src/vasprintf.c] avoid memory allocation for snprintf with size=0 + +------------------------------------------------------------------------ +r11272 | zimmerma | 2017-02-08 08:42:49 +0000 (Wed, 08 Feb 2017) | 3 lines +Changed paths: + M /trunk/src/sub1sp.c + M /trunk/tests/tsub1sp.c + +[src/sub1sp.c] fixed a bug in mpfr_sub1sp1 and mpfr_sub1sp2 (corner case) +[tests/tsub1sp.c] added non-regression test + +------------------------------------------------------------------------ +r11271 | zimmerma | 2017-02-07 18:42:53 +0000 (Tue, 07 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] added special code for p=GMP_NUMB_BITS + +------------------------------------------------------------------------ +r11270 | zimmerma | 2017-02-07 16:35:29 +0000 (Tue, 07 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/vasprintf.c + M /trunk/tests/tsprintf.c + +[src/vasprintf.c] improved also %a and %e + +------------------------------------------------------------------------ +r11269 | zimmerma | 2017-02-07 15:07:28 +0000 (Tue, 07 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + M /trunk/src/printf.c + M /trunk/src/vasprintf.c + M /trunk/tests/tsprintf.c + +[src/vasprintf.c] fixed bug #21056 + +------------------------------------------------------------------------ +r11268 | vlefevre | 2017-02-07 10:44:03 +0000 (Tue, 07 Feb 2017) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] More about the mpz_t pool. +------------------------------------------------------------------------ +r11267 | vlefevre | 2017-02-07 10:13:35 +0000 (Tue, 07 Feb 2017) | 1 line +Changed paths: + M /trunk/src/free_cache.c + +[src/free_cache.c] Better file description (keeping it short). +------------------------------------------------------------------------ +r11266 | vlefevre | 2017-02-07 10:10:10 +0000 (Tue, 07 Feb 2017) | 1 line +Changed paths: + M /trunk/src/free_cache.c + +[src/free_cache.c] Updated comments (mpz_t cache → mpz_t pool). +------------------------------------------------------------------------ +r11265 | vlefevre | 2017-02-07 01:47:16 +0000 (Tue, 07 Feb 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r11264 | vlefevre | 2017-02-07 01:46:14 +0000 (Tue, 07 Feb 2017) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Clarified mpfr_asprintf & mpfr_vasprintf specification +in case of error. +------------------------------------------------------------------------ +r11263 | vlefevre | 2017-02-07 00:59:37 +0000 (Tue, 07 Feb 2017) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Code cleanup. +------------------------------------------------------------------------ +r11262 | zimmerma | 2017-02-06 17:24:23 +0000 (Mon, 06 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/vasprintf.c + M /trunk/tests/tsprintf.c + +partial solution of bug #21056: a test of mpfr_sprintf still fails + +------------------------------------------------------------------------ +r11261 | zimmerma | 2017-02-06 15:09:39 +0000 (Mon, 06 Feb 2017) | 2 lines +Changed paths: + M /trunk/tests/tmul.c + +[tests/tmul.c] added test for underflow corner case + +------------------------------------------------------------------------ +r11260 | zimmerma | 2017-02-06 13:48:40 +0000 (Mon, 06 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] simplified underflow in div_1 and div_2 (one case is not possible) + +------------------------------------------------------------------------ +r11259 | zimmerma | 2017-02-06 13:10:24 +0000 (Mon, 06 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/sqr.c + M /trunk/tests/tsqr.c + +[tests/tsqr.c] added another corner case for underflow and mpfr_sqr_2 + +------------------------------------------------------------------------ +r11258 | zimmerma | 2017-02-06 12:58:48 +0000 (Mon, 06 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/sqr.c + M /trunk/tests/tsqr.c + +[tests/tsqr.c] added a corner underflow case + +------------------------------------------------------------------------ +r11257 | vlefevre | 2017-02-06 12:45:49 +0000 (Mon, 06 Feb 2017) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Added missing function prototype after r11256. +------------------------------------------------------------------------ +r11256 | zimmerma | 2017-02-06 12:04:33 +0000 (Mon, 06 Feb 2017) | 2 lines +Changed paths: + M /trunk/src/free_cache.c + M /trunk/src/mpfr-impl.h + +[mpfr-impl.h] now mpz_init2 uses the mpz spool too + +------------------------------------------------------------------------ +r11255 | vlefevre | 2017-02-03 14:10:51 +0000 (Fri, 03 Feb 2017) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Added: check the small-precision tables in the tests? +------------------------------------------------------------------------ +r11254 | vlefevre | 2017-02-03 01:28:43 +0000 (Fri, 03 Feb 2017) | 1 line +Changed paths: + M /trunk/src/sqrt.c + M /trunk/tests/tdiv.c + +Removed trailing whitespace. +------------------------------------------------------------------------ +r11253 | vlefevre | 2017-02-03 01:09:38 +0000 (Fri, 03 Feb 2017) | 1 line +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Fixed code for the _mulx_u64 test. +------------------------------------------------------------------------ +r11252 | vlefevre | 2017-02-02 17:59:51 +0000 (Thu, 02 Feb 2017) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Output whether _mulx_u64 is available. +------------------------------------------------------------------------ +r11251 | vlefevre | 2017-02-02 17:23:20 +0000 (Thu, 02 Feb 2017) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Fixed _mulx_u64 detection to avoid failures in tests +with ICC 15: we need an AC_RUN_IFELSE, not just an AC_LINK_IFELSE. +------------------------------------------------------------------------ +r11250 | vlefevre | 2017-01-31 13:43:30 +0000 (Tue, 31 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/invsqrt_limb.h + +[src/invsqrt_limb.h] Improved constants: make their meaning explicit; +portability with 32-bit long (and 64-bit limb). +------------------------------------------------------------------------ +r11249 | zimmerma | 2017-01-31 13:08:48 +0000 (Tue, 31 Jan 2017) | 3 lines +Changed paths: + M /trunk/src/invsqrt_limb.h + M /trunk/src/sqrt.c + +[src/invsqrt_limb.h] new macro __gmpfr_sqrt_limb_approx +[src/sqrt.c] new sqrt1 code using __gmpfr_sqrt_limb_approx + +------------------------------------------------------------------------ +r11248 | zimmerma | 2017-01-30 17:52:19 +0000 (Mon, 30 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] improved slow branch of mpfr_sqrt2 + +------------------------------------------------------------------------ +r11247 | zimmerma | 2017-01-30 16:43:19 +0000 (Mon, 30 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] improved slow branch of mpfr_div_2 + +------------------------------------------------------------------------ +r11246 | zimmerma | 2017-01-30 16:06:27 +0000 (Mon, 30 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] fixed TODO: replaced two if-statements by while-loop + +------------------------------------------------------------------------ +r11245 | vlefevre | 2017-01-30 15:15:44 +0000 (Mon, 30 Jan 2017) | 1 line +Changed paths: + M /trunk/src/div.c + +[src/div.c] Added TODO's. +------------------------------------------------------------------------ +r11244 | vlefevre | 2017-01-30 14:04:33 +0000 (Mon, 30 Jan 2017) | 1 line +Changed paths: + M /trunk/src/div.c + +[src/div.c] Added a MPFR_ASSERTD. +------------------------------------------------------------------------ +r11243 | zimmerma | 2017-01-28 20:16:52 +0000 (Sat, 28 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/atan.c + +[src/atan.c] added comment + +------------------------------------------------------------------------ +r11242 | zimmerma | 2017-01-28 17:38:56 +0000 (Sat, 28 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/invsqrt_limb.h + +[src/invsqrt_limb.h] fixed __gmpfr_sqrt_limb macro + +------------------------------------------------------------------------ +r11241 | zimmerma | 2017-01-28 09:20:50 +0000 (Sat, 28 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/atan.c + +[src/atan.c] small optimization + +------------------------------------------------------------------------ +r11240 | zimmerma | 2017-01-27 20:45:45 +0000 (Fri, 27 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/atan.c + +[src/atan.c] speedup for small precision + +------------------------------------------------------------------------ +r11239 | vlefevre | 2017-01-27 10:44:37 +0000 (Fri, 27 Jan 2017) | 1 line +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] Disable mpfr_mul_{1,2,3} if MPFR_GENERIC_ABI is defined. +------------------------------------------------------------------------ +r11238 | vlefevre | 2017-01-27 10:39:47 +0000 (Fri, 27 Jan 2017) | 1 line +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] Removed useless parentheses that can inhibit warnings. +------------------------------------------------------------------------ +r11237 | vlefevre | 2017-01-26 16:19:34 +0000 (Thu, 26 Jan 2017) | 1 line +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] Updated TODO. +------------------------------------------------------------------------ +r11236 | vlefevre | 2017-01-26 16:17:55 +0000 (Thu, 26 Jan 2017) | 1 line +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] Added a TODO about an optimization. +------------------------------------------------------------------------ +r11235 | zimmerma | 2017-01-26 10:03:11 +0000 (Thu, 26 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] fixed error bound for mpfr_sqrt2_approx + +------------------------------------------------------------------------ +r11234 | vlefevre | 2017-01-25 17:55:47 +0000 (Wed, 25 Jan 2017) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Added optimization of test + shift for some processors. +------------------------------------------------------------------------ +r11233 | vlefevre | 2017-01-25 16:04:38 +0000 (Wed, 25 Jan 2017) | 1 line +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Added MPFR_FULLSUB code for mpfr_sub1sp2. +------------------------------------------------------------------------ +r11232 | zimmerma | 2017-01-25 13:49:11 +0000 (Wed, 25 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/invsqrt_limb.h + M /trunk/src/sqrt.c + +[src/sqrt.c] changed error bound back from 16 to 15 + +------------------------------------------------------------------------ +r11231 | vlefevre | 2017-01-25 13:44:42 +0000 (Wed, 25 Jan 2017) | 2 lines +Changed paths: + M /trunk/doc/add-with-carry.c + +[doc/add-with-carry.c] Added reference to my bug report about Clang's +carry detection missed optimization in chained add-with-carry. +------------------------------------------------------------------------ +r11230 | zimmerma | 2017-01-25 13:16:19 +0000 (Wed, 25 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/invsqrt_limb.h + M /trunk/src/sqrt.c + +[src/sqrt.c] updated error bound for __gmpfr_invsqrt_limb_approx + +------------------------------------------------------------------------ +r11229 | vlefevre | 2017-01-25 12:40:00 +0000 (Wed, 25 Jan 2017) | 1 line +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Added refs to missed/broken optimization with Clang/LLVM. +------------------------------------------------------------------------ +r11228 | vlefevre | 2017-01-25 09:23:08 +0000 (Wed, 25 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Use the FULLSUB only. Added a comment about the change +in r11227. +------------------------------------------------------------------------ +r11227 | zimmerma | 2017-01-25 07:20:57 +0000 (Wed, 25 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] changed MPFR_FULLSUB variant into faster code + +------------------------------------------------------------------------ +r11226 | vlefevre | 2017-01-24 15:46:52 +0000 (Tue, 24 Jan 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Texinfo typography correction. +------------------------------------------------------------------------ +r11225 | vlefevre | 2017-01-24 14:37:58 +0000 (Tue, 24 Jan 2017) | 7 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Improvements concerning the exponent range. + * mpfr_get_exp: added a FIXME in a comment (documented behavior?). + * mpfr_set_emin / mpfr_set_emax: more specification and details. + * mpfr_subnormalize: clarification; added a warning about emin. + * Example of mpfr_subnormalize: added a note. +In particular, this follows a confusion: + https://sympa.inria.fr/sympa/arc/mpfr/2017-01/msg00024.html +------------------------------------------------------------------------ +r11224 | zimmerma | 2017-01-24 10:34:36 +0000 (Tue, 24 Jan 2017) | 3 lines +Changed paths: + M /trunk/src/invsqrt_limb.h + +[src/invsqrt_limb.h] changed slightly definition of d10 and d37 (does not + change final error analysis) + +------------------------------------------------------------------------ +r11223 | vlefevre | 2017-01-23 15:41:35 +0000 (Mon, 23 Jan 2017) | 3 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Updated comments about subtraction with borrow; the first +one from r11213 was incorrect (bad interpretation of the generated code +for GCC, potentially on a different alternate source code for Clang). +------------------------------------------------------------------------ +r11222 | zimmerma | 2017-01-23 14:11:17 +0000 (Mon, 23 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] simplified mpfr_sub1sp1() + +------------------------------------------------------------------------ +r11221 | zimmerma | 2017-01-23 11:38:04 +0000 (Mon, 23 Jan 2017) | 2 lines +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] added non-regression test + +------------------------------------------------------------------------ +r11220 | vlefevre | 2017-01-23 10:23:40 +0000 (Mon, 23 Jan 2017) | 1 line +Changed paths: + M /trunk/src/urandom.c + +[src/urandom.c] Added a FIXME as mpfr_urandom does not always set flags. +------------------------------------------------------------------------ +r11219 | vlefevre | 2017-01-23 09:46:50 +0000 (Mon, 23 Jan 2017) | 1 line +Changed paths: + M /trunk/src/urandom.c + +[src/urandom.c] Simplified code (no changes in the behavior). +------------------------------------------------------------------------ +r11218 | zimmerma | 2017-01-23 07:27:10 +0000 (Mon, 23 Jan 2017) | 3 lines +Changed paths: + M /trunk/src/urandom.c + +[src/urandom.c] fixed bug reported by Trevor Spiteri +(https://sympa.inria.fr/sympa/arc/mpfr/2017-01/msg00020.html) + +------------------------------------------------------------------------ +r11217 | zimmerma | 2017-01-21 12:58:34 +0000 (Sat, 21 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpn_exp.c + M /trunk/src/mulders.c + M /trunk/src/sqr.c + +changed mpn_sqr_n into mpn_sqr + +------------------------------------------------------------------------ +r11216 | zimmerma | 2017-01-20 17:21:15 +0000 (Fri, 20 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/Makefile.am + M /trunk/src/invsqrt_limb.h + M /trunk/src/sqrt.c + D /trunk/src/sqrt_tab.h + +new version of mpfr_sqrt2_approx (no longer needs sqrt_tab.h) + +------------------------------------------------------------------------ +r11215 | vlefevre | 2017-01-20 16:24:56 +0000 (Fri, 20 Jan 2017) | 1 line +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Updated TODO, mentioning an optimization bug in LLVM. +------------------------------------------------------------------------ +r11214 | vlefevre | 2017-01-20 16:13:45 +0000 (Fri, 20 Jan 2017) | 1 line +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Updated TODO about full subtraction with borrow. +------------------------------------------------------------------------ +r11213 | vlefevre | 2017-01-20 13:58:11 +0000 (Fri, 20 Jan 2017) | 3 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Added alternate code (enabled with -DMPFR_FULLSUB, until +fully tested) to replace a test + correction by a 2-limb subtraction, +recognized by GCC and Clang. +------------------------------------------------------------------------ +r11212 | zimmerma | 2017-01-20 13:56:05 +0000 (Fri, 20 Jan 2017) | 3 lines +Changed paths: + M /trunk/src/invsqrt_limb.h + M /trunk/src/sqrt.c + +renamed __gmpfr_invsqrt_limb into __gmpfr_invsqrt_limb_approx to better reflect +it only gives an approximation + +------------------------------------------------------------------------ +r11211 | vlefevre | 2017-01-20 11:59:39 +0000 (Fri, 20 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/invert_limb.h + +[src/invert_limb.h] Just like for invsqrt_limb.h (r11210), in 1UL << 60, +replaced 1UL by MPFR_LIMB_ONE to make the code valid with 32-bit long. +------------------------------------------------------------------------ +r11210 | vlefevre | 2017-01-20 11:54:33 +0000 (Fri, 20 Jan 2017) | 4 lines +Changed paths: + M /trunk/src/invsqrt_limb.h + +[src/invsqrt_limb.h] Bug fix: replaced 1UL by MPFR_LIMB_ONE since the +computations are done on limbs, which are expected to have 64 bits in +this context (the old code would fail on MS Windows / MinGW, where limbs +are 64-bit unsigned long long and unsigned long is a 32-bit type). +------------------------------------------------------------------------ +r11209 | vlefevre | 2017-01-20 11:47:59 +0000 (Fri, 20 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/invsqrt_limb.h + +[src/invsqrt_limb.h] Portability correction: avoid lines longer than the +POSIX line-length limit of 2047 characters; actually fit on 80 columns. +------------------------------------------------------------------------ +r11208 | zimmerma | 2017-01-20 11:15:54 +0000 (Fri, 20 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/Makefile.am + M /trunk/src/invert_limb.h + A /trunk/src/invsqrt_limb.h + M /trunk/src/sqrt.c + M /trunk/src/sqrt_tab.h + +faster version of mpfr_sqrt1(), with smaller table + +------------------------------------------------------------------------ +r11207 | zimmerma | 2017-01-20 08:09:20 +0000 (Fri, 20 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/invert_limb.h + +[src/invert_limb.h] improved __gmpfr_invert_limb* for 64-bit limb + +------------------------------------------------------------------------ +r11206 | zimmerma | 2017-01-17 11:04:25 +0000 (Tue, 17 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] use ADD_LIMB macro, and fixed comment + +------------------------------------------------------------------------ +r11205 | vlefevre | 2017-01-17 10:51:28 +0000 (Tue, 17 Jan 2017) | 5 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] MPFR_PARSE_DIRECTORY macro definition: workaround if +the realpath command is not found. Suggestion by Trevor Spiteri: + https://sympa.inria.fr/sympa/arc/mpfr/2017-01/msg00013.html +Note: I had to modify the patch to use quadrigraphs, otherwise the +generated configure file was invalid. +------------------------------------------------------------------------ +r11204 | zimmerma | 2017-01-17 10:35:43 +0000 (Tue, 17 Jan 2017) | 2 lines +Changed paths: + M /trunk/tests/tdiv.c + +[tdiv.c] added code to exercise mpfr_div2_approx + +------------------------------------------------------------------------ +r11203 | zimmerma | 2017-01-16 16:49:01 +0000 (Mon, 16 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] new variant of mpfr_div2_approx() + +------------------------------------------------------------------------ +r11202 | vlefevre | 2017-01-13 23:59:23 +0000 (Fri, 13 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/invert_limb.h + +[src/invert_limb.h] Fit on 80 columns (one line was over the +POSIX line-length limit of 2047 characters). +------------------------------------------------------------------------ +r11201 | vlefevre | 2017-01-13 23:43:26 +0000 (Fri, 13 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/invert_limb.h + +[src/invert_limb.h] Correction in __gmpfr_invert_limb for 32-bit ABI: +_d was used before being defined. +------------------------------------------------------------------------ +r11200 | zimmerma | 2017-01-13 23:24:20 +0000 (Fri, 13 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/invert_limb.h + +[invert_limb.h] added invert_limb code for 32-bit + +------------------------------------------------------------------------ +r11199 | vlefevre | 2017-01-13 15:18:34 +0000 (Fri, 13 Jan 2017) | 4 lines +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] Improved a line based on analysis (+ timings I've done +on x86_64 with GCC and Clang give better results, though they cannot +be conclusive since the gain is too small compared to other possible +causes of variations). +------------------------------------------------------------------------ +r11198 | vlefevre | 2017-01-13 14:40:29 +0000 (Fri, 13 Jan 2017) | 3 lines +Changed paths: + M /trunk/tools/mbench/Makefile + +[tools/mbench/Makefile] Added -static to CFLAGS in order to avoid +a link error when MPFR has been built with Clang (linking is done +with .a libraries, i.e. static libraries). +------------------------------------------------------------------------ +r11197 | vlefevre | 2017-01-13 10:53:51 +0000 (Fri, 13 Jan 2017) | 4 lines +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] Replaced "return 0;" by "MPFR_RET(0);" to emphasize on +the fact that we return a ternary value (code instrumentation may also +be easier later). Note: this is equivalent since the macro expands to +0 != 0 ? ... : 0, which gives 0 via trivial optimization. +------------------------------------------------------------------------ +r11196 | vlefevre | 2017-01-13 10:44:44 +0000 (Fri, 13 Jan 2017) | 3 lines +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] Improvements in mpfr_add1sp1; added a TODO. +Note for rb -> bp[0]: the generated code is the same, but the source +is more readable (-> rb has only one meaning). +------------------------------------------------------------------------ +r11195 | vlefevre | 2017-01-13 00:51:29 +0000 (Fri, 13 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] C90 compatibility (avoid initializer elements not computable +at load time). +------------------------------------------------------------------------ +r11194 | zimmerma | 2017-01-12 23:20:22 +0000 (Thu, 12 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] added some alternate code for mpfr_div2_approx (disabled for now) + +------------------------------------------------------------------------ +r11193 | zimmerma | 2017-01-12 21:40:50 +0000 (Thu, 12 Jan 2017) | 4 lines +Changed paths: + M /trunk/src/frac.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/round_raw_generic.c + M /trunk/src/set_uj.c + M /trunk/src/strtofr.c + M /trunk/src/sub1sp.c + M /trunk/src/sum.c + +fixed bug in urandomb.c reported by Dominic Chen +(https://sympa.inria.fr/sympa/arc/mpfr/2017-01/msg00011.html) +and replaced MPN_COPY_INCR/MPN_COPY_DECR by mpn_copyi/mpn_copyd + +------------------------------------------------------------------------ +r11192 | zimmerma | 2017-01-12 21:19:12 +0000 (Thu, 12 Jan 2017) | 3 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] small improvement in div_1 and div_2: force all precisions to be + equal, then we cannot have rb <> 0 and sb = 0 + +------------------------------------------------------------------------ +r11191 | zimmerma | 2017-01-12 17:24:36 +0000 (Thu, 12 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] improved case p=127 (or two-limb case with hard to round case) + +------------------------------------------------------------------------ +r11190 | vlefevre | 2017-01-12 14:26:36 +0000 (Thu, 12 Jan 2017) | 1 line +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] Added a TODO: slightly better code? +------------------------------------------------------------------------ +r11189 | zimmerma | 2017-01-12 13:30:28 +0000 (Thu, 12 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] improve mpfr_div_1 for precision 63 + +------------------------------------------------------------------------ +r11188 | vlefevre | 2017-01-12 10:17:49 +0000 (Thu, 12 Jan 2017) | 1 line +Changed paths: + M /trunk/src/rndna.c + +[src/rndna.c] Updated comments. +------------------------------------------------------------------------ +r11187 | zimmerma | 2017-01-12 10:16:40 +0000 (Thu, 12 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] improved mpfr_sqrt2_approx() + +------------------------------------------------------------------------ +r11186 | vlefevre | 2017-01-12 08:59:23 +0000 (Thu, 12 Jan 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Typographic correction (including generated spaces). +------------------------------------------------------------------------ +r11185 | vlefevre | 2017-01-10 16:17:05 +0000 (Tue, 10 Jan 2017) | 5 lines +Changed paths: + A /trunk/doc/add-with-carry.c + M /trunk/src/mpfr-impl.h + M /trunk/src/sqr.c + +Improvement of additions with carry. + * Added doc/add-with-carry.c showing how to do an addition with carry + in C (to make the compiler understand the code). + * src/mpfr-impl.h: added ADD_LIMB macro (addition with carry). + * src/sqr.c: use this ADD_LIMB macro to improve the generated code. +------------------------------------------------------------------------ +r11184 | zimmerma | 2017-01-10 15:20:00 +0000 (Tue, 10 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/sqr.c + +[src/sqr.c] 2 calls to umul_ppmm are enough in mpfr_sqr_2 in most cases + +------------------------------------------------------------------------ +r11183 | zimmerma | 2017-01-10 13:56:38 +0000 (Tue, 10 Jan 2017) | 3 lines +Changed paths: + M /trunk/src/div.c + M /trunk/src/sub1sp.c + +[src/div.c] added FIXME +[src/sub1sp.c] added comments + +------------------------------------------------------------------------ +r11182 | zimmerma | 2017-01-10 10:10:32 +0000 (Tue, 10 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] made code coherent with comment + +------------------------------------------------------------------------ +r11181 | vlefevre | 2017-01-10 09:58:49 +0000 (Tue, 10 Jan 2017) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Improved comment from r11180. +------------------------------------------------------------------------ +r11180 | zimmerma | 2017-01-10 09:48:30 +0000 (Tue, 10 Jan 2017) | 3 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] improved error bound for mpfr_sqrt2_approx, with known direction + of error + +------------------------------------------------------------------------ +r11178 | vlefevre | 2017-01-10 02:35:23 +0000 (Tue, 10 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Fixed other two bugs in special code for 3 limbs. +TODO: non-regression tests should be added for both. +------------------------------------------------------------------------ +r11177 | vlefevre | 2017-01-10 02:17:03 +0000 (Tue, 10 Jan 2017) | 1 line +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Fixed some bugs in special code for 3 limbs. +------------------------------------------------------------------------ +r11176 | vlefevre | 2017-01-10 01:17:54 +0000 (Tue, 10 Jan 2017) | 1 line +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Simplified a test. +------------------------------------------------------------------------ +r11173 | zimmerma | 2017-01-09 21:10:56 +0000 (Mon, 09 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] added special code for 3 limbs + +------------------------------------------------------------------------ +r11171 | vlefevre | 2017-01-09 16:58:51 +0000 (Mon, 09 Jan 2017) | 1 line +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] Fixed too large shift count in r11170 (code for 3 limbs). +------------------------------------------------------------------------ +r11170 | zimmerma | 2017-01-09 16:32:29 +0000 (Mon, 09 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] added special code for 3 limbs + +------------------------------------------------------------------------ +r11169 | zimmerma | 2017-01-09 14:41:14 +0000 (Mon, 09 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/sqr.c + +[src/sqr.c] added special code for 3 limbs + +------------------------------------------------------------------------ +r11167 | vlefevre | 2017-01-09 13:57:41 +0000 (Mon, 09 Jan 2017) | 1 line +Changed paths: + M /trunk/tests/tsub1sp.c + +[tests/tsub1sp.c] Fixed a return type. +------------------------------------------------------------------------ +r11166 | vlefevre | 2017-01-09 13:46:44 +0000 (Mon, 09 Jan 2017) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Updated note added in r11165. +------------------------------------------------------------------------ +r11165 | vlefevre | 2017-01-09 13:44:44 +0000 (Mon, 09 Jan 2017) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added a note about cross-compilation and test +under Wine, with references to bugs in autoconf and dash. +------------------------------------------------------------------------ +r11164 | zimmerma | 2017-01-09 10:53:20 +0000 (Mon, 09 Jan 2017) | 2 lines +Changed paths: + M /trunk/tests/tmul.c + +[tests/tmul.c] fixed typo + +------------------------------------------------------------------------ +r11162 | zimmerma | 2017-01-09 08:51:42 +0000 (Mon, 09 Jan 2017) | 3 lines +Changed paths: + M /trunk/src/sub1sp.c + M /trunk/tests/tsub1sp.c + +[src/sub1sp.c] fixed bug in mpfr_sub1sp2 when exponent diff. is GMP_NUMB_BITS +[tests/tsub1sp.c] added testcase + +------------------------------------------------------------------------ +r11161 | vlefevre | 2017-01-09 01:22:26 +0000 (Mon, 09 Jan 2017) | 1 line +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] Bug fix in mpfr_mul_3; tmul no longer fails (64-bit ABI). +------------------------------------------------------------------------ +r11160 | vlefevre | 2017-01-09 01:17:03 +0000 (Mon, 09 Jan 2017) | 1 line +Changed paths: + M /trunk/tests/tmul.c + +[tests/tmul.c] Added test of mpfr_mul on 1 to 3 limbs. Currently fails. +------------------------------------------------------------------------ +r11159 | vlefevre | 2017-01-08 23:45:49 +0000 (Sun, 08 Jan 2017) | 1 line +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] Define aq = MPFR_GET_PREC (a), and use this. +------------------------------------------------------------------------ +r11158 | zimmerma | 2017-01-08 22:22:36 +0000 (Sun, 08 Jan 2017) | 4 lines +Changed paths: + M /trunk/src/mul.c + M /trunk/src/sqrt.c + M /trunk/src/sub1sp.c + +[src/mul.c] added mpfr_mul_3 +[src/sqrt.c] renamed internal functions +[src/sub1sp.c] cosmetic change + +------------------------------------------------------------------------ +r11157 | zimmerma | 2017-01-07 07:57:37 +0000 (Sat, 07 Jan 2017) | 3 lines +Changed paths: + M /trunk/src/exp.c + M /trunk/src/sqrt.c + +[src/exp.c] avoid using a full limb as precision +[src/sqrt.c] removed obsolete comment + +------------------------------------------------------------------------ +r11156 | zimmerma | 2017-01-07 07:46:02 +0000 (Sat, 07 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/get_str.c + +[src/get_str.c] avoid precision = GMP_NUMB_BITS + +------------------------------------------------------------------------ +r11155 | zimmerma | 2017-01-07 07:26:12 +0000 (Sat, 07 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/div_ui.c + +[src/div_ui.c] added comment + +------------------------------------------------------------------------ +r11154 | vlefevre | 2017-01-06 15:17:12 +0000 (Fri, 06 Jan 2017) | 1 line +Changed paths: + M /trunk/tools/mbench/README + +[tools/mbench/README] Say how to disable a non-working library. +------------------------------------------------------------------------ +r11152 | zimmerma | 2017-01-06 06:59:41 +0000 (Fri, 06 Jan 2017) | 3 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] fixed previous commit: mpfr_div_1 and mpfr_div_2 also work for + GMP_NUMB_BITS <> 64, only some fast code inside is not defined + +------------------------------------------------------------------------ +r11150 | vlefevre | 2017-01-05 23:29:35 +0000 (Thu, 05 Jan 2017) | 1 line +Changed paths: + M /trunk/src/div.c + +[src/div.c] Use mpfr_limb_ptr instead of mp_ptr. +------------------------------------------------------------------------ +r11149 | vlefevre | 2017-01-05 23:27:43 +0000 (Thu, 05 Jan 2017) | 1 line +Changed paths: + M /trunk/src/div.c + +[src/div.c] Fix for GMP_NUMB_BITS != 64. +------------------------------------------------------------------------ +r11148 | zimmerma | 2017-01-05 21:13:50 +0000 (Thu, 05 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/div.c + M /trunk/src/invert_limb.h + +[src/div.c] faster division for 2 limbs + +------------------------------------------------------------------------ +r11147 | vlefevre | 2017-01-05 12:28:53 +0000 (Thu, 05 Jan 2017) | 1 line +Changed paths: + M /trunk/src/div_ui.c + +[src/div_ui.c] Coding style. +------------------------------------------------------------------------ +r11146 | vlefevre | 2017-01-05 12:25:59 +0000 (Thu, 05 Jan 2017) | 1 line +Changed paths: + M /trunk/src/div_ui.c + +[src/div_ui.c] Simplification. +------------------------------------------------------------------------ +r11145 | vlefevre | 2017-01-05 12:22:47 +0000 (Thu, 05 Jan 2017) | 1 line +Changed paths: + M /trunk/src/div_ui.c + +[src/div_ui.c] Replaced a MPFR_ASSERTN by MPFR_STAT_STATIC_ASSERT. +------------------------------------------------------------------------ +r11144 | vlefevre | 2017-01-05 12:17:32 +0000 (Thu, 05 Jan 2017) | 1 line +Changed paths: + M /trunk/tests/tdiv_ui.c + +[tests/tdiv_ui.c] Correction for 64-bit limb with 32-bit unsigned long. +------------------------------------------------------------------------ +r11143 | vlefevre | 2017-01-05 11:27:53 +0000 (Thu, 05 Jan 2017) | 1 line +Changed paths: + M /trunk/tests/tdiv_ui.c + +[tests/tdiv_ui.c] Fix when GMP_NUMB_BITS != 64. +------------------------------------------------------------------------ +r11142 | zimmerma | 2017-01-05 10:38:44 +0000 (Thu, 05 Jan 2017) | 2 lines +Changed paths: + M /trunk/src/div_ui.c + M /trunk/tests/tdiv_ui.c + +last fix was incomplete + +------------------------------------------------------------------------ +r11141 | zimmerma | 2017-01-05 09:43:59 +0000 (Thu, 05 Jan 2017) | 3 lines +Changed paths: + M /trunk/src/div_ui.c + M /trunk/tests/tdiv.c + M /trunk/tests/tdiv_ui.c + +[src/div_ui.c] fixed a bug in mpfr_div_ui (also affects mpfr_div since it calls + mpfr_div_ui when the divisor has a few bits) + +------------------------------------------------------------------------ +r11140 | zimmerma | 2017-01-05 07:51:15 +0000 (Thu, 05 Jan 2017) | 4 lines +Changed paths: + M /trunk/src/div.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mul.c + M /trunk/src/round_near_x.c + M /trunk/src/sqr.c + M /trunk/src/sqrt.c + M /trunk/tests/tdiv_ui.c + +fixed underflow bug by replacing !MPFR_IS_LIKE_RNDZ by new macro +MPFR_IS_LIKE_RNDA: for RNDN, !MPFR_IS_LIKE_RNDZ was true, while new macro +MPFR_IS_LIKE_RNDA is false + +------------------------------------------------------------------------ +r11139 | vlefevre | 2017-01-04 19:39:41 +0000 (Wed, 04 Jan 2017) | 3 lines +Changed paths: + M /trunk/tests/tdiv.c + +[tests/tdiv.c] Added a test that triggers an assertion failure +in a reduced exponent range (found from the generic tests with +GMP_CHECK_RANDOMIZE=1483628702). +------------------------------------------------------------------------ +r11138 | vlefevre | 2017-01-04 19:28:48 +0000 (Wed, 04 Jan 2017) | 1 line +Changed paths: + M /trunk/tests/tgeneric.c + +[tests/tgeneric.c] Added debug messages for overflow & underflow tests. +------------------------------------------------------------------------ +r11137 | vlefevre | 2017-01-04 19:03:49 +0000 (Wed, 04 Jan 2017) | 1 line +Changed paths: + M /trunk/tests/tdiv_ui.c + +[tests/tdiv_ui.c] Added a comment on new test (doesn't fail). +------------------------------------------------------------------------ +r11136 | zimmerma | 2017-01-04 18:04:18 +0000 (Wed, 04 Jan 2017) | 2 lines +Changed paths: + M /trunk/tests/tdiv_ui.c + +[tdiv_ui.c] added new test + +------------------------------------------------------------------------ +r11130 | vlefevre | 2017-01-03 11:46:41 +0000 (Tue, 03 Jan 2017) | 1 line +Changed paths: + M /trunk/src/invert_limb.h + +[src/invert_limb.h] Removed an unused variable. +------------------------------------------------------------------------ +r11129 | zimmerma | 2017-01-03 10:58:02 +0000 (Tue, 03 Jan 2017) | 3 lines +Changed paths: + M /trunk/src/Makefile.am + M /trunk/src/div.c + D /trunk/src/invert_limb.c + A /trunk/src/invert_limb.h + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + +use a macro instead of a function for __gmpfr_invert_limb and +__gmpfr_invert_limb_approx saves 2-3 cycles + +------------------------------------------------------------------------ +r11118 | vlefevre | 2017-01-01 01:35:42 +0000 (Sun, 01 Jan 2017) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r11117 | vlefevre | 2017-01-01 01:34:35 +0000 (Sun, 01 Jan 2017) | 5 lines +Changed paths: + M /trunk/BUGS + M /trunk/INSTALL + M /trunk/Makefile.am + M /trunk/NEWS + M /trunk/README + M /trunk/TODO + M /trunk/acinclude.m4 + M /trunk/configure.ac + M /trunk/doc/FAQ.html + M /trunk/doc/Makefile.am + M /trunk/doc/README.dev + M /trunk/doc/check-typography + M /trunk/doc/faq.xsl + M /trunk/doc/mpfr.texi + M /trunk/examples/can_round.c + M /trunk/examples/divworst.c + M /trunk/examples/rndo-add.c + M /trunk/examples/sample.c + M /trunk/examples/version.c + M /trunk/src/Makefile.am + M /trunk/src/abort_prec_max.c + M /trunk/src/acos.c + M /trunk/src/acosh.c + M /trunk/src/add.c + M /trunk/src/add1.c + M /trunk/src/add1sp.c + M /trunk/src/add_d.c + M /trunk/src/add_ui.c + M /trunk/src/agm.c + M /trunk/src/ai.c + M /trunk/src/amd/amdfam10/mparam.h + M /trunk/src/amd/athlon/mparam.h + M /trunk/src/amd/k8/mparam.h + M /trunk/src/arm/mparam.h + M /trunk/src/asin.c + M /trunk/src/asinh.c + M /trunk/src/atan.c + M /trunk/src/atan2.c + M /trunk/src/atanh.c + M /trunk/src/bernoulli.c + M /trunk/src/buildopt.c + M /trunk/src/cache.c + M /trunk/src/cbrt.c + M /trunk/src/check.c + M /trunk/src/clear.c + M /trunk/src/clears.c + M /trunk/src/cmp.c + M /trunk/src/cmp2.c + M /trunk/src/cmp_abs.c + M /trunk/src/cmp_d.c + M /trunk/src/cmp_ld.c + M /trunk/src/cmp_si.c + M /trunk/src/cmp_ui.c + M /trunk/src/comparisons.c + M /trunk/src/const_catalan.c + M /trunk/src/const_euler.c + M /trunk/src/const_log2.c + M /trunk/src/const_pi.c + M /trunk/src/constant.c + M /trunk/src/copysign.c + M /trunk/src/cos.c + M /trunk/src/cosh.c + M /trunk/src/cot.c + M /trunk/src/coth.c + M /trunk/src/csc.c + M /trunk/src/csch.c + M /trunk/src/d_div.c + M /trunk/src/d_sub.c + M /trunk/src/digamma.c + M /trunk/src/dim.c + M /trunk/src/div.c + M /trunk/src/div_2exp.c + M /trunk/src/div_2si.c + M /trunk/src/div_2ui.c + M /trunk/src/div_d.c + M /trunk/src/div_ui.c + M /trunk/src/dump.c + M /trunk/src/eint.c + M /trunk/src/eq.c + M /trunk/src/erandom.c + M /trunk/src/erf.c + M /trunk/src/erfc.c + M /trunk/src/exceptions.c + M /trunk/src/exp.c + M /trunk/src/exp10.c + M /trunk/src/exp2.c + M /trunk/src/exp3.c + M /trunk/src/exp_2.c + M /trunk/src/expm1.c + M /trunk/src/extract.c + M /trunk/src/factorial.c + M /trunk/src/fits_intmax.c + M /trunk/src/fits_s.h + M /trunk/src/fits_sint.c + M /trunk/src/fits_slong.c + M /trunk/src/fits_sshort.c + M /trunk/src/fits_u.h + M /trunk/src/fits_uint.c + M /trunk/src/fits_uintmax.c + M /trunk/src/fits_ulong.c + M /trunk/src/fits_ushort.c + M /trunk/src/fma.c + M /trunk/src/fmma.c + M /trunk/src/fms.c + M /trunk/src/fpif.c + M /trunk/src/frac.c + M /trunk/src/free_cache.c + M /trunk/src/frexp.c + M /trunk/src/gamma.c + M /trunk/src/gamma_inc.c + M /trunk/src/gammaonethird.c + M /trunk/src/gen_inverse.h + M /trunk/src/generic/coverage/mparam.h + M /trunk/src/generic/mparam.h + M /trunk/src/get_d.c + M /trunk/src/get_d64.c + M /trunk/src/get_exp.c + M /trunk/src/get_f.c + M /trunk/src/get_float128.c + M /trunk/src/get_flt.c + M /trunk/src/get_ld.c + M /trunk/src/get_si.c + M /trunk/src/get_sj.c + M /trunk/src/get_str.c + M /trunk/src/get_ui.c + M /trunk/src/get_uj.c + M /trunk/src/get_z.c + M /trunk/src/get_z_exp.c + M /trunk/src/gmp_op.c + M /trunk/src/grandom.c + M /trunk/src/hppa/mparam.h + M /trunk/src/hypot.c + M /trunk/src/ia64/mparam.h + M /trunk/src/ieee_floats.h + M /trunk/src/init.c + M /trunk/src/init2.c + M /trunk/src/inits.c + M /trunk/src/inits2.c + M /trunk/src/inp_str.c + M /trunk/src/int_ceil_log2.c + M /trunk/src/invert_limb.c + M /trunk/src/isinf.c + M /trunk/src/isinteger.c + M /trunk/src/isnan.c + M /trunk/src/isnum.c + M /trunk/src/isqrt.c + M /trunk/src/isregular.c + M /trunk/src/iszero.c + M /trunk/src/jn.c + M /trunk/src/jyn_asympt.c + M /trunk/src/li2.c + M /trunk/src/lngamma.c + M /trunk/src/log.c + M /trunk/src/log10.c + M /trunk/src/log1p.c + M /trunk/src/log2.c + M /trunk/src/log_ui.c + M /trunk/src/logging.c + M /trunk/src/min_prec.c + M /trunk/src/minmax.c + M /trunk/src/mips/mparam.h + M /trunk/src/modf.c + M /trunk/src/mp_clz_tab.c + M /trunk/src/mparam_h.in + M /trunk/src/mpf2mpfr.h + M /trunk/src/mpfr-cvers.h + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-intmax.h + M /trunk/src/mpfr-longlong.h + M /trunk/src/mpfr-mini-gmp.c + M /trunk/src/mpfr-mini-gmp.h + M /trunk/src/mpfr-sassert.h + M /trunk/src/mpfr-thread.h + M /trunk/src/mpfr.h + M /trunk/src/mpn_exp.c + M /trunk/src/mul.c + M /trunk/src/mul_2exp.c + M /trunk/src/mul_2si.c + M /trunk/src/mul_2ui.c + M /trunk/src/mul_d.c + M /trunk/src/mul_ui.c + M /trunk/src/mulders.c + M /trunk/src/neg.c + M /trunk/src/next.c + M /trunk/src/nrandom.c + M /trunk/src/out_str.c + M /trunk/src/pow.c + M /trunk/src/pow_si.c + M /trunk/src/pow_ui.c + M /trunk/src/pow_z.c + M /trunk/src/powerof2.c + M /trunk/src/powerpc32/mparam.h + M /trunk/src/powerpc64/mparam.h + M /trunk/src/print_raw.c + M /trunk/src/print_rnd_mode.c + M /trunk/src/printf.c + M /trunk/src/random_deviate.c + M /trunk/src/random_deviate.h + M /trunk/src/rec_sqrt.c + M /trunk/src/reldiff.c + M /trunk/src/rem1.c + M /trunk/src/rint.c + M /trunk/src/rndna.c + M /trunk/src/root.c + M /trunk/src/round_near_x.c + M /trunk/src/round_p.c + M /trunk/src/round_prec.c + M /trunk/src/round_raw_generic.c + M /trunk/src/scale2.c + M /trunk/src/sec.c + M /trunk/src/sech.c + M /trunk/src/set.c + M /trunk/src/set_d.c + M /trunk/src/set_d64.c + M /trunk/src/set_dfl_prec.c + M /trunk/src/set_exp.c + M /trunk/src/set_f.c + M /trunk/src/set_float128.c + M /trunk/src/set_flt.c + M /trunk/src/set_inf.c + M /trunk/src/set_ld.c + M /trunk/src/set_nan.c + M /trunk/src/set_prc_raw.c + M /trunk/src/set_prec.c + M /trunk/src/set_q.c + M /trunk/src/set_rnd.c + M /trunk/src/set_si.c + M /trunk/src/set_si_2exp.c + M /trunk/src/set_sj.c + M /trunk/src/set_str.c + M /trunk/src/set_str_raw.c + M /trunk/src/set_ui.c + M /trunk/src/set_ui_2exp.c + M /trunk/src/set_uj.c + M /trunk/src/set_z.c + M /trunk/src/set_z_exp.c + M /trunk/src/set_zero.c + M /trunk/src/setmax.c + M /trunk/src/setmin.c + M /trunk/src/setsign.c + M /trunk/src/sgn.c + M /trunk/src/si_op.c + M /trunk/src/signbit.c + M /trunk/src/sin.c + M /trunk/src/sin_cos.c + M /trunk/src/sinh.c + M /trunk/src/sinh_cosh.c + M /trunk/src/sparc64/mparam.h + M /trunk/src/sqr.c + M /trunk/src/sqrt.c + M /trunk/src/sqrt_tab.h + M /trunk/src/sqrt_ui.c + M /trunk/src/stack_interface.c + M /trunk/src/strtofr.c + M /trunk/src/sub.c + M /trunk/src/sub1.c + M /trunk/src/sub1sp.c + M /trunk/src/sub_d.c + M /trunk/src/sub_ui.c + M /trunk/src/subnormal.c + M /trunk/src/sum.c + M /trunk/src/swap.c + M /trunk/src/tan.c + M /trunk/src/tanh.c + M /trunk/src/ubf.c + M /trunk/src/uceil_exp2.c + M /trunk/src/uceil_log2.c + M /trunk/src/ufloor_log2.c + M /trunk/src/ui_div.c + M /trunk/src/ui_pow.c + M /trunk/src/ui_pow_ui.c + M /trunk/src/ui_sub.c + M /trunk/src/urandom.c + M /trunk/src/urandomb.c + M /trunk/src/vasprintf.c + M /trunk/src/version.c + M /trunk/src/volatile.c + M /trunk/src/x86/core2/mparam.h + M /trunk/src/x86/mparam.h + M /trunk/src/x86_64/core2/mparam.h + M /trunk/src/x86_64/corei5/mparam.h + M /trunk/src/x86_64/pentium4/mparam.h + M /trunk/src/yn.c + M /trunk/src/zeta.c + M /trunk/src/zeta_ui.c + M /trunk/tests/Makefile.am + M /trunk/tests/cmp_str.c + M /trunk/tests/data/digamma + M /trunk/tests/data/li2 + M /trunk/tests/memory.c + M /trunk/tests/mpf_compat.c + M /trunk/tests/mpf_compat.h + M /trunk/tests/mpfr-test.h + M /trunk/tests/mpfr_compat.c + M /trunk/tests/random2.c + M /trunk/tests/reuse.c + M /trunk/tests/rnd_mode.c + M /trunk/tests/tabort_defalloc1.c + M /trunk/tests/tabort_defalloc2.c + M /trunk/tests/tabort_prec_max.c + M /trunk/tests/tabs.c + M /trunk/tests/tacos.c + M /trunk/tests/tacosh.c + M /trunk/tests/tadd.c + M /trunk/tests/tadd1sp.c + M /trunk/tests/tadd_d.c + M /trunk/tests/tadd_ui.c + M /trunk/tests/tagm.c + M /trunk/tests/tai.c + M /trunk/tests/talloc-cache.c + M /trunk/tests/talloc.c + M /trunk/tests/tasin.c + M /trunk/tests/tasinh.c + M /trunk/tests/tassert.c + M /trunk/tests/tatan.c + M /trunk/tests/tatanh.c + M /trunk/tests/taway.c + M /trunk/tests/tbuildopt.c + M /trunk/tests/tcan_round.c + M /trunk/tests/tcbrt.c + M /trunk/tests/tcheck.c + M /trunk/tests/tcmp.c + M /trunk/tests/tcmp2.c + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + M /trunk/tests/tcmp_ui.c + M /trunk/tests/tcmpabs.c + M /trunk/tests/tcomparisons.c + M /trunk/tests/tconst_catalan.c + M /trunk/tests/tconst_euler.c + M /trunk/tests/tconst_log2.c + M /trunk/tests/tconst_pi.c + M /trunk/tests/tcopysign.c + M /trunk/tests/tcos.c + M /trunk/tests/tcosh.c + M /trunk/tests/tcot.c + M /trunk/tests/tcoth.c + M /trunk/tests/tcsc.c + M /trunk/tests/tcsch.c + M /trunk/tests/td_div.c + M /trunk/tests/td_sub.c + M /trunk/tests/tdigamma.c + M /trunk/tests/tdim.c + M /trunk/tests/tdiv.c + M /trunk/tests/tdiv_d.c + M /trunk/tests/tdiv_ui.c + M /trunk/tests/teint.c + M /trunk/tests/teq.c + M /trunk/tests/terandom.c + M /trunk/tests/terandom_chisq.c + M /trunk/tests/terf.c + M /trunk/tests/tests.c + M /trunk/tests/texceptions.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/texpm1.c + M /trunk/tests/tfactorial.c + M /trunk/tests/tfits.c + M /trunk/tests/tfma.c + M /trunk/tests/tfmma.c + M /trunk/tests/tfmod.c + M /trunk/tests/tfms.c + M /trunk/tests/tfpif.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tfrac.c + M /trunk/tests/tfrexp.c + M /trunk/tests/tgamma.c + M /trunk/tests/tgamma_inc.c + M /trunk/tests/tgeneric.c + M /trunk/tests/tgeneric_ui.c + M /trunk/tests/tget_d.c + M /trunk/tests/tget_d_2exp.c + M /trunk/tests/tget_f.c + M /trunk/tests/tget_flt.c + M /trunk/tests/tget_ld_2exp.c + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tget_sj.c + M /trunk/tests/tget_str.c + M /trunk/tests/tget_z.c + M /trunk/tests/tgmpop.c + M /trunk/tests/tgrandom.c + M /trunk/tests/thyperbolic.c + M /trunk/tests/thypot.c + M /trunk/tests/tinits.c + M /trunk/tests/tinp_str.c + M /trunk/tests/tinternals.c + M /trunk/tests/tisnan.c + M /trunk/tests/tisqrt.c + M /trunk/tests/tj0.c + M /trunk/tests/tj1.c + M /trunk/tests/tjn.c + M /trunk/tests/tl2b.c + M /trunk/tests/tlgamma.c + M /trunk/tests/tli2.c + M /trunk/tests/tlngamma.c + M /trunk/tests/tlog.c + M /trunk/tests/tlog10.c + M /trunk/tests/tlog1p.c + M /trunk/tests/tlog2.c + M /trunk/tests/tlog_ui.c + M /trunk/tests/tmin_prec.c + M /trunk/tests/tminmax.c + M /trunk/tests/tmodf.c + M /trunk/tests/tmul.c + M /trunk/tests/tmul_2exp.c + M /trunk/tests/tmul_d.c + M /trunk/tests/tmul_ui.c + M /trunk/tests/tnext.c + M /trunk/tests/tnrandom.c + M /trunk/tests/tnrandom_chisq.c + M /trunk/tests/tout_str.c + M /trunk/tests/toutimpl.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow3.c + M /trunk/tests/tpow_all.c + M /trunk/tests/tpow_z.c + M /trunk/tests/tprintf.c + M /trunk/tests/trandom.c + M /trunk/tests/trandom_deviate.c + M /trunk/tests/trec_sqrt.c + M /trunk/tests/tremquo.c + M /trunk/tests/trint.c + M /trunk/tests/trndna.c + M /trunk/tests/troot.c + M /trunk/tests/tround_prec.c + M /trunk/tests/tsec.c + M /trunk/tests/tsech.c + M /trunk/tests/tset.c + M /trunk/tests/tset_d.c + M /trunk/tests/tset_exp.c + M /trunk/tests/tset_f.c + M /trunk/tests/tset_float128.c + M /trunk/tests/tset_ld.c + M /trunk/tests/tset_q.c + M /trunk/tests/tset_si.c + M /trunk/tests/tset_sj.c + M /trunk/tests/tset_str.c + M /trunk/tests/tset_z.c + M /trunk/tests/tset_z_exp.c + M /trunk/tests/tsgn.c + M /trunk/tests/tsi_op.c + M /trunk/tests/tsin.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tsinh.c + M /trunk/tests/tsinh_cosh.c + M /trunk/tests/tsprintf.c + M /trunk/tests/tsqr.c + M /trunk/tests/tsqrt.c + M /trunk/tests/tsqrt_ui.c + M /trunk/tests/tstckintc.c + M /trunk/tests/tstdint.c + M /trunk/tests/tstrtofr.c + M /trunk/tests/tsub.c + M /trunk/tests/tsub1sp.c + M /trunk/tests/tsub_d.c + M /trunk/tests/tsub_ui.c + M /trunk/tests/tsubnormal.c + M /trunk/tests/tsum.c + M /trunk/tests/tswap.c + M /trunk/tests/ttan.c + M /trunk/tests/ttanh.c + M /trunk/tests/ttrunc.c + M /trunk/tests/tui_div.c + M /trunk/tests/tui_pow.c + M /trunk/tests/tui_sub.c + M /trunk/tests/turandom.c + M /trunk/tests/tvalist.c + M /trunk/tests/tversion.c + M /trunk/tests/ty0.c + M /trunk/tests/ty1.c + M /trunk/tests/tyn.c + M /trunk/tests/tzeta.c + M /trunk/tests/tzeta_ui.c + M /trunk/tools/bench/Makefile.am + M /trunk/tools/bench/benchtime.h + M /trunk/tools/bench/mpfrbench.c + M /trunk/tools/ck-clz_tab + M /trunk/tools/ck-copyright-notice + M /trunk/tools/ck-mparam + M /trunk/tools/ck-news + M /trunk/tools/ck-version-info + M /trunk/tools/get_patches.sh + M /trunk/tune/Makefile.am + M /trunk/tune/bidimensional_sample.c + M /trunk/tune/speed.c + M /trunk/tune/tuneup.c + +Copyright notice update: added 2017 with + perl -pi -e 's/ (\d{4}-)?(2016)(?= Free Software)/ + " ".($1||"$2-").($2+1)/e' **/*(^/) +under zsh, reverting the tools/mbench directory (not distributed with +MPFR). Removed 2016 from the example in the doc/README.dev file. +------------------------------------------------------------------------ +r11116 | vlefevre | 2016-12-31 04:01:05 +0000 (Sat, 31 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sqr.c + +[src/sqr.c] Bug fixes (portability): replaced left shift of a value +that can be negative by a multiplication by 2. +------------------------------------------------------------------------ +r11115 | vlefevre | 2016-12-31 03:40:00 +0000 (Sat, 31 Dec 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] C90 compatibility. +------------------------------------------------------------------------ +r11114 | vlefevre | 2016-12-31 03:28:01 +0000 (Sat, 31 Dec 2016) | 1 line +Changed paths: + M /trunk/src/div.c + +[src/div.c] C90 compatibility. +------------------------------------------------------------------------ +r11113 | vlefevre | 2016-12-31 03:17:51 +0000 (Sat, 31 Dec 2016) | 1 line +Changed paths: + M /trunk/src/invert_limb.c + +[src/invert_limb.c] Removed unused variable. +------------------------------------------------------------------------ +r11112 | zimmerma | 2016-12-30 17:23:49 +0000 (Fri, 30 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] small speedup in mpfr_mul_2 by not computing the product b0*c0 + +------------------------------------------------------------------------ +r11111 | zimmerma | 2016-12-30 16:39:13 +0000 (Fri, 30 Dec 2016) | 3 lines +Changed paths: + M /trunk/src/mul.c + M /trunk/src/sqr.c + +[src/mul.c] fixed typo in comment +[src/sqr.c] likewise + +------------------------------------------------------------------------ +r11110 | zimmerma | 2016-12-30 15:56:31 +0000 (Fri, 30 Dec 2016) | 4 lines +Changed paths: + M /trunk/src/mpfr-impl.h + M /trunk/src/mul.c + M /trunk/src/sqr.c + +[src/mul.c] fixed regression for 1/2 limbs introduced in revision 11098: + critical routines should not be exported, otherwise we lose a few + cycles (maybe they are inlined by the compiler) + +------------------------------------------------------------------------ +r11109 | zimmerma | 2016-12-30 14:25:47 +0000 (Fri, 30 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + M /trunk/src/invert_limb.c + M /trunk/src/mpfr-impl.h + +[src/div.c] further improvement in mpfr_div_1() + +------------------------------------------------------------------------ +r11108 | zimmerma | 2016-12-30 13:16:21 +0000 (Fri, 30 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] use an approximate quotient in mpfr_div_1() + +------------------------------------------------------------------------ +r11107 | zimmerma | 2016-12-30 12:19:40 +0000 (Fri, 30 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] simplify mpfr_div_1() + +------------------------------------------------------------------------ +r11106 | zimmerma | 2016-12-30 09:10:24 +0000 (Fri, 30 Dec 2016) | 5 lines +Changed paths: + M /trunk/src/Makefile.am + M /trunk/src/div.c + A /trunk/src/invert_limb.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + +[src/invert_limb.c] new file for __gmpfr_invert_limb internal function + (only provided so far for 64-bit limb) +[src/div.c] mpfr_div_1 and mpfr_div_2 don't require --enable-gmp-internals + any more + +------------------------------------------------------------------------ +r11105 | zimmerma | 2016-12-30 07:51:35 +0000 (Fri, 30 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt_tab.h + +[sqrt_tab.h] better file description + +------------------------------------------------------------------------ +r11104 | vlefevre | 2016-12-29 15:32:45 +0000 (Thu, 29 Dec 2016) | 1 line +Changed paths: + M /trunk/acinclude.m4 + M /trunk/src/div.c + +Improvement concerning the _mulx_u64 intrinsic. +------------------------------------------------------------------------ +r11103 | zimmerma | 2016-12-29 11:05:18 +0000 (Thu, 29 Dec 2016) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/src/div.c + +[src/div.c] replace GMP's invert_limb (internal) by own code + +------------------------------------------------------------------------ +r11101 | vlefevre | 2016-12-29 03:06:30 +0000 (Thu, 29 Dec 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Replaced constant MPFR_ASSERTD by MPFR_STAT_STATIC_ASSERT. +------------------------------------------------------------------------ +r11098 | zimmerma | 2016-12-28 12:24:13 +0000 (Wed, 28 Dec 2016) | 3 lines +Changed paths: + M /trunk/src/mpfr-impl.h + M /trunk/src/mul.c + M /trunk/src/sqr.c + M /trunk/tools/mbench/mfv5-mpfr.cc + +[src/sqr.c] use special code for 1 and 2 limbs +[mbench] added mpfr_sqr + +------------------------------------------------------------------------ +r11097 | zimmerma | 2016-12-28 10:25:31 +0000 (Wed, 28 Dec 2016) | 4 lines +Changed paths: + M /trunk/src/sqrt.c + M /trunk/src/sqrt_tab.h + +[src/sqrt.c] faster sqrt code for 2 limbs and 64-bit limb (removed special code + for 32-bit limb) +[src/sqrt_tab.h] new table for mpn_sqrtrem4_approx + +------------------------------------------------------------------------ +r11096 | zimmerma | 2016-12-28 09:20:24 +0000 (Wed, 28 Dec 2016) | 2 lines +Changed paths: + M /trunk/tests/tlog.c + +[tlog.c] missing printf() + +------------------------------------------------------------------------ +r11095 | vlefevre | 2016-12-27 10:53:16 +0000 (Tue, 27 Dec 2016) | 2 lines +Changed paths: + M /trunk/NEWS + +[NEWS] Mention that mpfr_get_str now also sets the inexact flag when +the conversion is inexact (completing r11073). +------------------------------------------------------------------------ +r11094 | vlefevre | 2016-12-27 10:33:09 +0000 (Tue, 27 Dec 2016) | 3 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[mpfr.texi] Be stronger in mpfr_round_nearest_away documentation +(as the ternary value is used each time the last bit on p+1 bits +is not 0, i.e. in about half cases). +------------------------------------------------------------------------ +r11093 | zimmerma | 2016-12-27 08:18:54 +0000 (Tue, 27 Dec 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[mpfr.texi] added stuff in mpfr_round_nearest_away documentation + +------------------------------------------------------------------------ +r11092 | vlefevre | 2016-12-27 02:33:59 +0000 (Tue, 27 Dec 2016) | 1 line +Changed paths: + M /trunk/src/log.c + +[src/log.c] Added another FIXME concerning the error analysis. +------------------------------------------------------------------------ +r11091 | vlefevre | 2016-12-27 02:20:57 +0000 (Tue, 27 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/log.c + +[src/log.c] Added an assertion and a FIXME: error in the MPFR code or +in the proof (error analysis). +------------------------------------------------------------------------ +r11090 | vlefevre | 2016-12-27 01:58:54 +0000 (Tue, 27 Dec 2016) | 1 line +Changed paths: + M /trunk/src/log.c + +[src/log.c] Slight simplification / improvement. +------------------------------------------------------------------------ +r11089 | vlefevre | 2016-12-27 01:16:53 +0000 (Tue, 27 Dec 2016) | 7 lines +Changed paths: + M /trunk/doc/algorithms.tex + +[doc/algorithms.tex] In Section "The logarithm function" (from r9046), +removed everything concerning the AGM since this is not what is done +in the MPFR code, where mpfr_agm is simply called (and this function +already has its own description later). +Note: The error analysis of mpfr_log can only be found in log.c, but +seems incorrect (though the bounds may be valid); it was introduced +in r416. +------------------------------------------------------------------------ +r11087 | vlefevre | 2016-12-26 02:43:56 +0000 (Mon, 26 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/log.c + +[src/log.c] Group constant terms together (GCC takes advantage of this, +at least on x86_64). +------------------------------------------------------------------------ +r11086 | vlefevre | 2016-12-26 02:30:02 +0000 (Mon, 26 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/log.c + +[src/log.c] Check for integer overflow (no visible changes in +standard configuration) + explanations. +------------------------------------------------------------------------ +r11085 | vlefevre | 2016-12-26 02:17:10 +0000 (Mon, 26 Dec 2016) | 1 line +Changed paths: + M /trunk/src/log.c + +[src/log.c] Get the exponent of the input only once. +------------------------------------------------------------------------ +r11075 | vlefevre | 2016-12-20 12:57:31 +0000 (Tue, 20 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Delay some assignments so that they are done just before +the variables are used (this should have been done in r10467). +------------------------------------------------------------------------ +r11073 | vlefevre | 2016-12-20 11:41:54 +0000 (Tue, 20 Dec 2016) | 4 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] For mpfr_get_str, explicitly say that the inexact flag +is set iff the result is inexact (since this may not be obvious and this +wasn't the case until now). In the compatibility section, mention this +change. +------------------------------------------------------------------------ +r11072 | vlefevre | 2016-12-20 11:35:11 +0000 (Tue, 20 Dec 2016) | 3 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] For mpfr_get_str, removed the note saying that +the inexact flag is not set when the conversion is inexact: +this is fixed in r11071. +------------------------------------------------------------------------ +r11071 | vlefevre | 2016-12-20 11:17:31 +0000 (Tue, 20 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/get_str.c + +[src/get_str.c] Corrected a comment and a test for inexactness +(→ the new tget_str.c test no longer fails). +------------------------------------------------------------------------ +r11068 | vlefevre | 2016-12-19 16:05:20 +0000 (Mon, 19 Dec 2016) | 1 line +Changed paths: + M /trunk/tests/tstrtofr.c + +[tests/tstrtofr.c] Added a comment. +------------------------------------------------------------------------ +r11067 | vlefevre | 2016-12-19 15:46:38 +0000 (Mon, 19 Dec 2016) | 1 line +Changed paths: + M /trunk/src/strtofr.c + +[src/strtofr.c] Better indentation. +------------------------------------------------------------------------ +r11066 | vlefevre | 2016-12-19 15:36:30 +0000 (Mon, 19 Dec 2016) | 1 line +Changed paths: + M /trunk/tests/tstrtofr.c + +[tests/tstrtofr.c] Replaced mpfr_cmp() == 0 by mpfr_equal_p(). +------------------------------------------------------------------------ +r11065 | vlefevre | 2016-12-19 15:04:12 +0000 (Mon, 19 Dec 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r11064 | vlefevre | 2016-12-19 14:17:11 +0000 (Mon, 19 Dec 2016) | 3 lines +Changed paths: + M /trunk/src/get_str.c + +[src/get_str.c] Removed an obsolete comment, which came from r2757 +(and even before, under another form); this comment no longer made +any sense as the sign of dir is no longer tested. +------------------------------------------------------------------------ +r11063 | vlefevre | 2016-12-19 14:00:20 +0000 (Mon, 19 Dec 2016) | 1 line +Changed paths: + M /trunk/src/get_str.c + +[src/get_str.c] Indentation fixed. +------------------------------------------------------------------------ +r11062 | vlefevre | 2016-12-19 13:59:35 +0000 (Mon, 19 Dec 2016) | 6 lines +Changed paths: + M /trunk/src/get_str.c + +[src/get_str.c] Setting the inexact flag as done in r11060 was incorrect +since the flags are restored. Moreover, this was done even when the Ziv +loop was going to fail (it's not clear whether this was expected). Moved +the test out of the Ziv loop, and update the copy of the flags instead +of the flags that will be overwritten. +Note: this still fails, but now for another reason. +------------------------------------------------------------------------ +r11061 | vlefevre | 2016-12-19 13:36:28 +0000 (Mon, 19 Dec 2016) | 2 lines +Changed paths: + M /trunk/tests/tget_str.c + +[tests/tget_str.c] Check the inexact flag for mpfr_get_str. +The test currently fails. +------------------------------------------------------------------------ +r11060 | zimmerma | 2016-12-19 08:26:26 +0000 (Mon, 19 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/get_str.c + +[get_str.c] inexact flag should now be correct in mpfr_get_str + +------------------------------------------------------------------------ +r11059 | zimmerma | 2016-12-19 08:08:19 +0000 (Mon, 19 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/strtofr.c + +[strtofr.c] updated comment + +------------------------------------------------------------------------ +r11058 | vlefevre | 2016-12-18 22:47:20 +0000 (Sun, 18 Dec 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added a short note about the default precision for Re. +------------------------------------------------------------------------ +r11057 | zimmerma | 2016-12-18 18:27:18 +0000 (Sun, 18 Dec 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[mpfr.texi] added emin in comment about mpfr_round_nearest_away + +------------------------------------------------------------------------ +r11056 | zimmerma | 2016-12-18 09:01:59 +0000 (Sun, 18 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/get_str.c + M /trunk/src/strtofr.c + +fixed bug in mpfr_strtofr (and likely similar bug in mpfr_get_str) + +------------------------------------------------------------------------ +r11055 | zimmerma | 2016-12-17 22:22:54 +0000 (Sat, 17 Dec 2016) | 2 lines +Changed paths: + M /trunk/tests/tstrtofr.c + +[tstrtofr.c] added test for bug in mpfr_strtofr() + +------------------------------------------------------------------------ +r11054 | vlefevre | 2016-12-17 02:27:05 +0000 (Sat, 17 Dec 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Added "do ... while (0)" in macro definition. +------------------------------------------------------------------------ +r11053 | vlefevre | 2016-12-16 15:04:26 +0000 (Fri, 16 Dec 2016) | 1 line +Changed paths: + M /trunk/src/div.c + +Removed trailing whitespace. +------------------------------------------------------------------------ +r11052 | vlefevre | 2016-12-16 14:54:14 +0000 (Fri, 16 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/round_raw_generic.c + +[src/round_raw_generic.c] Completed the support for MPFR_RNDNA (set +*inexp if use_inexp is true), from a patch by John P. Hartmann. +------------------------------------------------------------------------ +r11051 | zimmerma | 2016-12-16 11:15:14 +0000 (Fri, 16 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + M /trunk/src/sqrt_tab.h + +new mpn_sqrtrem4_approx function (unused so far) + +------------------------------------------------------------------------ +r11048 | vlefevre | 2016-12-15 15:18:42 +0000 (Thu, 15 Dec 2016) | 1 line +Changed paths: + M /trunk/src/sin.c + +[src/sin.c] Handled a FIXME. +------------------------------------------------------------------------ +r11047 | vlefevre | 2016-12-15 14:53:27 +0000 (Thu, 15 Dec 2016) | 1 line +Changed paths: + M /trunk/src/sqrt_tab.h + +[src/sqrt_tab.h] Added copyright notice. +------------------------------------------------------------------------ +r11044 | zimmerma | 2016-12-15 08:28:05 +0000 (Thu, 15 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[sqrt.c] simplify code for GMP_NUMB_BITS = 64 + +------------------------------------------------------------------------ +r11042 | zimmerma | 2016-12-14 21:07:34 +0000 (Wed, 14 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-longlong.h + +better fix than r11025 + +------------------------------------------------------------------------ +r11041 | zimmerma | 2016-12-14 16:42:32 +0000 (Wed, 14 Dec 2016) | 3 lines +Changed paths: + M /trunk/src/Makefile.am + M /trunk/src/sqrt.c + A /trunk/src/sqrt_tab.h + +[sqrt_tab.h] new header file with table for mpn_sqrtrem2_approx() +[sqrt.c] new version of mpn_sqrtrem2_approx() + +------------------------------------------------------------------------ +r11039 | zimmerma | 2016-12-14 10:52:58 +0000 (Wed, 14 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[sqrt.c] added mathematical error in mpn_sqrtrem2_approx() + +------------------------------------------------------------------------ +r11038 | zimmerma | 2016-12-14 07:40:46 +0000 (Wed, 14 Dec 2016) | 2 lines +Changed paths: + M /trunk/tests/tsprintf.c + +added non-regression test for bug fix in r11037 + +------------------------------------------------------------------------ +r11037 | vlefevre | 2016-12-14 03:22:12 +0000 (Wed, 14 Dec 2016) | 4 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Fixed a bug as spec.prec can be a negative number +other than -1 (if such a value is given as an argument with ".*"). +This is the probable cause of the assertion failure on: +https://gforge.inria.fr/tracker/?func=detail&atid=619&aid=21056&group_id=136 +------------------------------------------------------------------------ +r11036 | zimmerma | 2016-12-13 17:42:05 +0000 (Tue, 13 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[sqrt.c] faster version of mpn_sqrtrem2 for 64-bit limb + +------------------------------------------------------------------------ +r11035 | zimmerma | 2016-12-13 11:36:56 +0000 (Tue, 13 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[sqrt.c] approximate version of mpn_sqrtrem2, saves a few cycles in mpfr_sqrt1 + +------------------------------------------------------------------------ +r11034 | zimmerma | 2016-12-13 08:09:07 +0000 (Tue, 13 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + M /trunk/src/sub1sp.c + +[add/sub] added MPFR_UNLIKELY when adding one ulp changes the binade + +------------------------------------------------------------------------ +r11033 | vlefevre | 2016-12-12 17:53:57 +0000 (Mon, 12 Dec 2016) | 1 line +Changed paths: + M /trunk/src/sin.c + +[src/sin.c] Added missing word in r11032 comment. +------------------------------------------------------------------------ +r11032 | vlefevre | 2016-12-12 17:53:02 +0000 (Mon, 12 Dec 2016) | 1 line +Changed paths: + M /trunk/src/sin.c + +[src/sin.c] Common/related subexpressions. Added a FIXME. +------------------------------------------------------------------------ +r11031 | zimmerma | 2016-12-12 17:32:09 +0000 (Mon, 12 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/cos.c + M /trunk/src/exp_2.c + M /trunk/src/log.c + +[cos.c,exp_2.c,log.c] improved initial precision for Ziv's strategy + +------------------------------------------------------------------------ +r11030 | zimmerma | 2016-12-12 17:01:19 +0000 (Mon, 12 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sin.c + +[sin.c] improved strategy for initial precision + +------------------------------------------------------------------------ +r11029 | zimmerma | 2016-12-12 16:43:39 +0000 (Mon, 12 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[sqrt.c] updated code and comments + +------------------------------------------------------------------------ +r11028 | zimmerma | 2016-12-12 15:26:22 +0000 (Mon, 12 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[sqrt.c] slightly improve mpn_rsqrtrem1() (and detailed error analysis) + +------------------------------------------------------------------------ +r11027 | zimmerma | 2016-12-12 10:25:51 +0000 (Mon, 12 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[sqrt.c] removed mpn_sqrtrem1 (no longer needed since r11023) + +------------------------------------------------------------------------ +r11026 | zimmerma | 2016-12-12 10:23:39 +0000 (Mon, 12 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[sqrt.c] fixed comments to be coherent with the code + +------------------------------------------------------------------------ +r11025 | zimmerma | 2016-12-12 09:04:19 +0000 (Mon, 12 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-longlong.h + +fixed https://gforge.inria.fr/tracker/?func=detail&atid=619&aid=21053&group_id=136 + +------------------------------------------------------------------------ +r11024 | vlefevre | 2016-12-09 19:55:12 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Corrected a comment (1 has exponent 1 and we support +precision 1). +------------------------------------------------------------------------ +r11023 | zimmerma | 2016-12-09 16:59:46 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[sqrt.c] no more special case for prec <= GMP_NUMB_BITS/2, and added comments + +------------------------------------------------------------------------ +r11022 | vlefevre | 2016-12-09 15:13:10 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Bug fix (replaced = by ==). Note: this kind of bug could +be detected by avoiding extra parentheses. +------------------------------------------------------------------------ +r11021 | vlefevre | 2016-12-09 15:01:25 +0000 (Fri, 09 Dec 2016) | 1 line +Changed paths: + M /trunk/src/div.c + M /trunk/src/sqrt.c + +[src] Simplified ~MPFR_LIMB_ZERO to MPFR_LIMB_MAX. +------------------------------------------------------------------------ +r11020 | zimmerma | 2016-12-09 14:55:31 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[div.c] simplified mpfr_div_1 and mpfr_div_2 + +------------------------------------------------------------------------ +r11019 | zimmerma | 2016-12-09 14:34:20 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[div.c] added comments and simplified code + +------------------------------------------------------------------------ +r11018 | zimmerma | 2016-12-09 13:53:45 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[div.c] simplified code + +------------------------------------------------------------------------ +r11017 | zimmerma | 2016-12-09 13:50:55 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/mul.c + M /trunk/tests/tmul.c + +likewise for mpfr_mul_2() + +------------------------------------------------------------------------ +r11016 | zimmerma | 2016-12-09 13:44:45 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/mul.c + M /trunk/tests/tmul.c + +fixed bug in mpfr_mul_1() introduced in r11004 and added test case + +------------------------------------------------------------------------ +r11015 | zimmerma | 2016-12-09 13:14:56 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[div.c] simplified underflow test in mpfr_div_1() + +------------------------------------------------------------------------ +r11014 | vlefevre | 2016-12-09 12:51:17 +0000 (Fri, 09 Dec 2016) | 1 line +Changed paths: + M /trunk/src/div_ui.c + +[src/div_ui.c] underflow is unlikely! +------------------------------------------------------------------------ +r11013 | vlefevre | 2016-12-09 12:48:20 +0000 (Fri, 09 Dec 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] overflow and underflow are unlikely! +------------------------------------------------------------------------ +r11012 | zimmerma | 2016-12-09 12:42:08 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[div.c] overflow and underflow are unlikely! + +------------------------------------------------------------------------ +r11011 | zimmerma | 2016-12-09 12:30:39 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[div.c] slightly better code (less dependencies) for mpfr_div_1 when u0 >= v0 + +------------------------------------------------------------------------ +r11010 | zimmerma | 2016-12-09 12:02:19 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[div.c] simplified mpfr_div_1() code + +------------------------------------------------------------------------ +r11009 | zimmerma | 2016-12-09 11:52:44 +0000 (Fri, 09 Dec 2016) | 3 lines +Changed paths: + M /trunk/src/div.c + +[div.c] in mpfr_div_1, do not deal with the case where the precision is + <= GMP_NUMB_BITS/2, to not slow down the general case + +------------------------------------------------------------------------ +r11008 | vlefevre | 2016-12-09 11:45:35 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] Slight improvement (but shouldn't affect the generated code +with an optimizing compiler). +------------------------------------------------------------------------ +r11007 | zimmerma | 2016-12-09 11:34:58 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/mul.c + +[mul.c] likewise for mpfr_mul_2() + +------------------------------------------------------------------------ +r11006 | zimmerma | 2016-12-09 11:31:52 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/mul.c + +[mul.c] simplified mpfr_mul_1() + +------------------------------------------------------------------------ +r11005 | zimmerma | 2016-12-09 10:50:30 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/mul.c + M /trunk/tests/tmul.c + +fixed similar bug in mpfr_mul_2() + non-regression test + +------------------------------------------------------------------------ +r11004 | zimmerma | 2016-12-09 10:30:53 +0000 (Fri, 09 Dec 2016) | 3 lines +Changed paths: + M /trunk/src/mul.c + M /trunk/tests/tmul.c + +[mul.c] simplified the code and fixed a bug +[tmul.c] added non-regression test for fixed bug + +------------------------------------------------------------------------ +r11003 | zimmerma | 2016-12-09 10:10:42 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[sub1sp.c] added comment + assert + +------------------------------------------------------------------------ +r11002 | vlefevre | 2016-12-09 08:59:15 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + +[src] Fixed bug introduced in r10964 with --with-gmp-build: move +the numberof_const() definition from mpfr-gmp.h to mpfr-impl.h. +------------------------------------------------------------------------ +r11001 | zimmerma | 2016-12-09 08:46:20 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + +[add1sp.c] added comment + +------------------------------------------------------------------------ +r11000 | zimmerma | 2016-12-09 08:26:54 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + +[add1sp.c] simplified mpfr_add1sp2() + +------------------------------------------------------------------------ +r10999 | zimmerma | 2016-12-09 07:54:55 +0000 (Fri, 09 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[sub1sp.c] in mpfr_sub1sp2(), compute a0 before a1 whenever possible + +------------------------------------------------------------------------ +r10998 | vlefevre | 2016-12-09 00:33:52 +0000 (Fri, 09 Dec 2016) | 1 line +Changed paths: + M /trunk/tools/mbench/mfv5.cc + +[tools/mbench/mfv5.cc] Fixed type. +------------------------------------------------------------------------ +r10997 | zimmerma | 2016-12-08 17:16:48 +0000 (Thu, 08 Dec 2016) | 2 lines +Changed paths: + M /trunk/tools/mbench/timp.h + +[mbench] fixed typo + +------------------------------------------------------------------------ +r10995 | vlefevre | 2016-12-08 12:34:52 +0000 (Thu, 08 Dec 2016) | 1 line +Changed paths: + M /trunk/src/sub1sp.c + M /trunk/tests/tcheck.c + +Replaced two ~0 with mp_limb_t target by MPFR_LIMB_MAX. +------------------------------------------------------------------------ +r10994 | vlefevre | 2016-12-08 12:25:17 +0000 (Thu, 08 Dec 2016) | 2 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Added a test detecting code like ~0 (either an error +or poorly written code). +------------------------------------------------------------------------ +r10993 | zimmerma | 2016-12-08 11:00:19 +0000 (Thu, 08 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + M /trunk/src/sub1sp.c + +improved add1sp.c and sub1sp.c like in r10991 + +------------------------------------------------------------------------ +r10992 | zimmerma | 2016-12-08 10:59:09 +0000 (Thu, 08 Dec 2016) | 2 lines +Changed paths: + M /trunk/tools/mbench/mfv5.cc + +[mbench] set default max_exp to 1 (independent of number of bits per limb) + +------------------------------------------------------------------------ +r10991 | zimmerma | 2016-12-08 10:32:38 +0000 (Thu, 08 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[sub1sp.c] improved further + +------------------------------------------------------------------------ +r10990 | zimmerma | 2016-12-08 08:46:31 +0000 (Thu, 08 Dec 2016) | 2 lines +Changed paths: + M /trunk/tools/mbench/mfv5.cc + +[mbench] use mpfr_printf to print test numbers + +------------------------------------------------------------------------ +r10989 | zimmerma | 2016-12-08 08:23:26 +0000 (Thu, 08 Dec 2016) | 2 lines +Changed paths: + M /trunk/tools/mbench/mfv5.cc + +fixed bug in mfv5 (numbers used were 10 times too large) + +------------------------------------------------------------------------ +r10987 | zimmerma | 2016-12-07 16:21:48 +0000 (Wed, 07 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[sub1sp.c] corrected a comment, added another one + +------------------------------------------------------------------------ +r10986 | vlefevre | 2016-12-07 15:46:22 +0000 (Wed, 07 Dec 2016) | 1 line +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] Typo in a comment. +------------------------------------------------------------------------ +r10985 | vlefevre | 2016-12-07 15:35:15 +0000 (Wed, 07 Dec 2016) | 1 line +Changed paths: + M /trunk/src/pow.c + +[src/pow.c] Punctuation to make clear that there are 2 sentences. +------------------------------------------------------------------------ +r10984 | zimmerma | 2016-12-07 15:29:27 +0000 (Wed, 07 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + M /trunk/src/sub1sp.c + +likewise r10983 + +------------------------------------------------------------------------ +r10983 | zimmerma | 2016-12-07 15:06:48 +0000 (Wed, 07 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + +[add1sp.c] improved a conditional (if compiler is not smart enough) + +------------------------------------------------------------------------ +r10982 | zimmerma | 2016-12-07 13:14:33 +0000 (Wed, 07 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/exp_2.c + +[exp_2.c] small improvements + +------------------------------------------------------------------------ +r10981 | vlefevre | 2016-12-07 12:13:21 +0000 (Wed, 07 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] MPFR_INT_CEIL_LOG2(x) macro: added a FIXME and an +assertion concerning whether x <= ULONG_MAX or not. +------------------------------------------------------------------------ +r10980 | vlefevre | 2016-12-07 11:52:48 +0000 (Wed, 07 Dec 2016) | 1 line +Changed paths: + M /trunk/src/pow.c + +[src/pow.c] Added an assertion. +------------------------------------------------------------------------ +r10979 | zimmerma | 2016-12-07 11:51:24 +0000 (Wed, 07 Dec 2016) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + +[algorithms.tex] fixed typo + +------------------------------------------------------------------------ +r10978 | zimmerma | 2016-12-07 11:10:01 +0000 (Wed, 07 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/pow.c + +[pow.c] tuned starting precision (and removed obsolete comment) + +------------------------------------------------------------------------ +r10977 | zimmerma | 2016-12-07 10:42:04 +0000 (Wed, 07 Dec 2016) | 2 lines +Changed paths: + M /trunk/src/pow.c + +use MPFR_INT_CEIL_LOG2 + +------------------------------------------------------------------------ +r10973 | zimmerma | 2016-12-06 17:12:59 +0000 (Tue, 06 Dec 2016) | 2 lines +Changed paths: + M /trunk/tools/mbench/mfv5.cc + M /trunk/tools/mbench/mfv5.h + +[mfv5] added option -e, for example use -e1 to avoid over/underflow in mpfr_pow + +------------------------------------------------------------------------ +r10972 | zimmerma | 2016-12-06 17:11:42 +0000 (Tue, 06 Dec 2016) | 3 lines +Changed paths: + M /trunk/src/pow.c + +[pow.c] reduced overhead of special cases (gives speedup of a factor of two + for 53 bits of precision) + +------------------------------------------------------------------------ +r10970 | zimmerma | 2016-12-06 14:16:33 +0000 (Tue, 06 Dec 2016) | 2 lines +Changed paths: + M /trunk/tools/mbench/mfv5-mpfr.cc + +added mpfr_pow + +------------------------------------------------------------------------ +r10969 | vlefevre | 2016-12-06 08:22:02 +0000 (Tue, 06 Dec 2016) | 2 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Correction for zsh change after v5.2 (POSIX compat: +"set -e; f() { false && true; }; f; echo OK" no longer prints OK). +------------------------------------------------------------------------ +r10964 | vlefevre | 2016-11-29 16:06:33 +0000 (Tue, 29 Nov 2016) | 8 lines +Changed paths: + M /trunk/src/mpfr-gmp.h + M /trunk/src/mulders.c + +Check that the numberof() macro is used on an array. + * src/mpfr-gmp.h: define numberof_const() macro, equivalent to the + old numberof() macro: no check, but constant expression; improved + the numberof() macro to check that it is used on an array (since + an array can silently be converted to a pointer in C). Note that + potential failures are currently reported at run time. + * src/mulders.c: replaced numberof by numberof_const in #define's + (also removed a useless cast at the same time). +------------------------------------------------------------------------ +r10963 | vlefevre | 2016-11-17 22:28:27 +0000 (Thu, 17 Nov 2016) | 2 lines +Changed paths: + M /trunk/src/set_ld.c + M /trunk/tests/tset_ld.c + +[src/set_ld.c,tests/tset_ld.c] Updated comments, in particular +concerning LDBL_MAX. +------------------------------------------------------------------------ +r10961 | vlefevre | 2016-11-15 13:59:58 +0000 (Tue, 15 Nov 2016) | 3 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Added an overflow test that triggers a bug for +double-double (IBM long double format). See: + https://sympa.inria.fr/sympa/arc/mpfr/2016-11/msg00006.html +------------------------------------------------------------------------ +r10960 | vlefevre | 2016-11-15 13:48:27 +0000 (Tue, 15 Nov 2016) | 5 lines +Changed paths: + M /trunk/src/get_ld.c + +[src/get_ld.c] Fixed bugs for double-double (IBM long double format): + * one from r8650, which could yield a spurious assertion failure + in debug mode in case of underflow (with result 0); + * one from r8972, which used the variable sign uninitialized and + could yield a result with an incorrect sign. +------------------------------------------------------------------------ +r10959 | vlefevre | 2016-11-15 13:16:04 +0000 (Tue, 15 Nov 2016) | 1 line +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Added a missing exit(1). +------------------------------------------------------------------------ +r10958 | vlefevre | 2016-11-15 09:44:27 +0000 (Tue, 15 Nov 2016) | 7 lines +Changed paths: + M /trunk/tests/tget_d.c + M /trunk/tests/tget_d_2exp.c + M /trunk/tests/tget_ld_2exp.c + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tset_ld.c + +[tests] _GMP_IEEE_FLOATS was got rid of in r10150, but still used in +the tests, meaning that some tests were no longer done. So, get rid of +_GMP_IEEE_FLOATS also in the tests. Testing !defined(MPFR_ERRDIVZERO) +or defined(HAVE_SIGNEDZ) should be sufficient, depending on the context +(they were already used alone at some other places, so that new failures +are unlikely); anyway, _GMP_IEEE_FLOATS was not the right macro to test. +Only tget_set_d64.c has a specific change to use _MPFR_IEEE_FLOATS. +------------------------------------------------------------------------ +r10957 | vlefevre | 2016-11-15 08:43:19 +0000 (Tue, 15 Nov 2016) | 2 lines +Changed paths: + M /trunk/src/get_ld.c + +[src/get_ld.c] For double-double (IBM long double format): test other +special values, as this may be useful. +------------------------------------------------------------------------ +r10956 | vlefevre | 2016-11-15 07:41:32 +0000 (Tue, 15 Nov 2016) | 4 lines +Changed paths: + M /trunk/src/get_ld.c + +[src/get_ld.c] For double-double (IBM long double format), the code +was incorrect on large finite values, which are infinite as a double: +(+inf) + (-inf) was computed, which is NaN (thanks to Rob for the +report). Fixed this bug, with code clean up (not tested). +------------------------------------------------------------------------ +r10954 | vlefevre | 2016-11-10 15:45:24 +0000 (Thu, 10 Nov 2016) | 2 lines +Changed paths: + M /trunk/INSTALL + +[INSTALL] Added a note about MinGW and libtool error "libobj name ... +may not contain shell special characters.", with a solution. +------------------------------------------------------------------------ +r10953 | vlefevre | 2016-11-09 04:27:57 +0000 (Wed, 09 Nov 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Final corrections. +------------------------------------------------------------------------ +r10952 | vlefevre | 2016-11-09 03:52:03 +0000 (Wed, 09 Nov 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Another correction due to the rewrite for reuse support. +------------------------------------------------------------------------ +r10951 | vlefevre | 2016-11-09 03:20:29 +0000 (Wed, 09 Nov 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Correction. +------------------------------------------------------------------------ +r10944 | vlefevre | 2016-11-08 10:07:52 +0000 (Tue, 08 Nov 2016) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Added a short explanation for halfway cases. +------------------------------------------------------------------------ +r10943 | vlefevre | 2016-11-08 01:04:49 +0000 (Tue, 08 Nov 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Improved an example (from my ARITH-23 slides). +------------------------------------------------------------------------ +r10942 | vlefevre | 2016-11-08 00:59:47 +0000 (Tue, 08 Nov 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] English usage. +------------------------------------------------------------------------ +r10941 | vlefevre | 2016-11-07 14:17:28 +0000 (Mon, 07 Nov 2016) | 2 lines +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Explained the handling of halfway cases for sq = 1 +(since the explanations for sq ≥ 2 are not valid for sq = 1). +------------------------------------------------------------------------ +r10940 | vlefevre | 2016-11-07 14:06:50 +0000 (Mon, 07 Nov 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Minor update. +------------------------------------------------------------------------ +r10939 | vlefevre | 2016-11-07 03:47:24 +0000 (Mon, 07 Nov 2016) | 2 lines +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Last corrections. Concerning the setting of the sign of +the result, this changed with the support for precision 1 (see r10068). +------------------------------------------------------------------------ +r10938 | vlefevre | 2016-11-07 03:03:06 +0000 (Mon, 07 Nov 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Correction (English). +------------------------------------------------------------------------ +r10937 | vlefevre | 2016-11-07 02:41:11 +0000 (Mon, 07 Nov 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Correction about neg / sgn. +------------------------------------------------------------------------ +r10936 | vlefevre | 2016-11-07 01:47:17 +0000 (Mon, 07 Nov 2016) | 2 lines +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Added details about the handling of halfway cases, as +the rule is not obvious due to two's complement representation. +------------------------------------------------------------------------ +r10935 | vlefevre | 2016-11-06 23:46:57 +0000 (Sun, 06 Nov 2016) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Cosmetic change for consistency between lbit and rbit. +------------------------------------------------------------------------ +r10934 | vlefevre | 2016-11-06 22:39:38 +0000 (Sun, 06 Nov 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Minor update. +------------------------------------------------------------------------ +r10933 | vlefevre | 2016-11-04 13:55:53 +0000 (Fri, 04 Nov 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] A bit more explanations. +------------------------------------------------------------------------ +r10932 | vlefevre | 2016-11-04 12:52:58 +0000 (Fri, 04 Nov 2016) | 3 lines +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Corrected the usage of the HYPHEN-MINUS character (-): + * If it is a minus sign, use U+2212 MINUS SIGN (as already done). + * Do not use "-" after the "non" and "pre" prefixes. +------------------------------------------------------------------------ +r10931 | vlefevre | 2016-11-04 10:32:55 +0000 (Fri, 04 Nov 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Minor improvement. +------------------------------------------------------------------------ +r10929 | vlefevre | 2016-10-27 15:25:34 +0000 (Thu, 27 Oct 2016) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Replaced "TZ=UTC" by "TZ=GMT0" for portability. +------------------------------------------------------------------------ +r10928 | vlefevre | 2016-10-27 13:54:43 +0000 (Thu, 27 Oct 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Added a note. +------------------------------------------------------------------------ +r10927 | vlefevre | 2016-10-27 13:51:11 +0000 (Thu, 27 Oct 2016) | 2 lines +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Update for the current code (support of reused arguments); +some other improvements. +------------------------------------------------------------------------ +r10926 | vlefevre | 2016-10-27 13:47:16 +0000 (Thu, 27 Oct 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Corrected 2 typos. +------------------------------------------------------------------------ +r10925 | vlefevre | 2016-10-27 12:30:01 +0000 (Thu, 27 Oct 2016) | 5 lines +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Changed a MPN_COPY_DECR to MPN_COPY, which may be more +efficient: as of r10464 (support for reused arguments), the memory +used by the accumulator for the TMD resolution is no longer a part +of the main accumulator, so that we now know that the memory blocks +do not overlap. +------------------------------------------------------------------------ +r10924 | vlefevre | 2016-10-26 13:46:28 +0000 (Wed, 26 Oct 2016) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Corrected a comment from r10503. +------------------------------------------------------------------------ +r10923 | vlefevre | 2016-10-26 13:39:20 +0000 (Wed, 26 Oct 2016) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Moved/rewrote a comment (should have been done in r10467). +------------------------------------------------------------------------ +r10922 | vlefevre | 2016-10-25 14:49:00 +0000 (Tue, 25 Oct 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Started the update for the code supporting reuse. +------------------------------------------------------------------------ +r10920 | vlefevre | 2016-10-25 06:57:56 +0000 (Tue, 25 Oct 2016) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Fixed r10916 (thanks to Eli Zaretskii for the report). +------------------------------------------------------------------------ +r10918 | vlefevre | 2016-10-24 13:30:10 +0000 (Mon, 24 Oct 2016) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Improved a macro from r10916 (just in case...). +------------------------------------------------------------------------ +r10916 | vlefevre | 2016-10-24 12:53:55 +0000 (Mon, 24 Oct 2016) | 7 lines +Changed paths: + M /trunk/src/const_catalan.c + M /trunk/src/const_euler.c + M /trunk/src/const_log2.c + M /trunk/src/const_pi.c + M /trunk/src/exceptions.c + M /trunk/src/mpfr-impl.h + M /trunk/src/set_dfl_prec.c + M /trunk/src/set_rnd.c + +[src] Support build as thread-safe DLL on Windows: clean-up. + * Increased the use of macros to avoid some code duplication + (with risks of typos) and to prevent the problems related + to thread-safe DLL from appearing in the .c files. + * The prototypes of the functions to access the address of a + TLS variable are now defined. Otherwise one gets warnings: + https://sympa.inria.fr/sympa/arc/mpfr/2016-10/msg00004.html +------------------------------------------------------------------------ +r10915 | vlefevre | 2016-10-20 15:00:30 +0000 (Thu, 20 Oct 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Minor correction and improvement (English). +------------------------------------------------------------------------ +r10914 | vlefevre | 2016-10-20 14:22:35 +0000 (Thu, 20 Oct 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] "a" → "an" before "additional iteration". +------------------------------------------------------------------------ +r10912 | vlefevre | 2016-10-18 08:06:35 +0000 (Tue, 18 Oct 2016) | 1 line +Changed paths: + M /trunk/src/mpfr-gmp.h + +[src/mpfr-gmp.h] Updated a comment about bit-fields. +------------------------------------------------------------------------ +r10902 | vlefevre | 2016-09-27 15:10:30 +0000 (Tue, 27 Sep 2016) | 8 lines +Changed paths: + M /trunk/src/init2.c + M /trunk/src/mpfr-impl.h + M /trunk/src/round_prec.c + M /trunk/src/set_prec.c + +[src] + * mpfr-impl.h: document the memory allocated for a significand; + added a cast to avoid a direct conversion from mp_limb_t * to + mp_size_t *. + * init2.c, round_prec.c, set_prec.c: code clean-up by correcting + the type expected for the second argument of MPFR_SET_MANT_PTR + (this macro has a cast, so that this should not change anything, + but the old type mpfr_limb_ptr was meaningless and confusing). +------------------------------------------------------------------------ +r10890 | vlefevre | 2016-09-23 14:19:16 +0000 (Fri, 23 Sep 2016) | 1 line +Changed paths: + M /trunk/examples/version.c + +[examples/version.c] For MPFR >= 4, output float128 support info. +------------------------------------------------------------------------ +r10888 | vlefevre | 2016-09-23 14:06:48 +0000 (Fri, 23 Sep 2016) | 1 line +Changed paths: + M /trunk/examples/version.c + +[examples/version.c] A bit more output. +------------------------------------------------------------------------ +r10886 | vlefevre | 2016-09-23 13:47:14 +0000 (Fri, 23 Sep 2016) | 4 lines +Changed paths: + M /trunk/examples/version.c + +[examples/version.c] + * Really support C++ compilers (tested with g++ 6.2.0). + * Output information about the C implementation. + * Detect MPIR (→ output information on MPIR instead of GMP). +------------------------------------------------------------------------ +r10885 | vlefevre | 2016-09-23 13:14:12 +0000 (Fri, 23 Sep 2016) | 5 lines +Changed paths: + M /trunk/examples/version.c + +[examples/version.c] + * Code simplification: support for MPFR versions less than 3.0 had + already been dropped with the use of MPFR_RNDN. + * For MPFR patches, output "[none]" when there are no patches. + * Output mpfr_ptr size. +------------------------------------------------------------------------ +r10884 | vlefevre | 2016-09-21 15:11:16 +0000 (Wed, 21 Sep 2016) | 2 lines +Changed paths: + M /trunk/src/sin_cos.c + +[src/sin_cos.c] Avoid the reuse of variables for two completely +different things (with different orders of magnitude)! Changed types. +------------------------------------------------------------------------ +r10883 | vlefevre | 2016-09-21 15:06:52 +0000 (Wed, 21 Sep 2016) | 3 lines +Changed paths: + M /trunk/src/exp3.c + +[src/exp3.c] Avoid the reuse of variables for two completely different +things (with different orders of magnitude)! Added a cast to avoid a +potential integer overflow (like in r10881). +------------------------------------------------------------------------ +r10882 | vlefevre | 2016-09-21 15:05:07 +0000 (Wed, 21 Sep 2016) | 2 lines +Changed paths: + M /trunk/src/atan.c + +[src/atan.c] Avoid the reuse of variables for two completely different +things (with different orders of magnitude)! Changed types. +------------------------------------------------------------------------ +r10881 | vlefevre | 2016-09-21 13:54:01 +0000 (Wed, 21 Sep 2016) | 6 lines +Changed paths: + M /trunk/src/atan.c + M /trunk/src/sin_cos.c + +[src/{atan.c,sin_cos.c}] Added casts to avoid potential integer +overflows. Possible issue reported by David Binderman: + https://sympa.inria.fr/sympa/arc/mpfr/2016-09/msg00029.html +Note: From tests I've done on mpfr_atan, there would be issues with +16-bit int, but for 32-bit int, one could need several hundreds of +billions of bits for the target precision. +------------------------------------------------------------------------ +r10880 | vlefevre | 2016-09-21 11:34:52 +0000 (Wed, 21 Sep 2016) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] "To make a release": updated paragraph about warnings. +------------------------------------------------------------------------ +r10879 | vlefevre | 2016-09-21 11:12:23 +0000 (Wed, 21 Sep 2016) | 4 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] In the MPFR_RET macro, avoid the use of an integer +in a boolean context (even though that this is not wrong in C). Fix +after a bug report from David Binderman. Explanations: + https://sympa.inria.fr/sympa/arc/mpfr/2016-09/msg00028.html +------------------------------------------------------------------------ +r10878 | vlefevre | 2016-09-16 13:34:49 +0000 (Fri, 16 Sep 2016) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + +[doc/algorithms.tex] Riemann Zeta function, case s < 1/2: added a +paragraph on the sin(...) term of the reflection formula. +------------------------------------------------------------------------ +r10877 | vlefevre | 2016-09-16 13:05:04 +0000 (Fri, 16 Sep 2016) | 1 line +Changed paths: + M /trunk/doc/algorithms.tex + +[doc/algorithms.tex] More work on the Riemann Zeta function. +------------------------------------------------------------------------ +r10876 | vlefevre | 2016-09-15 13:31:39 +0000 (Thu, 15 Sep 2016) | 4 lines +Changed paths: + M /trunk/doc/algorithms.tex + +[doc/algorithms.tex] Riemann Zeta function, case s < 1/2: added a +paragraph briefly describing how the precisions of the variables +will be chosen (this is much more efficient than the current code +when the target precision is much lower than the input precision). +------------------------------------------------------------------------ +r10875 | vlefevre | 2016-09-15 13:17:58 +0000 (Thu, 15 Sep 2016) | 10 lines +Changed paths: + M /trunk/doc/algorithms.tex + M /trunk/src/zeta.c + +Some improvements / corrections in the description / proof of the +algorithm for the Riemann Zeta function. + * doc/algorithms.tex, section on the Riemann Zeta function: the case + s < 1/2 (reflection formula) is now in a new section, which needs + to be completed (with the detailed algorithm and error analysis); + case "s close to 0" added and now properly proved. + * src/zeta.c: update of the comment for s close to 0 (the brief + explanations were wrong for precision 1, and this was apparently + not checked when we allowed this precision!), adding a reference + to algorithms.tex for details. +------------------------------------------------------------------------ +r10874 | vlefevre | 2016-09-14 14:35:33 +0000 (Wed, 14 Sep 2016) | 3 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] In "[[…]]" conditional expressions, replaced "=" +by the preferred (and equivalent) form "==". +Discussion: http://www.zsh.org/mla/workers/2016/msg01711.html +------------------------------------------------------------------------ +r10872 | vlefevre | 2016-09-14 07:59:27 +0000 (Wed, 14 Sep 2016) | 1 line +Changed paths: + M /trunk/tests/tdiv.c + +[tests/tdiv.c] Improved code readability (related to r10871). +------------------------------------------------------------------------ +r10871 | zimmerma | 2016-09-14 06:39:43 +0000 (Wed, 14 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tdiv.c + +[tests/tdiv.c] improved code (found by David Binderman using cppcheck) + +------------------------------------------------------------------------ +r10870 | vlefevre | 2016-09-14 01:09:00 +0000 (Wed, 14 Sep 2016) | 3 lines +Changed paths: + M /trunk/tools/announce-text + +[tools/announce-text] Use the 64-bit key ID instead of the 32-bit one +since there are known collisions for 32-bit key ID's: +https://evil32.com/ +------------------------------------------------------------------------ +r10865 | vlefevre | 2016-09-13 15:11:11 +0000 (Tue, 13 Sep 2016) | 4 lines +Changed paths: + M /trunk/src/zeta.c + M /trunk/tests/tzeta.c + +[src/zeta.c] Added a FIXME: bug in the error computation due to the + use of the native double C type, which can yield an overflow. +[tests/tzeta.c] Added a corresponding test case, which gives an + assertion failure. +------------------------------------------------------------------------ +r10864 | vlefevre | 2016-09-13 14:53:46 +0000 (Tue, 13 Sep 2016) | 3 lines +Changed paths: + M /trunk/src/uceil_log2.c + M /trunk/src/ufloor_log2.c + +[src/{uceil_log2.c,ufloor_log2.c}] Added "MPFR_ASSERTN (exp < 1023);" +to get an assertion failure on infinities (which do not have an +exponent). +------------------------------------------------------------------------ +r10863 | vlefevre | 2016-09-13 14:50:38 +0000 (Tue, 13 Sep 2016) | 1 line +Changed paths: + M /trunk/src/uceil_log2.c + +[src/uceil_log2.c] Code style. +------------------------------------------------------------------------ +r10862 | vlefevre | 2016-09-13 14:46:08 +0000 (Tue, 13 Sep 2016) | 1 line +Changed paths: + M /trunk/src/ufloor_log2.c + +[src/ufloor_log2.c] Code style. +------------------------------------------------------------------------ +r10861 | vlefevre | 2016-09-13 14:05:24 +0000 (Tue, 13 Sep 2016) | 1 line +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] Make explicit that we need to use lngamma. +------------------------------------------------------------------------ +r10860 | vlefevre | 2016-09-13 13:58:51 +0000 (Tue, 13 Sep 2016) | 1 line +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] Updated comments on overflows / underflows. +------------------------------------------------------------------------ +r10859 | vlefevre | 2016-09-13 09:02:16 +0000 (Tue, 13 Sep 2016) | 3 lines +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] About internal underflows / cancellation: + * Added comments to FIXME's. + * Detect a potential integer overflow with MPFR_ASSERTN. +------------------------------------------------------------------------ +r10851 | vlefevre | 2016-09-12 10:11:31 +0000 (Mon, 12 Sep 2016) | 1 line +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Moved a comment. +------------------------------------------------------------------------ +r10850 | vlefevre | 2016-09-12 10:05:12 +0000 (Mon, 12 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Fixed print_binary (and no longer any failure with +gcc -mpc64 on x86). +------------------------------------------------------------------------ +r10849 | vlefevre | 2016-09-12 09:44:19 +0000 (Mon, 12 Sep 2016) | 1 line +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Corrected note in print_binary. +------------------------------------------------------------------------ +r10848 | vlefevre | 2016-09-12 09:42:56 +0000 (Mon, 12 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Reverted r10847 (it was incomplete and I was testing +the wrong code). +------------------------------------------------------------------------ +r10847 | vlefevre | 2016-09-12 09:40:34 +0000 (Mon, 12 Sep 2016) | 1 line +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Fixed print_binary. +------------------------------------------------------------------------ +r10846 | vlefevre | 2016-09-12 09:13:52 +0000 (Mon, 12 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Added a FIXME in print_binary, which can yield an +incorrect output and return a wrong precision (causing the failure). +------------------------------------------------------------------------ +r10845 | vlefevre | 2016-09-12 09:08:38 +0000 (Mon, 12 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Added a test that triggers a failure with gcc -mpc64 +on x86 (64-bit ABI). +------------------------------------------------------------------------ +r10844 | vlefevre | 2016-09-12 08:48:04 +0000 (Mon, 12 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Added some tests in case the rounding precision is +smaller than MPFR_LDBL_MANT_DIG (e.g. with gcc -mpc64 on x86). +------------------------------------------------------------------------ +r10843 | vlefevre | 2016-09-12 08:09:24 +0000 (Mon, 12 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] In print_binary, added an assertion that may fail +with flush-to-zero on underflow (avoiding an infinite loop). +------------------------------------------------------------------------ +r10842 | vlefevre | 2016-09-12 08:03:58 +0000 (Mon, 12 Sep 2016) | 4 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Simplified a condition in print_binary (BTW, the old +condition was based on the fact that the rounding depended only on the +exact result, which may not be the case when rounding is not completely +specified, e.g. with double-double arithmetic like on PowerPC). +------------------------------------------------------------------------ +r10841 | vlefevre | 2016-09-12 07:15:30 +0000 (Mon, 12 Sep 2016) | 1 line +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Replaced a condition by a simpler, equivalent one. +------------------------------------------------------------------------ +r10840 | zimmerma | 2016-09-10 05:55:31 +0000 (Sat, 10 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] added note + +------------------------------------------------------------------------ +r10839 | zimmerma | 2016-09-09 14:41:49 +0000 (Fri, 09 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] get rid of C99-only stuff + +------------------------------------------------------------------------ +r10838 | vlefevre | 2016-09-09 14:32:14 +0000 (Fri, 09 Sep 2016) | 1 line +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Removed a variable that is no longer used. +------------------------------------------------------------------------ +r10837 | vlefevre | 2016-09-09 12:49:59 +0000 (Fri, 09 Sep 2016) | 1 line +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] FIXME: nextafterl and ilogbl are C99 only. +------------------------------------------------------------------------ +r10836 | zimmerma | 2016-09-09 11:13:31 +0000 (Fri, 09 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] fixed computation of smallest subnormal using nextafterl + +------------------------------------------------------------------------ +r10835 | zimmerma | 2016-09-09 11:09:48 +0000 (Fri, 09 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] added warning + +------------------------------------------------------------------------ +r10834 | zimmerma | 2016-09-09 10:52:27 +0000 (Fri, 09 Sep 2016) | 3 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] fixed print_binary() for when the rounding precision is less + than the precision of long double + +------------------------------------------------------------------------ +r10833 | vlefevre | 2016-09-09 09:02:16 +0000 (Fri, 09 Sep 2016) | 2 lines +Changed paths: + M /trunk/src/get_ld.c + M /trunk/tests/tset_ld.c + +[src/get_ld.c] Replaced FIXME by an explanation of the current behavior. +[tests/tset_ld.c] Added a FIXME as a consequence. +------------------------------------------------------------------------ +r10832 | vlefevre | 2016-09-09 00:23:59 +0000 (Fri, 09 Sep 2016) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Update about NetBSD. +------------------------------------------------------------------------ +r10829 | vlefevre | 2016-09-08 16:37:56 +0000 (Thu, 08 Sep 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Corrected a spelling mistake. +------------------------------------------------------------------------ +r10828 | vlefevre | 2016-09-08 16:15:18 +0000 (Thu, 08 Sep 2016) | 1 line +Changed paths: + M /trunk/src/get_ld.c + +[src/get_ld.c] Updated FIXME (mention subnormals). +------------------------------------------------------------------------ +r10827 | vlefevre | 2016-09-08 15:48:59 +0000 (Thu, 08 Sep 2016) | 1 line +Changed paths: + M /trunk/src/get_ld.c + +[src/get_ld.c] Updated FIXME (this is NetBSD 5.1). +------------------------------------------------------------------------ +r10826 | vlefevre | 2016-09-08 15:35:19 +0000 (Thu, 08 Sep 2016) | 1 line +Changed paths: + M /trunk/src/get_ld.c + +[src/get_ld.c] Added a FIXME, in particular for NetBSD. +------------------------------------------------------------------------ +r10825 | vlefevre | 2016-09-08 15:17:10 +0000 (Thu, 08 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Avoid a freeze in print_binary under NetBSD due to +excess precision in LDBL_MAX (we do not run the test in this case). +------------------------------------------------------------------------ +r10824 | zimmerma | 2016-09-08 14:22:04 +0000 (Thu, 08 Sep 2016) | 3 lines +Changed paths: + M /trunk/src/sqrt.c + M /trunk/tests/tsqrt.c + +[src/sqrt.c] fixed bug in mpfr_sqrt2 +[tests/tsqrt.c] added non-regression test + +------------------------------------------------------------------------ +r10823 | vlefevre | 2016-09-08 13:57:26 +0000 (Thu, 08 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] The print_binary function is freezing on a NetBSD +machine; let's start with some improvements (assertions...). +------------------------------------------------------------------------ +r10822 | vlefevre | 2016-09-08 13:31:38 +0000 (Thu, 08 Sep 2016) | 1 line +Changed paths: + M /trunk/tests/tabs.c + +[tests/tabs.c] Removed mpfr_test_init (not needed here). +------------------------------------------------------------------------ +r10821 | vlefevre | 2016-09-08 13:30:35 +0000 (Thu, 08 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Moved mpfr_test_init at the right place (like +tget_d.c, tset_d.c, etc.). +------------------------------------------------------------------------ +r10820 | zimmerma | 2016-09-08 13:30:14 +0000 (Thu, 08 Sep 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] divsp1 -> div_1 + +------------------------------------------------------------------------ +r10819 | vlefevre | 2016-09-08 13:24:00 +0000 (Thu, 08 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Fixed a loop in case an extended range is used +(there are issues on a NetBSD machine, and this could be a cause). +------------------------------------------------------------------------ +r10818 | vlefevre | 2016-09-08 13:19:12 +0000 (Thu, 08 Sep 2016) | 1 line +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Corrected a type (due to a printf with %ld). +------------------------------------------------------------------------ +r10817 | zimmerma | 2016-09-08 13:14:30 +0000 (Thu, 08 Sep 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] divsp1 -> div_1, divsp2 -> div_2 (not necessarily same precision) + +------------------------------------------------------------------------ +r10816 | zimmerma | 2016-09-08 13:12:14 +0000 (Thu, 08 Sep 2016) | 3 lines +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] mulsp1 -> mul_1, mulsp2 -> mul_2 (the precision of operands is not + necessarily the same) + +------------------------------------------------------------------------ +r10813 | vlefevre | 2016-09-08 00:15:19 +0000 (Thu, 08 Sep 2016) | 1 line +Changed paths: + M /trunk/src/get_d.c + M /trunk/src/get_ld.c + +[src/{get_d,get_ld}.c] Use MPFR_ALIAS. +------------------------------------------------------------------------ +r10812 | vlefevre | 2016-09-07 12:35:33 +0000 (Wed, 07 Sep 2016) | 9 lines +Changed paths: + M /trunk/src/get_ld.c + +[src/get_ld.c] Improved the fix done in r10808: The mpfr_set_emin value +is not changed, but let's make the LDBL_MIN_EXP and LDBL_MAX_EXP values +appear as expected. +Note: The code for x86 extended precision first appeared in r3226 with +the usual emin and emax values, as found in the IEEE 754-1985 standard +(bounds) or on . But +MPFR uses a different convention, with a significand between 1/2 and 1 +instead of between 1 and 2, so that these values were off by 1. The +emax one was fixed in r6101, but the error on emin remained undetected. +------------------------------------------------------------------------ +r10811 | vlefevre | 2016-09-07 09:39:52 +0000 (Wed, 07 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] The bug_20160907 test is valid only with +HAVE_LDOUBLE_IEEE_EXT_LITTLE. +------------------------------------------------------------------------ +r10810 | vlefevre | 2016-09-07 08:20:28 +0000 (Wed, 07 Sep 2016) | 1 line +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] Updated FIXME: also suggest a scaling. +------------------------------------------------------------------------ +r10809 | zimmerma | 2016-09-07 07:58:43 +0000 (Wed, 07 Sep 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] check more numbers in bug_20160907() + +------------------------------------------------------------------------ +r10808 | zimmerma | 2016-09-07 07:38:09 +0000 (Wed, 07 Sep 2016) | 2 lines +Changed paths: + M /trunk/src/get_ld.c + +[src/get_ld.c] fixed bug reported by Walter Mascarenhas + +------------------------------------------------------------------------ +r10807 | zimmerma | 2016-09-07 07:28:32 +0000 (Wed, 07 Sep 2016) | 3 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] added test that triggers bug in mpfr_get_ld + (https://sympa.inria.fr/sympa/arc/mpfr/2016-09/msg00005.html) + +------------------------------------------------------------------------ +r10806 | vlefevre | 2016-09-07 01:12:06 +0000 (Wed, 07 Sep 2016) | 1 line +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] Updated FIXME with a suggestion. +------------------------------------------------------------------------ +r10805 | vlefevre | 2016-09-07 01:05:34 +0000 (Wed, 07 Sep 2016) | 3 lines +Changed paths: + M /trunk/src/zeta.c + M /trunk/tests/tzeta.c + +[src/zeta.c] Added a FIXME: An overflow in gamma(s1) does not imply + that Zeta(s) will overflow. +[tests/tzeta.c] Added a test that triggers this bug with a 32-bit ABI. +------------------------------------------------------------------------ +r10804 | vlefevre | 2016-09-07 00:25:25 +0000 (Wed, 07 Sep 2016) | 3 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Concerning GCC's AddressSanitizer (-fsanitize=address), +mention that LD_PRELOAD needs to be unset (or -static-libasan needs to +be used, but does not work yet). +------------------------------------------------------------------------ +r10802 | zimmerma | 2016-09-06 14:04:02 +0000 (Tue, 06 Sep 2016) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + +[doc/algorithms.tex] l -> \ell + +------------------------------------------------------------------------ +r10801 | zimmerma | 2016-09-06 13:58:27 +0000 (Tue, 06 Sep 2016) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + +[doc/algorithms.tex] du -> {\mathrm d}u + +------------------------------------------------------------------------ +r10800 | zimmerma | 2016-09-06 13:45:18 +0000 (Tue, 06 Sep 2016) | 2 lines +Changed paths: + M /trunk/src/log_ui.c + +[src/log_ui.c] added FIXME + +------------------------------------------------------------------------ +r10799 | vlefevre | 2016-09-06 13:08:38 +0000 (Tue, 06 Sep 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Avoid a warning due to an unused variable with +GMP_NUMB_BITS == 32. +------------------------------------------------------------------------ +r10798 | vlefevre | 2016-09-06 12:33:16 +0000 (Tue, 06 Sep 2016) | 3 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Fixed m4_pattern_forbid argument to avoid an error with +recent ax_pthread.m4 (such as in Debian's autoconf-archive 20160320-1, +which has just appeared in unstable). +------------------------------------------------------------------------ +r10797 | vlefevre | 2016-09-06 11:46:31 +0000 (Tue, 06 Sep 2016) | 1 line +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] Updated FIXME. +------------------------------------------------------------------------ +r10796 | zimmerma | 2016-09-06 11:10:56 +0000 (Tue, 06 Sep 2016) | 2 lines +Changed paths: + M /trunk/src/zeta.c + +[src/zeta.c] added FIXME + +------------------------------------------------------------------------ +r10795 | zimmerma | 2016-09-06 06:57:17 +0000 (Tue, 06 Sep 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] added alternate code for mpn_sqrtrem4 (disabled for now) + +------------------------------------------------------------------------ +r10794 | zimmerma | 2016-09-05 15:46:32 +0000 (Mon, 05 Sep 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + M /trunk/src/mpfr-gmp.h + +move macros from div.c to mpfr-gmp.h + +------------------------------------------------------------------------ +r10790 | vlefevre | 2016-09-05 09:07:28 +0000 (Mon, 05 Sep 2016) | 3 lines +Changed paths: + M /trunk/TODO + M /trunk/tests/tzeta.c + +About the tzeta timing issue (since r9848): + * TODO: updated item on tzeta. + * tests/tzeta.c: updated FIXME for test_generic. +------------------------------------------------------------------------ +r10789 | vlefevre | 2016-09-05 08:50:16 +0000 (Mon, 05 Sep 2016) | 7 lines +Changed paths: + M /trunk/TODO + +[TODO] Updated item on tzeta: + * removed the old problem: the fact that the traces for the trunk and + for r9954 are different is normal (fixes in mpfr_can_round affecting + tgeneric.c), and the timings depend on GMP_CHECK_RANDOMIZE and seem + equivalent in average with "test_generic (..., 5);" in both cases; + * added the fact that tzeta has been much slower since r9848, at least + with the x86 32-bit ABI. +------------------------------------------------------------------------ +r10775 | vlefevre | 2016-09-02 07:07:31 +0000 (Fri, 02 Sep 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +Removed trailing whitespace. +------------------------------------------------------------------------ +r10774 | zimmerma | 2016-09-01 08:45:19 +0000 (Thu, 01 Sep 2016) | 13 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] new code for 2 limbs on 64-bit machines, giving speedup of almost + a factor of two: + +bavette.loria.fr (Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz) +numactl --physcpubind=0 ./mfv5 -p113 mpfr_sqrt + +3.1.4: + mpfr_sqrt: 234 / 243.72 / 258 + +4.0-dev: + mpfr_sqrt: 122 / 127.63 / 136 + + +------------------------------------------------------------------------ +r10773 | zimmerma | 2016-08-31 08:54:41 +0000 (Wed, 31 Aug 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] fixed error triggered by previous commit + +------------------------------------------------------------------------ +r10772 | zimmerma | 2016-08-31 08:50:17 +0000 (Wed, 31 Aug 2016) | 3 lines +Changed paths: + M /trunk/src/div.c + M /trunk/tests/tdiv.c + +[src/div.c] added missing assertion +[tests/tdiv.c] added test case that make new assertion fail (with --enable-assert --enable-gmp-internals on a 64-bit machine) + +------------------------------------------------------------------------ +r10771 | zimmerma | 2016-08-31 06:38:33 +0000 (Wed, 31 Aug 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] fixed bug found by Vincent + +------------------------------------------------------------------------ +r10770 | vlefevre | 2016-08-31 00:06:31 +0000 (Wed, 31 Aug 2016) | 2 lines +Changed paths: + M /trunk/tests/tdiv.c + +[tests/tdiv.c] Added a test triggering an assertion failure with +"--enable-assert --enable-gmp-internals". +------------------------------------------------------------------------ +r10769 | vlefevre | 2016-08-30 23:01:03 +0000 (Tue, 30 Aug 2016) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Update. +------------------------------------------------------------------------ +r10768 | vlefevre | 2016-08-30 22:58:50 +0000 (Tue, 30 Aug 2016) | 1 line +Changed paths: + M /trunk/src/div.c + +[src/div.c] Untabified. Clarified a comment. +------------------------------------------------------------------------ +r10767 | zimmerma | 2016-08-30 14:18:00 +0000 (Tue, 30 Aug 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] document mpn_sqrtrem2() + +------------------------------------------------------------------------ +r10766 | zimmerma | 2016-08-30 14:09:59 +0000 (Tue, 30 Aug 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] don't use mpfr_divsp1 and mpfr_divsp2 when MPFR_GENERIC_ABI is defined + +------------------------------------------------------------------------ +r10765 | zimmerma | 2016-08-30 12:10:24 +0000 (Tue, 30 Aug 2016) | 3 lines +Changed paths: + M /trunk/src/div.c + M /trunk/tests/tdiv.c + +[src/div.c] faster code for 2 limbs +[tests/tdiv.c] added special test for 2 limbs + +------------------------------------------------------------------------ +r10764 | vlefevre | 2016-08-30 07:21:07 +0000 (Tue, 30 Aug 2016) | 7 lines +Changed paths: + M /trunk/tests/mpfr-test.h + M /trunk/tests/tests.c + +[tests] Define global variable tests_memory_disabled, which needs to +be set when the memory.c allocators (to track memory leaks) must not +be used; i.e., setting it disables the calls to tests_memory_start() +and tests_memory_end(). In tests.c, it is initialized to 0 (unset), +except when mini-gmp is used (same behavior as before this commit). +Programs that test GMP's mp_set_memory_functions() need to set this +variable before calling tests_start_mpfr(). +------------------------------------------------------------------------ +r10763 | vlefevre | 2016-08-29 15:35:16 +0000 (Mon, 29 Aug 2016) | 4 lines +Changed paths: + A /trunk/tests/talloc-cache.c + +Added tests/talloc-cache.c (not run by "make check") testing multiple +calls to mp_set_memory_functions. It yields a crash in the MPFR trunk, +which is unexpected with the current code. However, in the 3.1 branch, +r9467 fixed the crash as expected. +------------------------------------------------------------------------ +r10762 | zimmerma | 2016-08-29 14:20:09 +0000 (Mon, 29 Aug 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] added Sage code used to generate the bipartite tables + +------------------------------------------------------------------------ +r10761 | vlefevre | 2016-08-29 13:50:47 +0000 (Mon, 29 Aug 2016) | 1 line +Changed paths: + M /trunk/tests/talloc.c + +[tests/talloc.c] Added a warning about new tests. +------------------------------------------------------------------------ +r10760 | zimmerma | 2016-08-29 13:20:14 +0000 (Mon, 29 Aug 2016) | 2 lines +Changed paths: + M /trunk/src/atan.c + +[src/atan.c] fixed TODOs, and simplified code + +------------------------------------------------------------------------ +r10759 | vlefevre | 2016-08-29 13:09:50 +0000 (Mon, 29 Aug 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added a FIXME comment about memory allocation. +------------------------------------------------------------------------ +r10758 | vlefevre | 2016-08-29 12:55:26 +0000 (Mon, 29 Aug 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r10757 | vlefevre | 2016-08-29 12:54:47 +0000 (Mon, 29 Aug 2016) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Done in r10756: unify is_power_of_two() and mpfr_powerof2_raw(). +------------------------------------------------------------------------ +r10756 | zimmerma | 2016-08-29 08:15:17 +0000 (Mon, 29 Aug 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + M /trunk/src/powerof2.c + M /trunk/src/round_prec.c + +unified is_power_of_two() and mpfr_powerof2_raw() + +------------------------------------------------------------------------ +r10755 | zimmerma | 2016-08-29 07:49:12 +0000 (Mon, 29 Aug 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] improved documentation of mpfr_free_cache() + +------------------------------------------------------------------------ +r10754 | vlefevre | 2016-08-28 17:48:57 +0000 (Sun, 28 Aug 2016) | 1 line +Changed paths: + M /trunk/tests/tcan_round.c + +[tests/tcan_round.c] Improved a test now that mpfr_can_round is exact. +------------------------------------------------------------------------ +r10753 | vlefevre | 2016-08-28 00:12:04 +0000 (Sun, 28 Aug 2016) | 1 line +Changed paths: + M /trunk/src/mpfr-gmp.h + +[src/mpfr-gmp.h] Added a warning about r10749. +------------------------------------------------------------------------ +r10752 | vlefevre | 2016-08-27 23:53:19 +0000 (Sat, 27 Aug 2016) | 6 lines +Changed paths: + M /trunk/src/round_prec.c + +[src/round_prec.c] Various corrections/improvements: + * Unified the return, making sure that temporary memory is no longer + used after MPFR_TMP_FREE(marker), which was not the case in some + places. + * C90 compatibility. + * Minor improvements (use of MPFR_PREC2LIMBS, code on 78 columns...). +------------------------------------------------------------------------ +r10751 | vlefevre | 2016-08-27 23:01:59 +0000 (Sat, 27 Aug 2016) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Added: unify is_power_of_two() and mpfr_powerof2_raw()? +------------------------------------------------------------------------ +r10750 | vlefevre | 2016-08-27 22:58:07 +0000 (Sat, 27 Aug 2016) | 3 lines +Changed paths: + M /trunk/src/atan2.c + M /trunk/src/mpfr-impl.h + +[src/atan2.c] Replaced the use of the MPFR_IS_POWER_OF_2(x) macro by + a more efficient solution based on mpfr_powerof2_raw(). +[src/mpfr-impl.h] Removed the now obsolete MPFR_IS_POWER_OF_2 macro. +------------------------------------------------------------------------ +r10749 | zimmerma | 2016-08-26 12:49:48 +0000 (Fri, 26 Aug 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-gmp.h + +[src/mpfr-gmp.h] added comment about GMP memory allocation functions + +------------------------------------------------------------------------ +r10748 | zimmerma | 2016-08-25 07:22:38 +0000 (Thu, 25 Aug 2016) | 3 lines +Changed paths: + M /trunk/src/round_p.c + +[src/round_p.c] since mpfr_can_round is now always correct, we cannot compare + it blindly to mpfr_round_p any more + +------------------------------------------------------------------------ +r10747 | zimmerma | 2016-08-24 15:48:39 +0000 (Wed, 24 Aug 2016) | 2 lines +Changed paths: + M /trunk/src/round_prec.c + +[src/round_prec.c] fixed mpfr_can_round() so that all tests of tcan_round pass + +------------------------------------------------------------------------ +r10746 | zimmerma | 2016-08-23 12:38:22 +0000 (Tue, 23 Aug 2016) | 2 lines +Changed paths: + M /trunk/tests/tcan_round.c + +[tests/tcan_round.c] more information in case of error in check_can_round() + +------------------------------------------------------------------------ +r10744 | vlefevre | 2016-08-22 18:53:46 +0000 (Mon, 22 Aug 2016) | 1 line +Changed paths: + M /trunk/tools/mbench/mfv5.cc + +[tools/mbench/mfv5.cc] Fixed code (C++11 compatibility). +------------------------------------------------------------------------ +r10743 | vlefevre | 2016-08-22 13:57:53 +0000 (Mon, 22 Aug 2016) | 4 lines +Changed paths: + M /trunk/tests/tcan_round.c + +[tests/tcan_round.c] Added a comprehensive test of mpfr_can_round, +based on a naive implementation. +Note: if the exit() is removed, many cases are failing, for both kinds +of answers (there might also remain an error in my test...). +------------------------------------------------------------------------ +r10741 | vlefevre | 2016-08-19 14:34:01 +0000 (Fri, 19 Aug 2016) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] More thoughts about mpz_t caching (mpz_t pool). +------------------------------------------------------------------------ +r10740 | vlefevre | 2016-08-19 13:59:11 +0000 (Fri, 19 Aug 2016) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Issues with mpz_t caching. +------------------------------------------------------------------------ +r10739 | vlefevre | 2016-08-19 12:07:55 +0000 (Fri, 19 Aug 2016) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Update about mpz_t caching (mpz_t pool). +------------------------------------------------------------------------ +r10738 | vlefevre | 2016-08-19 11:55:31 +0000 (Fri, 19 Aug 2016) | 2 lines +Changed paths: + M /trunk/src/atan.c + +[src/atan.c] Added TODO's to use mpz_init2 instead mpz_init: I could +check that without "mpz_t cache" (pool), this makes the code faster. +------------------------------------------------------------------------ +r10737 | vlefevre | 2016-08-19 11:52:01 +0000 (Fri, 19 Aug 2016) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added a note about memory reallocations; recommend +mpz_init2 with the estimated maximum size instead of mpz_init. +------------------------------------------------------------------------ +r10736 | vlefevre | 2016-08-19 08:54:30 +0000 (Fri, 19 Aug 2016) | 1 line +Changed paths: + M /trunk/tests/tests.c + +[tests/tests.c] Updated the error message on incorrect MPFR version. +------------------------------------------------------------------------ +r10735 | vlefevre | 2016-08-19 08:36:16 +0000 (Fri, 19 Aug 2016) | 1 line +Changed paths: + M /trunk/INSTALL + +[INSTALL] Added note on Solaris and the LD_OPTIONS environment variable. +------------------------------------------------------------------------ +r10734 | vlefevre | 2016-08-11 16:32:23 +0000 (Thu, 11 Aug 2016) | 3 lines +Changed paths: + M /trunk/tools/coverage + +[tools/coverage] Added a warning: on a machine shared with other users, +by running this script, the account can easily be compromised due to a +libtool bug. +------------------------------------------------------------------------ +r10732 | vlefevre | 2016-08-06 23:24:24 +0000 (Sat, 06 Aug 2016) | 3 lines +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Moved MPFR_DEPRECATED before __MPFR_DECLSPEC for +compatibility with MSVC (and documented this requirement). +Thanks to Brian Gladman for the information. +------------------------------------------------------------------------ +r10731 | vlefevre | 2016-08-04 23:31:17 +0000 (Thu, 04 Aug 2016) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added a note about the C++11 compatibility issue +with a string literal immediately followed by a macro name. +------------------------------------------------------------------------ +r10727 | vlefevre | 2016-08-04 15:06:52 +0000 (Thu, 04 Aug 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-longlong.h + M /trunk/src/rec_sqrt.c + M /trunk/tests/reuse.c + M /trunk/tests/tadd1sp.c + M /trunk/tests/taway.c + +Fixed remaining macros with missing "do" … "while (0)", detected with +mpfrlint. There were no consequences except spurious null statements. +------------------------------------------------------------------------ +r10726 | vlefevre | 2016-08-04 15:02:00 +0000 (Thu, 04 Aug 2016) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Added a comment. +------------------------------------------------------------------------ +r10725 | vlefevre | 2016-08-04 13:43:31 +0000 (Thu, 04 Aug 2016) | 5 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Added a test detecting (unsafe) macros of the form: + #define FOO { ... } +The following form is preferred in most of the cases to avoid spurious +null statements: + #define FOO do { ... } while (0) +------------------------------------------------------------------------ +r10724 | vlefevre | 2016-08-04 13:17:31 +0000 (Thu, 04 Aug 2016) | 2 lines +Changed paths: + M /trunk/tests/tsi_op.c + +[tests/tsi_op.c] Fixed a macro. There were no consequences except +spurious null statements. +------------------------------------------------------------------------ +r10723 | vlefevre | 2016-08-04 12:30:53 +0000 (Thu, 04 Aug 2016) | 1 line +Changed paths: + M /trunk/tests/tset_si.c + M /trunk/tests/tset_sj.c + +[tests/tset_{si,sj}.c] Style improvements. Added a comment. +------------------------------------------------------------------------ +r10721 | vlefevre | 2016-08-04 12:17:34 +0000 (Thu, 04 Aug 2016) | 2 lines +Changed paths: + M /trunk/tests/tset_si.c + M /trunk/tests/tset_sj.c + +[tests/tset_{si,sj}.c] Fixed macros. There were no consequences except +spurious null statements. +------------------------------------------------------------------------ +r10719 | vlefevre | 2016-08-04 01:48:33 +0000 (Thu, 04 Aug 2016) | 5 lines +Changed paths: + M /trunk/tests/tpow_z.c + M /trunk/tests/tset_si.c + M /trunk/tests/tset_sj.c + M /trunk/tests/tsi_op.c + +[tests] C++ compatibility: avoid errors with "g++ -std=c++11" or later. +Note that as of GCC 6, "the default mode for C++ is now -std=gnu++14 +instead of -std=gnu++98" . +So, this fixes the failures in the build of the MPFR tests with g++ +from GCC 6 without particular options. +------------------------------------------------------------------------ +r10718 | vlefevre | 2016-08-03 16:23:55 +0000 (Wed, 03 Aug 2016) | 1 line +Changed paths: + M /trunk/src/round_prec.c + +[src/round_prec.c] mpfr_can_round_raw: added another FIXME. +------------------------------------------------------------------------ +r10717 | vlefevre | 2016-08-03 16:02:40 +0000 (Wed, 03 Aug 2016) | 2 lines +Changed paths: + M /trunk/src/round_prec.c + +[src/round_prec.c] mpfr_can_round_raw: added an assertion, corrected +a condition in a comment, and added comments, showing a new bug. +------------------------------------------------------------------------ +r10716 | vlefevre | 2016-08-02 15:25:58 +0000 (Tue, 02 Aug 2016) | 1 line +Changed paths: + M /trunk/tests/tmul.c + +[tests/tmul.c] Various corrections and improvements in test_underflow. +------------------------------------------------------------------------ +r10714 | vlefevre | 2016-08-02 11:04:48 +0000 (Tue, 02 Aug 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Mark mpfr_grandom as deprecated (this had already been done +in mpfr.texi r8548). +------------------------------------------------------------------------ +r10713 | vlefevre | 2016-08-02 10:29:36 +0000 (Tue, 02 Aug 2016) | 1 line +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Suggest MPFR_EXPERIMENTAL for experimental functions. +------------------------------------------------------------------------ +r10712 | vlefevre | 2016-08-01 12:40:38 +0000 (Mon, 01 Aug 2016) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Correction in the info about the C implementation. +------------------------------------------------------------------------ +r10711 | vlefevre | 2016-08-01 12:26:15 +0000 (Mon, 01 Aug 2016) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Corrections in the info about the C implementation. +------------------------------------------------------------------------ +r10710 | vlefevre | 2016-08-01 09:56:19 +0000 (Mon, 01 Aug 2016) | 3 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Corrected a bound in the proof of mpfr_sqrt1 (one-limb +precisions), related to the right shift of a negative value. Added +a warning and a TODO about such an operation. +------------------------------------------------------------------------ +r10709 | vlefevre | 2016-08-01 09:06:06 +0000 (Mon, 01 Aug 2016) | 6 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Enable mpfr_sqrt1 code for one-limb precisions (which +depends on implementation-defined features of the C standard) only +when __GNUC__ is defined, as it is known to be correct with GCC and +compatible compilers, but nothing is known yet for other compilers. +Removed the corresponding FIXME and added a note. In the future, a +configure test could be used as an alternative solution. +------------------------------------------------------------------------ +r10708 | vlefevre | 2016-08-01 08:37:09 +0000 (Mon, 01 Aug 2016) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Output more information about the C implementation. +------------------------------------------------------------------------ +r10707 | vlefevre | 2016-07-31 17:39:38 +0000 (Sun, 31 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Fixed some portability issues. +------------------------------------------------------------------------ +r10706 | vlefevre | 2016-07-31 17:32:32 +0000 (Sun, 31 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Fix if mp_limb_t > unsigned long (this fixed failures +with mingw-w64). +------------------------------------------------------------------------ +r10705 | vlefevre | 2016-07-31 17:30:28 +0000 (Sun, 31 Jul 2016) | 3 lines +Changed paths: + M /trunk/src/cos.c + M /trunk/src/lngamma.c + +[src/lngamma.c] Fix in case mp_limb_t is more than twice as large + as unsigned long (that would make it at least 128 bits). +[src/cos.c] Made code similar to the rest of the code. +------------------------------------------------------------------------ +r10704 | vlefevre | 2016-07-31 17:19:43 +0000 (Sun, 31 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/div_ui.c + +[src/div_ui.c] Improved a comment (to make it closer to what correct +C code should be), avoiding a false positive with mpfrlint. +------------------------------------------------------------------------ +r10703 | vlefevre | 2016-07-31 17:15:31 +0000 (Sun, 31 Jul 2016) | 2 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Detect possibly wrong code with some C/GMP +implementations, related to shifts and integer types. +------------------------------------------------------------------------ +r10702 | vlefevre | 2016-07-31 16:17:46 +0000 (Sun, 31 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Completed the FIXME (another portability issue). +------------------------------------------------------------------------ +r10701 | vlefevre | 2016-07-31 00:39:14 +0000 (Sun, 31 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Added a FIXME. The current code for prec < GMP_NUMB_BITS +is not portable. +------------------------------------------------------------------------ +r10700 | vlefevre | 2016-07-31 00:27:31 +0000 (Sun, 31 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Fixed code for implementations with 16-bit int's. +------------------------------------------------------------------------ +r10699 | vlefevre | 2016-07-31 00:23:11 +0000 (Sun, 31 Jul 2016) | 1 line +Changed paths: + M /trunk/tests/tsqrt.c + +[tests/tsqrt.c] Fixed output bug in a test. +------------------------------------------------------------------------ +r10698 | zimmerma | 2016-07-29 13:46:09 +0000 (Fri, 29 Jul 2016) | 10 lines +Changed paths: + M /trunk/NEWS + M /trunk/src/mul.c + +[src/mul.c] speedup for 2 limbs: numactl --physcpubind=0 ./mfv5 -p113 mpfr_mul + +3.1.5-dev: + mpfr_mul: 45 / 61.60 / 84 + +4.0-dev: + mpfr_mul: 30 / 32.15 / 36 + +[NEWS] mention that speedup + +------------------------------------------------------------------------ +r10697 | zimmerma | 2016-07-29 13:42:10 +0000 (Fri, 29 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] fixed bug in mpfr_sub1sp2 + +------------------------------------------------------------------------ +r10696 | zimmerma | 2016-07-29 12:44:56 +0000 (Fri, 29 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] removed useless code + +------------------------------------------------------------------------ +r10695 | zimmerma | 2016-07-29 12:33:12 +0000 (Fri, 29 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] code simplification + +------------------------------------------------------------------------ +r10694 | zimmerma | 2016-07-29 12:21:15 +0000 (Fri, 29 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] another code simplification + +------------------------------------------------------------------------ +r10693 | zimmerma | 2016-07-29 12:16:38 +0000 (Fri, 29 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] code simplification + +------------------------------------------------------------------------ +r10692 | zimmerma | 2016-07-29 12:06:05 +0000 (Fri, 29 Jul 2016) | 2 lines +Changed paths: + M /trunk/NEWS + +[NEWS] mention speedup in mpfr_add and mpfr_sub for 2 limbs + +------------------------------------------------------------------------ +r10691 | zimmerma | 2016-07-29 12:03:28 +0000 (Fri, 29 Jul 2016) | 10 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] faster code for 2 limbs. Results with mbench +(numactl --physcpubind=0 ./mfv5 -p113 mpfr_sub): + +3.1.5-dev: + mpfr_sub: 36 / 65.33 / 81 + +4.0-dev: + mpfr_sub: 24 / 33.00 / 36 + + +------------------------------------------------------------------------ +r10690 | zimmerma | 2016-07-28 15:09:21 +0000 (Thu, 28 Jul 2016) | 2 lines +Changed paths: + M /trunk/tests/tmul.c + +[tests/tmul.c] fixed wrong test + +------------------------------------------------------------------------ +r10689 | vlefevre | 2016-07-28 13:50:35 +0000 (Thu, 28 Jul 2016) | 3 lines +Changed paths: + M /trunk/tests/reuse.c + +[tests/reuse.c] Perform each reuse test on 1 to 5 limbs, with a random +number of trailing bits. This allows one to test code specific to 1 or +2 limbs. +------------------------------------------------------------------------ +r10688 | zimmerma | 2016-07-28 11:39:10 +0000 (Thu, 28 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] fixed issues found with --enable-assert=full + +------------------------------------------------------------------------ +r10687 | zimmerma | 2016-07-27 19:53:02 +0000 (Wed, 27 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] new code to deal with p in [GMP_NUMB_BITS+1,2*GMP_NUMB_BITS-1] + +------------------------------------------------------------------------ +r10686 | vlefevre | 2016-07-27 15:05:21 +0000 (Wed, 27 Jul 2016) | 9 lines +Changed paths: + M /trunk/src/round_prec.c + +[src/round_prec.c] Various minor improvements: + * Added a MPFR_ASSERTN since mpfr_can_round is a function in the API. + * Changed error variables to be more consistent with the context. + * Removed unnecessary code (casts...) about the error: it came from + round.c r1574, where types were different at that time. + * Made err2 (the old err) local to a small block to make sure that it + will not be used by mistake instead of err in future changes. + * Made equivalent expressions appear under the same form: + (rnd1 == rnd2 || rnd2 == MPFR_RNDN) && err - 2 >= prec +------------------------------------------------------------------------ +r10685 | vlefevre | 2016-07-27 14:28:44 +0000 (Wed, 27 Jul 2016) | 1 line +Changed paths: + M /trunk/src/round_prec.c + +[src/round_prec.c] Changed precision variables to be like SSA. +------------------------------------------------------------------------ +r10684 | vlefevre | 2016-07-27 14:17:36 +0000 (Wed, 27 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/round_prec.c + +[src/round_prec.c] Simplified code, making it more similar to code +that has just been fixed. +------------------------------------------------------------------------ +r10683 | vlefevre | 2016-07-27 14:08:48 +0000 (Wed, 27 Jul 2016) | 1 line +Changed paths: + M /trunk/src/round_prec.c + +[src/round_prec.c] Removed useless parentheses. +------------------------------------------------------------------------ +r10682 | vlefevre | 2016-07-27 14:05:16 +0000 (Wed, 27 Jul 2016) | 1 line +Changed paths: + M /trunk/src/round_prec.c + +[src/round_prec.c] Added an assertion for "default:". +------------------------------------------------------------------------ +r10681 | vlefevre | 2016-07-27 13:28:39 +0000 (Wed, 27 Jul 2016) | 2 lines +Changed paths: + M /trunk/tests/tcan_round.c + +[tests/tcan_round.c] In test_simple, output p (which is variable), +not prec (which is always 4). +------------------------------------------------------------------------ +r10680 | zimmerma | 2016-07-27 13:21:14 +0000 (Wed, 27 Jul 2016) | 3 lines +Changed paths: + M /trunk/src/round_prec.c + M /trunk/tests/tcan_round.c + +[src/round_prec.c] fixed bug in mpfr_can_round for 2^e when rnd1=rnd2 + and err > prec + 1 (was returning 0 instead of 1) + +------------------------------------------------------------------------ +r10679 | vlefevre | 2016-07-27 09:30:13 +0000 (Wed, 27 Jul 2016) | 2 lines +Changed paths: + M /trunk/tests/tcan_round.c + +[tests/tcan_round.c] Added a simple test that fails as a consequence of +r9883 (this could be observed on tzeta before r10678 in tgeneric.c). +------------------------------------------------------------------------ +r10678 | vlefevre | 2016-07-27 02:36:08 +0000 (Wed, 27 Jul 2016) | 2 lines +Changed paths: + M /trunk/tests/tgeneric.c + +[tests/tgeneric.c] Improvement: When the result is exact, it can always +be rounded (while mpfr_can_round can fail). +------------------------------------------------------------------------ +r10677 | vlefevre | 2016-07-27 01:47:43 +0000 (Wed, 27 Jul 2016) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Updated item about tzeta. +------------------------------------------------------------------------ +r10676 | zimmerma | 2016-07-26 18:03:08 +0000 (Tue, 26 Jul 2016) | 2 lines +Changed paths: + M /trunk/INSTALL + +[INSTALL] update (feedback from Bill Hart) + +------------------------------------------------------------------------ +r10675 | vlefevre | 2016-07-26 17:12:59 +0000 (Tue, 26 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Replaced mp_ptr by mpfr_limb_ptr (as usual). +------------------------------------------------------------------------ +r10674 | zimmerma | 2016-07-26 16:24:09 +0000 (Tue, 26 Jul 2016) | 2 lines +Changed paths: + M /trunk/tools/mbench/mfv5-mpfr.cc + +[mbench/mfv5-mpfr.cc] patch to allow using it with older versions of MPFR (say branch 3.1) + +------------------------------------------------------------------------ +r10673 | zimmerma | 2016-07-26 15:04:35 +0000 (Tue, 26 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] fixed mpn_sqrtrem2 for 32-bit limb + +------------------------------------------------------------------------ +r10672 | vlefevre | 2016-07-26 14:26:58 +0000 (Tue, 26 Jul 2016) | 1 line +Changed paths: + M /trunk/tests/tzeta.c + +[tests/tzeta.c] Added a FIXME so that r10667 can be reverted. +------------------------------------------------------------------------ +r10671 | vlefevre | 2016-07-26 14:24:04 +0000 (Tue, 26 Jul 2016) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Updated item about tzeta. +------------------------------------------------------------------------ +r10670 | vlefevre | 2016-07-26 14:06:10 +0000 (Tue, 26 Jul 2016) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Added item about the fix of mpfr_can_round in r9883 and tzeta. +------------------------------------------------------------------------ +r10669 | vlefevre | 2016-07-26 12:26:57 +0000 (Tue, 26 Jul 2016) | 7 lines +Changed paths: + M /trunk/doc/README.dev + M /trunk/src/sqrt.c + +New MPFR_GENERIC_ABI macro to test the generic code, not tied to a +particular ABI (e.g. GMP_NUMB_BITS value), so that such code has a +chance to be tested on current machines. + * doc/README.dev: added brief documentation. + * src/sqrt.c: enable mpfr_sqrt1 (optimization for one-limb precisions, + currently when GMP_NUMB_BITS is 32 or 64) only when MPFR_GENERIC_ABI + is not defined. +------------------------------------------------------------------------ +r10668 | vlefevre | 2016-07-26 12:16:38 +0000 (Tue, 26 Jul 2016) | 3 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] + * Changed mp_ptr to mpfr_limb_ptr. + * Untabified and removed trailing spaces. +------------------------------------------------------------------------ +r10667 | zimmerma | 2016-07-26 11:34:38 +0000 (Tue, 26 Jul 2016) | 2 lines +Changed paths: + M /trunk/tests/tzeta.c + +[tests/tzeta.c] reduced test time + +------------------------------------------------------------------------ +r10666 | zimmerma | 2016-07-26 11:30:00 +0000 (Tue, 26 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] adapted mpn_sqrtrem1 for GMP_NUMB_BITS=32 + +------------------------------------------------------------------------ +r10665 | vlefevre | 2016-07-25 14:36:06 +0000 (Mon, 25 Jul 2016) | 1 line +Changed paths: + M /trunk/INSTALL + +[INSTALL] Corrected hint for mingw (use --build instead of --host). +------------------------------------------------------------------------ +r10664 | zimmerma | 2016-07-25 13:22:25 +0000 (Mon, 25 Jul 2016) | 2 lines +Changed paths: + M /trunk/INSTALL + +[INSTALL] added hint for mingw + +------------------------------------------------------------------------ +r10662 | zimmerma | 2016-07-25 11:51:11 +0000 (Mon, 25 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] fixed temporary patch for 32-bit computers + +------------------------------------------------------------------------ +r10661 | vlefevre | 2016-07-25 10:01:24 +0000 (Mon, 25 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Typo in comment. +------------------------------------------------------------------------ +r10660 | vlefevre | 2016-07-25 09:58:38 +0000 (Mon, 25 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Updated FIXME's. This is still incorrect with 32-bit limbs. +------------------------------------------------------------------------ +r10659 | zimmerma | 2016-07-25 08:18:29 +0000 (Mon, 25 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] temporary fix for 32-bit limbs + +------------------------------------------------------------------------ +r10657 | vlefevre | 2016-07-22 15:17:56 +0000 (Fri, 22 Jul 2016) | 2 lines +Changed paths: + M /trunk/tests/tadd.c + +[tests/tadd.c] Improved coding style and messages (do not mix up +"inexact flag" and "ternary value"!). +------------------------------------------------------------------------ +r10642 | vlefevre | 2016-07-22 10:34:40 +0000 (Fri, 22 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Added another FIXME comment for 32-bit machines. +------------------------------------------------------------------------ +r10641 | vlefevre | 2016-07-22 10:32:47 +0000 (Fri, 22 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Added other FIXME comments for 32-bit machines. +------------------------------------------------------------------------ +r10640 | vlefevre | 2016-07-20 15:26:40 +0000 (Wed, 20 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Added FIXME comments for 32-bit machines. +------------------------------------------------------------------------ +r10639 | vlefevre | 2016-07-20 15:11:11 +0000 (Wed, 20 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] C90 compatibility. +------------------------------------------------------------------------ +r10638 | vlefevre | 2016-07-20 14:47:22 +0000 (Wed, 20 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Fixed minor (mainly style) issues found by mpfrlint. +------------------------------------------------------------------------ +r10637 | vlefevre | 2016-07-20 14:35:16 +0000 (Wed, 20 Jul 2016) | 5 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] + * Added --msg option to err-if-output function to optionally output + a message explaining what to do in case of error. + * Added this option to 3 err-if-output calls (errors with src/sqrt.c + r10636). +------------------------------------------------------------------------ +r10636 | zimmerma | 2016-07-20 13:57:32 +0000 (Wed, 20 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] new speedup for 1/2 and 1 limb + +------------------------------------------------------------------------ +r10632 | zimmerma | 2016-07-19 16:09:37 +0000 (Tue, 19 Jul 2016) | 2 lines +Changed paths: + M /trunk/NEWS + +[NEWS] mention speedup in mpfr_sqrt + +------------------------------------------------------------------------ +r10631 | zimmerma | 2016-07-19 16:08:38 +0000 (Tue, 19 Jul 2016) | 4 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] faster code for small precision (on tomate.loria.fr, 45 cycles +for prec=24 instead of 161 before, and 108 cycles for prec=53 instead of +165 with 3.1.4) + +------------------------------------------------------------------------ +r10628 | zimmerma | 2016-07-18 08:10:24 +0000 (Mon, 18 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] removed duplicate prototype (cf revision 10625) + +------------------------------------------------------------------------ +r10627 | zimmerma | 2016-07-18 08:04:21 +0000 (Mon, 18 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] yet another speedup + +------------------------------------------------------------------------ +r10626 | zimmerma | 2016-07-18 07:19:29 +0000 (Mon, 18 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] small improvement + +------------------------------------------------------------------------ +r10625 | vlefevre | 2016-07-18 00:46:29 +0000 (Mon, 18 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-gmp.h + +[src/mpfr-gmp.h] Declare __gmpn_invert_limb if used (in order to avoid +an error with g++ for the tests). +------------------------------------------------------------------------ +r10624 | zimmerma | 2016-07-17 19:46:38 +0000 (Sun, 17 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] removed wrong assertions (and added comments to explain why) + +------------------------------------------------------------------------ +r10623 | vlefevre | 2016-07-15 12:57:18 +0000 (Fri, 15 Jul 2016) | 1 line +Changed paths: + M /trunk/src/div.c + +[src/div.c] Added a FIXME (assertion failure). +------------------------------------------------------------------------ +r10622 | vlefevre | 2016-07-15 12:43:03 +0000 (Fri, 15 Jul 2016) | 1 line +Changed paths: + M /trunk/src/div.c + +[src/div.c] Untabified. +------------------------------------------------------------------------ +r10621 | vlefevre | 2016-07-15 12:40:22 +0000 (Fri, 15 Jul 2016) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Update concerning GMP internals. +------------------------------------------------------------------------ +r10620 | zimmerma | 2016-07-15 10:07:06 +0000 (Fri, 15 Jul 2016) | 2 lines +Changed paths: + M /trunk/configure.ac + M /trunk/src/sub1sp.c + +[src/sub1sp.c] implement use of __gmpn_rsblsh_n (disabled for now) + +------------------------------------------------------------------------ +r10619 | zimmerma | 2016-07-15 09:12:54 +0000 (Fri, 15 Jul 2016) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/configure.ac + M /trunk/src/div.c + +[src/div.c] only use __gmpn_invert_limb with --enable-gmp-internals + +------------------------------------------------------------------------ +r10618 | vlefevre | 2016-07-14 20:54:00 +0000 (Thu, 14 Jul 2016) | 4 lines +Changed paths: + M /trunk/src/mpfr-impl.h + M /trunk/tests/tcmp_ld.c + +[src/mpfr-impl.h] Require to be included in order to be + able to use the "long double macros and typedef" part. Moved the + IEEE_FLOAT128_MANT_DIG macro definition out of this part. +[tests/tcmp_ld.c] Added missing #include . +------------------------------------------------------------------------ +r10617 | vlefevre | 2016-07-14 16:04:42 +0000 (Thu, 14 Jul 2016) | 1 line +Changed paths: + M /trunk/src/div.c + +[src/div.c] Added a FIXME as __gmpn_invert_limb is a GMP internal. +------------------------------------------------------------------------ +r10616 | zimmerma | 2016-07-14 14:56:00 +0000 (Thu, 14 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] speedup for precision < GMP_NUMB_BITS/2 (by almost a factor 2) + +------------------------------------------------------------------------ +r10615 | zimmerma | 2016-07-14 14:31:21 +0000 (Thu, 14 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] added comment + +------------------------------------------------------------------------ +r10614 | zimmerma | 2016-07-14 14:14:48 +0000 (Thu, 14 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + M /trunk/src/mpfr-longlong.h + +[src/div.c] new faster code for 1 limb + +------------------------------------------------------------------------ +r10613 | zimmerma | 2016-07-14 07:44:07 +0000 (Thu, 14 Jul 2016) | 3 lines +Changed paths: + M /trunk/src/cmp_ld.c + M /trunk/src/get_ld.c + M /trunk/src/set_ld.c + +[src/cmp_ld.c] include float.h so that MPFR_LDBL_MANT_DIG is correctly defined +[src/get_ld.c,src/set_ld.c] added comment + +------------------------------------------------------------------------ +r10612 | zimmerma | 2016-07-13 15:03:21 +0000 (Wed, 13 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] removed obsolete comment since we no longer use __udiv_qrnnd_ld + +------------------------------------------------------------------------ +r10611 | zimmerma | 2016-07-13 14:22:34 +0000 (Wed, 13 Jul 2016) | 3 lines +Changed paths: + M /trunk/src/div.c + M /trunk/src/mpfr-longlong.h + +[src/div.c] changed __udiv_qrnnd_ld into __udiv_qrnnd_preinv (no dependency + any more on long double) + +------------------------------------------------------------------------ +r10610 | vlefevre | 2016-07-09 07:38:22 +0000 (Sat, 09 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] Do not use __udiv_qrnnd_ld for MPFR_LDBL_MANT_DIG > 64. +Added a comment about __udiv_qrnnd_ld. +------------------------------------------------------------------------ +r10609 | vlefevre | 2016-07-09 07:27:06 +0000 (Sat, 09 Jul 2016) | 1 line +Changed paths: + M /trunk/src/mpfr-longlong.h + +[src/mpfr-longlong.h] Typo. +------------------------------------------------------------------------ +r10608 | vlefevre | 2016-07-09 07:24:15 +0000 (Sat, 09 Jul 2016) | 1 line +Changed paths: + M /trunk/src/mpfr-longlong.h + +[src/mpfr-longlong.h] C89 compatibility. +------------------------------------------------------------------------ +r10607 | zimmerma | 2016-07-08 15:34:15 +0000 (Fri, 08 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] speedup using __udiv_qrnnd_ld + +------------------------------------------------------------------------ +r10606 | zimmerma | 2016-07-08 15:26:19 +0000 (Fri, 08 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-longlong.h + +[src/mpfr-longlong.h] contributed __udiv_qrnnd_ld variant + +------------------------------------------------------------------------ +r10605 | zimmerma | 2016-07-08 13:50:01 +0000 (Fri, 08 Jul 2016) | 3 lines +Changed paths: + M /trunk/src/div.c + M /trunk/src/mul.c + +[src/div.c] new special code for 1 limb +[src/mul.c] fixed corner case near underflow + +------------------------------------------------------------------------ +r10604 | zimmerma | 2016-07-08 13:10:12 +0000 (Fri, 08 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] fixed detection of rounding away + +------------------------------------------------------------------------ +r10603 | zimmerma | 2016-07-08 12:50:31 +0000 (Fri, 08 Jul 2016) | 3 lines +Changed paths: + M /trunk/src/mul.c + M /trunk/tests/tmul.c + +[src/mul.c] fixed underflow *after* rounding +[tests/tmul.c] fixed a test + +------------------------------------------------------------------------ +r10602 | zimmerma | 2016-07-08 12:45:05 +0000 (Fri, 08 Jul 2016) | 2 lines +Changed paths: + M /trunk/tests/tmul.c + +[tests/tmul.c] added underflow test for directed rounding too + +------------------------------------------------------------------------ +r10601 | zimmerma | 2016-07-08 12:24:28 +0000 (Fri, 08 Jul 2016) | 2 lines +Changed paths: + M /trunk/tests/tmul.c + +[tests/tmul.c] added test for underflow after rounding (reveals bug in mul.c) + +------------------------------------------------------------------------ +r10600 | vlefevre | 2016-07-08 11:57:26 +0000 (Fri, 08 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Clarified comment (it's better not to mention underflow +before rounding because it is not considered at all in MPFR). +------------------------------------------------------------------------ +r10599 | zimmerma | 2016-07-08 11:36:15 +0000 (Fri, 08 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] added comment about underflow before/after rounding + +------------------------------------------------------------------------ +r10598 | zimmerma | 2016-07-08 08:27:48 +0000 (Fri, 08 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] changed MPFR_PREC into MPFR_GET_PREC + +------------------------------------------------------------------------ +r10597 | zimmerma | 2016-07-07 12:35:28 +0000 (Thu, 07 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] removed a call to MPFR_LIKELY which is unlikely... + +------------------------------------------------------------------------ +r10596 | vlefevre | 2016-07-07 11:36:33 +0000 (Thu, 07 Jul 2016) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] i.e. → e.g. +------------------------------------------------------------------------ +r10595 | vlefevre | 2016-07-07 11:26:32 +0000 (Thu, 07 Jul 2016) | 1 line +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] Replaced mp_ptr by mpfr_limb_ptr (as usual). +------------------------------------------------------------------------ +r10594 | vlefevre | 2016-07-07 11:22:04 +0000 (Thu, 07 Jul 2016) | 4 lines +Changed paths: + M /trunk/src/add1sp.c + M /trunk/tests/tadd1sp.c + +[tests/tadd1sp.c] Added tests with EXP(b) < EXP(c), as there are + no such restrictions on the exponents for mpfr_add1sp. +[src/add1sp.c] Fixed mpfr_add1sp when b and c have different signs + and EXP(b) < EXP(c). +------------------------------------------------------------------------ +r10593 | zimmerma | 2016-07-07 11:08:04 +0000 (Thu, 07 Jul 2016) | 2 lines +Changed paths: + M /trunk/NEWS + +[NEWS] speedup in mpfr_mul for one limb (minus 1 bit) + +------------------------------------------------------------------------ +r10592 | zimmerma | 2016-07-07 11:01:33 +0000 (Thu, 07 Jul 2016) | 9 lines +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] speed-up of mpfr_mul for 1 limb (1 limb - 1 bit for the result). + Results of mbench for 53 bits on Intel i5-4590: + +before: + mpfr_mul: 33 / 37.12 / 42 +after: + mpfr_mul: 18 / 20.63 / 24 + + +------------------------------------------------------------------------ +r10591 | vlefevre | 2016-07-07 10:23:34 +0000 (Thu, 07 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/add1.c + +[src/add1.c] Corrected a comment as in practice, b and c do not +necessarily have the same sign (when called by mpfr_sub). +------------------------------------------------------------------------ +r10590 | zimmerma | 2016-07-07 08:15:00 +0000 (Thu, 07 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] added assertions + +------------------------------------------------------------------------ +r10589 | vlefevre | 2016-07-06 23:32:19 +0000 (Wed, 06 Jul 2016) | 1 line +Changed paths: + M /trunk/tests/tadd.c + +[tests/tadd.c] C++ compatibility. +------------------------------------------------------------------------ +r10588 | vlefevre | 2016-07-06 23:29:08 +0000 (Wed, 06 Jul 2016) | 1 line +Changed paths: + M /trunk/tests/tadd1sp.c + +[tests/tadd1sp.c] Do not use != 0 on predicate function. +------------------------------------------------------------------------ +r10587 | zimmerma | 2016-07-06 20:03:26 +0000 (Wed, 06 Jul 2016) | 3 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] removed special code for n = 1, now that we have a special + function mpfr_sub1sp1 + +------------------------------------------------------------------------ +r10586 | zimmerma | 2016-07-06 14:30:09 +0000 (Wed, 06 Jul 2016) | 2 lines +Changed paths: + M /trunk/tests/tadd.c + +[tests/tadd.c] revert mpfr_add to test_add + +------------------------------------------------------------------------ +r10585 | zimmerma | 2016-07-06 14:16:37 +0000 (Wed, 06 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] fixed two bugs in mpfr_add1sp1 + +------------------------------------------------------------------------ +r10584 | zimmerma | 2016-07-06 14:15:43 +0000 (Wed, 06 Jul 2016) | 2 lines +Changed paths: + M /trunk/tests/tadd1sp.c + +[tests/tadd1sp.c] added one hard-coded test + +------------------------------------------------------------------------ +r10583 | zimmerma | 2016-07-06 14:07:34 +0000 (Wed, 06 Jul 2016) | 2 lines +Changed paths: + M /trunk/tests/tadd.c + +[tests/tadd.c] last commit was wrong + +------------------------------------------------------------------------ +r10582 | zimmerma | 2016-07-06 13:54:52 +0000 (Wed, 06 Jul 2016) | 2 lines +Changed paths: + M /trunk/tests/tadd.c + +improved check_overflow() + +------------------------------------------------------------------------ +r10581 | vlefevre | 2016-07-06 13:38:53 +0000 (Wed, 06 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/urandom.c + +[src/urandom.c] Fixed uninitialized emin for nbits == 1 +(thanks GCC's -Werror=maybe-uninitialized). +------------------------------------------------------------------------ +r10580 | zimmerma | 2016-07-06 13:02:48 +0000 (Wed, 06 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/urandom.c + +[src/urandom.c] should now be ok for nbits = 1 + +------------------------------------------------------------------------ +r10579 | vlefevre | 2016-07-06 12:30:34 +0000 (Wed, 06 Jul 2016) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Change most mpfr_urandomb to mpfr_urandom in the tests? +------------------------------------------------------------------------ +r10578 | vlefevre | 2016-07-06 12:16:04 +0000 (Wed, 06 Jul 2016) | 1 line +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Improved an error message. +------------------------------------------------------------------------ +r10577 | vlefevre | 2016-07-06 12:13:03 +0000 (Wed, 06 Jul 2016) | 1 line +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Corrected English usage in error message. +------------------------------------------------------------------------ +r10576 | vlefevre | 2016-07-06 12:03:37 +0000 (Wed, 06 Jul 2016) | 1 line +Changed paths: + M /trunk/tests/turandom.c + +[tests/turandom.c] Small precision check: replaced 2 by MPFR_PREC_MIN. +------------------------------------------------------------------------ +r10575 | zimmerma | 2016-07-06 11:47:20 +0000 (Wed, 06 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/urandom.c + +[src/urandom.c] fixed urandom for a precision of 1 bit + +------------------------------------------------------------------------ +r10574 | vlefevre | 2016-07-06 11:14:42 +0000 (Wed, 06 Jul 2016) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] About random tests: avoid mpfr_urandomb!!! +------------------------------------------------------------------------ +r10573 | vlefevre | 2016-07-06 11:09:59 +0000 (Wed, 06 Jul 2016) | 2 lines +Changed paths: + M /trunk/tests/tadd1sp.c + +[tests/tadd1sp.c] Use mpfr_urandom instead of mpfr_urandomb. +This triggers an assertion failure in urandomb.c. +------------------------------------------------------------------------ +r10572 | vlefevre | 2016-07-06 11:03:20 +0000 (Wed, 06 Jul 2016) | 1 line +Changed paths: + M /trunk/tests/tadd1sp.c + +[tests/tadd1sp.c] Reordered variables. Removed a redundant test. +------------------------------------------------------------------------ +r10571 | vlefevre | 2016-07-06 10:30:13 +0000 (Wed, 06 Jul 2016) | 1 line +Changed paths: + M /trunk/tests/tadd1sp.c + +[tests/tadd1sp.c] In check_random, check the flags too. +------------------------------------------------------------------------ +r10570 | vlefevre | 2016-07-06 10:26:40 +0000 (Wed, 06 Jul 2016) | 1 line +Changed paths: + M /trunk/tests/tadd1sp.c + +[tests/tadd1sp.c] Test negative numbers too. +------------------------------------------------------------------------ +r10569 | vlefevre | 2016-07-06 10:15:17 +0000 (Wed, 06 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sub1sp.c + M /trunk/tests/tsub1sp.c + +Removed trailing spaces. +------------------------------------------------------------------------ +r10568 | zimmerma | 2016-07-06 09:02:12 +0000 (Wed, 06 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + +added comment + +------------------------------------------------------------------------ +r10567 | zimmerma | 2016-07-06 08:58:06 +0000 (Wed, 06 Jul 2016) | 3 lines +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] removed special cases for n=1 in mpfr_add1sp, now that we have + a special routine mpfr_add1sp1 + +------------------------------------------------------------------------ +r10566 | zimmerma | 2016-07-06 07:31:04 +0000 (Wed, 06 Jul 2016) | 2 lines +Changed paths: + M /trunk/tools/mbench/mfv5.cc + +[mbench/mfv5.cc] added RNDA and fixed typo + +------------------------------------------------------------------------ +r10565 | vlefevre | 2016-07-06 01:52:11 +0000 (Wed, 06 Jul 2016) | 2 lines +Changed paths: + M /trunk/tools/mbench/mfv5-mpfr.cc + M /trunk/tools/mbench/mfv5.cc + M /trunk/tools/mbench/mfv5.h + +The rounding mode can now be passed in argument with the -r option +(patch by Patrick Pélissier). +------------------------------------------------------------------------ +r10564 | vlefevre | 2016-07-06 01:43:45 +0000 (Wed, 06 Jul 2016) | 1 line +Changed paths: + M /trunk/src/add1sp.c + M /trunk/src/sub1sp.c + +Removed MPFR_HOT_FUNCTION_ATTR for mpfr_add1sp1 and mpfr_sub1sp1. +------------------------------------------------------------------------ +r10563 | vlefevre | 2016-07-05 19:15:18 +0000 (Tue, 05 Jul 2016) | 2 lines +Changed paths: + M /trunk/tests/tadd.c + +[tests/tadd.c] Added FIXME comment: there are many tests, but the +ternary value and the flags are not tested! +------------------------------------------------------------------------ +r10562 | vlefevre | 2016-07-05 19:06:28 +0000 (Tue, 05 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + M /trunk/src/mpfr-impl.h + M /trunk/src/sub1sp.c + +Functions mpfr_add1sp1 and mpfr_sub1sp1 are called only from the files +where they are defined, thus can be static. +------------------------------------------------------------------------ +r10561 | vlefevre | 2016-07-05 19:02:43 +0000 (Tue, 05 Jul 2016) | 1 line +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] Removed unused variable. +------------------------------------------------------------------------ +r10560 | zimmerma | 2016-07-05 15:09:25 +0000 (Tue, 05 Jul 2016) | 9 lines +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] new special code for 1 limb. In 3.1.4 we add with mfv5: + + mpfr_add: 30 / 49.30 / 90 + +now we have: + + mpfr_add: 24 / 28.18 / 30 + + +------------------------------------------------------------------------ +r10559 | zimmerma | 2016-07-05 15:07:58 +0000 (Tue, 05 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] added comment + +------------------------------------------------------------------------ +r10558 | vlefevre | 2016-07-05 14:08:11 +0000 (Tue, 05 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Another improvement (suggested by Paul). +------------------------------------------------------------------------ +r10557 | vlefevre | 2016-07-05 13:34:01 +0000 (Tue, 05 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Improved readability. With Debian's gcc-snapshot, this +is equivalent, and with tcc, the generated code is shorter. +------------------------------------------------------------------------ +r10556 | vlefevre | 2016-07-05 13:19:11 +0000 (Tue, 05 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] No longer depend on the representation of 0. +------------------------------------------------------------------------ +r10555 | vlefevre | 2016-07-05 13:15:10 +0000 (Tue, 05 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Various improvements in the coding style: readability, +consistency, GNU coding style. +------------------------------------------------------------------------ +r10554 | zimmerma | 2016-07-05 12:38:42 +0000 (Tue, 05 Jul 2016) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[README.dev] added documentation about mpfr-gfx + +------------------------------------------------------------------------ +r10553 | zimmerma | 2016-07-05 12:35:00 +0000 (Tue, 05 Jul 2016) | 2 lines +Changed paths: + M /trunk/tools/mbench/mpfr-gfx.c + +[mbench/mpfr-gfx.c] change of syntax of gnuplot + +------------------------------------------------------------------------ +r10552 | zimmerma | 2016-07-05 12:07:48 +0000 (Tue, 05 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + M /trunk/tests/tsub1sp.c + +[src/sub1sp.c] removed dead code, and improved coverage to 100% + +------------------------------------------------------------------------ +r10551 | vlefevre | 2016-07-05 09:45:01 +0000 (Tue, 05 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Removed incorrect MPFR_SET_EXP (the value was incorrect +and the real MPFR_SET_EXP is done later, after underflow checking). +------------------------------------------------------------------------ +r10550 | vlefevre | 2016-07-05 09:35:33 +0000 (Tue, 05 Jul 2016) | 1 line +Changed paths: + M /trunk/tests/tsub1sp.c + +[tests/tsub1sp.c] Added missing printf arguments. +------------------------------------------------------------------------ +r10548 | zimmerma | 2016-07-05 06:58:19 +0000 (Tue, 05 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] fixed some FIXMEs + +------------------------------------------------------------------------ +r10547 | vlefevre | 2016-07-04 23:05:29 +0000 (Mon, 04 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Added a FIXME. +------------------------------------------------------------------------ +r10546 | vlefevre | 2016-07-04 22:58:52 +0000 (Mon, 04 Jul 2016) | 3 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Avoid a -Wmaybe-uninitialized warning from GCC +by declaring a variable as initialized (the code is correct, +GCC isn't just smart enough). +------------------------------------------------------------------------ +r10545 | vlefevre | 2016-07-04 22:28:43 +0000 (Mon, 04 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sub1sp.c + +Removed trailing spaces. +------------------------------------------------------------------------ +r10544 | vlefevre | 2016-07-04 22:27:44 +0000 (Mon, 04 Jul 2016) | 3 lines +Changed paths: + M /trunk/Makefile.am + A /trunk/tools/ck-clz_tab + M /trunk/tools/mpfrlint + +Added tools/ck-clz_tab sh script to check the __clz_tab sizes +(to detect issues like the one fixed in r10542). Run this script +in dist-hook (Makefile.am) and in mpfrlint. +------------------------------------------------------------------------ +r10543 | zimmerma | 2016-07-04 16:00:22 +0000 (Mon, 04 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +resolved a FIXME + +------------------------------------------------------------------------ +r10542 | zimmerma | 2016-07-04 14:50:53 +0000 (Mon, 04 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/mp_clz_tab.c + +fixed bug reported by + +------------------------------------------------------------------------ +r10541 | vlefevre | 2016-07-04 13:39:10 +0000 (Mon, 04 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/exceptions.c + +[src/exceptions.c] Added a comment for mpfr_underflow: historical reason +for the choice of the behavior with MPFR_RNDN. +------------------------------------------------------------------------ +r10540 | zimmerma | 2016-07-04 11:09:26 +0000 (Mon, 04 Jul 2016) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +code simplification (suggested by Vincent) + +------------------------------------------------------------------------ +r10539 | zimmerma | 2016-07-04 10:36:16 +0000 (Mon, 04 Jul 2016) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/src/mpfr-impl.h + M /trunk/src/sub1sp.c + M /trunk/tests/texceptions.c + M /trunk/tests/tsub1sp.c + +speedup of mpfr_sub for same precision < GMP_NUMB_BITS + +------------------------------------------------------------------------ +r10538 | vlefevre | 2016-07-01 00:56:37 +0000 (Fri, 01 Jul 2016) | 1 line +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] Corrected indentation. +------------------------------------------------------------------------ +r10537 | vlefevre | 2016-07-01 00:51:59 +0000 (Fri, 01 Jul 2016) | 1 line +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Added comments. +------------------------------------------------------------------------ +r10536 | vlefevre | 2016-07-01 00:47:19 +0000 (Fri, 01 Jul 2016) | 1 line +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] Added comments. +------------------------------------------------------------------------ +r10535 | zimmerma | 2016-06-30 07:57:08 +0000 (Thu, 30 Jun 2016) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + M /trunk/src/sub1sp.c + +optimize mpfr_add (and mpfr_sub, not yet finished) for 1 limb + +------------------------------------------------------------------------ +r10534 | vlefevre | 2016-06-29 12:17:49 +0000 (Wed, 29 Jun 2016) | 1 line +Changed paths: + M /trunk/src/add.c + M /trunk/src/add1.c + M /trunk/src/mpfr-impl.h + M /trunk/src/sub.c + +Renamed macro MPFR_EXP_LESS_P to MPFR_UBF_EXP_LESS_P. +------------------------------------------------------------------------ +r10533 | vlefevre | 2016-06-29 12:16:16 +0000 (Wed, 29 Jun 2016) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + +[src/add1sp.c] Fixed bug introduced in r10530 when MPFR_WANT_ASSERT >= 2 +(--enable-assert=full). +------------------------------------------------------------------------ +r10532 | vlefevre | 2016-06-29 12:11:44 +0000 (Wed, 29 Jun 2016) | 1 line +Changed paths: + M /trunk/src/add1.c + +[src/add1.c] Re-added the MPFR_ASSERTD. The culprit seems to be r10530. +------------------------------------------------------------------------ +r10531 | vlefevre | 2016-06-29 12:09:05 +0000 (Wed, 29 Jun 2016) | 1 line +Changed paths: + M /trunk/src/add1.c + +[src/add1.c] Reverted r10529, which now fails. That's strange. +------------------------------------------------------------------------ +r10530 | zimmerma | 2016-06-29 12:00:06 +0000 (Wed, 29 Jun 2016) | 2 lines +Changed paths: + M /trunk/src/add.c + M /trunk/src/add1sp.c + +mpfr_add1sp does not assume any more EXP(b) >= EXP(c) + +------------------------------------------------------------------------ +r10529 | vlefevre | 2016-06-29 11:49:30 +0000 (Wed, 29 Jun 2016) | 1 line +Changed paths: + M /trunk/src/add1.c + +[src/add1.c] Added a MPFR_ASSERTD. +------------------------------------------------------------------------ +r10528 | zimmerma | 2016-06-29 09:56:17 +0000 (Wed, 29 Jun 2016) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + +still faster code for 1 limb + +------------------------------------------------------------------------ +r10527 | zimmerma | 2016-06-29 09:14:57 +0000 (Wed, 29 Jun 2016) | 3 lines +Changed paths: + M /trunk/src/add1sp.c + +merged r10522 from faithful branch + other special-code for 1 limb: +the worst case for mpfr_add in 53 limbs decreases from 70 to 60 cycles + +------------------------------------------------------------------------ +r10525 | zimmerma | 2016-06-29 08:08:35 +0000 (Wed, 29 Jun 2016) | 2 lines +Changed paths: + M /trunk/src/add1.c + +added comment that EXP(b) >= EXP(c) + +------------------------------------------------------------------------ +r10523 | vlefevre | 2016-06-27 17:08:25 +0000 (Mon, 27 Jun 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Changed "hole" to "gap". +------------------------------------------------------------------------ +r10519 | vlefevre | 2016-06-25 00:47:35 +0000 (Sat, 25 Jun 2016) | 1 line +Changed paths: + M /trunk/autogen.sh + +[autogen.sh] Treat autoreconf warnings as errors. +------------------------------------------------------------------------ +r10518 | vlefevre | 2016-06-24 23:55:21 +0000 (Fri, 24 Jun 2016) | 3 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Some improvements. In particular, avoid two successive +calls to mpfr_cmpabs on the same arguments (the compiler doesn't know +that it could optimize, as the function is not pure). +------------------------------------------------------------------------ +r10509 | vlefevre | 2016-06-24 14:21:13 +0000 (Fri, 24 Jun 2016) | 1 line +Changed paths: + M /trunk/src/add1sp.c + M /trunk/src/sub1sp.c + +Cosmetic change (whitespace). +------------------------------------------------------------------------ +r10506 | vlefevre | 2016-06-24 14:06:17 +0000 (Fri, 24 Jun 2016) | 3 lines +Changed paths: + M /trunk/src/add1sp.c + M /trunk/src/sub1sp.c + +[src/add1sp.c] For MPFR_WANT_ASSERT >= 2 (--enable-assert=full), test + the flags too and replaced "mpfr_cmp" by "! mpfr_equal_p". +[src/sub1sp.c] Make it similar to add1sp.c for MPFR_WANT_ASSERT >= 2. +------------------------------------------------------------------------ +r10504 | vlefevre | 2016-06-24 13:44:21 +0000 (Fri, 24 Jun 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r10503 | vlefevre | 2016-06-24 12:17:25 +0000 (Fri, 24 Jun 2016) | 3 lines +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Made the code a bit more natural: change of pos to neg +(an indirect consequence of the support of reused arguments). Some +other minor related changes. +------------------------------------------------------------------------ +r10501 | vlefevre | 2016-06-24 10:17:40 +0000 (Fri, 24 Jun 2016) | 5 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/sum.c + +The support of reused arguments in mpfr_sum is now complete, without +any visible regressions in the timings (which are unfortunately too +inaccurate to see anything). + * doc/mpfr.texi: removed sentences about the previous limitation. + * src/sum.c: removed the corresponding FIXME/TODO comment. +------------------------------------------------------------------------ +r10500 | vlefevre | 2016-06-24 10:11:10 +0000 (Fri, 24 Jun 2016) | 1 line +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Test the support of reused arguments. +------------------------------------------------------------------------ +r10493 | vlefevre | 2016-06-23 11:17:51 +0000 (Thu, 23 Jun 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Added a comment for MPFR_RNDRAW_GEN about the use +of the exponent field of the destination. +------------------------------------------------------------------------ +r10477 | vlefevre | 2016-06-17 15:38:51 +0000 (Fri, 17 Jun 2016) | 1 line +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Coding style: added spaces. +------------------------------------------------------------------------ +r10476 | vlefevre | 2016-06-17 15:17:34 +0000 (Fri, 17 Jun 2016) | 3 lines +Changed paths: + M /trunk/TODO + +[TODO] Suggest the use the keyword "static" in array indices of +parameter declarations with C99 compilers (6.7.5.3p7) when the +pointer is expected not to be null. +------------------------------------------------------------------------ +r10468 | vlefevre | 2016-06-15 09:46:29 +0000 (Wed, 15 Jun 2016) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Update (GCC trunk → GCC 5). +------------------------------------------------------------------------ +r10467 | vlefevre | 2016-06-13 09:06:29 +0000 (Mon, 13 Jun 2016) | 2 lines +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Copy the significand to the destination after resolving +the TMD in order to support reused arguments. +------------------------------------------------------------------------ +r10466 | vlefevre | 2016-06-13 06:40:25 +0000 (Mon, 13 Jun 2016) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Improved a comment. +------------------------------------------------------------------------ +r10465 | vlefevre | 2016-06-10 13:58:34 +0000 (Fri, 10 Jun 2016) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Corrected a MPFR_LOG_MSG modified in the latest change. +------------------------------------------------------------------------ +r10464 | vlefevre | 2016-06-10 13:47:29 +0000 (Fri, 10 Jun 2016) | 5 lines +Changed paths: + M /trunk/doc/sum.txt + M /trunk/src/sum.c + +[src/sum.c] For the future support of reused arguments: TMD resolution +is now done in a specific TMD accumulator, allocated at the same time +as the main accumulator. This TMD accumulator currently just takes at +most 2 limbs in practice, so that's not a problem. +[doc/sum.txt] Added TODO for things that will change. +------------------------------------------------------------------------ +r10463 | vlefevre | 2016-06-09 14:30:32 +0000 (Thu, 09 Jun 2016) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Define mpfr_ueexp_t (needed for r10462). +------------------------------------------------------------------------ +r10462 | vlefevre | 2016-06-09 14:09:11 +0000 (Thu, 09 Jun 2016) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Do not use "%zu" with printf (added in r10460). +------------------------------------------------------------------------ +r10461 | vlefevre | 2016-06-09 12:41:16 +0000 (Thu, 09 Jun 2016) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Document environment variables that affect the tests. +------------------------------------------------------------------------ +r10460 | vlefevre | 2016-06-09 12:15:14 +0000 (Thu, 09 Jun 2016) | 6 lines +Changed paths: + M /trunk/tests/memory.c + M /trunk/tests/mpfr-test.h + M /trunk/tests/tversion.c + +Other changes concerning the memory limit for the tests. + * Export the tests_memory_limit variable so that it can be accessed in + test programs (e.g. read by tversion as mentioned below, or modified + by a test program when executed with particular arguments). + * In tversion, print a warning when the memory limit has been modified + (with the MPFR_TESTS_MEMORY_LIMIT environment variable). +------------------------------------------------------------------------ +r10459 | vlefevre | 2016-06-09 11:51:52 +0000 (Thu, 09 Jun 2016) | 3 lines +Changed paths: + M /trunk/tests/memory.c + +[tests/memory.c] The MPFR_TESTS_MEMORY_LIMIT environment variable can +now contain an integer specifying the memory limit for the tests, or 0 +for unlimited, the default still being 2^22 = 4 MB. +------------------------------------------------------------------------ +r10457 | vlefevre | 2016-06-08 12:28:43 +0000 (Wed, 08 Jun 2016) | 4 lines +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Improved check3: + * Also do the tests with output precision MPFR_PREC_MIN; + this completes the value coverage for tsum. + * Also compare the flags. +------------------------------------------------------------------------ +r10456 | vlefevre | 2016-06-08 12:06:57 +0000 (Wed, 08 Jun 2016) | 4 lines +Changed paths: + M /trunk/tests/tsum.c + +Value coverage for tsum: After r9984 to differentiate sq > MPFR_PREC_MIN +and sq == MPFR_PREC_MIN, 42 tests were not done for sq == MPFR_PREC_MIN +on a 64-bit machine. In the check4 test, changed a 2 to MPFR_PREC_MIN. +This reduces to 12 tests that are not done. +------------------------------------------------------------------------ +r10454 | vlefevre | 2016-06-07 17:27:04 +0000 (Tue, 07 Jun 2016) | 18 lines +Changed paths: + M /trunk + M /trunk/src/Makefile.am + M /trunk/src/add.c + M /trunk/src/add1.c + M /trunk/src/cmp2.c + M /trunk/src/fmma.c + M /trunk/src/log_ui.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + M /trunk/src/print_raw.c + M /trunk/src/sub.c + M /trunk/src/sub1.c + A /trunk/src/ubf.c (from /branches/ubf/src/ubf.c:10453) + M /trunk/src/vasprintf.c + M /trunk/tests/tacosh.c + M /trunk/tests/texp.c + M /trunk/tests/tfmma.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow_z.c + M /trunk/tests/tsprintf.c + M /trunk/tests/tsub1sp.c + +Merged the "ubf" branch into the trunk: + * limited implementation of "unbounded floats" (numbers with a mpz_t + exponent), which could be completed in the future, in particular to + handle intermediate overflows/underflows in polynomial evaluation; + * rewrote mpfr_fmma and mpfr_fmms to use them, and added tests; + * restored the MPFR 3.1- exponent range for compatibility; + * restored some tests that were based on this exponent range. +The choice for the UBF implementation was to use a compatible structure: +the same as the mpfr_t one, with an additional field at the end, used +only when the exponent field _mpfr_exp has some special value. Thus some +functions such as addition and subtraction just needed minor changes to +support UBF, and no code was duplicated. This means that on MPFR numbers +(the usual case), one has a few more tests than before, but with known +branch probabilities. In practice, this should not be visible, at least +in most applications. This was more or less confirmed by timings (even +with many additions/subtractions in low precision, this was difficult +to say, as timings were influenced by various parameters that we cannot +control). +------------------------------------------------------------------------ +r10452 | vlefevre | 2016-06-07 10:22:03 +0000 (Tue, 07 Jun 2016) | 1 line +Changed paths: + M /trunk/tools/mbench/Makefile + +[tools/mbench/Makefile] Added multiarch support for GMP. +------------------------------------------------------------------------ +r10449 | vlefevre | 2016-06-07 07:26:52 +0000 (Tue, 07 Jun 2016) | 3 lines +Changed paths: + M /trunk/tests/tprintf.c + +[tests/tprintf.c] Removed tests of native %'g and %'f (from r8292) +as the ' flag is an extension from Single UNIX Specification and +in particular, they fail with MinGW under Wine. +------------------------------------------------------------------------ +r10447 | vlefevre | 2016-06-07 00:44:17 +0000 (Tue, 07 Jun 2016) | 1 line +Changed paths: + M /trunk/tests/tlgamma.c + +[tests/tlgamma.c] Typo in comment. +------------------------------------------------------------------------ +r10446 | vlefevre | 2016-06-07 00:23:13 +0000 (Tue, 07 Jun 2016) | 1 line +Changed paths: + M /trunk/src/uceil_log2.c + +[src/uceil_log2.c] Added a comment. Cosmetic changes. +------------------------------------------------------------------------ +r10445 | vlefevre | 2016-06-07 00:18:47 +0000 (Tue, 07 Jun 2016) | 1 line +Changed paths: + M /trunk/tests/tlgamma.c + +[tests/tlgamma.c] Corrected updated comment from r10444. +------------------------------------------------------------------------ +r10444 | vlefevre | 2016-06-06 23:45:31 +0000 (Mon, 06 Jun 2016) | 1 line +Changed paths: + M /trunk/tests/tlgamma.c + +[tests/tlgamma.c] Updated comment of the test added in r10442. +------------------------------------------------------------------------ +r10443 | vlefevre | 2016-06-06 23:43:44 +0000 (Mon, 06 Jun 2016) | 7 lines +Changed paths: + M /trunk/src/uceil_log2.c + +[src/uceil_log2.c] Correction in __gmpfr_ceil_log2, avoiding an +incorrect result with tcc: x.s.exp is declared as an unsigned +bit-field, so that tcc considers that x.s.exp - 1023 is unsigned. +However, since all the values of x.s.exp are representable in an +int, according to the integer promotion rules, x.s.exp should be +converted to an int, so that the subtraction is signed. So, this +appears to be a bug in tcc. +------------------------------------------------------------------------ +r10442 | vlefevre | 2016-06-06 23:09:17 +0000 (Mon, 06 Jun 2016) | 3 lines +Changed paths: + M /trunk/tests/tlgamma.c + +[tests/tlgamma.c] Added a test causing a "too much memory" error with +tcc 0.9.27~git20151227.933c223-1 (there's already one in special(), +but this one is a simpler, standalone test). +------------------------------------------------------------------------ +r10440 | vlefevre | 2016-06-06 16:19:21 +0000 (Mon, 06 Jun 2016) | 4 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] When checking if __float128 is available, we now also +check whether C99 constants (in particular the __float128 ones, such +as 0x1.fp+16383q) are supported since this is now required with the +__float128 support. +------------------------------------------------------------------------ +r10435 | vlefevre | 2016-06-06 12:15:56 +0000 (Mon, 06 Jun 2016) | 2 lines +Changed paths: + M /trunk/src/add1.c + +[src/add1.c] Simplified code: removed fb = 1 since it was already 1 +in the "if (fb > 0)" branch. +------------------------------------------------------------------------ +r10434 | vlefevre | 2016-06-06 10:59:02 +0000 (Mon, 06 Jun 2016) | 3 lines +Changed paths: + M /trunk/src/set_float128.c + +[src/set_float128.c] Fix: removed the divisions by zero, replacing them +by comparisons with the maximum finite binary128 number. Changes to be +similar to the handling of infinities in "src/set_ld.c". +------------------------------------------------------------------------ +r10433 | vlefevre | 2016-06-06 10:07:47 +0000 (Mon, 06 Jun 2016) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Faithful rounding: small correction. +------------------------------------------------------------------------ +r10432 | vlefevre | 2016-06-06 09:28:17 +0000 (Mon, 06 Jun 2016) | 2 lines +Changed paths: + M /trunk/TODO + +[TODO] Added "faithful rounding", with information about its definition +and implementation. +------------------------------------------------------------------------ +r10431 | vlefevre | 2016-06-03 15:51:24 +0000 (Fri, 03 Jun 2016) | 1 line +Changed paths: + M /trunk/src/fits_intmax.c + M /trunk/src/fits_s.h + +[src/{fits_intmax.c,fits_s.h}] In comments, fit → fits. +------------------------------------------------------------------------ +r10430 | vlefevre | 2016-06-03 15:30:53 +0000 (Fri, 03 Jun 2016) | 3 lines +Changed paths: + M /trunk/src/set_float128.c + +[src/set_float128.c] Added FIXME comment: The mpfr_set_float128 code +generates a divide-by-zero exception. Suggest a solution. +Note: this is detected with "-DMPFR_TESTS_DIVBYZERO -DMPFR_ERRDIVZERO". +------------------------------------------------------------------------ +r10429 | vlefevre | 2016-06-03 15:02:05 +0000 (Fri, 03 Jun 2016) | 3 lines +Changed paths: + M /trunk/tests/tset_float128.c + +[tests/tset_float128.c] Take into account failures in division by 0 +and absence of signed zeros. Also fixed the code checking the sign +of 0 (mpfr_sgn cannot be used for that since it returns 0 for ±0). +------------------------------------------------------------------------ +r10426 | vlefevre | 2016-06-03 14:19:33 +0000 (Fri, 03 Jun 2016) | 2 lines +Changed paths: + M /trunk/src/set_d.c + +[src/set_d.c] Added some assertions and fixed a 32-bit shift count +when GMP_NUMB_BITS == 32. +------------------------------------------------------------------------ +r10424 | vlefevre | 2016-06-03 13:54:29 +0000 (Fri, 03 Jun 2016) | 1 line +Changed paths: + M /trunk/tests/tset_float128.c + +[tests/tset_float128.c] C++ compatibility. +------------------------------------------------------------------------ +r10423 | vlefevre | 2016-06-03 13:50:17 +0000 (Fri, 03 Jun 2016) | 1 line +Changed paths: + M /trunk/tests/tlog.c + +[tests/tlog.c] Added a cast to mpfr_rnd_t for C++ compatibility. +------------------------------------------------------------------------ +r10417 | zimmerma | 2016-06-03 12:26:21 +0000 (Fri, 03 Jun 2016) | 2 lines +Changed paths: + M /trunk/TODO + +added reference for Lambert W function + +------------------------------------------------------------------------ +r10396 | vlefevre | 2016-06-02 14:34:35 +0000 (Thu, 02 Jun 2016) | 2 lines +Changed paths: + M /trunk/src/exceptions.c + +[src/exceptions.c] Fixed the MPFR_LOG_FUNC in mpfr_underflow and +mpfr_overflow (x is not an input in these functions). +------------------------------------------------------------------------ +r10395 | vlefevre | 2016-06-02 14:26:51 +0000 (Thu, 02 Jun 2016) | 4 lines +Changed paths: + M /trunk/src/sub1.c + +[src/sub1.c] In r10347, logging was introduced instead of #ifdef DEBUG +and printf. Removed 2 MPFR_LOG_VAR, as the variable is not normalized +yet. Re-added #ifdef DEBUG for the MPFR_LOG_MSG's since this may be +too low level and not much useful except in case of bugs. +------------------------------------------------------------------------ +r10390 | zimmerma | 2016-05-30 14:06:51 +0000 (Mon, 30 May 2016) | 2 lines +Changed paths: + M /trunk/src/sub1.c + +fixed typos + +------------------------------------------------------------------------ +r10386 | vlefevre | 2016-05-30 07:53:27 +0000 (Mon, 30 May 2016) | 2 lines +Changed paths: + M /trunk/tests/tsub.c + +[tests/tsub.c] Added comments for check_max_almosteven (latest +test case, added in r10383). +------------------------------------------------------------------------ +r10383 | vlefevre | 2016-05-29 18:40:42 +0000 (Sun, 29 May 2016) | 10 lines +Changed paths: + M /trunk/src/sub1.c + M /trunk/tests/tsub.c + +[src/sub1.c] Fixed bug in mpfr_sub1 (real subtraction a = b - c, with + |b| > |c|): In MPFR_RNDN (round-to-nearest mode), when + * |b| is the midpoint between the maximum finite number in the + precision of a and 2^emax (the maximum finite number + 1 ulp), + which is possible only if PREC(b) > PREC(a), + * c is small enough (i.e. no overlap with a and b), + mpfr_sub1 returns an infinity (with overflow flag set) instead of + ± the maximum number (no overflow). The cause is that an overflow + is generated too early, in an intermediate rounding. +[tests/tsub.c] Added test cases. +------------------------------------------------------------------------ +r10378 | vlefevre | 2016-05-25 20:16:08 +0000 (Wed, 25 May 2016) | 1 line +Changed paths: + M /trunk/src/log_ui.c + +[src/log_ui.c] Changes for ISO C90 compatibility. +------------------------------------------------------------------------ +r10377 | vlefevre | 2016-05-25 20:13:30 +0000 (Wed, 25 May 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-gmp.h + +[src/mpfr-gmp.h] For _MPFR_IEEE_FLOATS, changed bit-field type from +unsigned long, which is implementation-defined, to unsigned int. +------------------------------------------------------------------------ +r10376 | vlefevre | 2016-05-25 19:46:12 +0000 (Wed, 25 May 2016) | 1 line +Changed paths: + M /trunk/src/log_ui.c + +[src/log_ui.c] Added an assertion. +------------------------------------------------------------------------ +r10375 | vlefevre | 2016-05-25 19:44:17 +0000 (Wed, 25 May 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Fixed bug introduced in r10327, giving: +error: ISO C does not allow extra ';' outside of a function [-Wpedantic] +------------------------------------------------------------------------ +r10374 | zimmerma | 2016-05-25 18:39:24 +0000 (Wed, 25 May 2016) | 2 lines +Changed paths: + M /trunk/src/log_ui.c + +improved mpfr_log_ui + +------------------------------------------------------------------------ +r10373 | zimmerma | 2016-05-25 17:26:55 +0000 (Wed, 25 May 2016) | 2 lines +Changed paths: + M /trunk/tests/memory.c + +added comment + +------------------------------------------------------------------------ +r10372 | vlefevre | 2016-05-25 11:46:34 +0000 (Wed, 25 May 2016) | 2 lines +Changed paths: + M /trunk/TODO + +[TODO] mpfr_ai efficiency: also mention mpfr.texi (the issue with large +arguments has always been documented). +------------------------------------------------------------------------ +r10371 | vlefevre | 2016-05-25 11:42:32 +0000 (Wed, 25 May 2016) | 2 lines +Changed paths: + M /trunk/TODO + +[TODO] mpfr_ai efficiency: mention tests/tai.c (the REDUCE_EMAX was +added in r6734). +------------------------------------------------------------------------ +r10370 | zimmerma | 2016-05-25 09:59:51 +0000 (Wed, 25 May 2016) | 2 lines +Changed paths: + M /trunk/TODO + +added item about efficiency of mpfr_ai for large arguments + +------------------------------------------------------------------------ +r10369 | vlefevre | 2016-05-25 07:57:59 +0000 (Wed, 25 May 2016) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Also clarified the use of "configure". +------------------------------------------------------------------------ +r10368 | vlefevre | 2016-05-25 07:55:48 +0000 (Wed, 25 May 2016) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Clarified the use of "autogen.sh". +------------------------------------------------------------------------ +r10367 | zimmerma | 2016-05-25 07:32:01 +0000 (Wed, 25 May 2016) | 2 lines +Changed paths: + M /trunk/tools/nightly-test + +use autogen.sh + +------------------------------------------------------------------------ +r10366 | zimmerma | 2016-05-25 07:03:11 +0000 (Wed, 25 May 2016) | 2 lines +Changed paths: + M /trunk/tools/nightly-test + +added libtoolize (needed for AX_PTHREAD) + +------------------------------------------------------------------------ +r10365 | vlefevre | 2016-05-24 23:44:24 +0000 (Tue, 24 May 2016) | 1 line +Changed paths: + M /trunk/tests/tlog_ui.c + +[tests/tlog_ui.c] Improved a test function. +------------------------------------------------------------------------ +r10364 | vlefevre | 2016-05-24 23:01:42 +0000 (Tue, 24 May 2016) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Fixed the use of m4_pattern_forbid: the argument must +be quoted, otherwise the macro is expanded when defined. +------------------------------------------------------------------------ +r10363 | zimmerma | 2016-05-24 21:37:31 +0000 (Tue, 24 May 2016) | 2 lines +Changed paths: + M /trunk/src/log_ui.c + +small improvements to log_ui (still slower than log for large precision) + +------------------------------------------------------------------------ +r10362 | vlefevre | 2016-05-24 20:47:59 +0000 (Tue, 24 May 2016) | 1 line +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Detect whether the AX_PTHREAD macro is left unexpanded. +------------------------------------------------------------------------ +r10361 | zimmerma | 2016-05-24 19:27:42 +0000 (Tue, 24 May 2016) | 2 lines +Changed paths: + M /trunk/tests/tconst_log2.c + +use rounding to nearest by default in "tconst_log2 prec" + +------------------------------------------------------------------------ +r10360 | zimmerma | 2016-05-24 19:02:07 +0000 (Tue, 24 May 2016) | 2 lines +Changed paths: + M /trunk/tests/tlog.c + +minor changes to allow ./tlog xxx prec + +------------------------------------------------------------------------ +r10359 | zimmerma | 2016-05-24 18:46:35 +0000 (Tue, 24 May 2016) | 2 lines +Changed paths: + M /trunk/tests/tgeneric.c + M /trunk/tests/tlog_ui.c + +added generic tests for mpfr_log_ui + compare with mpfr_log + +------------------------------------------------------------------------ +r10356 | vlefevre | 2016-05-24 15:48:56 +0000 (Tue, 24 May 2016) | 4 lines +Changed paths: + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + M /trunk/src/random_deviate.h + M /trunk/tests/mpfr-test.h + +Removed _MPFR_PROTO with the following Perl script on the .h files. + while (<>) { if ($c) { die if /_MPFR_PROTO/; s/^( {$c}) */$1/; + s/\) *\)/)/ and undef $c } elsif (s/^(.*)(_MPFR_PROTO *\()\(/$1(/) + { s/\) *\)/)/ or $c = 1 + length $1 } print } +------------------------------------------------------------------------ +r10355 | vlefevre | 2016-05-24 15:26:21 +0000 (Tue, 24 May 2016) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] Re-added AM_PROG_AR in case Microsoft lib.exe is used +(without this, "automake --warnings=all" gives a warning). +------------------------------------------------------------------------ +r10354 | vlefevre | 2016-05-24 15:13:15 +0000 (Tue, 24 May 2016) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Replaced the obsolete ACX_PTHREAD by AX_PTHREAD +(done with "autoupdate acinclude.m4"). +------------------------------------------------------------------------ +r10353 | vlefevre | 2016-05-24 15:03:30 +0000 (Tue, 24 May 2016) | 3 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] Moved LT_INIT near the top for --enable-lto, and removed +AM_PROG_AR (no longer needed as done by LT_INIT) and AC_PROG_RANLIB +(obsoleted by LT_INIT). +------------------------------------------------------------------------ +r10352 | vlefevre | 2016-05-24 14:41:52 +0000 (Tue, 24 May 2016) | 1 line +Changed paths: + M /trunk/src/ieee_floats.h + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + +Avoid some warnings with "gcc -Wundef". +------------------------------------------------------------------------ +r10351 | vlefevre | 2016-05-24 14:27:06 +0000 (Tue, 24 May 2016) | 1 line +Changed paths: + M /trunk/configure.ac + +[configure.ac] Removed a FIXME fixed in r4482. +------------------------------------------------------------------------ +r10349 | vlefevre | 2016-05-24 13:58:57 +0000 (Tue, 24 May 2016) | 1 line +Changed paths: + M /trunk/src/mpfr-longlong.h + +[src/mpfr-longlong.h] Update from GMP 6.1.0. +------------------------------------------------------------------------ +r10348 | vlefevre | 2016-05-24 12:55:15 +0000 (Tue, 24 May 2016) | 1 line +Changed paths: + M /trunk/src/mpfr-cvers.h + +[src/mpfr-cvers.h] Fixed typo in a macro (thanks to Patrick Pélissier). +------------------------------------------------------------------------ +r10347 | vlefevre | 2016-05-24 12:47:22 +0000 (Tue, 24 May 2016) | 4 lines +Changed paths: + M /trunk/src/sub1.c + +[src/sub1.c] Various minor improvements: + * Some changes related to the exponents and diff_exp. + * Coding style + use of IS_POW2. + * Use logging instead of #ifdef DEBUG and printf. +------------------------------------------------------------------------ +r10346 | zimmerma | 2016-05-24 12:26:13 +0000 (Tue, 24 May 2016) | 2 lines +Changed paths: + M /trunk/doc/README.dev + M /trunk/src/add1.c + M /trunk/src/add1sp.c + M /trunk/src/cmp2.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mul.c + M /trunk/src/mul_2ui.c + M /trunk/src/mul_ui.c + M /trunk/src/rint.c + M /trunk/src/round_raw_generic.c + M /trunk/src/set.c + M /trunk/src/set_prec.c + M /trunk/src/sub1.c + M /trunk/src/sub1sp.c + +removed too aggressive MPFR_LIKELY/MPFR_UNLIKELY (see README.dev) + +------------------------------------------------------------------------ +r10345 | vlefevre | 2016-05-24 10:47:12 +0000 (Tue, 24 May 2016) | 1 line +Changed paths: + M /trunk/acinclude.m4 + M /trunk/configure.ac + +Added optional LTO support (from a patch by Patrick Pélissier). +------------------------------------------------------------------------ +r10344 | vlefevre | 2016-05-24 10:27:33 +0000 (Tue, 24 May 2016) | 3 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/free_cache.c + +Corrected mpfr_free_cache behavior when WANT_SHARED_CACHE is defined +to make it consistent with the behavior when WANT_SHARED_CACHE is not +defined (patch by Patrick Pélissier). +------------------------------------------------------------------------ +r10342 | vlefevre | 2016-05-24 10:00:00 +0000 (Tue, 24 May 2016) | 2 lines +Changed paths: + M /trunk/tests/tfpif.c + +[tests/tfpif.c] Correction on r10338: use src_fopen instead of fopen +and check fp (just like with FILE_NAME_R). +------------------------------------------------------------------------ +r10339 | zimmerma | 2016-05-24 09:19:44 +0000 (Tue, 24 May 2016) | 2 lines +Changed paths: + M /trunk/tests/Makefile.am + A /trunk/tests/mpfrtest2.dat + +added new (read-only) test file for mpfr_fpif_import + +------------------------------------------------------------------------ +r10338 | zimmerma | 2016-05-24 09:18:36 +0000 (Tue, 24 May 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/tests/tfpif.c + +added tests for mpfr_fpif_import with precision > MPFR_PREC_MAX + +------------------------------------------------------------------------ +r10336 | vlefevre | 2016-05-24 08:19:17 +0000 (Tue, 24 May 2016) | 1 line +Changed paths: + M /trunk/NEWS + +Updated NEWS about shared caches. +------------------------------------------------------------------------ +r10335 | vlefevre | 2016-05-24 08:17:02 +0000 (Tue, 24 May 2016) | 1 line +Changed paths: + M /trunk/INSTALL + M /trunk/NEWS + M /trunk/VERSION + M /trunk/configure.ac + M /trunk/doc/mpfr.texi + M /trunk/src/Makefile.am + M /trunk/src/mpfr.h + M /trunk/src/version.c + +MPFR 3.2(.x) → 4.0(.x) +------------------------------------------------------------------------ +r10334 | vlefevre | 2016-05-24 00:31:26 +0000 (Tue, 24 May 2016) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + +[NEWS] New function mpfr_buildopt_sharedcache_p in MPFR 3.2. +[doc/mpfr.texi] New function mpfr_buildopt_sharedcache_p. Minor changes. +------------------------------------------------------------------------ +r10333 | vlefevre | 2016-05-23 23:52:58 +0000 (Mon, 23 May 2016) | 4 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] About the MPFR_DECL_INIT_CACHE macro: + * Added a FIXME comment about a possible warning due to a missing + field initializer; suggest 2 possible solutions. + * Improved code readability. +------------------------------------------------------------------------ +r10332 | vlefevre | 2016-05-23 22:41:26 +0000 (Mon, 23 May 2016) | 1 line +Changed paths: + M /trunk/src/free_cache.c + +[src/free_cache.c] Avoid duplicated source code for maintainability. +------------------------------------------------------------------------ +r10331 | vlefevre | 2016-05-23 22:27:29 +0000 (Mon, 23 May 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Corrections about caches. +------------------------------------------------------------------------ +r10330 | vlefevre | 2016-05-23 22:13:44 +0000 (Mon, 23 May 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-thread.h + +[src/mpfr-thread.h] For #error, use a string literal as a single +preprocessing-token. +------------------------------------------------------------------------ +r10329 | vlefevre | 2016-05-23 22:06:24 +0000 (Mon, 23 May 2016) | 1 line +Changed paths: + M /trunk/src/mpfr-thread.h + +[src/mpfr-thread.h] Coding style. +------------------------------------------------------------------------ +r10328 | vlefevre | 2016-05-23 22:02:48 +0000 (Mon, 23 May 2016) | 1 line +Changed paths: + M /trunk/src/cache.c + M /trunk/src/free_cache.c + M /trunk/tests/tconst_pi.c + +Minor comment & coding style corrections on r10327. +------------------------------------------------------------------------ +r10327 | vlefevre | 2016-05-23 16:12:32 +0000 (Mon, 23 May 2016) | 1 line +Changed paths: + M /trunk/TODO + M /trunk/acinclude.m4 + M /trunk/configure.ac + M /trunk/doc/README.dev + M /trunk/doc/mpfr.texi + M /trunk/src/buildopt.c + M /trunk/src/cache.c + M /trunk/src/free_cache.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-thread.h + M /trunk/src/mpfr.h + M /trunk/tests/memory.c + M /trunk/tests/tconst_pi.c + M /trunk/tests/tests.c + +Added shared cache support (from a patch by Patrick Pélissier). +------------------------------------------------------------------------ +r10326 | zimmerma | 2016-05-23 15:55:42 +0000 (Mon, 23 May 2016) | 2 lines +Changed paths: + M /trunk/tests/tfpif.c + +added tests for mpfr_fpif in precision 1 + +------------------------------------------------------------------------ +r10321 | vlefevre | 2016-05-23 14:17:58 +0000 (Mon, 23 May 2016) | 1 line +Changed paths: + M /trunk/src/gmp_op.c + M /trunk/src/pow_z.c + M /trunk/src/set_f.c + M /trunk/src/set_q.c + M /trunk/src/set_z_exp.c + +ABS(SIZ(x)) → ABSIZ(x) +------------------------------------------------------------------------ +r10319 | zimmerma | 2016-05-23 13:08:04 +0000 (Mon, 23 May 2016) | 3 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +redefine mpfr_init_set_xxx with mpz_t pool, otherwise the pool is not +used for those calls + +------------------------------------------------------------------------ +r10313 | zimmerma | 2016-05-23 09:59:58 +0000 (Mon, 23 May 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +added comment about MPFR_MY_MPZ_INIT + +------------------------------------------------------------------------ +r10312 | vlefevre | 2016-05-23 09:54:47 +0000 (Mon, 23 May 2016) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Replaced a comment by a MPFR_ASSERTD. +------------------------------------------------------------------------ +r10311 | vlefevre | 2016-05-23 09:46:33 +0000 (Mon, 23 May 2016) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Code simplification. +------------------------------------------------------------------------ +r10310 | vlefevre | 2016-05-23 09:36:14 +0000 (Mon, 23 May 2016) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Replaced a comment by a MPFR_ASSERTD. +------------------------------------------------------------------------ +r10309 | vlefevre | 2016-05-23 08:28:07 +0000 (Mon, 23 May 2016) | 5 lines +Changed paths: + M /trunk/src/print_raw.c + +[src/print_raw.c] Changes for mpfr_print_binary / mpfr_dump: + * Support out-of-range exponents as this function is mainly for + debugging purpose (TODO: add some warning for such exponents). + See: https://sympa.inria.fr/sympa/arc/mpfr/2016-01/msg00061.html + * Support _MPFR_EXP_FORMAT == 4 (format used for testing). +------------------------------------------------------------------------ +r10308 | vlefevre | 2016-05-22 22:27:26 +0000 (Sun, 22 May 2016) | 3 lines +Changed paths: + M /trunk/AUTHORS + M /trunk/BUGS + M /trunk/COPYING + M /trunk/COPYING.LESSER + M /trunk/ChangeLog + M /trunk/INSTALL + M /trunk/Makefile.am + M /trunk/NEWS + M /trunk/README + M /trunk/TODO + M /trunk/VERSION + M /trunk/acinclude.m4 + M /trunk/configure.ac + M /trunk/doc/FAQ.html + M /trunk/doc/README.dev + M /trunk/doc/algorithms.bib + M /trunk/doc/algorithms.tex + M /trunk/doc/faq.xsl + M /trunk/doc/fdl.texi + M /trunk/doc/mpfr.texi + M /trunk/doc/update-faq + M /trunk/examples/divworst.c + M /trunk/examples/rndo-add.c + M /trunk/examples/sample.c + M /trunk/examples/version.c + M /trunk/other/cputime.h + M /trunk/other/div-short.c + M /trunk/src/Makefile.am + M /trunk/src/abort_prec_max.c + M /trunk/src/acos.c + M /trunk/src/acosh.c + M /trunk/src/add.c + M /trunk/src/add1.c + M /trunk/src/add1sp.c + M /trunk/src/add_d.c + M /trunk/src/add_ui.c + M /trunk/src/agm.c + M /trunk/src/ai.c + M /trunk/src/asin.c + M /trunk/src/asinh.c + M /trunk/src/atan.c + M /trunk/src/atan2.c + M /trunk/src/atanh.c + M /trunk/src/bernoulli.c + M /trunk/src/buildopt.c + M /trunk/src/cache.c + M /trunk/src/cbrt.c + M /trunk/src/check.c + M /trunk/src/clear.c + M /trunk/src/clears.c + M /trunk/src/cmp.c + M /trunk/src/cmp2.c + M /trunk/src/cmp_abs.c + M /trunk/src/cmp_d.c + M /trunk/src/cmp_ld.c + M /trunk/src/cmp_si.c + M /trunk/src/cmp_ui.c + M /trunk/src/comparisons.c + M /trunk/src/const_catalan.c + M /trunk/src/const_euler.c + M /trunk/src/const_log2.c + M /trunk/src/const_pi.c + M /trunk/src/constant.c + M /trunk/src/copysign.c + M /trunk/src/cos.c + M /trunk/src/cosh.c + M /trunk/src/cot.c + M /trunk/src/coth.c + M /trunk/src/csc.c + M /trunk/src/csch.c + M /trunk/src/d_div.c + M /trunk/src/d_sub.c + M /trunk/src/digamma.c + M /trunk/src/dim.c + M /trunk/src/div.c + M /trunk/src/div_2exp.c + M /trunk/src/div_2si.c + M /trunk/src/div_2ui.c + M /trunk/src/div_d.c + M /trunk/src/div_ui.c + M /trunk/src/dump.c + M /trunk/src/eint.c + M /trunk/src/eq.c + M /trunk/src/erandom.c + M /trunk/src/erf.c + M /trunk/src/erfc.c + M /trunk/src/exceptions.c + M /trunk/src/exp.c + M /trunk/src/exp10.c + M /trunk/src/exp2.c + M /trunk/src/exp3.c + M /trunk/src/exp_2.c + M /trunk/src/expm1.c + M /trunk/src/extract.c + M /trunk/src/factorial.c + M /trunk/src/fits_intmax.c + M /trunk/src/fits_s.h + M /trunk/src/fits_sint.c + M /trunk/src/fits_slong.c + M /trunk/src/fits_sshort.c + M /trunk/src/fits_u.h + M /trunk/src/fits_uint.c + M /trunk/src/fits_uintmax.c + M /trunk/src/fits_ulong.c + M /trunk/src/fits_ushort.c + M /trunk/src/fma.c + M /trunk/src/fms.c + M /trunk/src/fpif.c + M /trunk/src/frac.c + M /trunk/src/free_cache.c + M /trunk/src/frexp.c + M /trunk/src/gamma.c + M /trunk/src/gammaonethird.c + M /trunk/src/gen_inverse.h + M /trunk/src/get_d.c + M /trunk/src/get_d64.c + M /trunk/src/get_exp.c + M /trunk/src/get_f.c + M /trunk/src/get_float128.c + M /trunk/src/get_flt.c + M /trunk/src/get_ld.c + M /trunk/src/get_si.c + M /trunk/src/get_sj.c + M /trunk/src/get_str.c + M /trunk/src/get_ui.c + M /trunk/src/get_uj.c + M /trunk/src/get_z.c + M /trunk/src/get_z_exp.c + M /trunk/src/gmp_op.c + M /trunk/src/hypot.c + M /trunk/src/ieee_floats.h + M /trunk/src/init.c + M /trunk/src/init2.c + M /trunk/src/inits.c + M /trunk/src/inits2.c + M /trunk/src/inp_str.c + M /trunk/src/int_ceil_log2.c + M /trunk/src/isinf.c + M /trunk/src/isinteger.c + M /trunk/src/isnan.c + M /trunk/src/isnum.c + M /trunk/src/isqrt.c + M /trunk/src/isregular.c + M /trunk/src/iszero.c + M /trunk/src/jn.c + M /trunk/src/jyn_asympt.c + M /trunk/src/li2.c + M /trunk/src/lngamma.c + M /trunk/src/log.c + M /trunk/src/log10.c + M /trunk/src/log1p.c + M /trunk/src/log2.c + M /trunk/src/logging.c + M /trunk/src/min_prec.c + M /trunk/src/minmax.c + M /trunk/src/modf.c + M /trunk/src/mp_clz_tab.c + M /trunk/src/mparam_h.in + M /trunk/src/mpf2mpfr.h + M /trunk/src/mpfr-cvers.h + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-longlong.h + M /trunk/src/mpfr-thread.h + M /trunk/src/mpfr.h + M /trunk/src/mpn_exp.c + M /trunk/src/mul.c + M /trunk/src/mul_2exp.c + M /trunk/src/mul_2si.c + M /trunk/src/mul_2ui.c + M /trunk/src/mul_d.c + M /trunk/src/mul_ui.c + M /trunk/src/mulders.c + M /trunk/src/neg.c + M /trunk/src/next.c + M /trunk/src/out_str.c + M /trunk/src/pow.c + M /trunk/src/pow_si.c + M /trunk/src/pow_ui.c + M /trunk/src/pow_z.c + M /trunk/src/powerof2.c + M /trunk/src/print_raw.c + M /trunk/src/print_rnd_mode.c + M /trunk/src/printf.c + M /trunk/src/rec_sqrt.c + M /trunk/src/reldiff.c + M /trunk/src/rem1.c + M /trunk/src/rint.c + M /trunk/src/root.c + M /trunk/src/round_near_x.c + M /trunk/src/round_p.c + M /trunk/src/round_prec.c + M /trunk/src/round_raw_generic.c + M /trunk/src/scale2.c + M /trunk/src/sec.c + M /trunk/src/sech.c + M /trunk/src/set.c + M /trunk/src/set_d.c + M /trunk/src/set_d64.c + M /trunk/src/set_dfl_prec.c + M /trunk/src/set_exp.c + M /trunk/src/set_f.c + M /trunk/src/set_flt.c + M /trunk/src/set_inf.c + M /trunk/src/set_ld.c + M /trunk/src/set_nan.c + M /trunk/src/set_prc_raw.c + M /trunk/src/set_prec.c + M /trunk/src/set_q.c + M /trunk/src/set_rnd.c + M /trunk/src/set_si.c + M /trunk/src/set_si_2exp.c + M /trunk/src/set_sj.c + M /trunk/src/set_str.c + M /trunk/src/set_str_raw.c + M /trunk/src/set_ui.c + M /trunk/src/set_ui_2exp.c + M /trunk/src/set_uj.c + M /trunk/src/set_z.c + M /trunk/src/set_z_exp.c + M /trunk/src/set_zero.c + M /trunk/src/setmax.c + M /trunk/src/setmin.c + M /trunk/src/setsign.c + M /trunk/src/sgn.c + M /trunk/src/si_op.c + M /trunk/src/signbit.c + M /trunk/src/sin.c + M /trunk/src/sin_cos.c + M /trunk/src/sinh.c + M /trunk/src/sinh_cosh.c + M /trunk/src/sqr.c + M /trunk/src/sqrt.c + M /trunk/src/sqrt_ui.c + M /trunk/src/stack_interface.c + M /trunk/src/strtofr.c + M /trunk/src/sub.c + M /trunk/src/sub1.c + M /trunk/src/sub1sp.c + M /trunk/src/sub_d.c + M /trunk/src/sub_ui.c + M /trunk/src/subnormal.c + M /trunk/src/sum.c + M /trunk/src/swap.c + M /trunk/src/tan.c + M /trunk/src/tanh.c + M /trunk/src/uceil_exp2.c + M /trunk/src/uceil_log2.c + M /trunk/src/ufloor_log2.c + M /trunk/src/ui_div.c + M /trunk/src/ui_pow.c + M /trunk/src/ui_pow_ui.c + M /trunk/src/ui_sub.c + M /trunk/src/urandom.c + M /trunk/src/urandomb.c + M /trunk/src/vasprintf.c + M /trunk/src/version.c + M /trunk/src/volatile.c + M /trunk/src/yn.c + M /trunk/src/zeta.c + M /trunk/src/zeta_ui.c + M /trunk/tests/Makefile.am + M /trunk/tests/RRTest.c + M /trunk/tests/cmp_str.c + M /trunk/tests/inp_str.dat + M /trunk/tests/memory.c + M /trunk/tests/mpf_compat.c + M /trunk/tests/mpf_compat.h + M /trunk/tests/mpfr-test.h + M /trunk/tests/mpfr_compat.c + M /trunk/tests/random2.c + M /trunk/tests/reuse.c + M /trunk/tests/rnd_mode.c + M /trunk/tests/tabs.c + M /trunk/tests/tacos.c + M /trunk/tests/tacosh.c + M /trunk/tests/tadd.c + M /trunk/tests/tadd1sp.c + M /trunk/tests/tadd_d.c + M /trunk/tests/tadd_ui.c + M /trunk/tests/tagm.c + M /trunk/tests/tai.c + M /trunk/tests/talloc.c + M /trunk/tests/tasin.c + M /trunk/tests/tasinh.c + M /trunk/tests/tatan.c + M /trunk/tests/tatanh.c + M /trunk/tests/taway.c + M /trunk/tests/tbuildopt.c + M /trunk/tests/tcan_round.c + M /trunk/tests/tcbrt.c + M /trunk/tests/tcheck.c + M /trunk/tests/tcmp.c + M /trunk/tests/tcmp2.c + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + M /trunk/tests/tcmp_ui.c + M /trunk/tests/tcmpabs.c + M /trunk/tests/tcomparisons.c + M /trunk/tests/tconst_catalan.c + M /trunk/tests/tconst_euler.c + M /trunk/tests/tconst_log2.c + M /trunk/tests/tconst_pi.c + M /trunk/tests/tcopysign.c + M /trunk/tests/tcos.c + M /trunk/tests/tcosh.c + M /trunk/tests/tcot.c + M /trunk/tests/tcoth.c + M /trunk/tests/tcsc.c + M /trunk/tests/tcsch.c + M /trunk/tests/td_div.c + M /trunk/tests/td_sub.c + M /trunk/tests/tdigamma.c + M /trunk/tests/tdim.c + M /trunk/tests/tdiv.c + M /trunk/tests/tdiv_d.c + M /trunk/tests/tdiv_ui.c + M /trunk/tests/teint.c + M /trunk/tests/teq.c + M /trunk/tests/terf.c + M /trunk/tests/tests.c + M /trunk/tests/texceptions.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/texpm1.c + M /trunk/tests/tfactorial.c + M /trunk/tests/tfits.c + M /trunk/tests/tfma.c + M /trunk/tests/tfmod.c + M /trunk/tests/tfms.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tfrac.c + M /trunk/tests/tgamma.c + M /trunk/tests/tgeneric.c + M /trunk/tests/tgeneric_ui.c + M /trunk/tests/tget_d.c + M /trunk/tests/tget_d_2exp.c + M /trunk/tests/tget_f.c + M /trunk/tests/tget_flt.c + M /trunk/tests/tget_ld_2exp.c + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tget_sj.c + M /trunk/tests/tget_str.c + M /trunk/tests/tget_z.c + M /trunk/tests/tgmpop.c + M /trunk/tests/thyperbolic.c + M /trunk/tests/thypot.c + M /trunk/tests/tinits.c + M /trunk/tests/tinp_str.c + M /trunk/tests/tinternals.c + M /trunk/tests/tisnan.c + M /trunk/tests/tisqrt.c + M /trunk/tests/tj0.c + M /trunk/tests/tj1.c + M /trunk/tests/tjn.c + M /trunk/tests/tl2b.c + M /trunk/tests/tlgamma.c + M /trunk/tests/tli2.c + M /trunk/tests/tlngamma.c + M /trunk/tests/tlog.c + M /trunk/tests/tlog10.c + M /trunk/tests/tlog1p.c + M /trunk/tests/tlog2.c + M /trunk/tests/tmin_prec.c + M /trunk/tests/tminmax.c + M /trunk/tests/tmodf.c + M /trunk/tests/tmul.c + M /trunk/tests/tmul_2exp.c + M /trunk/tests/tmul_d.c + M /trunk/tests/tmul_ui.c + M /trunk/tests/tnext.c + M /trunk/tests/tout_str.c + M /trunk/tests/toutimpl.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow3.c + M /trunk/tests/tpow_all.c + M /trunk/tests/tpow_z.c + M /trunk/tests/tprintf.c + M /trunk/tests/trandom.c + M /trunk/tests/trec_sqrt.c + M /trunk/tests/tremquo.c + M /trunk/tests/trint.c + M /trunk/tests/troot.c + M /trunk/tests/tround_prec.c + M /trunk/tests/tsec.c + M /trunk/tests/tsech.c + M /trunk/tests/tset.c + M /trunk/tests/tset_d.c + M /trunk/tests/tset_exp.c + M /trunk/tests/tset_f.c + M /trunk/tests/tset_ld.c + M /trunk/tests/tset_q.c + M /trunk/tests/tset_si.c + M /trunk/tests/tset_sj.c + M /trunk/tests/tset_str.c + M /trunk/tests/tset_z.c + M /trunk/tests/tset_z_exp.c + M /trunk/tests/tsgn.c + M /trunk/tests/tsi_op.c + M /trunk/tests/tsin.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tsinh.c + M /trunk/tests/tsinh_cosh.c + M /trunk/tests/tsprintf.c + M /trunk/tests/tsqr.c + M /trunk/tests/tsqrt.c + M /trunk/tests/tsqrt_ui.c + M /trunk/tests/tstckintc.c + M /trunk/tests/tstdint.c + M /trunk/tests/tstrtofr.c + M /trunk/tests/tsub.c + M /trunk/tests/tsub1sp.c + M /trunk/tests/tsub_d.c + M /trunk/tests/tsub_ui.c + M /trunk/tests/tsubnormal.c + M /trunk/tests/tsum.c + M /trunk/tests/tswap.c + M /trunk/tests/ttan.c + M /trunk/tests/ttanh.c + M /trunk/tests/ttrunc.c + M /trunk/tests/tui_div.c + M /trunk/tests/tui_pow.c + M /trunk/tests/tui_sub.c + M /trunk/tests/turandom.c + M /trunk/tests/tversion.c + M /trunk/tests/ty0.c + M /trunk/tests/ty1.c + M /trunk/tests/tyn.c + M /trunk/tests/tzeta.c + M /trunk/tests/tzeta_ui.c + M /trunk/tools/check_inits_clears + M /trunk/tools/coverage + M /trunk/tools/mbench/generate.c + M /trunk/tools/mbench/mfv5.h + M /trunk/tools/mbench/mpfr-gfx.c + M /trunk/tools/mbench/mpfr-v4.c + M /trunk/tools/mbench/mpfr-v6.c + M /trunk/tools/mbench/timp.h + M /trunk/tools/update-version + M /trunk/tune/speed.c + M /trunk/tune/tuneup.c + +Removed svn:keywords properties: they are not used, we do not plan +to use them (such a feature does not exist in other VCS), and they +may break things if used by mistake. +------------------------------------------------------------------------ +r10307 | vlefevre | 2016-05-22 22:06:00 +0000 (Sun, 22 May 2016) | 1 line +Changed paths: + M /trunk/tests/tfmma.c + +[tests/tfmma.c] Corrections and improvements in random_test. +------------------------------------------------------------------------ +r10306 | vlefevre | 2016-05-22 21:55:56 +0000 (Sun, 22 May 2016) | 1 line +Changed paths: + M /trunk/tests/tfmma.c + +[tests/tfmma.c] Replaced mpfr_cmp by the stronger mpfr_equal_p. +------------------------------------------------------------------------ +r10303 | vlefevre | 2016-05-22 09:58:51 +0000 (Sun, 22 May 2016) | 3 lines +Changed paths: + M /trunk/tests/tadd_ui.c + M /trunk/tests/tsub_ui.c + +[tests] + * tadd_ui.c: clean-up (a boolean test doesn't need "!= 0"). + * tsub_ui.c: check that the NaN flag is set on NaN. +------------------------------------------------------------------------ +r10302 | vlefevre | 2016-05-22 09:31:34 +0000 (Sun, 22 May 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Added IS_SIGNED macro to check whether an integer type +(after integer promotion) is signed; and use it for MPFR_EXP_IN_RANGE. +------------------------------------------------------------------------ +r10301 | vlefevre | 2016-05-20 14:26:39 +0000 (Fri, 20 May 2016) | 2 lines +Changed paths: + M /trunk/src/ui_sub.c + +[src/ui_sub.c] Improved code style and assertions, making mpfr_ui_sub +more like mpfr_add_ui and mpfr_sub_ui. Added comments. +------------------------------------------------------------------------ +r10300 | vlefevre | 2016-05-20 14:17:57 +0000 (Fri, 20 May 2016) | 2 lines +Changed paths: + M /trunk/src/add_ui.c + M /trunk/src/sub_ui.c + +Partly rewrote mpfr_add_ui and mpfr_sub_ui (more similar to the +mpfr_ui_sub code), solving the failures. +------------------------------------------------------------------------ +r10299 | vlefevre | 2016-05-20 11:43:07 +0000 (Fri, 20 May 2016) | 3 lines +Changed paths: + M /trunk/tests/tgeneric.c + +[tests/tgeneric.c] Check NaN argument, mainly in order to check the NaN +flag when the result is NaN (almost all cases). This makes both tadd_ui +(ignoring the new test done in r10298) and tsub_ui fail. +------------------------------------------------------------------------ +r10298 | zimmerma | 2016-05-19 15:52:25 +0000 (Thu, 19 May 2016) | 2 lines +Changed paths: + M /trunk/tests/tadd_ui.c + +added test case for bug reported by Rob (sisyphus1@optusnet.com.au) + +------------------------------------------------------------------------ +r10297 | vlefevre | 2016-05-19 14:34:44 +0000 (Thu, 19 May 2016) | 1 line +Changed paths: + M /trunk/src/fmma.c + +[src/fmma.c] Added FIXME comments. +------------------------------------------------------------------------ +r10296 | vlefevre | 2016-05-18 15:31:02 +0000 (Wed, 18 May 2016) | 1 line +Changed paths: + M /trunk/src/check.c + M /trunk/src/fpif.c + M /trunk/src/mpfr-impl.h + M /trunk/src/urandomb.c + +Added MPFR_EXP_IN_RANGE macro, and replaced some tests to use it. +------------------------------------------------------------------------ +r10295 | vlefevre | 2016-05-18 15:26:17 +0000 (Wed, 18 May 2016) | 1 line +Changed paths: + M /trunk/src/fma.c + +[src/fma.c] Minor code simplification. +------------------------------------------------------------------------ +r10294 | vlefevre | 2016-05-17 23:34:48 +0000 (Tue, 17 May 2016) | 4 lines +Changed paths: + M /trunk/src/exp.c + M /trunk/src/get_str.c + M /trunk/src/mpfr-impl.h + M /trunk/src/pow.c + +Improved code related to mpfr_set_exp_t: + * Define MPFR_EXP_LIMB_SIZE macro (size of mpfr_exp_t in limbs) + and use it. + * src/pow.c: replaced a mpfr_init2 by MPFR_TMP_INIT1. +------------------------------------------------------------------------ +r10293 | zimmerma | 2016-05-17 09:40:21 +0000 (Tue, 17 May 2016) | 2 lines +Changed paths: + M /trunk/tests/tget_set_d64.c + +added comment about printing decimal floats + +------------------------------------------------------------------------ +r10292 | vlefevre | 2016-05-13 15:24:50 +0000 (Fri, 13 May 2016) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Minor improvements. +------------------------------------------------------------------------ +r10291 | vlefevre | 2016-05-12 00:29:43 +0000 (Thu, 12 May 2016) | 1 line +Changed paths: + M /trunk/configure.ac + +[configure.ac] Added a comment about GMP CC/CFLAGS detection. +------------------------------------------------------------------------ +r10290 | vlefevre | 2016-05-12 00:16:35 +0000 (Thu, 12 May 2016) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] Better GMP CC/CFLAGS detection (based on a patch by +Patrick Pélissier). +------------------------------------------------------------------------ +r10289 | zimmerma | 2016-05-11 14:38:59 +0000 (Wed, 11 May 2016) | 2 lines +Changed paths: + M /trunk/configure.ac + +add -P option to cpp when detecting CC/CFLAGS in gmp.h (workaround for gcc-5) + +------------------------------------------------------------------------ +r10288 | vlefevre | 2016-05-04 15:54:30 +0000 (Wed, 04 May 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r10286 | vlefevre | 2016-05-04 14:14:23 +0000 (Wed, 04 May 2016) | 3 lines +Changed paths: + M /trunk/Makefile.am + M /trunk/doc/Makefile.am + +[doc/Makefile.am] Reverted the change done in r10283 as the mpfr.info + file was always rebuilt. +[Makefile.am] Execute check-typography from dist-hook instead. +------------------------------------------------------------------------ +r10285 | vlefevre | 2016-05-04 14:01:31 +0000 (Wed, 04 May 2016) | 3 lines +Changed paths: + M /trunk/Makefile.am + M /trunk/doc/check-typography + +[Makefile.am] Add doc/check-typography to the tarball as it is needed + to rebuild the mpfr.info file if the mpfr.texi file is modified. +[doc/check-typography] Added copyright notice and explanations. +------------------------------------------------------------------------ +r10284 | vlefevre | 2016-05-04 13:44:59 +0000 (Wed, 04 May 2016) | 1 line +Changed paths: + M /trunk/doc/check-typography + +[doc/check-typography] Removed useless parentheses. +------------------------------------------------------------------------ +r10283 | vlefevre | 2016-05-04 13:41:11 +0000 (Wed, 04 May 2016) | 10 lines +Changed paths: + M /trunk/doc/Makefile.am + A /trunk/doc/check-typography + M /trunk/doc/mpfr.texi + M /trunk/tools/mpfrlint + +Detect typography ambiguities in doc/mpfr.texi ASAP: to avoid errors +due to implicit rules, it is better to explicitly make clear whether +a punctuation mark ends or does not end a sentence. + * Added doc/check-typography sh script to detect such typography + ambiguities. + * doc/Makefile.am: automatically execute this script before mpfr.info + is rebuilt; fail with explanations in case there are ambiguities. + * doc/mpfr.texi: avoid typography ambiguities. + * tools/mpfrlint: replaced the old typography check by a call to the + check-typography script (which does more checks). +------------------------------------------------------------------------ +r10282 | vlefevre | 2016-05-04 11:20:28 +0000 (Wed, 04 May 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Typographic correction on the latest addition. +------------------------------------------------------------------------ +r10281 | vlefevre | 2016-05-04 11:17:11 +0000 (Wed, 04 May 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] The MPFR_ and mpfr_ prefixes are reserved for MPFR. +------------------------------------------------------------------------ +r10278 | vlefevre | 2016-04-25 13:11:11 +0000 (Mon, 25 Apr 2016) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Clean-up. +------------------------------------------------------------------------ +r10276 | vlefevre | 2016-04-21 12:36:10 +0000 (Thu, 21 Apr 2016) | 3 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] Improved the GMP CC/CFLAGS detection: the test for $cpp +was not checking whether gmp.h could actually be included, so that the +code was outputting "yes" even when gmp.h was not installed. +------------------------------------------------------------------------ +r10273 | vlefevre | 2016-04-21 09:23:27 +0000 (Thu, 21 Apr 2016) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Added: Limited pkg-config support. +------------------------------------------------------------------------ +r10272 | vlefevre | 2016-04-21 08:37:29 +0000 (Thu, 21 Apr 2016) | 1 line +Changed paths: + M /trunk + M /trunk/Makefile.am + M /trunk/README + M /trunk/configure.ac + M /trunk/doc/mpfr.texi + A /trunk/mpfr.pc.in + +Added pkg-config support (patch from Kip Warner + some changes). +------------------------------------------------------------------------ +r10271 | zimmerma | 2016-04-20 11:48:14 +0000 (Wed, 20 Apr 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-gmp.h + +typo + +------------------------------------------------------------------------ +r10270 | vlefevre | 2016-04-20 11:47:20 +0000 (Wed, 20 Apr 2016) | 1 line +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Improved warning message for the "long double" test. +------------------------------------------------------------------------ +r10269 | vlefevre | 2016-04-20 11:44:45 +0000 (Wed, 20 Apr 2016) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] "double format" test: changed the AC_MSG_ERROR (when +not recognized) to AC_MSG_WARN (like with long double). +------------------------------------------------------------------------ +r10268 | vlefevre | 2016-04-20 11:39:31 +0000 (Wed, 20 Apr 2016) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] No longer include in the "double format" test +(it is unnecessary and doesn't exist everywhere). +------------------------------------------------------------------------ +r10267 | vlefevre | 2016-04-20 11:35:26 +0000 (Wed, 20 Apr 2016) | 1 line +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Typo. +------------------------------------------------------------------------ +r10263 | vlefevre | 2016-04-13 19:37:36 +0000 (Wed, 13 Apr 2016) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Updated a comment about Cygwin and Unix. +------------------------------------------------------------------------ +r10262 | vlefevre | 2016-04-09 11:20:32 +0000 (Sat, 09 Apr 2016) | 2 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Fixed bug triggered when the command for err-if-output +has empty arguments (this does not occur yet). +------------------------------------------------------------------------ +r10261 | vlefevre | 2016-04-08 23:39:28 +0000 (Fri, 08 Apr 2016) | 3 lines +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Output the status of the __GMP_LIBGMP_DLL and +MPFR_WIN_THREAD_SAFE_DLL macros (since unreliable consistency checks +have been removed in r10260). +------------------------------------------------------------------------ +r10260 | vlefevre | 2016-04-08 23:17:07 +0000 (Fri, 08 Apr 2016) | 8 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Removed the detection of possible inconsistencies +under Unix because the tests could yield spurious errors with Cygwin32 +or other similar implementations. Moreover, such tests were used for +debugging purpose or to detect potential problems in the environment, +thus were not really useful for the end user. They were initially +added in the win-thread-safe-dll branch (r9682, following a problem +found in r9680). One alternative for checking by the MPFR developers +would be to output the status of some internal macros in tversion. +------------------------------------------------------------------------ +r10259 | vlefevre | 2016-04-08 16:02:39 +0000 (Fri, 08 Apr 2016) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Use err-if-output also for external checkers. +------------------------------------------------------------------------ +r10258 | vlefevre | 2016-04-08 15:56:20 +0000 (Fri, 08 Apr 2016) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Better choice of a variable name. +------------------------------------------------------------------------ +r10257 | zimmerma | 2016-04-08 15:55:03 +0000 (Fri, 08 Apr 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +revert changeset 10255 + +------------------------------------------------------------------------ +r10256 | vlefevre | 2016-04-08 15:28:59 +0000 (Fri, 08 Apr 2016) | 4 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] + * Switched to zsh. + * Much more meaningful error messages. + * Fix: in the mpfr.texi punctuation test, ignore the comments. +------------------------------------------------------------------------ +r10255 | zimmerma | 2016-04-08 14:10:47 +0000 (Fri, 08 Apr 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +patch for Cygwin (cf http://trac.sagemath.org/ticket/20380) + +------------------------------------------------------------------------ +r10254 | vlefevre | 2016-04-08 07:58:49 +0000 (Fri, 08 Apr 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r10253 | vlefevre | 2016-04-07 15:10:30 +0000 (Thu, 07 Apr 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/dump.c + +[doc/mpfr.texi] Document mpfr_dump (which has always been there). +[src/dump.c] Added a comment (with TODO). +------------------------------------------------------------------------ +r10252 | vlefevre | 2016-04-07 13:59:37 +0000 (Thu, 07 Apr 2016) | 2 lines +Changed paths: + M /trunk/src/sub1.c + M /trunk/tests/reuse.c + M /trunk/tests/tabs.c + M /trunk/tests/tacos.c + M /trunk/tests/tadd.c + M /trunk/tests/tadd1sp.c + M /trunk/tests/tasin.c + M /trunk/tests/tatan.c + M /trunk/tests/tatanh.c + M /trunk/tests/taway.c + M /trunk/tests/tcmp2.c + M /trunk/tests/tcos.c + M /trunk/tests/tdiv.c + M /trunk/tests/tdiv_ui.c + M /trunk/tests/teq.c + M /trunk/tests/terf.c + M /trunk/tests/texceptions.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/tfactorial.c + M /trunk/tests/tgamma.c + M /trunk/tests/tgmpop.c + M /trunk/tests/tlgamma.c + M /trunk/tests/tlngamma.c + M /trunk/tests/tmul_ui.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow3.c + M /trunk/tests/trandom.c + M /trunk/tests/tset_d.c + M /trunk/tests/tset_str.c + M /trunk/tests/tsqrt.c + M /trunk/tests/tsub.c + M /trunk/tests/tsub1sp.c + M /trunk/tests/tsub_ui.c + M /trunk/tests/ttrunc.c + M /trunk/tests/tui_pow.c + M /trunk/tests/turandom.c + M /trunk/tests/tzeta.c + +Replaced various instances of mpfr_print_binary + newline (sometimes +missing) by mpfr_dump. +------------------------------------------------------------------------ +r10251 | vlefevre | 2016-04-07 13:43:13 +0000 (Thu, 07 Apr 2016) | 1 line +Changed paths: + M /trunk/tests/tgmpop.c + M /trunk/tests/tset_q.c + +[tests] Fixed typo in error messages. +------------------------------------------------------------------------ +r10249 | vlefevre | 2016-04-01 13:44:10 +0000 (Fri, 01 Apr 2016) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Mention ISO/IEC JTC 1/SC 22/WG 21 N3060 (C++ special functions). +------------------------------------------------------------------------ +r10247 | vlefevre | 2016-03-29 01:37:38 +0000 (Tue, 29 Mar 2016) | 9 lines +Changed paths: + M /trunk/INSTALL + +[INSTALL] Removed incorrect note about NetBSD/alpha: The configure +script distributed with the MPFR 3.1.4 tarball does not contain anything +related to the -mieee GCC option; this just seems to be a particular +pkgsrc issue for NetBSD: + http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/mk/platform/NetBSD.mk?rev=1.48&content-type=text/x-cvsweb-markup + https://www.google.fr/search?q=pkgsrc+%22mieee%22 +where -mieee is added. The -mieee-with-inexact option added in the MPFR +3.1 branch might yield the same error with the buggy GCC versions, but +this is now obsolete in the trunk (the code was removed in r10152). +------------------------------------------------------------------------ +r10246 | zimmerma | 2016-03-25 09:09:41 +0000 (Fri, 25 Mar 2016) | 2 lines +Changed paths: + M /trunk/INSTALL + +added note about NetBSD/alpha + +------------------------------------------------------------------------ +r10245 | vlefevre | 2016-03-16 15:22:31 +0000 (Wed, 16 Mar 2016) | 2 lines +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Added a summary of the timings, copied from: + ^/misc/sum-timings/results/ReadMe@10244 +------------------------------------------------------------------------ +r10235 | vlefevre | 2016-03-15 12:28:46 +0000 (Tue, 15 Mar 2016) | 1 line +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Updated comment of bug20160315 after fix in 3.1 branch. +------------------------------------------------------------------------ +r10233 | vlefevre | 2016-03-15 11:58:47 +0000 (Tue, 15 Mar 2016) | 2 lines +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Added bug20160315 (this bug appears when porting sum.c +for MPFR 3.1.4 but does not appear in the trunk). +------------------------------------------------------------------------ +r10232 | vlefevre | 2016-03-14 16:11:12 +0000 (Mon, 14 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Some clarification in the TMD case. +------------------------------------------------------------------------ +r10231 | vlefevre | 2016-03-14 13:59:53 +0000 (Mon, 14 Mar 2016) | 2 lines +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Added a proof that the choice for the size ts of the +temporary area is sufficient. +------------------------------------------------------------------------ +r10230 | vlefevre | 2016-03-14 01:48:55 +0000 (Mon, 14 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Replaced e by ε for the error (e is already used). +------------------------------------------------------------------------ +r10229 | vlefevre | 2016-03-14 01:24:52 +0000 (Mon, 14 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Update about t' in the error analysis. +------------------------------------------------------------------------ +r10228 | vlefevre | 2016-03-14 00:43:03 +0000 (Mon, 14 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] More about the notion of exponent in two's complement. +------------------------------------------------------------------------ +r10227 | vlefevre | 2016-03-13 23:59:54 +0000 (Sun, 13 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Update about sum_raw (with a correction of a typo). +------------------------------------------------------------------------ +r10226 | vlefevre | 2016-03-10 17:05:09 +0000 (Thu, 10 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Rewrote paragraph about limitations. +------------------------------------------------------------------------ +r10225 | vlefevre | 2016-03-10 16:33:10 +0000 (Thu, 10 Mar 2016) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Corrected comment: 32/64-bit machine → 32/64-bit ABI. +------------------------------------------------------------------------ +r10224 | vlefevre | 2016-03-10 16:20:29 +0000 (Thu, 10 Mar 2016) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Use UPDATE_MINEXP when necessary; added comments. +------------------------------------------------------------------------ +r10223 | vlefevre | 2016-03-10 16:09:38 +0000 (Thu, 10 Mar 2016) | 2 lines +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Added a comment about corner cases involving huge +precisions, which should never occur in practice. +------------------------------------------------------------------------ +r10222 | vlefevre | 2016-03-10 15:10:51 +0000 (Thu, 10 Mar 2016) | 5 lines +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] + * Added some MPFR_ASSERTD that correspond to properties used in the + proof corrected in doc/sum.txt r10221. + * Added a test for corner cases that will/can probably never occur + in practice. +------------------------------------------------------------------------ +r10221 | vlefevre | 2016-03-10 15:05:04 +0000 (Thu, 10 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Improved explanations and corrected a proof. +------------------------------------------------------------------------ +r10220 | vlefevre | 2016-03-10 12:47:09 +0000 (Thu, 10 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Added a figure. +------------------------------------------------------------------------ +r10219 | vlefevre | 2016-03-10 10:37:18 +0000 (Thu, 10 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Clarifications. +------------------------------------------------------------------------ +r10218 | vlefevre | 2016-03-09 16:21:44 +0000 (Wed, 09 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] GMP → the current version of GMP (6.1.0). +------------------------------------------------------------------------ +r10217 | vlefevre | 2016-03-09 15:48:16 +0000 (Wed, 09 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Another clarification. +------------------------------------------------------------------------ +r10216 | vlefevre | 2016-03-09 15:44:38 +0000 (Wed, 09 Mar 2016) | 2 lines +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Clarification about a reiteration in sum_raw with +explanation closer to the code. +------------------------------------------------------------------------ +r10215 | vlefevre | 2016-03-09 15:07:02 +0000 (Wed, 09 Mar 2016) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Clarification of comments about "sum.txt". +------------------------------------------------------------------------ +r10214 | vlefevre | 2016-03-09 14:59:16 +0000 (Wed, 09 Mar 2016) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Added comments and an MPFR_ASSERTD for sum_raw(). +------------------------------------------------------------------------ +r10213 | vlefevre | 2016-03-09 14:37:33 +0000 (Wed, 09 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Clarification. +------------------------------------------------------------------------ +r10212 | vlefevre | 2016-03-09 13:34:09 +0000 (Wed, 09 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Update (mainly related to two's complement). +------------------------------------------------------------------------ +r10211 | vlefevre | 2016-03-09 09:17:27 +0000 (Wed, 09 Mar 2016) | 1 line +Changed paths: + M /trunk/INSTALL + +[INSTALL] More information about MinGW and __USE_MINGW_ANSI_STDIO. +------------------------------------------------------------------------ +r10210 | vlefevre | 2016-03-08 15:57:43 +0000 (Tue, 08 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Corrected 2 typos found by PZ. +------------------------------------------------------------------------ +r10209 | vlefevre | 2016-03-08 14:50:02 +0000 (Tue, 08 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Added commas. +------------------------------------------------------------------------ +r10208 | vlefevre | 2016-03-08 14:45:41 +0000 (Tue, 08 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Added info about an exact zero result and IEEE 754 / 1788. +------------------------------------------------------------------------ +r10207 | vlefevre | 2016-03-08 09:55:59 +0000 (Tue, 08 Mar 2016) | 2 lines +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] A bit more about the choice of two's complement for the +accumulator. +------------------------------------------------------------------------ +r10206 | vlefevre | 2016-03-08 09:22:27 +0000 (Tue, 08 Mar 2016) | 2 lines +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Explanation concerning the choice of two's complement for +the accumulator. +------------------------------------------------------------------------ +r10198 | vlefevre | 2016-03-04 14:30:37 +0000 (Fri, 04 Mar 2016) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Update about MinGW and __USE_MINGW_ANSI_STDIO. +------------------------------------------------------------------------ +r10196 | vlefevre | 2016-03-04 14:07:22 +0000 (Fri, 04 Mar 2016) | 1 line +Changed paths: + M /trunk/INSTALL + +[INSTALL] Some improvement about MinGW and __USE_MINGW_ANSI_STDIO. +------------------------------------------------------------------------ +r10195 | vlefevre | 2016-03-04 13:58:05 +0000 (Fri, 04 Mar 2016) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] With MinGW, build with -D__USE_MINGW_ANSI_STDIO by default? +------------------------------------------------------------------------ +r10194 | vlefevre | 2016-03-03 10:13:32 +0000 (Thu, 03 Mar 2016) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] Improved --help messages for decimal-float and float128 +(a bit like what was done for thread-safe). +------------------------------------------------------------------------ +r10193 | zimmerma | 2016-03-03 10:00:06 +0000 (Thu, 03 Mar 2016) | 2 lines +Changed paths: + M /trunk/NEWS + +updated NEWS for decimal floats and __float128 + +------------------------------------------------------------------------ +r10192 | zimmerma | 2016-03-03 09:56:24 +0000 (Thu, 03 Mar 2016) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/configure.ac + +set --enable-float128 to "autodetect" by default (like --enable-decimal-float) + +------------------------------------------------------------------------ +r10191 | vlefevre | 2016-03-02 17:15:13 +0000 (Wed, 02 Mar 2016) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] For testing the lack of subnormal support. +------------------------------------------------------------------------ +r10190 | vlefevre | 2016-03-02 16:56:27 +0000 (Wed, 02 Mar 2016) | 3 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Also fixed the test for subnormal double-precision +numbers, in case an extended precision / exponent range is used +(however the test is not guaranteed with non-conforming compilers). +------------------------------------------------------------------------ +r10189 | vlefevre | 2016-03-02 16:51:19 +0000 (Wed, 02 Mar 2016) | 1 line +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Fixed test for subnormal single-precision numbers. +------------------------------------------------------------------------ +r10188 | zimmerma | 2016-03-02 16:47:54 +0000 (Wed, 02 Mar 2016) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/tests/tget_flt.c + +added a separate configure test for subnormals in the "float" format + +------------------------------------------------------------------------ +r10187 | vlefevre | 2016-03-02 16:39:38 +0000 (Wed, 02 Mar 2016) | 1 line +Changed paths: + M /trunk/acinclude.m4 + M /trunk/configure.ac + +[acinclude.m4,configure.ac] Various fixes in error messages. +------------------------------------------------------------------------ +r10186 | vlefevre | 2016-03-02 15:52:47 +0000 (Wed, 02 Mar 2016) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Update ICC detection. +------------------------------------------------------------------------ +r10185 | zimmerma | 2016-03-02 15:24:12 +0000 (Wed, 02 Mar 2016) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/configure.ac + +autodetect support for decimal floats (as suggested in revision 10179) + +------------------------------------------------------------------------ +r10183 | vlefevre | 2016-03-02 14:56:01 +0000 (Wed, 02 Mar 2016) | 1 line +Changed paths: + M /trunk/src/ieee_floats.h + +[src/ieee_floats.h] Comment update. +------------------------------------------------------------------------ +r10182 | vlefevre | 2016-03-02 14:47:32 +0000 (Wed, 02 Mar 2016) | 2 lines +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Another improvement, just in case Clang no longer +defines __GNUC__ in the future. +------------------------------------------------------------------------ +r10181 | vlefevre | 2016-03-02 14:43:31 +0000 (Wed, 02 Mar 2016) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Improved output of compiler information. +------------------------------------------------------------------------ +r10180 | vlefevre | 2016-03-02 14:18:27 +0000 (Wed, 02 Mar 2016) | 4 lines +Changed paths: + M /trunk/src/ieee_floats.h + +[src/ieee_floats.h] No longer use a NaN memory representation because +it was fixed thus could be either a qNaN or a sNaN, depending on the +machine. Moreover the choice is to generate a qNaN, in particular due +to lack of sNaN support by compilers. +------------------------------------------------------------------------ +r10179 | vlefevre | 2016-03-02 13:59:12 +0000 (Wed, 02 Mar 2016) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/configure.ac + +Do not build with decimal float by default as it is not standard +(a better behavior could be to auto-detect). +------------------------------------------------------------------------ +r10178 | vlefevre | 2016-03-02 10:02:37 +0000 (Wed, 02 Mar 2016) | 1 line +Changed paths: + M /trunk/src/ieee_floats.h + M /trunk/src/mpfr-impl.h + +Updated comments about DBL_NAN, dbl_nan.d and qNaN / sNaN encoding. +------------------------------------------------------------------------ +r10177 | vlefevre | 2016-03-02 01:03:56 +0000 (Wed, 02 Mar 2016) | 1 line +Changed paths: + M /trunk/src/get_flt.c + +[src/get_flt.c] Updated FIXME comment: idea of a solution... +------------------------------------------------------------------------ +r10175 | vlefevre | 2016-03-02 00:49:43 +0000 (Wed, 02 Mar 2016) | 2 lines +Changed paths: + M /trunk/src/get_flt.c + +[src/get_flt.c] FIXME: The code assumes the IEEE-754 binary32 format +with subnormal support. +------------------------------------------------------------------------ +r10173 | vlefevre | 2016-03-02 00:29:46 +0000 (Wed, 02 Mar 2016) | 2 lines +Changed paths: + M /trunk/tests/tget_flt.c + +[tests/tget_flt.c] Do tests that may involve subnormals only +if HAVE_DENORMS is defined. +------------------------------------------------------------------------ +r10172 | vlefevre | 2016-03-01 17:17:13 +0000 (Tue, 01 Mar 2016) | 5 lines +Changed paths: + M /trunk/src/set_d64.c + M /trunk/src/set_float128.c + M /trunk/src/set_ld.c + +[src/set_*.c] Use the DOUBLE_ISNAN macro for _Decimal64, __float128 and +long double like what is done for double; on platforms where d != d is +not wrongly optimized to false, this should not change anything. Also +added some MPFR_UNLIKELY for special cases of _Decimal64 and __float128, +as this is already done for double and long double. +------------------------------------------------------------------------ +r10171 | vlefevre | 2016-03-01 16:59:07 +0000 (Tue, 01 Mar 2016) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Detect some uses of "x != x" and "x == x". +------------------------------------------------------------------------ +r10170 | zimmerma | 2016-03-01 16:34:35 +0000 (Tue, 01 Mar 2016) | 2 lines +Changed paths: + M /trunk/tests/tversion.c + +recognize icc (which might define __GNUC__) + +------------------------------------------------------------------------ +r10169 | vlefevre | 2016-03-01 16:07:33 +0000 (Tue, 01 Mar 2016) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Added a comment about non-IEEE-754 environment. +------------------------------------------------------------------------ +r10168 | zimmerma | 2016-03-01 15:46:05 +0000 (Tue, 01 Mar 2016) | 2 lines +Changed paths: + M /trunk/src/ieee_floats.h + +HAVE_DOUBLE_IEEE_LITTLE_SWAPPED is not supported + +------------------------------------------------------------------------ +r10165 | vlefevre | 2016-03-01 15:37:17 +0000 (Tue, 01 Mar 2016) | 3 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] Quote the argument of all AC_MSG_RESULT and AC_MSG_ERROR +when it is longer than a word, as already done in most cases (this is +safer in case we modify the text and add a comma). +------------------------------------------------------------------------ +r10164 | vlefevre | 2016-03-01 15:19:46 +0000 (Tue, 01 Mar 2016) | 1 line +Changed paths: + M /trunk/tests/tset_float128.c + +[tests/tset_float128.c] Better cast. +------------------------------------------------------------------------ +r10163 | zimmerma | 2016-03-01 15:08:50 +0000 (Tue, 01 Mar 2016) | 2 lines +Changed paths: + M /trunk/tests/tget_flt.c + M /trunk/tests/tset_float128.c + +use DOUBLE_ISNAN() instead of f == f + +------------------------------------------------------------------------ +r10162 | zimmerma | 2016-03-01 14:31:01 +0000 (Tue, 01 Mar 2016) | 2 lines +Changed paths: + M /trunk/tools/cfarm.sh + +updated + +------------------------------------------------------------------------ +r10161 | zimmerma | 2016-03-01 14:23:02 +0000 (Tue, 01 Mar 2016) | 2 lines +Changed paths: + M /trunk/INSTALL + +updated paragraph on AIX/PowerPC + +------------------------------------------------------------------------ +r10160 | zimmerma | 2016-03-01 14:19:57 +0000 (Tue, 01 Mar 2016) | 2 lines +Changed paths: + M /trunk/tests/tget_flt.c + +added more details in case of error + +------------------------------------------------------------------------ +r10159 | zimmerma | 2016-03-01 14:08:10 +0000 (Tue, 01 Mar 2016) | 2 lines +Changed paths: + M /trunk/configure.ac + +harmonize configure message against GMP + +------------------------------------------------------------------------ +r10158 | zimmerma | 2016-03-01 12:16:25 +0000 (Tue, 01 Mar 2016) | 2 lines +Changed paths: + M /trunk/tools/cfarm.sh + +updated with mpfr-3.1.4-rc2 + +------------------------------------------------------------------------ +r10157 | zimmerma | 2016-03-01 10:48:18 +0000 (Tue, 01 Mar 2016) | 3 lines +Changed paths: + M /trunk/configure.ac + M /trunk/src/mpfr-gmp.h + +fixed detection of "double" format, and removed +HAVE_DOUBLE_IEEE_LITTLE_SWAPPED, since we have no machine to test it + +------------------------------------------------------------------------ +r10156 | zimmerma | 2016-03-01 10:19:54 +0000 (Tue, 01 Mar 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +removed leftover debug statement + +------------------------------------------------------------------------ +r10155 | vlefevre | 2016-03-01 10:14:28 +0000 (Tue, 01 Mar 2016) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +Removed "The IEEE code for double needs GMP internal files." from +doc/README.dev as this is no longer the case since r10150. +------------------------------------------------------------------------ +r10154 | zimmerma | 2016-03-01 08:53:40 +0000 (Tue, 01 Mar 2016) | 2 lines +Changed paths: + M /trunk/NEWS + +speedup in mpfr_set_d and mpfr_get_d + +------------------------------------------------------------------------ +r10153 | zimmerma | 2016-03-01 08:52:21 +0000 (Tue, 01 Mar 2016) | 3 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/configure.ac + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + +improved detection of decimal floats +removed (obsolete?) #define XDEBUG in mpfr-gmp.h + +------------------------------------------------------------------------ +r10152 | vlefevre | 2016-03-01 02:11:41 +0000 (Tue, 01 Mar 2016) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Removed old code for Alpha (as suggested by Paul). +It was no longer tested. +------------------------------------------------------------------------ +r10151 | vlefevre | 2016-03-01 02:00:47 +0000 (Tue, 01 Mar 2016) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] Added a FIXME comment about a possible misuse of +AC_RUN_IFELSE programs that can return several values. +------------------------------------------------------------------------ +r10150 | zimmerma | 2016-02-29 20:57:06 +0000 (Mon, 29 Feb 2016) | 3 lines +Changed paths: + M /trunk/configure.ac + M /trunk/src/get_d64.c + M /trunk/src/ieee_floats.h + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/scale2.c + M /trunk/src/set_d.c + M /trunk/src/set_d64.c + M /trunk/src/uceil_exp2.c + M /trunk/src/uceil_log2.c + M /trunk/src/ufloor_log2.c + +get rid of dependency from GMP for _GMP_IEEE_FLOATS and ieee_double_extract +enable decimal float by default + +------------------------------------------------------------------------ +r10147 | vlefevre | 2016-02-29 17:56:38 +0000 (Mon, 29 Feb 2016) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Also detect the use of ASSERT_ALWAYS (forbidden). +------------------------------------------------------------------------ +r10145 | vlefevre | 2016-02-29 17:44:12 +0000 (Mon, 29 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tget_d.c + M /trunk/tests/tget_d_2exp.c + M /trunk/tests/tget_ld_2exp.c + +Replaced the remaining ASSERT_ALWAYS by MPFR_ASSERTN. +------------------------------------------------------------------------ +r10141 | vlefevre | 2016-02-29 09:49:50 +0000 (Mon, 29 Feb 2016) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Removed a useless note (as the ABI has already changed). +------------------------------------------------------------------------ +r10137 | vlefevre | 2016-02-29 04:06:04 +0000 (Mon, 29 Feb 2016) | 2 lines +Changed paths: + M /trunk/NEWS + +[NEWS] Update about MinGW: "Added support for thread-safe DLL" as +this was more than a fix of the test suite with r9684,9778. +------------------------------------------------------------------------ +r10135 | vlefevre | 2016-02-29 03:52:18 +0000 (Mon, 29 Feb 2016) | 2 lines +Changed paths: + M /trunk/NEWS + +[NEWS] Added "MinGW: Avoid failures in the test suite for shared builds +with TLS." (fix in r9891). +------------------------------------------------------------------------ +r10134 | vlefevre | 2016-02-29 03:48:45 +0000 (Mon, 29 Feb 2016) | 2 lines +Changed paths: + M /trunk/INSTALL + +[INSTALL] Removed an obsolete sentence about MinGW and shared builds +with TLS (the failures in the test suite were avoided in r9891). +------------------------------------------------------------------------ +r10132 | vlefevre | 2016-02-29 00:55:52 +0000 (Mon, 29 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/Makefile.am + +[tests/Makefile.am] Comment update. +------------------------------------------------------------------------ +r10128 | vlefevre | 2016-02-25 15:24:32 +0000 (Thu, 25 Feb 2016) | 1 line +Changed paths: + M /trunk/src/clears.c + M /trunk/src/fits_intmax.c + M /trunk/src/fits_uintmax.c + M /trunk/src/get_sj.c + M /trunk/src/get_uj.c + M /trunk/src/inits.c + M /trunk/src/inits2.c + M /trunk/src/printf.c + M /trunk/src/set_sj.c + M /trunk/src/set_uj.c + M /trunk/src/vasprintf.c + M /trunk/tests/tests.c + M /trunk/tests/tfits.c + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tget_sj.c + M /trunk/tests/tset_float128.c + M /trunk/tests/tset_sj.c + +About "config.h" inclusion: code consistency; removed obsolete comment. +------------------------------------------------------------------------ +r10127 | vlefevre | 2016-02-25 15:10:34 +0000 (Thu, 25 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Output availability of intmax_t/uintmax_t based +functions and *printf functions. +------------------------------------------------------------------------ +r10126 | vlefevre | 2016-02-25 15:02:06 +0000 (Thu, 25 Feb 2016) | 1 line +Changed paths: + M /trunk/src/printf.c + +[src/printf.c] Added a blank line for more readability. +------------------------------------------------------------------------ +r10125 | vlefevre | 2016-02-25 14:52:16 +0000 (Thu, 25 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added a note about the "config.h" inclusion. +------------------------------------------------------------------------ +r10124 | vlefevre | 2016-02-25 14:37:12 +0000 (Thu, 25 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Let's group the features together. +------------------------------------------------------------------------ +r10123 | vlefevre | 2016-02-25 14:35:26 +0000 (Thu, 25 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Output support status of modifiers in gmp_printf. +------------------------------------------------------------------------ +r10122 | vlefevre | 2016-02-25 10:36:36 +0000 (Thu, 25 Feb 2016) | 1 line +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + M /trunk/src/buildopt.c + M /trunk/src/mpfr.h + M /trunk/tests/tversion.c + +Added mpfr_buildopt_float128_p function. +------------------------------------------------------------------------ +r10121 | vlefevre | 2016-02-25 10:25:46 +0000 (Thu, 25 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Removed old comments. +------------------------------------------------------------------------ +r10118 | vlefevre | 2016-02-24 16:21:47 +0000 (Wed, 24 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tset_str.c + +[tests/tset_str.c] Correction (with no noticeable effect). +------------------------------------------------------------------------ +r10115 | vlefevre | 2016-02-24 14:11:12 +0000 (Wed, 24 Feb 2016) | 2 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] For codespell, skip the openout.* files, which are +created by "make pdf". +------------------------------------------------------------------------ +r10113 | vlefevre | 2016-02-24 11:15:44 +0000 (Wed, 24 Feb 2016) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Minor FIXME comment update. +------------------------------------------------------------------------ +r10112 | vlefevre | 2016-02-24 10:36:02 +0000 (Wed, 24 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Updated introduction. +------------------------------------------------------------------------ +r10111 | vlefevre | 2016-02-24 03:10:09 +0000 (Wed, 24 Feb 2016) | 1 line +Changed paths: + M /trunk/tools/announce-text + +[tools/announce-text] Check the files on the mpfr.org web server. +------------------------------------------------------------------------ +r10110 | vlefevre | 2016-02-24 02:41:10 +0000 (Wed, 24 Feb 2016) | 1 line +Changed paths: + M /trunk/tools/announce-text + +[tools/announce-text] Added a comment. +------------------------------------------------------------------------ +r10109 | vlefevre | 2016-02-24 02:34:29 +0000 (Wed, 24 Feb 2016) | 1 line +Changed paths: + M /trunk/tools/announce-text + +[tools/announce-text] Update for release candidates. +------------------------------------------------------------------------ +r10105 | vlefevre | 2016-02-24 01:39:52 +0000 (Wed, 24 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Fixed a warning with "make info". +------------------------------------------------------------------------ +r10101 | vlefevre | 2016-02-24 01:15:08 +0000 (Wed, 24 Feb 2016) | 4 lines +Changed paths: + M /trunk/Makefile.am + A /trunk/tools/ck-news + +Added tools/ck-news Perl script to check the NEWS file. +In Makefile.am: + * run this script in dist-hook for "make dist"; + * added this script to EXTRA_DIST as it is used in dist-hook. +------------------------------------------------------------------------ +r10100 | vlefevre | 2016-02-24 00:14:35 +0000 (Wed, 24 Feb 2016) | 1 line +Changed paths: + M /trunk/tools/announce-text + +[tools/announce-text] Take into account $vers setting. +------------------------------------------------------------------------ +r10099 | vlefevre | 2016-02-24 00:05:37 +0000 (Wed, 24 Feb 2016) | 1 line +Changed paths: + M /trunk/tools/announce-text + +[tools/announce-text] Replaced MD5 by SHA256. +------------------------------------------------------------------------ +r10093 | vlefevre | 2016-02-23 22:08:16 +0000 (Tue, 23 Feb 2016) | 1 line +Changed paths: + M /trunk/tools/update-version + +[tools/update-version] Correction for new perl versions. +------------------------------------------------------------------------ +r10092 | zimmerma | 2016-02-23 14:41:11 +0000 (Tue, 23 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +unified description of mpfr_eint + +------------------------------------------------------------------------ +r10089 | vlefevre | 2016-02-23 12:15:16 +0000 (Tue, 23 Feb 2016) | 4 lines +Changed paths: + M /trunk/src/cmp_d.c + M /trunk/src/cmp_ld.c + +[src/{cmp_d.c,cmp_ld.c}] Bug fixes: mpfr_cmp_d (resp. mpfr_cmp_ld) was +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. +------------------------------------------------------------------------ +r10088 | vlefevre | 2016-02-23 12:05:41 +0000 (Tue, 23 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + +[tests/{tcmp_d.c,tcmp_ld.c}] Added a test in reduced exponent range. +------------------------------------------------------------------------ +r10087 | vlefevre | 2016-02-23 11:56:19 +0000 (Tue, 23 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + +[tests/{tcmp_d.c,tcmp_ld.c}] Full test of the flags for NaN → failure. +------------------------------------------------------------------------ +r10086 | vlefevre | 2016-02-23 09:28:01 +0000 (Tue, 23 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + +[tests/{tcmp_d.c,tcmp_ld.c}] GNU coding style. +------------------------------------------------------------------------ +r10085 | vlefevre | 2016-02-23 09:24:50 +0000 (Tue, 23 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tcmp_d.c + +[tests/tcmp_d.c] GNU coding style. +------------------------------------------------------------------------ +r10084 | vlefevre | 2016-02-23 08:38:47 +0000 (Tue, 23 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Update about the suggestion to split the inputs for +Demmel's algorithm. +------------------------------------------------------------------------ +r10082 | vlefevre | 2016-02-22 14:13:07 +0000 (Mon, 22 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added a reference to the build-multi script. +------------------------------------------------------------------------ +r10080 | vlefevre | 2016-02-22 14:03:36 +0000 (Mon, 22 Feb 2016) | 1 line +Changed paths: + D /trunk/tools/build-multi + +Removed the tools/build-multi script (already in ^/misc). +------------------------------------------------------------------------ +r10079 | vlefevre | 2016-02-22 13:59:11 +0000 (Mon, 22 Feb 2016) | 2 lines +Changed paths: + A /trunk/tools/build-multi + +Added tools/build-multi zsh script to build and install multiple MPFR +versions, and add XML library descriptors for ABI Compliance Checker. +------------------------------------------------------------------------ +r10077 | vlefevre | 2016-02-22 12:34:37 +0000 (Mon, 22 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tagm.c + +[tests/tagm.c] Also do the test with a = b in precision 2 (since the +same bug occurs in the 3.1 branch, which doesn't support precision 1). +------------------------------------------------------------------------ +r10076 | zimmerma | 2016-02-22 11:00:48 +0000 (Mon, 22 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + +fixed error analysis for gamma_inc continued fraction + +------------------------------------------------------------------------ +r10074 | vlefevre | 2016-02-19 16:53:29 +0000 (Fri, 19 Feb 2016) | 3 lines +Changed paths: + M /trunk/tests/tfmod.c + +[tests/tfmod.c] Test that triggers the bug fixed in r10054: run it +also in the extended exponent range in order to make the test fail +when ported to the 3.1 branch. +------------------------------------------------------------------------ +r10073 | vlefevre | 2016-02-19 16:35:48 +0000 (Fri, 19 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tfmod.c + +[tests/tfmod.c] Renamed a variable since it is not always NaN. +------------------------------------------------------------------------ +r10072 | vlefevre | 2016-02-19 16:29:37 +0000 (Fri, 19 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tfmod.c + +[tests/tfmod.c] Added a test that triggers the bug fixed in r10054 +without relying on test_generic failure. +------------------------------------------------------------------------ +r10070 | zimmerma | 2016-02-19 08:02:46 +0000 (Fri, 19 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + +added references in comment + +------------------------------------------------------------------------ +r10069 | zimmerma | 2016-02-18 17:52:47 +0000 (Thu, 18 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/algorithms.bib + M /trunk/doc/algorithms.tex + +added error analysis for gamma_inc with continued fraction (to be reviewed) + +------------------------------------------------------------------------ +r10068 | vlefevre | 2016-02-18 13:52:16 +0000 (Thu, 18 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + M /trunk/src/sum.c + +[doc/sum.txt,src/sum.c] mpfr_sum: added support for precision 1. +------------------------------------------------------------------------ +r10067 | zimmerma | 2016-02-18 12:08:46 +0000 (Thu, 18 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +more precision about gamma_inc + +------------------------------------------------------------------------ +r10066 | zimmerma | 2016-02-18 09:31:53 +0000 (Thu, 18 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + +added reference to series for incomplete gamma function + +------------------------------------------------------------------------ +r10065 | zimmerma | 2016-02-17 19:36:55 +0000 (Wed, 17 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tgamma_inc.c + +added tests for negative integer a + +------------------------------------------------------------------------ +r10064 | vlefevre | 2016-02-17 17:51:14 +0000 (Wed, 17 Feb 2016) | 3 lines +Changed paths: + M /trunk/tests/tfmod.c + +[tests/tfmod.c] Do not use a variable named nan to avoid confusion +with the nan function of C99 (and possible obscure failures in the +future, if we include ). +------------------------------------------------------------------------ +r10063 | zimmerma | 2016-02-17 17:46:17 +0000 (Wed, 17 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + +added reference to gamma_inc(-n,x) for current code + +------------------------------------------------------------------------ +r10062 | zimmerma | 2016-02-17 17:29:31 +0000 (Wed, 17 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tremquo.c + +added test to exercise bug fixed in revision 10056 + +------------------------------------------------------------------------ +r10061 | zimmerma | 2016-02-17 17:28:47 +0000 (Wed, 17 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tfmod.c + +fixed one test + +------------------------------------------------------------------------ +r10060 | zimmerma | 2016-02-17 16:25:25 +0000 (Wed, 17 Feb 2016) | 3 lines +Changed paths: + M /trunk/src/agm.c + M /trunk/tests/tagm.c + +fixed bug in mpfr_agm in case a=b but result cannot be exactly represented +in the target precision: ternary value was wrongly set to 0 + +------------------------------------------------------------------------ +r10059 | vlefevre | 2016-02-17 16:12:57 +0000 (Wed, 17 Feb 2016) | 1 line +Changed paths: + M /trunk/src/rem1.c + +Removed trailing spaces. +------------------------------------------------------------------------ +r10058 | zimmerma | 2016-02-17 15:53:37 +0000 (Wed, 17 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tgamma_inc.c + +reduce the time of tgamma_inc + +------------------------------------------------------------------------ +r10057 | zimmerma | 2016-02-17 15:53:24 +0000 (Wed, 17 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tgeneric.c + +fixed the number of special tests for 2-argument functions + +------------------------------------------------------------------------ +r10056 | zimmerma | 2016-02-17 15:39:49 +0000 (Wed, 17 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/rem1.c + +fixed stupid error in revision 10054 + +------------------------------------------------------------------------ +r10055 | vlefevre | 2016-02-17 15:23:25 +0000 (Wed, 17 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Removed mpfr_sum_sort declaration, as this internal +function had been removed in r9370. +------------------------------------------------------------------------ +r10054 | zimmerma | 2016-02-17 15:17:20 +0000 (Wed, 17 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/rem1.c + M /trunk/tests/tfmod.c + +avoid computing with huge integers in mpfr_fmod when x/y is very small + +------------------------------------------------------------------------ +r10053 | vlefevre | 2016-02-17 15:00:01 +0000 (Wed, 17 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Update about the old mpfr_sum implementation. +------------------------------------------------------------------------ +r10052 | zimmerma | 2016-02-17 14:19:48 +0000 (Wed, 17 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +Clarify the status of mpfr_gamma_inc for the MPFR 3.2 release. + +------------------------------------------------------------------------ +r10051 | vlefevre | 2016-02-17 13:06:46 +0000 (Wed, 17 Feb 2016) | 3 lines +Changed paths: + M /trunk/tests/tgeneric.c + +[tests/tgeneric.c] Fixed a typo in latest commit, and added min/max +and max/min special tests for functions with 2 arguments. +This triggers a failure in tfmod on 64-bit machines at least. +------------------------------------------------------------------------ +r10050 | vlefevre | 2016-02-17 12:47:48 +0000 (Wed, 17 Feb 2016) | 1 line +Changed paths: + M /trunk/src/gamma_inc.c + +[src/gamma_inc.c] Improved assertions. +------------------------------------------------------------------------ +r10049 | zimmerma | 2016-02-17 12:34:05 +0000 (Wed, 17 Feb 2016) | 4 lines +Changed paths: + M /trunk/src/gamma_inc.c + M /trunk/tests/tgamma_inc.c + M /trunk/tests/tgeneric.c + +now mpfr_gamma_inc(a,x) also works for 'a' a negative integer +(however a and x should not be too large, we should implement +Legendre's continued fraction for the general case) + +------------------------------------------------------------------------ +r10048 | zimmerma | 2016-02-17 12:26:53 +0000 (Wed, 17 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/eint.c + M /trunk/tests/teint.c + +fixed issue in mpfr_eint + +------------------------------------------------------------------------ +r10047 | vlefevre | 2016-02-17 12:25:30 +0000 (Wed, 17 Feb 2016) | 1 line +Changed paths: + M /trunk/src/gamma.c + +[src/gamma.c] Added another assertion. +------------------------------------------------------------------------ +r10046 | vlefevre | 2016-02-17 12:17:27 +0000 (Wed, 17 Feb 2016) | 1 line +Changed paths: + M /trunk/src/gamma.c + +[src/gamma.c] Added assertions and a comment. +------------------------------------------------------------------------ +r10045 | vlefevre | 2016-02-17 12:07:49 +0000 (Wed, 17 Feb 2016) | 4 lines +Changed paths: + M /trunk/src/gamma.c + +[src/gamma.c] Removed useless saved_flags as flags are already saved +by MPFR_SAVE_EXPO_MARK. Removed the comment about about emin/emax as +emin <= 2 <= emax may not be sufficient (or may be suboptimal). +After all, MPFR_SAVE_EXPO_* is the usual thing to do... +------------------------------------------------------------------------ +r10044 | zimmerma | 2016-02-17 11:42:15 +0000 (Wed, 17 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/gamma.c + +previous commit was incomplete + +------------------------------------------------------------------------ +r10043 | zimmerma | 2016-02-17 11:09:33 +0000 (Wed, 17 Feb 2016) | 3 lines +Changed paths: + M /trunk/src/gamma.c + M /trunk/tests/tgamma.c + +fixed bug in mpfr_gamma: flags might be corrupted in case the argument was +an integer fitting in an unsigned long + +------------------------------------------------------------------------ +r10042 | vlefevre | 2016-02-15 19:12:11 +0000 (Mon, 15 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Update about patches. +------------------------------------------------------------------------ +r10038 | vlefevre | 2016-02-15 12:17:30 +0000 (Mon, 15 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/troot.c + +[tests/troot.c] Compare root(x,2^h) with pow(x,2^(-h)). +------------------------------------------------------------------------ +r10037 | vlefevre | 2016-02-15 11:45:26 +0000 (Mon, 15 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tpow.c + +Added bad_cases tests for mpfr_pow_ui and mpfr_pow_si. +------------------------------------------------------------------------ +r10036 | vlefevre | 2016-02-15 11:37:34 +0000 (Mon, 15 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/troot.c + +Added bad_cases tests for mpfr_root. +------------------------------------------------------------------------ +r10034 | vlefevre | 2016-02-15 09:39:49 +0000 (Mon, 15 Feb 2016) | 3 lines +Changed paths: + M /trunk/src/fits_intmax.c + M /trunk/src/fits_s.h + M /trunk/src/fits_u.h + +[src/{fits_intmax.c,fits_s.h,fits_u.h}] Fixed mpfr_fits_* functions +in a reduced exponent range and debug mode for non-integer numbers +just above the positive limit. +------------------------------------------------------------------------ +r10033 | vlefevre | 2016-02-15 09:36:58 +0000 (Mon, 15 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tfits.c + +[tests/tfits.c] Check a non-integer number just below a power of two. +------------------------------------------------------------------------ +r10032 | vlefevre | 2016-02-15 09:17:47 +0000 (Mon, 15 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tfits.c + +[tests/tfits.c] Also run the tests in reduced exponent range. +------------------------------------------------------------------------ +r10031 | vlefevre | 2016-02-15 01:50:08 +0000 (Mon, 15 Feb 2016) | 3 lines +Changed paths: + M /trunk/tests/tfits.c + +[tests/tfits.c] Added tests of non-integer values near the type limits. +This triggers a flags failure for src/fits_* r9649, corresponding to +the bug fixed in r9650 (there were no tests for this bug yet). +------------------------------------------------------------------------ +r10030 | vlefevre | 2016-02-15 01:23:34 +0000 (Mon, 15 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tfits.c + +[tests/tfits.c] Increased code reuse so that tests could be improved +more easily (not everything is tested yet). +------------------------------------------------------------------------ +r10028 | vlefevre | 2016-02-12 13:52:48 +0000 (Fri, 12 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tconst_log2.c + +[tests/tconst_log2.c] Correction for C++ compilers. +------------------------------------------------------------------------ +r10027 | vlefevre | 2016-02-12 13:50:03 +0000 (Fri, 12 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tcan_round.c + +[tests/tcan_round.c] Correction for C++ compilers. Code formatting. +------------------------------------------------------------------------ +r10025 | vlefevre | 2016-02-12 13:20:59 +0000 (Fri, 12 Feb 2016) | 1 line +Changed paths: + M /trunk/src/div.c + +[src/div.c] Coding style. +------------------------------------------------------------------------ +r10024 | vlefevre | 2016-02-12 13:18:16 +0000 (Fri, 12 Feb 2016) | 1 line +Changed paths: + M /trunk/src/div.c + +[src/div.c] Added a TODO for value coverage tests. +------------------------------------------------------------------------ +r10022 | vlefevre | 2016-02-12 11:42:12 +0000 (Fri, 12 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added a comment about mpfr_gamma_inc. +------------------------------------------------------------------------ +r10021 | vlefevre | 2016-02-12 10:33:13 +0000 (Fri, 12 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tgamma_inc.c + +[tests/tgamma_inc.c] Added a TODO. +------------------------------------------------------------------------ +r10020 | vlefevre | 2016-02-12 10:07:36 +0000 (Fri, 12 Feb 2016) | 4 lines +Changed paths: + M /trunk/src/gamma_inc.c + +[src/gamma_inc.c] Detect internal overflow in order to avoid taking +all the memory of the machine, but it is currently not supported: +assertion failure. This was occurring with a = 2^32 and x = 2^(-32) +on 32-bit machines (see change in r10019). +------------------------------------------------------------------------ +r10019 | zimmerma | 2016-02-12 09:21:57 +0000 (Fri, 12 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tgamma_inc.c + +reduced a test with large arguments + +------------------------------------------------------------------------ +r10018 | vlefevre | 2016-02-11 13:59:33 +0000 (Thu, 11 Feb 2016) | 1 line +Changed paths: + M /trunk/src/gamma_inc.c + +[src/gamma_inc.c] Improved type consistency to avoid integer overflow. +------------------------------------------------------------------------ +r10017 | vlefevre | 2016-02-11 13:54:47 +0000 (Thu, 11 Feb 2016) | 1 line +Changed paths: + M /trunk/src/gamma_inc.c + +[src/gamma_inc.c] Added some assertions to detect integer overflow. +------------------------------------------------------------------------ +r10016 | vlefevre | 2016-02-11 12:46:30 +0000 (Thu, 11 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tgamma_inc.c + +[tests/tgamma_inc.c] C++/C99 comment → C89 comment. +------------------------------------------------------------------------ +r10015 | vlefevre | 2016-02-11 12:44:49 +0000 (Thu, 11 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/gmp_op.c + +[src/gmp_op.c] Fixed an assertion that made tgmpop fail on 32-bit +machines (it became wrong with r9964 and --enable-assert). +------------------------------------------------------------------------ +r10014 | vlefevre | 2016-02-10 09:31:39 +0000 (Wed, 10 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Added a FIXME for precision 1 (recently added). +------------------------------------------------------------------------ +r10013 | zimmerma | 2016-02-10 08:39:20 +0000 (Wed, 10 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/gamma_inc.c + +added formula for gamma_inc(-n,x) + +------------------------------------------------------------------------ +r10012 | zimmerma | 2016-02-09 14:16:17 +0000 (Tue, 09 Feb 2016) | 4 lines +Changed paths: + M /trunk/TODO + +removed item about speeding up const_euler: done since now for x=1.1, +prec=16610, mpfr_const_euler takes only about 40% of the total time. +For x=1.1 and prec=100000 it takes only about 14% of the total time. + +------------------------------------------------------------------------ +r10011 | zimmerma | 2016-02-09 14:06:42 +0000 (Tue, 09 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/gamma_inc.c + M /trunk/tests/tgamma_inc.c + +fixed the call to mpfr_eint() in gamma_inc, added some tests for gamma_inc + +------------------------------------------------------------------------ +r10010 | zimmerma | 2016-02-09 13:35:39 +0000 (Tue, 09 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/eint.c + M /trunk/tests/teint.c + +now mpfr_eint() returns -E1(-x) for x < 0 + +------------------------------------------------------------------------ +r10008 | vlefevre | 2016-02-09 09:55:51 +0000 (Tue, 09 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/eint.c + M /trunk/tests/teint.c + +[src/eint.c] Fixed eint(-inf). +[tests/teint.c] Added a corresponding test. +------------------------------------------------------------------------ +r10007 | vlefevre | 2016-02-09 02:17:21 +0000 (Tue, 09 Feb 2016) | 1 line +Changed paths: + M /trunk/src/si_op.c + +[src/si_op.c] Unified coding style and added logging. +------------------------------------------------------------------------ +r10006 | vlefevre | 2016-02-09 02:10:22 +0000 (Tue, 09 Feb 2016) | 1 line +Changed paths: + M /trunk/src/div_ui.c + M /trunk/src/mul_ui.c + M /trunk/src/si_op.c + M /trunk/src/ui_div.c + +[src] Moved si ops from mul_ui.c, div_ui.c and ui_div.c to si_op.c. +------------------------------------------------------------------------ +r10005 | vlefevre | 2016-02-09 02:07:23 +0000 (Tue, 09 Feb 2016) | 4 lines +Changed paths: + M /trunk/src/ui_div.c + +[src/ui_div.c] Fixed bug in mpfr_si_div when the integer is LONG_MIN, +visible when using an UB sanitizer (see r9999). +Note: this integer value is not tested yet in the test suite due to +the lack of generic tests for mpfr_si_div. +------------------------------------------------------------------------ +r10004 | vlefevre | 2016-02-09 02:03:32 +0000 (Tue, 09 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tgeneric.c + M /trunk/tests/tsi_op.c + +[tests/{tgeneric.c,tsi_op.c}] Added TODO. +------------------------------------------------------------------------ +r10003 | vlefevre | 2016-02-09 01:44:53 +0000 (Tue, 09 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/div_ui.c + M /trunk/src/mul_ui.c + +[src/{div,mul}_ui.c] Fixed bug in mpfr_div_si and mpfr_mul_si when the +integer is LONG_MIN, visible when using an UB sanitizer (see r9999). +------------------------------------------------------------------------ +r10001 | vlefevre | 2016-02-09 01:31:17 +0000 (Tue, 09 Feb 2016) | 3 lines +Changed paths: + M /trunk/tests/tgeneric_ui.c + +[tests/tgeneric_ui.c] Added tests of the extreme integer values, +so that tsi_op fails with a runtime error in si_op.c r9998 when +using an UB sanitizer (bug fixed in r9999). +------------------------------------------------------------------------ +r10000 | vlefevre | 2016-02-09 01:17:01 +0000 (Tue, 09 Feb 2016) | 1 line +Changed paths: + M /trunk/src/eint.c + +[src/eint.c] Code simplification. +------------------------------------------------------------------------ +r9999 | vlefevre | 2016-02-09 01:08:25 +0000 (Tue, 09 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/si_op.c + +[src/si_op.c] Fixed bug in mpfr_add_si, mpfr_sub_si and mpfr_si_sub +when the integer is LONG_MIN, visible when using an UB sanitizer. +------------------------------------------------------------------------ +r9998 | vlefevre | 2016-02-09 01:03:01 +0000 (Tue, 09 Feb 2016) | 1 line +Changed paths: + M /trunk/src/si_op.c + +[src/si_op.c] Code formatting. +------------------------------------------------------------------------ +r9997 | vlefevre | 2016-02-09 01:01:01 +0000 (Tue, 09 Feb 2016) | 3 lines +Changed paths: + M /trunk/tests/teint.c + +[tests/teint.c] Added a test that triggers a runtime error +at si_op.c:42:31 on an x86-64 Linux machine, using: + CFLAGS="-fsanitize=undefined -fno-sanitize-recover" +------------------------------------------------------------------------ +r9996 | vlefevre | 2016-02-09 00:33:32 +0000 (Tue, 09 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Typographic correction. +------------------------------------------------------------------------ +r9995 | vlefevre | 2016-02-09 00:27:35 +0000 (Tue, 09 Feb 2016) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Avoid false positives in mp_exp_t check. +------------------------------------------------------------------------ +r9994 | vlefevre | 2016-02-09 00:18:19 +0000 (Tue, 09 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/eint.c + +[src/eint.c] Updated a FIXME (mpfr_set_exp_t was added in r4333 and +completed in r5455), with typo from r6789 corrected. +------------------------------------------------------------------------ +r9993 | vlefevre | 2016-02-09 00:02:40 +0000 (Tue, 09 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated Section "API Compatibility / Changed Functions": +mpfr_eint changed in MPFR 3.2. +------------------------------------------------------------------------ +r9992 | zimmerma | 2016-02-08 18:52:44 +0000 (Mon, 08 Feb 2016) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/TODO + +update NEWS/TODO with respect to E1 + +------------------------------------------------------------------------ +r9991 | zimmerma | 2016-02-08 18:41:55 +0000 (Mon, 08 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/eint.c + M /trunk/tests/teint.c + +oops, eint(x) was wrong for negative x with |x| >= 0.5 + +------------------------------------------------------------------------ +r9990 | zimmerma | 2016-02-08 18:30:52 +0000 (Mon, 08 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + M /trunk/doc/mpfr.texi + M /trunk/src/eint.c + M /trunk/src/gamma_inc.c + M /trunk/src/mpfr-impl.h + M /trunk/tests/teint.c + +now mpfr_eint(x) returns E1(x) for negative x + +------------------------------------------------------------------------ +r9989 | vlefevre | 2016-02-08 16:16:01 +0000 (Mon, 08 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Correction (spelling). +------------------------------------------------------------------------ +r9988 | vlefevre | 2016-02-08 11:47:21 +0000 (Mon, 08 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Clarified a bit more. +------------------------------------------------------------------------ +r9986 | vlefevre | 2016-02-08 09:59:11 +0000 (Mon, 08 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Added explanations concerning the check1 test. +------------------------------------------------------------------------ +r9985 | vlefevre | 2016-02-08 09:39:13 +0000 (Mon, 08 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tsum.c + +Value coverage for tsum: reduce output length. +------------------------------------------------------------------------ +r9984 | vlefevre | 2016-02-08 09:13:05 +0000 (Mon, 08 Feb 2016) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + M /trunk/src/sum.c + M /trunk/tests/tsum.c + +Value coverage for tsum: differentiate sq > MPFR_PREC_MIN and not. +------------------------------------------------------------------------ +r9983 | vlefevre | 2016-02-07 11:09:39 +0000 (Sun, 07 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Source on 80 columns. +------------------------------------------------------------------------ +r9982 | zimmerma | 2016-02-07 09:37:23 +0000 (Sun, 07 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tsum.c + +extended the check1() test, gives failure on 64-bit processor + +------------------------------------------------------------------------ +r9981 | zimmerma | 2016-02-07 09:04:52 +0000 (Sun, 07 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +fixed note + +------------------------------------------------------------------------ +r9980 | zimmerma | 2016-02-06 09:42:06 +0000 (Sat, 06 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + M /trunk/doc/mpfr.texi + M /trunk/src/gamma_inc.c + +more work on gamma_inc + +------------------------------------------------------------------------ +r9979 | zimmerma | 2016-02-06 09:24:54 +0000 (Sat, 06 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +note about memory usage + +------------------------------------------------------------------------ +r9978 | vlefevre | 2016-02-05 17:09:48 +0000 (Fri, 05 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/gamma_inc.c + +[src/gamma_inc.c] Corrected protection against integer overflow +(MPFR_PREC_IN_RANGE is just for debug mode). +------------------------------------------------------------------------ +r9977 | vlefevre | 2016-02-05 17:03:04 +0000 (Fri, 05 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/gamma_inc.c + +[src/gamma_inc.c] Added protection against integer overflow +(i.e. abort instead of getting incorrect results). +------------------------------------------------------------------------ +r9976 | zimmerma | 2016-02-05 16:35:22 +0000 (Fri, 05 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + M /trunk/doc/mpfr.texi + M /trunk/src/gamma_inc.c + M /trunk/tests/tgamma_inc.c + M /trunk/tests/tpow.c + +more work on gamma_inc (only remains the case a=0 and x>0 to implement) + +------------------------------------------------------------------------ +r9975 | vlefevre | 2016-02-05 16:20:10 +0000 (Fri, 05 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tsprintf.c + +Removed trailing spaces. +------------------------------------------------------------------------ +r9974 | vlefevre | 2016-02-05 16:13:46 +0000 (Fri, 05 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/troot.c + +[tests/troot.c] In exact_powers, check negative values too. +------------------------------------------------------------------------ +r9973 | vlefevre | 2016-02-05 16:00:02 +0000 (Fri, 05 Feb 2016) | 1 line +Changed paths: + M /trunk/src/root.c + +[src/root.c] Code simplification. +------------------------------------------------------------------------ +r9972 | vlefevre | 2016-02-05 15:45:47 +0000 (Fri, 05 Feb 2016) | 1 line +Changed paths: + M /trunk/TODO + +TODO update for fmma. +------------------------------------------------------------------------ +r9971 | zimmerma | 2016-02-05 15:34:38 +0000 (Fri, 05 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tgamma.c + M /trunk/tests/tset_str.c + +reduced emax + +------------------------------------------------------------------------ +r9970 | zimmerma | 2016-02-05 15:19:37 +0000 (Fri, 05 Feb 2016) | 3 lines +Changed paths: + M /trunk/src/mpfr-impl.h + M /trunk/src/root.c + M /trunk/tests/troot.c + +added a test for exact powers for mpfr_root +and fixed mpfr_root for negative x (and odd k) + +------------------------------------------------------------------------ +r9969 | vlefevre | 2016-02-05 14:19:10 +0000 (Fri, 05 Feb 2016) | 3 lines +Changed paths: + M /trunk/src/root.c + +[src/root.c] Corrected(?) the check for exact root by adding an +exactness test for the inverse operation z^k (if unnecessary, it +needs to be properly proved and documented). +------------------------------------------------------------------------ +r9968 | vlefevre | 2016-02-05 14:09:48 +0000 (Fri, 05 Feb 2016) | 1 line +Changed paths: + M /trunk/src/root.c + +[src/root.c] Corrected a comment. +------------------------------------------------------------------------ +r9967 | vlefevre | 2016-02-05 14:01:25 +0000 (Fri, 05 Feb 2016) | 1 line +Changed paths: + M /trunk/src/root.c + +[src/root.c] Some minor changes. Updated comments. +------------------------------------------------------------------------ +r9966 | zimmerma | 2016-02-05 13:50:42 +0000 (Fri, 05 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/root.c + +check for an exact root in mpfr_root_aux + +------------------------------------------------------------------------ +r9965 | zimmerma | 2016-02-05 13:19:16 +0000 (Fri, 05 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/root.c + M /trunk/tests/troot.c + +fixed bug in mpfr_root and inefficiency problem with large k + +------------------------------------------------------------------------ +r9964 | vlefevre | 2016-02-05 12:17:01 +0000 (Fri, 05 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] For MPFR_IS_PURE_FP(x), when x is a pure FP number, +check that EXP(x) is in the current exponent range (debug mode). +------------------------------------------------------------------------ +r9963 | vlefevre | 2016-02-05 12:15:10 +0000 (Fri, 05 Feb 2016) | 10 lines +Changed paths: + M /trunk/src/exceptions.c + +[src/exceptions.c] Some changes concerning mpfr_check_range: + * Added a note about the case EXP(x) < MPFR_EMIN_MIN. + * Do not use the MPFR_IS_PURE_FP() macro as this macro assumes that + if the number is not a singular number, then it is really a pure + FP number (some assertion checking may be done in debug mode), + but this is not necessarily the case here. + * Removed an incorrect comment and re-added the MPFR_UNLIKELY for + the cases where EXP(x) is outside the exponent range. Indeed, + mpfr_check_range is called at the end of most functions, and + in most cases, there are no underflows / overflows. +------------------------------------------------------------------------ +r9962 | vlefevre | 2016-02-05 11:44:26 +0000 (Fri, 05 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/texp.c + +[tests/texp.c] Added FIXME, as the overflow test, which was specific +to the 32-bit ABI, is no longer run. +------------------------------------------------------------------------ +r9961 | vlefevre | 2016-02-05 11:38:46 +0000 (Fri, 05 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tacosh.c + +[tests/tacosh.c] Added a FIXME (huge values no longer tested at all). +------------------------------------------------------------------------ +r9960 | vlefevre | 2016-02-05 11:23:30 +0000 (Fri, 05 Feb 2016) | 1 line +Changed paths: + M /trunk/src/fmma.c + +[src/fmma.c] Removed unused code. +------------------------------------------------------------------------ +r9959 | zimmerma | 2016-02-05 11:10:20 +0000 (Fri, 05 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/troot.c + +added code to compare mpfr_root with exp(log(x)/k) + +------------------------------------------------------------------------ +r9958 | zimmerma | 2016-02-05 10:21:25 +0000 (Fri, 05 Feb 2016) | 3 lines +Changed paths: + M /trunk/src/mpfr.h + M /trunk/tests/tacosh.c + M /trunk/tests/texp.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow_z.c + M /trunk/tests/tsub1sp.c + +reduce MPFR_EMAX_DEFAULT by 2, and modify some tests cases assuming +MPFR_EMAX_DEFAULT=2^30-1 + +------------------------------------------------------------------------ +r9957 | zimmerma | 2016-02-05 09:54:31 +0000 (Fri, 05 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/fmma.c + M /trunk/src/mpfr-impl.h + M /trunk/tests/tsprintf.c + +fixed fmma failure + +------------------------------------------------------------------------ +r9956 | vlefevre | 2016-02-05 08:57:06 +0000 (Fri, 05 Feb 2016) | 1 line +Changed paths: + M /trunk/src/exp.c + +[src/exp.c] Simplified exponent range setting in special case. +------------------------------------------------------------------------ +r9955 | zimmerma | 2016-02-05 08:24:01 +0000 (Fri, 05 Feb 2016) | 3 lines +Changed paths: + M /trunk/src/exp.c + M /trunk/tests/tabs.c + M /trunk/tests/tacos.c + M /trunk/tests/tacosh.c + M /trunk/tests/tadd.c + M /trunk/tests/tadd_d.c + M /trunk/tests/tadd_ui.c + M /trunk/tests/tagm.c + M /trunk/tests/tai.c + M /trunk/tests/tasin.c + M /trunk/tests/tasinh.c + M /trunk/tests/tatan.c + M /trunk/tests/tatanh.c + M /trunk/tests/tcbrt.c + M /trunk/tests/tconst_catalan.c + M /trunk/tests/tconst_euler.c + M /trunk/tests/tconst_log2.c + M /trunk/tests/tconst_pi.c + M /trunk/tests/tcos.c + M /trunk/tests/tcosh.c + M /trunk/tests/tcot.c + M /trunk/tests/tcoth.c + M /trunk/tests/tcsc.c + M /trunk/tests/tcsch.c + M /trunk/tests/td_div.c + M /trunk/tests/td_sub.c + M /trunk/tests/tdigamma.c + M /trunk/tests/tdim.c + M /trunk/tests/tdiv.c + M /trunk/tests/tdiv_d.c + M /trunk/tests/tdiv_ui.c + M /trunk/tests/teint.c + M /trunk/tests/terf.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/texpm1.c + M /trunk/tests/tfmod.c + M /trunk/tests/tfrac.c + M /trunk/tests/tgamma.c + M /trunk/tests/tgmpop.c + M /trunk/tests/thypot.c + M /trunk/tests/tj0.c + M /trunk/tests/tj1.c + M /trunk/tests/tlgamma.c + M /trunk/tests/tli2.c + M /trunk/tests/tlngamma.c + M /trunk/tests/tlog.c + M /trunk/tests/tlog10.c + M /trunk/tests/tlog1p.c + M /trunk/tests/tlog2.c + M /trunk/tests/tmul.c + M /trunk/tests/tmul_d.c + M /trunk/tests/tmul_ui.c + M /trunk/tests/tpow.c + M /trunk/tests/trec_sqrt.c + M /trunk/tests/trint.c + M /trunk/tests/troot.c + M /trunk/tests/tsec.c + M /trunk/tests/tsech.c + M /trunk/tests/tset.c + M /trunk/tests/tsi_op.c + M /trunk/tests/tsin.c + M /trunk/tests/tsinh.c + M /trunk/tests/tsqr.c + M /trunk/tests/tsqrt.c + M /trunk/tests/tsub.c + M /trunk/tests/tsub_d.c + M /trunk/tests/tsub_ui.c + M /trunk/tests/ttan.c + M /trunk/tests/ttanh.c + M /trunk/tests/tui_div.c + M /trunk/tests/tui_sub.c + M /trunk/tests/ty0.c + M /trunk/tests/ty1.c + M /trunk/tests/tzeta.c + +changed test_generic() calls to start from MPFR_PREC_MIN instead of 2; +this revealed a special-case code in mpfr_exp which didn't work for prec=1 + +------------------------------------------------------------------------ +r9954 | vlefevre | 2016-02-05 01:07:29 +0000 (Fri, 05 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/trint.c + +[tests/trint.c] Do the significand parity test only for precision > 1. +------------------------------------------------------------------------ +r9953 | zimmerma | 2016-02-04 20:01:26 +0000 (Thu, 04 Feb 2016) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + +updated NEWS and mpfr.texi for MPFR_PREC_MIN=1 + +------------------------------------------------------------------------ +r9952 | zimmerma | 2016-02-04 19:03:05 +0000 (Thu, 04 Feb 2016) | 3 lines +Changed paths: + M /trunk/src/mpfr.h + M /trunk/tests/tadd1sp.c + M /trunk/tests/tfactorial.c + M /trunk/tests/tget_f.c + M /trunk/tests/tmul.c + M /trunk/tests/tmul_ui.c + M /trunk/tests/tpow.c + M /trunk/tests/trint.c + M /trunk/tests/troot.c + M /trunk/tests/tsqr.c + M /trunk/tests/tsqrt.c + M /trunk/tests/tsub1sp.c + M /trunk/tests/tui_div.c + +MPFR_PREC_MIN is now 1, in accordance with the next revision of IEEE-754 +fixed tests to start at MPFR_PREC_MIN instead of hard-coded value of 2 + +------------------------------------------------------------------------ +r9951 | zimmerma | 2016-02-04 18:31:40 +0000 (Thu, 04 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tsi_op.c + +fixed test which was assuming MPFR_PREC_MIN=2 + +------------------------------------------------------------------------ +r9950 | zimmerma | 2016-02-04 18:24:16 +0000 (Thu, 04 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tsub.c + +fixed to correctly check prec=1 + +------------------------------------------------------------------------ +r9949 | zimmerma | 2016-02-04 18:11:11 +0000 (Thu, 04 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tadd.c + +prepare for MPFR_PREC_MIN=1 + +------------------------------------------------------------------------ +r9948 | zimmerma | 2016-02-04 18:01:47 +0000 (Thu, 04 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tcheck.c + +fixed tcheck for MPFR_PREC_MIN=1 + +------------------------------------------------------------------------ +r9947 | zimmerma | 2016-02-04 17:54:02 +0000 (Thu, 04 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/pow.c + +prepare mpfr_pow to work for precision 1 + +------------------------------------------------------------------------ +r9942 | vlefevre | 2016-02-04 15:09:06 +0000 (Thu, 04 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Mention the Caramba project-team. +------------------------------------------------------------------------ +r9941 | vlefevre | 2016-02-04 15:04:52 +0000 (Thu, 04 Feb 2016) | 4 lines +Changed paths: + M /trunk/BUGS + M /trunk/INSTALL + M /trunk/NEWS + M /trunk/README + M /trunk/TODO + M /trunk/acinclude.m4 + M /trunk/configure.ac + M /trunk/doc/FAQ.html + M /trunk/doc/README.dev + M /trunk/doc/faq.xsl + M /trunk/examples/can_round.c + M /trunk/examples/divworst.c + M /trunk/examples/rndo-add.c + M /trunk/examples/sample.c + M /trunk/examples/version.c + M /trunk/src/abort_prec_max.c + M /trunk/src/acos.c + M /trunk/src/acosh.c + M /trunk/src/add.c + M /trunk/src/add1.c + M /trunk/src/add1sp.c + M /trunk/src/add_d.c + M /trunk/src/add_ui.c + M /trunk/src/agm.c + M /trunk/src/ai.c + M /trunk/src/asin.c + M /trunk/src/asinh.c + M /trunk/src/atan.c + M /trunk/src/atan2.c + M /trunk/src/atanh.c + M /trunk/src/bernoulli.c + M /trunk/src/buildopt.c + M /trunk/src/cache.c + M /trunk/src/cbrt.c + M /trunk/src/check.c + M /trunk/src/clear.c + M /trunk/src/clears.c + M /trunk/src/cmp.c + M /trunk/src/cmp2.c + M /trunk/src/cmp_abs.c + M /trunk/src/cmp_d.c + M /trunk/src/cmp_ld.c + M /trunk/src/cmp_si.c + M /trunk/src/cmp_ui.c + M /trunk/src/comparisons.c + M /trunk/src/const_catalan.c + M /trunk/src/const_log2.c + M /trunk/src/const_pi.c + M /trunk/src/constant.c + M /trunk/src/copysign.c + M /trunk/src/cos.c + M /trunk/src/cosh.c + M /trunk/src/cot.c + M /trunk/src/coth.c + M /trunk/src/csc.c + M /trunk/src/csch.c + M /trunk/src/d_div.c + M /trunk/src/d_sub.c + M /trunk/src/digamma.c + M /trunk/src/dim.c + M /trunk/src/div.c + M /trunk/src/div_2exp.c + M /trunk/src/div_2si.c + M /trunk/src/div_2ui.c + M /trunk/src/div_d.c + M /trunk/src/div_ui.c + M /trunk/src/dump.c + M /trunk/src/eint.c + M /trunk/src/eq.c + M /trunk/src/erf.c + M /trunk/src/erfc.c + M /trunk/src/exceptions.c + M /trunk/src/exp.c + M /trunk/src/exp10.c + M /trunk/src/exp2.c + M /trunk/src/exp3.c + M /trunk/src/exp_2.c + M /trunk/src/expm1.c + M /trunk/src/extract.c + M /trunk/src/factorial.c + M /trunk/src/fits_intmax.c + M /trunk/src/fits_s.h + M /trunk/src/fits_sint.c + M /trunk/src/fits_slong.c + M /trunk/src/fits_sshort.c + M /trunk/src/fits_u.h + M /trunk/src/fits_uint.c + M /trunk/src/fits_uintmax.c + M /trunk/src/fits_ulong.c + M /trunk/src/fits_ushort.c + M /trunk/src/fma.c + M /trunk/src/fmma.c + M /trunk/src/fms.c + M /trunk/src/frac.c + M /trunk/src/free_cache.c + M /trunk/src/frexp.c + M /trunk/src/gamma.c + M /trunk/src/gamma_inc.c + M /trunk/src/gammaonethird.c + M /trunk/src/gen_inverse.h + M /trunk/src/get_d.c + M /trunk/src/get_d64.c + M /trunk/src/get_exp.c + M /trunk/src/get_f.c + M /trunk/src/get_float128.c + M /trunk/src/get_flt.c + M /trunk/src/get_ld.c + M /trunk/src/get_si.c + M /trunk/src/get_sj.c + M /trunk/src/get_str.c + M /trunk/src/get_ui.c + M /trunk/src/get_uj.c + M /trunk/src/get_z.c + M /trunk/src/get_z_exp.c + M /trunk/src/gmp_op.c + M /trunk/src/grandom.c + M /trunk/src/hypot.c + M /trunk/src/ieee_floats.h + M /trunk/src/init.c + M /trunk/src/init2.c + M /trunk/src/inits.c + M /trunk/src/inits2.c + M /trunk/src/inp_str.c + M /trunk/src/int_ceil_log2.c + M /trunk/src/isinf.c + M /trunk/src/isinteger.c + M /trunk/src/isnan.c + M /trunk/src/isnum.c + M /trunk/src/isqrt.c + M /trunk/src/isregular.c + M /trunk/src/iszero.c + M /trunk/src/jn.c + M /trunk/src/jyn_asympt.c + M /trunk/src/li2.c + M /trunk/src/lngamma.c + M /trunk/src/log.c + M /trunk/src/log10.c + M /trunk/src/log1p.c + M /trunk/src/log2.c + M /trunk/src/log_ui.c + M /trunk/src/logging.c + M /trunk/src/min_prec.c + M /trunk/src/minmax.c + M /trunk/src/modf.c + M /trunk/src/mpf2mpfr.h + M /trunk/src/mpfr-cvers.h + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-intmax.h + M /trunk/src/mpfr-mini-gmp.c + M /trunk/src/mpfr-mini-gmp.h + M /trunk/src/mpfr-sassert.h + M /trunk/src/mpfr-thread.h + M /trunk/src/mpfr.h + M /trunk/src/mpn_exp.c + M /trunk/src/mul.c + M /trunk/src/mul_2exp.c + M /trunk/src/mul_2si.c + M /trunk/src/mul_2ui.c + M /trunk/src/mul_d.c + M /trunk/src/mul_ui.c + M /trunk/src/mulders.c + M /trunk/src/neg.c + M /trunk/src/next.c + M /trunk/src/out_str.c + M /trunk/src/pow.c + M /trunk/src/pow_si.c + M /trunk/src/pow_ui.c + M /trunk/src/pow_z.c + M /trunk/src/powerof2.c + M /trunk/src/print_raw.c + M /trunk/src/print_rnd_mode.c + M /trunk/src/printf.c + M /trunk/src/rec_sqrt.c + M /trunk/src/reldiff.c + M /trunk/src/rem1.c + M /trunk/src/rint.c + M /trunk/src/rndna.c + M /trunk/src/root.c + M /trunk/src/round_near_x.c + M /trunk/src/round_p.c + M /trunk/src/round_prec.c + M /trunk/src/round_raw_generic.c + M /trunk/src/scale2.c + M /trunk/src/sec.c + M /trunk/src/sech.c + M /trunk/src/set.c + M /trunk/src/set_d.c + M /trunk/src/set_d64.c + M /trunk/src/set_dfl_prec.c + M /trunk/src/set_exp.c + M /trunk/src/set_f.c + M /trunk/src/set_float128.c + M /trunk/src/set_flt.c + M /trunk/src/set_inf.c + M /trunk/src/set_ld.c + M /trunk/src/set_nan.c + M /trunk/src/set_prc_raw.c + M /trunk/src/set_prec.c + M /trunk/src/set_q.c + M /trunk/src/set_rnd.c + M /trunk/src/set_si.c + M /trunk/src/set_si_2exp.c + M /trunk/src/set_sj.c + M /trunk/src/set_str.c + M /trunk/src/set_str_raw.c + M /trunk/src/set_ui.c + M /trunk/src/set_ui_2exp.c + M /trunk/src/set_uj.c + M /trunk/src/set_z.c + M /trunk/src/set_z_exp.c + M /trunk/src/set_zero.c + M /trunk/src/setmax.c + M /trunk/src/setmin.c + M /trunk/src/setsign.c + M /trunk/src/sgn.c + M /trunk/src/si_op.c + M /trunk/src/signbit.c + M /trunk/src/sin.c + M /trunk/src/sin_cos.c + M /trunk/src/sinh.c + M /trunk/src/sinh_cosh.c + M /trunk/src/sqr.c + M /trunk/src/sqrt.c + M /trunk/src/sqrt_ui.c + M /trunk/src/stack_interface.c + M /trunk/src/strtofr.c + M /trunk/src/sub.c + M /trunk/src/sub1.c + M /trunk/src/sub1sp.c + M /trunk/src/sub_d.c + M /trunk/src/sub_ui.c + M /trunk/src/subnormal.c + M /trunk/src/sum.c + M /trunk/src/swap.c + M /trunk/src/tan.c + M /trunk/src/tanh.c + M /trunk/src/uceil_exp2.c + M /trunk/src/uceil_log2.c + M /trunk/src/ufloor_log2.c + M /trunk/src/ui_div.c + M /trunk/src/ui_pow.c + M /trunk/src/ui_pow_ui.c + M /trunk/src/ui_sub.c + M /trunk/src/urandom.c + M /trunk/src/urandomb.c + M /trunk/src/vasprintf.c + M /trunk/src/version.c + M /trunk/src/volatile.c + M /trunk/src/yn.c + M /trunk/src/zeta.c + M /trunk/src/zeta_ui.c + M /trunk/tests/cmp_str.c + M /trunk/tests/data/digamma + M /trunk/tests/data/li2 + M /trunk/tests/memory.c + M /trunk/tests/mpf_compat.c + M /trunk/tests/mpf_compat.h + M /trunk/tests/mpfr-test.h + M /trunk/tests/mpfr_compat.c + M /trunk/tests/random2.c + M /trunk/tests/reuse.c + M /trunk/tests/rnd_mode.c + M /trunk/tests/tabort_defalloc1.c + M /trunk/tests/tabort_defalloc2.c + M /trunk/tests/tabort_prec_max.c + M /trunk/tests/tabs.c + M /trunk/tests/tacos.c + M /trunk/tests/tacosh.c + M /trunk/tests/tadd.c + M /trunk/tests/tadd1sp.c + M /trunk/tests/tadd_d.c + M /trunk/tests/tadd_ui.c + M /trunk/tests/tagm.c + M /trunk/tests/tai.c + M /trunk/tests/talloc.c + M /trunk/tests/tasin.c + M /trunk/tests/tasinh.c + M /trunk/tests/tassert.c + M /trunk/tests/tatan.c + M /trunk/tests/tatanh.c + M /trunk/tests/taway.c + M /trunk/tests/tbuildopt.c + M /trunk/tests/tcan_round.c + M /trunk/tests/tcbrt.c + M /trunk/tests/tcheck.c + M /trunk/tests/tcmp.c + M /trunk/tests/tcmp2.c + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + M /trunk/tests/tcmp_ui.c + M /trunk/tests/tcmpabs.c + M /trunk/tests/tcomparisons.c + M /trunk/tests/tconst_catalan.c + M /trunk/tests/tconst_euler.c + M /trunk/tests/tconst_log2.c + M /trunk/tests/tconst_pi.c + M /trunk/tests/tcopysign.c + M /trunk/tests/tcos.c + M /trunk/tests/tcosh.c + M /trunk/tests/tcot.c + M /trunk/tests/tcoth.c + M /trunk/tests/tcsc.c + M /trunk/tests/tcsch.c + M /trunk/tests/td_div.c + M /trunk/tests/td_sub.c + M /trunk/tests/tdigamma.c + M /trunk/tests/tdim.c + M /trunk/tests/tdiv.c + M /trunk/tests/tdiv_d.c + M /trunk/tests/tdiv_ui.c + M /trunk/tests/teint.c + M /trunk/tests/teq.c + M /trunk/tests/terandom.c + M /trunk/tests/terf.c + M /trunk/tests/tests.c + M /trunk/tests/texceptions.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/texpm1.c + M /trunk/tests/tfactorial.c + M /trunk/tests/tfits.c + M /trunk/tests/tfma.c + M /trunk/tests/tfmma.c + M /trunk/tests/tfmod.c + M /trunk/tests/tfms.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tfrac.c + M /trunk/tests/tfrexp.c + M /trunk/tests/tgamma.c + M /trunk/tests/tgamma_inc.c + M /trunk/tests/tgeneric.c + M /trunk/tests/tgeneric_ui.c + M /trunk/tests/tget_d.c + M /trunk/tests/tget_d_2exp.c + M /trunk/tests/tget_f.c + M /trunk/tests/tget_flt.c + M /trunk/tests/tget_ld_2exp.c + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tget_sj.c + M /trunk/tests/tget_str.c + M /trunk/tests/tget_z.c + M /trunk/tests/tgmpop.c + M /trunk/tests/tgrandom.c + M /trunk/tests/thyperbolic.c + M /trunk/tests/thypot.c + M /trunk/tests/tinits.c + M /trunk/tests/tinp_str.c + M /trunk/tests/tinternals.c + M /trunk/tests/tisnan.c + M /trunk/tests/tisqrt.c + M /trunk/tests/tj0.c + M /trunk/tests/tj1.c + M /trunk/tests/tjn.c + M /trunk/tests/tl2b.c + M /trunk/tests/tlgamma.c + M /trunk/tests/tli2.c + M /trunk/tests/tlngamma.c + M /trunk/tests/tlog.c + M /trunk/tests/tlog10.c + M /trunk/tests/tlog1p.c + M /trunk/tests/tlog2.c + M /trunk/tests/tlog_ui.c + M /trunk/tests/tmin_prec.c + M /trunk/tests/tminmax.c + M /trunk/tests/tmodf.c + M /trunk/tests/tmul.c + M /trunk/tests/tmul_2exp.c + M /trunk/tests/tmul_d.c + M /trunk/tests/tmul_ui.c + M /trunk/tests/tnext.c + M /trunk/tests/tnrandom.c + M /trunk/tests/tout_str.c + M /trunk/tests/toutimpl.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow3.c + M /trunk/tests/tpow_all.c + M /trunk/tests/tpow_z.c + M /trunk/tests/tprintf.c + M /trunk/tests/trandom.c + M /trunk/tests/trec_sqrt.c + M /trunk/tests/tremquo.c + M /trunk/tests/trint.c + M /trunk/tests/trndna.c + M /trunk/tests/troot.c + M /trunk/tests/tround_prec.c + M /trunk/tests/tsec.c + M /trunk/tests/tsech.c + M /trunk/tests/tset.c + M /trunk/tests/tset_d.c + M /trunk/tests/tset_exp.c + M /trunk/tests/tset_f.c + M /trunk/tests/tset_float128.c + M /trunk/tests/tset_ld.c + M /trunk/tests/tset_q.c + M /trunk/tests/tset_si.c + M /trunk/tests/tset_sj.c + M /trunk/tests/tset_str.c + M /trunk/tests/tset_z.c + M /trunk/tests/tset_z_exp.c + M /trunk/tests/tsgn.c + M /trunk/tests/tsi_op.c + M /trunk/tests/tsin.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tsinh.c + M /trunk/tests/tsinh_cosh.c + M /trunk/tests/tsprintf.c + M /trunk/tests/tsqr.c + M /trunk/tests/tsqrt.c + M /trunk/tests/tsqrt_ui.c + M /trunk/tests/tstckintc.c + M /trunk/tests/tstdint.c + M /trunk/tests/tstrtofr.c + M /trunk/tests/tsub.c + M /trunk/tests/tsub1sp.c + M /trunk/tests/tsub_d.c + M /trunk/tests/tsub_ui.c + M /trunk/tests/tsubnormal.c + M /trunk/tests/tsum.c + M /trunk/tests/tswap.c + M /trunk/tests/ttan.c + M /trunk/tests/ttanh.c + M /trunk/tests/ttrunc.c + M /trunk/tests/tui_div.c + M /trunk/tests/tui_pow.c + M /trunk/tests/tui_sub.c + M /trunk/tests/turandom.c + M /trunk/tests/tvalist.c + M /trunk/tests/tversion.c + M /trunk/tests/ty0.c + M /trunk/tests/ty1.c + M /trunk/tests/tyn.c + M /trunk/tests/tzeta.c + M /trunk/tests/tzeta_ui.c + M /trunk/tools/bench/benchtime.h + M /trunk/tools/bench/mpfrbench.c + M /trunk/tools/get_patches.sh + M /trunk/tune/bidimensional_sample.c + M /trunk/tune/speed.c + M /trunk/tune/tuneup.c + +Replaced + Contributed by the AriC and Caramel projects +by + Contributed by the AriC and Caramba projects +------------------------------------------------------------------------ +r9940 | zimmerma | 2016-02-04 13:42:12 +0000 (Thu, 04 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/gamma_inc.c + +added comment about gamma_inc + +------------------------------------------------------------------------ +r9939 | vlefevre | 2016-02-04 12:42:29 +0000 (Thu, 04 Feb 2016) | 1 line +Changed paths: + M /trunk/src/gamma_inc.c + +[src/gamma_inc.c] Added assertions. +------------------------------------------------------------------------ +r9938 | zimmerma | 2016-02-04 11:36:53 +0000 (Thu, 04 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/gamma_inc.c + +more work on gamma_inc + +------------------------------------------------------------------------ +r9937 | zimmerma | 2016-02-04 11:14:14 +0000 (Thu, 04 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/gamma_inc.c + +fixed some special values for gamma_inc + +------------------------------------------------------------------------ +r9936 | vlefevre | 2016-02-03 18:27:47 +0000 (Wed, 03 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] FIXME: Clarify the status of mpfr_gamma_inc for +the MPFR 3.2 release. +------------------------------------------------------------------------ +r9935 | vlefevre | 2016-02-03 18:14:00 +0000 (Wed, 03 Feb 2016) | 1 line +Changed paths: + R /trunk/src/fmma.c (from /trunk/src/fmma.c:9933) + R /trunk/src/log_ui.c (from /trunk/src/log_ui.c:9933) + +Retrieve the src/fmma.c and src/log_ui.c history. +------------------------------------------------------------------------ +r9934 | zimmerma | 2016-02-03 17:58:35 +0000 (Wed, 03 Feb 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + R /trunk/src/fmma.c + R /trunk/src/log_ui.c + +completed "Added Functions" section + +------------------------------------------------------------------------ +r9933 | vlefevre | 2016-02-03 17:51:11 +0000 (Wed, 03 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Typographic correction. +------------------------------------------------------------------------ +r9932 | vlefevre | 2016-02-03 17:26:47 +0000 (Wed, 03 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] Fixed bug introduced in r9902 and visible in the tests +on 32-bit machines. +------------------------------------------------------------------------ +r9931 | vlefevre | 2016-02-03 15:27:03 +0000 (Wed, 03 Feb 2016) | 1 line +Changed paths: + M /trunk/src/root.c + +[src/root.c] Added TODO for code rewrite (discussion between VL and PZ). +------------------------------------------------------------------------ +r9930 | vlefevre | 2016-02-03 15:16:03 +0000 (Wed, 03 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/troot.c + +[tests/troot.c] Also check that root(0,0) is NaN to make sure that such +special cases are considered in the right order in the implementation. +------------------------------------------------------------------------ +r9929 | vlefevre | 2016-02-03 15:09:06 +0000 (Wed, 03 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Completed mpfr_root description: the 0th root gives NaN. +------------------------------------------------------------------------ +r9928 | vlefevre | 2016-02-03 15:03:20 +0000 (Wed, 03 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/root.c + M /trunk/tests/troot.c + +[src/root.c,tests/troot.c] Removed obsolete code that was commented out; +some cleanup. +------------------------------------------------------------------------ +r9927 | vlefevre | 2016-02-03 14:55:55 +0000 (Wed, 03 Feb 2016) | 1 line +Changed paths: + M /trunk/src/root.c + +[src/root.c] Comment correction (again). +------------------------------------------------------------------------ +r9926 | vlefevre | 2016-02-03 14:39:19 +0000 (Wed, 03 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/root.c + +[src/root.c] Comment correction to avoid a variable name with several +meanings. +------------------------------------------------------------------------ +r9925 | vlefevre | 2016-02-03 14:26:09 +0000 (Wed, 03 Feb 2016) | 1 line +Changed paths: + M /trunk/src/root.c + +[src/root.c] Simplified code and corrected comment. +------------------------------------------------------------------------ +r9924 | vlefevre | 2016-02-03 14:04:20 +0000 (Wed, 03 Feb 2016) | 1 line +Changed paths: + M /trunk/src/root.c + +[src/root.c] Corrected a comment and added an assertion (see r9923). +------------------------------------------------------------------------ +r9923 | vlefevre | 2016-02-03 11:21:18 +0000 (Wed, 03 Feb 2016) | 1 line +Changed paths: + M /trunk/src/root.c + +[src/root.c] Added a FIXME comment. +------------------------------------------------------------------------ +r9922 | vlefevre | 2016-02-03 10:29:22 +0000 (Wed, 03 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/troot.c + +[tests/troot.c] Typo in a comment. +------------------------------------------------------------------------ +r9921 | vlefevre | 2016-02-03 10:17:03 +0000 (Wed, 03 Feb 2016) | 3 lines +Changed paths: + M /trunk/tests/troot.c + +[tests/troot.c] Added tests showing a bug in mpfr_root on large +integer arguments (found thanks to a bug in GNOME Calculator: +). +------------------------------------------------------------------------ +r9920 | vlefevre | 2016-02-03 01:59:06 +0000 (Wed, 03 Feb 2016) | 1 line +Changed paths: + M /trunk/tests/tcan_round.c + M /trunk/tests/tconst_log2.c + +Style: use RND_LOOP; mpfr_can_round returns a Boolean-like value. +------------------------------------------------------------------------ +r9919 | vlefevre | 2016-02-02 17:30:33 +0000 (Tue, 02 Feb 2016) | 1 line +Changed paths: + M /trunk/src/erandom.c + M /trunk/src/nrandom.c + +[src/{erandom.c,nrandom.c}] Updated a reference. +------------------------------------------------------------------------ +r9917 | zimmerma | 2016-02-02 16:24:28 +0000 (Tue, 02 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/sin_cos.c + +mpfr_can_round -> MPFR_CAN_ROUND + +------------------------------------------------------------------------ +r9916 | vlefevre | 2016-02-02 16:13:57 +0000 (Tue, 02 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated FIXME for mpfr_can_round. +------------------------------------------------------------------------ +r9915 | vlefevre | 2016-02-02 16:05:26 +0000 (Tue, 02 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added a FIXME for mpfr_can_round. Still incorrect... +------------------------------------------------------------------------ +r9914 | vlefevre | 2016-02-02 15:53:35 +0000 (Tue, 02 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r9913 | vlefevre | 2016-02-02 15:52:57 +0000 (Tue, 02 Feb 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Corrected note about mpfr_can_round. +------------------------------------------------------------------------ +r9912 | zimmerma | 2016-02-02 15:50:04 +0000 (Tue, 02 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/const_log2.c + M /trunk/tests/tconst_log2.c + +refactor the exhaustive search code in mpfr_const_log2 + +------------------------------------------------------------------------ +r9911 | zimmerma | 2016-02-02 14:24:16 +0000 (Tue, 02 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/atan2.c + +mpfr_round_p -> MPFR_CAN_ROUND + +------------------------------------------------------------------------ +r9910 | zimmerma | 2016-02-02 14:15:44 +0000 (Tue, 02 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/lngamma.c + +mpfr_can_round -> MPFR_CAN_ROUND + +------------------------------------------------------------------------ +r9909 | zimmerma | 2016-02-02 14:13:04 +0000 (Tue, 02 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/factorial.c + +mpfr_can_round -> MPFR_CAN_ROUND + +------------------------------------------------------------------------ +r9908 | zimmerma | 2016-02-02 14:10:10 +0000 (Tue, 02 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/const_log2.c + M /trunk/src/exp3.c + +use MPFR_CAN_ROUND instead of mpfr_can_round/mpfr_round_p + +------------------------------------------------------------------------ +r9907 | zimmerma | 2016-02-02 14:02:26 +0000 (Tue, 02 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/const_log2.c + +rounding test was wrong for rounding to nearest + +------------------------------------------------------------------------ +r9906 | zimmerma | 2016-02-02 13:43:07 +0000 (Tue, 02 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/const_log2.c + +replace mpfr_can_round by mpfr_round_p + +------------------------------------------------------------------------ +r9905 | vlefevre | 2016-02-02 13:26:59 +0000 (Tue, 02 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/round_prec.c + +[src/round_prec.c] Added a TODO to improve the mpfr_can_round_raw +efficiency by only doing a bit inspection (no mpn operations). +------------------------------------------------------------------------ +r9904 | vlefevre | 2016-02-01 17:13:43 +0000 (Mon, 01 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tcan_round.c + +[tests/tcan_round.c] Added test of mpfr_round_p with powers of two +(similar to the one done in src/round_p.c for MPFR_WANT_ASSERT >= 2). +------------------------------------------------------------------------ +r9903 | vlefevre | 2016-02-01 16:43:57 +0000 (Mon, 01 Feb 2016) | 2 lines +Changed paths: + M /trunk/tests/tcan_round.c + +[tests/tcan_round.c] Updated description: mpfr_round_p is also tested +in check_round_p (and will be in test_pow2). +------------------------------------------------------------------------ +r9902 | zimmerma | 2016-02-01 16:06:36 +0000 (Mon, 01 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + M /trunk/src/round_p.c + +now mpfr_round_p() always requires normalized input + +------------------------------------------------------------------------ +r9901 | vlefevre | 2016-02-01 12:10:57 +0000 (Mon, 01 Feb 2016) | 1 line +Changed paths: + M /trunk/src/div.c + +[src/div.c] Added an assert based on comments in the code. +------------------------------------------------------------------------ +r9900 | vlefevre | 2016-02-01 09:20:47 +0000 (Mon, 01 Feb 2016) | 1 line +Changed paths: + M /trunk/src/round_p.c + +[src/round_p.c] Some corrections in comment. +------------------------------------------------------------------------ +r9899 | zimmerma | 2016-02-01 09:09:12 +0000 (Mon, 01 Feb 2016) | 2 lines +Changed paths: + M /trunk/src/round_p.c + +added a comment + +------------------------------------------------------------------------ +r9898 | vlefevre | 2016-01-31 23:59:34 +0000 (Sun, 31 Jan 2016) | 3 lines +Changed paths: + M /trunk/src/round_p.c + +[src/round_p.c] Fixed mpfr_round_p for MPFR_WANT_ASSERT >= 2, as +mpfr_round_p accepts non-normalized inputs (as decided in r9897), +but not mpfr_can_round_raw (as decided in r9883). +------------------------------------------------------------------------ +r9897 | zimmerma | 2016-01-31 17:01:37 +0000 (Sun, 31 Jan 2016) | 2 lines +Changed paths: + M /trunk/src/div.c + M /trunk/src/round_p.c + +the inputs of mpfr_round_p might not always be normalized + +------------------------------------------------------------------------ +r9896 | zimmerma | 2016-01-29 17:29:03 +0000 (Fri, 29 Jan 2016) | 2 lines +Changed paths: + M /trunk/src/round_prec.c + +fixed FIXME + +------------------------------------------------------------------------ +r9893 | vlefevre | 2016-01-29 14:26:51 +0000 (Fri, 29 Jan 2016) | 1 line +Changed paths: + M /trunk/configure.ac + +[configure.ac] Improved consistency in messages. +------------------------------------------------------------------------ +r9892 | vlefevre | 2016-01-29 14:07:18 +0000 (Fri, 29 Jan 2016) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Updated instructions on how to cross-compile MPFR +for MinGW (i586-mingw32msvc) and test it under Wine. +------------------------------------------------------------------------ +r9891 | vlefevre | 2016-01-29 13:45:57 +0000 (Fri, 29 Jan 2016) | 10 lines +Changed paths: + M /trunk/doc/README.dev + M /trunk/tests/memory.c + M /trunk/tests/mpfr-test.h + M /trunk/tests/terandom.c + M /trunk/tests/tests.c + M /trunk/tests/tgrandom.c + M /trunk/tests/tnrandom.c + M /trunk/tests/tset_str.c + M /trunk/tests/tsum.c + M /trunk/tools/mpfrlint + +Cleanup of memory allocation in the tests: + * only tests_allocate, tests_reallocate and tests_free should be used + (now exported instead of mpfr_default_allocate, etc.); + * this is now mentioned in doc/README.dev; + * added checks to tools/mpfrlint (heuristics as usual). + +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), though this +cleanup is more general than an attempt to fix a Windows issue. +------------------------------------------------------------------------ +r9890 | zimmerma | 2016-01-29 10:11:08 +0000 (Fri, 29 Jan 2016) | 2 lines +Changed paths: + M /trunk/src/round_prec.c + +fixed case when prec > bn * GMP_NUMB_BITS and directed rounding + +------------------------------------------------------------------------ +r9889 | zimmerma | 2016-01-29 07:13:37 +0000 (Fri, 29 Jan 2016) | 2 lines +Changed paths: + M /trunk/tests/tcan_round.c + +typo + +------------------------------------------------------------------------ +r9888 | vlefevre | 2016-01-28 14:26:01 +0000 (Thu, 28 Jan 2016) | 1 line +Changed paths: + M /trunk/tests/tcan_round.c + +[tests/tcan_round.c] Updated comment and corrected condition on prec. +------------------------------------------------------------------------ +r9887 | vlefevre | 2016-01-28 13:56:53 +0000 (Thu, 28 Jan 2016) | 1 line +Changed paths: + M /trunk/tests/tcan_round.c + +[tests/tcan_round.c] Updated comments. +------------------------------------------------------------------------ +r9886 | vlefevre | 2016-01-28 13:27:09 +0000 (Thu, 28 Jan 2016) | 5 lines +Changed paths: + M /trunk/src/round_p.c + +[src/round_p.c] Added an assertion (similar to what was added to +mpfr_can_round_raw). This triggers failures, which could also be +detected with MPFR_WANT_ASSERT >= 2, due to the fact that mpfr_div +can internally generate a number that is not normalized before a +rounding test. +------------------------------------------------------------------------ +r9885 | vlefevre | 2016-01-28 13:17:52 +0000 (Thu, 28 Jan 2016) | 1 line +Changed paths: + M /trunk/src/round_prec.c + +[src/round_prec.c] Updated comments. +------------------------------------------------------------------------ +r9884 | zimmerma | 2016-01-28 12:17:32 +0000 (Thu, 28 Jan 2016) | 2 lines +Changed paths: + M /trunk/src/round_prec.c + M /trunk/tests/tcan_round.c + +more work on mpfr_can_round + +------------------------------------------------------------------------ +r9883 | zimmerma | 2016-01-28 09:20:45 +0000 (Thu, 28 Jan 2016) | 2 lines +Changed paths: + M /trunk/src/exp3.c + M /trunk/src/round_prec.c + M /trunk/tests/tcan_round.c + +fixed bug in mpfr_can_round for input = 2^k + +------------------------------------------------------------------------ +r9882 | vlefevre | 2016-01-27 16:24:48 +0000 (Wed, 27 Jan 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Replaced "Rounding Related Functions" by +"Rounding-Related Functions" (thanks to Keith Briggs for the remark). +------------------------------------------------------------------------ +r9881 | vlefevre | 2016-01-27 16:05:28 +0000 (Wed, 27 Jan 2016) | 3 lines +Changed paths: + M /trunk/tests/tcan_round.c + +[tests/tcan_round.c] Added tests for powers of two. This triggers +errors. I may have done mistakes, but at least x = 2^32, j = 32, +r1=MPFR_RNDN, r2=MPFR_RNDN seems buggy. +------------------------------------------------------------------------ +r9880 | zimmerma | 2016-01-27 15:12:56 +0000 (Wed, 27 Jan 2016) | 2 lines +Changed paths: + M /trunk/examples/can_round.c + +simplified + +------------------------------------------------------------------------ +r9879 | zimmerma | 2016-01-27 14:28:25 +0000 (Wed, 27 Jan 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +another detail + +------------------------------------------------------------------------ +r9878 | vlefevre | 2016-01-27 14:27:26 +0000 (Wed, 27 Jan 2016) | 3 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Corrected mpfr_can_round description again as the +possible difference is on 0+ = 2^(emin-1), not about overflow. +Let's just say "assuming an unbounded exponent range". +------------------------------------------------------------------------ +r9877 | vlefevre | 2016-01-27 13:57:12 +0000 (Wed, 27 Jan 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Corrected mpfr_can_round description (about overflow). +------------------------------------------------------------------------ +r9876 | zimmerma | 2016-01-27 13:43:16 +0000 (Wed, 27 Jan 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +yet another improvement + +------------------------------------------------------------------------ +r9875 | zimmerma | 2016-01-27 13:37:09 +0000 (Wed, 27 Jan 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +improved documentation + +------------------------------------------------------------------------ +r9874 | vlefevre | 2016-01-27 13:24:42 +0000 (Wed, 27 Jan 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Clarified change in r9873. +------------------------------------------------------------------------ +r9873 | zimmerma | 2016-01-27 12:48:07 +0000 (Wed, 27 Jan 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +improve documentation of mpfr_can_round + +------------------------------------------------------------------------ +r9872 | zimmerma | 2016-01-27 12:03:22 +0000 (Wed, 27 Jan 2016) | 2 lines +Changed paths: + M /trunk/examples/can_round.c + +also print the rounded value + +------------------------------------------------------------------------ +r9871 | zimmerma | 2016-01-27 11:15:01 +0000 (Wed, 27 Jan 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +added pointer to examples/can_round.c + +------------------------------------------------------------------------ +r9870 | vlefevre | 2016-01-27 10:51:08 +0000 (Wed, 27 Jan 2016) | 2 lines +Changed paths: + M /trunk/examples/can_round.c + +[examples/can_round.c] Removed the useless #include and +replaced the internal mpfr_dump by mpfr_printf. +------------------------------------------------------------------------ +r9869 | zimmerma | 2016-01-27 10:50:12 +0000 (Wed, 27 Jan 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +improved documentation of mpfr_can_round + +------------------------------------------------------------------------ +r9868 | zimmerma | 2016-01-27 10:44:29 +0000 (Wed, 27 Jan 2016) | 2 lines +Changed paths: + M /trunk/Makefile.am + A /trunk/examples/can_round.c + +added example on how to use mpfr_can_round + +------------------------------------------------------------------------ +r9865 | zimmerma | 2016-01-21 21:50:49 +0000 (Thu, 21 Jan 2016) | 2 lines +Changed paths: + M /trunk/TODO + +mention mpfr_set/get_decimal128 for the future (low priority for now) + +------------------------------------------------------------------------ +r9864 | vlefevre | 2016-01-21 15:43:35 +0000 (Thu, 21 Jan 2016) | 1 line +Changed paths: + M /trunk/src/round_p.c + +[src/round_p.c] Code formatting. +------------------------------------------------------------------------ +r9863 | zimmerma | 2016-01-21 13:12:33 +0000 (Thu, 21 Jan 2016) | 2 lines +Changed paths: + M /trunk/TODO + +added remark about Ei vs E1 + +------------------------------------------------------------------------ +r9861 | vlefevre | 2016-01-21 09:13:26 +0000 (Thu, 21 Jan 2016) | 1 line +Changed paths: + M /trunk/tests/tsqrt.c + +[tests/tsqrt.c] Improved bug20160120. +------------------------------------------------------------------------ +r9859 | vlefevre | 2016-01-21 00:31:32 +0000 (Thu, 21 Jan 2016) | 2 lines +Changed paths: + M /trunk/tests/tsqrt.c + +[tests/tsqrt.c] In bug20160120, check the validity of the result with +mpfr_check first, because the mpfr_sqrt was generating invalid data. +------------------------------------------------------------------------ +r9858 | zimmerma | 2016-01-20 21:08:21 +0000 (Wed, 20 Jan 2016) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + M /trunk/tests/tsqrt.c + +fixed bug in mpfr_sqrt reported by Fredrik Johansson + +------------------------------------------------------------------------ +r9857 | zimmerma | 2016-01-20 17:05:02 +0000 (Wed, 20 Jan 2016) | 2 lines +Changed paths: + M /trunk/tests/tsqrt.c + +added test case for bug reported by Fredrik Johansson + +------------------------------------------------------------------------ +r9856 | zimmerma | 2016-01-20 15:36:35 +0000 (Wed, 20 Jan 2016) | 2 lines +Changed paths: + M /trunk/src/zeta.c + +added FIXME + +------------------------------------------------------------------------ +r9854 | vlefevre | 2016-01-20 15:25:01 +0000 (Wed, 20 Jan 2016) | 1 line +Changed paths: + M /trunk/tests/tzeta.c + +[tests/tzeta.c] Added casts for printf. +------------------------------------------------------------------------ +r9853 | vlefevre | 2016-01-20 15:19:23 +0000 (Wed, 20 Jan 2016) | 2 lines +Changed paths: + M /trunk/tests/tzeta.c + +[tests/tzeta.c] Some corrections. Made the input value of the latest +test clear (avoiding a long string at the same time). +------------------------------------------------------------------------ +r9852 | zimmerma | 2016-01-20 15:03:30 +0000 (Wed, 20 Jan 2016) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + M /trunk/src/zeta.c + M /trunk/tests/tzeta.c + +fixed bug for zeta(s) with s near an even negative integer + +------------------------------------------------------------------------ +r9851 | vlefevre | 2016-01-20 14:52:31 +0000 (Wed, 20 Jan 2016) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Instructions on how to cross-compile MPFR for MinGW +(i586-mingw32msvc) and test it under Wine. +------------------------------------------------------------------------ +r9850 | vlefevre | 2016-01-20 14:27:43 +0000 (Wed, 20 Jan 2016) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Typo. +------------------------------------------------------------------------ +r9848 | vlefevre | 2016-01-20 13:52:38 +0000 (Wed, 20 Jan 2016) | 8 lines +Changed paths: + M /trunk/tests/tgeneric.c + +[tests/tgeneric.c] Improved the generic tests in order to trigger the +mpfr_jn bug found by Fredrik Johansson (r9841) and potential similar +bugs: For half cases, the precision of the inputs was modified to be +smaller than the base precision (for the result). Here, this rule is +changed so that if the base precision is small (< 16), then the +precision of the inputs is chosen to be significantly *larger* than +the base precision in general. +Note: With this improvement, both tj0 and tj1 fail in r9840. +------------------------------------------------------------------------ +r9847 | zimmerma | 2016-01-20 10:11:48 +0000 (Wed, 20 Jan 2016) | 2 lines +Changed paths: + M /trunk/TODO + +added references + +------------------------------------------------------------------------ +r9846 | zimmerma | 2016-01-20 09:58:51 +0000 (Wed, 20 Jan 2016) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + +added section about gamma_inc + +------------------------------------------------------------------------ +r9844 | zimmerma | 2016-01-20 08:54:09 +0000 (Wed, 20 Jan 2016) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + M /trunk/src/jyn_asympt.c + M /trunk/tests/tj0.c + +fixed bug found by Fredrik Johansson + +------------------------------------------------------------------------ +r9843 | zimmerma | 2016-01-20 08:11:55 +0000 (Wed, 20 Jan 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +added reference for eint + +------------------------------------------------------------------------ +r9842 | vlefevre | 2016-01-20 02:57:40 +0000 (Wed, 20 Jan 2016) | 1 line +Changed paths: + M /trunk/tests/tj0.c + +[tests/tj0.c] Avoid mpfr_set_d. +------------------------------------------------------------------------ +r9841 | zimmerma | 2016-01-19 21:53:16 +0000 (Tue, 19 Jan 2016) | 2 lines +Changed paths: + M /trunk/tests/tj0.c + +added bug found by Fredrik Johansson in mpfr_j0 + +------------------------------------------------------------------------ +r9840 | zimmerma | 2016-01-19 21:25:55 +0000 (Tue, 19 Jan 2016) | 2 lines +Changed paths: + M /trunk/NEWS + +added mpfr_gamma_inc + +------------------------------------------------------------------------ +r9839 | vlefevre | 2016-01-19 15:28:24 +0000 (Tue, 19 Jan 2016) | 1 line +Changed paths: + M /trunk/src/gamma_inc.c + +[src/gamma_inc.c] Use MPFR_ARE_SINGULAR. +------------------------------------------------------------------------ +r9838 | zimmerma | 2016-01-19 13:29:47 +0000 (Tue, 19 Jan 2016) | 2 lines +Changed paths: + M /trunk/src/gamma_inc.c + +deal with the case where one of a or x is not regular + +------------------------------------------------------------------------ +r9837 | vlefevre | 2016-01-19 09:59:16 +0000 (Tue, 19 Jan 2016) | 1 line +Changed paths: + M /trunk/tools/nightly-test + +[tools/nightly-test] Corrected tests. +------------------------------------------------------------------------ +r9835 | zimmerma | 2016-01-19 08:42:53 +0000 (Tue, 19 Jan 2016) | 2 lines +Changed paths: + M /trunk/TODO + +added reference + +------------------------------------------------------------------------ +r9834 | zimmerma | 2016-01-18 13:41:18 +0000 (Mon, 18 Jan 2016) | 2 lines +Changed paths: + M /trunk/TODO + +added the incomplete beta function + +------------------------------------------------------------------------ +r9833 | zimmerma | 2016-01-18 08:50:53 +0000 (Mon, 18 Jan 2016) | 2 lines +Changed paths: + M /trunk/TODO + +incomplete Gamma is now available + +------------------------------------------------------------------------ +r9832 | zimmerma | 2016-01-18 08:28:50 +0000 (Mon, 18 Jan 2016) | 2 lines +Changed paths: + M /trunk/tools/nightly-test + +switch to bash and add --enable-decimal-float + +------------------------------------------------------------------------ +r9831 | zimmerma | 2016-01-18 08:25:25 +0000 (Mon, 18 Jan 2016) | 2 lines +Changed paths: + M /trunk/doc/mini-gmp + +minor modification of documentation for mini-gmp + +------------------------------------------------------------------------ +r9830 | zimmerma | 2016-01-18 08:23:53 +0000 (Mon, 18 Jan 2016) | 2 lines +Changed paths: + M /trunk/Makefile.am + +added target "make bench" + +------------------------------------------------------------------------ +r9829 | zimmerma | 2016-01-17 19:27:09 +0000 (Sun, 17 Jan 2016) | 2 lines +Changed paths: + M /trunk/tests/tgamma.c + M /trunk/tests/tgamma_inc.c + +allow tgamma x prec to print gamma(x) to prec bits + +------------------------------------------------------------------------ +r9828 | vlefevre | 2016-01-17 01:05:44 +0000 (Sun, 17 Jan 2016) | 1 line +Changed paths: + M /trunk/tests + +[tests] Added tgamma_inc to svn:ignore property. +------------------------------------------------------------------------ +r9827 | vlefevre | 2016-01-17 00:55:54 +0000 (Sun, 17 Jan 2016) | 1 line +Changed paths: + M /trunk/TODO + +TODO update. +------------------------------------------------------------------------ +r9826 | vlefevre | 2016-01-17 00:48:16 +0000 (Sun, 17 Jan 2016) | 1 line +Changed paths: + M /trunk/src/fmma.c + +[src/fmma.c] Removed trailing spaces. +------------------------------------------------------------------------ +r9825 | vlefevre | 2016-01-17 00:46:30 +0000 (Sun, 17 Jan 2016) | 1 line +Changed paths: + M /trunk/tests/tgamma_inc.c + +[tests/tgamma_inc.c] Portability correction. +------------------------------------------------------------------------ +r9824 | vlefevre | 2016-01-17 00:43:48 +0000 (Sun, 17 Jan 2016) | 1 line +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Improved a comment. +------------------------------------------------------------------------ +r9823 | vlefevre | 2016-01-17 00:37:32 +0000 (Sun, 17 Jan 2016) | 1 line +Changed paths: + M /trunk/src/gamma_inc.c + +[src/gamma_inc.c] Various corrections. +------------------------------------------------------------------------ +r9822 | zimmerma | 2016-01-16 09:37:34 +0000 (Sat, 16 Jan 2016) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/Makefile.am + A /trunk/src/gamma_inc.c + M /trunk/src/mpfr.h + M /trunk/tests/Makefile.am + M /trunk/tests/tgamma.c + A /trunk/tests/tgamma_inc.c + +first version of incomplete Gamma function (work in progress) + +------------------------------------------------------------------------ +r9821 | vlefevre | 2016-01-16 09:24:34 +0000 (Sat, 16 Jan 2016) | 1 line +Changed paths: + M /trunk/TODO + +TODO for correctly rounded polynomials (like fmma). +------------------------------------------------------------------------ +r9820 | zimmerma | 2016-01-16 08:29:34 +0000 (Sat, 16 Jan 2016) | 2 lines +Changed paths: + M /trunk/src/fmma.c + M /trunk/tests/tfmma.c + +try to fix bugs in fmma (work in progress) + +------------------------------------------------------------------------ +r9819 | vlefevre | 2016-01-15 16:30:07 +0000 (Fri, 15 Jan 2016) | 2 lines +Changed paths: + M /trunk/src/log_ui.c + +[src/log_ui.c] Added a FIXME comment: mpfr_log_ui is much slower than +mpfr_log on some values of n, e.g. around ULONG_MAX/3. +------------------------------------------------------------------------ +r9818 | vlefevre | 2016-01-15 16:18:35 +0000 (Fri, 15 Jan 2016) | 1 line +Changed paths: + M /trunk/tests/tlog_ui.c + +[tests/tlog_ui.c] Added tests for n around ULONG_MAX/3. +------------------------------------------------------------------------ +r9817 | vlefevre | 2016-01-15 16:06:29 +0000 (Fri, 15 Jan 2016) | 1 line +Changed paths: + M /trunk/src/log_ui.c + +[src/log_ui.c] Fixed the computation of p. +------------------------------------------------------------------------ +r9816 | vlefevre | 2016-01-15 15:13:07 +0000 (Fri, 15 Jan 2016) | 4 lines +Changed paths: + M /trunk/src/log_ui.c + +[src/log_ui.c] Removed a mpz_sub_ui(...,1) to match the comment. +This -1 came from the previous code, but this doesn't change the +value of k because a multiple of 3 cannot be a power of 2. Also +renamed a variable. +------------------------------------------------------------------------ +r9815 | vlefevre | 2016-01-15 15:07:32 +0000 (Fri, 15 Jan 2016) | 3 lines +Changed paths: + M /trunk/src/log_ui.c + +[src/log_ui.c] Compute the value of k without rounding (if n was larger +than 2^53 or even 2^24 due to dynamic x87 precision, the result could +be wrong) and overflow (3 * n doesn't always fit in a limb). +------------------------------------------------------------------------ +r9814 | vlefevre | 2016-01-15 11:30:54 +0000 (Fri, 15 Jan 2016) | 1 line +Changed paths: + M /trunk/src/log_ui.c + +[src/log_ui.c] Added assertions. +------------------------------------------------------------------------ +r9813 | vlefevre | 2016-01-15 11:14:08 +0000 (Fri, 15 Jan 2016) | 1 line +Changed paths: + M /trunk/tests/tlog_ui.c + +[tests/tlog_ui.c] Added tests for n around LONG_MAX. +------------------------------------------------------------------------ +r9812 | vlefevre | 2016-01-15 09:59:26 +0000 (Fri, 15 Jan 2016) | 1 line +Changed paths: + M /trunk/src/log_ui.c + +[src/log_ui.c] Replaced a comment by an assertion. +------------------------------------------------------------------------ +r9811 | vlefevre | 2016-01-15 09:52:33 +0000 (Fri, 15 Jan 2016) | 1 line +Changed paths: + M /trunk/src/log_ui.c + +[src/log_ui.c] Added a FIXME (integer overflow for large n). +------------------------------------------------------------------------ +r9810 | vlefevre | 2016-01-15 09:50:55 +0000 (Fri, 15 Jan 2016) | 14 lines +Changed paths: + M /trunk/tests/tlog_ui.c + +[tests/tlog_ui.c] + * In the loop, do not test n = 0 and n = 1, because mpfr_can_round + always fails for these values, so that the test is pointless. + * Check that mpfr_can_round no longer fails (this is possible as + we are not doing random tests, i.e. the tested values are known); + the additional precision for y had to be increased. + * Also test large values of n (ULONG_MAX down to ULONG_MAX-19). When + GCC's run-time sanitizer -fsanitize=undefined -fno-sanitize-recover + is used, it signals an error for large values of n. + * The reference values y are obtained with mpfr_log instead of + mpfr_log_ui: indeed we need a different implementation from the + tested function, otherwise only the rounding is tested! Without + GCC's run-time sanitizer, this shows that mpfr_log_ui is buggy + for large values of n. +------------------------------------------------------------------------ +r9809 | vlefevre | 2016-01-15 02:26:55 +0000 (Fri, 15 Jan 2016) | 1 line +Changed paths: + M /trunk/tests + +[tests] Added tfmma and tlog_ui to svn:ignore property. +------------------------------------------------------------------------ +r9808 | vlefevre | 2016-01-15 02:21:43 +0000 (Fri, 15 Jan 2016) | 2 lines +Changed paths: + M /trunk/src/fmma.c + +[src/fmma.c] Use MPFR_SET_EXP to get an assertion failure in case of +out-of-range exponent instead of uncontrolled behavior. +------------------------------------------------------------------------ +r9807 | vlefevre | 2016-01-15 02:11:51 +0000 (Fri, 15 Jan 2016) | 1 line +Changed paths: + M /trunk/tests/tfmma.c + +[tests/tfmma.c] Added tests that trigger an error. +------------------------------------------------------------------------ +r9806 | vlefevre | 2016-01-15 01:39:44 +0000 (Fri, 15 Jan 2016) | 1 line +Changed paths: + M /trunk/src/fma.c + +[src/fma.c] Added a comment for the new code. +------------------------------------------------------------------------ +r9805 | vlefevre | 2016-01-14 23:06:22 +0000 (Thu, 14 Jan 2016) | 1 line +Changed paths: + M /trunk/tests/Makefile.am + +[tests/Makefile.am] Tests in lexicographic order. +------------------------------------------------------------------------ +r9804 | zimmerma | 2016-01-14 20:46:59 +0000 (Thu, 14 Jan 2016) | 2 lines +Changed paths: + M /trunk/tests/reuse.c + M /trunk/tests/tadd_d.c + M /trunk/tests/taway.c + M /trunk/tests/td_div.c + M /trunk/tests/td_sub.c + M /trunk/tests/tdiv_d.c + M /trunk/tests/tfmod.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tinternals.c + M /trunk/tests/tli2.c + M /trunk/tests/tmodf.c + M /trunk/tests/tmul_d.c + M /trunk/tests/tpow_all.c + M /trunk/tests/tprintf.c + M /trunk/tests/trec_sqrt.c + M /trunk/tests/tsinh_cosh.c + M /trunk/tests/tsprintf.c + M /trunk/tests/tsub_d.c + M /trunk/tests/tzeta_ui.c + +in tests, removed #if MPFR_VERSION >= MPFR_VERSION_NUM(2,x,y) + +------------------------------------------------------------------------ +r9803 | zimmerma | 2016-01-14 20:45:36 +0000 (Thu, 14 Jan 2016) | 2 lines +Changed paths: + M /trunk/tests/Makefile.am + +forgot in last commit + +------------------------------------------------------------------------ +r9802 | zimmerma | 2016-01-14 20:43:39 +0000 (Thu, 14 Jan 2016) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + M /trunk/src/Makefile.am + A /trunk/src/log_ui.c + M /trunk/src/mpfr.h + A /trunk/tests/tlog_ui.c + +added new function mpfr_log_ui + +------------------------------------------------------------------------ +r9801 | zimmerma | 2016-01-13 09:18:05 +0000 (Wed, 13 Jan 2016) | 2 lines +Changed paths: + M /trunk/tools/mbench/mfv5-mpfr.cc + +adapted to 3- and 4-argument functions (using patch from Patrick Pelissier) + +------------------------------------------------------------------------ +r9800 | vlefevre | 2016-01-12 17:44:31 +0000 (Tue, 12 Jan 2016) | 1 line +Changed paths: + M /trunk/tests/tfmma.c + +[tests/tfmma.c] C++ compatibility. +------------------------------------------------------------------------ +r9799 | vlefevre | 2016-01-12 17:39:15 +0000 (Tue, 12 Jan 2016) | 1 line +Changed paths: + M /trunk/tests/tfmma.c + +[tests/tfmma.c] Fixed type in printf. +------------------------------------------------------------------------ +r9798 | vlefevre | 2016-01-12 17:36:29 +0000 (Tue, 12 Jan 2016) | 1 line +Changed paths: + M /trunk/src/fmma.c + +[src/fmma.c] Replaced mp_ptr by mpfr_limb_ptr (as usual). +------------------------------------------------------------------------ +r9797 | vlefevre | 2016-01-12 16:38:21 +0000 (Tue, 12 Jan 2016) | 1 line +Changed paths: + M /trunk/tests/tfmma.c + +Really replaced mpfr_printf by printf. +------------------------------------------------------------------------ +r9796 | zimmerma | 2016-01-12 15:50:48 +0000 (Tue, 12 Jan 2016) | 2 lines +Changed paths: + M /trunk/src/fmma.c + +give copyright to FSF + +------------------------------------------------------------------------ +r9795 | zimmerma | 2016-01-12 14:13:09 +0000 (Tue, 12 Jan 2016) | 2 lines +Changed paths: + M /trunk/tests/tfmma.c + +replaced mpfr_printf calls + +------------------------------------------------------------------------ +r9794 | zimmerma | 2016-01-12 14:12:52 +0000 (Tue, 12 Jan 2016) | 2 lines +Changed paths: + M /trunk/src/fmma.c + +changed copyright (I'm the sole author of this part of the code) + +------------------------------------------------------------------------ +r9793 | zimmerma | 2016-01-12 12:29:04 +0000 (Tue, 12 Jan 2016) | 2 lines +Changed paths: + A /trunk/src/fmma.c + A /trunk/tests/tfmma.c + +forgot two files + +------------------------------------------------------------------------ +r9792 | vlefevre | 2016-01-12 12:13:20 +0000 (Tue, 12 Jan 2016) | 1 line +Changed paths: + M /trunk/src/fma.c + +[src/fma.c] C89 compatibility correction. +------------------------------------------------------------------------ +r9791 | vlefevre | 2016-01-12 12:00:23 +0000 (Tue, 12 Jan 2016) | 1 line +Changed paths: + M /trunk/src/fma.c + +[src/fma.c] Replaced mp_ptr by mpfr_limb_ptr (as usual). +------------------------------------------------------------------------ +r9788 | zimmerma | 2016-01-10 21:39:53 +0000 (Sun, 10 Jan 2016) | 4 lines +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + M /trunk/src/Makefile.am + M /trunk/src/fma.c + M /trunk/src/mpfr.h + M /trunk/tests/Makefile.am + M /trunk/tools/mbench/mfv5-mpfr.cc + +speedup in mpfr_fma and mpfr_fms +new functions mpfr_fmma and mpfr_fmms +modified mbench/fma to compute b*c+c instead of b*b+c (b*c+d would be better) + +------------------------------------------------------------------------ +r9787 | vlefevre | 2016-01-08 15:22:26 +0000 (Fri, 08 Jan 2016) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added info about the parallel test harness. +------------------------------------------------------------------------ +r9786 | vlefevre | 2016-01-08 15:17:02 +0000 (Fri, 08 Jan 2016) | 4 lines +Changed paths: + M /trunk/doc/README.dev + M /trunk/tests/Makefile.am + +Updated documentation related to valgrind or other wrapper for the tests +due to the fact that Automake 1.13+ generates a parallel test harness. + * doc/README.dev: replaced VALGRIND by LOG_COMPILER. + * tests/Makefile.am: added a comment mentioning LOG_COMPILER. +------------------------------------------------------------------------ +r9784 | zimmerma | 2016-01-05 07:58:46 +0000 (Tue, 05 Jan 2016) | 2 lines +Changed paths: + M /trunk/tools/bench/mpfrbench.c + +mpfrbench: use clock() when getrusage() is not available + +------------------------------------------------------------------------ +r9783 | vlefevre | 2016-01-02 01:32:58 +0000 (Sat, 02 Jan 2016) | 2 lines +Changed paths: + M /trunk/INSTALL + +[INSTALL] Added a note about tuning MPFR: + For the current GMP version (6.1.0), a Unix-like OS is required. +------------------------------------------------------------------------ +r9780 | vlefevre | 2016-01-01 02:17:19 +0000 (Fri, 01 Jan 2016) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r9779 | vlefevre | 2016-01-01 02:15:38 +0000 (Fri, 01 Jan 2016) | 5 lines +Changed paths: + M /trunk/BUGS + M /trunk/INSTALL + M /trunk/Makefile.am + M /trunk/NEWS + M /trunk/README + M /trunk/TODO + M /trunk/acinclude.m4 + M /trunk/configure.ac + M /trunk/doc/FAQ.html + M /trunk/doc/Makefile.am + M /trunk/doc/README.dev + M /trunk/doc/faq.xsl + M /trunk/doc/mpfr.texi + M /trunk/examples/divworst.c + M /trunk/examples/rndo-add.c + M /trunk/examples/sample.c + M /trunk/examples/version.c + M /trunk/src/Makefile.am + M /trunk/src/abort_prec_max.c + M /trunk/src/acos.c + M /trunk/src/acosh.c + M /trunk/src/add.c + M /trunk/src/add1.c + M /trunk/src/add1sp.c + M /trunk/src/add_d.c + M /trunk/src/add_ui.c + M /trunk/src/agm.c + M /trunk/src/ai.c + M /trunk/src/amd/amdfam10/mparam.h + M /trunk/src/amd/athlon/mparam.h + M /trunk/src/amd/k8/mparam.h + M /trunk/src/arm/mparam.h + M /trunk/src/asin.c + M /trunk/src/asinh.c + M /trunk/src/atan.c + M /trunk/src/atan2.c + M /trunk/src/atanh.c + M /trunk/src/bernoulli.c + M /trunk/src/buildopt.c + M /trunk/src/cache.c + M /trunk/src/cbrt.c + M /trunk/src/check.c + M /trunk/src/clear.c + M /trunk/src/clears.c + M /trunk/src/cmp.c + M /trunk/src/cmp2.c + M /trunk/src/cmp_abs.c + M /trunk/src/cmp_d.c + M /trunk/src/cmp_ld.c + M /trunk/src/cmp_si.c + M /trunk/src/cmp_ui.c + M /trunk/src/comparisons.c + M /trunk/src/const_catalan.c + M /trunk/src/const_euler.c + M /trunk/src/const_log2.c + M /trunk/src/const_pi.c + M /trunk/src/constant.c + M /trunk/src/copysign.c + M /trunk/src/cos.c + M /trunk/src/cosh.c + M /trunk/src/cot.c + M /trunk/src/coth.c + M /trunk/src/csc.c + M /trunk/src/csch.c + M /trunk/src/d_div.c + M /trunk/src/d_sub.c + M /trunk/src/digamma.c + M /trunk/src/dim.c + M /trunk/src/div.c + M /trunk/src/div_2exp.c + M /trunk/src/div_2si.c + M /trunk/src/div_2ui.c + M /trunk/src/div_d.c + M /trunk/src/div_ui.c + M /trunk/src/dump.c + M /trunk/src/eint.c + M /trunk/src/eq.c + M /trunk/src/erandom.c + M /trunk/src/erf.c + M /trunk/src/erfc.c + M /trunk/src/exceptions.c + M /trunk/src/exp.c + M /trunk/src/exp10.c + M /trunk/src/exp2.c + M /trunk/src/exp3.c + M /trunk/src/exp_2.c + M /trunk/src/expm1.c + M /trunk/src/extract.c + M /trunk/src/factorial.c + M /trunk/src/fits_intmax.c + M /trunk/src/fits_s.h + M /trunk/src/fits_sint.c + M /trunk/src/fits_slong.c + M /trunk/src/fits_sshort.c + M /trunk/src/fits_u.h + M /trunk/src/fits_uint.c + M /trunk/src/fits_uintmax.c + M /trunk/src/fits_ulong.c + M /trunk/src/fits_ushort.c + M /trunk/src/fma.c + M /trunk/src/fms.c + M /trunk/src/fpif.c + M /trunk/src/frac.c + M /trunk/src/free_cache.c + M /trunk/src/frexp.c + M /trunk/src/gamma.c + M /trunk/src/gammaonethird.c + M /trunk/src/gen_inverse.h + M /trunk/src/generic/coverage/mparam.h + M /trunk/src/generic/mparam.h + M /trunk/src/get_d.c + M /trunk/src/get_d64.c + M /trunk/src/get_exp.c + M /trunk/src/get_f.c + M /trunk/src/get_float128.c + M /trunk/src/get_flt.c + M /trunk/src/get_ld.c + M /trunk/src/get_si.c + M /trunk/src/get_sj.c + M /trunk/src/get_str.c + M /trunk/src/get_ui.c + M /trunk/src/get_uj.c + M /trunk/src/get_z.c + M /trunk/src/get_z_exp.c + M /trunk/src/gmp_op.c + M /trunk/src/grandom.c + M /trunk/src/hppa/mparam.h + M /trunk/src/hypot.c + M /trunk/src/ia64/mparam.h + M /trunk/src/ieee_floats.h + M /trunk/src/init.c + M /trunk/src/init2.c + M /trunk/src/inits.c + M /trunk/src/inits2.c + M /trunk/src/inp_str.c + M /trunk/src/int_ceil_log2.c + M /trunk/src/isinf.c + M /trunk/src/isinteger.c + M /trunk/src/isnan.c + M /trunk/src/isnum.c + M /trunk/src/isqrt.c + M /trunk/src/isregular.c + M /trunk/src/iszero.c + M /trunk/src/jn.c + M /trunk/src/jyn_asympt.c + M /trunk/src/li2.c + M /trunk/src/lngamma.c + M /trunk/src/log.c + M /trunk/src/log10.c + M /trunk/src/log1p.c + M /trunk/src/log2.c + M /trunk/src/logging.c + M /trunk/src/min_prec.c + M /trunk/src/minmax.c + M /trunk/src/mips/mparam.h + M /trunk/src/modf.c + M /trunk/src/mp_clz_tab.c + M /trunk/src/mparam_h.in + M /trunk/src/mpf2mpfr.h + M /trunk/src/mpfr-cvers.h + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-intmax.h + M /trunk/src/mpfr-longlong.h + M /trunk/src/mpfr-mini-gmp.c + M /trunk/src/mpfr-mini-gmp.h + M /trunk/src/mpfr-sassert.h + M /trunk/src/mpfr-thread.h + M /trunk/src/mpfr.h + M /trunk/src/mpn_exp.c + M /trunk/src/mul.c + M /trunk/src/mul_2exp.c + M /trunk/src/mul_2si.c + M /trunk/src/mul_2ui.c + M /trunk/src/mul_d.c + M /trunk/src/mul_ui.c + M /trunk/src/mulders.c + M /trunk/src/neg.c + M /trunk/src/next.c + M /trunk/src/nrandom.c + M /trunk/src/out_str.c + M /trunk/src/pow.c + M /trunk/src/pow_si.c + M /trunk/src/pow_ui.c + M /trunk/src/pow_z.c + M /trunk/src/powerof2.c + M /trunk/src/powerpc32/mparam.h + M /trunk/src/powerpc64/mparam.h + M /trunk/src/print_raw.c + M /trunk/src/print_rnd_mode.c + M /trunk/src/printf.c + M /trunk/src/random_deviate.c + M /trunk/src/random_deviate.h + M /trunk/src/rec_sqrt.c + M /trunk/src/reldiff.c + M /trunk/src/rem1.c + M /trunk/src/rint.c + M /trunk/src/rndna.c + M /trunk/src/root.c + M /trunk/src/round_near_x.c + M /trunk/src/round_p.c + M /trunk/src/round_prec.c + M /trunk/src/round_raw_generic.c + M /trunk/src/scale2.c + M /trunk/src/sec.c + M /trunk/src/sech.c + M /trunk/src/set.c + M /trunk/src/set_d.c + M /trunk/src/set_d64.c + M /trunk/src/set_dfl_prec.c + M /trunk/src/set_exp.c + M /trunk/src/set_f.c + M /trunk/src/set_float128.c + M /trunk/src/set_flt.c + M /trunk/src/set_inf.c + M /trunk/src/set_ld.c + M /trunk/src/set_nan.c + M /trunk/src/set_prc_raw.c + M /trunk/src/set_prec.c + M /trunk/src/set_q.c + M /trunk/src/set_rnd.c + M /trunk/src/set_si.c + M /trunk/src/set_si_2exp.c + M /trunk/src/set_sj.c + M /trunk/src/set_str.c + M /trunk/src/set_str_raw.c + M /trunk/src/set_ui.c + M /trunk/src/set_ui_2exp.c + M /trunk/src/set_uj.c + M /trunk/src/set_z.c + M /trunk/src/set_z_exp.c + M /trunk/src/set_zero.c + M /trunk/src/setmax.c + M /trunk/src/setmin.c + M /trunk/src/setsign.c + M /trunk/src/sgn.c + M /trunk/src/si_op.c + M /trunk/src/signbit.c + M /trunk/src/sin.c + M /trunk/src/sin_cos.c + M /trunk/src/sinh.c + M /trunk/src/sinh_cosh.c + M /trunk/src/sparc64/mparam.h + M /trunk/src/sqr.c + M /trunk/src/sqrt.c + M /trunk/src/sqrt_ui.c + M /trunk/src/stack_interface.c + M /trunk/src/strtofr.c + M /trunk/src/sub.c + M /trunk/src/sub1.c + M /trunk/src/sub1sp.c + M /trunk/src/sub_d.c + M /trunk/src/sub_ui.c + M /trunk/src/subnormal.c + M /trunk/src/sum.c + M /trunk/src/swap.c + M /trunk/src/tan.c + M /trunk/src/tanh.c + M /trunk/src/uceil_exp2.c + M /trunk/src/uceil_log2.c + M /trunk/src/ufloor_log2.c + M /trunk/src/ui_div.c + M /trunk/src/ui_pow.c + M /trunk/src/ui_pow_ui.c + M /trunk/src/ui_sub.c + M /trunk/src/urandom.c + M /trunk/src/urandomb.c + M /trunk/src/vasprintf.c + M /trunk/src/version.c + M /trunk/src/volatile.c + M /trunk/src/x86/core2/mparam.h + M /trunk/src/x86/mparam.h + M /trunk/src/x86_64/core2/mparam.h + M /trunk/src/x86_64/corei5/mparam.h + M /trunk/src/x86_64/pentium4/mparam.h + M /trunk/src/yn.c + M /trunk/src/zeta.c + M /trunk/src/zeta_ui.c + M /trunk/tests/Makefile.am + M /trunk/tests/cmp_str.c + M /trunk/tests/data/digamma + M /trunk/tests/data/li2 + M /trunk/tests/memory.c + M /trunk/tests/mpf_compat.c + M /trunk/tests/mpf_compat.h + M /trunk/tests/mpfr-test.h + M /trunk/tests/mpfr_compat.c + M /trunk/tests/random2.c + M /trunk/tests/reuse.c + M /trunk/tests/rnd_mode.c + M /trunk/tests/tabort_defalloc1.c + M /trunk/tests/tabort_defalloc2.c + M /trunk/tests/tabort_prec_max.c + M /trunk/tests/tabs.c + M /trunk/tests/tacos.c + M /trunk/tests/tacosh.c + M /trunk/tests/tadd.c + M /trunk/tests/tadd1sp.c + M /trunk/tests/tadd_d.c + M /trunk/tests/tadd_ui.c + M /trunk/tests/tagm.c + M /trunk/tests/tai.c + M /trunk/tests/talloc.c + M /trunk/tests/tasin.c + M /trunk/tests/tasinh.c + M /trunk/tests/tassert.c + M /trunk/tests/tatan.c + M /trunk/tests/tatanh.c + M /trunk/tests/taway.c + M /trunk/tests/tbuildopt.c + M /trunk/tests/tcan_round.c + M /trunk/tests/tcbrt.c + M /trunk/tests/tcheck.c + M /trunk/tests/tcmp.c + M /trunk/tests/tcmp2.c + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + M /trunk/tests/tcmp_ui.c + M /trunk/tests/tcmpabs.c + M /trunk/tests/tcomparisons.c + M /trunk/tests/tconst_catalan.c + M /trunk/tests/tconst_euler.c + M /trunk/tests/tconst_log2.c + M /trunk/tests/tconst_pi.c + M /trunk/tests/tcopysign.c + M /trunk/tests/tcos.c + M /trunk/tests/tcosh.c + M /trunk/tests/tcot.c + M /trunk/tests/tcoth.c + M /trunk/tests/tcsc.c + M /trunk/tests/tcsch.c + M /trunk/tests/td_div.c + M /trunk/tests/td_sub.c + M /trunk/tests/tdigamma.c + M /trunk/tests/tdim.c + M /trunk/tests/tdiv.c + M /trunk/tests/tdiv_d.c + M /trunk/tests/tdiv_ui.c + M /trunk/tests/teint.c + M /trunk/tests/teq.c + M /trunk/tests/terandom.c + M /trunk/tests/terandom_chisq.c + M /trunk/tests/terf.c + M /trunk/tests/tests.c + M /trunk/tests/texceptions.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/texpm1.c + M /trunk/tests/tfactorial.c + M /trunk/tests/tfits.c + M /trunk/tests/tfma.c + M /trunk/tests/tfmod.c + M /trunk/tests/tfms.c + M /trunk/tests/tfpif.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tfrac.c + M /trunk/tests/tfrexp.c + M /trunk/tests/tgamma.c + M /trunk/tests/tgeneric.c + M /trunk/tests/tgeneric_ui.c + M /trunk/tests/tget_d.c + M /trunk/tests/tget_d_2exp.c + M /trunk/tests/tget_f.c + M /trunk/tests/tget_flt.c + M /trunk/tests/tget_ld_2exp.c + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tget_sj.c + M /trunk/tests/tget_str.c + M /trunk/tests/tget_z.c + M /trunk/tests/tgmpop.c + M /trunk/tests/tgrandom.c + M /trunk/tests/thyperbolic.c + M /trunk/tests/thypot.c + M /trunk/tests/tinits.c + M /trunk/tests/tinp_str.c + M /trunk/tests/tinternals.c + M /trunk/tests/tisnan.c + M /trunk/tests/tisqrt.c + M /trunk/tests/tj0.c + M /trunk/tests/tj1.c + M /trunk/tests/tjn.c + M /trunk/tests/tl2b.c + M /trunk/tests/tlgamma.c + M /trunk/tests/tli2.c + M /trunk/tests/tlngamma.c + M /trunk/tests/tlog.c + M /trunk/tests/tlog10.c + M /trunk/tests/tlog1p.c + M /trunk/tests/tlog2.c + M /trunk/tests/tmin_prec.c + M /trunk/tests/tminmax.c + M /trunk/tests/tmodf.c + M /trunk/tests/tmul.c + M /trunk/tests/tmul_2exp.c + M /trunk/tests/tmul_d.c + M /trunk/tests/tmul_ui.c + M /trunk/tests/tnext.c + M /trunk/tests/tnrandom.c + M /trunk/tests/tnrandom_chisq.c + M /trunk/tests/tout_str.c + M /trunk/tests/toutimpl.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow3.c + M /trunk/tests/tpow_all.c + M /trunk/tests/tpow_z.c + M /trunk/tests/tprintf.c + M /trunk/tests/trandom.c + M /trunk/tests/trandom_deviate.c + M /trunk/tests/trec_sqrt.c + M /trunk/tests/tremquo.c + M /trunk/tests/trint.c + M /trunk/tests/trndna.c + M /trunk/tests/troot.c + M /trunk/tests/tround_prec.c + M /trunk/tests/tsec.c + M /trunk/tests/tsech.c + M /trunk/tests/tset.c + M /trunk/tests/tset_d.c + M /trunk/tests/tset_exp.c + M /trunk/tests/tset_f.c + M /trunk/tests/tset_float128.c + M /trunk/tests/tset_ld.c + M /trunk/tests/tset_q.c + M /trunk/tests/tset_si.c + M /trunk/tests/tset_sj.c + M /trunk/tests/tset_str.c + M /trunk/tests/tset_z.c + M /trunk/tests/tset_z_exp.c + M /trunk/tests/tsgn.c + M /trunk/tests/tsi_op.c + M /trunk/tests/tsin.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tsinh.c + M /trunk/tests/tsinh_cosh.c + M /trunk/tests/tsprintf.c + M /trunk/tests/tsqr.c + M /trunk/tests/tsqrt.c + M /trunk/tests/tsqrt_ui.c + M /trunk/tests/tstckintc.c + M /trunk/tests/tstdint.c + M /trunk/tests/tstrtofr.c + M /trunk/tests/tsub.c + M /trunk/tests/tsub1sp.c + M /trunk/tests/tsub_d.c + M /trunk/tests/tsub_ui.c + M /trunk/tests/tsubnormal.c + M /trunk/tests/tsum.c + M /trunk/tests/tswap.c + M /trunk/tests/ttan.c + M /trunk/tests/ttanh.c + M /trunk/tests/ttrunc.c + M /trunk/tests/tui_div.c + M /trunk/tests/tui_pow.c + M /trunk/tests/tui_sub.c + M /trunk/tests/turandom.c + M /trunk/tests/tvalist.c + M /trunk/tests/tversion.c + M /trunk/tests/ty0.c + M /trunk/tests/ty1.c + M /trunk/tests/tyn.c + M /trunk/tests/tzeta.c + M /trunk/tests/tzeta_ui.c + M /trunk/tools/bench/Makefile.am + M /trunk/tools/bench/benchtime.h + M /trunk/tools/bench/mpfrbench.c + M /trunk/tools/ck-copyright-notice + M /trunk/tools/ck-mparam + M /trunk/tools/ck-version-info + M /trunk/tools/get_patches.sh + M /trunk/tune/Makefile.am + M /trunk/tune/bidimensional_sample.c + M /trunk/tune/speed.c + M /trunk/tune/tuneup.c + +Copyright notice update: added 2016 with + perl -pi -e 's/ (\d{4}-)?(2015)(?= Free Software)/ + " ".($1||"$2-").($2+1)/e' **/*(^/) +under zsh (the m4 and tools/mbench directories were not modified). +Removed 2015 from the example in the doc/README.dev file. +------------------------------------------------------------------------ +r9778 | vlefevre | 2015-12-28 23:51:22 +0000 (Mon, 28 Dec 2015) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Fixed MPFR_WIN_THREAD_SAFE_DLL definition +(patch by Patrick Pélissier). +------------------------------------------------------------------------ +r9777 | vlefevre | 2015-12-27 23:56:07 +0000 (Sun, 27 Dec 2015) | 6 lines +Changed paths: + M /trunk/tests/mpf_compat.h + +[tests/mpf_compat.h] Fix: File "inp_str.dat" could not be opened with +builds outside the source directory (objdir different from srcdir). +This did not generate an error, but prevented a test from being done. +Now that mpfr-test.h is included via the mpf_compat.c or mpfr_compat.c +file (there does not seem to be a valid reason not to include it), we +can use src_fopen to open the file in all cases. +------------------------------------------------------------------------ +r9775 | vlefevre | 2015-12-27 13:54:59 +0000 (Sun, 27 Dec 2015) | 1 line +Changed paths: + M /trunk/tests/mpfr-test.h + M /trunk/tests/tests.c + M /trunk/tests/tversion.c + +[tests] In tversion.c, output the locale too (if supported). +------------------------------------------------------------------------ +r9774 | vlefevre | 2015-12-27 13:50:21 +0000 (Sun, 27 Dec 2015) | 1 line +Changed paths: + M /trunk/tests/tinp_str.c + +[tests/tinp_str.c] Added a blank line. +------------------------------------------------------------------------ +r9773 | vlefevre | 2015-12-27 13:31:56 +0000 (Sun, 27 Dec 2015) | 4 lines +Changed paths: + M /trunk/tests/inp_str.dat + M /trunk/tests/mpf_compat.h + M /trunk/tests/tinp_str.c + +[tests] + * inp_str.dat: added a locale-independent line at the beginning of + the file (useful for mpf_compat). + * mpf_compat.h, tinp_str.c: update because of this change. +------------------------------------------------------------------------ +r9772 | vlefevre | 2015-12-27 11:51:58 +0000 (Sun, 27 Dec 2015) | 3 lines +Changed paths: + M /trunk/tests/tests.c + +[tests/tests.c] Improved src_fopen description (do not use the term +"src directory" because there is a directory named "src", but this +is not what is referred here). +------------------------------------------------------------------------ +r9771 | vlefevre | 2015-12-26 13:52:07 +0000 (Sat, 26 Dec 2015) | 2 lines +Changed paths: + M /trunk/tests/mpf_compat.h + +[tests/mpf_compat.h] Fix: changed "inp_str.data" to "inp_str.dat" +due to the file rename in r8120 (otherwise nothing is tested). +------------------------------------------------------------------------ +r9770 | vlefevre | 2015-12-26 11:41:11 +0000 (Sat, 26 Dec 2015) | 8 lines +Changed paths: + M /trunk/tests/mpf_compat.h + +[tests/mpf_compat.h] For mpf_set_str and mpf_init_set_str, avoid strings +with ".", since for GMP the decimal separator is locale dependent (the +tests can be run in non-C locales on purpose in order to detect issues +in various locales), so that for the mpf_compat test, the conversion +fails and the mpf value x is set to 0 (which can yield other problems, +such as with mpf_div (y, x, x), which raises an exception). +Note: this problem appeared in r9157, where tests_start_mpfr() was added +to mpf_compat.h (the locale setting is done in this function). +------------------------------------------------------------------------ +r9769 | zimmerma | 2015-12-18 08:24:39 +0000 (Fri, 18 Dec 2015) | 2 lines +Changed paths: + M /trunk/tests/mpfr-test.h + +patch from Patrick Pelissier (for MinGW) + +------------------------------------------------------------------------ +r9768 | vlefevre | 2015-12-15 07:47:43 +0000 (Tue, 15 Dec 2015) | 1 line +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Corrections for C++. +------------------------------------------------------------------------ +r9767 | vlefevre | 2015-12-14 16:38:00 +0000 (Mon, 14 Dec 2015) | 1 line +Changed paths: + M /trunk/INSTALL + +Removed trailing spaces. +------------------------------------------------------------------------ +r9766 | zimmerma | 2015-12-14 13:59:43 +0000 (Mon, 14 Dec 2015) | 2 lines +Changed paths: + M /trunk/INSTALL + +review by Rob (sisyphus1@optusnet.com.au) + +------------------------------------------------------------------------ +r9765 | zimmerma | 2015-12-14 11:55:44 +0000 (Mon, 14 Dec 2015) | 2 lines +Changed paths: + M /trunk/INSTALL + +removed obsolete parts (?) for MinGW + +------------------------------------------------------------------------ +r9764 | zimmerma | 2015-12-14 11:52:10 +0000 (Mon, 14 Dec 2015) | 2 lines +Changed paths: + M /trunk/INSTALL + +new text for Windows/Visual Studio/Visual C++ part contributed by Brian Gladman + +------------------------------------------------------------------------ +r9763 | vlefevre | 2015-12-14 11:12:18 +0000 (Mon, 14 Dec 2015) | 1 line +Changed paths: + M /trunk/INSTALL + +[INSTALL] Switch to UTF-8. +------------------------------------------------------------------------ +r9762 | zimmerma | 2015-12-14 09:38:00 +0000 (Mon, 14 Dec 2015) | 2 lines +Changed paths: + M /trunk/INSTALL + +changes proposed by Alexander (sav_ix@ukr.net) + +------------------------------------------------------------------------ +r9761 | vlefevre | 2015-12-14 08:55:12 +0000 (Mon, 14 Dec 2015) | 1 line +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Correction. +------------------------------------------------------------------------ +r9760 | zimmerma | 2015-12-14 08:47:26 +0000 (Mon, 14 Dec 2015) | 2 lines +Changed paths: + M /trunk/tests/tsum.c + +clock() should work everywhere + +------------------------------------------------------------------------ +r9759 | vlefevre | 2015-12-14 08:40:26 +0000 (Mon, 14 Dec 2015) | 1 line +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] The timing test from r9753 in POSIX-only. +------------------------------------------------------------------------ +r9758 | vlefevre | 2015-12-14 08:02:45 +0000 (Mon, 14 Dec 2015) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r9757 | zimmerma | 2015-12-14 07:56:59 +0000 (Mon, 14 Dec 2015) | 2 lines +Changed paths: + M /trunk/INSTALL + +update INSTALL file + +------------------------------------------------------------------------ +r9756 | zimmerma | 2015-12-14 07:39:10 +0000 (Mon, 14 Dec 2015) | 2 lines +Changed paths: + M /trunk/INSTALL + +-D__USE_MINGW_ANSI_STDIO is needed for GMP only + +------------------------------------------------------------------------ +r9755 | vlefevre | 2015-12-11 16:46:48 +0000 (Fri, 11 Dec 2015) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Updated comment about overlapping between input and output. +------------------------------------------------------------------------ +r9754 | zimmerma | 2015-12-11 16:15:14 +0000 (Fri, 11 Dec 2015) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +document that (currently) mpfr_sum doesn't allow overlap + +------------------------------------------------------------------------ +r9753 | zimmerma | 2015-12-11 15:49:29 +0000 (Fri, 11 Dec 2015) | 2 lines +Changed paths: + M /trunk/tests/tsum.c + +timing test to compare mpfr_sum and naive algorithm (without correct rounding) + +------------------------------------------------------------------------ +r9751 | zimmerma | 2015-12-11 13:39:41 +0000 (Fri, 11 Dec 2015) | 2 lines +Changed paths: + M /trunk/INSTALL + +update wrt -D__USE_MINGW_ANSI_STDIO + +------------------------------------------------------------------------ +r9750 | zimmerma | 2015-12-11 13:24:51 +0000 (Fri, 11 Dec 2015) | 2 lines +Changed paths: + M /trunk/INSTALL + +note about MinGW and TLS support + +------------------------------------------------------------------------ +r9749 | zimmerma | 2015-12-11 08:54:39 +0000 (Fri, 11 Dec 2015) | 2 lines +Changed paths: + M /trunk/tests/tfprintf.c + M /trunk/tests/tprintf.c + +improving error message + +------------------------------------------------------------------------ +r9747 | zimmerma | 2015-12-10 20:59:26 +0000 (Thu, 10 Dec 2015) | 2 lines +Changed paths: + M /trunk/tests/tfprintf.c + M /trunk/tests/tprintf.c + M /trunk/tests/tsprintf.c + +added comment and message for errors under MinGW + +------------------------------------------------------------------------ +r9745 | vlefevre | 2015-12-03 10:17:09 +0000 (Thu, 03 Dec 2015) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Updated a comment about clang and division by 0. +------------------------------------------------------------------------ +r9742 | vlefevre | 2015-11-11 01:43:00 +0000 (Wed, 11 Nov 2015) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Update. +------------------------------------------------------------------------ +r9741 | vlefevre | 2015-11-11 01:25:12 +0000 (Wed, 11 Nov 2015) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Update. +------------------------------------------------------------------------ +r9740 | vlefevre | 2015-11-11 00:48:50 +0000 (Wed, 11 Nov 2015) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Minor correction. +------------------------------------------------------------------------ +r9739 | vlefevre | 2015-11-10 17:00:22 +0000 (Tue, 10 Nov 2015) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Minor correction. +------------------------------------------------------------------------ +r9738 | vlefevre | 2015-11-10 16:29:45 +0000 (Tue, 10 Nov 2015) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Minor correction. +------------------------------------------------------------------------ +r9737 | vlefevre | 2015-11-10 15:59:51 +0000 (Tue, 10 Nov 2015) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Update. +------------------------------------------------------------------------ +r9736 | vlefevre | 2015-11-10 13:12:45 +0000 (Tue, 10 Nov 2015) | 2 lines +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Clarification: avoid the word "iteration" for the loop +over the inputs, when possible. +------------------------------------------------------------------------ +r9735 | vlefevre | 2015-11-10 12:57:20 +0000 (Tue, 10 Nov 2015) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Update. +------------------------------------------------------------------------ +r9734 | vlefevre | 2015-11-10 09:03:17 +0000 (Tue, 10 Nov 2015) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Update. +------------------------------------------------------------------------ +r9733 | vlefevre | 2015-11-10 01:30:55 +0000 (Tue, 10 Nov 2015) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Update. +------------------------------------------------------------------------ +r9732 | vlefevre | 2015-11-09 16:28:57 +0000 (Mon, 09 Nov 2015) | 2 lines +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Added a FIXME comment about the reuse of an input for the +output. +------------------------------------------------------------------------ +r9731 | vlefevre | 2015-11-06 23:17:31 +0000 (Fri, 06 Nov 2015) | 1 line +Changed paths: + M /trunk/NEWS + M /trunk/configure.ac + M /trunk/src/mpfr-gmp.h + +GMP 5.0.0 or newer is required (instead of 4.2.0). +------------------------------------------------------------------------ +r9730 | vlefevre | 2015-11-06 15:11:12 +0000 (Fri, 06 Nov 2015) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Major and final update (complete rewrite). +------------------------------------------------------------------------ +r9729 | vlefevre | 2015-11-06 02:49:03 +0000 (Fri, 06 Nov 2015) | 1 line +Changed paths: + M /trunk/src/mpfr-gmp.h + +[src/mpfr-gmp.h] Added a TODO. +------------------------------------------------------------------------ +r9728 | vlefevre | 2015-11-06 02:16:50 +0000 (Fri, 06 Nov 2015) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Bug fixed (MPN_COPY_INCR instead of MPN_COPY_DECR). +------------------------------------------------------------------------ +r9727 | vlefevre | 2015-11-05 15:55:00 +0000 (Thu, 05 Nov 2015) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Minor comment correction. +------------------------------------------------------------------------ +r9726 | vlefevre | 2015-11-05 12:43:51 +0000 (Thu, 05 Nov 2015) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Added another assertion (checked). +------------------------------------------------------------------------ +r9725 | vlefevre | 2015-11-05 12:12:14 +0000 (Thu, 05 Nov 2015) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Added assertions (checked). +------------------------------------------------------------------------ +r9724 | vlefevre | 2015-11-04 10:29:01 +0000 (Wed, 04 Nov 2015) | 1 line +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Added a comment. +------------------------------------------------------------------------ +r9723 | vlefevre | 2015-11-04 10:17:08 +0000 (Wed, 04 Nov 2015) | 2 lines +Changed paths: + M /trunk/TODO + +[TODO] In tsum, add testcases for mpfr_sum triggering the bug fixed +in r9722. +------------------------------------------------------------------------ +r9722 | vlefevre | 2015-11-04 10:07:06 +0000 (Wed, 04 Nov 2015) | 2 lines +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Bug fix: an error bound was too large to compute the sign +of the secondary term (when the TMD occurs). +------------------------------------------------------------------------ +r9721 | vlefevre | 2015-11-03 14:17:15 +0000 (Tue, 03 Nov 2015) | 2 lines +Changed paths: + M /trunk/tests/tstdint.c + M /trunk/tests/tvalist.c + +[tests/{tstdint.c,tvalist.c}] Updated and improved comment about the +test of partial + full inclusion. +------------------------------------------------------------------------ +r9720 | vlefevre | 2015-11-03 11:17:16 +0000 (Tue, 03 Nov 2015) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] C code starting with # (preprocessor directives) must not +be indented. +------------------------------------------------------------------------ +r9718 | zimmerma | 2015-11-03 10:52:52 +0000 (Tue, 03 Nov 2015) | 2 lines +Changed paths: + M /trunk/configure.ac + M /trunk/doc/mini-gmp + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-mini-gmp.h + M /trunk/tests/tests.c + M /trunk/tests/tstdint.c + M /trunk/tests/tvalist.c + M /trunk/tests/tversion.c + +simplify the configuration with mini-gmp + +------------------------------------------------------------------------ +r9717 | vlefevre | 2015-10-30 15:52:37 +0000 (Fri, 30 Oct 2015) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Updated comment for sum_raw(). +------------------------------------------------------------------------ +r9716 | zimmerma | 2015-10-30 10:28:21 +0000 (Fri, 30 Oct 2015) | 2 lines +Changed paths: + M /trunk/src/mpfr-mini-gmp.h + +better definition of GMP_NUMB_BITS + +------------------------------------------------------------------------ +r9715 | zimmerma | 2015-10-29 18:55:09 +0000 (Thu, 29 Oct 2015) | 2 lines +Changed paths: + M /trunk/src/mulders.c + +update description of file + +------------------------------------------------------------------------ +r9710 | vlefevre | 2015-10-29 13:36:15 +0000 (Thu, 29 Oct 2015) | 1 line +Changed paths: + M /trunk/tests/tdiv.c + +[tests/tdiv.c] Improved comment about the mpfr_divhigh_n_basecase bug. +------------------------------------------------------------------------ +r9708 | zimmerma | 2015-10-29 12:29:44 +0000 (Thu, 29 Oct 2015) | 2 lines +Changed paths: + M /trunk/src/mpfr-mini-gmp.c + M /trunk/src/mpfr-mini-gmp.h + M /trunk/tests/tabort_defalloc1.c + M /trunk/tests/tabort_defalloc2.c + M /trunk/tests/terandom_chisq.c + M /trunk/tests/tnrandom_chisq.c + M /trunk/tests/trandom_deviate.c + +more tests do work with mini-gmp (from GMP 6.1.0-rc1) + +------------------------------------------------------------------------ +r9707 | vlefevre | 2015-10-29 12:17:04 +0000 (Thu, 29 Oct 2015) | 2 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] For the tests on the source files, ignore everything +related to mini-gmp, not just the src/mini-gmp.[ch] files. +------------------------------------------------------------------------ +r9706 | vlefevre | 2015-10-29 12:06:19 +0000 (Thu, 29 Oct 2015) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] "To make a release": mention -DMPFR_TUNE_COVERAGE. +------------------------------------------------------------------------ +r9705 | vlefevre | 2015-10-29 12:02:17 +0000 (Thu, 29 Oct 2015) | 1 line +Changed paths: + M /trunk/tests/tdiv.c + +[tests/tdiv.c] Updated comment about the mpfr_divhigh_n_basecase bug. +------------------------------------------------------------------------ +r9704 | zimmerma | 2015-10-29 09:44:03 +0000 (Thu, 29 Oct 2015) | 2 lines +Changed paths: + M /trunk/src/mpfr-mini-gmp.c + +fixed replacement for mpn_neg (return value was wrong) + +------------------------------------------------------------------------ +r9703 | zimmerma | 2015-10-29 08:31:48 +0000 (Thu, 29 Oct 2015) | 2 lines +Changed paths: + M /trunk/doc/mini-gmp + M /trunk/src/free_cache.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-mini-gmp.c + M /trunk/src/mpfr-mini-gmp.h + M /trunk/src/urandomb.c + +adapt for mini-gmp (from GMP 6.1.0-rc1) + +------------------------------------------------------------------------ +r9702 | zimmerma | 2015-10-29 06:57:07 +0000 (Thu, 29 Oct 2015) | 2 lines +Changed paths: + M /trunk/src/bernoulli.c + M /trunk/src/div.c + +replace obsolete mpz_div_2exp function by mpz_xdiv_q_2exp + +------------------------------------------------------------------------ +r9701 | zimmerma | 2015-10-28 17:33:01 +0000 (Wed, 28 Oct 2015) | 2 lines +Changed paths: + M /trunk/doc/mini-gmp + M /trunk/src/free_cache.c + M /trunk/src/mpfr-mini-gmp.c + M /trunk/src/mpfr-mini-gmp.h + +adapt mini-gmp stuff to GMP 6.1.0-rc1 + +------------------------------------------------------------------------ +r9700 | zimmerma | 2015-10-28 16:39:50 +0000 (Wed, 28 Oct 2015) | 2 lines +Changed paths: + M /trunk/src/const_euler.c + +replace obsolete mpz_div by mpz_tdiv_q + +------------------------------------------------------------------------ +r9699 | zimmerma | 2015-10-27 12:20:39 +0000 (Tue, 27 Oct 2015) | 3 lines +Changed paths: + M /trunk/src/mulders.c + M /trunk/tests/tdiv.c + +fix bug reported by Ricky Farr +(https://sympa.inria.fr/sympa/arc/mpfr/2015-10/msg00023.html) + +------------------------------------------------------------------------ +r9697 | vlefevre | 2015-10-22 14:34:29 +0000 (Thu, 22 Oct 2015) | 2 lines +Changed paths: + M /trunk/autogen.sh + +[autogen.sh] Restore the INSTALL file also if the process receives +a usual signal (SIGHUP, SIGINT, SIGQUIT or SIGTERM). +------------------------------------------------------------------------ +r9696 | vlefevre | 2015-10-22 12:37:52 +0000 (Thu, 22 Oct 2015) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Added a comment about compiler info. +------------------------------------------------------------------------ +r9695 | vlefevre | 2015-10-22 12:25:43 +0000 (Thu, 22 Oct 2015) | 3 lines +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Instead of __GNUC__, __GNUC_MINOR__ and +__GNUC_PATCHLEVEL__, output __VERSION__, which gives more +information (for GCC development versions and ICC). +------------------------------------------------------------------------ +r9694 | vlefevre | 2015-10-21 11:41:57 +0000 (Wed, 21 Oct 2015) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Updated comment for sum_raw(). +------------------------------------------------------------------------ +r9693 | vlefevre | 2015-09-15 14:29:32 +0000 (Tue, 15 Sep 2015) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added a comment about mpfr_get_{si,ui,sj,uj} and flags. +------------------------------------------------------------------------ +r9692 | vlefevre | 2015-09-15 14:02:41 +0000 (Tue, 15 Sep 2015) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r9691 | vlefevre | 2015-09-15 13:59:49 +0000 (Tue, 15 Sep 2015) | 3 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Changed "returned value" to "return value" when this +is the value returned by the C function (synonymous, but sometimes +less ambiguous). +------------------------------------------------------------------------ +r9690 | vlefevre | 2015-09-15 13:55:46 +0000 (Tue, 15 Sep 2015) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] For r9689, "returned value" → "return value". +------------------------------------------------------------------------ +r9689 | vlefevre | 2015-09-15 13:51:33 +0000 (Tue, 15 Sep 2015) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Completed the specification of mpfr_get_{si,ui,sj,uj} +and mpfr_get_z (inexact flag, and returned value for mpfr_get_z). +------------------------------------------------------------------------ +r9688 | vlefevre | 2015-09-15 12:16:15 +0000 (Tue, 15 Sep 2015) | 6 lines +Changed paths: + M /trunk/tests/tget_z.c + +[tests/tget_z.c] Fixed and improved the check_one() test. + * The input value was modified at each iteration, giving z = 0 very + quickly, so that not much was tested in practice; in particular, + the third argument of mpz_fdiv_q_2exp in mpfr_get_z was never + properly tested (since it has no effect for z = 0). + * Added various tests of the flags. +------------------------------------------------------------------------ +r9687 | vlefevre | 2015-09-15 09:25:20 +0000 (Tue, 15 Sep 2015) | 1 line +Changed paths: + M /trunk/tests/tget_z.c + +[tests/tget_z.c] Optimized the check_one() test. +------------------------------------------------------------------------ +r9684 | vlefevre | 2015-09-10 20:54:35 +0000 (Thu, 10 Sep 2015) | 5 lines +Changed paths: + M /trunk + M /trunk/src/const_catalan.c + M /trunk/src/const_euler.c + M /trunk/src/const_log2.c + M /trunk/src/const_pi.c + M /trunk/src/exceptions.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-thread.h + M /trunk/src/set_dfl_prec.c + M /trunk/src/set_rnd.c + +Merged the win-thread-safe-dll branch: support build as thread-safe DLL +on Windows: changes from Stephan Tolksdorf + https://gforge.inria.fr/tracker/download.php/136/619/19537/4980/changes.zip ++ a correction and some consistency checks. See MPFR bug 19537 on: +https://gforge.inria.fr/tracker/index.php?func=detail&aid=19537&group_id=136&atid=619 +------------------------------------------------------------------------ +r9675 | vlefevre | 2015-09-10 00:17:06 +0000 (Thu, 10 Sep 2015) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + M /trunk/tests/mpfr-test.h + M /trunk/tests/tfprintf.c + M /trunk/tests/tprintf.c + M /trunk/tests/tsprintf.c + +Include config.h when need be. +------------------------------------------------------------------------ +r9674 | vlefevre | 2015-09-07 09:15:01 +0000 (Mon, 07 Sep 2015) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Updated mpz_t caching item, suggesting mpz_init2 instead. +------------------------------------------------------------------------ +r9673 | vlefevre | 2015-09-07 08:59:49 +0000 (Mon, 07 Sep 2015) | 5 lines +Changed paths: + M /trunk/TODO + +[TODO] Added: check whether mpz_t caching is necessary (this was +committed in r8911). In short, timings should be done with -static +(this wasn't clear), they may depend on the malloc implementation, +and after a look at the source, the difference in the timings with +mpz_t caching is surprising and should be explained. +------------------------------------------------------------------------ +r9672 | vlefevre | 2015-09-04 10:02:57 +0000 (Fri, 04 Sep 2015) | 3 lines +Changed paths: + M /trunk/tools/ck-copyright-notice + +[tools/ck-copyright-notice] Check src/mparam_h.in instead of the +generated (and not distributed) src/mparam.h file; this is also +useful to avoid an error after running "make tune". +------------------------------------------------------------------------ +r9671 | zimmerma | 2015-09-04 09:57:08 +0000 (Fri, 04 Sep 2015) | 2 lines +Changed paths: + M /trunk/tools/bench/Makefile.am + +distribute the mpfrbench README + +------------------------------------------------------------------------ +r9670 | zimmerma | 2015-09-04 09:48:35 +0000 (Fri, 04 Sep 2015) | 2 lines +Changed paths: + A /trunk/tools/bench/README + +add a README for mpfrbench + +------------------------------------------------------------------------ +r9669 | vlefevre | 2015-09-04 09:39:10 +0000 (Fri, 04 Sep 2015) | 1 line +Changed paths: + M /trunk/tune/tuneup.c + +More details in a comment about assertions via tuneup. +------------------------------------------------------------------------ +r9668 | zimmerma | 2015-09-04 09:23:58 +0000 (Fri, 04 Sep 2015) | 2 lines +Changed paths: + M /trunk/tune/tuneup.c + +fixed failed assertion during "make tune" + +------------------------------------------------------------------------ +r9667 | vlefevre | 2015-08-25 22:10:40 +0000 (Tue, 25 Aug 2015) | 1 line +Changed paths: + M /trunk/tests/tget_z.c + +[tests/tget_z.c] Flags testing. +------------------------------------------------------------------------ +r9666 | vlefevre | 2015-08-25 20:43:35 +0000 (Tue, 25 Aug 2015) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Updated a URL. +------------------------------------------------------------------------ +r9663 | vlefevre | 2015-08-25 17:22:30 +0000 (Tue, 25 Aug 2015) | 1 line +Changed paths: + M /trunk/tests/tstdint.c + +[tests/tstdint.c] Support MPFR_PRINTF_MAXLM. +------------------------------------------------------------------------ +r9662 | vlefevre | 2015-08-25 16:44:08 +0000 (Tue, 25 Aug 2015) | 1 line +Changed paths: + M /trunk/tests/tget_sj.c + +[tests/tget_sj.c] Support MPFR_PRINTF_MAXLM. +------------------------------------------------------------------------ +r9661 | vlefevre | 2015-08-25 16:36:24 +0000 (Tue, 25 Aug 2015) | 1 line +Changed paths: + M /trunk/tests/tget_sj.c + +[tests/tget_sj.c] Typo. +------------------------------------------------------------------------ +r9660 | vlefevre | 2015-08-25 16:24:23 +0000 (Tue, 25 Aug 2015) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Instead of checking whether the 'j' printf length +modifier is working, try to find one that works. +------------------------------------------------------------------------ +r9659 | vlefevre | 2015-08-25 15:17:22 +0000 (Tue, 25 Aug 2015) | 1 line +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Check whether the 'j' printf length modifier is working. +------------------------------------------------------------------------ +r9658 | vlefevre | 2015-08-25 12:25:03 +0000 (Tue, 25 Aug 2015) | 1 line +Changed paths: + M /trunk/tests/tget_sj.c + +[tests/tget_sj.c] Improved check_erange (more flags testing). +------------------------------------------------------------------------ +r9657 | vlefevre | 2015-08-25 11:45:22 +0000 (Tue, 25 Aug 2015) | 1 line +Changed paths: + M /trunk/tests/tget_sj.c + +[tests/tget_sj.c] Improved check_sj and check_uj even more. +------------------------------------------------------------------------ +r9656 | vlefevre | 2015-08-25 11:31:08 +0000 (Tue, 25 Aug 2015) | 1 line +Changed paths: + M /trunk/tests/tget_sj.c + +[tests/tget_sj.c] Improved check_sj and check_uj (flags testing). +------------------------------------------------------------------------ +r9655 | vlefevre | 2015-08-24 15:48:24 +0000 (Mon, 24 Aug 2015) | 1 line +Changed paths: + M /trunk/tests/tfits.c + +[tests/tfits.c] New tests at the limits of the types. +------------------------------------------------------------------------ +r9654 | vlefevre | 2015-08-24 15:38:14 +0000 (Mon, 24 Aug 2015) | 2 lines +Changed paths: + M /trunk/tests/tfits.c + +[tests/tfits.c] For the mpfr_fits_{uintmax,intmax}_p functions, check +that the flags are not modified and added tests of -Inf and -0. +------------------------------------------------------------------------ +r9653 | vlefevre | 2015-08-24 15:23:55 +0000 (Mon, 24 Aug 2015) | 2 lines +Changed paths: + M /trunk/tests/tfits.c + +[tests/tfits.c] For the mpfr_fits_{u,s}{long,int,short}_p functions, +check that the flags are not modified and added tests of -Inf and -0. +------------------------------------------------------------------------ +r9652 | zimmerma | 2015-08-24 10:11:29 +0000 (Mon, 24 Aug 2015) | 2 lines +Changed paths: + M /trunk/src/mparam_h.in + +fixed the AMD K8 tuning (cf r8118) + +------------------------------------------------------------------------ +r9651 | vlefevre | 2015-08-24 06:44:57 +0000 (Mon, 24 Aug 2015) | 1 line +Changed paths: + M /trunk/tests/tset_si.c + +[tests/tset_si.c] Improved NaN mpfr_get_si / mpfr_get_ui test. +------------------------------------------------------------------------ +r9650 | vlefevre | 2015-08-24 01:37:59 +0000 (Mon, 24 Aug 2015) | 3 lines +Changed paths: + M /trunk/src/fits_intmax.c + M /trunk/src/fits_s.h + M /trunk/src/fits_u.h + +[src/{fits_intmax.c,fits_s.h,fits_u.h}] Fixed mpfr_fits_* functions: +the flags could be modified, which made the new mpfr_get_{si,ui} tests +fail (tests/tset_si.c r9649). +------------------------------------------------------------------------ +r9649 | vlefevre | 2015-08-24 01:23:30 +0000 (Mon, 24 Aug 2015) | 1 line +Changed paths: + M /trunk/tests/tset_si.c + +[tests/tset_si.c] Added mpfr_get_{si,ui} tests, including flags. +------------------------------------------------------------------------ +r9648 | vlefevre | 2015-08-20 12:17:30 +0000 (Thu, 20 Aug 2015) | 3 lines +Changed paths: + M /trunk/src/mparam_h.in + +[src/mparam_h.in] Improved comment: __amd64__ is generic to all +x86 processors with a 64-bit ABI (amd64, a.k.a. x86_64), thus +suggest to move mparam.h files to more meaningful locations. +------------------------------------------------------------------------ +r9645 | vlefevre | 2015-08-20 01:27:44 +0000 (Thu, 20 Aug 2015) | 4 lines +Changed paths: + M /trunk + M /trunk/configure.ac + +[configure.ac] Added test for usability of gmp.h at link time +(merged changeset r9644 from the 3.1 branch, with minor changes +due to the fact that a known problem between GMP 4.1 and GCC 5 +can no longer occur, now that we require GMP 4.2.0 or newer). +------------------------------------------------------------------------ +r9642 | vlefevre | 2015-08-19 08:05:38 +0000 (Wed, 19 Aug 2015) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] "To make a release": mention abi-compliance-checker. +------------------------------------------------------------------------ +r9638 | vlefevre | 2015-07-31 12:30:50 +0000 (Fri, 31 Jul 2015) | 3 lines +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] Added an assertion (I get a build failure with gcc-snapshot +20150722-1 due to -Werror=array-bounds, but the code looks OK). +Simplified test on: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67077 +------------------------------------------------------------------------ +r9637 | zimmerma | 2015-07-31 07:22:03 +0000 (Fri, 31 Jul 2015) | 3 lines +Changed paths: + M /trunk/configure.ac + M /trunk/src/mpfr-gmp.h + M /trunk/src/sqrt.c + +remove usage of mpn_rootrem in mpfr_sqrt since now mpn_sqrtrem is faster +(https://gmplib.org/list-archives/gmp-devel/2015-July/004074.html) + +------------------------------------------------------------------------ +r9636 | vlefevre | 2015-07-30 09:41:37 +0000 (Thu, 30 Jul 2015) | 1 line +Changed paths: + M /trunk/src/next.c + +[src/next.c] Added a note concerning the exceptions. +------------------------------------------------------------------------ +r9632 | vlefevre | 2015-07-20 22:04:21 +0000 (Mon, 20 Jul 2015) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r9631 | vlefevre | 2015-07-20 21:56:04 +0000 (Mon, 20 Jul 2015) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Output MPFR_VERSION_STRING too. +------------------------------------------------------------------------ +r9630 | vlefevre | 2015-07-20 21:49:28 +0000 (Mon, 20 Jul 2015) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Check and output additional mpfr_buildopt_* info. +------------------------------------------------------------------------ +r9629 | vlefevre | 2015-07-20 15:59:51 +0000 (Mon, 20 Jul 2015) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + M /trunk/src/mpfr.h + M /trunk/src/rint.c + M /trunk/tests/trint.c + +Added mpfr_rint_roundeven and mpfr_roundeven functions, with +documentation and tests. +------------------------------------------------------------------------ +r9619 | vlefevre | 2015-07-16 12:43:22 +0000 (Thu, 16 Jul 2015) | 5 lines +Changed paths: + M /trunk/tests/tfrexp.c + +[tests/tfrexp.c] + * Replaced each mpfr_get_exp occurrence by the internal MPFR_GET_EXP + macro in order to make sure that an assertion failure is triggered + in case of singular number (see also the comment added in r9618). + * Fixed the remaining problem due to an overflow and infinite value. +------------------------------------------------------------------------ +r9618 | vlefevre | 2015-07-16 12:32:33 +0000 (Thu, 16 Jul 2015) | 2 lines +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Added a comment about the drawback of the mpfr_get_exp() +macro, defined in addition to the function. +------------------------------------------------------------------------ +r9617 | vlefevre | 2015-07-15 14:22:19 +0000 (Wed, 15 Jul 2015) | 2 lines +Changed paths: + M /trunk/tests/tfrexp.c + +[tests/tfrexp.c] Simplification: merged the tests on the ternary values, +the returned MPFR values and the flags. +------------------------------------------------------------------------ +r9616 | vlefevre | 2015-07-15 14:17:12 +0000 (Wed, 15 Jul 2015) | 4 lines +Changed paths: + M /trunk/src/div_2si.c + M /trunk/src/div_2ui.c + M /trunk/src/mul_2si.c + +[src/{div_2si.c,div_2ui.c,mul_2si.c}] Fixed some underflow cases in +rounding to nearest when the exact result is -2^(emin-2), i.e. the +middle of 0 and the minimum negative number in absolute value (the +correction in r5517 was incorrect/incomplete). +------------------------------------------------------------------------ +r9615 | vlefevre | 2015-07-15 13:48:37 +0000 (Wed, 15 Jul 2015) | 1 line +Changed paths: + M /trunk/src/exceptions.c + +[src/exceptions.c] Added logging for mpfr_underflow and mpfr_overflow. +------------------------------------------------------------------------ +r9614 | vlefevre | 2015-07-15 13:35:53 +0000 (Wed, 15 Jul 2015) | 2 lines +Changed paths: + M /trunk/tests/tmul_2exp.c + +[tests/tmul_2exp.c] Extended the underflow() test to negative numbers, +triggering a new bug. +------------------------------------------------------------------------ +r9613 | vlefevre | 2015-07-15 08:24:21 +0000 (Wed, 15 Jul 2015) | 1 line +Changed paths: + M /trunk/src/frexp.c + +[src/frexp.c] Added a comment. +------------------------------------------------------------------------ +r9609 | vlefevre | 2015-07-02 10:45:20 +0000 (Thu, 02 Jul 2015) | 3 lines +Changed paths: + M /trunk/tools/build-patch + +[tools/build-patch] Rebuild the mpfr.info file if mpfr.texi has been +modified, in order to take it into account in the patch. This is needed +since the mpfr.info file is distributed in the tarball. +------------------------------------------------------------------------ +r9604 | vlefevre | 2015-07-02 00:17:00 +0000 (Thu, 02 Jul 2015) | 3 lines +Changed paths: + M /trunk + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Check a Texinfo rule (Section "Ending a Sentence") +with common words that end with a capital letter. +(merged changeset r9603 from the 3.1 branch) +------------------------------------------------------------------------ +r9601 | vlefevre | 2015-06-28 09:28:30 +0000 (Sun, 28 Jun 2015) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Updated URL of TS 18661-4. +------------------------------------------------------------------------ +r9600 | vlefevre | 2015-06-26 13:59:12 +0000 (Fri, 26 Jun 2015) | 1 line +Changed paths: + M /trunk/src/frexp.c + +[src/frexp.c] Handle internal overflow. +------------------------------------------------------------------------ +r9599 | vlefevre | 2015-06-26 13:46:55 +0000 (Fri, 26 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tfrexp.c + +[tests/tfrexp.c] Forgot a "exit (1);". +------------------------------------------------------------------------ +r9598 | vlefevre | 2015-06-26 08:06:17 +0000 (Fri, 26 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tmul_2exp.c + +[tests/tmul_2exp.c] Overflow test: more output info; improved code. +------------------------------------------------------------------------ +r9597 | vlefevre | 2015-06-26 07:57:49 +0000 (Fri, 26 Jun 2015) | 3 lines +Changed paths: + M /trunk/src/mul_2si.c + M /trunk/tests/tmul_2exp.c + +[src/mul_2si.c] Fixed overflow case when n = 0. +[tests/tmul_2exp.c] In the overflow test, check mpfr_mul_2ui and +mpfr_mul_2si too (mpfr_mul_2ui was OK). +------------------------------------------------------------------------ +r9596 | vlefevre | 2015-06-26 07:42:49 +0000 (Fri, 26 Jun 2015) | 2 lines +Changed paths: + M /trunk/src/div_2si.c + M /trunk/tests/tmul_2exp.c + +[src/div_2si.c] Fixed overflow case when n = 0. +[tests/tmul_2exp.c] In the overflow test, check mpfr_div_2si too. +------------------------------------------------------------------------ +r9595 | vlefevre | 2015-06-26 07:28:10 +0000 (Fri, 26 Jun 2015) | 2 lines +Changed paths: + M /trunk/src/div_2ui.c + M /trunk/tests/tmul_2exp.c + +[src/div_2ui.c] Fixed overflow case (can occur only when n = 0). +[tests/tmul_2exp.c] Completed the overflow test. +------------------------------------------------------------------------ +r9594 | vlefevre | 2015-06-26 00:33:56 +0000 (Fri, 26 Jun 2015) | 2 lines +Changed paths: + M /trunk/tests/tfrexp.c + +[tests/tfrexp.c] Added tests (currently fail due to the mpfr_div_2ui +unhandled-overflow bug). +------------------------------------------------------------------------ +r9593 | vlefevre | 2015-06-26 00:23:19 +0000 (Fri, 26 Jun 2015) | 2 lines +Changed paths: + M /trunk/tests/tmul_2exp.c + +[tests/tmul_2exp.c] Added tests where mpfr_div_2ui overflows, which +is currently not handled. +------------------------------------------------------------------------ +r9592 | vlefevre | 2015-06-26 00:00:58 +0000 (Fri, 26 Jun 2015) | 2 lines +Changed paths: + M /trunk/src/frexp.c + +[src/frexp.c] Fixed a bug occurring when the current exponent range +does not contain 0. +------------------------------------------------------------------------ +r9591 | vlefevre | 2015-06-25 21:33:30 +0000 (Thu, 25 Jun 2015) | 1 line +Changed paths: + M /trunk/src/check.c + +[src/check.c] Typo in a comment. +------------------------------------------------------------------------ +r9588 | vlefevre | 2015-06-19 22:57:07 +0000 (Fri, 19 Jun 2015) | 1 line +Changed paths: + M /trunk/tools/announce-text + +[tools/announce-text] Update due to recent InriaForge upgrade. +------------------------------------------------------------------------ +r9581 | vlefevre | 2015-06-16 15:38:37 +0000 (Tue, 16 Jun 2015) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added a paragraph about the multiple use of MPFR. +------------------------------------------------------------------------ +r9580 | vlefevre | 2015-06-16 15:08:45 +0000 (Tue, 16 Jun 2015) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Added: use symbol versioning. +------------------------------------------------------------------------ +r9575 | vlefevre | 2015-06-12 15:30:27 +0000 (Fri, 12 Jun 2015) | 3 lines +Changed paths: + M /trunk/doc/faq.xsl + +[doc/faq.xsl] Remove the indent="no" to get the same behavior as before +when using libxslt 1.1.27+. See: + http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718535#10 +------------------------------------------------------------------------ +r9572 | vlefevre | 2015-06-12 13:55:51 +0000 (Fri, 12 Jun 2015) | 2 lines +Changed paths: + M /trunk/tests/tfma.c + +[tests/tfma.c] Improved the new underflow tests (test_underflow3) to +test FMA(-x,y,-z). +------------------------------------------------------------------------ +r9569 | vlefevre | 2015-06-12 13:27:00 +0000 (Fri, 12 Jun 2015) | 1 line +Changed paths: + M /trunk/src/fma.c + +[src/fma.c] Completely fixed the scaling in case of underflow. +------------------------------------------------------------------------ +r9568 | vlefevre | 2015-06-12 01:00:03 +0000 (Fri, 12 Jun 2015) | 3 lines +Changed paths: + M /trunk/src/fma.c + +[src/fma.c] Partially fixed the scaling in case of underflow, +corresponding to the testcase from r9566. Double rounding is +not handled yet (failure triggered by r9567). +------------------------------------------------------------------------ +r9567 | vlefevre | 2015-06-12 00:55:09 +0000 (Fri, 12 Jun 2015) | 5 lines +Changed paths: + M /trunk/tests/tfma.c + +[tests/tfma.c] Improved the new underflow tests (test_underflow3) to +yield some cases with double rounding when scaling: If the only fix +in src/fma.c is to change the rounding mode of the last mpfr_div_2ui +(computing s / 2^scale) to rnd_mode, a new failure appears for n = 2, +k = 4, s = -1, MPFR_RNDN. +------------------------------------------------------------------------ +r9566 | vlefevre | 2015-06-12 00:25:11 +0000 (Fri, 12 Jun 2015) | 2 lines +Changed paths: + M /trunk/tests/tfma.c + +[tests/tfma.c] Corrected the new underflow tests to really generate +underflows, showing a bug in mpfr_fma. +------------------------------------------------------------------------ +r9565 | vlefevre | 2015-06-12 00:10:19 +0000 (Fri, 12 Jun 2015) | 1 line +Changed paths: + M /trunk/src/fma.c + +[src/fma.c] Added log messages. +------------------------------------------------------------------------ +r9564 | vlefevre | 2015-06-12 00:09:18 +0000 (Fri, 12 Jun 2015) | 2 lines +Changed paths: + M /trunk/tests/tfma.c + +[tests/tfma.c] The code removed in r9560 was actually necessary, +but do this in a better way. +------------------------------------------------------------------------ +r9563 | vlefevre | 2015-06-11 23:51:48 +0000 (Thu, 11 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tfma.c + +[tests/tfma.c] Added other underflow tests. +------------------------------------------------------------------------ +r9562 | vlefevre | 2015-06-11 23:13:22 +0000 (Thu, 11 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tfma.c + +[tests/tfma.c] Some improvements. +------------------------------------------------------------------------ +r9561 | vlefevre | 2015-06-11 23:08:40 +0000 (Thu, 11 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tfma.c + +[tests/tfma.c] GNU coding style. +------------------------------------------------------------------------ +r9560 | vlefevre | 2015-06-11 23:05:51 +0000 (Thu, 11 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tfma.c + +[tests/tfma.c] Removed code that isn't necessary. +------------------------------------------------------------------------ +r9557 | vlefevre | 2015-06-11 08:48:04 +0000 (Thu, 11 Jun 2015) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] "To make a release": mention -DMPFR_COV_CHECK and +-DMPFR_ALLOCA_MAX=0 tests. +------------------------------------------------------------------------ +r9553 | vlefevre | 2015-06-10 23:46:47 +0000 (Wed, 10 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/trandom.c + +[tests/trandom.c] Cleaner test, avoiding the explicit use of mpfr_rands. +------------------------------------------------------------------------ +r9551 | vlefevre | 2015-06-10 14:25:57 +0000 (Wed, 10 Jun 2015) | 3 lines +Changed paths: + M /trunk/tests/trandom.c + +[tests/trandom.c] Improved latest change, as some other test already +assume a fixed PRNG with GMP >= 4.2.0 (now the value of the last +random number of the test is checked). +------------------------------------------------------------------------ +r9550 | vlefevre | 2015-06-10 13:59:09 +0000 (Wed, 10 Jun 2015) | 7 lines +Changed paths: + M /trunk/tests/trandom.c + +[tests/trandom.c] + * Get a non-zero fixed-point number whose first 32 bits are 0 with the + default GMP PRNG. This corresponds to the case cnt == 0 && k != 0 in + src/urandomb.c (fixed in r8762) with the 32-bit ABI. + * Output a warning (with a fatal error when the MPFR_COV_CHECK macro + is defined) if one doesn't get such a number, probably because the + GMP PRNG has changed. +------------------------------------------------------------------------ +r9545 | vlefevre | 2015-06-10 10:25:56 +0000 (Wed, 10 Jun 2015) | 4 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] The bug fixed in r9540 actually came from r9014, which +incorrectly replaced MPFR_EXP by MPFR_SET_EXP. So, restored the +previous code (re-adding the assertion check), keeping my comment +from r9540 to explain why we don't use MPFR_SET_EXP. +------------------------------------------------------------------------ +r9544 | vlefevre | 2015-06-10 09:21:02 +0000 (Wed, 10 Jun 2015) | 5 lines +Changed paths: + M /trunk/tests/tgeneric.c + +[tests/tgeneric.c] Fixed overflow/underflow tests introduced in r9539: +the tests were done in all rounding modes, but the code was incorrect +if the exponent of the result depended on the rounding mode. So, the +tests are now done only in the rounding mode previously selected. This +should be sufficient to detect bugs. +------------------------------------------------------------------------ +r9543 | vlefevre | 2015-06-10 08:48:24 +0000 (Wed, 10 Jun 2015) | 3 lines +Changed paths: + M /trunk/src/lngamma.c + +[src/lngamma.c] For mpfr_lgamma and mpfr_lngamma, the exponent range +was not restored in some cases (some large results). Bug introduced +in r8917 (trunk only). +------------------------------------------------------------------------ +r9542 | vlefevre | 2015-06-10 08:30:07 +0000 (Wed, 10 Jun 2015) | 9 lines +Changed paths: + M /trunk/src/cos.c + M /trunk/src/sin.c + +[src/{cos.c,sin.c}] Fixed bug related to the exponent range, introduced +in r6461 with the use of mpfr_sincos_fast. +Details: + For mpfr_sin, the exponent range was not restored, and restoring it + before calling mpfr_sincos_fast as this was done for mpfr_cos did + not work; indeed the source of this function shows that it needs an + extended exponent range. So, changed both mpfr_cos and mpfr_sin to + call mpfr_sincos_fast in the extended exponent range and restore the + exponent range at the end, like in usual code. +------------------------------------------------------------------------ +r9541 | vlefevre | 2015-06-10 08:14:01 +0000 (Wed, 10 Jun 2015) | 3 lines +Changed paths: + M /trunk/tests/tgeneric.c + +[tests/tgeneric.c] Check whether the exponent range has been +modified by the tested function (which should never happen). +This check triggers failures in tlgamma, tlngamma and tsin. +------------------------------------------------------------------------ +r9540 | vlefevre | 2015-06-10 07:50:21 +0000 (Wed, 10 Jun 2015) | 3 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Fixed assertion failure in reduced exponent range. +Note: This could happen only in very specific exponent ranges, +in particular, which do not include the number 1. +------------------------------------------------------------------------ +r9539 | vlefevre | 2015-06-10 07:38:24 +0000 (Wed, 10 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tgeneric.c + +[tests/tgeneric.c] Added overflow/underflow tests (→ 4 failed tests). +------------------------------------------------------------------------ +r9523 | vlefevre | 2015-06-08 00:46:52 +0000 (Mon, 08 Jun 2015) | 4 lines +Changed paths: + M /trunk/src/zeta_ui.c + M /trunk/tests/tzeta_ui.c + +[src/zeta_ui.c] + * Support reduced exponent range for the generic case. + * Added logging. +[tests/tzeta_ui.c] Added tests in reduced exponent range. +------------------------------------------------------------------------ +r9521 | vlefevre | 2015-06-08 00:27:37 +0000 (Mon, 08 Jun 2015) | 1 line +Changed paths: + M /trunk/src/add_ui.c + +[src/add_ui.c] Fixed format string in MPFR_LOG_FUNC. +------------------------------------------------------------------------ +r9520 | vlefevre | 2015-06-07 22:17:00 +0000 (Sun, 07 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tzeta_ui.c + +[tests/tzeta_ui.c] Code simplification. +------------------------------------------------------------------------ +r9519 | vlefevre | 2015-06-07 22:11:52 +0000 (Sun, 07 Jun 2015) | 2 lines +Changed paths: + M /trunk/tests/tzeta_ui.c + +[tests/tzeta_ui.c] Test zeta(0) in reduced exponent range and all +rounding modes. +------------------------------------------------------------------------ +r9518 | vlefevre | 2015-06-07 21:54:01 +0000 (Sun, 07 Jun 2015) | 2 lines +Changed paths: + M /trunk/src/zeta_ui.c + M /trunk/tests/tzeta_ui.c + +[src/zeta_ui.c] Fixed zeta(0) in reduced exponent range. +[tests/tzeta_ui.c] Added testcase. +------------------------------------------------------------------------ +r9514 | vlefevre | 2015-06-05 01:30:20 +0000 (Fri, 05 Jun 2015) | 1 line +Changed paths: + M /trunk/src/ui_div.c + M /trunk/src/ui_sub.c + +[src/{ui_div.c,ui_sub.c}] Correction for reduced exponent range. +------------------------------------------------------------------------ +r9513 | vlefevre | 2015-06-05 01:21:49 +0000 (Fri, 05 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tui_sub.c + +[tests/tui_sub.c] Check overflow. +------------------------------------------------------------------------ +r9512 | vlefevre | 2015-06-05 01:07:43 +0000 (Fri, 05 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tui_div.c + +[tests/tui_div.c] Check overflow. +------------------------------------------------------------------------ +r9511 | vlefevre | 2015-06-05 00:29:07 +0000 (Fri, 05 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tgeneric.c + +[tests/tgeneric.c] Removed useless parentheses. +------------------------------------------------------------------------ +r9510 | vlefevre | 2015-06-05 00:22:02 +0000 (Fri, 05 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tgeneric.c + +[tests/tgeneric.c] Special cases with unsigned long argument. +------------------------------------------------------------------------ +r9509 | vlefevre | 2015-06-05 00:13:04 +0000 (Fri, 05 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tpow_all.c + +[tests/tpow_all.c] Better flags output in error message. +------------------------------------------------------------------------ +r9508 | vlefevre | 2015-06-04 13:27:07 +0000 (Thu, 04 Jun 2015) | 2 lines +Changed paths: + M /trunk/src/set_q.c + +[src/set_q.c] Added missing MPFR_SAVE_EXPO_FREE in case of preliminary +overflow or underflow (extreme cases). +------------------------------------------------------------------------ +r9507 | vlefevre | 2015-06-04 13:23:35 +0000 (Thu, 04 Jun 2015) | 2 lines +Changed paths: + M /trunk/src/set_q.c + +[src/set_q.c] Replaced a "return" by MPFR_RET: this is at least needed +in the extreme case cd != 0, and safer in general. +------------------------------------------------------------------------ +r9506 | vlefevre | 2015-06-04 13:20:10 +0000 (Thu, 04 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tset_q.c + +[tests/tset_q.c] Check the flags. +------------------------------------------------------------------------ +r9505 | vlefevre | 2015-06-04 11:19:31 +0000 (Thu, 04 Jun 2015) | 1 line +Changed paths: + M /trunk/src/mul_ui.c + +[src/mul_ui.c] Fixed bug in mpfr_mul_ui/si: the inexact flag wasn't set. +------------------------------------------------------------------------ +r9504 | vlefevre | 2015-06-04 11:17:52 +0000 (Thu, 04 Jun 2015) | 2 lines +Changed paths: + M /trunk/tests/tadd_ui.c + M /trunk/tests/tdiv_ui.c + M /trunk/tests/tmul_ui.c + M /trunk/tests/tsub_ui.c + +[tests/t{add,div,mul,sub}_ui.c] Replaced tgeneric_ui.c by tgeneric.c, +showing a bug in mpfr_mul_ui (missing inexact flag). +------------------------------------------------------------------------ +r9503 | vlefevre | 2015-06-04 11:02:39 +0000 (Thu, 04 Jun 2015) | 2 lines +Changed paths: + M /trunk/tests/tui_div.c + M /trunk/tests/tui_sub.c + +[tests/{tui_div.c,tui_sub.c}] Added generic tests, yielding assertion +failures (due to a reduced exponent range) when assertions are checked. +------------------------------------------------------------------------ +r9502 | vlefevre | 2015-06-04 10:50:16 +0000 (Thu, 04 Jun 2015) | 4 lines +Changed paths: + M /trunk/tests/tgeneric.c + +[tests/tgeneric.c] Major clean-up, with some minor corrections. +Added support for unsigned long argument, which can be the first +or the second one (another intent is to replace tgeneric_ui.c, +which does fewer tests concerning the flags). +------------------------------------------------------------------------ +r9500 | vlefevre | 2015-06-04 10:08:05 +0000 (Thu, 04 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tdiv_d.c + +[tests/tdiv_d.c] Corrected the tested function for the generic tests. +------------------------------------------------------------------------ +r9498 | vlefevre | 2015-06-04 10:03:18 +0000 (Thu, 04 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/td_div.c + +[tests/td_div.c] Corrected the tested function for the generic tests. +------------------------------------------------------------------------ +r9497 | vlefevre | 2015-06-04 02:17:10 +0000 (Thu, 04 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tui_sub.c + +[tests/tui_sub.c] Minor improvements. +------------------------------------------------------------------------ +r9495 | vlefevre | 2015-06-04 02:03:41 +0000 (Thu, 04 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tgeneric_ui.c + +[tests/tgeneric_ui.c] Added missing \n. Minor improvements. +------------------------------------------------------------------------ +r9494 | vlefevre | 2015-06-04 01:58:27 +0000 (Thu, 04 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/tui_div.c + +[tests/tui_div.c] Minor improvements. +------------------------------------------------------------------------ +r9492 | vlefevre | 2015-06-03 14:23:00 +0000 (Wed, 03 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/trint.c + +[tests/trint.c] Corrected the description (copy-paste error in r9473). +------------------------------------------------------------------------ +r9489 | vlefevre | 2015-06-03 12:03:05 +0000 (Wed, 03 Jun 2015) | 1 line +Changed paths: + M /trunk/src/rint.c + +[src/rint.c] Handle reduced exponent range. +------------------------------------------------------------------------ +r9488 | vlefevre | 2015-06-03 11:48:05 +0000 (Wed, 03 Jun 2015) | 2 lines +Changed paths: + M /trunk/tests/trint.c + +[tests/trint.c] Extend basic_tests from [56,72] to [1,72] since i < 4 +(|x| < 1) are special cases in the implementation. +------------------------------------------------------------------------ +r9487 | vlefevre | 2015-06-03 11:40:21 +0000 (Wed, 03 Jun 2015) | 2 lines +Changed paths: + M /trunk/tests/trint.c + +[tests/trint.c] Also run BASIC_TEST in reduced exponent range +(emin = emax = EXP(x)). +------------------------------------------------------------------------ +r9486 | vlefevre | 2015-06-03 11:30:39 +0000 (Wed, 03 Jun 2015) | 2 lines +Changed paths: + M /trunk/tests/trint.c + +[tests/trint.c] Also run BASIC_TEST2 in reduced exponent range +(emin = emax = EXP(x)). +------------------------------------------------------------------------ +r9485 | vlefevre | 2015-06-03 00:45:28 +0000 (Wed, 03 Jun 2015) | 1 line +Changed paths: + M /trunk/src/rint.c + +[src/rint.c] Added a comment about the mpfr_rint_* functions. +------------------------------------------------------------------------ +r9484 | vlefevre | 2015-06-03 00:32:23 +0000 (Wed, 03 Jun 2015) | 4 lines +Changed paths: + M /trunk/src/rint.c + +[src/rint.c] Simplified and fixed the mpfr_rint_* functions: in some +corner cases, an intermediate overflow would not be propagated. No +testcases added for this particular problem since huge precision +numbers would be involved. +------------------------------------------------------------------------ +r9482 | vlefevre | 2015-06-02 11:39:37 +0000 (Tue, 02 Jun 2015) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added description of the flags for the mpfr_rint, +mpfr_ceil, mpfr_floor, mpfr_round, mpfr_trunc functions. +------------------------------------------------------------------------ +r9481 | vlefevre | 2015-06-01 13:44:02 +0000 (Mon, 01 Jun 2015) | 1 line +Changed paths: + M /trunk/tests/trint.c + +[tests/trint.c] In the basic tests, test the flags. +------------------------------------------------------------------------ +r9480 | vlefevre | 2015-05-31 09:58:46 +0000 (Sun, 31 May 2015) | 1 line +Changed paths: + M /trunk/tests/trint.c + +[tests/trint.c] Corrections for r9476 and r9477. +------------------------------------------------------------------------ +r9478 | vlefevre | 2015-05-31 09:46:50 +0000 (Sun, 31 May 2015) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] For the gcc compiler, better choice of the -W flags +when the selected language is C++ (e.g. when CC=g++). +------------------------------------------------------------------------ +r9477 | vlefevre | 2015-05-29 15:22:19 +0000 (Fri, 29 May 2015) | 2 lines +Changed paths: + M /trunk/tests/trint.c + +[tests/trint.c] Added basic tests of the mpfr_{trunc,floor,ceil,round} +functions. +------------------------------------------------------------------------ +r9476 | vlefevre | 2015-05-29 11:26:20 +0000 (Fri, 29 May 2015) | 1 line +Changed paths: + M /trunk/tests/trint.c + +[tests/trint.c] Added basic tests of the mpfr_rint_* functions. +------------------------------------------------------------------------ +r9474 | vlefevre | 2015-05-29 11:18:57 +0000 (Fri, 29 May 2015) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added blank lines to improve readability. +------------------------------------------------------------------------ +r9473 | vlefevre | 2015-05-29 10:26:25 +0000 (Fri, 29 May 2015) | 2 lines +Changed paths: + M /trunk/tests/trint.c + +[tests/trint.c] Updated the description (test_generic_round is now +tested, which wasn't done at all before). +------------------------------------------------------------------------ +r9472 | vlefevre | 2015-05-29 10:24:17 +0000 (Fri, 29 May 2015) | 6 lines +Changed paths: + M /trunk/tests/trint.c + +[tests/trint.c] Added generic tests for the mpfr_rint_* functions. +Since all numbers in ]0,1/2[ round to the same value, in order to +avoid redundant tests, increased the TEST_RANDOM_EMIN value to -20 +and set TEST_RANDOM_ALWAYS_SCALE to 1. +Note: only these new tests generate an error if the change of the +exponent range is no longer done in these mpfr_rint_* functions. +------------------------------------------------------------------------ +r9471 | vlefevre | 2015-05-29 10:19:18 +0000 (Fri, 29 May 2015) | 10 lines +Changed paths: + M /trunk/tests/mpfr-test.h + M /trunk/tests/tests.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tgeneric.c + M /trunk/tests/tprintf.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tsum.c + +[tests] Added always_scale argument (boolean) to tests_default_random() +so that when it is true, scaling is always performed on random numbers +generated by mpfr_urandomb(), instead of preferring numbers of the order +of magnitude of 1 for half outputs. This will be useful for mpfr_rint_* +tests. + +For tgeneric.c, the value of this argument is controlled by a new macro +TEST_RANDOM_ALWAYS_SCALE (0 by default, which corresponds to the current +behavior). For the other tests that call tests_default_random(), the +argument is set to 0, so that the behavior remains the same. +------------------------------------------------------------------------ +r9469 | vlefevre | 2015-05-29 08:54:33 +0000 (Fri, 29 May 2015) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added a remark concerning the mpfr_rint_* functions. +------------------------------------------------------------------------ +r9466 | vlefevre | 2015-05-28 11:11:31 +0000 (Thu, 28 May 2015) | 8 lines +Changed paths: + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + +[src] Fixed allocation issue for multithreaded applications: +https://sympa.inria.fr/sympa/arc/mpfr/2015-05/msg00001.html + * mpfr-gmp.{c,h}: made mpfr_allocate_func, mpfr_reallocate_func and + mpfr_free_func thread-local; updated MPFR_GET_MEMFUNC to execute + mp_get_memory_functions only when these pointers have not been set + to the actual function pointers yet. + * mpfr-impl.h: #include "mpfr-thread.h" earlier (before mpfr-gmp.h, + where MPFR_THREAD_ATTR is now used). +------------------------------------------------------------------------ +r9461 | vlefevre | 2015-05-25 17:59:11 +0000 (Mon, 25 May 2015) | 4 lines +Changed paths: + M /trunk/src/mpfr-gmp.c + +[src/mpfr-gmp.c] Replaced mpfr_allocate_func and mpfr_free_func +by __gmp_allocate_func and __gmp_free_func in mpfr_tmp_allocate +and mpfr_tmp_free respectively, fixing the crash in talloc. +See: https://sympa.inria.fr/sympa/arc/mpfr/2015-05/msg00001.html +------------------------------------------------------------------------ +r9460 | vlefevre | 2015-05-25 17:07:27 +0000 (Mon, 25 May 2015) | 2 lines +Changed paths: + M /trunk/tests/talloc.c + +[tests/talloc.c] Avoid a failure with --with-gmp-build due to the fact +that the MPFR_ALLOCA_MAX macro is not defined in this case. +------------------------------------------------------------------------ +r9459 | vlefevre | 2015-05-23 23:56:17 +0000 (Sat, 23 May 2015) | 4 lines +Changed paths: + M /trunk/doc/README.dev + A /trunk/libtool-tcc-rpath.patch + +Added libtool-tcc-rpath.patch from + https://lists.gnu.org/archive/html/libtool-patches/2015-05/msg00000.html +so that tcc can be used with libtool 2.4.3 to 2.4.6. +In doc/README.dev, documented how to use this patch (before a release). +------------------------------------------------------------------------ +r9457 | vlefevre | 2015-05-23 23:37:14 +0000 (Sat, 23 May 2015) | 1 line +Changed paths: + M /trunk/src/erandom.c + M /trunk/src/fpif.c + M /trunk/src/frexp.c + M /trunk/src/get_float128.c + +Added svn:keywords on some .c files for consistency. +------------------------------------------------------------------------ +r9456 | vlefevre | 2015-05-23 23:35:29 +0000 (Sat, 23 May 2015) | 1 line +Changed paths: + M /trunk/tests/terandom_chisq.c + M /trunk/tests/tnrandom_chisq.c + M /trunk/tests/tvalist.c + +Removed the few svn:mime-type properties on .c files for consistency. +------------------------------------------------------------------------ +r9455 | vlefevre | 2015-05-23 23:32:46 +0000 (Sat, 23 May 2015) | 7 lines +Changed paths: + M /trunk/tests + M /trunk/tests/Makefile.am + A /trunk/tests/talloc.c + +[tests] Added talloc.c and updated check_PROGRAMS in Makefile.am. +This test detects an allocation bug added in r8813, which occurs +if mpfr_tmp_allocate() is invoked before __gmp_allocate_func when +the GMP build is not used (thus this bug is not visible in most +code since mpfr_init2 is generally called first, directly or not, +and it uses __gmp_allocate_func). Details: + https://sympa.inria.fr/sympa/arc/mpfr/2015-05/msg00001.html +------------------------------------------------------------------------ +r9453 | vlefevre | 2015-05-23 23:06:07 +0000 (Sat, 23 May 2015) | 3 lines +Changed paths: + M /trunk/tests/tstdint.c + M /trunk/tests/tvalist.c + +[tests/{tstdint.c,tvalist.c}] Added missing #include "mpfr-test.h" +(detected with gcc -Werror=implicit-function-declaration), needed +since r9447. +------------------------------------------------------------------------ +r9451 | vlefevre | 2015-05-22 18:15:24 +0000 (Fri, 22 May 2015) | 1 line +Changed paths: + M /trunk/src/mpfr-gmp.c + +[src/mpfr-gmp.c] Code formatting. +------------------------------------------------------------------------ +r9450 | vlefevre | 2015-05-22 17:56:53 +0000 (Fri, 22 May 2015) | 1 line +Changed paths: + M /trunk/tests/tstckintc.c + +[tests/tstckintc.c] Fixed undefined behavior (invalid pointer). +------------------------------------------------------------------------ +r9449 | vlefevre | 2015-05-22 17:50:09 +0000 (Fri, 22 May 2015) | 2 lines +Changed paths: + M /trunk/doc/README.dev + M /trunk/src/mpfr-gmp.h + +Define MPFR_ALLOCA_MAX macro: Maximum size for the use of alloca by +temporary allocations (default: 16384). +------------------------------------------------------------------------ +r9447 | vlefevre | 2015-05-22 09:21:21 +0000 (Fri, 22 May 2015) | 2 lines +Changed paths: + M /trunk/tests/tstdint.c + M /trunk/tests/tvalist.c + +[tests/{tstdint.c,tvalist.c}] Use tests_start_mpfr / tests_end_mpfr, +in particular to detect a wrong MPFR version (due to a libtool bug). +------------------------------------------------------------------------ +r9445 | vlefevre | 2015-05-21 15:08:10 +0000 (Thu, 21 May 2015) | 2 lines +Changed paths: + M /trunk/autogen.sh + +[autogen.sh] Exit with the exit status of autoreconf. Thus a failure +will be noticed more easily. +------------------------------------------------------------------------ +r9443 | vlefevre | 2015-05-21 14:12:33 +0000 (Thu, 21 May 2015) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Update. +------------------------------------------------------------------------ +r9440 | vlefevre | 2015-05-21 11:49:48 +0000 (Thu, 21 May 2015) | 3 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Added a comment about memmove and memset being considered +to be missing when gcc -Werror is used, because of a "conflicting types +for built-in function" error. +------------------------------------------------------------------------ +r9438 | vlefevre | 2015-05-21 11:10:09 +0000 (Thu, 21 May 2015) | 5 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Various corrections in the tests: + * MPFR_CHECK_MP_LIMB_T_VS_LONG was always failing due to a typo. + * MPFR_FUNC_GMP_PRINTF_SPEC: missing #include for strcmp. + * Replaced rint by nearbyint in messages (as nearbyint is tested). + * Avoid warnings to avoid failures when -Werror is used. +------------------------------------------------------------------------ +r9416 | vlefevre | 2015-05-20 15:42:02 +0000 (Wed, 20 May 2015) | 2 lines +Changed paths: + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + M /trunk/tests/tget_d.c + +[tests/{tcmp_d.c,tcmp_ld.c,tget_d.c}] Avoid warnings concerning unused +variables when MPFR_ERRDIVZERO is defined (useful with -Werror). +------------------------------------------------------------------------ +r9415 | vlefevre | 2015-05-20 15:30:46 +0000 (Wed, 20 May 2015) | 2 lines +Changed paths: + M /trunk/tests/tests.c + +[tests/tests.c] Avoid a warning concerning an unused variable +when HAVE_DENORMS is not defined (useful with -Werror). +------------------------------------------------------------------------ +r9402 | vlefevre | 2015-05-19 15:37:15 +0000 (Tue, 19 May 2015) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Improved mpfr_swap description again. +------------------------------------------------------------------------ +r9401 | vlefevre | 2015-05-19 15:19:52 +0000 (Tue, 19 May 2015) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Correction and improvements in the formatting. +------------------------------------------------------------------------ +r9400 | vlefevre | 2015-05-19 14:31:45 +0000 (Tue, 19 May 2015) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added a warning for mpfr_set_prec and mpfr_prec_round +about allocation issue, as these functions change the precision of x. +------------------------------------------------------------------------ +r9399 | vlefevre | 2015-05-19 13:59:35 +0000 (Tue, 19 May 2015) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Typo in the latest change. +------------------------------------------------------------------------ +r9398 | vlefevre | 2015-05-19 13:53:33 +0000 (Tue, 19 May 2015) | 3 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Rewrote the mpfr_swap description. This should solve +the documentation issue reported on: + https://gforge.inria.fr/tracker/index.php?func=detail&aid=18954&group_id=136&atid=619 +------------------------------------------------------------------------ +r9396 | vlefevre | 2015-05-18 13:02:23 +0000 (Mon, 18 May 2015) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Update (preliminary steps). +------------------------------------------------------------------------ +r9393 | vlefevre | 2015-05-13 13:39:37 +0000 (Wed, 13 May 2015) | 1 line +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] Started the rewrite of the doc. +------------------------------------------------------------------------ +r9392 | vlefevre | 2015-05-06 10:21:19 +0000 (Wed, 06 May 2015) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Update concerning mpfr_sum. +------------------------------------------------------------------------ +r9391 | vlefevre | 2015-05-06 10:20:37 +0000 (Wed, 06 May 2015) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Update concerning mpfr_sum. +------------------------------------------------------------------------ +r9390 | vlefevre | 2015-05-06 09:08:08 +0000 (Wed, 06 May 2015) | 3 lines +Changed paths: + M /trunk/doc/sum.txt + +[doc/sum.txt] The specification of the sign of a zero result only +applies to an exact zero, of course (for an inexact zero result, +the usual rule of the rounding mode is applied). +------------------------------------------------------------------------ +r9388 | vlefevre | 2015-05-06 07:18:49 +0000 (Wed, 06 May 2015) | 2 lines +Changed paths: + M /trunk/tests/terandom_chisq.c + M /trunk/tests/tnrandom_chisq.c + +[tests/t[ne]random_chisq.c] Fixed memory leak (detected by GCC's +AddressSanitizer). +------------------------------------------------------------------------ +r9387 | vlefevre | 2015-05-06 07:10:07 +0000 (Wed, 06 May 2015) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] "To make a release": Test with GCC's AddressSanitizer +(-fsanitize=address). +------------------------------------------------------------------------ +r9386 | vlefevre | 2015-05-06 07:09:05 +0000 (Wed, 06 May 2015) | 3 lines +Changed paths: + M /trunk/tests/tabort_defalloc1.c + M /trunk/tests/tabort_defalloc2.c + +[tests/tabort_defalloc*.c] Disable the tests if __SANITIZE_ADDRESS__ +is defined, i.e. when GCC's AddressSanitizer is used, because it +reports the error before GMP can do the abort. +------------------------------------------------------------------------ +r9385 | vlefevre | 2015-05-05 14:13:11 +0000 (Tue, 05 May 2015) | 7 lines +Changed paths: + M /trunk/tests/tests.c + +[tests/tests.c] Make tests_default_random() more intuitive, avoiding +automatic changes of the current exponent range in some cases: instead +of adding some random exponent in [emin,emax] to the exponent of the +random number x in ]0,1[, force this random exponent to be the one of +x, so that its exponent is guaranteed to be in [emin,emax]. This avoids +a failure in tsum due to the fact that the exponent range was changed +automatically (and not restored). +------------------------------------------------------------------------ +r9384 | vlefevre | 2015-05-05 13:35:16 +0000 (Tue, 05 May 2015) | 4 lines +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] In cancel(), increase the number of tests from 8 to 1000. +This is much more, but the test is fast compare to other ones so that +the running time increases by a few percents only. And this triggers a +new bug: the exponent range is not restored (on a 64-bit machine). +------------------------------------------------------------------------ +r9383 | vlefevre | 2015-05-05 13:19:14 +0000 (Tue, 05 May 2015) | 7 lines +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Changes in cancel(): + * The fail-test was x[n] > bound instead of |x[n]| > bound, so that + some failures could be missed. + * More output in case of failure. + * Handle underflow in the bound computation. This fixes an incorrect + failure due to a bound rounded toward zero instead of toward +inf + with GMP_CHECK_RANDOMIZE=1431478020 (found by the nightly tests). +------------------------------------------------------------------------ +r9382 | vlefevre | 2015-05-05 08:15:35 +0000 (Tue, 05 May 2015) | 3 lines +Changed paths: + M /trunk/tools/nightly-test + +[tools/nightly-test] Run "make check" with VERBOSE=1 in order to have +tests/test-suite.log output in case of failure, now that Automake 1.13+ +is used. +------------------------------------------------------------------------ +r9381 | vlefevre | 2015-04-28 09:32:11 +0000 (Tue, 28 Apr 2015) | 1 line +Changed paths: + M /trunk/doc/sum.txt + M /trunk/src/sum.c + +Added a TODO about mpfr_sum. +------------------------------------------------------------------------ +r9380 | vlefevre | 2015-04-24 09:49:21 +0000 (Fri, 24 Apr 2015) | 1 line +Changed paths: + M /trunk/configure.ac + +[configure.ac] Updated a comment about Automake 1.13. +------------------------------------------------------------------------ +r9379 | vlefevre | 2015-04-24 09:27:03 +0000 (Fri, 24 Apr 2015) | 1 line +Changed paths: + M /trunk/Makefile.am + +[Makefile.am] Updated comment about ACLOCAL_AMFLAGS. +------------------------------------------------------------------------ +r9378 | vlefevre | 2015-04-24 08:57:14 +0000 (Fri, 24 Apr 2015) | 2 lines +Changed paths: + M /trunk/TODO + +[TODO] Suggest to move some macro definitions from acinclude.m4 to the +m4 directory as suggested by the Automake manual. +------------------------------------------------------------------------ +r9376 | vlefevre | 2015-04-23 13:31:31 +0000 (Thu, 23 Apr 2015) | 3 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Grouped everything about the test suite near the end +of this file. Added information about how the test suite works since +the full Automake 1.13 support (r8821). +------------------------------------------------------------------------ +r9375 | vlefevre | 2015-04-23 11:39:17 +0000 (Thu, 23 Apr 2015) | 5 lines +Changed paths: + M /trunk/INSTALL + M /trunk/configure.ac + M /trunk/doc/mpfr.texi + +To take into account that Automake 1.13 or later will be used: + * doc/mpfr.texi, INSTALL: updates related to "make check". + * configure.ac: require Automake 1.13 since the documentation now + assumes that 1.13 or later is used (and because previous Automake + versions are no longer tested). +------------------------------------------------------------------------ +r9373 | vlefevre | 2015-04-10 11:07:47 +0000 (Fri, 10 Apr 2015) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Mention the complete rewrite of function mpfr_sum. +------------------------------------------------------------------------ +r9372 | vlefevre | 2015-04-10 09:17:51 +0000 (Fri, 10 Apr 2015) | 1 line +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Added a comment about the latest fixed bug. +------------------------------------------------------------------------ +r9370 | vlefevre | 2015-04-10 00:51:00 +0000 (Fri, 10 Apr 2015) | 9 lines +Changed paths: + M /trunk + M /trunk/doc/README.dev + A /trunk/doc/sum.txt (from /branches/new-sum/doc/sum.txt:9369) + M /trunk/src/mpfr-impl.h + M /trunk/src/sum.c + M /trunk/tests/tsum.c + +Merged the new-sum branch: + * New feature for developers in order to improve the testsuite: + value coverage checking (MPFR_COV_CHECK macro), allowing one + to check whether some combinations of values are tested. See + example of use in src/sum.c and tests/tsum.c files. + * src/sum.c: full rewrite of mpfr_sum. Note: the documentation + of the algorithm in doc/sum.txt is currently a bit obsolete. + * tests/tsum.c: many new tests, some of them specifically written + for the new algorithm and implementation. +------------------------------------------------------------------------ +r9346 | vlefevre | 2015-03-20 14:06:52 +0000 (Fri, 20 Mar 2015) | 1 line +Changed paths: + M /trunk/tools/ck-copyright-notice + +[tools/ck-copyright-notice] Bug fix and improvements. +------------------------------------------------------------------------ +r9345 | vlefevre | 2015-03-20 13:57:13 +0000 (Fri, 20 Mar 2015) | 1 line +Changed paths: + M /trunk/tools/ck-copyright-notice + +[tools/ck-copyright-notice] More checks. +------------------------------------------------------------------------ +r9333 | vlefevre | 2015-03-06 13:57:53 +0000 (Fri, 06 Mar 2015) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added information on how to do type punning +(something we already did, but with no justification yet). +------------------------------------------------------------------------ +r9328 | vlefevre | 2015-02-27 10:16:42 +0000 (Fri, 27 Feb 2015) | 2 lines +Changed paths: + M /trunk/src/sub1sp.c + +[src/sub1sp.c] Avoid an unnecessary mpn_lshift after an mpn_sub_1 when +the initial value was a power of two. +------------------------------------------------------------------------ +r9327 | vlefevre | 2015-02-27 10:01:18 +0000 (Fri, 27 Feb 2015) | 1 line +Changed paths: + M /trunk/src/next.c + +[src/next.c] Avoid an unnecessary loop when the exponent decreases. +------------------------------------------------------------------------ +r9306 | vlefevre | 2015-02-24 15:49:10 +0000 (Tue, 24 Feb 2015) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Added SAFE_DIFF macro (safe difference). +------------------------------------------------------------------------ +r9295 | vlefevre | 2015-02-21 15:26:49 +0000 (Sat, 21 Feb 2015) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Fixed and improved some sign-related macros +(some parentheses were missing). +------------------------------------------------------------------------ +r9287 | vlefevre | 2015-02-18 14:19:03 +0000 (Wed, 18 Feb 2015) | 2 lines +Changed paths: + M /trunk/doc/README.dev + M /trunk/src/logging.c + M /trunk/src/mpfr-impl.h + +Logging: the log stream is flushed after each log output when +the MPFR_LOG_FLUSH environment variable is set. +------------------------------------------------------------------------ +r9286 | vlefevre | 2015-02-18 13:54:57 +0000 (Wed, 18 Feb 2015) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +Factorized the logging macros by moving tests inside LOG_PRINT. +------------------------------------------------------------------------ +r9279 | vlefevre | 2015-02-13 08:50:28 +0000 (Fri, 13 Feb 2015) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r9278 | vlefevre | 2015-02-13 08:31:08 +0000 (Fri, 13 Feb 2015) | 5 lines +Changed paths: + M /trunk/BUGS + M /trunk/INSTALL + M /trunk/Makefile.am + M /trunk/NEWS + M /trunk/README + M /trunk/TODO + M /trunk/acinclude.m4 + M /trunk/configure.ac + M /trunk/doc/FAQ.html + M /trunk/doc/Makefile.am + M /trunk/doc/README.dev + M /trunk/doc/faq.xsl + M /trunk/doc/mpfr.texi + M /trunk/examples/divworst.c + M /trunk/examples/rndo-add.c + M /trunk/examples/sample.c + M /trunk/examples/version.c + M /trunk/src/Makefile.am + M /trunk/src/abort_prec_max.c + M /trunk/src/acos.c + M /trunk/src/acosh.c + M /trunk/src/add.c + M /trunk/src/add1.c + M /trunk/src/add1sp.c + M /trunk/src/add_d.c + M /trunk/src/add_ui.c + M /trunk/src/agm.c + M /trunk/src/ai.c + M /trunk/src/amd/amdfam10/mparam.h + M /trunk/src/amd/athlon/mparam.h + M /trunk/src/amd/k8/mparam.h + M /trunk/src/arm/mparam.h + M /trunk/src/asin.c + M /trunk/src/asinh.c + M /trunk/src/atan.c + M /trunk/src/atan2.c + M /trunk/src/atanh.c + M /trunk/src/bernoulli.c + M /trunk/src/buildopt.c + M /trunk/src/cache.c + M /trunk/src/cbrt.c + M /trunk/src/check.c + M /trunk/src/clear.c + M /trunk/src/clears.c + M /trunk/src/cmp.c + M /trunk/src/cmp2.c + M /trunk/src/cmp_abs.c + M /trunk/src/cmp_d.c + M /trunk/src/cmp_ld.c + M /trunk/src/cmp_si.c + M /trunk/src/cmp_ui.c + M /trunk/src/comparisons.c + M /trunk/src/const_catalan.c + M /trunk/src/const_euler.c + M /trunk/src/const_log2.c + M /trunk/src/const_pi.c + M /trunk/src/constant.c + M /trunk/src/copysign.c + M /trunk/src/cos.c + M /trunk/src/cosh.c + M /trunk/src/cot.c + M /trunk/src/coth.c + M /trunk/src/csc.c + M /trunk/src/csch.c + M /trunk/src/d_div.c + M /trunk/src/d_sub.c + M /trunk/src/digamma.c + M /trunk/src/dim.c + M /trunk/src/div.c + M /trunk/src/div_2exp.c + M /trunk/src/div_2si.c + M /trunk/src/div_2ui.c + M /trunk/src/div_d.c + M /trunk/src/div_ui.c + M /trunk/src/dump.c + M /trunk/src/eint.c + M /trunk/src/eq.c + M /trunk/src/erandom.c + M /trunk/src/erf.c + M /trunk/src/erfc.c + M /trunk/src/exceptions.c + M /trunk/src/exp.c + M /trunk/src/exp10.c + M /trunk/src/exp2.c + M /trunk/src/exp3.c + M /trunk/src/exp_2.c + M /trunk/src/expm1.c + M /trunk/src/extract.c + M /trunk/src/factorial.c + M /trunk/src/fits_intmax.c + M /trunk/src/fits_s.h + M /trunk/src/fits_sint.c + M /trunk/src/fits_slong.c + M /trunk/src/fits_sshort.c + M /trunk/src/fits_u.h + M /trunk/src/fits_uint.c + M /trunk/src/fits_uintmax.c + M /trunk/src/fits_ulong.c + M /trunk/src/fits_ushort.c + M /trunk/src/fma.c + M /trunk/src/fms.c + M /trunk/src/fpif.c + M /trunk/src/frac.c + M /trunk/src/free_cache.c + M /trunk/src/frexp.c + M /trunk/src/gamma.c + M /trunk/src/gammaonethird.c + M /trunk/src/gen_inverse.h + M /trunk/src/generic/coverage/mparam.h + M /trunk/src/generic/mparam.h + M /trunk/src/get_d.c + M /trunk/src/get_d64.c + M /trunk/src/get_exp.c + M /trunk/src/get_f.c + M /trunk/src/get_float128.c + M /trunk/src/get_flt.c + M /trunk/src/get_ld.c + M /trunk/src/get_si.c + M /trunk/src/get_sj.c + M /trunk/src/get_str.c + M /trunk/src/get_ui.c + M /trunk/src/get_uj.c + M /trunk/src/get_z.c + M /trunk/src/get_z_exp.c + M /trunk/src/gmp_op.c + M /trunk/src/grandom.c + M /trunk/src/hppa/mparam.h + M /trunk/src/hypot.c + M /trunk/src/ia64/mparam.h + M /trunk/src/ieee_floats.h + M /trunk/src/init.c + M /trunk/src/init2.c + M /trunk/src/inits.c + M /trunk/src/inits2.c + M /trunk/src/inp_str.c + M /trunk/src/int_ceil_log2.c + M /trunk/src/isinf.c + M /trunk/src/isinteger.c + M /trunk/src/isnan.c + M /trunk/src/isnum.c + M /trunk/src/isqrt.c + M /trunk/src/isregular.c + M /trunk/src/iszero.c + M /trunk/src/jn.c + M /trunk/src/jyn_asympt.c + M /trunk/src/li2.c + M /trunk/src/lngamma.c + M /trunk/src/log.c + M /trunk/src/log10.c + M /trunk/src/log1p.c + M /trunk/src/log2.c + M /trunk/src/logging.c + M /trunk/src/min_prec.c + M /trunk/src/minmax.c + M /trunk/src/mips/mparam.h + M /trunk/src/modf.c + M /trunk/src/mp_clz_tab.c + M /trunk/src/mparam_h.in + M /trunk/src/mpf2mpfr.h + M /trunk/src/mpfr-cvers.h + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-intmax.h + M /trunk/src/mpfr-longlong.h + M /trunk/src/mpfr-mini-gmp.c + M /trunk/src/mpfr-mini-gmp.h + M /trunk/src/mpfr-sassert.h + M /trunk/src/mpfr-thread.h + M /trunk/src/mpfr.h + M /trunk/src/mpn_exp.c + M /trunk/src/mul.c + M /trunk/src/mul_2exp.c + M /trunk/src/mul_2si.c + M /trunk/src/mul_2ui.c + M /trunk/src/mul_d.c + M /trunk/src/mul_ui.c + M /trunk/src/mulders.c + M /trunk/src/neg.c + M /trunk/src/next.c + M /trunk/src/nrandom.c + M /trunk/src/out_str.c + M /trunk/src/pow.c + M /trunk/src/pow_si.c + M /trunk/src/pow_ui.c + M /trunk/src/pow_z.c + M /trunk/src/powerof2.c + M /trunk/src/powerpc32/mparam.h + M /trunk/src/powerpc64/mparam.h + M /trunk/src/print_raw.c + M /trunk/src/print_rnd_mode.c + M /trunk/src/printf.c + M /trunk/src/random_deviate.c + M /trunk/src/random_deviate.h + M /trunk/src/rec_sqrt.c + M /trunk/src/reldiff.c + M /trunk/src/rem1.c + M /trunk/src/rint.c + M /trunk/src/rndna.c + M /trunk/src/root.c + M /trunk/src/round_near_x.c + M /trunk/src/round_p.c + M /trunk/src/round_prec.c + M /trunk/src/round_raw_generic.c + M /trunk/src/scale2.c + M /trunk/src/sec.c + M /trunk/src/sech.c + M /trunk/src/set.c + M /trunk/src/set_d.c + M /trunk/src/set_d64.c + M /trunk/src/set_dfl_prec.c + M /trunk/src/set_exp.c + M /trunk/src/set_f.c + M /trunk/src/set_float128.c + M /trunk/src/set_flt.c + M /trunk/src/set_inf.c + M /trunk/src/set_ld.c + M /trunk/src/set_nan.c + M /trunk/src/set_prc_raw.c + M /trunk/src/set_prec.c + M /trunk/src/set_q.c + M /trunk/src/set_rnd.c + M /trunk/src/set_si.c + M /trunk/src/set_si_2exp.c + M /trunk/src/set_sj.c + M /trunk/src/set_str.c + M /trunk/src/set_str_raw.c + M /trunk/src/set_ui.c + M /trunk/src/set_ui_2exp.c + M /trunk/src/set_uj.c + M /trunk/src/set_z.c + M /trunk/src/set_z_exp.c + M /trunk/src/set_zero.c + M /trunk/src/setmax.c + M /trunk/src/setmin.c + M /trunk/src/setsign.c + M /trunk/src/sgn.c + M /trunk/src/si_op.c + M /trunk/src/signbit.c + M /trunk/src/sin.c + M /trunk/src/sin_cos.c + M /trunk/src/sinh.c + M /trunk/src/sinh_cosh.c + M /trunk/src/sparc64/mparam.h + M /trunk/src/sqr.c + M /trunk/src/sqrt.c + M /trunk/src/sqrt_ui.c + M /trunk/src/stack_interface.c + M /trunk/src/strtofr.c + M /trunk/src/sub.c + M /trunk/src/sub1.c + M /trunk/src/sub1sp.c + M /trunk/src/sub_d.c + M /trunk/src/sub_ui.c + M /trunk/src/subnormal.c + M /trunk/src/sum.c + M /trunk/src/swap.c + M /trunk/src/tan.c + M /trunk/src/tanh.c + M /trunk/src/uceil_exp2.c + M /trunk/src/uceil_log2.c + M /trunk/src/ufloor_log2.c + M /trunk/src/ui_div.c + M /trunk/src/ui_pow.c + M /trunk/src/ui_pow_ui.c + M /trunk/src/ui_sub.c + M /trunk/src/urandom.c + M /trunk/src/urandomb.c + M /trunk/src/vasprintf.c + M /trunk/src/version.c + M /trunk/src/volatile.c + M /trunk/src/x86/core2/mparam.h + M /trunk/src/x86/mparam.h + M /trunk/src/x86_64/core2/mparam.h + M /trunk/src/x86_64/corei5/mparam.h + M /trunk/src/x86_64/pentium4/mparam.h + M /trunk/src/yn.c + M /trunk/src/zeta.c + M /trunk/src/zeta_ui.c + M /trunk/tests/Makefile.am + M /trunk/tests/cmp_str.c + M /trunk/tests/data/digamma + M /trunk/tests/data/li2 + M /trunk/tests/memory.c + M /trunk/tests/mpf_compat.c + M /trunk/tests/mpf_compat.h + M /trunk/tests/mpfr-test.h + M /trunk/tests/mpfr_compat.c + M /trunk/tests/random2.c + M /trunk/tests/reuse.c + M /trunk/tests/rnd_mode.c + M /trunk/tests/tabort_defalloc1.c + M /trunk/tests/tabort_defalloc2.c + M /trunk/tests/tabort_prec_max.c + M /trunk/tests/tabs.c + M /trunk/tests/tacos.c + M /trunk/tests/tacosh.c + M /trunk/tests/tadd.c + M /trunk/tests/tadd1sp.c + M /trunk/tests/tadd_d.c + M /trunk/tests/tadd_ui.c + M /trunk/tests/tagm.c + M /trunk/tests/tai.c + M /trunk/tests/tasin.c + M /trunk/tests/tasinh.c + M /trunk/tests/tassert.c + M /trunk/tests/tatan.c + M /trunk/tests/tatanh.c + M /trunk/tests/taway.c + M /trunk/tests/tbuildopt.c + M /trunk/tests/tcan_round.c + M /trunk/tests/tcbrt.c + M /trunk/tests/tcheck.c + M /trunk/tests/tcmp.c + M /trunk/tests/tcmp2.c + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + M /trunk/tests/tcmp_ui.c + M /trunk/tests/tcmpabs.c + M /trunk/tests/tcomparisons.c + M /trunk/tests/tconst_catalan.c + M /trunk/tests/tconst_euler.c + M /trunk/tests/tconst_log2.c + M /trunk/tests/tconst_pi.c + M /trunk/tests/tcopysign.c + M /trunk/tests/tcos.c + M /trunk/tests/tcosh.c + M /trunk/tests/tcot.c + M /trunk/tests/tcoth.c + M /trunk/tests/tcsc.c + M /trunk/tests/tcsch.c + M /trunk/tests/td_div.c + M /trunk/tests/td_sub.c + M /trunk/tests/tdigamma.c + M /trunk/tests/tdim.c + M /trunk/tests/tdiv.c + M /trunk/tests/tdiv_d.c + M /trunk/tests/tdiv_ui.c + M /trunk/tests/teint.c + M /trunk/tests/teq.c + M /trunk/tests/terandom.c + M /trunk/tests/terandom_chisq.c + M /trunk/tests/terf.c + M /trunk/tests/tests.c + M /trunk/tests/texceptions.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/texpm1.c + M /trunk/tests/tfactorial.c + M /trunk/tests/tfits.c + M /trunk/tests/tfma.c + M /trunk/tests/tfmod.c + M /trunk/tests/tfms.c + M /trunk/tests/tfpif.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tfrac.c + M /trunk/tests/tfrexp.c + M /trunk/tests/tgamma.c + M /trunk/tests/tgeneric.c + M /trunk/tests/tgeneric_ui.c + M /trunk/tests/tget_d.c + M /trunk/tests/tget_d_2exp.c + M /trunk/tests/tget_f.c + M /trunk/tests/tget_flt.c + M /trunk/tests/tget_ld_2exp.c + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tget_sj.c + M /trunk/tests/tget_str.c + M /trunk/tests/tget_z.c + M /trunk/tests/tgmpop.c + M /trunk/tests/tgrandom.c + M /trunk/tests/thyperbolic.c + M /trunk/tests/thypot.c + M /trunk/tests/tinits.c + M /trunk/tests/tinp_str.c + M /trunk/tests/tinternals.c + M /trunk/tests/tisnan.c + M /trunk/tests/tisqrt.c + M /trunk/tests/tj0.c + M /trunk/tests/tj1.c + M /trunk/tests/tjn.c + M /trunk/tests/tl2b.c + M /trunk/tests/tlgamma.c + M /trunk/tests/tli2.c + M /trunk/tests/tlngamma.c + M /trunk/tests/tlog.c + M /trunk/tests/tlog10.c + M /trunk/tests/tlog1p.c + M /trunk/tests/tlog2.c + M /trunk/tests/tmin_prec.c + M /trunk/tests/tminmax.c + M /trunk/tests/tmodf.c + M /trunk/tests/tmul.c + M /trunk/tests/tmul_2exp.c + M /trunk/tests/tmul_d.c + M /trunk/tests/tmul_ui.c + M /trunk/tests/tnext.c + M /trunk/tests/tnrandom.c + M /trunk/tests/tnrandom_chisq.c + M /trunk/tests/tout_str.c + M /trunk/tests/toutimpl.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow3.c + M /trunk/tests/tpow_all.c + M /trunk/tests/tpow_z.c + M /trunk/tests/tprintf.c + M /trunk/tests/trandom.c + M /trunk/tests/trandom_deviate.c + M /trunk/tests/trec_sqrt.c + M /trunk/tests/tremquo.c + M /trunk/tests/trint.c + M /trunk/tests/trndna.c + M /trunk/tests/troot.c + M /trunk/tests/tround_prec.c + M /trunk/tests/tsec.c + M /trunk/tests/tsech.c + M /trunk/tests/tset.c + M /trunk/tests/tset_d.c + M /trunk/tests/tset_exp.c + M /trunk/tests/tset_f.c + M /trunk/tests/tset_float128.c + M /trunk/tests/tset_ld.c + M /trunk/tests/tset_q.c + M /trunk/tests/tset_si.c + M /trunk/tests/tset_sj.c + M /trunk/tests/tset_str.c + M /trunk/tests/tset_z.c + M /trunk/tests/tset_z_exp.c + M /trunk/tests/tsgn.c + M /trunk/tests/tsi_op.c + M /trunk/tests/tsin.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tsinh.c + M /trunk/tests/tsinh_cosh.c + M /trunk/tests/tsprintf.c + M /trunk/tests/tsqr.c + M /trunk/tests/tsqrt.c + M /trunk/tests/tsqrt_ui.c + M /trunk/tests/tstckintc.c + M /trunk/tests/tstdint.c + M /trunk/tests/tstrtofr.c + M /trunk/tests/tsub.c + M /trunk/tests/tsub1sp.c + M /trunk/tests/tsub_d.c + M /trunk/tests/tsub_ui.c + M /trunk/tests/tsubnormal.c + M /trunk/tests/tsum.c + M /trunk/tests/tswap.c + M /trunk/tests/ttan.c + M /trunk/tests/ttanh.c + M /trunk/tests/ttrunc.c + M /trunk/tests/tui_div.c + M /trunk/tests/tui_pow.c + M /trunk/tests/tui_sub.c + M /trunk/tests/turandom.c + M /trunk/tests/tvalist.c + M /trunk/tests/tversion.c + M /trunk/tests/ty0.c + M /trunk/tests/ty1.c + M /trunk/tests/tyn.c + M /trunk/tests/tzeta.c + M /trunk/tests/tzeta_ui.c + M /trunk/tools/bench/Makefile.am + M /trunk/tools/bench/benchtime.h + M /trunk/tools/bench/mpfrbench.c + M /trunk/tools/ck-copyright-notice + M /trunk/tools/ck-mparam + M /trunk/tools/ck-version-info + M /trunk/tools/get_patches.sh + M /trunk/tune/Makefile.am + M /trunk/tune/bidimensional_sample.c + M /trunk/tune/speed.c + M /trunk/tune/tuneup.c + +Copyright notice update: added 2015 with + perl -pi -e 's/ (\d{4}-)?(2014)(?= Free Software)/ + " ".($1||"$2-").($2+1)/e' **/*(^/) +under zsh, reverting the tools/mbench directory (not distributed with +MPFR). Removed 2014 from the example in the doc/README.dev file. +------------------------------------------------------------------------ +r9270 | vlefevre | 2015-01-23 12:55:31 +0000 (Fri, 23 Jan 2015) | 1 line +Changed paths: + M /trunk/doc + +Added algorithms.fls (generated by latexmk) to svn:ignore property. +------------------------------------------------------------------------ +r9269 | vlefevre | 2015-01-21 14:33:22 +0000 (Wed, 21 Jan 2015) | 2 lines +Changed paths: + M /trunk/tests/tfpif.c + +[tests/tfpif.c] Updated a mpfr_set_zero line for consistency and +better readability. +------------------------------------------------------------------------ +r9268 | vlefevre | 2015-01-21 14:28:52 +0000 (Wed, 21 Jan 2015) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Added mpfr_set_(inf|zero) tests on the sign. +------------------------------------------------------------------------ +r9267 | vlefevre | 2015-01-21 14:24:24 +0000 (Wed, 21 Jan 2015) | 1 line +Changed paths: + M /trunk/tests/tset.c + +[tests/tset.c] More mpfr_set_inf tests. +------------------------------------------------------------------------ +r9266 | vlefevre | 2015-01-21 14:22:35 +0000 (Wed, 21 Jan 2015) | 1 line +Changed paths: + M /trunk/tests/tset.c + +[tests/tset.c] More mpfr_set_zero tests. +------------------------------------------------------------------------ +r9265 | vlefevre | 2015-01-21 13:47:03 +0000 (Wed, 21 Jan 2015) | 1 line +Changed paths: + M /trunk/tools/mbench/timp.h + +[tools/mbench/timp.h] Spelling mistake in a comment. +------------------------------------------------------------------------ +r9255 | vlefevre | 2014-12-17 08:40:45 +0000 (Wed, 17 Dec 2014) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r9254 | vlefevre | 2014-12-16 14:30:01 +0000 (Tue, 16 Dec 2014) | 3 lines +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + +[NEWS] Added an item about improved caching. +[NEWS,doc/mpfr.texi] In particular, mention the minimum of 10% increase +of the precision (done in r8967). +------------------------------------------------------------------------ +r9253 | vlefevre | 2014-12-16 14:08:19 +0000 (Tue, 16 Dec 2014) | 5 lines +Changed paths: + M /trunk/NEWS + M /trunk/src/Makefile.am + +[NEWS] Note that the behavior of the mpfr_set_exp function changed. +[src/Makefile.am] As this changed the ABI (the old, unwise behavior +was documented), reset -version-info age. This is not that bad since +there are other changes in the behavior, though regarded as bugs or +previously undocumented behavior. +------------------------------------------------------------------------ +r9245 | vlefevre | 2014-12-04 01:36:25 +0000 (Thu, 04 Dec 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Mention the tools/build-patch script. +------------------------------------------------------------------------ +r9242 | zimmerma | 2014-12-03 18:02:02 +0000 (Wed, 03 Dec 2014) | 2 lines +Changed paths: + M /trunk/TODO + +pointed to Feature Request + +------------------------------------------------------------------------ +r9239 | zimmerma | 2014-11-24 06:54:55 +0000 (Mon, 24 Nov 2014) | 3 lines +Changed paths: + M /trunk/configure.ac + +fixed issue reported by Dan Grayson: +https://gforge.inria.fr/tracker/?func=detail&atid=619&aid=18314&group_id=136 + +------------------------------------------------------------------------ +r9238 | vlefevre | 2014-11-13 00:31:08 +0000 (Thu, 13 Nov 2014) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Minor change concerning mp_limb_t. +------------------------------------------------------------------------ +r9237 | vlefevre | 2014-11-12 08:40:25 +0000 (Wed, 12 Nov 2014) | 1 line +Changed paths: + M /trunk/acinclude.m4 + M /trunk/src/exp_2.c + +Style improvements. +------------------------------------------------------------------------ +r9236 | vlefevre | 2014-11-12 08:35:49 +0000 (Wed, 12 Nov 2014) | 1 line +Changed paths: + M /trunk/src/exp_2.c + +[src/exp_2.c] Improved t = 0 test. +------------------------------------------------------------------------ +r9235 | vlefevre | 2014-11-12 08:31:09 +0000 (Wed, 12 Nov 2014) | 2 lines +Changed paths: + M /trunk/src/exp_2.c + +[src/exp_2.c] Fixed a bug added in r9233 (a case t = 0 was no longer +taken into account). +------------------------------------------------------------------------ +r9234 | vlefevre | 2014-11-12 08:26:50 +0000 (Wed, 12 Nov 2014) | 1 line +Changed paths: + M /trunk/src/exp_2.c + +[src/exp_2.c] GNU coding style. +------------------------------------------------------------------------ +r9233 | zimmerma | 2014-11-11 20:22:55 +0000 (Tue, 11 Nov 2014) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/configure.ac + M /trunk/src/exp_2.c + +improve mpfr_exp2 (patch from Patrick Pelissier) + +------------------------------------------------------------------------ +r9232 | zimmerma | 2014-11-09 20:09:04 +0000 (Sun, 09 Nov 2014) | 2 lines +Changed paths: + M /trunk/src/atan.c + M /trunk/src/mpfr-impl.h + +improve mpfr_atan for small precision (patch from Patrick Pelissier) + +------------------------------------------------------------------------ +r9231 | zimmerma | 2014-11-09 20:03:23 +0000 (Sun, 09 Nov 2014) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/tests/Makefile.am + +added check for libquadmath (not used) + +------------------------------------------------------------------------ +r9230 | vlefevre | 2014-11-03 05:54:33 +0000 (Mon, 03 Nov 2014) | 2 lines +Changed paths: + M /trunk/src/cache.c + +[src/cache.c] Improved mpfr_clear_cache in case mpfr_free_cache is +called often (like with GC-based systems). Patch by Patrick Pélissier. +------------------------------------------------------------------------ +r9229 | vlefevre | 2014-11-03 05:48:02 +0000 (Mon, 03 Nov 2014) | 3 lines +Changed paths: + M /trunk/src/add_d.c + M /trunk/src/cmp_d.c + M /trunk/src/d_div.c + M /trunk/src/d_sub.c + M /trunk/src/div_d.c + M /trunk/src/get_str.c + M /trunk/src/mul_d.c + M /trunk/src/sub_d.c + M /trunk/src/ui_pow.c + +[src] Applied patch by Patrick Pélissier to allocate some constant-size +MPFR numbers on the stack instead of using mpfr_init2, and replace some +MPFR_ASSERTN by MPFR_ASSERTD. +------------------------------------------------------------------------ +r9228 | vlefevre | 2014-10-31 10:08:50 +0000 (Fri, 31 Oct 2014) | 1 line +Changed paths: + M /trunk/src/get_str.c + +[src/get_str.c] Improved comments. +------------------------------------------------------------------------ +r9227 | vlefevre | 2014-10-30 15:11:34 +0000 (Thu, 30 Oct 2014) | 2 lines +Changed paths: + M /trunk/src/get_str.c + +[src/get_str.c] Free the temporary memory allocated in the Ziv loop ASAP +and at a single place (the code should be clearer like that). +------------------------------------------------------------------------ +r9226 | vlefevre | 2014-10-30 14:41:34 +0000 (Thu, 30 Oct 2014) | 1 line +Changed paths: + M /trunk/src/get_str.c + +[src/get_str.c] Code refactoring. +------------------------------------------------------------------------ +r9225 | vlefevre | 2014-10-30 14:28:43 +0000 (Thu, 30 Oct 2014) | 1 line +Changed paths: + M /trunk/tests/tget_str.c + +[tests/tget_str.c] Code formatting. +------------------------------------------------------------------------ +r9224 | vlefevre | 2014-10-30 14:26:03 +0000 (Thu, 30 Oct 2014) | 3 lines +Changed paths: + M /trunk/tests/tget_str.c + +[tests/tget_str.c] Fixed a test that made mpfr_get_str crash with +logging (even when the base is invalid, the MPFR number must be +initialized). +------------------------------------------------------------------------ +r9223 | vlefevre | 2014-10-30 13:50:34 +0000 (Thu, 30 Oct 2014) | 4 lines +Changed paths: + M /trunk/src/check.c + M /trunk/src/get_str.c + +[src/check.c] Added a note saying that mpfr_check() must not be called + on statically allocated numbers (only used inside MPFR). +[src/get_str.c] Removed the "MPFR_ASSERTD (mpfr_check (p));" (added in + previous commit) because of that. +------------------------------------------------------------------------ +r9222 | vlefevre | 2014-10-30 13:30:15 +0000 (Thu, 30 Oct 2014) | 6 lines +Changed paths: + M /trunk/src/get_str.c + +[src/get_str.c] Added some logging (MPFR_LOG_*), which triggers a crash +in tget_str with MPFR_LOG_ALL=1. An analysis with gdb shows that this +is due to an invalid MPFR number in mpfr_ceil_mul(). Added a + MPFR_ASSERTD (mpfr_check (p)); +there, which fails in tget_str (this was the cause of the crash), even +without logging. +------------------------------------------------------------------------ +r9221 | vlefevre | 2014-10-29 08:46:26 +0000 (Wed, 29 Oct 2014) | 5 lines +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + M /trunk/src/get_str.c + M /trunk/tests/tget_str.c + +mpfr_get_str now sets the NaN flag on NaN input. See: + https://sympa.inria.fr/sympa/arc/mpfr/2014-10/msg00013.html and + https://gforge.inria.fr/tracker/index.php?func=detail&aid=18228&group_id=136&atid=619 +Also completed the mpfr_get_str description in mpfr.texi concerning +the special numbers and the exception flags. +------------------------------------------------------------------------ +r9220 | vlefevre | 2014-10-28 12:21:52 +0000 (Tue, 28 Oct 2014) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r9219 | vlefevre | 2014-10-28 10:06:22 +0000 (Tue, 28 Oct 2014) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Removed a spurious "an". +------------------------------------------------------------------------ +r9218 | vlefevre | 2014-10-28 09:37:36 +0000 (Tue, 28 Oct 2014) | 1 line +Changed paths: + M /trunk/src/get_str.c + +[src/get_str.c] Improved style consistency. +------------------------------------------------------------------------ +r9217 | vlefevre | 2014-10-28 09:31:54 +0000 (Tue, 28 Oct 2014) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] In the mpfr_get_str description, note that the type +mpfr_exp_t is large enough to hold the exponent in all cases. +------------------------------------------------------------------------ +r9216 | vlefevre | 2014-10-28 09:27:30 +0000 (Tue, 28 Oct 2014) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Improved mpfr_get_str description concerning the +returned pointer (it was ambiguous in the case of an invalid base). +------------------------------------------------------------------------ +r9212 | vlefevre | 2014-10-09 13:28:45 +0000 (Thu, 09 Oct 2014) | 1 line +Changed paths: + M /trunk/tests/tests.c + +[tests/tests.c] Updated the error message last changed. +------------------------------------------------------------------------ +r9211 | vlefevre | 2014-10-09 13:24:56 +0000 (Thu, 09 Oct 2014) | 1 line +Changed paths: + M /trunk/tests/tests.c + +[tests/tests.c] Updated the error message last changed + comment. +------------------------------------------------------------------------ +r9210 | vlefevre | 2014-10-08 11:59:40 +0000 (Wed, 08 Oct 2014) | 2 lines +Changed paths: + M /trunk/tests/Makefile.am + +[tests/Makefile.am] Added a reference to the bug I've just reported +against GNU Automake (completing the other references). +------------------------------------------------------------------------ +r9209 | vlefevre | 2014-10-08 10:59:40 +0000 (Wed, 08 Oct 2014) | 1 line +Changed paths: + M /trunk/tests/tests.c + +[tests/tests.c] Updated the error message last changed. +------------------------------------------------------------------------ +r9208 | vlefevre | 2014-10-07 13:33:33 +0000 (Tue, 07 Oct 2014) | 1 line +Changed paths: + M /trunk/tests/tests.c + +[tests/tests.c] Changed an error message. +------------------------------------------------------------------------ +r9204 | vlefevre | 2014-09-09 00:17:47 +0000 (Tue, 09 Sep 2014) | 1 line +Changed paths: + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tset_float128.c + +[tests] Corrections for builds with "config.h". +------------------------------------------------------------------------ +r9193 | vlefevre | 2014-08-22 15:23:52 +0000 (Fri, 22 Aug 2014) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Avoid false positives in the check of MPFR_LOG_MSG. +------------------------------------------------------------------------ +r9187 | vlefevre | 2014-08-21 11:33:33 +0000 (Thu, 21 Aug 2014) | 1 line +Changed paths: + M /trunk/src/add.c + M /trunk/src/exceptions.c + M /trunk/src/fma.c + M /trunk/src/hypot.c + M /trunk/src/mul.c + +[src] Cleaner use of MPFR_SET_SIGN. +------------------------------------------------------------------------ +r9178 | vlefevre | 2014-08-17 16:47:29 +0000 (Sun, 17 Aug 2014) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Added item on tests (mpfr.h macros vs mpfr-impl.h). +------------------------------------------------------------------------ +r9177 | vlefevre | 2014-08-17 10:46:16 +0000 (Sun, 17 Aug 2014) | 3 lines +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Fixed the mpfr_signbit() macro, which depended on +mpfr-impl.h (the problem wasn't detected in the tests since mpfr-impl.h +is included in them). Thanks to Rob for the bug report. +------------------------------------------------------------------------ +r9164 | vlefevre | 2014-08-05 10:33:51 +0000 (Tue, 05 Aug 2014) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Improved check of MPFR_LOG_MSG. +------------------------------------------------------------------------ +r9163 | vlefevre | 2014-08-05 10:19:02 +0000 (Tue, 05 Aug 2014) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Replaced {src,tests}/*.{c,h} by $srctests. +------------------------------------------------------------------------ +r9162 | vlefevre | 2014-08-05 09:49:35 +0000 (Tue, 05 Aug 2014) | 1 line +Changed paths: + M /trunk/src/ai.c + +[src/ai.c] Corrected log messages. +------------------------------------------------------------------------ +r9161 | vlefevre | 2014-08-05 09:34:26 +0000 (Tue, 05 Aug 2014) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r9160 | vlefevre | 2014-08-05 09:29:29 +0000 (Tue, 05 Aug 2014) | 6 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/vasprintf.c + +Update concerning the P type specifier for formatted output, since +mpfr_prec_t was changed to a signed type in MPFR 3.0.0. + * doc/mpfr.texi: d and i can be used (o, u, x, and X are still OK + in practice since a mpfr_prec_t value is usually nonnegative); + changed a "unsigned int" to "int". + * src/vasprintf.c: updated a comment. +------------------------------------------------------------------------ +r9158 | vlefevre | 2014-07-23 00:23:18 +0000 (Wed, 23 Jul 2014) | 1 line +Changed paths: + M /trunk/tests/mpf_compat.h + +[tests/mpf_compat.h] Fixed a bug (mpf_set_prec_raw usage with GMP/MPF). +------------------------------------------------------------------------ +r9157 | vlefevre | 2014-07-23 00:12:35 +0000 (Wed, 23 Jul 2014) | 9 lines +Changed paths: + M /trunk/tests/mpf_compat.c + M /trunk/tests/mpf_compat.h + M /trunk/tests/mpfr-test.h + M /trunk/tests/mpfr_compat.c + +[tests] + * mpfr-test.h: no longer include right here since the + included mpfr-impl.h does that and even better for C++. + * mpf_compat.c, mpfr_compat.c: include mpfr-test.h as it does useful + things (in particular, include config.h via mpfr-impl.h if there + is one, and define __MPFR_TEST_H__ for mpfr-impl.h). + * mpf_compat.h: no longer include some headers already included + via mpfr-test.h (see above change); added tests_start_mpfr and + tests_end_mpfr (showing memory inconsistency with mpf_compat). +------------------------------------------------------------------------ +r9156 | vlefevre | 2014-07-20 22:05:51 +0000 (Sun, 20 Jul 2014) | 1 line +Changed paths: + M /trunk/src/get_str.c + +[src/get_str.c] Coding style: better code for a boolean. +------------------------------------------------------------------------ +r9152 | vlefevre | 2014-07-10 13:31:18 +0000 (Thu, 10 Jul 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] "To make a release": check also without mpz_t caching. +------------------------------------------------------------------------ +r9151 | vlefevre | 2014-07-10 13:13:31 +0000 (Thu, 10 Jul 2014) | 8 lines +Changed paths: + M /trunk/tools/ck-copyright-notice + M /trunk/tools/mpfrlint + +[tools/ck-copyright-notice] Ignore src/mini-gmp.[ch] files. +[tools/mpfrlint] + * Ignore src/mini-gmp.[ch] files for some tests. + * Check that __gmp[nz]_ functions are not used (with 2 exceptions), + since this breaks the support of mini-gmp and may also break + future/modified GMP versions. + Note: only code added in r8911 (mpz_t caching) currently fails to + follow this rule. +------------------------------------------------------------------------ +r9150 | vlefevre | 2014-07-10 10:35:11 +0000 (Thu, 10 Jul 2014) | 4 lines +Changed paths: + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + +Do not test include guards before a #include: the test must be done only +in the included file itself. Note that some files such as mpfr.h may +have multiple parts that could be enabled depending on the context, so +that testing a guard before a #include may yield incorrect behavior. +------------------------------------------------------------------------ +r9149 | vlefevre | 2014-07-09 01:17:18 +0000 (Wed, 09 Jul 2014) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Updated the list of macros used for building and +checking MPFR. +------------------------------------------------------------------------ +r9148 | vlefevre | 2014-07-09 01:11:57 +0000 (Wed, 09 Jul 2014) | 1 line +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Corrected a message. +------------------------------------------------------------------------ +r9147 | vlefevre | 2014-07-08 10:22:09 +0000 (Tue, 08 Jul 2014) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/doc/README.dev + M /trunk/tests/tests.c + +Renamed the MPFR_TEST_DIVBYZERO macro to MPFR_TESTS_DIVBYZERO +for consistency with MPFR_TESTS_TIMEOUT. +------------------------------------------------------------------------ +r9146 | vlefevre | 2014-07-07 16:18:16 +0000 (Mon, 07 Jul 2014) | 1 line +Changed paths: + M /trunk/tests/tadd_d.c + M /trunk/tests/td_sub.c + M /trunk/tests/tdiv_d.c + M /trunk/tests/tsub_d.c + +[tests] Minor improvements. +------------------------------------------------------------------------ +r9145 | vlefevre | 2014-07-07 16:15:43 +0000 (Mon, 07 Jul 2014) | 1 line +Changed paths: + M /trunk/tests/reuse.c + M /trunk/tests/taway.c + +[tests/reuse.c,tests/taway.c] Added mpfr_ai and mpfr_digamma. +------------------------------------------------------------------------ +r9144 | vlefevre | 2014-07-07 16:13:47 +0000 (Mon, 07 Jul 2014) | 1 line +Changed paths: + M /trunk/tests/tmul_d.c + +[tests/tmul_d.c] Minor improvement. +------------------------------------------------------------------------ +r9143 | vlefevre | 2014-07-07 16:11:56 +0000 (Mon, 07 Jul 2014) | 2 lines +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] Fixed a test when MPFR_WANT_ASSERT >= 2 (NaN with non-NaN +was not detected as an error). +------------------------------------------------------------------------ +r9142 | vlefevre | 2014-07-07 15:59:53 +0000 (Mon, 07 Jul 2014) | 4 lines +Changed paths: + M /trunk/src/add1sp.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mul.c + M /trunk/src/round_p.c + M /trunk/src/sub1sp.c + +[src] MPFR_WANT_ASSERT clean-up. +Note: the mul.c test for MPFR_WANT_ASSERT >= 3 is now enabled for +MPFR_WANT_ASSERT = 2 (since setting MPFR_WANT_ASSERT to 3 was not +possible with configure options), and fixed. +------------------------------------------------------------------------ +r9141 | vlefevre | 2014-07-07 12:43:59 +0000 (Mon, 07 Jul 2014) | 2 lines +Changed paths: + M /trunk/configure.ac + M /trunk/src/exceptions.c + M /trunk/src/mpfr-impl.h + +Added debug of branch prediction / --enable-debug-prediction configure +option (patch from Patrick Pélissier, with some changes). +------------------------------------------------------------------------ +r9139 | vlefevre | 2014-07-02 17:17:40 +0000 (Wed, 02 Jul 2014) | 1 line +Changed paths: + M /trunk/src/round_raw_generic.c + +[src/round_raw_generic.c] Updated comment about MPFR_RNDNA. +------------------------------------------------------------------------ +r9138 | vlefevre | 2014-07-02 13:10:19 +0000 (Wed, 02 Jul 2014) | 1 line +Changed paths: + M /trunk/doc/mini-gmp + +[doc/mini-gmp] Added a note about MPFR_USE_MINI_GMP. +------------------------------------------------------------------------ +r9137 | vlefevre | 2014-07-02 12:57:22 +0000 (Wed, 02 Jul 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added an item on the use of GMP functions. +------------------------------------------------------------------------ +r9136 | vlefevre | 2014-07-02 12:29:40 +0000 (Wed, 02 Jul 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] "To make a release": test with mini-gmp. +------------------------------------------------------------------------ +r9135 | vlefevre | 2014-07-02 12:24:54 +0000 (Wed, 02 Jul 2014) | 5 lines +Changed paths: + M /trunk/src/erandom.c + M /trunk/src/mpfr.h + M /trunk/src/nrandom.c + M /trunk/src/random_deviate.c + M /trunk/tests/terandom.c + M /trunk/tests/tnrandom.c + +Removed the need of MPFR_USE_MINI_GMP tests for mpfr_[ne]random +functions (source and tests) as mpfr_random_deviate_value no longer +needs mpq_t (since r9066). Also removed a static assertion in +src/random_deviate.c for the same reason. +Note: the change done in r9133 is now really useful! +------------------------------------------------------------------------ +r9134 | vlefevre | 2014-07-02 12:12:45 +0000 (Wed, 02 Jul 2014) | 1 line +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Added other missing "#ifndef MPFR_USE_MINI_GMP". +------------------------------------------------------------------------ +r9133 | vlefevre | 2014-07-02 11:59:52 +0000 (Wed, 02 Jul 2014) | 3 lines +Changed paths: + M /trunk/tests/terandom.c + M /trunk/tests/tnrandom.c + +[tests/t[ne]random.c] Code clean-up: added !defined(MPFR_USE_MINI_GMP) +to protect mpfr_printf. This is actually not needed due to the initial +"#ifndef MPFR_USE_MINI_GMP" but this is for a different reason. +------------------------------------------------------------------------ +r9132 | vlefevre | 2014-07-02 11:55:25 +0000 (Wed, 02 Jul 2014) | 2 lines +Changed paths: + M /trunk/tests/terandom.c + M /trunk/tests/tnrandom.c + +[tests/t[ne]random.c] Reverted the changes done in r9126,9127,9130 +and added a proper comment. +------------------------------------------------------------------------ +r9131 | vlefevre | 2014-07-02 11:49:23 +0000 (Wed, 02 Jul 2014) | 2 lines +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Added a missing "#ifndef MPFR_USE_MINI_GMP" +(not really useful, but cleaner). +------------------------------------------------------------------------ +r9130 | vlefevre | 2014-07-02 11:46:04 +0000 (Wed, 02 Jul 2014) | 1 line +Changed paths: + M /trunk/tests/terandom.c + M /trunk/tests/tnrandom.c + +[tests/t[ne]random.c] Fixed the change done in r9126 and r9127. +------------------------------------------------------------------------ +r9129 | vlefevre | 2014-07-02 11:41:43 +0000 (Wed, 02 Jul 2014) | 3 lines +Changed paths: + M /trunk/configure.ac + M /trunk/src/erandom.c + M /trunk/src/get_f.c + M /trunk/src/gmp_op.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-mini-gmp.c + M /trunk/src/mpfr.h + M /trunk/src/nrandom.c + M /trunk/src/printf.c + M /trunk/src/random_deviate.c + M /trunk/src/set_f.c + M /trunk/src/set_q.c + M /trunk/src/vasprintf.c + M /trunk/tests/mpf_compat.c + M /trunk/tests/mpfr_compat.c + M /trunk/tests/tabort_defalloc1.c + M /trunk/tests/tabort_defalloc2.c + M /trunk/tests/tcan_round.c + M /trunk/tests/terandom.c + M /trunk/tests/terandom_chisq.c + M /trunk/tests/tests.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tget_f.c + M /trunk/tests/tgmpop.c + M /trunk/tests/tgrandom.c + M /trunk/tests/tnrandom.c + M /trunk/tests/tnrandom_chisq.c + M /trunk/tests/tprintf.c + M /trunk/tests/trandom.c + M /trunk/tests/trandom_deviate.c + M /trunk/tests/tset_f.c + M /trunk/tests/tset_q.c + M /trunk/tests/tsprintf.c + M /trunk/tests/turandom.c + +Renamed WANT_MINI_GMP to MPFR_USE_MINI_GMP as it is used in mpfr.h +(all MPFR macros that appear there should start with MPFR_ to avoid +conflicts with other software). +------------------------------------------------------------------------ +r9128 | vlefevre | 2014-07-02 09:57:16 +0000 (Wed, 02 Jul 2014) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Detect the possible use of forbidden macros in mpfr.h. +------------------------------------------------------------------------ +r9127 | vlefevre | 2014-07-02 09:23:25 +0000 (Wed, 02 Jul 2014) | 2 lines +Changed paths: + M /trunk/tests/terandom.c + +[tests/terandom.c] Put the WANT_MINI_GMP test at the right place, like +what has been done for "tests/tnrandom.c". +------------------------------------------------------------------------ +r9126 | vlefevre | 2014-07-02 09:20:11 +0000 (Wed, 02 Jul 2014) | 3 lines +Changed paths: + M /trunk/tests/tnrandom.c + +[tests/tnrandom.c] Put the WANT_MINI_GMP test at the right place +(at the same time of the HAVE_STDARG test), but this should be +improved in the future, e.g. with a HAVE_MPFR_PRINTF macro. +------------------------------------------------------------------------ +r9125 | zimmerma | 2014-07-02 09:04:30 +0000 (Wed, 02 Jul 2014) | 2 lines +Changed paths: + M /trunk/tests/tnrandom.c + +added comment + +------------------------------------------------------------------------ +r9124 | vlefevre | 2014-07-02 08:43:19 +0000 (Wed, 02 Jul 2014) | 1 line +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] Minor correction of a comment. +------------------------------------------------------------------------ +r9122 | vlefevre | 2014-07-01 11:50:12 +0000 (Tue, 01 Jul 2014) | 1 line +Changed paths: + M /trunk/tests/trandom_deviate.c + +[tests/trandom_deviate.c] Correction (fprintf format). +------------------------------------------------------------------------ +r9121 | zimmerma | 2014-07-01 11:39:30 +0000 (Tue, 01 Jul 2014) | 5 lines +Changed paths: + M /trunk/tests/chi-squared-tests.txt + M /trunk/tests/terandom_chisq.c + M /trunk/tests/tnrandom_chisq.c + M /trunk/tests/trandom_deviate.c + +patch from Charles Karney: +> Here is the patch which repeats the chi-squared tests in the case of +> suspiciously high values. The probability of a false positive is now +> 1/10^9. I also got rid of the mpfr_printf's. + +------------------------------------------------------------------------ +r9117 | vlefevre | 2014-06-30 15:07:40 +0000 (Mon, 30 Jun 2014) | 5 lines +Changed paths: + M /trunk/tools/build-patch + +[tools/build-patch] + * Removed unnecessary quotes for better readability (this is zsh). + * When (second argument) is used, use the correct name + for the generated patch; at the same time, fixed a checkobj call. + * Added comment about typical usage. +------------------------------------------------------------------------ +r9116 | vlefevre | 2014-06-30 13:44:39 +0000 (Mon, 30 Jun 2014) | 3 lines +Changed paths: + M /trunk/tools/build-patch + +[tools/build-patch] Correction if MPFR_CURRENT_DIR is set: to make sure +that it is always up-to-date, we want to allow it to be a symlink (e.g. +.../mpfr-current), so that we want to call realpath on it. +------------------------------------------------------------------------ +r9115 | vlefevre | 2014-06-30 13:22:09 +0000 (Mon, 30 Jun 2014) | 2 lines +Changed paths: + A /trunk/tools/build-patch + +Added tools/build-patch zsh script to transform a raw patch into a patch +to be put on the MPFR www server. +------------------------------------------------------------------------ +r9114 | vlefevre | 2014-06-30 12:21:26 +0000 (Mon, 30 Jun 2014) | 1 line +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] For the mpfr_{mul,div}_si macros: s/positive/non-negative/ +------------------------------------------------------------------------ +r9113 | vlefevre | 2014-06-30 10:36:46 +0000 (Mon, 30 Jun 2014) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] Correction of two "configure --help" messages +(from Patrick Pélissier and other changes). +------------------------------------------------------------------------ +r9112 | vlefevre | 2014-06-30 10:00:16 +0000 (Mon, 30 Jun 2014) | 1 line +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Coding style. +------------------------------------------------------------------------ +r9111 | vlefevre | 2014-06-30 09:57:36 +0000 (Mon, 30 Jun 2014) | 5 lines +Changed paths: + M /trunk/src/div_ui.c + M /trunk/src/mpfr.h + M /trunk/src/mul_ui.c + M /trunk/tests/tdiv_ui.c + M /trunk/tests/tmul_ui.c + +New macros for mpfr_{mul,div}_ui to optimize the call when the integer +is a constant number that is a power of 2. +New macros for mpfr_{mul,div}_si to optimize the call when the integer +is a constant number that is positive. +(Modified patch from Patrick Pélissier) +------------------------------------------------------------------------ +r9109 | vlefevre | 2014-06-26 10:55:09 +0000 (Thu, 26 Jun 2014) | 1 line +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Improved comments. +------------------------------------------------------------------------ +r9108 | vlefevre | 2014-06-26 10:53:46 +0000 (Thu, 26 Jun 2014) | 2 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Fixed assertion failures for tiny numbers (the code +was correct, but the assertions didn't check against the right bound). +------------------------------------------------------------------------ +r9107 | vlefevre | 2014-06-26 01:02:26 +0000 (Thu, 26 Jun 2014) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] Bug fix: avoid integer overflow in the code added in r9086 +(now tdiv no longer fails). +------------------------------------------------------------------------ +r9106 | vlefevre | 2014-06-26 00:43:06 +0000 (Thu, 26 Jun 2014) | 3 lines +Changed paths: + M /trunk + M /trunk/src/div.c + +[src/div.c] Bug fix: avoid an integer overflow when dividing the +largest finite MPFR number by the smallest positive one. +(merged changeset r9105 from the 3.1 branch) +------------------------------------------------------------------------ +r9103 | vlefevre | 2014-06-26 00:16:26 +0000 (Thu, 26 Jun 2014) | 1 line +Changed paths: + M /trunk/tests/tdiv.c + +[tests/tdiv.c] Forgot "exit (1);". +------------------------------------------------------------------------ +r9101 | vlefevre | 2014-06-26 00:00:16 +0000 (Thu, 26 Jun 2014) | 3 lines +Changed paths: + M /trunk/tests/tdiv.c + +[tests/tdiv.c] Added mpfr_div tests on extreme values. This detects +2 problems (at least on a 64-bit machine): a result is not a valid +MPFR number (mpfr_check fails) and the flags are incorrect. +------------------------------------------------------------------------ +r9100 | vlefevre | 2014-06-25 23:34:28 +0000 (Wed, 25 Jun 2014) | 2 lines +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Fixed test added in r9099 (the problem was unrelated +to the bug in vasprintf.c). +------------------------------------------------------------------------ +r9099 | vlefevre | 2014-06-25 23:20:16 +0000 (Wed, 25 Jun 2014) | 2 lines +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Added a test with the minimum exponent +(currently triggers an assertion failure in vasprintf.c). +------------------------------------------------------------------------ +r9098 | zimmerma | 2014-06-25 16:29:51 +0000 (Wed, 25 Jun 2014) | 2 lines +Changed paths: + M /trunk/tools/nightly-test + +define MPFR_SKIP_EXTREME to avoid currently failing tsum test + +------------------------------------------------------------------------ +r9097 | vlefevre | 2014-06-25 16:09:57 +0000 (Wed, 25 Jun 2014) | 2 lines +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Do not run the check_extreme test (which currently fails) +when the MPFR_SKIP_EXTREME environment variable is defined. +------------------------------------------------------------------------ +r9096 | zimmerma | 2014-06-25 15:37:25 +0000 (Wed, 25 Jun 2014) | 2 lines +Changed paths: + M /trunk/tools/nightly-test + +reconfigure for mpfrbench + +------------------------------------------------------------------------ +r9095 | zimmerma | 2014-06-25 15:05:30 +0000 (Wed, 25 Jun 2014) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/src/div.c + M /trunk/tests/tdiv.c + +speedup in mpfr_div for n/n division, using mpz_tdiv_q + +------------------------------------------------------------------------ +r9094 | vlefevre | 2014-06-25 13:39:37 +0000 (Wed, 25 Jun 2014) | 2 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Check when simple mp_limb_t constants could be used +(MPFR_LIMB_ZERO, MPFR_LIMB_ONE, and MPFR_LIMB_MAX). +------------------------------------------------------------------------ +r9092 | vlefevre | 2014-06-25 13:15:40 +0000 (Wed, 25 Jun 2014) | 7 lines +Changed paths: + M /trunk/src/coth.c + M /trunk/src/div.c + M /trunk/src/erfc.c + M /trunk/src/exp2.c + M /trunk/src/get_si.c + M /trunk/src/get_str.c + M /trunk/src/jn.c + M /trunk/src/lngamma.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + M /trunk/src/pow.c + M /trunk/src/pow_si.c + M /trunk/src/pow_z.c + M /trunk/src/print_raw.c + M /trunk/src/signbit.c + M /trunk/src/sin.c + M /trunk/src/sin_cos.c + M /trunk/src/yn.c + M /trunk/tests/mpfr-test.h + M /trunk/tests/taway.c + M /trunk/tests/tcos.c + M /trunk/tests/tcosh.c + M /trunk/tests/tcoth.c + M /trunk/tests/tcsch.c + M /trunk/tests/tdiv.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/texpm1.c + M /trunk/tests/tfactorial.c + M /trunk/tests/tfma.c + M /trunk/tests/tfms.c + M /trunk/tests/tgamma.c + M /trunk/tests/tget_flt.c + M /trunk/tests/tgmpop.c + M /trunk/tests/thyperbolic.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow_z.c + M /trunk/tests/tremquo.c + M /trunk/tests/trint.c + M /trunk/tests/tsec.c + M /trunk/tests/tsech.c + M /trunk/tests/tset.c + M /trunk/tests/tset_ld.c + M /trunk/tests/tset_str.c + M /trunk/tests/tsin.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tsinh.c + M /trunk/tests/tzeta.c + +Use MPFR_IS_NEG and MPFR_IS_POS instead of comparing the sign with 0. +Done with + perl -pi -e ' + s/MPFR_SIGN *\(([^)]+)\) *<=? *0/MPFR_IS_NEG ($1)/g; + s/MPFR_SIGN *\(([^)]+)\) *>=? *0/MPFR_IS_POS ($1)/g; + ' {src,tests}/*.{c,h} +and some manual changes. +------------------------------------------------------------------------ +r9091 | vlefevre | 2014-06-25 12:50:21 +0000 (Wed, 25 Jun 2014) | 11 lines +Changed paths: + M /trunk/src/check.c + M /trunk/src/div.c + M /trunk/src/div_ui.c + M /trunk/src/frac.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-mini-gmp.c + M /trunk/src/mulders.c + M /trunk/src/print_raw.c + M /trunk/src/round_raw_generic.c + M /trunk/src/set_uj.c + M /trunk/src/sub1sp.c + M /trunk/src/vasprintf.c + M /trunk/tests/random2.c + M /trunk/tests/tadd.c + M /trunk/tests/tcmp2.c + M /trunk/tests/teq.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tset_si.c + +More code clean-up (for both consistency and readability): + * Use the simple mp_limb_t constants when possible. + * New internal macro MPFR_IS_NORMALIZED. +Note: this was done with + perl -pi -e ' + s/~ *\(mp_limb_t\) *0/MPFR_LIMB_MAX/g; + s/\(mp_limb_t\) *-1/MPFR_LIMB_MAX/g; + s/\(mp_limb_t\) *0/MPFR_LIMB_ZERO/g; + s/\(mp_limb_t\) *1L?/MPFR_LIMB_ONE/g' {src,tests}/*.{c,h} + svn revert src/mpfr-impl.h +and some manual changes. +------------------------------------------------------------------------ +r9090 | vlefevre | 2014-06-25 12:02:19 +0000 (Wed, 25 Jun 2014) | 6 lines +Changed paths: + M /trunk/src/add1.c + M /trunk/src/get_f.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/next.c + M /trunk/src/rint.c + M /trunk/src/round_p.c + M /trunk/src/setmax.c + M /trunk/tests/mpfr-test.h + M /trunk/tests/tgeneric.c + +Code clean-up: + * Simplified the definition of simple mp_limb_t constants: it is + better to avoid GMP internals when there is a standard way. + * Replaced the use of MP_LIMB_T_MAX by the new macro MPFR_LIMB_MAX. + * So, removed the now useless MP_LIMB_T_MAX and GMP_LIMB_HIGHBIT + definitions from "mpfr-gmp.h". +------------------------------------------------------------------------ +r9089 | vlefevre | 2014-06-25 11:55:23 +0000 (Wed, 25 Jun 2014) | 1 line +Changed paths: + M /trunk/src/mpfr-mini-gmp.h + +[src/mpfr-mini-gmp.h] GMP_NUMB_MASK is no longer needed. +------------------------------------------------------------------------ +r9088 | vlefevre | 2014-06-25 11:54:14 +0000 (Wed, 25 Jun 2014) | 1 line +Changed paths: + M /trunk/tests/random2.c + +[tests/random2.c] Removed a useless use of GMP_NUMB_MASK. +------------------------------------------------------------------------ +r9087 | vlefevre | 2014-06-25 09:38:31 +0000 (Wed, 25 Jun 2014) | 8 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] In the case where the divisor has one limb (latest commit), +check that the value of this limb fits in an unsigned long, otherwise +mpfr_div_ui cannot be used. Indeed, according to the GMP manual §2.2, +a limb may be a long long (actually unsigned): + For example in some 32-bit ABIs, GMP may support a limb as either a + 32-bit `long' or a 64-bit `long long'. +Note: if a limb is an unsigned long, this new test will be no-op, since +always true. +------------------------------------------------------------------------ +r9086 | zimmerma | 2014-06-25 08:05:09 +0000 (Wed, 25 Jun 2014) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/src/div.c + +speedup of mpfr_div when divisor has one limb + +------------------------------------------------------------------------ +r9085 | vlefevre | 2014-06-25 01:24:49 +0000 (Wed, 25 Jun 2014) | 6 lines +Changed paths: + M /trunk/src/random_deviate.h + +[src/random_deviate.h] Fixed prototypes: + * Added __MPFR_DECLSPEC to avoid failure with Windows DLL; see + https://sympa.inria.fr/sympa/arc/mpfr/2014-06/msg00003.html + * Added _MPFR_PROTO for consistency (though it will probably + be removed in the near future). + * Removed variable names (coding style). +------------------------------------------------------------------------ +r9084 | vlefevre | 2014-06-24 14:29:22 +0000 (Tue, 24 Jun 2014) | 1 line +Changed paths: + M /trunk/tests + +[tests] Added terandom_chisq and tnrandom_chisq to svn:ignore property. +------------------------------------------------------------------------ +r9083 | vlefevre | 2014-06-24 14:26:58 +0000 (Tue, 24 Jun 2014) | 3 lines +Changed paths: + M /trunk/tests/Makefile.am + A /trunk/tests/chi-squared-tests.txt + A /trunk/tests/terandom_chisq.c + A /trunk/tests/tnrandom_chisq.c + M /trunk/tests/trandom_deviate.c + +[tests] Applied patch by Charles Karney (chi-squared tests for +mpfr_[ne]random), together with the contents of his mail about +this patch. +------------------------------------------------------------------------ +r9082 | vlefevre | 2014-06-23 11:14:48 +0000 (Mon, 23 Jun 2014) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r9081 | vlefevre | 2014-06-22 20:37:11 +0000 (Sun, 22 Jun 2014) | 1 line +Changed paths: + M /trunk/INSTALL + M /trunk/README + M /trunk/TODO + M /trunk/acinclude.m4 + M /trunk/configure.ac + M /trunk/doc/README.dev + M /trunk/doc/mpfr.texi + M /trunk/src/get_d64.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-sassert.h + M /trunk/src/mpfr.h + M /trunk/src/set_d64.c + M /trunk/tests/tests.c + M /trunk/tests/tgeneric.c + M /trunk/tests/tset_ld.c + +Updated URL's. +------------------------------------------------------------------------ +r9079 | vlefevre | 2014-06-22 11:53:31 +0000 (Sun, 22 Jun 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Updated URL's (use of https instead of http). +------------------------------------------------------------------------ +r9071 | vlefevre | 2014-06-17 10:20:27 +0000 (Tue, 17 Jun 2014) | 2 lines +Changed paths: + M /trunk/tests/trandom_deviate.c + +[tests/trandom_deviate.c] New version, with fixes of ternary value +(inexact) handling by Charles Karney. +------------------------------------------------------------------------ +r9070 | vlefevre | 2014-06-17 10:10:24 +0000 (Tue, 17 Jun 2014) | 1 line +Changed paths: + M /trunk/tests + +[tests] Added trandom_deviate to svn:ignore property. +------------------------------------------------------------------------ +r9069 | vlefevre | 2014-06-17 10:08:55 +0000 (Tue, 17 Jun 2014) | 1 line +Changed paths: + M /trunk/tests/trandom_deviate.c + +[tests/trandom_deviate.c] GNU style and C90 compatibility. +------------------------------------------------------------------------ +r9068 | vlefevre | 2014-06-17 09:09:01 +0000 (Tue, 17 Jun 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Updated note about ternary values (macros). +------------------------------------------------------------------------ +r9067 | vlefevre | 2014-06-17 09:03:11 +0000 (Tue, 17 Jun 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added a note about ternary values. +------------------------------------------------------------------------ +r9066 | zimmerma | 2014-06-17 05:41:36 +0000 (Tue, 17 Jun 2014) | 2 lines +Changed paths: + M /trunk/src/random_deviate.c + M /trunk/tests/trandom_deviate.c + +patches from Charles Karney + +------------------------------------------------------------------------ +r9065 | vlefevre | 2014-06-17 00:21:33 +0000 (Tue, 17 Jun 2014) | 2 lines +Changed paths: + M /trunk/tests/trandom_deviate.c + +[tests/trandom_deviate.c] Removed useless "#ifdef HAVE_STDARG": +printf is a standard C function and is always defined. +------------------------------------------------------------------------ +r9064 | vlefevre | 2014-06-17 00:20:05 +0000 (Tue, 17 Jun 2014) | 2 lines +Changed paths: + M /trunk/tests/trandom_deviate.c + +[tests/trandom_deviate.c] GNU style. Pre-C99 compatibility +(statements after declarations). +------------------------------------------------------------------------ +r9063 | vlefevre | 2014-06-17 00:15:15 +0000 (Tue, 17 Jun 2014) | 1 line +Changed paths: + M /trunk/tests/trandom_deviate.c + +[tests/trandom_deviate.c] Untabified. +------------------------------------------------------------------------ +r9061 | zimmerma | 2014-06-16 13:21:42 +0000 (Mon, 16 Jun 2014) | 2 lines +Changed paths: + M /trunk/tests/Makefile.am + A /trunk/tests/trandom_deviate.c + +added trandom_deviate.c to improve coverage (contributed by Charles Karney) + +------------------------------------------------------------------------ +r9060 | zimmerma | 2014-06-16 13:20:13 +0000 (Mon, 16 Jun 2014) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +updated information about coverage test + +------------------------------------------------------------------------ +r9059 | vlefevre | 2014-06-05 12:48:00 +0000 (Thu, 05 Jun 2014) | 1 line +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] English usage in a comment. +------------------------------------------------------------------------ +r9058 | vlefevre | 2014-06-03 09:16:01 +0000 (Tue, 03 Jun 2014) | 1 line +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Updated a comment. +------------------------------------------------------------------------ +r9054 | vlefevre | 2014-05-22 00:09:42 +0000 (Thu, 22 May 2014) | 1 line +Changed paths: + M /trunk/README + M /trunk/doc/README.dev + M /trunk/tools/announce-text + +Changed "INRIAGForge" to "InriaForge" (due to the rename). +------------------------------------------------------------------------ +r9048 | vlefevre | 2014-05-14 13:56:06 +0000 (Wed, 14 May 2014) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Correction about clang sanitizer: mention the +-fno-sanitize=float-cast-overflow,float-divide-by-zero option. +------------------------------------------------------------------------ +r9047 | vlefevre | 2014-05-14 13:28:04 +0000 (Wed, 14 May 2014) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] About clang sanitizer, mention the +-fno-sanitize=float-divide-by-zero option. +------------------------------------------------------------------------ +r9046 | zimmerma | 2014-05-06 12:14:24 +0000 (Tue, 06 May 2014) | 2 lines +Changed paths: + M /trunk/doc/algorithms.bib + M /trunk/doc/algorithms.tex + +added description of algorithm used for mpfr_log (from Sylvie Boldo) + +------------------------------------------------------------------------ +r9045 | vlefevre | 2014-04-25 09:02:51 +0000 (Fri, 25 Apr 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Updated an old note about GCC 4.9. +------------------------------------------------------------------------ +r9044 | vlefevre | 2014-04-25 09:00:56 +0000 (Fri, 25 Apr 2014) | 3 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Completed the note about GCC's sanitizer. See + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44786 (sanitizer) + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60275 (no recover) +------------------------------------------------------------------------ +r9043 | vlefevre | 2014-04-25 08:30:38 +0000 (Fri, 25 Apr 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Completed the note about GCC's sanitizer. +------------------------------------------------------------------------ +r9042 | vlefevre | 2014-04-25 07:21:24 +0000 (Fri, 25 Apr 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Mention that GCC 4.9 supports "-fsanitize=undefined". +------------------------------------------------------------------------ +r9040 | vlefevre | 2014-04-22 15:20:13 +0000 (Tue, 22 Apr 2014) | 2 lines +Changed paths: + M /trunk/tests/tpow.c + +[tests/tpow.c] Removed comment that can now be confusing: try_mpfr.html +was actually not using the mpfr_pow function, but exp(y*log(x)). +------------------------------------------------------------------------ +r9039 | vlefevre | 2014-04-22 10:48:46 +0000 (Tue, 22 Apr 2014) | 3 lines +Changed paths: + M /trunk/tests/tpow.c + +[tests/tpow.c] Added a test corresponding to buggy output on +http://ex-cs.sist.ac.jp/~tkouya/try_mpfr.html but everything +is OK in r9038. +------------------------------------------------------------------------ +r9036 | vlefevre | 2014-04-15 22:26:58 +0000 (Tue, 15 Apr 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Update about patches and autotools files. +------------------------------------------------------------------------ +r9035 | vlefevre | 2014-04-15 22:26:18 +0000 (Tue, 15 Apr 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Update about patches and autotools files. +------------------------------------------------------------------------ +r9032 | vlefevre | 2014-04-15 15:13:32 +0000 (Tue, 15 Apr 2014) | 2 lines +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Changed initialization in check_extreme(), which wasn't +supported by ISO C90. +------------------------------------------------------------------------ +r9031 | vlefevre | 2014-04-15 15:12:11 +0000 (Tue, 15 Apr 2014) | 1 line +Changed paths: + M /trunk/src/free_cache.c + +[free_cache.c] Avoid mixed declarations and code for ISO C90 support. +------------------------------------------------------------------------ +r9030 | vlefevre | 2014-04-15 13:01:25 +0000 (Tue, 15 Apr 2014) | 6 lines +Changed paths: + M /trunk/configure.ac + +Re-added configure test on GMP_NUMB_BITS and sizeof(mp_limb_t), and +updated it: + * BYTES_PER_MP_LIMB is no longer tested (see r9029). + * The test is now always run, not just when --with-gmp-build is used. + * Results are output in config.log in case of failure. + * The error message has been updated. +------------------------------------------------------------------------ +r9029 | zimmerma | 2014-04-15 09:15:31 +0000 (Tue, 15 Apr 2014) | 3 lines +Changed paths: + M /trunk/configure.ac + M /trunk/src/exp.c + M /trunk/src/init2.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/mul.c + M /trunk/src/rndna.c + M /trunk/src/stack_interface.c + +BYTES_PER_MP_LIMB -> MPFR_BYTES_PER_MP_LIMB for GMP 6 compatibility +when --with-gmp-build is used. See mailing-list discussion: + https://sympa.inria.fr/sympa/arc/mpfr/2014-04/msg00000.html +------------------------------------------------------------------------ +r9020 | zimmerma | 2014-03-26 06:49:35 +0000 (Wed, 26 Mar 2014) | 2 lines +Changed paths: + M /trunk/TODO + +other argument reduction for log_ui + +------------------------------------------------------------------------ +r9019 | zimmerma | 2014-03-25 20:40:42 +0000 (Tue, 25 Mar 2014) | 3 lines +Changed paths: + M /trunk/src/sqrt.c + +mpn_sqrtrem (rp, sp, sp, rrsize) is faster than +mpn_sqrtrem (rp, NULL, sp, rrsize): avoids one allocation and one copy + +------------------------------------------------------------------------ +r9016 | vlefevre | 2014-03-25 15:05:47 +0000 (Tue, 25 Mar 2014) | 4 lines +Changed paths: + M /trunk/src/add1.c + M /trunk/src/add1sp.c + M /trunk/src/check.c + M /trunk/src/cmp.c + M /trunk/src/init2.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mul.c + M /trunk/src/round_prec.c + M /trunk/src/set_dfl_prec.c + M /trunk/src/set_prc_raw.c + M /trunk/src/set_prec.c + M /trunk/src/sqrt.c + M /trunk/src/sub1.c + M /trunk/src/sub1sp.c + M /trunk/tests/tconst_pi.c + M /trunk/tests/tests.c + +Added MPFR_PREC_COND, MPFR_PREC_IN_RANGE and MPFR_GET_PREC internal +macros (to mpfr-impl.h). Use these macros at some places in the code +(replacing some MPFR_PREC instances, as suggested by a patch from +Patrick Pélissier). +------------------------------------------------------------------------ +r9015 | vlefevre | 2014-03-25 14:39:43 +0000 (Tue, 25 Mar 2014) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Added an MPFR_ASSERTD in MPFR_MPZ_SIZEINBASE2 +(from a patch by Patrick Pélissier). +------------------------------------------------------------------------ +r9014 | vlefevre | 2014-03-25 14:36:03 +0000 (Tue, 25 Mar 2014) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +[src/sqrt.c] Replaced a MPFR_EXP by MPFR_SET_EXP (from a patch by +Patrick Pélissier). +------------------------------------------------------------------------ +r9013 | vlefevre | 2014-03-25 14:28:48 +0000 (Tue, 25 Mar 2014) | 2 lines +Changed paths: + M /trunk/src/div.c + +[src/div.c] Added MPFR_ASSERTD assertions and improved a test +(patch from Patrick Pélissier). +------------------------------------------------------------------------ +r9011 | zimmerma | 2014-03-17 20:54:30 +0000 (Mon, 17 Mar 2014) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + +fixed FIXME + +------------------------------------------------------------------------ +r9010 | vlefevre | 2014-03-17 15:35:52 +0000 (Mon, 17 Mar 2014) | 9 lines +Changed paths: + M /trunk/doc/algorithms.bib + M /trunk/doc/algorithms.tex + +[doc/algorithms.*] A formula about radix conversion was incorrect +(and didn't match the correct code) when the output radix b is a +power of two. Added reference to Matula's "In-and-Out Conversions" +(correctness and optimality of the formula) and left a FIXME. +For more information, see the August/September discussion in the +MPFR list, particular subthreads starting at: + https://sympa.inria.fr/sympa/arc/mpfr/2012-08/msg00028.html + https://sympa.inria.fr/sympa/arc/mpfr/2012-09/msg00000.html + https://sympa.inria.fr/sympa/arc/mpfr/2012-09/msg00011.html +------------------------------------------------------------------------ +r9009 | zimmerma | 2014-03-15 08:26:10 +0000 (Sat, 15 Mar 2014) | 2 lines +Changed paths: + M /trunk/TODO + +added item + +------------------------------------------------------------------------ +r9008 | zimmerma | 2014-03-14 17:21:33 +0000 (Fri, 14 Mar 2014) | 2 lines +Changed paths: + M /trunk/TODO + +added item (mpfr_log_ui) + +------------------------------------------------------------------------ +r9002 | vlefevre | 2014-03-14 11:37:11 +0000 (Fri, 14 Mar 2014) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r9001 | vlefevre | 2014-03-14 11:35:17 +0000 (Fri, 14 Mar 2014) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Correction in the mpfr_set_str description. +------------------------------------------------------------------------ +r8998 | vlefevre | 2014-03-10 00:34:57 +0000 (Mon, 10 Mar 2014) | 2 lines +Changed paths: + M /trunk/TODO + M /trunk/src/gmp_op.c + +Added a TODO item concerning gmp_op.c functions with mpz_srcptr and +the use of mpz_fits_slong_p and a mpfr_*_si function (see r8992). +------------------------------------------------------------------------ +r8997 | vlefevre | 2014-03-02 08:32:16 +0000 (Sun, 02 Mar 2014) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Fixed the mpfr_get_default_rounding_mode() macro for +C++ (it didn't have the correct type), and improved the similar ones. +------------------------------------------------------------------------ +r8996 | vlefevre | 2014-03-02 08:12:34 +0000 (Sun, 02 Mar 2014) | 1 line +Changed paths: + M /trunk/src/lngamma.c + +[src/lngamma.c] Fixed allocation. +------------------------------------------------------------------------ +r8995 | vlefevre | 2014-03-02 08:07:31 +0000 (Sun, 02 Mar 2014) | 2 lines +Changed paths: + M /trunk/src/lngamma.c + +[src/lngamma.c] Temporarily disabled fast argument reconstruction +because it doesn't compile with g++. +------------------------------------------------------------------------ +r8994 | vlefevre | 2014-03-01 23:43:27 +0000 (Sat, 01 Mar 2014) | 1 line +Changed paths: + M /trunk/src/lngamma.c + +Removed trailing spaces. +------------------------------------------------------------------------ +r8993 | zimmerma | 2014-02-28 21:56:47 +0000 (Fri, 28 Feb 2014) | 3 lines +Changed paths: + M /trunk/src/lngamma.c + +[lngamma.c] implemented fast way of computing x*(x+1)*...*(x+k-1) + (it remains to speed up the computation of the Bernoulli numbers) + +------------------------------------------------------------------------ +r8992 | zimmerma | 2014-02-28 20:15:35 +0000 (Fri, 28 Feb 2014) | 2 lines +Changed paths: + M /trunk/src/gmp_op.c + +speedup of the mpfr_xxx_z functions when z fits in a long + +------------------------------------------------------------------------ +r8991 | zimmerma | 2014-02-28 19:49:15 +0000 (Fri, 28 Feb 2014) | 2 lines +Changed paths: + M /trunk/TODO + +explicit possible speedup in mpfr_[ln]gamma + +------------------------------------------------------------------------ +r8990 | vlefevre | 2014-02-24 15:29:52 +0000 (Mon, 24 Feb 2014) | 1 line +Changed paths: + M /trunk/doc/algorithms.tex + +[doc/algorithms.tex] Avoid inconsistent spaces. +------------------------------------------------------------------------ +r8989 | vlefevre | 2014-02-21 14:19:41 +0000 (Fri, 21 Feb 2014) | 1 line +Changed paths: + M /trunk/tools/mbench/README + +[tools/mbench/README] Conversion into UTF-8. +------------------------------------------------------------------------ +r8988 | vlefevre | 2014-02-21 14:12:39 +0000 (Fri, 21 Feb 2014) | 1 line +Changed paths: + M /trunk/tools/mbench/generate.c + M /trunk/tools/mbench/mfv5-crlibm.cc + M /trunk/tools/mbench/mfv5-libc.cc + M /trunk/tools/mbench/mfv5-mpfr.cc + M /trunk/tools/mbench/mfv5.cc + M /trunk/tools/mbench/mpfr-gfx.c + M /trunk/tools/mbench/mpfr-v4.c + M /trunk/tools/mbench/mpfr-v6.c + +[tools/mbench] Replaced GMP_RNDx by MPFR_RNDx. +------------------------------------------------------------------------ +r8987 | zimmerma | 2014-02-21 13:18:59 +0000 (Fri, 21 Feb 2014) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +definitively fix the name mpfr_min_prec + +------------------------------------------------------------------------ +r8986 | vlefevre | 2014-02-17 13:28:38 +0000 (Mon, 17 Feb 2014) | 1 line +Changed paths: + M /trunk/src/bernoulli.c + +[src/bernoulli.c] Minor bug fixed and other improvements. +------------------------------------------------------------------------ +r8985 | zimmerma | 2014-02-17 13:24:48 +0000 (Mon, 17 Feb 2014) | 2 lines +Changed paths: + M /trunk/TODO + +update for mpfr_gamma and Bernoulli numbers + +------------------------------------------------------------------------ +r8984 | vlefevre | 2014-02-17 13:08:24 +0000 (Mon, 17 Feb 2014) | 1 line +Changed paths: + M /trunk/src/bernoulli.c + +[src/bernoulli.c] Fixed pointer types (build failure with -Werror). +------------------------------------------------------------------------ +r8983 | vlefevre | 2014-02-17 13:02:58 +0000 (Mon, 17 Feb 2014) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Removed obsolete mpfr_bernoulli_internal prototype, +which makes the compilation of bernoulli.c fail. +------------------------------------------------------------------------ +r8982 | vlefevre | 2014-02-17 13:01:03 +0000 (Mon, 17 Feb 2014) | 1 line +Changed paths: + M /trunk/src/bernoulli.c + +[src/bernoulli.c] Improved isprime() by using MPFR_ASSERTD. +------------------------------------------------------------------------ +r8981 | zimmerma | 2014-02-17 12:46:18 +0000 (Mon, 17 Feb 2014) | 3 lines +Changed paths: + M /trunk/NEWS + M /trunk/src/bernoulli.c + +use a faster algorithm (based on Von Staudt–Clausen theorem) to compute +Bernoulli numbers -> speedup in mpfr_*gamma and mpfr_li2 + +------------------------------------------------------------------------ +r8980 | zimmerma | 2014-02-16 07:28:11 +0000 (Sun, 16 Feb 2014) | 2 lines +Changed paths: + M /trunk/src/set_d.c + M /trunk/tests/tset_d.c + +more changes suggested by Wolf Lammen (and also test 2^(-1074)) + +------------------------------------------------------------------------ +r8979 | vlefevre | 2014-02-16 02:52:21 +0000 (Sun, 16 Feb 2014) | 2 lines +Changed paths: + M /trunk/tests/memory.c + +[tests/memory.c] Limit heap memory to 4 MB. This should be sufficient. +Currently, only tsum should fail, but mpfr_sum will be rewritten soon. +------------------------------------------------------------------------ +r8978 | vlefevre | 2014-02-15 21:22:55 +0000 (Sat, 15 Feb 2014) | 2 lines +Changed paths: + M /trunk/src/set_d.c + +[src/set_d.c] Fixed type to avoid non-representable unsigned → signed +conversion. +------------------------------------------------------------------------ +r8977 | vlefevre | 2014-02-15 21:19:22 +0000 (Sat, 15 Feb 2014) | 1 line +Changed paths: + M /trunk/src/set_d.c + +[src/set_d.c] Correction when MPFR_WANT_ASSERT is defined. +------------------------------------------------------------------------ +r8976 | vlefevre | 2014-02-15 21:03:02 +0000 (Sat, 15 Feb 2014) | 1 line +Changed paths: + M /trunk/src/get_ld.c + M /trunk/src/set_ld.c + +Untabified and removed trailing spaces. +------------------------------------------------------------------------ +r8975 | zimmerma | 2014-02-15 20:20:27 +0000 (Sat, 15 Feb 2014) | 4 lines +Changed paths: + M /trunk/src/set_d.c + +partial patch from Wolf Lammen: +- move the normalization code, necessary in an extremely rare corner case only, + out of the way of the normal case, for speed up + +------------------------------------------------------------------------ +r8974 | zimmerma | 2014-02-15 09:37:01 +0000 (Sat, 15 Feb 2014) | 3 lines +Changed paths: + M /trunk/tests/mpfr-test.h + M /trunk/tests/tests.c + +Rename MPFR gmp_randstate_ptr into mpfr_gmp_randstate_ptr +(patch from Patrick Pélissier) + +------------------------------------------------------------------------ +r8973 | zimmerma | 2014-02-14 16:01:28 +0000 (Fri, 14 Feb 2014) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +print message for "possibly double-double, little endian" long double format + +------------------------------------------------------------------------ +r8972 | zimmerma | 2014-02-14 15:56:54 +0000 (Fri, 14 Feb 2014) | 2 lines +Changed paths: + M /trunk/src/cmp_ld.c + M /trunk/src/get_ld.c + M /trunk/src/set_ld.c + +different fixes for set_ld, get_ld and cmd_ld with double-double + +------------------------------------------------------------------------ +r8971 | vlefevre | 2014-02-14 12:37:36 +0000 (Fri, 14 Feb 2014) | 3 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Fixed an assertion to support systems where +2^1023 + 2^(-1074) is exactly representable, while not detected +as double-double. +------------------------------------------------------------------------ +r8970 | zimmerma | 2014-02-14 12:18:26 +0000 (Fri, 14 Feb 2014) | 3 lines +Changed paths: + M /trunk/acinclude.m4 + +recognize long-double format for ppc64le +(https://sympa.inria.fr/sympa/arc/mpfr/2014-02/msg00014.html) + +------------------------------------------------------------------------ +r8969 | vlefevre | 2014-02-14 10:25:22 +0000 (Fri, 14 Feb 2014) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Added item on special case of mpfr_add and mpfr_sub. +------------------------------------------------------------------------ +r8968 | zimmerma | 2014-02-14 08:11:02 +0000 (Fri, 14 Feb 2014) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +added test for get_ld + +------------------------------------------------------------------------ +r8967 | vlefevre | 2014-02-14 00:50:10 +0000 (Fri, 14 Feb 2014) | 9 lines +Changed paths: + M /trunk/src/cache.c + +[src/cache.c] + * Improved r8966: Setting the cache size to 10% more than the + requested precision may be a bad idea in large precisions. + It's better to guarantee a minimum of 10% increase; if the + user wants to, he can still control the maximum precision by + pre-computing the constant at this precision. Also make sure + that if pold == 0, the mpfr_init2 size is the same as the + mpfr_set_prec one (in order to avoid immediate reallocation). + * Replaced a comment by a couple of MPFR_ASSERTD's. +------------------------------------------------------------------------ +r8966 | zimmerma | 2014-02-13 18:25:08 +0000 (Thu, 13 Feb 2014) | 3 lines +Changed paths: + M /trunk/src/cache.c + +when recomputing a constant, use a precision 10% larger than the wanted +precision to avoid many recomputations + +------------------------------------------------------------------------ +r8965 | vlefevre | 2014-02-13 12:43:02 +0000 (Thu, 13 Feb 2014) | 1 line +Changed paths: + M /trunk/src/round_raw_generic.c + +[src/round_raw_generic.c] Added a FIXME comment for MPFR_RNDNA. +------------------------------------------------------------------------ +r8964 | vlefevre | 2014-02-13 12:34:07 +0000 (Thu, 13 Feb 2014) | 2 lines +Changed paths: + M /trunk/src/bernoulli.c + M /trunk/src/mpfr-impl.h + +[src/bernoulli.c] GNU style. +[src/mpfr-impl.h] Corrected prototypes. +------------------------------------------------------------------------ +r8963 | zimmerma | 2014-02-13 09:38:34 +0000 (Thu, 13 Feb 2014) | 3 lines +Changed paths: + M /trunk/src/bernoulli.c + M /trunk/src/digamma.c + M /trunk/src/free_cache.c + M /trunk/src/li2.c + M /trunk/src/lngamma.c + M /trunk/src/mpfr-impl.h + +implement cache for Bernoulli numbers (patch from Patrick Pélissier) +tuned parameters for [ln]gamma now that we cache Bernoulli numbers + +------------------------------------------------------------------------ +r8962 | zimmerma | 2014-02-13 09:23:44 +0000 (Thu, 13 Feb 2014) | 2 lines +Changed paths: + M /trunk/tools/bench/Makefile.am + +added bench target so that we can simply do "make bench" + +------------------------------------------------------------------------ +r8961 | zimmerma | 2014-02-12 21:29:39 +0000 (Wed, 12 Feb 2014) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +added test for double-double + +------------------------------------------------------------------------ +r8960 | zimmerma | 2014-02-12 20:10:20 +0000 (Wed, 12 Feb 2014) | 2 lines +Changed paths: + M /trunk/TODO + +added comment about mpfr_gamma + +------------------------------------------------------------------------ +r8959 | zimmerma | 2014-02-12 19:01:28 +0000 (Wed, 12 Feb 2014) | 2 lines +Changed paths: + M /trunk/src/gamma.c + +forgot to restore the exponents in last commit + +------------------------------------------------------------------------ +r8958 | zimmerma | 2014-02-12 18:25:03 +0000 (Wed, 12 Feb 2014) | 2 lines +Changed paths: + M /trunk/TODO + +added reference for efficiency issue with mpfr_gamma + +------------------------------------------------------------------------ +r8957 | zimmerma | 2014-02-12 18:20:51 +0000 (Wed, 12 Feb 2014) | 2 lines +Changed paths: + M /trunk/src/gamma.c + M /trunk/src/lngamma.c + +improve mpfr_gamma at around 1000 bits + +------------------------------------------------------------------------ +r8956 | vlefevre | 2014-02-12 02:46:10 +0000 (Wed, 12 Feb 2014) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r8954 | vlefevre | 2014-02-12 02:43:45 +0000 (Wed, 12 Feb 2014) | 17 lines +Changed paths: + M /trunk + M /trunk/doc/mpfr.texi + M /trunk/src/add_ui.c + M /trunk/src/cache.c + M /trunk/src/mpfr-impl.h + M /trunk/src/random_deviate.c + M /trunk/src/set_d.c + M /trunk/src/set_exp.c + M /trunk/src/set_f.c + M /trunk/src/sqrt_ui.c + M /trunk/src/sub_ui.c + M /trunk/src/ui_div.c + M /trunk/src/ui_sub.c + M /trunk/src/urandomb.c + M /trunk/tests/trandom.c + +Merged the set_exp branch into the trunk. Changes: + * src/mpfr-impl.h: updated the MPFR_SET_EXP(x, exp) definition for + the MPFR_EXP_CHECK case. There are 2 consequences: + 1. The exp expression is evaluated several times (this should be + OK with the MPFR code and optimizations). + 2. The real value of exp is tested for the assertion, instead of + the value converted to mpfr_exp_t. Thus new bugs could be found + (e.g. when an unsigned type is used instead of signed). + * src/set_exp.c: set the exponent only if x is a non-zero ordinary + number, i.e. already has a valid significand and a valid exponent + (thus it is no longer a low-level function, and it can no longer + generate an invalid value from a valid one). + * doc/mpfr.texi: updated mpfr_set_exp description and added an item + in the "API Compatibility / Changed Functions" section. + * Clean-up. +Original discussion: + https://sympa.inria.fr/sympa/arc/mpfr/2011-01/msg00092.html +------------------------------------------------------------------------ +r8953 | vlefevre | 2014-02-12 02:18:46 +0000 (Wed, 12 Feb 2014) | 1 line +Changed paths: + M /trunk/src/rint.c + +[src/rint.c] Added FIXME comment. +------------------------------------------------------------------------ +r8952 | vlefevre | 2014-02-12 02:13:50 +0000 (Wed, 12 Feb 2014) | 1 line +Changed paths: + M /trunk/src/next.c + +[src/next.c] Improved handling of special values. +------------------------------------------------------------------------ +r8949 | vlefevre | 2014-02-12 01:47:16 +0000 (Wed, 12 Feb 2014) | 2 lines +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] Bug fixes and code clean-up. At the same time, took the +future mpfr_set_exp change into account (see set_exp branch). +------------------------------------------------------------------------ +r8948 | vlefevre | 2014-02-12 00:55:41 +0000 (Wed, 12 Feb 2014) | 1 line +Changed paths: + M /trunk/src/set.c + +[src/set.c] Cosmetic change. +------------------------------------------------------------------------ +r8947 | vlefevre | 2014-02-12 00:47:31 +0000 (Wed, 12 Feb 2014) | 1 line +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] English usage. +------------------------------------------------------------------------ +r8945 | vlefevre | 2014-02-11 17:44:18 +0000 (Tue, 11 Feb 2014) | 1 line +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] Cosmetic change. +------------------------------------------------------------------------ +r8944 | vlefevre | 2014-02-11 16:33:23 +0000 (Tue, 11 Feb 2014) | 4 lines +Changed paths: + M /trunk + M /trunk/src/atan.c + +[src/atan.c] Fixed types of some variables, in particular +unsigned → signed conversion of non-representable value +(detected due to the new MPFR_SET_EXP assertion check in +the set_exp branch). +------------------------------------------------------------------------ +r8942 | vlefevre | 2014-02-11 16:20:25 +0000 (Tue, 11 Feb 2014) | 4 lines +Changed paths: + M /trunk + M /trunk/src/exp3.c + +[src/exp3.c] Fixed types of some variables, in particular +unsigned → signed conversion of non-representable value +(detected due to the new MPFR_SET_EXP assertion check in +the set_exp branch). +------------------------------------------------------------------------ +r8940 | vlefevre | 2014-02-11 14:40:11 +0000 (Tue, 11 Feb 2014) | 3 lines +Changed paths: + M /trunk + M /trunk/src/set_ui_2exp.c + M /trunk/src/set_uj.c + +[src/{set_ui_2exp.c,set_uj.c}] Fixed types of some variables, in +particular unsigned → signed conversion of non-representable value +under some conditions. +------------------------------------------------------------------------ +r8934 | vlefevre | 2014-02-11 13:59:39 +0000 (Tue, 11 Feb 2014) | 3 lines +Changed paths: + M /trunk + M /trunk/src/set_si_2exp.c + +[src/set_si_2exp.c] Fixed unsigned → signed conversion of +non-representable value when mpfr_exp_t has the same size +as int. +------------------------------------------------------------------------ +r8931 | vlefevre | 2014-02-11 13:51:47 +0000 (Tue, 11 Feb 2014) | 3 lines +Changed paths: + M /trunk + M /trunk/src/add_ui.c + +[src/add_ui.c] Fixed unsigned → signed conversion of non-representable +value (detected due to the new MPFR_SET_EXP assertion check in the +set_exp branch). +------------------------------------------------------------------------ +r8929 | vlefevre | 2014-02-11 13:43:55 +0000 (Tue, 11 Feb 2014) | 1 line +Changed paths: + M /trunk/src/random_deviate.c + +[src/random_deviate.c] Added an assertion. +------------------------------------------------------------------------ +r8928 | vlefevre | 2014-02-11 13:35:52 +0000 (Tue, 11 Feb 2014) | 3 lines +Changed paths: + M /trunk + M /trunk/tests/random2.c + +[tests/random2.c] Fixed unsigned → signed conversion of +non-representable value (detected due to the new MPFR_SET_EXP +assertion check in the set_exp branch). +------------------------------------------------------------------------ +r8922 | vlefevre | 2014-02-11 11:55:20 +0000 (Tue, 11 Feb 2014) | 1 line +Changed paths: + M /trunk/tools/bench + +Set svn:ignore property on the tools/bench directory. +------------------------------------------------------------------------ +r8921 | vlefevre | 2014-02-06 11:50:39 +0000 (Thu, 06 Feb 2014) | 1 line +Changed paths: + M /trunk/src/set_ld.c + +[src/set_ld.c] Added a note about the test for infinity. +------------------------------------------------------------------------ +r8920 | zimmerma | 2014-02-05 04:53:39 +0000 (Wed, 05 Feb 2014) | 2 lines +Changed paths: + M /trunk/tools/nightly-test + +make -> make mpfrbench + +------------------------------------------------------------------------ +r8919 | vlefevre | 2014-02-05 01:10:06 +0000 (Wed, 05 Feb 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + M /trunk/tests/tgeneric.c + M /trunk/tools/nightly-test + +Removed MPFR_CHECK_MAX as it is now useless: all "max" tests succeed. +------------------------------------------------------------------------ +r8918 | vlefevre | 2014-02-05 01:00:58 +0000 (Wed, 05 Feb 2014) | 2 lines +Changed paths: + M /trunk/src/lngamma.c + +[src/lngamma.c] Fixed bug introduced in the latest change r8917 +(inexact was not initialized in the case compared < 0). +------------------------------------------------------------------------ +r8917 | zimmerma | 2014-02-04 13:14:52 +0000 (Tue, 04 Feb 2014) | 2 lines +Changed paths: + M /trunk/src/lngamma.c + +added code for large inputs in lngamma/lgamma + +------------------------------------------------------------------------ +r8916 | vlefevre | 2014-02-04 12:53:29 +0000 (Tue, 04 Feb 2014) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Suggest timing-based thresholds for asymptotic expansions. +------------------------------------------------------------------------ +r8915 | zimmerma | 2014-02-04 12:20:47 +0000 (Tue, 04 Feb 2014) | 2 lines +Changed paths: + M /trunk/src/digamma.c + M /trunk/tests/data/digamma + +use asymptotic expansion for large positive argument + +------------------------------------------------------------------------ +r8914 | zimmerma | 2014-01-30 09:18:33 +0000 (Thu, 30 Jan 2014) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +tiny change to distinguish different versions of the manual + +------------------------------------------------------------------------ +r8913 | vlefevre | 2014-01-29 23:43:47 +0000 (Wed, 29 Jan 2014) | 5 lines +Changed paths: + M /trunk/src/constant.c + M /trunk/src/eint.c + M /trunk/src/erf.c + M /trunk/src/exp.c + M /trunk/src/exp_2.c + M /trunk/src/expm1.c + M /trunk/src/mpfr-impl.h + +[src] Add constants: + * __gmpfr_mone = -1 + * mpfr_const_log2_RNDD = log(2) rounded down in precision 64 bits + * mpfr_const_log2_RNDU = log(2) rounded up in precision 64 bits +(modified patch from Patrick Pélissier). +------------------------------------------------------------------------ +r8912 | zimmerma | 2014-01-29 17:02:50 +0000 (Wed, 29 Jan 2014) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + +added reference + +------------------------------------------------------------------------ +r8911 | vlefevre | 2014-01-29 01:08:00 +0000 (Wed, 29 Jan 2014) | 1 line +Changed paths: + M /trunk/src/exp_2.c + M /trunk/src/free_cache.c + M /trunk/src/mpfr-impl.h + +[src] mpz_t caching (modified patch by Patrick Pélissier). +------------------------------------------------------------------------ +r8910 | vlefevre | 2014-01-29 00:24:45 +0000 (Wed, 29 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/const_pi.c + +[src/const_pi.c] Rewrote a condition to avoid a potential +integer overflow (?) and match a comment. +------------------------------------------------------------------------ +r8909 | vlefevre | 2014-01-29 00:17:08 +0000 (Wed, 29 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/const_pi.c + +[src/const_pi.c] Use of GROUP allocation and minor optimization +(modified patch by Patrick Pélissier). +------------------------------------------------------------------------ +r8908 | vlefevre | 2014-01-28 03:58:36 +0000 (Tue, 28 Jan 2014) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Added a note about "rounding to odd" / "sticky rounding". +------------------------------------------------------------------------ +r8907 | vlefevre | 2014-01-27 08:17:37 +0000 (Mon, 27 Jan 2014) | 2 lines +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Run-time assertions concerning relations between +the MPFR exponent type and the long type are allowed (see r8896). +------------------------------------------------------------------------ +r8906 | vlefevre | 2014-01-26 02:43:37 +0000 (Sun, 26 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/mpf_compat.h + +[tests/mpf_compat.h] In MPFR mode, skip the tests when mpfr_exp_t is not +a long. +------------------------------------------------------------------------ +r8905 | vlefevre | 2014-01-26 02:39:15 +0000 (Sun, 26 Jan 2014) | 1 line +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Fixed printf argument. +------------------------------------------------------------------------ +r8904 | vlefevre | 2014-01-26 02:36:16 +0000 (Sun, 26 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/tgamma.c + +[tests/tgamma.c] Fixed printf argument (bug detected with +_MPFR_EXP_FORMAT=2 and -Werror=format=). +------------------------------------------------------------------------ +r8902 | vlefevre | 2014-01-26 01:20:50 +0000 (Sun, 26 Jan 2014) | 3 lines +Changed paths: + M /trunk/tools/bench/mpfrbench.c + +[tools/bench/mpfrbench.c] No longer use the numberof macro, and +#include "mpfr.h" instead of "mpfr-impl.h", so that mpfrbench.c +can now be linked against an installed MPFR library. +------------------------------------------------------------------------ +r8900 | vlefevre | 2014-01-24 15:17:15 +0000 (Fri, 24 Jan 2014) | 9 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/configure.ac + +Added MPFR_CHECK_GMP configure check. +Useful if the user provides --with-gmp with a directory containing +a GMP version that doesn't have the correct ABI: the previous tests +won't trigger the error if the same GMP version with the right ABI +is installed on the system, as this library is automatically +selected by the linker, while the header (which depends on the ABI) +of the --with-gmp include directory is used. Before this test, one +was getting an error in MPFR_CHECK_DBL2INT_BUG, though the error is +not related to a double-to-integer conversion bug. +------------------------------------------------------------------------ +r8899 | vlefevre | 2014-01-24 14:28:40 +0000 (Fri, 24 Jan 2014) | 10 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Corrections for the case _MPFR_EXP_FORMAT == 4: + * No longer use MPFR_EXP_MIN and MPFR_EXP_MAX unconditionally in + a #if directive, since if MPFR_HAVE_INTMAX_MAX is not defined, + the compilation fails. The test was not really useful anyway: + if one really wants mpfr_eexp_t to be long int if mpfr_exp_t + has the same range as long int, then _MPFR_EXP_FORMAT == 3 is + sufficient (and this is the default). + * Removed a test that should be always true due to the previous + inclusion of mpfr.h (intmax_t has already been used there in + the case _MPFR_EXP_FORMAT == 4). +------------------------------------------------------------------------ +r8898 | vlefevre | 2014-01-24 11:32:51 +0000 (Fri, 24 Jan 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Rephrased paragraph added in r8897. +------------------------------------------------------------------------ +r8897 | vlefevre | 2014-01-24 11:29:06 +0000 (Fri, 24 Jan 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added a note for Automake 1.13+ and failed tests. +------------------------------------------------------------------------ +r8896 | vlefevre | 2014-01-24 11:09:21 +0000 (Fri, 24 Jan 2014) | 6 lines +Changed paths: + M /trunk/src/cot.c + M /trunk/src/fpif.c + M /trunk/src/pow.c + M /trunk/src/print_rnd_mode.c + M /trunk/src/rec_sqrt.c + M /trunk/src/strtofr.c + M /trunk/src/urandom.c + +[src] Replaced some MPFR_ASSERTN's by MPFR_STAT_STATIC_ASSERT (from the +detection by mpfrlint). Note: the MPFR_ASSERTN's concerning relations +between the MPFR exponent type and the long type have not been replaced +because these tests may fail with the non-standard _MPFR_EXP_FORMAT = 4 +on some platforms (e.g. 32-bit ones), and we still want to be able to +build MPFR in this case in order to test it; this needs to be fixed. +------------------------------------------------------------------------ +r8895 | vlefevre | 2014-01-24 10:24:22 +0000 (Fri, 24 Jan 2014) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Constant checking in assertions. +------------------------------------------------------------------------ +r8894 | vlefevre | 2014-01-24 10:21:59 +0000 (Fri, 24 Jan 2014) | 1 line +Changed paths: + M /trunk/src/mpfr-mini-gmp.c + +[src/mpfr-mini-gmp.c] Use lower case for function parameters. +------------------------------------------------------------------------ +r8893 | zimmerma | 2014-01-24 08:04:25 +0000 (Fri, 24 Jan 2014) | 2 lines +Changed paths: + M /trunk/tune/tuneup.c + +re-enable assertions (patch from Patrick Pélissier) + +------------------------------------------------------------------------ +r8892 | zimmerma | 2014-01-24 08:00:18 +0000 (Fri, 24 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/add1sp.c + +removed an MPFR_LIKELY that is not so likely... + +------------------------------------------------------------------------ +r8891 | vlefevre | 2014-01-24 02:52:15 +0000 (Fri, 24 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/add1.c + M /trunk/src/add1sp.c + M /trunk/src/atan.c + M /trunk/src/cache.c + M /trunk/src/cmp2.c + M /trunk/src/set_d.c + M /trunk/src/set_ld.c + M /trunk/src/set_z_exp.c + M /trunk/src/sub1sp.c + +Optimization: likely / unlikely, etc. (patch by Patrick Pélissier). +Coding style. +------------------------------------------------------------------------ +r8890 | vlefevre | 2014-01-24 02:41:55 +0000 (Fri, 24 Jan 2014) | 2 lines +Changed paths: + M /trunk/tune/tuneup.c + +[tune/tuneup.c] Fix compilation error due to static assertion being +wrong (patch by Patrick Pélissier). +------------------------------------------------------------------------ +r8889 | vlefevre | 2014-01-24 02:39:30 +0000 (Fri, 24 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/const_log2.c + +[src/const_log2.c] Optimization by using GROUP allocation (patch +by Patrick Pélissier). +------------------------------------------------------------------------ +r8888 | vlefevre | 2014-01-24 02:37:59 +0000 (Fri, 24 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/exp_2.c + +[src/exp_2.c] Optimization: Increase the initial estimate of the number +of iterations (patch by Patrick Pélissier). +------------------------------------------------------------------------ +r8887 | vlefevre | 2014-01-24 02:36:05 +0000 (Fri, 24 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/erfc.c + +[src/erfc.c] Use of static assertion instead of run time assertion +(patch by Patrick Pélissier). +------------------------------------------------------------------------ +r8886 | vlefevre | 2014-01-24 02:35:02 +0000 (Fri, 24 Jan 2014) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Removed trailing spaces. +------------------------------------------------------------------------ +r8885 | vlefevre | 2014-01-24 02:33:48 +0000 (Fri, 24 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/sin_cos.c + +[src/sin_cos.c] Optimization: use of MPFR_MPZ_SIZEINBASE2, GROUP +allocation, and MPFR_ALIAS (modified patch by Patrick Pélissier). +------------------------------------------------------------------------ +r8884 | vlefevre | 2014-01-24 02:25:02 +0000 (Fri, 24 Jan 2014) | 2 lines +Changed paths: + M /trunk/tools/mbench/mfv5-libc.cc + +[tools/mbench/mfv5-libc.cc] Fix warning when compiling with recent GCC +due to unused but set variable (patch by Patrick Pélissier). +------------------------------------------------------------------------ +r8883 | zimmerma | 2014-01-23 21:15:27 +0000 (Thu, 23 Jan 2014) | 5 lines +Changed paths: + M /trunk/tools/bench/Makefile.am + +revert to EXTRA_PROGRAMS (bin_PROGRAMS is installed in /usr/local/bin, +which is not what we want, we could use noinst_PROGRAMS, which would be +compiled automatically, but for coherence with GNU MPC we use EXTRA_PROGRAMS +which is not compiled automatically) + +------------------------------------------------------------------------ +r8881 | zimmerma | 2014-01-23 18:31:37 +0000 (Thu, 23 Jan 2014) | 2 lines +Changed paths: + M /trunk/tools/bench/mpfrbench.c + +divide the global score to get a number around 1000 + +------------------------------------------------------------------------ +r8880 | zimmerma | 2014-01-23 18:02:05 +0000 (Thu, 23 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/sum.c + +added reference + +------------------------------------------------------------------------ +r8879 | zimmerma | 2014-01-23 16:56:55 +0000 (Thu, 23 Jan 2014) | 2 lines +Changed paths: + M /trunk/tools/mbench/mfv5.cc + +gnu style + +------------------------------------------------------------------------ +r8878 | vlefevre | 2014-01-23 15:17:07 +0000 (Thu, 23 Jan 2014) | 4 lines +Changed paths: + M /trunk/doc/README.dev + A /trunk/libtool-tcc-wl.patch + +Added libtool-tcc-wl.patch patch from + http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=663945#46 +to add tcc support to libtool 2.4.2 and below. +In doc/README.dev, documented how to use this patch (before a release). +------------------------------------------------------------------------ +r8877 | vlefevre | 2014-01-23 12:26:17 +0000 (Thu, 23 Jan 2014) | 4 lines +Changed paths: + M /trunk/tests/tadd.c + M /trunk/tests/tsum.c + +[tests/tadd.c] Added check_extreme test (huge + tiny). +[tests/tsum.c] Added check_extreme test (same test as in tadd.c, + but with mpfr_sum instead of mpfr_add), and temporarily disabled + the cancel test. +------------------------------------------------------------------------ +r8876 | vlefevre | 2014-01-23 11:50:17 +0000 (Thu, 23 Jan 2014) | 1 line +Changed paths: + M /trunk/src/mulders.c + M /trunk/tests/tadd.c + M /trunk/tests/tatan.c + M /trunk/tests/tfma.c + M /trunk/tests/tfms.c + M /trunk/tests/tl2b.c + M /trunk/tests/tnext.c + M /trunk/tests/tpow_all.c + M /trunk/tests/tsubnormal.c + M /trunk/tests/tsum.c + M /trunk/tools/bench/mpfrbench.c + M /trunk/tune/speed.c + +Use of the numberof macro. +------------------------------------------------------------------------ +r8875 | vlefevre | 2014-01-23 11:32:16 +0000 (Thu, 23 Jan 2014) | 1 line +Changed paths: + M /trunk/tools/bench/mpfrbench.c + +[tools/bench/mpfrbench.c] Whitespace clean-up. +------------------------------------------------------------------------ +r8874 | vlefevre | 2014-01-23 11:28:06 +0000 (Thu, 23 Jan 2014) | 1 line +Changed paths: + M /trunk/src/const_euler.c + +[src/const_euler.c] Removed trailing spaces. +------------------------------------------------------------------------ +r8873 | vlefevre | 2014-01-23 11:24:30 +0000 (Thu, 23 Jan 2014) | 2 lines +Changed paths: + M /trunk/tools/bench/Makefile.am + +[tools/bench/Makefile.am] Fix for separate build directory (problem +detected with "make distcheck"). +------------------------------------------------------------------------ +r8872 | vlefevre | 2014-01-23 09:17:10 +0000 (Thu, 23 Jan 2014) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Updated comment. +------------------------------------------------------------------------ +r8871 | vlefevre | 2014-01-23 09:08:55 +0000 (Thu, 23 Jan 2014) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Updated comment. +------------------------------------------------------------------------ +r8870 | vlefevre | 2014-01-23 09:06:21 +0000 (Thu, 23 Jan 2014) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Added a possible algorithm in comment. +------------------------------------------------------------------------ +r8869 | vlefevre | 2014-01-23 08:41:50 +0000 (Thu, 23 Jan 2014) | 1 line +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Added FIXME comment. +------------------------------------------------------------------------ +r8868 | zimmerma | 2014-01-22 20:27:28 +0000 (Wed, 22 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/reuse.c + +missing space + +------------------------------------------------------------------------ +r8867 | zimmerma | 2014-01-22 18:26:49 +0000 (Wed, 22 Jan 2014) | 2 lines +Changed paths: + M /trunk/AUTHORS + M /trunk/doc/mpfr.texi + +Mickaël is the only author of MPFRbench + +------------------------------------------------------------------------ +r8866 | zimmerma | 2014-01-22 18:12:19 +0000 (Wed, 22 Jan 2014) | 2 lines +Changed paths: + M /trunk/AUTHORS + M /trunk/doc/mpfr.texi + +updated authors and contributors + +------------------------------------------------------------------------ +r8865 | zimmerma | 2014-01-22 16:58:29 +0000 (Wed, 22 Jan 2014) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/src/const_euler.c + +new code for Euler's constant (contributed by Fredrik Johansson) + +------------------------------------------------------------------------ +r8864 | zimmerma | 2014-01-22 16:25:34 +0000 (Wed, 22 Jan 2014) | 2 lines +Changed paths: + M /trunk/Makefile.am + +added subdir tools/bench + +------------------------------------------------------------------------ +r8863 | zimmerma | 2014-01-22 15:16:09 +0000 (Wed, 22 Jan 2014) | 2 lines +Changed paths: + M /trunk/tools/nightly-test + +added MPFRbench + +------------------------------------------------------------------------ +r8862 | zimmerma | 2014-01-22 15:14:55 +0000 (Wed, 22 Jan 2014) | 2 lines +Changed paths: + M /trunk/NEWS + +added MPFRbench + +------------------------------------------------------------------------ +r8861 | zimmerma | 2014-01-22 15:07:15 +0000 (Wed, 22 Jan 2014) | 2 lines +Changed paths: + M /trunk/tools/bench/Makefile.am + +make mpfrbench compiled just with "make" + +------------------------------------------------------------------------ +r8860 | zimmerma | 2014-01-22 15:02:42 +0000 (Wed, 22 Jan 2014) | 2 lines +Changed paths: + M /trunk/configure.ac + +changes for MPFRbench + +------------------------------------------------------------------------ +r8859 | zimmerma | 2014-01-22 15:02:13 +0000 (Wed, 22 Jan 2014) | 2 lines +Changed paths: + A /trunk/tools/bench + A /trunk/tools/bench/Makefile.am + A /trunk/tools/bench/benchtime.h + A /trunk/tools/bench/mpfrbench.c + +new directory for MPFRbench (contributed by Mickaël Gastineau and Bill Hart) + +------------------------------------------------------------------------ +r8858 | vlefevre | 2014-01-22 14:38:28 +0000 (Wed, 22 Jan 2014) | 1 line +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Added a comment about the cancellation test. +------------------------------------------------------------------------ +r8857 | vlefevre | 2014-01-22 14:32:58 +0000 (Wed, 22 Jan 2014) | 1 line +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] In the cancellation test, do a random permutation. +------------------------------------------------------------------------ +r8856 | zimmerma | 2014-01-22 14:30:28 +0000 (Wed, 22 Jan 2014) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +mention sponsors + +------------------------------------------------------------------------ +r8855 | vlefevre | 2014-01-22 14:26:03 +0000 (Wed, 22 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] In the cancellation test: reduced the number of tests; +output debug information when building with -DDEBUG. +------------------------------------------------------------------------ +r8854 | vlefevre | 2014-01-22 14:12:16 +0000 (Wed, 22 Jan 2014) | 1 line +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Added simple cancellation test. +------------------------------------------------------------------------ +r8853 | vlefevre | 2014-01-22 13:52:25 +0000 (Wed, 22 Jan 2014) | 1 line +Changed paths: + M /trunk/tests/tests.c + +[tests/tests.c] Fixed tests_default_random in case mpfr_exp_t > long. +------------------------------------------------------------------------ +r8852 | vlefevre | 2014-01-22 13:39:18 +0000 (Wed, 22 Jan 2014) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Improved mpfr_sum description. +------------------------------------------------------------------------ +r8851 | vlefevre | 2014-01-22 13:33:55 +0000 (Wed, 22 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/sum.c + +[src/sum.c] Do not use bitwise operations on values that can be +negative. Added comments about what the functions do. +------------------------------------------------------------------------ +r8850 | zimmerma | 2014-01-22 12:25:17 +0000 (Wed, 22 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/sqrt.c + +fixed regression noticed by Patrick Pelissier with --enable-gmp-internals + +------------------------------------------------------------------------ +r8849 | vlefevre | 2014-01-22 12:23:01 +0000 (Wed, 22 Jan 2014) | 1 line +Changed paths: + M /trunk/tests/tests.c + +[tests/tests.c] Fixed bug in test_version() introduced in r8821. +------------------------------------------------------------------------ +r8847 | vlefevre | 2014-01-22 10:41:11 +0000 (Wed, 22 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/lngamma.c + M /trunk/tests/tlngamma.c + +[src/lngamma.c] Fixed divide-by-zero flag for negative integers. +[tests/tlngamma.c] Test the flags for some special values. Clean-up. +------------------------------------------------------------------------ +r8846 | zimmerma | 2014-01-22 10:21:59 +0000 (Wed, 22 Jan 2014) | 2 lines +Changed paths: + M /trunk/TODO + +removed two items done + +------------------------------------------------------------------------ +r8843 | vlefevre | 2014-01-21 17:40:44 +0000 (Tue, 21 Jan 2014) | 3 lines +Changed paths: + M /trunk/src/exp.c + M /trunk/src/exp_2.c + M /trunk/src/round_prec.c + +[src/{exp.c,exp_2.c}] mpfr_exp optimization (modified patch + by Patrick Pélissier). +[src/round_prec.c] Added a note about the reallocation. +------------------------------------------------------------------------ +r8842 | vlefevre | 2014-01-21 17:17:53 +0000 (Tue, 21 Jan 2014) | 1 line +Changed paths: + M /trunk/src/round_prec.c + M /trunk/src/set_exp.c + +LIKELY some code. +------------------------------------------------------------------------ +r8841 | vlefevre | 2014-01-21 16:32:49 +0000 (Tue, 21 Jan 2014) | 7 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/lngamma.c + M /trunk/tests/tlngamma.c + +[src/lngamma.c] Fixed mpfr_lngamma behavior on nonpositive integers + and -Inf. +[doc/mpfr.texi] Updated the documentation on the general rules for + special values and on mpfr_lngamma. +[tests/tlngamma.c] Update. +See +(behavior of mpfr_lngamma on zero and general rule for such limits). +------------------------------------------------------------------------ +r8840 | vlefevre | 2014-01-21 15:50:01 +0000 (Tue, 21 Jan 2014) | 4 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/configure.ac + +[acinclude.m4,configure.ac] Check that a directory passed to +a --with-gmp* configure option exists and doesn't contain any +space, and canonicalize the name if the realpath utility is +available (patch by Patrick Pélissier). +------------------------------------------------------------------------ +r8835 | vlefevre | 2014-01-21 14:24:32 +0000 (Tue, 21 Jan 2014) | 1 line +Changed paths: + M /trunk/src/mul.c + +[src/mul.c] Optimization (modified patch by Patrick Pélissier). +------------------------------------------------------------------------ +r8834 | vlefevre | 2014-01-21 14:17:54 +0000 (Tue, 21 Jan 2014) | 3 lines +Changed paths: + M /trunk/src/abort_prec_max.c + M /trunk/src/add.c + M /trunk/src/add1.c + M /trunk/src/add1sp.c + M /trunk/src/add_ui.c + M /trunk/src/clear.c + M /trunk/src/cmp.c + M /trunk/src/div.c + M /trunk/src/div_2si.c + M /trunk/src/div_ui.c + M /trunk/src/exceptions.c + M /trunk/src/init2.c + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + M /trunk/src/mul.c + M /trunk/src/mul_ui.c + M /trunk/src/set.c + M /trunk/src/set_prec.c + M /trunk/src/set_ui_2exp.c + M /trunk/src/sub.c + M /trunk/src/sub1sp.c + +[src] Added support for MPFR_PURE_FUNCTION_ATTR, MPFR_HOT_FUNCTION_ATTR, +and MPFR_COLD_FUNCTION_ATTR, and fixed some LIKELY/UNLIKELY conditions +(modified patch by Patrick Pélissier). +------------------------------------------------------------------------ +r8833 | vlefevre | 2014-01-21 13:57:50 +0000 (Tue, 21 Jan 2014) | 7 lines +Changed paths: + M /trunk/src/atanh.c + M /trunk/src/cot.c + M /trunk/src/coth.c + M /trunk/src/csc.c + M /trunk/src/csch.c + M /trunk/src/digamma.c + M /trunk/src/div.c + M /trunk/src/div_ui.c + M /trunk/src/eint.c + M /trunk/src/erfc.c + M /trunk/src/gamma.c + M /trunk/src/hypot.c + M /trunk/src/lngamma.c + M /trunk/src/log.c + M /trunk/src/log10.c + M /trunk/src/log1p.c + M /trunk/src/log2.c + M /trunk/src/mpfr-impl.h + M /trunk/src/pow.c + M /trunk/src/pow_si.c + M /trunk/src/pow_z.c + M /trunk/src/rec_sqrt.c + M /trunk/src/round_near_x.c + M /trunk/src/subnormal.c + M /trunk/src/ui_div.c + M /trunk/src/yn.c + M /trunk/src/zeta.c + M /trunk/src/zeta_ui.c + M /trunk/tools/mpfrlint + +[src/*.c] Replaced mpfr_set_divby0 by the faster MPFR_SET_DIVBY0, + and so on (except for src/exceptions.c). +[tools/mpfrlint] Update for flags related functions: check that + the macros are used in src (except for exceptions.c and mpfr.h) + instead of the functions. +[src/mpfr-impl.h] Removed some useless parentheses in comments, + for mpfrlint. +------------------------------------------------------------------------ +r8832 | zimmerma | 2014-01-21 12:57:53 +0000 (Tue, 21 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/tfma.c + M /trunk/tests/tfms.c + +added more detail in case of error + +------------------------------------------------------------------------ +r8831 | vlefevre | 2014-01-21 11:21:18 +0000 (Tue, 21 Jan 2014) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Added MPFR_SET_* macros to set flags efficiently. +------------------------------------------------------------------------ +r8830 | vlefevre | 2014-01-21 11:05:35 +0000 (Tue, 21 Jan 2014) | 1 line +Changed paths: + M /trunk/src/erf.c + +Small mpfr_erf improvement (modified patch by Patrick Pélissier). +------------------------------------------------------------------------ +r8829 | vlefevre | 2014-01-21 10:51:48 +0000 (Tue, 21 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/mpfr-gmp.h + +[src/mpfr-gmp.h] TMP_FREE optimization as tmp_marker is often null +(based on a patch by Patrick Pélissier). +------------------------------------------------------------------------ +r8828 | vlefevre | 2014-01-21 10:36:26 +0000 (Tue, 21 Jan 2014) | 1 line +Changed paths: + M /trunk/configure.ac + +[configure.ac] --enable-mini-gmp message: fixed layout; experimental. +------------------------------------------------------------------------ +r8827 | vlefevre | 2014-01-21 10:33:27 +0000 (Tue, 21 Jan 2014) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Mini-gmp support is experimental. +------------------------------------------------------------------------ +r8826 | vlefevre | 2014-01-21 10:32:01 +0000 (Tue, 21 Jan 2014) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Mention the new --enable-mini-gmp configure option. +------------------------------------------------------------------------ +r8825 | vlefevre | 2014-01-21 10:30:24 +0000 (Tue, 21 Jan 2014) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Mini-gmp support. +------------------------------------------------------------------------ +r8824 | vlefevre | 2014-01-21 10:28:29 +0000 (Tue, 21 Jan 2014) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] MPFR now depends on GMP 4.2+. Dropped K&R C compatibility. +------------------------------------------------------------------------ +r8823 | vlefevre | 2014-01-21 10:25:38 +0000 (Tue, 21 Jan 2014) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Better Automake 1.13 support. +------------------------------------------------------------------------ +r8821 | vlefevre | 2014-01-21 09:54:21 +0000 (Tue, 21 Jan 2014) | 20 lines +Changed paths: + M /trunk + M /trunk/tests/Makefile.am + M /trunk/tests/mpfr-test.h + M /trunk/tests/tests.c + M /trunk/tests/tversion.c + +Merged the vl-am113 branch: test suite improvement with Automake 1.13. + * Moved GMP version check from tversion.c to the test_version() + function of tests.c, so that this check is done in every test. + This function now returns an int, as there are now 3 cases: + 1. An error in MPFR version check is a fatal error: test_version() + exits with an error (exit status = 1). + 2. An error in GMP version check is a non-fatal error: if there + are no errors in MPFR version check, test_version() returns + with value 1. + 3. Otherwise test_version() returns with value 0 (everything is + fine). + * tversion.c still runs test_version(), but fails if this function + returns with an error, i.e. any error is fatal for this test. + Note: for the other tests, one just has a message in the output + in case of GMP version mismatch. + * mpfr-test.h: updated test_version() prototype. + * Makefile.am: removed the second tversion invocation, and output + the contents of tversion.log if this file exists (typically with + Automake 1.13+, for which one no longer gets tversion output by + default). +------------------------------------------------------------------------ +r8819 | vlefevre | 2014-01-20 22:30:05 +0000 (Mon, 20 Jan 2014) | 1 line +Changed paths: + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-mini-gmp.h + M /trunk/src/mpfr.h + M /trunk/tests/tvalist.c + +Dropped obsolete __gmp_const (replaced by const). +------------------------------------------------------------------------ +r8818 | vlefevre | 2014-01-20 22:27:00 +0000 (Mon, 20 Jan 2014) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Removed mini-gmp support: done. +------------------------------------------------------------------------ +r8817 | vlefevre | 2014-01-20 22:11:52 +0000 (Mon, 20 Jan 2014) | 1 line +Changed paths: + M /trunk/src/exp.c + +Small mpfr_exp improvement (modified patch by Patrick Pélissier). +------------------------------------------------------------------------ +r8816 | vlefevre | 2014-01-20 18:17:47 +0000 (Mon, 20 Jan 2014) | 2 lines +Changed paths: + M /trunk/tools/mbench/Makefile + M /trunk/tools/mbench/mfv5.cc + M /trunk/tools/mbench/mfv5.h + M /trunk/tools/mbench/timp.h + +[tools/mbench] Patch by Patrick Pélissier: import base support, +corei7 support, build fix (with MPFR 3.1+). +------------------------------------------------------------------------ +r8815 | zimmerma | 2014-01-20 18:00:57 +0000 (Mon, 20 Jan 2014) | 5 lines +Changed paths: + M /trunk/src/fma.c + +come back to revision 8723 which was faster (measured with tools/mbench/mfv5 +on 53 and 1024 bits). The reason is that the "new" version had overhead for +mpfr_round_p (about 40 cycles on Core 2) and mpfr_set (about 98 cycles for +53 bits, and 132 cycles for 1024 bits) + +------------------------------------------------------------------------ +r8814 | vlefevre | 2014-01-20 18:00:40 +0000 (Mon, 20 Jan 2014) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/src/mpfr-impl.h + +Added __builtin_unreachable / MPFR_ASSUME support (modified patch +from Patrick Pélissier). +------------------------------------------------------------------------ +r8813 | vlefevre | 2014-01-20 17:44:03 +0000 (Mon, 20 Jan 2014) | 4 lines +Changed paths: + M /trunk/configure.ac + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/mulders.c + M /trunk/tests/memory.c + M /trunk/tests/mpfr-test.h + M /trunk/tests/tests.c + +MPFR now depends on GMP 4.2+ instead of 4.1+. +GMP 4.2 compatibility fixed. +Code clean-up. +(Modified patch from Patrick Pélissier) +------------------------------------------------------------------------ +r8812 | vlefevre | 2014-01-20 17:38:46 +0000 (Mon, 20 Jan 2014) | 1 line +Changed paths: + M /trunk/src/fms.c + +[src/fms.c] Coding style. +------------------------------------------------------------------------ +r8811 | vlefevre | 2014-01-20 17:37:52 +0000 (Mon, 20 Jan 2014) | 1 line +Changed paths: + M /trunk/src/fma.c + +[src/fma.c] Changed mp_prec_t to mpfr_prec_t. +------------------------------------------------------------------------ +r8810 | zimmerma | 2014-01-20 17:20:08 +0000 (Mon, 20 Jan 2014) | 2 lines +Changed paths: + M /trunk/tools/mbench/mfv5-mpfr.cc + +added mpfr_fma + +------------------------------------------------------------------------ +r8808 | zimmerma | 2014-01-20 16:44:32 +0000 (Mon, 20 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/fma.c + +speed up mpfr_fma [common work with Jeroen Demeyer] + +------------------------------------------------------------------------ +r8805 | zimmerma | 2014-01-20 14:39:19 +0000 (Mon, 20 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/fms.c + +simplified the fms code (joint work with Jeroen Demeyer) + +------------------------------------------------------------------------ +r8802 | zimmerma | 2014-01-20 12:01:38 +0000 (Mon, 20 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/exp3.c + M /trunk/tests/texp.c + +fixed bug in mpfr_exp_3, and memory leak in texp + +------------------------------------------------------------------------ +r8799 | vlefevre | 2014-01-20 11:06:11 +0000 (Mon, 20 Jan 2014) | 3 lines +Changed paths: + M /trunk/src/li2.c + +[src/li2.c] Use MPFR_RET_NEVER_GO_HERE () instead of MPFR_ASSERTN (0) +to avoid an error with: + ./configure --enable-logging CFLAGS="-Werror=return-type"; make +------------------------------------------------------------------------ +r8798 | vlefevre | 2014-01-20 11:04:16 +0000 (Mon, 20 Jan 2014) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Updated comment of the MPFR_RET_NEVER_GO_HERE macro. +------------------------------------------------------------------------ +r8797 | zimmerma | 2014-01-20 10:07:18 +0000 (Mon, 20 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/texp.c + +added new test that currently fails (found with mini-gmp) + +------------------------------------------------------------------------ +r8796 | vlefevre | 2014-01-18 23:26:00 +0000 (Sat, 18 Jan 2014) | 3 lines +Changed paths: + M /trunk/doc/algorithms.tex + M /trunk/doc/mpfr.texi + M /trunk/src/factorial.c + M /trunk/src/mpfr-impl.h + M /trunk/src/sub1.c + +Spelling consistency: + non-negative → nonnegative + non-positive → nonpositive +------------------------------------------------------------------------ +r8795 | vlefevre | 2014-01-18 23:21:07 +0000 (Sat, 18 Jan 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] More on exponent handling. +------------------------------------------------------------------------ +r8794 | vlefevre | 2014-01-18 22:43:28 +0000 (Sat, 18 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/tset_str.c + +[tests/tset_str.c] Fixed and improved a mpfr_set_str_binary random test. +Some code clean-up. +------------------------------------------------------------------------ +r8793 | vlefevre | 2014-01-18 21:40:37 +0000 (Sat, 18 Jan 2014) | 1 line +Changed paths: + M /trunk/tests/tset_str.c + +[tests/tset_str.c] Removed useless and confusing cast. +------------------------------------------------------------------------ +r8792 | vlefevre | 2014-01-18 20:32:19 +0000 (Sat, 18 Jan 2014) | 1 line +Changed paths: + M /trunk/src/set_d.c + +[src/set_d.c] Improved a comment about signed zeros. +------------------------------------------------------------------------ +r8791 | zimmerma | 2014-01-18 18:50:30 +0000 (Sat, 18 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/mpfr-mini-gmp.c + +fixed memory leak + +------------------------------------------------------------------------ +r8790 | zimmerma | 2014-01-18 09:41:16 +0000 (Sat, 18 Jan 2014) | 2 lines +Changed paths: + A /trunk/doc/mini-gmp + +instructions to compile MPFR with mini-gmp + +------------------------------------------------------------------------ +r8789 | zimmerma | 2014-01-18 09:32:32 +0000 (Sat, 18 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/tabort_defalloc1.c + M /trunk/tests/tabort_defalloc2.c + +disable those tests for mini-gmp + +------------------------------------------------------------------------ +r8788 | zimmerma | 2014-01-18 09:17:16 +0000 (Sat, 18 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/tset_str.c + +fixed test which might produce subnormal numbers + +------------------------------------------------------------------------ +r8787 | zimmerma | 2014-01-18 08:44:32 +0000 (Sat, 18 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/trandom.c + M /trunk/tests/turandom.c + +disable two tests that depend on the random generator + +------------------------------------------------------------------------ +r8786 | zimmerma | 2014-01-18 08:38:03 +0000 (Sat, 18 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/tui_pow.c + +followup from previous commit: 1^Inf is special too + +------------------------------------------------------------------------ +r8785 | zimmerma | 2014-01-18 08:36:54 +0000 (Sat, 18 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/tui_pow.c + +fixed issue for n^x with x=Inf when the random number n is 0 + +------------------------------------------------------------------------ +r8784 | zimmerma | 2014-01-18 08:28:01 +0000 (Sat, 18 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/tfms.c + +fixed issue when x=0 and y=Inf (or converse) + +------------------------------------------------------------------------ +r8783 | zimmerma | 2014-01-18 08:26:02 +0000 (Sat, 18 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/tfma.c + +fixed issue when x=0 and y=Inf (or converse) + +------------------------------------------------------------------------ +r8782 | zimmerma | 2014-01-18 08:17:41 +0000 (Sat, 18 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/tget_str.c + +fixed bug in test file + +------------------------------------------------------------------------ +r8781 | vlefevre | 2014-01-18 01:28:25 +0000 (Sat, 18 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/set_d.c + +[src/set_d.c] Fixes and other minor changes suggested by Wolf Lammen: +https://sympa.inria.fr/sympa/arc/mpfr/2014-01/msg00007.html +------------------------------------------------------------------------ +r8780 | vlefevre | 2014-01-18 00:55:24 +0000 (Sat, 18 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/set_d.c + +[src/set_d.c] In extract_double, replaced long by int for exp (it may be +faster, and shouldn't be slower as it is more restrictive than long). +------------------------------------------------------------------------ +r8779 | vlefevre | 2014-01-18 00:45:20 +0000 (Sat, 18 Jan 2014) | 1 line +Changed paths: + M /trunk/src/set_d.c + +[src/set_d.c] Removed obsolete comment from r245. +------------------------------------------------------------------------ +r8778 | vlefevre | 2014-01-18 00:40:26 +0000 (Sat, 18 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/set_d.c + +[src/set_d.c] Renamed __gmpfr_extract_double to extract_double +(this is just a static function). +------------------------------------------------------------------------ +r8777 | vlefevre | 2014-01-18 00:30:24 +0000 (Sat, 18 Jan 2014) | 3 lines +Changed paths: + M /trunk/src/set_d.c + +[src/set_d.c] Fixed __gmpfr_extract_double precondition on d. +Bug found by Wolf Lammen: + https://sympa.inria.fr/sympa/arc/mpfr/2014-01/msg00007.html +------------------------------------------------------------------------ +r8776 | zimmerma | 2014-01-18 00:18:28 +0000 (Sat, 18 Jan 2014) | 6 lines +Changed paths: + M /trunk/src/mpfr-mini-gmp.c + M /trunk/src/mpfr-mini-gmp.h + M /trunk/tests/tset_str.c + +more progress with mini-gmp: +======================= +9 of 157 tests failed +(13 tests were not run) +======================= + +------------------------------------------------------------------------ +r8775 | vlefevre | 2014-01-18 00:09:17 +0000 (Sat, 18 Jan 2014) | 1 line +Changed paths: + M /trunk/tests/ty0.c + M /trunk/tests/ty1.c + +[tests/{ty0,ty1}.c] Reduce emax for the generic tests. +------------------------------------------------------------------------ +r8774 | vlefevre | 2014-01-17 23:52:16 +0000 (Fri, 17 Jan 2014) | 1 line +Changed paths: + M /trunk/src/lngamma.c + +[src/lngamma.c] FIXME: proposed method for overflow detection. +------------------------------------------------------------------------ +r8773 | vlefevre | 2014-01-17 23:32:17 +0000 (Fri, 17 Jan 2014) | 1 line +Changed paths: + M /trunk/src/lngamma.c + +[src/lngamma.c] Minor improvements. +------------------------------------------------------------------------ +r8772 | zimmerma | 2014-01-17 23:26:31 +0000 (Fri, 17 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/tsqrt_ui.c + +missing \n + +------------------------------------------------------------------------ +r8771 | zimmerma | 2014-01-17 23:25:23 +0000 (Fri, 17 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/tmul.c + +missing \n + +------------------------------------------------------------------------ +r8770 | zimmerma | 2014-01-17 23:21:58 +0000 (Fri, 17 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/tfms.c + +missing \n in error messages + +------------------------------------------------------------------------ +r8769 | zimmerma | 2014-01-17 23:20:19 +0000 (Fri, 17 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/tfma.c + +missing \n in error messages + +------------------------------------------------------------------------ +r8768 | vlefevre | 2014-01-17 23:08:56 +0000 (Fri, 17 Jan 2014) | 1 line +Changed paths: + M /trunk/src/lngamma.c + +[src/lngamma.c] Added a MPFR_LOG_FUNC. +------------------------------------------------------------------------ +r8767 | vlefevre | 2014-01-17 23:00:51 +0000 (Fri, 17 Jan 2014) | 1 line +Changed paths: + M /trunk/src/digamma.c + +[src/digamma.c] FIXME: for x large, use the asymptotic expansion. +------------------------------------------------------------------------ +r8766 | vlefevre | 2014-01-17 22:48:52 +0000 (Fri, 17 Jan 2014) | 1 line +Changed paths: + M /trunk/src/digamma.c + +[src/digamma.c] Added 2 MPFR_LOG_FUNC's. +------------------------------------------------------------------------ +r8765 | vlefevre | 2014-01-17 22:46:25 +0000 (Fri, 17 Jan 2014) | 4 lines +Changed paths: + M /trunk/tests/tgeneric.c + +[tests/tgeneric.c] Fixed bug found by PZ: code introduced in r4538 to +test the maximum (in absolute value) positive and negative arguments +was buggy, as only the negative one was tested. +→ This makes some tests fail on the maximum positive argument. +------------------------------------------------------------------------ +r8764 | zimmerma | 2014-01-17 18:41:13 +0000 (Fri, 17 Jan 2014) | 6 lines +Changed paths: + M /trunk/src/mpfr-mini-gmp.c + M /trunk/tests/tests.c + +some progress with mini-gmp: +======================= +34 of 157 tests failed +(13 tests were not run) +======================= + +------------------------------------------------------------------------ +r8763 | zimmerma | 2014-01-17 15:51:49 +0000 (Fri, 17 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/urandomb.c + +mpn_copyd (rp, sp, n) should be used when rp >= sp + +------------------------------------------------------------------------ +r8762 | zimmerma | 2014-01-17 12:26:35 +0000 (Fri, 17 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/urandomb.c + +fixed bug which could appear with probability 1/2^32 or 1/2^64 + +------------------------------------------------------------------------ +r8761 | vlefevre | 2014-01-17 09:54:35 +0000 (Fri, 17 Jan 2014) | 1 line +Changed paths: + M /trunk/src/mpfr-mini-gmp.c + +[src/mpfr-mini-gmp.c] Removed trailing spaces. +------------------------------------------------------------------------ +r8760 | vlefevre | 2014-01-17 09:53:44 +0000 (Fri, 17 Jan 2014) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Update due to the mini-gmp support (r8753). +------------------------------------------------------------------------ +r8759 | vlefevre | 2014-01-17 09:48:04 +0000 (Fri, 17 Jan 2014) | 1 line +Changed paths: + M /trunk/tests/mpf_compat.c + M /trunk/tests/mpfr_compat.c + M /trunk/tests/terandom.c + M /trunk/tests/tget_f.c + M /trunk/tests/tgmpop.c + M /trunk/tests/tnrandom.c + M /trunk/tests/tset_f.c + M /trunk/tests/tset_q.c + +[tests] Various fixes for r8753. +------------------------------------------------------------------------ +r8758 | vlefevre | 2014-01-17 09:39:15 +0000 (Fri, 17 Jan 2014) | 1 line +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Indentation. +------------------------------------------------------------------------ +r8757 | vlefevre | 2014-01-17 09:36:57 +0000 (Fri, 17 Jan 2014) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Indentation. +------------------------------------------------------------------------ +r8756 | vlefevre | 2014-01-17 09:33:16 +0000 (Fri, 17 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/erandom.c + M /trunk/src/mpfr-mini-gmp.c + M /trunk/src/nrandom.c + M /trunk/src/printf.c + M /trunk/src/vasprintf.c + +Avoid an empty translation unit (see ISO C99, 6.9). Some errors could +be triggered with "gcc -std=c99 -pedantic-errors". +------------------------------------------------------------------------ +r8755 | zimmerma | 2014-01-17 07:22:48 +0000 (Fri, 17 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/Makefile.am + M /trunk/src/mpfr-mini-gmp.c + M /trunk/src/mpfr-mini-gmp.h + M /trunk/tests/tadd.c + +more progress for the mini-gmp interface + +------------------------------------------------------------------------ +r8754 | zimmerma | 2014-01-16 22:03:40 +0000 (Thu, 16 Jan 2014) | 2 lines +Changed paths: + A /trunk/src/mpfr-mini-gmp.c + A /trunk/src/mpfr-mini-gmp.h + +added two new files for mini-gmp interface + +------------------------------------------------------------------------ +r8753 | zimmerma | 2014-01-16 22:03:01 +0000 (Thu, 16 Jan 2014) | 3 lines +Changed paths: + M /trunk/configure.ac + M /trunk/src/Makefile.am + M /trunk/src/erandom.c + M /trunk/src/get_f.c + M /trunk/src/gmp_op.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + M /trunk/src/nrandom.c + M /trunk/src/printf.c + M /trunk/src/random_deviate.c + M /trunk/src/set_f.c + M /trunk/src/set_q.c + M /trunk/src/vasprintf.c + M /trunk/tests/mpf_compat.c + M /trunk/tests/mpfr_compat.c + M /trunk/tests/tcan_round.c + M /trunk/tests/terandom.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tget_f.c + M /trunk/tests/tgmpop.c + M /trunk/tests/tgrandom.c + M /trunk/tests/tnrandom.c + M /trunk/tests/tprintf.c + M /trunk/tests/tset_f.c + M /trunk/tests/tset_q.c + M /trunk/tests/tsprintf.c + +first step towards making MPFR compile with --enable-mini-gmp, so far make +succeeds and all tests compile, but many tests fail, will investigate later + +------------------------------------------------------------------------ +r8752 | vlefevre | 2014-01-16 13:49:34 +0000 (Thu, 16 Jan 2014) | 7 lines +Changed paths: + M /trunk/src/get_z_exp.c + +[src/get_z_exp.c] Added an assert for security in case the precision is +large, but the error should be handled properly (to be discussed). +Note: there are still corrupt memory problems when the precision is +large enough but below the mpz limit (a bug in GMP?). +Note [VL, 2014-01-17]: these problems are due to an integer overflow in +mpz/clear.c of GMP 5.1.3; I've reported the bug here: + https://gmplib.org/list-archives/gmp-bugs/2014-January/003321.html +------------------------------------------------------------------------ +r8751 | vlefevre | 2014-01-16 12:10:56 +0000 (Thu, 16 Jan 2014) | 1 line +Changed paths: + M /trunk/src/get_z_exp.c + +[src/get_z_exp.c] Avoid a potential overflow. +------------------------------------------------------------------------ +r8750 | vlefevre | 2014-01-16 12:03:01 +0000 (Thu, 16 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/extract.c + +[src/extract.c] Type clean-up with 2 bug fixes (these bugs should have +no effect on most platforms without too aggressive optimizations). +------------------------------------------------------------------------ +r8749 | zimmerma | 2014-01-16 11:01:49 +0000 (Thu, 16 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/extract.c + M /trunk/src/get_z_exp.c + M /trunk/src/mpfr-gmp.h + +replaced function _mpz_realloc by preferred one mpz_realloc2 + +------------------------------------------------------------------------ +r8748 | vlefevre | 2014-01-16 09:00:58 +0000 (Thu, 16 Jan 2014) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Added mini-gmp support. +------------------------------------------------------------------------ +r8747 | vlefevre | 2014-01-15 00:13:19 +0000 (Wed, 15 Jan 2014) | 2 lines +Changed paths: + M /trunk/NEWS + +[NEWS] Mention speed improvement with --enable-assert[=full] and GCC +(due to the fix in r8746). +------------------------------------------------------------------------ +r8746 | vlefevre | 2014-01-14 23:44:44 +0000 (Tue, 14 Jan 2014) | 3 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Fixed the MPFR_ASSERTN macro as suggested by +Wolf Lammen: https://sympa.inria.fr/sympa/arc/mpfr/2014-01/msg00002.html +Note: the semantics doesn't change, it should just be more efficient. +------------------------------------------------------------------------ +r8745 | vlefevre | 2014-01-12 20:34:17 +0000 (Sun, 12 Jan 2014) | 1 line +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Output MPFR_LDBL_MANT_DIG in some failure case. +------------------------------------------------------------------------ +r8744 | vlefevre | 2014-01-11 23:41:59 +0000 (Sat, 11 Jan 2014) | 1 line +Changed paths: + M /trunk/tests/tset_d.c + +[tests/tset_d.c] More information in a failed test. +------------------------------------------------------------------------ +r8743 | vlefevre | 2014-01-10 15:17:32 +0000 (Fri, 10 Jan 2014) | 2 lines +Changed paths: + M /trunk/tests/Makefile.am + +[tests/Makefile.am] In LOADLIBES, replaced $(INCLUDES) by $(AM_CPPFLAGS) +(this should have been done at the same time as r8364). +------------------------------------------------------------------------ +r8741 | vlefevre | 2014-01-09 15:33:36 +0000 (Thu, 09 Jan 2014) | 4 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] "To make a release" update. In particular at step 5, +replaced "make dist" by "make distcheck" so that some problems can be +detected at step 5 instead of step 6, ensuring that the tarballs are +complete. +------------------------------------------------------------------------ +r8740 | vlefevre | 2014-01-09 15:22:59 +0000 (Thu, 09 Jan 2014) | 1 line +Changed paths: + M /trunk/src/Makefile.am + +[src/Makefile.am] Forgot to add mpfr-cvers.h in r8739. +------------------------------------------------------------------------ +r8739 | vlefevre | 2014-01-09 15:19:35 +0000 (Thu, 09 Jan 2014) | 12 lines +Changed paths: + A /trunk/src/mpfr-cvers.h (from /trunk/src/mpfr-impl.h:8738) + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-sassert.h + +When static assertions are not supported by the C implementation +natively (new C11 feature), their MPFR implementation got broken by +changeset r8625, as the __MPFR_GNUC macro in mpfr-sassert.h was not +defined in the configure test (since mpfr-impl.h wasn't included) +and generated an error, disabling the static assertions support. +This is fixed by the following changes, avoiding code duplication +and thus risk of inconsistencies in future modification: + * copied some of the version detection macros from mpfr-impl.h to + a standalone file mpfr-cvers.h, and updated the macros; + * in mpfr-impl.h, replaced these macros by a #include "mpfr-cvers.h" + and updated a comment; + * in mpfr-sassert.h, added a #include "mpfr-cvers.h". +------------------------------------------------------------------------ +r8738 | vlefevre | 2014-01-09 14:02:46 +0000 (Thu, 09 Jan 2014) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] In the Static Assertions test, avoid a warning with GCC +and added comments. +------------------------------------------------------------------------ +r8737 | vlefevre | 2014-01-07 10:10:08 +0000 (Tue, 07 Jan 2014) | 1 line +Changed paths: + M /trunk/ChangeLog + +ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC svn log -rHEAD:0 -v". +------------------------------------------------------------------------ +r8736 | vlefevre | 2014-01-07 08:51:55 +0000 (Tue, 07 Jan 2014) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Use codespell if available. +------------------------------------------------------------------------ +r8734 | vlefevre | 2014-01-07 00:52:51 +0000 (Tue, 07 Jan 2014) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Fixed a misspelling, using codespell. +------------------------------------------------------------------------ +r8733 | vlefevre | 2014-01-07 00:49:55 +0000 (Tue, 07 Jan 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + M /trunk/src/div_ui.c + M /trunk/src/eint.c + M /trunk/src/erfc.c + M /trunk/src/strtofr.c + M /trunk/src/sub1sp.c + M /trunk/src/vasprintf.c + +Fixed misspellings, using codespell. +------------------------------------------------------------------------ +r8732 | vlefevre | 2014-01-06 00:45:48 +0000 (Mon, 06 Jan 2014) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Added item: new functions of IEEE 754-2008 / C binding draft. +------------------------------------------------------------------------ +r8731 | vlefevre | 2014-01-05 04:37:58 +0000 (Sun, 05 Jan 2014) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] "To make a release": added a paragraph about warnings. +------------------------------------------------------------------------ +r8730 | vlefevre | 2014-01-05 03:28:14 +0000 (Sun, 05 Jan 2014) | 1 line +Changed paths: + M /trunk/tests/trint.c + +[tests/trint.c] Avoid a warning. +------------------------------------------------------------------------ +r8729 | vlefevre | 2014-01-05 03:23:10 +0000 (Sun, 05 Jan 2014) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Avoid a warning due to variable set but not used in a +test, making the test fail with gcc -Werror=unused-but-set-variable. +------------------------------------------------------------------------ +r8728 | vlefevre | 2014-01-05 03:17:16 +0000 (Sun, 05 Jan 2014) | 1 line +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Replaced "main()" by "main (void)". +------------------------------------------------------------------------ +r8726 | vlefevre | 2014-01-04 03:02:09 +0000 (Sat, 04 Jan 2014) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r8725 | vlefevre | 2014-01-03 20:57:13 +0000 (Fri, 03 Jan 2014) | 2 lines +Changed paths: + M /trunk/src/const_log2.c + M /trunk/src/const_pi.c + M /trunk/src/exceptions.c + M /trunk/src/mpfr-impl.h + M /trunk/src/set_dfl_prec.c + M /trunk/src/set_rnd.c + +Fixed warnings from GCC's -Wold-style-declaration option: +MPFR_THREAD_ATTR must be at beginning of declaration. +------------------------------------------------------------------------ +r8723 | vlefevre | 2014-01-03 20:33:38 +0000 (Fri, 03 Jan 2014) | 5 lines +Changed paths: + M /trunk/BUGS + M /trunk/INSTALL + M /trunk/Makefile.am + M /trunk/NEWS + M /trunk/README + M /trunk/TODO + M /trunk/acinclude.m4 + M /trunk/configure.ac + M /trunk/doc/FAQ.html + M /trunk/doc/Makefile.am + M /trunk/doc/README.dev + M /trunk/doc/faq.xsl + M /trunk/doc/mpfr.texi + M /trunk/examples/divworst.c + M /trunk/examples/rndo-add.c + M /trunk/examples/sample.c + M /trunk/examples/version.c + M /trunk/src/Makefile.am + M /trunk/src/abort_prec_max.c + M /trunk/src/acos.c + M /trunk/src/acosh.c + M /trunk/src/add.c + M /trunk/src/add1.c + M /trunk/src/add1sp.c + M /trunk/src/add_d.c + M /trunk/src/add_ui.c + M /trunk/src/agm.c + M /trunk/src/ai.c + M /trunk/src/amd/amdfam10/mparam.h + M /trunk/src/amd/athlon/mparam.h + M /trunk/src/amd/k8/mparam.h + M /trunk/src/arm/mparam.h + M /trunk/src/asin.c + M /trunk/src/asinh.c + M /trunk/src/atan.c + M /trunk/src/atan2.c + M /trunk/src/atanh.c + M /trunk/src/bernoulli.c + M /trunk/src/buildopt.c + M /trunk/src/cache.c + M /trunk/src/cbrt.c + M /trunk/src/check.c + M /trunk/src/clear.c + M /trunk/src/clears.c + M /trunk/src/cmp.c + M /trunk/src/cmp2.c + M /trunk/src/cmp_abs.c + M /trunk/src/cmp_d.c + M /trunk/src/cmp_ld.c + M /trunk/src/cmp_si.c + M /trunk/src/cmp_ui.c + M /trunk/src/comparisons.c + M /trunk/src/const_catalan.c + M /trunk/src/const_euler.c + M /trunk/src/const_log2.c + M /trunk/src/const_pi.c + M /trunk/src/constant.c + M /trunk/src/copysign.c + M /trunk/src/cos.c + M /trunk/src/cosh.c + M /trunk/src/cot.c + M /trunk/src/coth.c + M /trunk/src/csc.c + M /trunk/src/csch.c + M /trunk/src/d_div.c + M /trunk/src/d_sub.c + M /trunk/src/digamma.c + M /trunk/src/dim.c + M /trunk/src/div.c + M /trunk/src/div_2exp.c + M /trunk/src/div_2si.c + M /trunk/src/div_2ui.c + M /trunk/src/div_d.c + M /trunk/src/div_ui.c + M /trunk/src/dump.c + M /trunk/src/eint.c + M /trunk/src/eq.c + M /trunk/src/erandom.c + M /trunk/src/erf.c + M /trunk/src/erfc.c + M /trunk/src/exceptions.c + M /trunk/src/exp.c + M /trunk/src/exp10.c + M /trunk/src/exp2.c + M /trunk/src/exp3.c + M /trunk/src/exp_2.c + M /trunk/src/expm1.c + M /trunk/src/extract.c + M /trunk/src/factorial.c + M /trunk/src/fits_intmax.c + M /trunk/src/fits_s.h + M /trunk/src/fits_sint.c + M /trunk/src/fits_slong.c + M /trunk/src/fits_sshort.c + M /trunk/src/fits_u.h + M /trunk/src/fits_uint.c + M /trunk/src/fits_uintmax.c + M /trunk/src/fits_ulong.c + M /trunk/src/fits_ushort.c + M /trunk/src/fma.c + M /trunk/src/fms.c + M /trunk/src/fpif.c + M /trunk/src/frac.c + M /trunk/src/free_cache.c + M /trunk/src/frexp.c + M /trunk/src/gamma.c + M /trunk/src/gammaonethird.c + M /trunk/src/gen_inverse.h + M /trunk/src/generic/coverage/mparam.h + M /trunk/src/generic/mparam.h + M /trunk/src/get_d.c + M /trunk/src/get_d64.c + M /trunk/src/get_exp.c + M /trunk/src/get_f.c + M /trunk/src/get_float128.c + M /trunk/src/get_flt.c + M /trunk/src/get_ld.c + M /trunk/src/get_si.c + M /trunk/src/get_sj.c + M /trunk/src/get_str.c + M /trunk/src/get_ui.c + M /trunk/src/get_uj.c + M /trunk/src/get_z.c + M /trunk/src/get_z_exp.c + M /trunk/src/gmp_op.c + M /trunk/src/grandom.c + M /trunk/src/hppa/mparam.h + M /trunk/src/hypot.c + M /trunk/src/ia64/mparam.h + M /trunk/src/ieee_floats.h + M /trunk/src/init.c + M /trunk/src/init2.c + M /trunk/src/inits.c + M /trunk/src/inits2.c + M /trunk/src/inp_str.c + M /trunk/src/int_ceil_log2.c + M /trunk/src/isinf.c + M /trunk/src/isinteger.c + M /trunk/src/isnan.c + M /trunk/src/isnum.c + M /trunk/src/isqrt.c + M /trunk/src/isregular.c + M /trunk/src/iszero.c + M /trunk/src/jn.c + M /trunk/src/jyn_asympt.c + M /trunk/src/li2.c + M /trunk/src/lngamma.c + M /trunk/src/log.c + M /trunk/src/log10.c + M /trunk/src/log1p.c + M /trunk/src/log2.c + M /trunk/src/logging.c + M /trunk/src/min_prec.c + M /trunk/src/minmax.c + M /trunk/src/mips/mparam.h + M /trunk/src/modf.c + M /trunk/src/mp_clz_tab.c + M /trunk/src/mparam_h.in + M /trunk/src/mpf2mpfr.h + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-intmax.h + M /trunk/src/mpfr-longlong.h + M /trunk/src/mpfr-sassert.h + M /trunk/src/mpfr-thread.h + M /trunk/src/mpfr.h + M /trunk/src/mpn_exp.c + M /trunk/src/mul.c + M /trunk/src/mul_2exp.c + M /trunk/src/mul_2si.c + M /trunk/src/mul_2ui.c + M /trunk/src/mul_d.c + M /trunk/src/mul_ui.c + M /trunk/src/mulders.c + M /trunk/src/neg.c + M /trunk/src/next.c + M /trunk/src/nrandom.c + M /trunk/src/out_str.c + M /trunk/src/pow.c + M /trunk/src/pow_si.c + M /trunk/src/pow_ui.c + M /trunk/src/pow_z.c + M /trunk/src/powerof2.c + M /trunk/src/powerpc32/mparam.h + M /trunk/src/powerpc64/mparam.h + M /trunk/src/print_raw.c + M /trunk/src/print_rnd_mode.c + M /trunk/src/printf.c + M /trunk/src/random_deviate.c + M /trunk/src/random_deviate.h + M /trunk/src/rec_sqrt.c + M /trunk/src/reldiff.c + M /trunk/src/rem1.c + M /trunk/src/rint.c + M /trunk/src/rndna.c + M /trunk/src/root.c + M /trunk/src/round_near_x.c + M /trunk/src/round_p.c + M /trunk/src/round_prec.c + M /trunk/src/round_raw_generic.c + M /trunk/src/scale2.c + M /trunk/src/sec.c + M /trunk/src/sech.c + M /trunk/src/set.c + M /trunk/src/set_d.c + M /trunk/src/set_d64.c + M /trunk/src/set_dfl_prec.c + M /trunk/src/set_exp.c + M /trunk/src/set_f.c + M /trunk/src/set_float128.c + M /trunk/src/set_flt.c + M /trunk/src/set_inf.c + M /trunk/src/set_ld.c + M /trunk/src/set_nan.c + M /trunk/src/set_prc_raw.c + M /trunk/src/set_prec.c + M /trunk/src/set_q.c + M /trunk/src/set_rnd.c + M /trunk/src/set_si.c + M /trunk/src/set_si_2exp.c + M /trunk/src/set_sj.c + M /trunk/src/set_str.c + M /trunk/src/set_str_raw.c + M /trunk/src/set_ui.c + M /trunk/src/set_ui_2exp.c + M /trunk/src/set_uj.c + M /trunk/src/set_z.c + M /trunk/src/set_z_exp.c + M /trunk/src/set_zero.c + M /trunk/src/setmax.c + M /trunk/src/setmin.c + M /trunk/src/setsign.c + M /trunk/src/sgn.c + M /trunk/src/si_op.c + M /trunk/src/signbit.c + M /trunk/src/sin.c + M /trunk/src/sin_cos.c + M /trunk/src/sinh.c + M /trunk/src/sinh_cosh.c + M /trunk/src/sparc64/mparam.h + M /trunk/src/sqr.c + M /trunk/src/sqrt.c + M /trunk/src/sqrt_ui.c + M /trunk/src/stack_interface.c + M /trunk/src/strtofr.c + M /trunk/src/sub.c + M /trunk/src/sub1.c + M /trunk/src/sub1sp.c + M /trunk/src/sub_d.c + M /trunk/src/sub_ui.c + M /trunk/src/subnormal.c + M /trunk/src/sum.c + M /trunk/src/swap.c + M /trunk/src/tan.c + M /trunk/src/tanh.c + M /trunk/src/uceil_exp2.c + M /trunk/src/uceil_log2.c + M /trunk/src/ufloor_log2.c + M /trunk/src/ui_div.c + M /trunk/src/ui_pow.c + M /trunk/src/ui_pow_ui.c + M /trunk/src/ui_sub.c + M /trunk/src/urandom.c + M /trunk/src/urandomb.c + M /trunk/src/vasprintf.c + M /trunk/src/version.c + M /trunk/src/volatile.c + M /trunk/src/x86/core2/mparam.h + M /trunk/src/x86/mparam.h + M /trunk/src/x86_64/core2/mparam.h + M /trunk/src/x86_64/corei5/mparam.h + M /trunk/src/x86_64/pentium4/mparam.h + M /trunk/src/yn.c + M /trunk/src/zeta.c + M /trunk/src/zeta_ui.c + M /trunk/tests/Makefile.am + M /trunk/tests/cmp_str.c + M /trunk/tests/data/digamma + M /trunk/tests/data/li2 + M /trunk/tests/memory.c + M /trunk/tests/mpf_compat.c + M /trunk/tests/mpf_compat.h + M /trunk/tests/mpfr-test.h + M /trunk/tests/mpfr_compat.c + M /trunk/tests/random2.c + M /trunk/tests/reuse.c + M /trunk/tests/rnd_mode.c + M /trunk/tests/tabort_defalloc1.c + M /trunk/tests/tabort_defalloc2.c + M /trunk/tests/tabort_prec_max.c + M /trunk/tests/tabs.c + M /trunk/tests/tacos.c + M /trunk/tests/tacosh.c + M /trunk/tests/tadd.c + M /trunk/tests/tadd1sp.c + M /trunk/tests/tadd_d.c + M /trunk/tests/tadd_ui.c + M /trunk/tests/tagm.c + M /trunk/tests/tai.c + M /trunk/tests/tasin.c + M /trunk/tests/tasinh.c + M /trunk/tests/tassert.c + M /trunk/tests/tatan.c + M /trunk/tests/tatanh.c + M /trunk/tests/taway.c + M /trunk/tests/tbuildopt.c + M /trunk/tests/tcan_round.c + M /trunk/tests/tcbrt.c + M /trunk/tests/tcheck.c + M /trunk/tests/tcmp.c + M /trunk/tests/tcmp2.c + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + M /trunk/tests/tcmp_ui.c + M /trunk/tests/tcmpabs.c + M /trunk/tests/tcomparisons.c + M /trunk/tests/tconst_catalan.c + M /trunk/tests/tconst_euler.c + M /trunk/tests/tconst_log2.c + M /trunk/tests/tconst_pi.c + M /trunk/tests/tcopysign.c + M /trunk/tests/tcos.c + M /trunk/tests/tcosh.c + M /trunk/tests/tcot.c + M /trunk/tests/tcoth.c + M /trunk/tests/tcsc.c + M /trunk/tests/tcsch.c + M /trunk/tests/td_div.c + M /trunk/tests/td_sub.c + M /trunk/tests/tdigamma.c + M /trunk/tests/tdim.c + M /trunk/tests/tdiv.c + M /trunk/tests/tdiv_d.c + M /trunk/tests/tdiv_ui.c + M /trunk/tests/teint.c + M /trunk/tests/teq.c + M /trunk/tests/terandom.c + M /trunk/tests/terf.c + M /trunk/tests/tests.c + M /trunk/tests/texceptions.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/texpm1.c + M /trunk/tests/tfactorial.c + M /trunk/tests/tfits.c + M /trunk/tests/tfma.c + M /trunk/tests/tfmod.c + M /trunk/tests/tfms.c + M /trunk/tests/tfpif.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tfrac.c + M /trunk/tests/tfrexp.c + M /trunk/tests/tgamma.c + M /trunk/tests/tgeneric.c + M /trunk/tests/tgeneric_ui.c + M /trunk/tests/tget_d.c + M /trunk/tests/tget_d_2exp.c + M /trunk/tests/tget_f.c + M /trunk/tests/tget_flt.c + M /trunk/tests/tget_ld_2exp.c + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tget_sj.c + M /trunk/tests/tget_str.c + M /trunk/tests/tget_z.c + M /trunk/tests/tgmpop.c + M /trunk/tests/tgrandom.c + M /trunk/tests/thyperbolic.c + M /trunk/tests/thypot.c + M /trunk/tests/tinits.c + M /trunk/tests/tinp_str.c + M /trunk/tests/tinternals.c + M /trunk/tests/tisnan.c + M /trunk/tests/tisqrt.c + M /trunk/tests/tj0.c + M /trunk/tests/tj1.c + M /trunk/tests/tjn.c + M /trunk/tests/tl2b.c + M /trunk/tests/tlgamma.c + M /trunk/tests/tli2.c + M /trunk/tests/tlngamma.c + M /trunk/tests/tlog.c + M /trunk/tests/tlog10.c + M /trunk/tests/tlog1p.c + M /trunk/tests/tlog2.c + M /trunk/tests/tmin_prec.c + M /trunk/tests/tminmax.c + M /trunk/tests/tmodf.c + M /trunk/tests/tmul.c + M /trunk/tests/tmul_2exp.c + M /trunk/tests/tmul_d.c + M /trunk/tests/tmul_ui.c + M /trunk/tests/tnext.c + M /trunk/tests/tnrandom.c + M /trunk/tests/tout_str.c + M /trunk/tests/toutimpl.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow3.c + M /trunk/tests/tpow_all.c + M /trunk/tests/tpow_z.c + M /trunk/tests/tprintf.c + M /trunk/tests/trandom.c + M /trunk/tests/trec_sqrt.c + M /trunk/tests/tremquo.c + M /trunk/tests/trint.c + M /trunk/tests/trndna.c + M /trunk/tests/troot.c + M /trunk/tests/tround_prec.c + M /trunk/tests/tsec.c + M /trunk/tests/tsech.c + M /trunk/tests/tset.c + M /trunk/tests/tset_d.c + M /trunk/tests/tset_exp.c + M /trunk/tests/tset_f.c + M /trunk/tests/tset_float128.c + M /trunk/tests/tset_ld.c + M /trunk/tests/tset_q.c + M /trunk/tests/tset_si.c + M /trunk/tests/tset_sj.c + M /trunk/tests/tset_str.c + M /trunk/tests/tset_z.c + M /trunk/tests/tset_z_exp.c + M /trunk/tests/tsgn.c + M /trunk/tests/tsi_op.c + M /trunk/tests/tsin.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tsinh.c + M /trunk/tests/tsinh_cosh.c + M /trunk/tests/tsprintf.c + M /trunk/tests/tsqr.c + M /trunk/tests/tsqrt.c + M /trunk/tests/tsqrt_ui.c + M /trunk/tests/tstckintc.c + M /trunk/tests/tstdint.c + M /trunk/tests/tstrtofr.c + M /trunk/tests/tsub.c + M /trunk/tests/tsub1sp.c + M /trunk/tests/tsub_d.c + M /trunk/tests/tsub_ui.c + M /trunk/tests/tsubnormal.c + M /trunk/tests/tsum.c + M /trunk/tests/tswap.c + M /trunk/tests/ttan.c + M /trunk/tests/ttanh.c + M /trunk/tests/ttrunc.c + M /trunk/tests/tui_div.c + M /trunk/tests/tui_pow.c + M /trunk/tests/tui_sub.c + M /trunk/tests/turandom.c + M /trunk/tests/tvalist.c + M /trunk/tests/tversion.c + M /trunk/tests/ty0.c + M /trunk/tests/ty1.c + M /trunk/tests/tyn.c + M /trunk/tests/tzeta.c + M /trunk/tests/tzeta_ui.c + M /trunk/tools/ck-copyright-notice + M /trunk/tools/ck-mparam + M /trunk/tools/ck-version-info + M /trunk/tools/get_patches.sh + M /trunk/tune/Makefile.am + M /trunk/tune/bidimensional_sample.c + M /trunk/tune/speed.c + M /trunk/tune/tuneup.c + +Copyright notice update: added 2014 with + perl -pi -e 's/ (\d{4}-)?(2013)(?= Free Software)/ + " ".($1||"$2-").($2+1)/e' **/*(^/) +under zsh (the tools/mbench directory was not modified). +Removed 2013 from the example in the doc/README.dev file. +------------------------------------------------------------------------ +r8722 | zimmerma | 2013-12-17 06:37:59 +0000 (Tue, 17 Dec 2013) | 3 lines +Changed paths: + M /trunk/src/strtofr.c + +work around for bug in mpn_set_str +(https://gmplib.org/list-archives/gmp-bugs/2013-December/003267.html) + +------------------------------------------------------------------------ +r8721 | vlefevre | 2013-12-12 12:18:05 +0000 (Thu, 12 Dec 2013) | 3 lines +Changed paths: + A /trunk/tools/repl-variadic + +Added tools/repl-variadic Perl script to replace the variadic functions +mpfr_clears, mpfr_inits and mpfr_inits2, in case they are not supported +by the compiler. +------------------------------------------------------------------------ +r8716 | vlefevre | 2013-11-28 18:05:41 +0000 (Thu, 28 Nov 2013) | 2 lines +Changed paths: + M /trunk/tests/tstckintc.c + +[tests/tstckintc.c] Improved tests when mpfr_custom_init_set is used as +a macro (i.e. without parentheses) to trigger the bug fixed in r8715. +------------------------------------------------------------------------ +r8715 | vlefevre | 2013-11-28 17:59:54 +0000 (Thu, 28 Nov 2013) | 5 lines +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Fixed bug in the mpfr_custom_init_set macro (typo in +variable name, which can yield incorrect behavior if the second +argument is not a simple expression). +Thanks to Andreas Enge for the bug report: + https://sympa.inria.fr/sympa/arc/mpfr/2013-11/msg00029.html +------------------------------------------------------------------------ +r8714 | vlefevre | 2013-11-21 02:02:54 +0000 (Thu, 21 Nov 2013) | 17 lines +Changed paths: + M /trunk/src/lngamma.c + +[src/lngamma.c] No longer declare B as initialized with GCC (see r5534), +as the "may be used uninitialized" warning no longer occurs with latest +GCC: trunk revision 203899 (Debian 20131021-1), for the future GCC 4.9. +The warning still occurs with GCC 4.8.2 (Debian 4.8.2-1): + +$ gcc-4.8 -O2 -Wall -c gamma.c +In file included from gamma.c:27:0: +gamma.c: In function ‘mpfr_gamma’: +lngamma.c:468:17: warning: ‘B’ may be used uninitialized in this function [-Wmaybe-uninitialized] + B = mpfr_bernoulli_internal (B, m); /* B[2m]*(2m+1)!, exact */ + ^ +lngamma.c:165:10: note: ‘B’ was declared here + mpz_t *B; + ^ +Note: with GCC 4.8.2, at least -O is needed to reproduce the warning, +and -Wmaybe-uninitialized without -Wuninitialized (or -Wall) doesn't +trigger the warning. +------------------------------------------------------------------------ +r8713 | zimmerma | 2013-11-15 07:36:08 +0000 (Fri, 15 Nov 2013) | 2 lines +Changed paths: + M /trunk/tools/nightly-test + +added -Wlogical-op + +------------------------------------------------------------------------ +r8709 | vlefevre | 2013-11-15 00:46:21 +0000 (Fri, 15 Nov 2013) | 1 line +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Added a few tests. +------------------------------------------------------------------------ +r8707 | vlefevre | 2013-11-15 00:26:52 +0000 (Fri, 15 Nov 2013) | 4 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] This may seem obvious, but this is not the first time +this happens: + "When adding the expected result, do NOT use the one +obtained from the MPFR function! Otherwise, if this function is buggy, +the test will be wrong and the function will remain buggy." +------------------------------------------------------------------------ +r8706 | vlefevre | 2013-11-15 00:17:16 +0000 (Fri, 15 Nov 2013) | 2 lines +Changed paths: + M /trunk/tests/tsprintf.c + +[tests/tsprintf.c] Fixed incorrect test from r5652 (the corresponding +bug in src/vasprintf.c has been fixed in r8705). +------------------------------------------------------------------------ +r8705 | zimmerma | 2013-11-14 19:04:02 +0000 (Thu, 14 Nov 2013) | 3 lines +Changed paths: + M /trunk/src/vasprintf.c + +fixed bug reported by David Binderman +(https://sympa.inria.fr/sympa/arc/mpfr/2013-11/msg00009.html) + +------------------------------------------------------------------------ +r8703 | vlefevre | 2013-11-06 14:54:45 +0000 (Wed, 06 Nov 2013) | 1 line +Changed paths: + M /trunk/tests/thypot.c + +[tests/thypot.c] More NaN tests. +------------------------------------------------------------------------ +r8702 | thevenyp | 2013-11-06 13:27:15 +0000 (Wed, 06 Nov 2013) | 1 line +Changed paths: + M /trunk/tests/thypot.c + +[tests/thypot.c] Fix use of a non explicitly initialized variable. +------------------------------------------------------------------------ +r8701 | zimmerma | 2013-11-04 21:03:02 +0000 (Mon, 04 Nov 2013) | 2 lines +Changed paths: + M /trunk/src/sum.c + +[sum.c] the call to mpfr_can_round was obviously wrong + +------------------------------------------------------------------------ +r8700 | vlefevre | 2013-11-04 18:12:08 +0000 (Mon, 04 Nov 2013) | 1 line +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Updated TODO comment (→ check underflows). +------------------------------------------------------------------------ +r8699 | zimmerma | 2013-11-04 17:07:40 +0000 (Mon, 04 Nov 2013) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + M /trunk/src/sum.c + M /trunk/tests/tsum.c + +[sum.c] mpfr_sum should consider the maximal precision of its inputs/output + +------------------------------------------------------------------------ +r8698 | vlefevre | 2013-10-28 09:36:01 +0000 (Mon, 28 Oct 2013) | 2 lines +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Added a TODO comment: add generic random test with +cancellations, and tests with intermediate overflows. +------------------------------------------------------------------------ +r8697 | vlefevre | 2013-10-28 09:02:45 +0000 (Mon, 28 Oct 2013) | 2 lines +Changed paths: + M /trunk/tests/tsum.c + +[tests/tsum.c] Added test for bug reported by Joseph S. Myers: +https://sympa.inria.fr/sympa/arc/mpfr/2013-10/msg00015.html +------------------------------------------------------------------------ +r8692 | vlefevre | 2013-09-27 14:08:05 +0000 (Fri, 27 Sep 2013) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added an example for mpfr_fits_*, corresponding to the +bug fixed in r8503. +------------------------------------------------------------------------ +r8690 | vlefevre | 2013-09-27 13:30:54 +0000 (Fri, 27 Sep 2013) | 5 lines +Changed paths: + M /trunk/src/mpfr-impl.h + M /trunk/tests/tset_ld.c + +[src/mpfr-impl.h] Document that DOUBLE_ISNAN(x) is valid on long double. +[tests/tset_ld.c] In Isnan_ld, do not convert the long double argument +to double, as this can give an overflow and unexpected behavior without +default IEEE 754 behavior. With this change, this tset_ld test no longer +fails with "clang -O2 -fsanitize=undefined -fno-sanitize-recover". +------------------------------------------------------------------------ +r8689 | vlefevre | 2013-09-27 12:57:37 +0000 (Fri, 27 Sep 2013) | 1 line +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Avoid a division by zero if MPFR_ERRDIVZERO. +------------------------------------------------------------------------ +r8688 | vlefevre | 2013-09-27 12:48:31 +0000 (Fri, 27 Sep 2013) | 1 line +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Move tests_start_mpfr call earlier. +------------------------------------------------------------------------ +r8687 | vlefevre | 2013-09-27 12:39:40 +0000 (Fri, 27 Sep 2013) | 1 line +Changed paths: + M /trunk/tests/tget_flt.c + +[tests/tget_flt.c] Corrections when MPFR_ERRDIVZERO is defined. +------------------------------------------------------------------------ +r8686 | vlefevre | 2013-09-27 12:25:24 +0000 (Fri, 27 Sep 2013) | 5 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] With clang, disable division by zero using constants +due to a bug in its sanitizer and because IEEE 754 division by zero is +currently not properly supported. +With this change, the tget_d test no longer fails with: + clang -O2 -fsanitize=undefined -fno-sanitize-recover +------------------------------------------------------------------------ +r8685 | vlefevre | 2013-09-26 13:21:02 +0000 (Thu, 26 Sep 2013) | 1 line +Changed paths: + M /trunk/tests/tget_flt.c + +[tests/tget_flt.c] Protect a division by 0. +------------------------------------------------------------------------ +r8681 | vlefevre | 2013-09-17 12:41:50 +0000 (Tue, 17 Sep 2013) | 1 line +Changed paths: + M /trunk/src/Makefile.am + +[src/Makefile.am] Updated -version-info to 6:0:2 for MPFR 3.2.0. +------------------------------------------------------------------------ +r8680 | vlefevre | 2013-09-16 08:56:31 +0000 (Mon, 16 Sep 2013) | 2 lines +Changed paths: + M /trunk/NEWS + +[NEWS] For MPFR 3.2: The --enable-decimal-float configure option +no longer requires --with-gmp-build (see r8402). +------------------------------------------------------------------------ +r8679 | vlefevre | 2013-09-15 22:46:47 +0000 (Sun, 15 Sep 2013) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] Detect broken _Decimal64 support on powerpc64 with +the mode32 ABI. +------------------------------------------------------------------------ +r8678 | vlefevre | 2013-09-15 22:20:20 +0000 (Sun, 15 Sep 2013) | 1 line +Changed paths: + M /trunk/tests/tget_set_d64.c + +[tests/tget_set_d64.c] More meaningful messages in check_inf_nan. +------------------------------------------------------------------------ +r8677 | vlefevre | 2013-09-15 21:48:18 +0000 (Sun, 15 Sep 2013) | 2 lines +Changed paths: + M /trunk/tests/tget_set_d64.c + +[tests/tget_set_d64.c] More meaningful messages in check_inf_nan +after failures on powerpc64 with the mode32 ABI. +------------------------------------------------------------------------ +r8676 | vlefevre | 2013-09-04 11:50:39 +0000 (Wed, 04 Sep 2013) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Added: implement optional cache sharing between threads. +------------------------------------------------------------------------ +r8674 | vlefevre | 2013-09-02 13:30:46 +0000 (Mon, 02 Sep 2013) | 3 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Changed node name "Integer Related Functions" to +"Integer and Remainder Related Functions", as the corresponding +section title was changed in r4867. Added associated @cindex. +------------------------------------------------------------------------ +r8673 | vlefevre | 2013-09-02 13:17:18 +0000 (Mon, 02 Sep 2013) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r8672 | vlefevre | 2013-09-02 13:15:25 +0000 (Mon, 02 Sep 2013) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Specified special values (in particular the sign of 0) +for Section 5.10 "Integer and Remainder Related Functions". +------------------------------------------------------------------------ +r8671 | vlefevre | 2013-09-02 01:45:33 +0000 (Mon, 02 Sep 2013) | 3 lines +Changed paths: + M /trunk/src/round_raw_generic.c + +[src/round_raw_generic.c] Support MPFR_RNDNA for this class of functions +at the request of John P. Hartmann (to support one of IBM's High Level +Assembler rounding mode for hexadecimal floating-point constants). +------------------------------------------------------------------------ +r8670 | vlefevre | 2013-09-02 01:22:20 +0000 (Mon, 02 Sep 2013) | 1 line +Changed paths: + M /trunk/src/round_raw_generic.c + +[src/round_raw_generic.c] Code simplification / comment corrections. +------------------------------------------------------------------------ +r8668 | vlefevre | 2013-08-26 13:42:04 +0000 (Mon, 26 Aug 2013) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] About clang sanitizer, mention -fno-sanitize-recover +for more visibility in automated tests. +------------------------------------------------------------------------ +r8667 | vlefevre | 2013-08-23 11:12:37 +0000 (Fri, 23 Aug 2013) | 2 lines +Changed paths: + M /trunk/src/ai.c + +[src/ai.c] Moved the handling of the special cases NaN and ±Inf to +the main function mpfr_ai. +------------------------------------------------------------------------ +r8666 | vlefevre | 2013-08-23 02:41:24 +0000 (Fri, 23 Aug 2013) | 4 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/agm.c + M /trunk/tests/tagm.c + +[src/agm.c] Corrected a comment. +[tests/tagm.c] Added tests concerning special values, + in particular (zero,negative) and symmetric tests. +[doc/mpfr.texi] Corrected mpfr_agm description. +------------------------------------------------------------------------ +r8665 | vlefevre | 2013-08-21 13:51:24 +0000 (Wed, 21 Aug 2013) | 2 lines +Changed paths: + M /trunk/TODO + +[TODO] Revisit the conversion functions between a MPFR number and +a native floating-point value. +------------------------------------------------------------------------ +r8664 | vlefevre | 2013-08-19 09:39:12 +0000 (Mon, 19 Aug 2013) | 4 lines +Changed paths: + M /trunk/doc + +[doc] Added mpfr.t2d and mpfr.t2p to svn:ignore property. +Note: These directories are now generated when using "make mpfr.dvi" +and "make mpfr.pdf". This comes from a change in Automake 1.13 (see +its 2012-06-20 changelog) for the texi2dvi and texi2pdf invocations. +------------------------------------------------------------------------ +r8663 | vlefevre | 2013-08-10 11:30:35 +0000 (Sat, 10 Aug 2013) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Before release, test with gcc -mpc64 under Linux/x86. +------------------------------------------------------------------------ +r8662 | zimmerma | 2013-08-08 13:12:06 +0000 (Thu, 08 Aug 2013) | 2 lines +Changed paths: + M /trunk/tests/tversion.c + +[tversion.c] added GCC version + +------------------------------------------------------------------------ +r8661 | zimmerma | 2013-08-08 12:52:58 +0000 (Thu, 08 Aug 2013) | 4 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tset_ld.c] try to fix a bug on i686-freebsd + (see http://hydra.nixos.org/build/5665961/log/raw) + + +------------------------------------------------------------------------ +r8660 | zimmerma | 2013-08-08 08:02:10 +0000 (Thu, 08 Aug 2013) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tset_ld.c] added debug information + +------------------------------------------------------------------------ +r8659 | vlefevre | 2013-08-07 20:22:46 +0000 (Wed, 07 Aug 2013) | 3 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Reverted changeset r8657 as %a is C99-only. Moreover +the memory representation already gives the necessary information (and +the decimal output was correct on the machine where the test fails). +------------------------------------------------------------------------ +r8658 | zimmerma | 2013-08-07 20:13:50 +0000 (Wed, 07 Aug 2013) | 3 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tset_ld.c] maybe this will fix the issue for i686-freebsd? + Cf http://hydra.nixos.org/build/5662697. + +------------------------------------------------------------------------ +r8657 | zimmerma | 2013-08-07 19:55:02 +0000 (Wed, 07 Aug 2013) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tset_ld.c] in case of error, print d in hexadecimal + +------------------------------------------------------------------------ +r8656 | vlefevre | 2013-08-07 09:56:38 +0000 (Wed, 07 Aug 2013) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] In the "mpfr_set_ld should be exact" error, output +the memory representation of d. +------------------------------------------------------------------------ +r8655 | zimmerma | 2013-08-07 08:56:42 +0000 (Wed, 07 Aug 2013) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tset_ld.c] print value of MPFR_LDBL_MANT_DIG in case of error + +------------------------------------------------------------------------ +r8654 | vlefevre | 2013-08-07 01:24:06 +0000 (Wed, 07 Aug 2013) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Space consistency. +------------------------------------------------------------------------ +r8653 | vlefevre | 2013-08-06 08:09:27 +0000 (Tue, 06 Aug 2013) | 1 line +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Corrected a comment. +------------------------------------------------------------------------ +r8652 | vlefevre | 2013-08-06 02:00:54 +0000 (Tue, 06 Aug 2013) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Set some long double variables as volatile in order to +avoid optimizations that yield failures with xlc on power7 (not tested). +------------------------------------------------------------------------ +r8651 | vlefevre | 2013-08-06 00:48:02 +0000 (Tue, 06 Aug 2013) | 2 lines +Changed paths: + M /trunk/src/get_ld.c + +[src/get_ld.c] Oops... The non-working code was due to a missing cast. +So, simplified the code. +------------------------------------------------------------------------ +r8650 | vlefevre | 2013-08-06 00:44:25 +0000 (Tue, 06 Aug 2013) | 3 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/src/get_ld.c + +[acinclude.m4] Define HAVE_LDOUBLE_MAYBE_DOUBLE_DOUBLE if the + "long double" format seems to be double-double (e.g. on PowerPC). +[src/get_ld.c] Added double-double support. +------------------------------------------------------------------------ +r8649 | vlefevre | 2013-08-05 23:31:54 +0000 (Mon, 05 Aug 2013) | 1 line +Changed paths: + M /trunk/src/get_ld.c + +[src/get_ld.c] GNU style. +------------------------------------------------------------------------ +r8648 | vlefevre | 2013-08-05 23:28:01 +0000 (Mon, 05 Aug 2013) | 1 line +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Improved output in case of error. +------------------------------------------------------------------------ +r8647 | vlefevre | 2013-08-05 23:05:45 +0000 (Mon, 05 Aug 2013) | 5 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Improved check_set_get() test function; in particular, +it no longer takes a mpfr_t argument: the precision of the MPFR number +is now determined dynamically from the long double d. Thus some numbers +having a precision > MPFR_LDBL_MANT_DIG in double-double arithmetic are +now tested (e.g. on PowerPC). +------------------------------------------------------------------------ +r8645 | vlefevre | 2013-08-05 16:38:39 +0000 (Mon, 05 Aug 2013) | 3 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] "correctly-rounded" → "correctly rounded" (see rule on +http://en.wikipedia.org/wiki/Wikipedia:HYPHEN#Hyphens and the IEEE 754 +and ISO C standards don't use a hyphen either). +------------------------------------------------------------------------ +r8644 | vlefevre | 2013-08-05 02:13:23 +0000 (Mon, 05 Aug 2013) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added missing @code{}'s in mpfr_fpif_import description. +------------------------------------------------------------------------ +r8643 | vlefevre | 2013-08-05 02:08:04 +0000 (Mon, 05 Aug 2013) | 6 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Replaced periods ending a sentence by "@." in the +following cases: when the preceding character is a capital letter +or a closing parenthesis following a capital letter (e.g. "NaN.", +"MPFR.", "MPFR).", etc). This is needed to get correct spacing in +the generated .info and PDF files with the next sentence of the +paragraph (when there is one). +------------------------------------------------------------------------ +r8642 | vlefevre | 2013-08-05 01:17:15 +0000 (Mon, 05 Aug 2013) | 4 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Removed the "check largest 2^k that is representable +as a long double" test based on macros LDBL_MAX and LDBL_EPSILON, which +are not correct in some C implementations. There is already another +"check the largest power of two" test, based on a loop, which is OK. +------------------------------------------------------------------------ +r8641 | zimmerma | 2013-08-04 10:53:07 +0000 (Sun, 04 Aug 2013) | 4 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tset_ld.c] improve tests to avoid spurious errors for double-double + representation where MPFR_LDBL_MANT_DIG=106 and numbers + with 107 bits or more + +------------------------------------------------------------------------ +r8640 | vlefevre | 2013-08-02 23:24:44 +0000 (Fri, 02 Aug 2013) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Document that log1p(-1) = -Inf. +------------------------------------------------------------------------ +r8639 | vlefevre | 2013-08-02 23:17:16 +0000 (Fri, 02 Aug 2013) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r8638 | vlefevre | 2013-08-02 23:15:42 +0000 (Fri, 02 Aug 2013) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Moved mpfr_log1p & mpfr_expm1 after mpfr_log & mpfr_exp +respectively. +------------------------------------------------------------------------ +r8637 | vlefevre | 2013-08-02 08:29:06 +0000 (Fri, 02 Aug 2013) | 1 line +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] Comment on LDBL_MAX. +------------------------------------------------------------------------ +r8636 | zimmerma | 2013-08-02 08:21:33 +0000 (Fri, 02 Aug 2013) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tset_ld.c] missing conversion from int to mpfr_rnd_t + +------------------------------------------------------------------------ +r8635 | zimmerma | 2013-08-02 07:26:02 +0000 (Fri, 02 Aug 2013) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tset_ld.c] improve error message + +------------------------------------------------------------------------ +r8634 | vlefevre | 2013-08-02 03:21:02 +0000 (Fri, 02 Aug 2013) | 1 line +Changed paths: + M /trunk/src/set_ld.c + +[src/set_ld.c] Corrected a comment. +------------------------------------------------------------------------ +r8633 | vlefevre | 2013-08-01 14:15:30 +0000 (Thu, 01 Aug 2013) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Completed specification of mpfr_lngamma and mpfr_lgamma +on 1 and 2 (result is +0). +------------------------------------------------------------------------ +r8632 | vlefevre | 2013-08-01 13:52:40 +0000 (Thu, 01 Aug 2013) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Improved description of mpfr_rec_sqrt and mpfr_hypot. +------------------------------------------------------------------------ +r8631 | vlefevre | 2013-08-01 13:41:24 +0000 (Thu, 01 Aug 2013) | 1 line +Changed paths: + M /trunk/tests + +[tests] Added terandom and tnrandom to svn:ignore property. +------------------------------------------------------------------------ +r8630 | vlefevre | 2013-08-01 13:34:41 +0000 (Thu, 01 Aug 2013) | 1 line +Changed paths: + M /trunk/src/acos.c + M /trunk/src/acosh.c + M /trunk/src/log.c + M /trunk/src/rec_sqrt.c + +[src] Improved some comments with "0", about its sign. +------------------------------------------------------------------------ +r8629 | vlefevre | 2013-08-01 13:33:33 +0000 (Thu, 01 Aug 2013) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Completed specification on special numbers (±0, ±Inf). +------------------------------------------------------------------------ +r8628 | zimmerma | 2013-08-01 07:58:05 +0000 (Thu, 01 Aug 2013) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tset_ld.c] increase precision to take into account double-double encoding + +------------------------------------------------------------------------ +r8627 | zimmerma | 2013-08-01 07:10:05 +0000 (Thu, 01 Aug 2013) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tset_ld.c] replaced error by warning when _GMP_IEEE_FLOATS is not defined + +------------------------------------------------------------------------ +r8625 | vlefevre | 2013-07-22 14:32:12 +0000 (Mon, 22 Jul 2013) | 4 lines +Changed paths: + M /trunk/src/mpfr-sassert.h + +[src/mpfr-sassert.h] Get rid of annoying warnings + typedef 'MPFR_ASSERT_xxx' locally defined but not used +with GCC 4.8+ (better than the non-portable solution r8618). Thanks to +Jonathan Wakely: https://gcc.gnu.org/ml/gcc-help/2013-07/msg00142.html +------------------------------------------------------------------------ +r8624 | zimmerma | 2013-07-22 12:06:18 +0000 (Mon, 22 Jul 2013) | 4 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] revert commit 8618 since it breaks hydra jobs i686-cygwin, + i686-freebsd, i686-solaris and x86_64-freebsd + (cf http://hydra.nixos.org/eval/955753) + +------------------------------------------------------------------------ +r8621 | vlefevre | 2013-07-22 02:20:41 +0000 (Mon, 22 Jul 2013) | 3 lines +Changed paths: + M /trunk/src/asinh.c + M /trunk/src/atanh.c + M /trunk/src/cosh.c + M /trunk/src/digamma.c + M /trunk/src/eint.c + M /trunk/src/erfc.c + M /trunk/src/exp2.c + M /trunk/src/factorial.c + M /trunk/src/init2.c + M /trunk/src/log10.c + M /trunk/src/log1p.c + M /trunk/src/log2.c + M /trunk/src/mpf2mpfr.h + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-longlong.h + M /trunk/src/pow.c + M /trunk/src/pow_si.c + M /trunk/src/pow_z.c + M /trunk/src/rec_sqrt.c + M /trunk/src/sinh.c + M /trunk/src/sinh_cosh.c + M /trunk/src/sub1.c + M /trunk/src/sub1sp.c + M /trunk/src/sum.c + M /trunk/src/tanh.c + M /trunk/src/ui_pow_ui.c + M /trunk/src/vasprintf.c + M /trunk/src/zeta.c + M /trunk/tests/mpf_compat.h + M /trunk/tests/tabort_prec_max.c + M /trunk/tests/tget_sj.c + M /trunk/tests/tprintf.c + M /trunk/tests/tset_si.c + M /trunk/tests/tsprintf.c + M /trunk/tools/mbench/timp.h + M /trunk/tune/bidimensional_sample.c + M /trunk/tune/tuneup.c + +Applied patch 3 by Ondřej Bílka with some manual corrections, +fixing typos: + https://sympa.inria.fr/sympa/arc/mpfr/2013-07/msg00016.html +------------------------------------------------------------------------ +r8620 | vlefevre | 2013-07-22 02:04:00 +0000 (Mon, 22 Jul 2013) | 2 lines +Changed paths: + M /trunk/src/mpfr-longlong.h + M /trunk/src/round_raw_generic.c + M /trunk/src/strtofr.c + M /trunk/src/sub1sp.c + M /trunk/src/sum.c + M /trunk/src/zeta.c + +Applied patch 2 by Ondřej Bílka, fixing capitalization: + https://sympa.inria.fr/sympa/arc/mpfr/2013-07/msg00015.html +------------------------------------------------------------------------ +r8619 | vlefevre | 2013-07-22 02:01:45 +0000 (Mon, 22 Jul 2013) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + M /trunk/src/nrandom.c + M /trunk/src/set_uj.c + M /trunk/src/sub1sp.c + M /trunk/src/vasprintf.c + M /trunk/tools/mbench/mpfr-v4.c + M /trunk/tools/mbench/mpfr-v6.c + +Applied patch 1 by Ondřej Bílka, fixing common typos: + https://sympa.inria.fr/sympa/arc/mpfr/2013-07/msg00014.html +------------------------------------------------------------------------ +r8618 | vlefevre | 2013-07-22 01:58:23 +0000 (Mon, 22 Jul 2013) | 3 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] Added -Wno-unused-local-typedefs flag to avoid spurious +"typedef 'MPFR_ASSERT_xxx' locally defined but not used" warnings due +to the implementation of static assertions. +------------------------------------------------------------------------ +r8617 | vlefevre | 2013-07-16 16:55:33 +0000 (Tue, 16 Jul 2013) | 1 line +Changed paths: + M /trunk/doc/README.dev + +Slightly restructured doc/README.dev and mentioned C-Reduce. +------------------------------------------------------------------------ +r8616 | vlefevre | 2013-07-12 10:51:19 +0000 (Fri, 12 Jul 2013) | 4 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] If the gmp.h vs libgmp test fails, also output the value +of some variables (in case config.log is available, information can +also be retrieved from "Cache variables" and "Output variables" near +the end). +------------------------------------------------------------------------ +r8615 | zimmerma | 2013-07-12 07:28:18 +0000 (Fri, 12 Jul 2013) | 2 lines +Changed paths: + M /trunk/configure.ac + +revert temporary commit 8613 + +------------------------------------------------------------------------ +r8614 | vlefevre | 2013-07-11 11:33:12 +0000 (Thu, 11 Jul 2013) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Improved MPFR_CHECK_DBL2INT_BUG in case of failure +and added comments about that. +------------------------------------------------------------------------ +r8613 | zimmerma | 2013-07-11 10:07:51 +0000 (Thu, 11 Jul 2013) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] temporary commit to investigate problem with i686-solaris on hydra + +------------------------------------------------------------------------ +r8612 | vlefevre | 2013-07-11 01:58:44 +0000 (Thu, 11 Jul 2013) | 3 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] In the CC and CFLAGS setup from gmp.h, modified the +list of commands to select the C preprocessor since /lib/cpp isn't +the best choice under Solaris. +------------------------------------------------------------------------ +r8611 | vlefevre | 2013-07-11 01:38:47 +0000 (Thu, 11 Jul 2013) | 3 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] Moved AM_PROG_AR (introduced in r8546) after the +CC and CFLAGS setup from gmp.h, because AM_PROG_AR makes Autoconf +select a compiler (before it may be chosen from __GMP_CC). +------------------------------------------------------------------------ +r8610 | vlefevre | 2013-07-11 01:24:13 +0000 (Thu, 11 Jul 2013) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] The test of CC and CFLAGS was done too late! Moved this +test earlier (checked on Debian/unstable with autoconf 2.69). +------------------------------------------------------------------------ +r8609 | vlefevre | 2013-07-10 15:24:00 +0000 (Wed, 10 Jul 2013) | 1 line +Changed paths: + M /trunk/configure.ac + +[configure.ac] Improved r8608 (gmp.h/libgmp on stderr). +------------------------------------------------------------------------ +r8608 | zimmerma | 2013-07-10 15:11:48 +0000 (Wed, 10 Jul 2013) | 3 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] print also the versions of gmp.h/libgmp on stderr, hoping they + will appear on i686-solaris + +------------------------------------------------------------------------ +r8607 | zimmerma | 2013-07-10 14:44:20 +0000 (Wed, 10 Jul 2013) | 2 lines +Changed paths: + M /trunk/src/exp_2.c + +[src/exp_2.c] removed useless instruction + +------------------------------------------------------------------------ +r8606 | vlefevre | 2013-07-10 14:09:19 +0000 (Wed, 10 Jul 2013) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Corrected change in r8602 to get an error in the case +i == 0 and u != 1. +------------------------------------------------------------------------ +r8605 | zimmerma | 2013-07-10 13:48:43 +0000 (Wed, 10 Jul 2013) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] added fflush to see versions of gmp.h/libgmp + +------------------------------------------------------------------------ +r8604 | vlefevre | 2013-07-10 13:12:20 +0000 (Wed, 10 Jul 2013) | 2 lines +Changed paths: + M /trunk/src/exp_2.c + +[src/exp_2.c] Fixed undefined behavior (present in all MPFR versions) +detected by "clang -fsanitize=undefined". +------------------------------------------------------------------------ +r8603 | vlefevre | 2013-07-10 13:06:51 +0000 (Wed, 10 Jul 2013) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Suggest to test with "clang -fsanitize=undefined"; +see . +------------------------------------------------------------------------ +r8602 | zimmerma | 2013-07-10 13:05:06 +0000 (Wed, 10 Jul 2013) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +more helpful debug information + +------------------------------------------------------------------------ +r8601 | zimmerma | 2013-07-10 13:02:51 +0000 (Wed, 10 Jul 2013) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +added debug information for double-to-integer conversion bug + +------------------------------------------------------------------------ +r8600 | vlefevre | 2013-07-09 16:08:49 +0000 (Tue, 09 Jul 2013) | 1 line +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Updated a comment about ICC. +------------------------------------------------------------------------ +r8599 | vlefevre | 2013-07-09 16:00:39 +0000 (Tue, 09 Jul 2013) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added URL about compiler detection. +------------------------------------------------------------------------ +r8595 | vlefevre | 2013-06-07 15:47:07 +0000 (Fri, 07 Jun 2013) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Another update about signed and unsigned integer types. +------------------------------------------------------------------------ +r8594 | vlefevre | 2013-06-07 15:39:16 +0000 (Fri, 07 Jun 2013) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Update about signed and unsigned integer types. +------------------------------------------------------------------------ +r8593 | zimmerma | 2013-06-07 14:16:40 +0000 (Fri, 07 Jun 2013) | 3 lines +Changed paths: + M /trunk/src/random_deviate.c + M /trunk/tests/Makefile.am + +[src/random_deviate.c] applied patch from Charles Karney +[tests/Makefile.am] reorder test files + +------------------------------------------------------------------------ +r8592 | vlefevre | 2013-06-07 12:00:23 +0000 (Fri, 07 Jun 2013) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added URL's about C++ reserved keywords. +------------------------------------------------------------------------ +r8591 | zimmerma | 2013-06-07 11:35:57 +0000 (Fri, 07 Jun 2013) | 4 lines +Changed paths: + M /trunk/src/random_deviate.h + M /trunk/tests/tget_sj.c + M /trunk/tests/tset_si.c + +changed to allow compilation with C++: +[src/random_deviate.h] must declare the types before extern C {...} +[tests/tget_sj.c,tests/tset_si.c] "not" seems to be reserved in C++ + +------------------------------------------------------------------------ +r8590 | vlefevre | 2013-06-07 08:09:04 +0000 (Fri, 07 Jun 2013) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + +[doc/algorithms.tex] Slightly improved a bound under which mpfr_hypot +cannot have an internal underflow, thus is correct. +------------------------------------------------------------------------ +r8589 | vlefevre | 2013-06-06 23:39:56 +0000 (Thu, 06 Jun 2013) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Improved a test to avoid false positives. +------------------------------------------------------------------------ +r8588 | vlefevre | 2013-06-06 14:22:26 +0000 (Thu, 06 Jun 2013) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + +[doc/algorithms.tex] Updated/improved the proof of mpfr_hypot in the +scaling case. +------------------------------------------------------------------------ +r8587 | vlefevre | 2013-06-06 13:38:02 +0000 (Thu, 06 Jun 2013) | 2 lines +Changed paths: + M /trunk/src/hypot.c + +[src/hypot.c] Slightly improved scaling to avoid even more underflow +in the scaling of y or in its square. +------------------------------------------------------------------------ +r8586 | vlefevre | 2013-06-06 12:28:06 +0000 (Thu, 06 Jun 2013) | 1 line +Changed paths: + M /trunk/src/hypot.c + +[src/hypot.c] Added a comment on the FIXME. +------------------------------------------------------------------------ +r8585 | vlefevre | 2013-06-06 12:03:49 +0000 (Thu, 06 Jun 2013) | 1 line +Changed paths: + M /trunk/src/mpfr-gmp.h + +[src/mpfr-gmp.h] Removed useless and meaningless definitions. +------------------------------------------------------------------------ +r8584 | vlefevre | 2013-06-06 11:47:58 +0000 (Thu, 06 Jun 2013) | 3 lines +Changed paths: + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + +[src] Moved mp_bitcnt_t definition for GMP < 5 from mpfr-gmp.h to +mpfr-impl.h (mpfr-gmp.h is only for definitions from GMP internals +as it is included only in builds without GMP internals). +------------------------------------------------------------------------ +r8583 | vlefevre | 2013-06-06 11:38:51 +0000 (Thu, 06 Jun 2013) | 1 line +Changed paths: + M /trunk/src/mpfr-gmp.h + +[src/mpfr-gmp.h] Fixed mp_bitcnt_t presence test. +------------------------------------------------------------------------ +r8582 | zimmerma | 2013-06-06 11:12:55 +0000 (Thu, 06 Jun 2013) | 2 lines +Changed paths: + M /trunk/src/mpfr-gmp.h + +changed macro to typedef when mp_bitcnt_t is missing (for coherence with GMP) + +------------------------------------------------------------------------ +r8581 | zimmerma | 2013-06-06 06:53:57 +0000 (Thu, 06 Jun 2013) | 2 lines +Changed paths: + M /trunk/src/nrandom.c + M /trunk/src/random_deviate.c + +fixed compiler warnings + +------------------------------------------------------------------------ +r8580 | zimmerma | 2013-06-06 05:48:37 +0000 (Thu, 06 Jun 2013) | 3 lines +Changed paths: + M /trunk/src/hypot.c + M /trunk/src/mpfr-gmp.h + +[mpfr-gmp.h] added replacement for mp_bitcnt_t +[hypot.c] added comment + +------------------------------------------------------------------------ +r8579 | zimmerma | 2013-06-05 15:29:17 +0000 (Wed, 05 Jun 2013) | 2 lines +Changed paths: + M /trunk/src/erandom.c + M /trunk/src/nrandom.c + M /trunk/src/random_deviate.c + M /trunk/src/random_deviate.h + +applied patch from Charles Karney + +------------------------------------------------------------------------ +r8578 | vlefevre | 2013-06-05 13:58:18 +0000 (Wed, 05 Jun 2013) | 2 lines +Changed paths: + M /trunk/README + +[README] Added ar-lib (due to AM_PROG_AR in r8546) and test-driver +(installed by Automake 1.12+). +------------------------------------------------------------------------ +r8574 | vlefevre | 2013-06-03 08:34:46 +0000 (Mon, 03 Jun 2013) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r8573 | vlefevre | 2013-06-02 19:07:51 +0000 (Sun, 02 Jun 2013) | 3 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] In AM_INIT_AUTOMAKE, lowered Automake version requirement +to 1.11.2 (for AM_PROG_AR), as Ubuntu 12.04 LTS only has Automake 1.11.3 +(we assume that such distributions have a security patch). +------------------------------------------------------------------------ +r8572 | vlefevre | 2013-06-02 14:17:52 +0000 (Sun, 02 Jun 2013) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] In AM_INIT_AUTOMAKE, require Automake 1.11.6 for +AM_PROG_AR and security reasons. +------------------------------------------------------------------------ +r8571 | vlefevre | 2013-06-02 13:59:51 +0000 (Sun, 02 Jun 2013) | 1 line +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + +[NEWS,doc/mpfr.texi] New and deprecated functions in MPFR 3.2. +------------------------------------------------------------------------ +r8570 | vlefevre | 2013-06-02 13:47:38 +0000 (Sun, 02 Jun 2013) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/grandom.c + +Spelling: gaussian -> Gaussian (Wikipedia, Wolfram MathWorld, dict). +------------------------------------------------------------------------ +r8569 | vlefevre | 2013-06-02 13:39:55 +0000 (Sun, 02 Jun 2013) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Slight doc improvement for mpfr_grandom. +------------------------------------------------------------------------ +r8568 | zimmerma | 2013-06-01 11:05:15 +0000 (Sat, 01 Jun 2013) | 2 lines +Changed paths: + M /trunk/src/random_deviate.c + +added assertion + +------------------------------------------------------------------------ +r8567 | vlefevre | 2013-06-01 09:23:02 +0000 (Sat, 01 Jun 2013) | 1 line +Changed paths: + M /trunk/src/random_deviate.c + +[src/random_deviate.c] Updated a comment. +------------------------------------------------------------------------ +r8566 | zimmerma | 2013-06-01 08:35:30 +0000 (Sat, 01 Jun 2013) | 3 lines +Changed paths: + M /trunk/src/random_deviate.c + +in case mp_limb_t is smaller than unsigned long, use alternate code for +highest_bit_idx + +------------------------------------------------------------------------ +r8565 | vlefevre | 2013-06-01 00:50:16 +0000 (Sat, 01 Jun 2013) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Update for random_deviate. +------------------------------------------------------------------------ +r8564 | vlefevre | 2013-06-01 00:46:16 +0000 (Sat, 01 Jun 2013) | 1 line +Changed paths: + M /trunk/src/nrandom.c + +[src/nrandom.c] Corrected indentation. +------------------------------------------------------------------------ +r8563 | vlefevre | 2013-06-01 00:37:16 +0000 (Sat, 01 Jun 2013) | 1 line +Changed paths: + M /trunk/src/random_deviate.h + +[src/random_deviate.h] Fixed a typo in a macro name. +------------------------------------------------------------------------ +r8562 | vlefevre | 2013-06-01 00:33:47 +0000 (Sat, 01 Jun 2013) | 1 line +Changed paths: + M /trunk/src/random_deviate.c + +[src/random_deviate.c] Removed trailing spaces. +------------------------------------------------------------------------ +r8561 | vlefevre | 2013-06-01 00:32:35 +0000 (Sat, 01 Jun 2013) | 2 lines +Changed paths: + M /trunk + +Added ar-lib to svn:ignore property (this script comes from Automake, +due to the use of AM_PROG_AR in configure.ac as of r8546). +------------------------------------------------------------------------ +r8560 | vlefevre | 2013-05-31 16:11:47 +0000 (Fri, 31 May 2013) | 3 lines +Changed paths: + M /trunk/tests/memory.c + +[tests/memory.c] Added a FIXME comment about the time complexity of +tests_memory_find (Paul Zimmermann noticed that tgrandom on a large +value takes a lot of time, probably because of that). +------------------------------------------------------------------------ +r8559 | zimmerma | 2013-05-31 15:14:44 +0000 (Fri, 31 May 2013) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + +updated NEWS and contribution section in mpfr.texi + +------------------------------------------------------------------------ +r8558 | zimmerma | 2013-05-31 14:55:53 +0000 (Fri, 31 May 2013) | 2 lines +Changed paths: + M /trunk/src/random_deviate.c + +#include <...> -> #include "..." for local files + +------------------------------------------------------------------------ +r8557 | zimmerma | 2013-05-31 14:46:39 +0000 (Fri, 31 May 2013) | 2 lines +Changed paths: + M /trunk/src/random_deviate.c + +removed obsolete comment + +------------------------------------------------------------------------ +r8556 | zimmerma | 2013-05-31 13:34:12 +0000 (Fri, 31 May 2013) | 2 lines +Changed paths: + M /trunk/src/nrandom.c + +GNU style + +------------------------------------------------------------------------ +r8555 | zimmerma | 2013-05-31 13:28:51 +0000 (Fri, 31 May 2013) | 2 lines +Changed paths: + M /trunk/src/erandom.c + +GNU style + +------------------------------------------------------------------------ +r8554 | zimmerma | 2013-05-31 13:25:41 +0000 (Fri, 31 May 2013) | 2 lines +Changed paths: + M /trunk/src/random_deviate.c + +GNU style + +------------------------------------------------------------------------ +r8553 | zimmerma | 2013-05-31 12:55:49 +0000 (Fri, 31 May 2013) | 2 lines +Changed paths: + M /trunk/tests/Makefile.am + A /trunk/tests/terandom.c + A /trunk/tests/tnrandom.c + +added tests files for mpfr_nrandom and mpfr_erandom + +------------------------------------------------------------------------ +r8552 | zimmerma | 2013-05-31 12:43:52 +0000 (Fri, 31 May 2013) | 3 lines +Changed paths: + M /trunk/src/random_deviate.c + +removed RANDOM_SIMPLE=1 stuff (this was an alternate slower implementation). +Kept in svn history as a reference. + +------------------------------------------------------------------------ +r8551 | zimmerma | 2013-05-31 12:40:37 +0000 (Fri, 31 May 2013) | 2 lines +Changed paths: + M /trunk/src/nrandom.c + +removed mpfr_grandom_alt (likewise previous commit) + +------------------------------------------------------------------------ +r8550 | zimmerma | 2013-05-31 12:39:03 +0000 (Fri, 31 May 2013) | 4 lines +Changed paths: + M /trunk/src/random_deviate.c + +removed mpfr_urandom_alt (slower than mpfr_urandom, but it can be recovered +from the svn history to illustrate one of the basic properties of a newly +initialized mpfr_random_deviate_t) + +------------------------------------------------------------------------ +r8549 | zimmerma | 2013-05-31 12:36:40 +0000 (Fri, 31 May 2013) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/Makefile.am + D /trunk/src/mpfr_random.h + M /trunk/src/random_deviate.h + +removed mpfr_random.h, headers are in mpfr.h + +------------------------------------------------------------------------ +r8548 | zimmerma | 2013-05-31 12:30:01 +0000 (Fri, 31 May 2013) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/Makefile.am + A /trunk/src/erandom.c + M /trunk/src/mpfr.h + A /trunk/src/mpfr_random.h + A /trunk/src/nrandom.c + A /trunk/src/random_deviate.c + A /trunk/src/random_deviate.h + +original contribution from Charles Karney + +------------------------------------------------------------------------ +r8547 | vlefevre | 2013-05-30 17:34:52 +0000 (Thu, 30 May 2013) | 1 line +Changed paths: + D /trunk/tools/update-patchv + +Removed obsolete tools/update-patchv script. Use update-version instead. +------------------------------------------------------------------------ +r8546 | vlefevre | 2013-05-30 16:03:49 +0000 (Thu, 30 May 2013) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] Added AM_PROG_AR to support unusual archivers +(after a warning from Automake 1.13). +------------------------------------------------------------------------ +r8544 | vlefevre | 2013-05-30 15:57:33 +0000 (Thu, 30 May 2013) | 1 line +Changed paths: + M /trunk/tools/ck-copyright-notice + +[tools/ck-copyright-notice] Update for copyright year ranges. +------------------------------------------------------------------------ +r8542 | vlefevre | 2013-05-30 15:54:39 +0000 (Thu, 30 May 2013) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r8540 | vlefevre | 2013-05-30 15:53:07 +0000 (Thu, 30 May 2013) | 2 lines +Changed paths: + M /trunk/BUGS + M /trunk/INSTALL + M /trunk/Makefile.am + M /trunk/NEWS + M /trunk/README + M /trunk/TODO + M /trunk/acinclude.m4 + M /trunk/configure.ac + M /trunk/doc/FAQ.html + M /trunk/doc/Makefile.am + M /trunk/doc/README.dev + M /trunk/doc/faq.xsl + M /trunk/doc/mpfr.texi + M /trunk/examples/divworst.c + M /trunk/examples/rndo-add.c + M /trunk/examples/sample.c + M /trunk/examples/version.c + M /trunk/src/Makefile.am + M /trunk/src/abort_prec_max.c + M /trunk/src/acos.c + M /trunk/src/acosh.c + M /trunk/src/add.c + M /trunk/src/add1.c + M /trunk/src/add1sp.c + M /trunk/src/add_d.c + M /trunk/src/add_ui.c + M /trunk/src/agm.c + M /trunk/src/ai.c + M /trunk/src/amd/amdfam10/mparam.h + M /trunk/src/amd/athlon/mparam.h + M /trunk/src/amd/k8/mparam.h + M /trunk/src/arm/mparam.h + M /trunk/src/asin.c + M /trunk/src/asinh.c + M /trunk/src/atan.c + M /trunk/src/atan2.c + M /trunk/src/atanh.c + M /trunk/src/bernoulli.c + M /trunk/src/buildopt.c + M /trunk/src/cache.c + M /trunk/src/cbrt.c + M /trunk/src/check.c + M /trunk/src/clear.c + M /trunk/src/clears.c + M /trunk/src/cmp.c + M /trunk/src/cmp2.c + M /trunk/src/cmp_abs.c + M /trunk/src/cmp_d.c + M /trunk/src/cmp_ld.c + M /trunk/src/cmp_si.c + M /trunk/src/cmp_ui.c + M /trunk/src/comparisons.c + M /trunk/src/const_catalan.c + M /trunk/src/const_euler.c + M /trunk/src/const_log2.c + M /trunk/src/const_pi.c + M /trunk/src/constant.c + M /trunk/src/copysign.c + M /trunk/src/cos.c + M /trunk/src/cosh.c + M /trunk/src/cot.c + M /trunk/src/coth.c + M /trunk/src/csc.c + M /trunk/src/csch.c + M /trunk/src/d_div.c + M /trunk/src/d_sub.c + M /trunk/src/digamma.c + M /trunk/src/dim.c + M /trunk/src/div.c + M /trunk/src/div_2exp.c + M /trunk/src/div_2si.c + M /trunk/src/div_2ui.c + M /trunk/src/div_d.c + M /trunk/src/div_ui.c + M /trunk/src/dump.c + M /trunk/src/eint.c + M /trunk/src/eq.c + M /trunk/src/erf.c + M /trunk/src/erfc.c + M /trunk/src/exceptions.c + M /trunk/src/exp.c + M /trunk/src/exp10.c + M /trunk/src/exp2.c + M /trunk/src/exp3.c + M /trunk/src/exp_2.c + M /trunk/src/expm1.c + M /trunk/src/extract.c + M /trunk/src/factorial.c + M /trunk/src/fits_intmax.c + M /trunk/src/fits_s.h + M /trunk/src/fits_sint.c + M /trunk/src/fits_slong.c + M /trunk/src/fits_sshort.c + M /trunk/src/fits_u.h + M /trunk/src/fits_uint.c + M /trunk/src/fits_uintmax.c + M /trunk/src/fits_ulong.c + M /trunk/src/fits_ushort.c + M /trunk/src/fma.c + M /trunk/src/fms.c + M /trunk/src/fpif.c + M /trunk/src/frac.c + M /trunk/src/free_cache.c + M /trunk/src/frexp.c + M /trunk/src/gamma.c + M /trunk/src/gammaonethird.c + M /trunk/src/gen_inverse.h + M /trunk/src/generic/coverage/mparam.h + M /trunk/src/generic/mparam.h + M /trunk/src/get_d.c + M /trunk/src/get_d64.c + M /trunk/src/get_exp.c + M /trunk/src/get_f.c + M /trunk/src/get_float128.c + M /trunk/src/get_flt.c + M /trunk/src/get_ld.c + M /trunk/src/get_si.c + M /trunk/src/get_sj.c + M /trunk/src/get_str.c + M /trunk/src/get_ui.c + M /trunk/src/get_uj.c + M /trunk/src/get_z.c + M /trunk/src/get_z_exp.c + M /trunk/src/gmp_op.c + M /trunk/src/grandom.c + M /trunk/src/hppa/mparam.h + M /trunk/src/hypot.c + M /trunk/src/ia64/mparam.h + M /trunk/src/ieee_floats.h + M /trunk/src/init.c + M /trunk/src/init2.c + M /trunk/src/inits.c + M /trunk/src/inits2.c + M /trunk/src/inp_str.c + M /trunk/src/int_ceil_log2.c + M /trunk/src/isinf.c + M /trunk/src/isinteger.c + M /trunk/src/isnan.c + M /trunk/src/isnum.c + M /trunk/src/isqrt.c + M /trunk/src/isregular.c + M /trunk/src/iszero.c + M /trunk/src/jn.c + M /trunk/src/jyn_asympt.c + M /trunk/src/li2.c + M /trunk/src/lngamma.c + M /trunk/src/log.c + M /trunk/src/log10.c + M /trunk/src/log1p.c + M /trunk/src/log2.c + M /trunk/src/logging.c + M /trunk/src/min_prec.c + M /trunk/src/minmax.c + M /trunk/src/mips/mparam.h + M /trunk/src/modf.c + M /trunk/src/mp_clz_tab.c + M /trunk/src/mparam_h.in + M /trunk/src/mpf2mpfr.h + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-intmax.h + M /trunk/src/mpfr-sassert.h + M /trunk/src/mpfr-thread.h + M /trunk/src/mpfr.h + M /trunk/src/mpn_exp.c + M /trunk/src/mul.c + M /trunk/src/mul_2exp.c + M /trunk/src/mul_2si.c + M /trunk/src/mul_2ui.c + M /trunk/src/mul_d.c + M /trunk/src/mul_ui.c + M /trunk/src/mulders.c + M /trunk/src/neg.c + M /trunk/src/next.c + M /trunk/src/out_str.c + M /trunk/src/pow.c + M /trunk/src/pow_si.c + M /trunk/src/pow_ui.c + M /trunk/src/pow_z.c + M /trunk/src/powerof2.c + M /trunk/src/powerpc32/mparam.h + M /trunk/src/powerpc64/mparam.h + M /trunk/src/print_raw.c + M /trunk/src/print_rnd_mode.c + M /trunk/src/printf.c + M /trunk/src/rec_sqrt.c + M /trunk/src/reldiff.c + M /trunk/src/rem1.c + M /trunk/src/rint.c + M /trunk/src/rndna.c + M /trunk/src/root.c + M /trunk/src/round_near_x.c + M /trunk/src/round_p.c + M /trunk/src/round_prec.c + M /trunk/src/round_raw_generic.c + M /trunk/src/scale2.c + M /trunk/src/sec.c + M /trunk/src/sech.c + M /trunk/src/set.c + M /trunk/src/set_d.c + M /trunk/src/set_d64.c + M /trunk/src/set_dfl_prec.c + M /trunk/src/set_exp.c + M /trunk/src/set_f.c + M /trunk/src/set_float128.c + M /trunk/src/set_flt.c + M /trunk/src/set_inf.c + M /trunk/src/set_ld.c + M /trunk/src/set_nan.c + M /trunk/src/set_prc_raw.c + M /trunk/src/set_prec.c + M /trunk/src/set_q.c + M /trunk/src/set_rnd.c + M /trunk/src/set_si.c + M /trunk/src/set_si_2exp.c + M /trunk/src/set_sj.c + M /trunk/src/set_str.c + M /trunk/src/set_str_raw.c + M /trunk/src/set_ui.c + M /trunk/src/set_ui_2exp.c + M /trunk/src/set_uj.c + M /trunk/src/set_z.c + M /trunk/src/set_z_exp.c + M /trunk/src/set_zero.c + M /trunk/src/setmax.c + M /trunk/src/setmin.c + M /trunk/src/setsign.c + M /trunk/src/sgn.c + M /trunk/src/si_op.c + M /trunk/src/signbit.c + M /trunk/src/sin.c + M /trunk/src/sin_cos.c + M /trunk/src/sinh.c + M /trunk/src/sinh_cosh.c + M /trunk/src/sparc64/mparam.h + M /trunk/src/sqr.c + M /trunk/src/sqrt.c + M /trunk/src/sqrt_ui.c + M /trunk/src/stack_interface.c + M /trunk/src/strtofr.c + M /trunk/src/sub.c + M /trunk/src/sub1.c + M /trunk/src/sub1sp.c + M /trunk/src/sub_d.c + M /trunk/src/sub_ui.c + M /trunk/src/subnormal.c + M /trunk/src/sum.c + M /trunk/src/swap.c + M /trunk/src/tan.c + M /trunk/src/tanh.c + M /trunk/src/uceil_exp2.c + M /trunk/src/uceil_log2.c + M /trunk/src/ufloor_log2.c + M /trunk/src/ui_div.c + M /trunk/src/ui_pow.c + M /trunk/src/ui_pow_ui.c + M /trunk/src/ui_sub.c + M /trunk/src/urandom.c + M /trunk/src/urandomb.c + M /trunk/src/vasprintf.c + M /trunk/src/version.c + M /trunk/src/volatile.c + M /trunk/src/x86/core2/mparam.h + M /trunk/src/x86/mparam.h + M /trunk/src/x86_64/core2/mparam.h + M /trunk/src/x86_64/corei5/mparam.h + M /trunk/src/x86_64/pentium4/mparam.h + M /trunk/src/yn.c + M /trunk/src/zeta.c + M /trunk/src/zeta_ui.c + M /trunk/tests/Makefile.am + M /trunk/tests/cmp_str.c + M /trunk/tests/data/digamma + M /trunk/tests/data/li2 + M /trunk/tests/memory.c + M /trunk/tests/mpf_compat.c + M /trunk/tests/mpf_compat.h + M /trunk/tests/mpfr-test.h + M /trunk/tests/mpfr_compat.c + M /trunk/tests/random2.c + M /trunk/tests/reuse.c + M /trunk/tests/rnd_mode.c + M /trunk/tests/tabort_defalloc1.c + M /trunk/tests/tabort_defalloc2.c + M /trunk/tests/tabort_prec_max.c + M /trunk/tests/tabs.c + M /trunk/tests/tacos.c + M /trunk/tests/tacosh.c + M /trunk/tests/tadd.c + M /trunk/tests/tadd1sp.c + M /trunk/tests/tadd_d.c + M /trunk/tests/tadd_ui.c + M /trunk/tests/tagm.c + M /trunk/tests/tai.c + M /trunk/tests/tasin.c + M /trunk/tests/tasinh.c + M /trunk/tests/tassert.c + M /trunk/tests/tatan.c + M /trunk/tests/tatanh.c + M /trunk/tests/taway.c + M /trunk/tests/tbuildopt.c + M /trunk/tests/tcan_round.c + M /trunk/tests/tcbrt.c + M /trunk/tests/tcheck.c + M /trunk/tests/tcmp.c + M /trunk/tests/tcmp2.c + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + M /trunk/tests/tcmp_ui.c + M /trunk/tests/tcmpabs.c + M /trunk/tests/tcomparisons.c + M /trunk/tests/tconst_catalan.c + M /trunk/tests/tconst_euler.c + M /trunk/tests/tconst_log2.c + M /trunk/tests/tconst_pi.c + M /trunk/tests/tcopysign.c + M /trunk/tests/tcos.c + M /trunk/tests/tcosh.c + M /trunk/tests/tcot.c + M /trunk/tests/tcoth.c + M /trunk/tests/tcsc.c + M /trunk/tests/tcsch.c + M /trunk/tests/td_div.c + M /trunk/tests/td_sub.c + M /trunk/tests/tdigamma.c + M /trunk/tests/tdim.c + M /trunk/tests/tdiv.c + M /trunk/tests/tdiv_d.c + M /trunk/tests/tdiv_ui.c + M /trunk/tests/teint.c + M /trunk/tests/teq.c + M /trunk/tests/terf.c + M /trunk/tests/tests.c + M /trunk/tests/texceptions.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/texpm1.c + M /trunk/tests/tfactorial.c + M /trunk/tests/tfits.c + M /trunk/tests/tfma.c + M /trunk/tests/tfmod.c + M /trunk/tests/tfms.c + M /trunk/tests/tfpif.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tfrac.c + M /trunk/tests/tfrexp.c + M /trunk/tests/tgamma.c + M /trunk/tests/tgeneric.c + M /trunk/tests/tgeneric_ui.c + M /trunk/tests/tget_d.c + M /trunk/tests/tget_d_2exp.c + M /trunk/tests/tget_f.c + M /trunk/tests/tget_flt.c + M /trunk/tests/tget_ld_2exp.c + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tget_sj.c + M /trunk/tests/tget_str.c + M /trunk/tests/tget_z.c + M /trunk/tests/tgmpop.c + M /trunk/tests/tgrandom.c + M /trunk/tests/thyperbolic.c + M /trunk/tests/thypot.c + M /trunk/tests/tinits.c + M /trunk/tests/tinp_str.c + M /trunk/tests/tinternals.c + M /trunk/tests/tisnan.c + M /trunk/tests/tisqrt.c + M /trunk/tests/tj0.c + M /trunk/tests/tj1.c + M /trunk/tests/tjn.c + M /trunk/tests/tl2b.c + M /trunk/tests/tlgamma.c + M /trunk/tests/tli2.c + M /trunk/tests/tlngamma.c + M /trunk/tests/tlog.c + M /trunk/tests/tlog10.c + M /trunk/tests/tlog1p.c + M /trunk/tests/tlog2.c + M /trunk/tests/tmin_prec.c + M /trunk/tests/tminmax.c + M /trunk/tests/tmodf.c + M /trunk/tests/tmul.c + M /trunk/tests/tmul_2exp.c + M /trunk/tests/tmul_d.c + M /trunk/tests/tmul_ui.c + M /trunk/tests/tnext.c + M /trunk/tests/tout_str.c + M /trunk/tests/toutimpl.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow3.c + M /trunk/tests/tpow_all.c + M /trunk/tests/tpow_z.c + M /trunk/tests/tprintf.c + M /trunk/tests/trandom.c + M /trunk/tests/trec_sqrt.c + M /trunk/tests/tremquo.c + M /trunk/tests/trint.c + M /trunk/tests/trndna.c + M /trunk/tests/troot.c + M /trunk/tests/tround_prec.c + M /trunk/tests/tsec.c + M /trunk/tests/tsech.c + M /trunk/tests/tset.c + M /trunk/tests/tset_d.c + M /trunk/tests/tset_exp.c + M /trunk/tests/tset_f.c + M /trunk/tests/tset_float128.c + M /trunk/tests/tset_ld.c + M /trunk/tests/tset_q.c + M /trunk/tests/tset_si.c + M /trunk/tests/tset_sj.c + M /trunk/tests/tset_str.c + M /trunk/tests/tset_z.c + M /trunk/tests/tset_z_exp.c + M /trunk/tests/tsgn.c + M /trunk/tests/tsi_op.c + M /trunk/tests/tsin.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tsinh.c + M /trunk/tests/tsinh_cosh.c + M /trunk/tests/tsprintf.c + M /trunk/tests/tsqr.c + M /trunk/tests/tsqrt.c + M /trunk/tests/tsqrt_ui.c + M /trunk/tests/tstckintc.c + M /trunk/tests/tstdint.c + M /trunk/tests/tstrtofr.c + M /trunk/tests/tsub.c + M /trunk/tests/tsub1sp.c + M /trunk/tests/tsub_d.c + M /trunk/tests/tsub_ui.c + M /trunk/tests/tsubnormal.c + M /trunk/tests/tsum.c + M /trunk/tests/tswap.c + M /trunk/tests/ttan.c + M /trunk/tests/ttanh.c + M /trunk/tests/ttrunc.c + M /trunk/tests/tui_div.c + M /trunk/tests/tui_pow.c + M /trunk/tests/tui_sub.c + M /trunk/tests/turandom.c + M /trunk/tests/tvalist.c + M /trunk/tests/tversion.c + M /trunk/tests/ty0.c + M /trunk/tests/ty1.c + M /trunk/tests/tyn.c + M /trunk/tests/tzeta.c + M /trunk/tests/tzeta_ui.c + M /trunk/tools/ck-copyright-notice + M /trunk/tools/ck-mparam + M /trunk/tools/ck-version-info + M /trunk/tools/get_patches.sh + M /trunk/tools/mbench/Makefile + M /trunk/tools/mbench/generate.c + M /trunk/tools/mbench/mfv5-arprec.cc + M /trunk/tools/mbench/mfv5-cln.cc + M /trunk/tools/mbench/mfv5-crlibm.cc + M /trunk/tools/mbench/mfv5-libc.cc + M /trunk/tools/mbench/mfv5-lidia.cc + M /trunk/tools/mbench/mfv5-mpf.cc + M /trunk/tools/mbench/mfv5-mpfr.cc + M /trunk/tools/mbench/mfv5-ntl.cc + M /trunk/tools/mbench/mfv5-pari.cc + M /trunk/tools/mbench/mfv5-void.cc + M /trunk/tools/mbench/mfv5.cc + M /trunk/tools/mbench/mfv5.h + M /trunk/tools/mbench/mpfr-gfx.c + M /trunk/tools/mbench/mpfr-v4.c + M /trunk/tools/mbench/mpfr-v6.c + M /trunk/tools/mbench/timp.h + M /trunk/tune/Makefile.am + M /trunk/tune/bidimensional_sample.c + M /trunk/tune/speed.c + M /trunk/tune/tuneup.c + +Use copyright year ranges, following + https://www.gnu.org/prep/maintain/maintain.html#Copyright-Notices +------------------------------------------------------------------------ +r8537 | vlefevre | 2013-05-30 13:51:01 +0000 (Thu, 30 May 2013) | 1 line +Changed paths: + M /trunk/tests + +[tests] Added *.log and *.trs to svn:ignore property. +------------------------------------------------------------------------ +r8536 | vlefevre | 2013-05-30 13:44:55 +0000 (Thu, 30 May 2013) | 1 line +Changed paths: + M /trunk/INSTALL + +[INSTALL] Update about configure default options. +------------------------------------------------------------------------ +r8534 | vlefevre | 2013-05-30 13:21:33 +0000 (Thu, 30 May 2013) | 1 line +Changed paths: + M /trunk + +Added test-driver (from Automake 1.12+) to svn:ignore property. +------------------------------------------------------------------------ +r8532 | vlefevre | 2013-05-24 15:17:52 +0000 (Fri, 24 May 2013) | 1 line +Changed paths: + M /trunk/configure.ac + +[configure.ac] Updated comment about -mieee-fp icc option. +------------------------------------------------------------------------ +r8531 | thevenyp | 2013-05-24 14:42:52 +0000 (Fri, 24 May 2013) | 2 lines +Changed paths: + M /trunk/tests/tprintf.c + +[tests/tprintf] remove tests of invalid format (continuation of r8525). + +------------------------------------------------------------------------ +r8530 | thevenyp | 2013-05-24 14:39:58 +0000 (Fri, 24 May 2013) | 3 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Support all length modifiers defined by ISO C99, even if the + corresponding type is not detected by configure (continuation of r8525). + +------------------------------------------------------------------------ +r8529 | vlefevre | 2013-05-24 13:59:10 +0000 (Fri, 24 May 2013) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] For ICC, changed the deprecated -mp option to the +equivalent one -mieee-fp; added a comment about that. +------------------------------------------------------------------------ +r8528 | thevenyp | 2013-05-24 12:59:13 +0000 (Fri, 24 May 2013) | 3 lines +Changed paths: + M /trunk/src/vasprintf.c + +[src/vasprintf.c] Always support 't' and 'L' length modifiers, but don't + test them if configure doesn't find the corresponding type. + +------------------------------------------------------------------------ +r8527 | thevenyp | 2013-05-24 12:31:17 +0000 (Fri, 24 May 2013) | 4 lines +Changed paths: + M /trunk/src/vasprintf.c + M /trunk/tests/tprintf.c + +Printing invalid format specifiers (continuation of r8525) +[src/vasprintf.c] Add comments. +[tests/tprintf.c] Simplify tests. + +------------------------------------------------------------------------ +r8526 | zimmerma | 2013-05-24 12:01:07 +0000 (Fri, 24 May 2013) | 2 lines +Changed paths: + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + +new macro MPFR_MAYBE_UNUSED to avoid compiler warnings + +------------------------------------------------------------------------ +r8525 | thevenyp | 2013-05-23 16:24:57 +0000 (Thu, 23 May 2013) | 3 lines +Changed paths: + M /trunk/src/vasprintf.c + M /trunk/tests/tprintf.c + +[src/vasprintf.c] Print invalid format specifier instead of returning an error code, as in GMP. +[tests/tprintf.c] Modify tests for invalid format. + +------------------------------------------------------------------------ +r8524 | zimmerma | 2013-05-22 15:11:42 +0000 (Wed, 22 May 2013) | 3 lines +Changed paths: + M /trunk/configure.ac + +try to link with GMP even when a dll, since it seems to work now +(see https://sympa.inria.fr/sympa/arc/mpfr/2013-05/msg00010.html) + +------------------------------------------------------------------------ +r8523 | zimmerma | 2013-05-22 11:50:08 +0000 (Wed, 22 May 2013) | 5 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/src/vasprintf.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tprintf.c + M /trunk/tests/tsprintf.c + +replaced macros NPRINTF_T and NPRINTF_L by positive versions +PRINTF_T and PRINTF_L, now we don't assume that %td and %Lf are supported +when we don't check it (for example when cross-compiling, or under Windows +when GMP is a dynamic library) + +------------------------------------------------------------------------ +r8522 | zimmerma | 2013-05-22 10:20:30 +0000 (Wed, 22 May 2013) | 2 lines +Changed paths: + M /trunk/src/mpfr-gmp.h + +fixed typo + +------------------------------------------------------------------------ +r8520 | vlefevre | 2013-05-15 23:12:07 +0000 (Wed, 15 May 2013) | 2 lines +Changed paths: + M /trunk/Makefile.am + +[Makefile.am] Added a comment about ACLOCAL_AMFLAGS, based on the +GNU Automake 1.13.2 release notes. +------------------------------------------------------------------------ +r8514 | vlefevre | 2013-04-17 08:28:45 +0000 (Wed, 17 Apr 2013) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] With clang, do not use GCC's self-initialization trick +as it generates a warning, though clang claims GCC compatibility. +------------------------------------------------------------------------ +r8511 | zimmerma | 2013-04-04 07:06:13 +0000 (Thu, 04 Apr 2013) | 2 lines +Changed paths: + M /trunk/doc/algorithms.tex + +[algorithms.tex] added reference + +------------------------------------------------------------------------ +r8506 | zimmerma | 2013-03-26 14:05:57 +0000 (Tue, 26 Mar 2013) | 2 lines +Changed paths: + M /trunk/TODO + +[TODO] added item + +------------------------------------------------------------------------ +r8504 | vlefevre | 2013-03-18 17:19:21 +0000 (Mon, 18 Mar 2013) | 1 line +Changed paths: + M /trunk/src/fits_intmax.c + +[src/fits_intmax.c] Corrected a comment. +------------------------------------------------------------------------ +r8503 | vlefevre | 2013-03-18 17:13:32 +0000 (Mon, 18 Mar 2013) | 4 lines +Changed paths: + M /trunk/src/fits_u.h + M /trunk/src/fits_uintmax.c + +[src/{fits_u.h,fits_uintmax.c}] Fixed the mpfr_fits_u*_p functions, +which incorrectly returned 0 ("doesn't fit") on negative arguments +when the rounding to an integer was 0. The fits_uintmax.c file now +uses fits_u.h for consistency. +------------------------------------------------------------------------ +r8502 | vlefevre | 2013-03-18 16:32:08 +0000 (Mon, 18 Mar 2013) | 1 line +Changed paths: + M /trunk/tests/tfits.c + +[tests/tfits.c] Use error numbers to know where an error occurred. +------------------------------------------------------------------------ +r8501 | vlefevre | 2013-03-18 14:24:16 +0000 (Mon, 18 Mar 2013) | 1 line +Changed paths: + M /trunk/src/fits_uintmax.c + +[src/fits_uintmax.c] Replaced an obsolete comment by a TODO. +------------------------------------------------------------------------ +r8500 | vlefevre | 2013-03-18 12:54:04 +0000 (Mon, 18 Mar 2013) | 2 lines +Changed paths: + M /trunk/tests/tget_sj.c + +[tests/tget_sj.c] Added mpfr_get_uj tests on small negative op, +similar to what has been done for mpfr_get_ui in r8498,8499. +------------------------------------------------------------------------ +r8499 | vlefevre | 2013-03-18 12:50:56 +0000 (Mon, 18 Mar 2013) | 2 lines +Changed paths: + M /trunk/tests/tset_si.c + +[tests/tset_si.c] Minor type correction for r8498 (this shouldn't matter +because the value is normally small, but perhaps not in case of bug). +------------------------------------------------------------------------ +r8498 | vlefevre | 2013-03-18 12:44:09 +0000 (Mon, 18 Mar 2013) | 1 line +Changed paths: + M /trunk/tests/tset_si.c + +[tests/tset_si.c] Added mpfr_get_ui tests on small negative op. +------------------------------------------------------------------------ +r8497 | vlefevre | 2013-03-18 12:18:31 +0000 (Mon, 18 Mar 2013) | 1 line +Changed paths: + M /trunk/tests/tset_si.c + +[tests/tset_si.c] Corrected comment. +------------------------------------------------------------------------ +r8496 | vlefevre | 2013-03-18 12:09:34 +0000 (Mon, 18 Mar 2013) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r8495 | vlefevre | 2013-03-18 12:08:34 +0000 (Mon, 18 Mar 2013) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Improved documentation of the conversions to an integer +(mpfr_get_si, mpfr_get_ui, mpfr_get_sj, mpfr_get_uj). +------------------------------------------------------------------------ +r8494 | vlefevre | 2013-03-18 11:56:17 +0000 (Mon, 18 Mar 2013) | 2 lines +Changed paths: + M /trunk/tests/tfits.c + +[tests/tfits.c] Added tests, in particular for small negative op +and in non-RNDN rounding modes; tfits currently fails. +------------------------------------------------------------------------ +r8493 | vlefevre | 2013-03-18 02:50:23 +0000 (Mon, 18 Mar 2013) | 1 line +Changed paths: + M /trunk/tools/announce-text + +[tools/announce-text] Added short text about what GNU MPFR is. +------------------------------------------------------------------------ +r8483 | vlefevre | 2013-03-13 15:31:32 +0000 (Wed, 13 Mar 2013) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Removed a duplicate word. +------------------------------------------------------------------------ +r8477 | vlefevre | 2013-03-12 02:18:35 +0000 (Tue, 12 Mar 2013) | 1 line +Changed paths: + M /trunk/INSTALL + +[INSTALL] Added a paragraph about Cygwin and threading. +------------------------------------------------------------------------ +r8475 | vlefevre | 2013-03-12 00:07:19 +0000 (Tue, 12 Mar 2013) | 1 line +Changed paths: + M /trunk/INSTALL + +[INSTALL] Improved information on patches. +------------------------------------------------------------------------ +r8474 | vlefevre | 2013-03-11 00:43:52 +0000 (Mon, 11 Mar 2013) | 1 line +Changed paths: + M /trunk/tools/announce-text + +[tools/announce-text] Added text about how to verify the signatures. +------------------------------------------------------------------------ +r8473 | vlefevre | 2013-03-11 00:22:33 +0000 (Mon, 11 Mar 2013) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Updated "To make a release" about the web pages. +------------------------------------------------------------------------ +r8469 | vlefevre | 2013-03-08 11:55:17 +0000 (Fri, 08 Mar 2013) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added info about update-version and ck-version-info. +------------------------------------------------------------------------ +r8462 | vlefevre | 2013-03-05 01:05:49 +0000 (Tue, 05 Mar 2013) | 1 line +Changed paths: + M /trunk/tests/tfpif.c + +[tests/tfpif.c] Clean-up. Improved consistency. +------------------------------------------------------------------------ +r8461 | vlefevre | 2013-03-04 03:45:19 +0000 (Mon, 04 Mar 2013) | 2 lines +Changed paths: + M /trunk/examples/ReadMe + M /trunk/examples/divworst.c + M /trunk/examples/rndo-add.c + M /trunk/examples/sample.c + M /trunk/examples/version.c + +[examples] Replaced the old rounding mode macros (GMP_RNDN, etc.) by the +new ones (MPFR_RNDN, etc.) in the *.c files; updated ReadMe file. +------------------------------------------------------------------------ +r8460 | vlefevre | 2013-03-04 03:41:45 +0000 (Mon, 04 Mar 2013) | 1 line +Changed paths: + M /trunk/doc/update-faq + +[doc/update-faq] Removed the now useless s/GMP_RND/MPFR_RND/ rewriting. +------------------------------------------------------------------------ +r8458 | vlefevre | 2013-03-04 02:44:00 +0000 (Mon, 04 Mar 2013) | 3 lines +Changed paths: + M /trunk/doc/faq.xsl + M /trunk/doc/update-faq + +[doc] Slightly modified faq.xsl to avoid libxslt bug 377440, and +moved the addition of special CSS comments for XML compatibility +from update-faq to faq.xsl file. +------------------------------------------------------------------------ +r8457 | vlefevre | 2013-03-01 15:25:44 +0000 (Fri, 01 Mar 2013) | 1 line +Changed paths: + M /trunk/tests/tgamma.c + +[tests/tgamma.c] Avoid mpfr_set_d. +------------------------------------------------------------------------ +r8456 | vlefevre | 2013-03-01 15:20:53 +0000 (Fri, 01 Mar 2013) | 2 lines +Changed paths: + M /trunk/tests/tfpif.c + +[tests/tfpif.c] Avoid mpfr_set_d as the results may depend on the C +implementation. +------------------------------------------------------------------------ +r8448 | vlefevre | 2013-01-03 05:09:01 +0000 (Thu, 03 Jan 2013) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r8447 | vlefevre | 2013-01-03 04:59:33 +0000 (Thu, 03 Jan 2013) | 5 lines +Changed paths: + M /trunk/BUGS + M /trunk/INSTALL + M /trunk/Makefile.am + M /trunk/NEWS + M /trunk/README + M /trunk/TODO + M /trunk/acinclude.m4 + M /trunk/configure.ac + M /trunk/doc/FAQ.html + M /trunk/doc/Makefile.am + M /trunk/doc/README.dev + M /trunk/doc/faq.xsl + M /trunk/doc/mpfr.texi + M /trunk/examples/divworst.c + M /trunk/examples/rndo-add.c + M /trunk/examples/sample.c + M /trunk/examples/version.c + M /trunk/src/Makefile.am + M /trunk/src/abort_prec_max.c + M /trunk/src/acos.c + M /trunk/src/acosh.c + M /trunk/src/add.c + M /trunk/src/add1.c + M /trunk/src/add1sp.c + M /trunk/src/add_d.c + M /trunk/src/add_ui.c + M /trunk/src/agm.c + M /trunk/src/ai.c + M /trunk/src/amd/amdfam10/mparam.h + M /trunk/src/amd/athlon/mparam.h + M /trunk/src/amd/k8/mparam.h + M /trunk/src/arm/mparam.h + M /trunk/src/asin.c + M /trunk/src/asinh.c + M /trunk/src/atan.c + M /trunk/src/atan2.c + M /trunk/src/atanh.c + M /trunk/src/bernoulli.c + M /trunk/src/buildopt.c + M /trunk/src/cache.c + M /trunk/src/cbrt.c + M /trunk/src/check.c + M /trunk/src/clear.c + M /trunk/src/clears.c + M /trunk/src/cmp.c + M /trunk/src/cmp2.c + M /trunk/src/cmp_abs.c + M /trunk/src/cmp_d.c + M /trunk/src/cmp_ld.c + M /trunk/src/cmp_si.c + M /trunk/src/cmp_ui.c + M /trunk/src/comparisons.c + M /trunk/src/const_catalan.c + M /trunk/src/const_euler.c + M /trunk/src/const_log2.c + M /trunk/src/const_pi.c + M /trunk/src/constant.c + M /trunk/src/copysign.c + M /trunk/src/cos.c + M /trunk/src/cosh.c + M /trunk/src/cot.c + M /trunk/src/coth.c + M /trunk/src/csc.c + M /trunk/src/csch.c + M /trunk/src/d_div.c + M /trunk/src/d_sub.c + M /trunk/src/digamma.c + M /trunk/src/dim.c + M /trunk/src/div.c + M /trunk/src/div_2exp.c + M /trunk/src/div_2si.c + M /trunk/src/div_2ui.c + M /trunk/src/div_d.c + M /trunk/src/div_ui.c + M /trunk/src/dump.c + M /trunk/src/eint.c + M /trunk/src/eq.c + M /trunk/src/erf.c + M /trunk/src/erfc.c + M /trunk/src/exceptions.c + M /trunk/src/exp.c + M /trunk/src/exp10.c + M /trunk/src/exp2.c + M /trunk/src/exp3.c + M /trunk/src/exp_2.c + M /trunk/src/expm1.c + M /trunk/src/extract.c + M /trunk/src/factorial.c + M /trunk/src/fits_intmax.c + M /trunk/src/fits_s.h + M /trunk/src/fits_sint.c + M /trunk/src/fits_slong.c + M /trunk/src/fits_sshort.c + M /trunk/src/fits_u.h + M /trunk/src/fits_uint.c + M /trunk/src/fits_uintmax.c + M /trunk/src/fits_ulong.c + M /trunk/src/fits_ushort.c + M /trunk/src/fma.c + M /trunk/src/fms.c + M /trunk/src/fpif.c + M /trunk/src/frac.c + M /trunk/src/free_cache.c + M /trunk/src/frexp.c + M /trunk/src/gamma.c + M /trunk/src/gammaonethird.c + M /trunk/src/gen_inverse.h + M /trunk/src/generic/coverage/mparam.h + M /trunk/src/generic/mparam.h + M /trunk/src/get_d.c + M /trunk/src/get_d64.c + M /trunk/src/get_exp.c + M /trunk/src/get_f.c + M /trunk/src/get_float128.c + M /trunk/src/get_flt.c + M /trunk/src/get_ld.c + M /trunk/src/get_si.c + M /trunk/src/get_sj.c + M /trunk/src/get_str.c + M /trunk/src/get_ui.c + M /trunk/src/get_uj.c + M /trunk/src/get_z.c + M /trunk/src/get_z_exp.c + M /trunk/src/gmp_op.c + M /trunk/src/grandom.c + M /trunk/src/hppa/mparam.h + M /trunk/src/hypot.c + M /trunk/src/ia64/mparam.h + M /trunk/src/ieee_floats.h + M /trunk/src/init.c + M /trunk/src/init2.c + M /trunk/src/inits.c + M /trunk/src/inits2.c + M /trunk/src/inp_str.c + M /trunk/src/int_ceil_log2.c + M /trunk/src/isinf.c + M /trunk/src/isinteger.c + M /trunk/src/isnan.c + M /trunk/src/isnum.c + M /trunk/src/isqrt.c + M /trunk/src/isregular.c + M /trunk/src/iszero.c + M /trunk/src/jn.c + M /trunk/src/jyn_asympt.c + M /trunk/src/li2.c + M /trunk/src/lngamma.c + M /trunk/src/log.c + M /trunk/src/log10.c + M /trunk/src/log1p.c + M /trunk/src/log2.c + M /trunk/src/logging.c + M /trunk/src/min_prec.c + M /trunk/src/minmax.c + M /trunk/src/mips/mparam.h + M /trunk/src/modf.c + M /trunk/src/mp_clz_tab.c + M /trunk/src/mparam_h.in + M /trunk/src/mpf2mpfr.h + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-intmax.h + M /trunk/src/mpfr-longlong.h + M /trunk/src/mpfr-sassert.h + M /trunk/src/mpfr-thread.h + M /trunk/src/mpfr.h + M /trunk/src/mpn_exp.c + M /trunk/src/mul.c + M /trunk/src/mul_2exp.c + M /trunk/src/mul_2si.c + M /trunk/src/mul_2ui.c + M /trunk/src/mul_d.c + M /trunk/src/mul_ui.c + M /trunk/src/mulders.c + M /trunk/src/neg.c + M /trunk/src/next.c + M /trunk/src/out_str.c + M /trunk/src/pow.c + M /trunk/src/pow_si.c + M /trunk/src/pow_ui.c + M /trunk/src/pow_z.c + M /trunk/src/powerof2.c + M /trunk/src/powerpc32/mparam.h + M /trunk/src/powerpc64/mparam.h + M /trunk/src/print_raw.c + M /trunk/src/print_rnd_mode.c + M /trunk/src/printf.c + M /trunk/src/rec_sqrt.c + M /trunk/src/reldiff.c + M /trunk/src/rem1.c + M /trunk/src/rint.c + M /trunk/src/rndna.c + M /trunk/src/root.c + M /trunk/src/round_near_x.c + M /trunk/src/round_p.c + M /trunk/src/round_prec.c + M /trunk/src/round_raw_generic.c + M /trunk/src/scale2.c + M /trunk/src/sec.c + M /trunk/src/sech.c + M /trunk/src/set.c + M /trunk/src/set_d.c + M /trunk/src/set_d64.c + M /trunk/src/set_dfl_prec.c + M /trunk/src/set_exp.c + M /trunk/src/set_f.c + M /trunk/src/set_float128.c + M /trunk/src/set_flt.c + M /trunk/src/set_inf.c + M /trunk/src/set_ld.c + M /trunk/src/set_nan.c + M /trunk/src/set_prc_raw.c + M /trunk/src/set_prec.c + M /trunk/src/set_q.c + M /trunk/src/set_rnd.c + M /trunk/src/set_si.c + M /trunk/src/set_si_2exp.c + M /trunk/src/set_sj.c + M /trunk/src/set_str.c + M /trunk/src/set_str_raw.c + M /trunk/src/set_ui.c + M /trunk/src/set_ui_2exp.c + M /trunk/src/set_uj.c + M /trunk/src/set_z.c + M /trunk/src/set_z_exp.c + M /trunk/src/set_zero.c + M /trunk/src/setmax.c + M /trunk/src/setmin.c + M /trunk/src/setsign.c + M /trunk/src/sgn.c + M /trunk/src/si_op.c + M /trunk/src/signbit.c + M /trunk/src/sin.c + M /trunk/src/sin_cos.c + M /trunk/src/sinh.c + M /trunk/src/sinh_cosh.c + M /trunk/src/sparc64/mparam.h + M /trunk/src/sqr.c + M /trunk/src/sqrt.c + M /trunk/src/sqrt_ui.c + M /trunk/src/stack_interface.c + M /trunk/src/strtofr.c + M /trunk/src/sub.c + M /trunk/src/sub1.c + M /trunk/src/sub1sp.c + M /trunk/src/sub_d.c + M /trunk/src/sub_ui.c + M /trunk/src/subnormal.c + M /trunk/src/sum.c + M /trunk/src/swap.c + M /trunk/src/tan.c + M /trunk/src/tanh.c + M /trunk/src/uceil_exp2.c + M /trunk/src/uceil_log2.c + M /trunk/src/ufloor_log2.c + M /trunk/src/ui_div.c + M /trunk/src/ui_pow.c + M /trunk/src/ui_pow_ui.c + M /trunk/src/ui_sub.c + M /trunk/src/urandom.c + M /trunk/src/urandomb.c + M /trunk/src/vasprintf.c + M /trunk/src/version.c + M /trunk/src/volatile.c + M /trunk/src/x86/core2/mparam.h + M /trunk/src/x86/mparam.h + M /trunk/src/x86_64/core2/mparam.h + M /trunk/src/x86_64/corei5/mparam.h + M /trunk/src/x86_64/pentium4/mparam.h + M /trunk/src/yn.c + M /trunk/src/zeta.c + M /trunk/src/zeta_ui.c + M /trunk/tests/Makefile.am + M /trunk/tests/cmp_str.c + M /trunk/tests/data/digamma + M /trunk/tests/data/li2 + M /trunk/tests/memory.c + M /trunk/tests/mpf_compat.c + M /trunk/tests/mpf_compat.h + M /trunk/tests/mpfr-test.h + M /trunk/tests/mpfr_compat.c + M /trunk/tests/random2.c + M /trunk/tests/reuse.c + M /trunk/tests/rnd_mode.c + M /trunk/tests/tabort_defalloc1.c + M /trunk/tests/tabort_defalloc2.c + M /trunk/tests/tabort_prec_max.c + M /trunk/tests/tabs.c + M /trunk/tests/tacos.c + M /trunk/tests/tacosh.c + M /trunk/tests/tadd.c + M /trunk/tests/tadd1sp.c + M /trunk/tests/tadd_d.c + M /trunk/tests/tadd_ui.c + M /trunk/tests/tagm.c + M /trunk/tests/tai.c + M /trunk/tests/tasin.c + M /trunk/tests/tasinh.c + M /trunk/tests/tassert.c + M /trunk/tests/tatan.c + M /trunk/tests/tatanh.c + M /trunk/tests/taway.c + M /trunk/tests/tbuildopt.c + M /trunk/tests/tcan_round.c + M /trunk/tests/tcbrt.c + M /trunk/tests/tcheck.c + M /trunk/tests/tcmp.c + M /trunk/tests/tcmp2.c + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + M /trunk/tests/tcmp_ui.c + M /trunk/tests/tcmpabs.c + M /trunk/tests/tcomparisons.c + M /trunk/tests/tconst_catalan.c + M /trunk/tests/tconst_euler.c + M /trunk/tests/tconst_log2.c + M /trunk/tests/tconst_pi.c + M /trunk/tests/tcopysign.c + M /trunk/tests/tcos.c + M /trunk/tests/tcosh.c + M /trunk/tests/tcot.c + M /trunk/tests/tcoth.c + M /trunk/tests/tcsc.c + M /trunk/tests/tcsch.c + M /trunk/tests/td_div.c + M /trunk/tests/td_sub.c + M /trunk/tests/tdigamma.c + M /trunk/tests/tdim.c + M /trunk/tests/tdiv.c + M /trunk/tests/tdiv_d.c + M /trunk/tests/tdiv_ui.c + M /trunk/tests/teint.c + M /trunk/tests/teq.c + M /trunk/tests/terf.c + M /trunk/tests/tests.c + M /trunk/tests/texceptions.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/texpm1.c + M /trunk/tests/tfactorial.c + M /trunk/tests/tfits.c + M /trunk/tests/tfma.c + M /trunk/tests/tfmod.c + M /trunk/tests/tfms.c + M /trunk/tests/tfpif.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tfrac.c + M /trunk/tests/tfrexp.c + M /trunk/tests/tgamma.c + M /trunk/tests/tgeneric.c + M /trunk/tests/tgeneric_ui.c + M /trunk/tests/tget_d.c + M /trunk/tests/tget_d_2exp.c + M /trunk/tests/tget_f.c + M /trunk/tests/tget_flt.c + M /trunk/tests/tget_ld_2exp.c + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tget_sj.c + M /trunk/tests/tget_str.c + M /trunk/tests/tget_z.c + M /trunk/tests/tgmpop.c + M /trunk/tests/tgrandom.c + M /trunk/tests/thyperbolic.c + M /trunk/tests/thypot.c + M /trunk/tests/tinits.c + M /trunk/tests/tinp_str.c + M /trunk/tests/tinternals.c + M /trunk/tests/tisnan.c + M /trunk/tests/tisqrt.c + M /trunk/tests/tj0.c + M /trunk/tests/tj1.c + M /trunk/tests/tjn.c + M /trunk/tests/tl2b.c + M /trunk/tests/tlgamma.c + M /trunk/tests/tli2.c + M /trunk/tests/tlngamma.c + M /trunk/tests/tlog.c + M /trunk/tests/tlog10.c + M /trunk/tests/tlog1p.c + M /trunk/tests/tlog2.c + M /trunk/tests/tmin_prec.c + M /trunk/tests/tminmax.c + M /trunk/tests/tmodf.c + M /trunk/tests/tmul.c + M /trunk/tests/tmul_2exp.c + M /trunk/tests/tmul_d.c + M /trunk/tests/tmul_ui.c + M /trunk/tests/tnext.c + M /trunk/tests/tout_str.c + M /trunk/tests/toutimpl.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow3.c + M /trunk/tests/tpow_all.c + M /trunk/tests/tpow_z.c + M /trunk/tests/tprintf.c + M /trunk/tests/trandom.c + M /trunk/tests/trec_sqrt.c + M /trunk/tests/tremquo.c + M /trunk/tests/trint.c + M /trunk/tests/trndna.c + M /trunk/tests/troot.c + M /trunk/tests/tround_prec.c + M /trunk/tests/tsec.c + M /trunk/tests/tsech.c + M /trunk/tests/tset.c + M /trunk/tests/tset_d.c + M /trunk/tests/tset_exp.c + M /trunk/tests/tset_f.c + M /trunk/tests/tset_float128.c + M /trunk/tests/tset_ld.c + M /trunk/tests/tset_q.c + M /trunk/tests/tset_si.c + M /trunk/tests/tset_sj.c + M /trunk/tests/tset_str.c + M /trunk/tests/tset_z.c + M /trunk/tests/tset_z_exp.c + M /trunk/tests/tsgn.c + M /trunk/tests/tsi_op.c + M /trunk/tests/tsin.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tsinh.c + M /trunk/tests/tsinh_cosh.c + M /trunk/tests/tsprintf.c + M /trunk/tests/tsqr.c + M /trunk/tests/tsqrt.c + M /trunk/tests/tsqrt_ui.c + M /trunk/tests/tstckintc.c + M /trunk/tests/tstdint.c + M /trunk/tests/tstrtofr.c + M /trunk/tests/tsub.c + M /trunk/tests/tsub1sp.c + M /trunk/tests/tsub_d.c + M /trunk/tests/tsub_ui.c + M /trunk/tests/tsubnormal.c + M /trunk/tests/tsum.c + M /trunk/tests/tswap.c + M /trunk/tests/ttan.c + M /trunk/tests/ttanh.c + M /trunk/tests/ttrunc.c + M /trunk/tests/tui_div.c + M /trunk/tests/tui_pow.c + M /trunk/tests/tui_sub.c + M /trunk/tests/turandom.c + M /trunk/tests/tvalist.c + M /trunk/tests/tversion.c + M /trunk/tests/ty0.c + M /trunk/tests/ty1.c + M /trunk/tests/tyn.c + M /trunk/tests/tzeta.c + M /trunk/tests/tzeta_ui.c + M /trunk/tools/ck-copyright-notice + M /trunk/tools/ck-mparam + M /trunk/tools/ck-version-info + M /trunk/tools/get_patches.sh + M /trunk/tune/Makefile.am + M /trunk/tune/bidimensional_sample.c + M /trunk/tune/speed.c + M /trunk/tune/tuneup.c + +Copyright notice update: added 2013 with + perl -pi -e 's/2012 Free Software/2012, 2013 Free Software/' **/*(^/) +under zsh, reverting the ChangeLog file and the m4 directory +(the tools/mbench directory was not modified). +Removed 2012 from the example in the doc/README.dev file. +------------------------------------------------------------------------ +r8446 | vlefevre | 2013-01-03 04:38:45 +0000 (Thu, 03 Jan 2013) | 1 line +Changed paths: + M /trunk/configure.ac + +[configure.ac] Corrected comment on clock_gettime (from r8445). +------------------------------------------------------------------------ +r8445 | vlefevre | 2012-12-31 15:42:02 +0000 (Mon, 31 Dec 2012) | 2 lines +Changed paths: + M /trunk/configure.ac + M /trunk/tune/Makefile.am + +Tuning: reverted changeset r8444 and applied patch by Patrick Pélissier +for GMP 5.1.0 to link against librt conditionally. +------------------------------------------------------------------------ +r8444 | zimmerma | 2012-12-31 09:43:09 +0000 (Mon, 31 Dec 2012) | 2 lines +Changed paths: + M /trunk/tune/Makefile.am + +[Makefile.am] -lrt is needed for clock_gettime() [undefined with GMP 5.1.0] + +------------------------------------------------------------------------ +r8443 | vlefevre | 2012-12-21 17:02:51 +0000 (Fri, 21 Dec 2012) | 1 line +Changed paths: + M /trunk/tests/tfpif.c + +[tests/tfpif.c] Added a TODO. +------------------------------------------------------------------------ +r8442 | vlefevre | 2012-12-21 16:50:34 +0000 (Fri, 21 Dec 2012) | 2 lines +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] Added an assert on MPFR_PREC_MIN because the code seems +to be based on this (always true with the current value). +------------------------------------------------------------------------ +r8441 | vlefevre | 2012-12-21 16:37:16 +0000 (Fri, 21 Dec 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Minor corrections of mpfr_fpif_import documentation. +------------------------------------------------------------------------ +r8440 | demengeo | 2012-12-21 12:42:15 +0000 (Fri, 21 Dec 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/fpif.c + +mpfr_fpif_import now check precision size. Documentation updated for mpfr_fpif_import. +------------------------------------------------------------------------ +r8439 | vlefevre | 2012-12-20 03:52:41 +0000 (Thu, 20 Dec 2012) | 2 lines +Changed paths: + M /trunk/src/get_f.c + M /trunk/src/mpfr-gmp.h + M /trunk/tests/tadd.c + M /trunk/tests/tgeneric.c + +Compatibility with GMP 5.1.0 when gmp-impl.h is included (thanks to Rob: +https://sympa.inria.fr/sympa/arc/mpfr/2012-12/msg00003.html); clean-up. +------------------------------------------------------------------------ +r8437 | vlefevre | 2012-12-12 10:35:20 +0000 (Wed, 12 Dec 2012) | 2 lines +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] Added a FIXME comment in mpfr_fpif_import concerning the +precision. +------------------------------------------------------------------------ +r8436 | vlefevre | 2012-12-11 23:51:12 +0000 (Tue, 11 Dec 2012) | 3 lines +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] Added comments. Fixed mpfr_fpif_read_precision_from_file +in the case where the precision size > sizeof(mpfr_prec_t) and/or when +the read precision is too large (as mpfr_prec_t is signed). +------------------------------------------------------------------------ +r8435 | zimmerma | 2012-12-11 20:49:49 +0000 (Tue, 11 Dec 2012) | 2 lines +Changed paths: + M /trunk/src/fpif.c + +[fpif.c] completed FIXME + +------------------------------------------------------------------------ +r8434 | vlefevre | 2012-12-08 09:39:25 +0000 (Sat, 08 Dec 2012) | 2 lines +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] Added a FIXME comment: large precisions read from the file +can trigger undefined behavior if sizeof(mpfr_prec_t) is too small. +------------------------------------------------------------------------ +r8433 | demengeo | 2012-12-07 16:03:06 +0000 (Fri, 07 Dec 2012) | 1 line +Changed paths: + M /trunk/src/fpif.c + +Fixed stack overflow bug in fpif.c +------------------------------------------------------------------------ +r8432 | vlefevre | 2012-12-05 17:38:38 +0000 (Wed, 05 Dec 2012) | 3 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/configure.ac + +[acinclude.m4,configure.ac] Moved the "double-to-integer conversion bug" +test after the gmp.h detection as it uses gmp.h (otherwise one gets an +incorrect error on this test if gmp.h can't be found or is unusable). +------------------------------------------------------------------------ +r8430 | vlefevre | 2012-12-03 15:04:33 +0000 (Mon, 03 Dec 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Removed a useless comma from r8428. +------------------------------------------------------------------------ +r8429 | vlefevre | 2012-12-03 15:02:23 +0000 (Mon, 03 Dec 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r8428 | vlefevre | 2012-12-03 15:00:58 +0000 (Mon, 03 Dec 2012) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated warning in mpfr_min_prec description, +in particular for the use with mpfr_prec_round. +------------------------------------------------------------------------ +r8425 | vlefevre | 2012-10-17 23:10:24 +0000 (Wed, 17 Oct 2012) | 2 lines +Changed paths: + M /trunk/src/set_uj.c + +[src/set_uj.c] Change to help the compiler to detect dead code, +improving the coverage (from a patch by Patrick Pélissier). +------------------------------------------------------------------------ +r8424 | vlefevre | 2012-10-17 22:56:04 +0000 (Wed, 17 Oct 2012) | 1 line +Changed paths: + M /trunk/src/get_d64.c + +[src/get_d64.c] Added a const (thanks to Patrick Pélissier). +------------------------------------------------------------------------ +r8423 | vlefevre | 2012-10-10 08:35:59 +0000 (Wed, 10 Oct 2012) | 10 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/src/mpfr-impl.h + M /trunk/tests/tsprintf.c + +[acinclude.m4] Check struct lconv members (from ) to avoid a + build failure under Android, which does not have them; see + https://sympa.inria.fr/sympa/arc/mpfr/2012-10/msg00002.html +[src/mpfr-impl.h] Decimal point / thousands separator support can now be + detected automatically by configure (from the presence of + and the above members) or explicitly disabled/enabled by the user by + defining the MPFR_LCONV_DPTS macro to 0 or 1 via CFLAGS (a configure + switch might be added in the future). +[tests/tsprintf.c] Do the locale_da_DK test only if MPFR_LCONV_DPTS is + true. +------------------------------------------------------------------------ +r8422 | vlefevre | 2012-09-29 23:23:59 +0000 (Sat, 29 Sep 2012) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Note about GNU extensions and ICC. +------------------------------------------------------------------------ +r8420 | vlefevre | 2012-09-20 10:09:28 +0000 (Thu, 20 Sep 2012) | 3 lines +Changed paths: + M /trunk/src/get_float128.c + M /trunk/src/set_float128.c + +[get_float128.c,set_float128.c] Avoid an empty translation unit +(forbidden by ISO C, detected with gcc -ansi -pedantic-errors) +when MPFR_WANT_FLOAT128 is not defined. +------------------------------------------------------------------------ +r8419 | vlefevre | 2012-09-20 09:33:30 +0000 (Thu, 20 Sep 2012) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/mpfr.h + M /trunk/src/rndna.c + M /trunk/tests/trndna.c + +Applied patch (with minor changes) by Patrick Pélissier to improve +the mpfr_round_nearest_away interface. +------------------------------------------------------------------------ +r8418 | zimmerma | 2012-09-12 07:05:13 +0000 (Wed, 12 Sep 2012) | 2 lines +Changed paths: + M /trunk/tools/nightly-test + +[nightly-test] modified so that decimal floats are tested (with gcc) + +------------------------------------------------------------------------ +r8417 | vlefevre | 2012-09-05 11:21:00 +0000 (Wed, 05 Sep 2012) | 1 line +Changed paths: + M /trunk/src/set_d64.c + +Removed trailing whitespace. +------------------------------------------------------------------------ +r8416 | vlefevre | 2012-09-05 11:20:03 +0000 (Wed, 05 Sep 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r8415 | vlefevre | 2012-09-04 13:19:54 +0000 (Tue, 04 Sep 2012) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] Improved error message when the compiler doesn't know +_Decimal64 (if MPFR is built with --enable-decimal-float). +------------------------------------------------------------------------ +r8414 | zimmerma | 2012-09-04 13:01:41 +0000 (Tue, 04 Sep 2012) | 2 lines +Changed paths: + M /trunk/configure.ac + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + +revert changeset r8412 (_Decimal64 might be defined in C++, but not as a macro) + +------------------------------------------------------------------------ +r8413 | zimmerma | 2012-09-04 12:43:47 +0000 (Tue, 04 Sep 2012) | 2 lines +Changed paths: + M /trunk/configure.ac + M /trunk/doc/mpfr.texi + +updated documentation wrt --enable-decimal-float + +------------------------------------------------------------------------ +r8412 | zimmerma | 2012-09-04 12:36:52 +0000 (Tue, 04 Sep 2012) | 3 lines +Changed paths: + M /trunk/configure.ac + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + +added support for --enable-decimal-float with g++ (does not work with icpc, + the Intel C++ compiler) + +------------------------------------------------------------------------ +r8411 | zimmerma | 2012-09-04 10:14:31 +0000 (Tue, 04 Sep 2012) | 2 lines +Changed paths: + M /trunk/tests/tl2b.c + +[tests/tl2b.c] fix for C++ + +------------------------------------------------------------------------ +r8410 | vlefevre | 2012-09-04 09:29:20 +0000 (Tue, 04 Sep 2012) | 1 line +Changed paths: + M /trunk/src/set_d.c + +[src/set_d.c] Updated a comment on the negative zero. +------------------------------------------------------------------------ +r8409 | vlefevre | 2012-09-04 09:18:21 +0000 (Tue, 04 Sep 2012) | 2 lines +Changed paths: + M /trunk/src/get_str.c + +[src/get_str.c] #include "mpfr-intmax.h" so that UINT64_C has a chance +to be defined (optionally used as of r8406). +------------------------------------------------------------------------ +r8408 | zimmerma | 2012-09-04 09:15:06 +0000 (Tue, 04 Sep 2012) | 3 lines +Changed paths: + M /trunk/src/set_d64.c + +[src/set_d64.c] fix for systems where +0.0 and -0.0 are stored identically in + memory + +------------------------------------------------------------------------ +r8407 | zimmerma | 2012-09-04 09:08:59 +0000 (Tue, 04 Sep 2012) | 2 lines +Changed paths: + M /trunk/src/set_d64.c + +[src/set_d64.c] better code to detect -0.0 (copied from set_d.c) + +------------------------------------------------------------------------ +r8406 | zimmerma | 2012-09-04 09:00:56 +0000 (Tue, 04 Sep 2012) | 3 lines +Changed paths: + M /trunk/src/get_str.c + M /trunk/tests/tl2b.c + +[tests/tl2b.c] use UINT64_C for 64-bit integer constants +[src/get_str.c] update table generated by "tests/tl2b 1" + +------------------------------------------------------------------------ +r8405 | zimmerma | 2012-09-04 07:49:09 +0000 (Tue, 04 Sep 2012) | 2 lines +Changed paths: + M /trunk/src/get_d64.c + M /trunk/src/set_d64.c + +[get_d64.c,set_d64.c] small fixes (did not work any more with --with-gmp-build) + +------------------------------------------------------------------------ +r8404 | zimmerma | 2012-09-04 07:27:32 +0000 (Tue, 04 Sep 2012) | 3 lines +Changed paths: + M /trunk/src/set_d64.c + +[set_d64.c] some cleanup, since sprintf adds a final '\0', and fixed a too + small memory allocation + +------------------------------------------------------------------------ +r8403 | zimmerma | 2012-09-03 20:21:56 +0000 (Mon, 03 Sep 2012) | 2 lines +Changed paths: + M /trunk/TODO + +[TODO] removed an item (done) + +------------------------------------------------------------------------ +r8402 | zimmerma | 2012-09-03 20:21:12 +0000 (Mon, 03 Sep 2012) | 4 lines +Changed paths: + M /trunk/configure.ac + M /trunk/src/get_d64.c + M /trunk/src/set_d64.c + M /trunk/tests/tget_set_d64.c + +Now --enable-decimal-float does not require any more --with-gmp-build. +Still disabled by default: some more testing is needed before we can enable +it by default (if _Decimal64 is supported). + +------------------------------------------------------------------------ +r8398 | vlefevre | 2012-08-29 13:47:39 +0000 (Wed, 29 Aug 2012) | 1 line +Changed paths: + M /trunk/tests/tstrtofr.c + +[tests/tstrtofr.c] Updated bug20120829 comment (bug fixed in r8396). +------------------------------------------------------------------------ +r8397 | vlefevre | 2012-08-29 13:45:18 +0000 (Wed, 29 Aug 2012) | 1 line +Changed paths: + M /trunk/tests/tstrtofr.c + +[tests/tstrtofr.c] Fixed small type error. +------------------------------------------------------------------------ +r8396 | zimmerma | 2012-08-29 13:40:43 +0000 (Wed, 29 Aug 2012) | 2 lines +Changed paths: + M /trunk/src/strtofr.c + +[strtofr.c] new try to fix the assertion failure on 32-bit + +------------------------------------------------------------------------ +r8395 | vlefevre | 2012-08-29 13:08:16 +0000 (Wed, 29 Aug 2012) | 2 lines +Changed paths: + M /trunk/tests/tstrtofr.c + +[tests/tstrtofr.c] Added more bug20120829 tests, showing that r8394 is +still buggy on 32-bit machines (assertion failure in strtofr.c). +------------------------------------------------------------------------ +r8394 | zimmerma | 2012-08-29 12:51:19 +0000 (Wed, 29 Aug 2012) | 2 lines +Changed paths: + M /trunk/src/strtofr.c + +[strtofr.c] fix for failing test case introduced in r8392 + +------------------------------------------------------------------------ +r8393 | vlefevre | 2012-08-29 12:30:44 +0000 (Wed, 29 Aug 2012) | 2 lines +Changed paths: + M /trunk/tests/tstrtofr.c + +[tests/tstrtofr.c] Updated a comment: the 2nd testcase of r8392 also +triggers an assertion failure on 32-bit machines. +------------------------------------------------------------------------ +r8392 | vlefevre | 2012-08-29 12:27:47 +0000 (Wed, 29 Aug 2012) | 5 lines +Changed paths: + M /trunk/tests/tstrtofr.c + +[tests/tstrtofr.c] Added 2 testcases: + * One triggering an assertion failure in strtofr.c r8389 + on 32-bit machines (fixed in r8390). + * One still triggering an assertion failure in strtofr.c (r8391) + on 64-bit machines. +------------------------------------------------------------------------ +r8391 | zimmerma | 2012-08-29 10:30:04 +0000 (Wed, 29 Aug 2012) | 2 lines +Changed paths: + M /trunk/src/strtofr.c + +[strtofr.c] fixed comments + +------------------------------------------------------------------------ +r8390 | zimmerma | 2012-08-28 20:06:21 +0000 (Tue, 28 Aug 2012) | 2 lines +Changed paths: + M /trunk/src/strtofr.c + +[strtofr.c] fix for err >= GMP_NUMB_BITS + +------------------------------------------------------------------------ +r8389 | vlefevre | 2012-08-28 15:13:32 +0000 (Tue, 28 Aug 2012) | 1 line +Changed paths: + M /trunk/src/strtofr.c + +[src/strtofr.c] Consistency correction: towards → toward. +------------------------------------------------------------------------ +r8388 | vlefevre | 2012-08-28 15:07:30 +0000 (Tue, 28 Aug 2012) | 1 line +Changed paths: + M /trunk/src/sin_cos.c + +[src/sin_cos.c] Consistency correction: towards → toward. +------------------------------------------------------------------------ +r8386 | vlefevre | 2012-08-28 15:04:52 +0000 (Tue, 28 Aug 2012) | 1 line +Changed paths: + M /trunk/doc/FAQ.html + +[doc] Updated FAQ.html with update-faq. +------------------------------------------------------------------------ +r8384 | zimmerma | 2012-08-28 14:20:38 +0000 (Tue, 28 Aug 2012) | 7 lines +Changed paths: + M /trunk/src/strtofr.c + +[strtofr.c] fixed bug in mpfr_strtofr in case: + (1) the input string was used entirely + (2) the conversion was done by a division + (3) and the division was exact + In such a case the "reconstruction" of the ternary value was + inexact. + +------------------------------------------------------------------------ +r8379 | vlefevre | 2012-08-16 09:05:27 +0000 (Thu, 16 Aug 2012) | 4 lines +Changed paths: + M /trunk/src/get_d64.c + M /trunk/tests/tget_set_d64.c + +[src/get_d64.c] mpfr_get_decimal64 was buggy in MPFR_RNDN on some + values x such that 0.5e-398 < |x| < 1e-398 (smallest subnormal): + it was returning 0 instead of +/- 1e-398 (see r8370). +[tests/tget_set_d64.c] Added testcases. +------------------------------------------------------------------------ +r8377 | vlefevre | 2012-08-15 23:30:04 +0000 (Wed, 15 Aug 2012) | 3 lines +Changed paths: + M /trunk/src/get_d64.c + +[src/get_d64.c] Fixed get_decimal64_max by simplifying it completely, +and changed get_decimal64_min in the same way. +Thanks to Rob (Sisyphus) for the idea. +------------------------------------------------------------------------ +r8376 | vlefevre | 2012-08-15 23:22:17 +0000 (Wed, 15 Aug 2012) | 2 lines +Changed paths: + M /trunk/tests/tget_set_d64.c + +[tests/tget_set_d64.c] Added overflow tests (they cover the two bad +tests fixed in r8372 and trigger a bug in get_decimal64_max). +------------------------------------------------------------------------ +r8375 | vlefevre | 2012-08-15 22:31:31 +0000 (Wed, 15 Aug 2012) | 1 line +Changed paths: + M /trunk/tests/tget_set_d64.c + +[tests/tget_set_d64.c] Added some tests for large numbers. +------------------------------------------------------------------------ +r8374 | vlefevre | 2012-08-15 22:11:24 +0000 (Wed, 15 Aug 2012) | 2 lines +Changed paths: + M /trunk/configure.ac + M /trunk/doc/README.dev + M /trunk/src/add1sp.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mul.c + M /trunk/src/round_p.c + M /trunk/src/set_d.c + M /trunk/src/sub1sp.c + M /trunk/tests/mpfr-test.h + +Renamed WANT_ASSERT to MPFR_WANT_ASSERT in order to avoid a clash +with GMP when MPFR is configured with --with-gmp-build. +------------------------------------------------------------------------ +r8372 | vlefevre | 2012-08-14 10:35:11 +0000 (Tue, 14 Aug 2012) | 1 line +Changed paths: + M /trunk/src/get_d64.c + +[src/get_d64.c] Fixed overflow cases. +------------------------------------------------------------------------ +r8371 | vlefevre | 2012-08-14 01:31:27 +0000 (Tue, 14 Aug 2012) | 1 line +Changed paths: + M /trunk/tests/tstrtofr.c + +[tests/tstrtofr.c] Added testcase from bug reported by Joseph S. Myers. +------------------------------------------------------------------------ +r8370 | vlefevre | 2012-08-13 16:17:20 +0000 (Mon, 13 Aug 2012) | 3 lines +Changed paths: + M /trunk/src/get_d64.c + +[src/get_d64.c] mpfr_get_decimal64 is buggy in MPFR_RNDN for values x +such that 0.5e-398 < |x| < 1e-398. Added a FIXME comment. +See: https://sympa.inria.fr/sympa/arc/mpfr/2012-08/msg00002.html +------------------------------------------------------------------------ +r8367 | vlefevre | 2012-07-27 10:41:07 +0000 (Fri, 27 Jul 2012) | 8 lines +Changed paths: + M /trunk/configure.ac + M /trunk/doc/README.dev + M /trunk/src/fpif.c + +[src/fpif.c] No longer assume that if HAVE_BIG_ENDIAN is not defined, + the architecture is little endian. Detect the case where neither + HAVE_BIG_ENDIAN nor HAVE_LITTLE_ENDIAN is defined (currently an + error). +[configure.ac] Fixed the use of AC_C_BIGENDIAN (since AC_CONFIG_HEADERS + is not used, one must have an ACTION-IF-UNIVERSAL argument). +[doc/README.dev] Check with "-UHAVE_BIG_ENDIAN -UHAVE_LITTLE_ENDIAN" + (unknown/unspecified endianness) before a release. +------------------------------------------------------------------------ +r8366 | vlefevre | 2012-07-27 09:52:16 +0000 (Fri, 27 Jul 2012) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Update now that autogen.sh is in the repository. +------------------------------------------------------------------------ +r8365 | vlefevre | 2012-07-27 09:41:47 +0000 (Fri, 27 Jul 2012) | 2 lines +Changed paths: + A /trunk/autogen.sh + +Added autogen.sh sh script from Daniel Richard G. to install/update the +autotools files and clean up caches (useful before a release). +------------------------------------------------------------------------ +r8364 | vlefevre | 2012-07-27 09:35:49 +0000 (Fri, 27 Jul 2012) | 31 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/configure.ac + M /trunk/m4/size_max.m4 + M /trunk/tests/Makefile.am + M /trunk/tune/Makefile.am + +Updated autotools files to get rid of obsolete macros (thanks to +Daniel Richard G. for the patch; kept the autoconf requirement +to 2.60 instead of changing it to 2.68 as done with autoupdate, +since 2.60 seems to be sufficient according to the changes and +2.68 is too recent, e.g. Debian/stable still has 2.67). +--- Note --- +This update has another effect: The "Configs for Windows DLLs." +code (from "case $host in" to "esac") is now executed at the right +time, after options like --disable-static are taken into account. +Juste before this change, the test + if test "$enable_shared" = yes; then +was always false. This could be seen on hydra: +With r8360: +[...] +configure flags: --disable-static --disable-dependency-tracking + --prefix=/nix/store/95zhbb0v23syxsazx33hg3acbvixyq5a-mpfr-0-3.2.0-dev +[...] +checking for DLL/static GMP... static +[...] +checking whether to build shared libraries... yes +checking whether to build static libraries... no +[...] +With r8367: +[...] +configure flags: --disable-static --disable-dependency-tracking + --prefix=/nix/store/8zblwffd2ww1z0smqlgwrfzcl6b48rim-mpfr-0-3.2.0-dev +[...] +checking whether to build shared libraries... yes +checking whether to build static libraries... no +checking for DLL/static GMP... static +[...] +------------------------------------------------------------------------ +r8363 | vlefevre | 2012-07-27 09:09:40 +0000 (Fri, 27 Jul 2012) | 2 lines +Changed paths: + M /trunk/src/mpfr-intmax.h + +[src/mpfr-intmax.h] Updated comment formatting so that mpfrlint +doesn't complain. +------------------------------------------------------------------------ +r8360 | vlefevre | 2012-07-26 14:09:01 +0000 (Thu, 26 Jul 2012) | 1 line +Changed paths: + M /trunk/configure.ac + +[configure.ac] Replaced "sed" by "$SED". +------------------------------------------------------------------------ +r8359 | vlefevre | 2012-07-26 14:08:12 +0000 (Thu, 26 Jul 2012) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Check for sed. +------------------------------------------------------------------------ +r8358 | vlefevre | 2012-07-26 13:24:29 +0000 (Thu, 26 Jul 2012) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Check for grep, egrep and fgrep (see r8356 correction). +------------------------------------------------------------------------ +r8357 | zimmerma | 2012-07-26 10:19:46 +0000 (Thu, 26 Jul 2012) | 2 lines +Changed paths: + M /trunk/src/get_str.c + M /trunk/tests/tl2b.c + +we use a 77-bit approximation in get_str.c (and not 76-bit) + +------------------------------------------------------------------------ +r8356 | zimmerma | 2012-07-25 14:18:13 +0000 (Wed, 25 Jul 2012) | 3 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] grep -> $EGREP (thanks Marc Glisse) + https://sympa.inria.fr/sympa/arc/mpfr/2012-07/msg00006.html + +------------------------------------------------------------------------ +r8355 | zimmerma | 2012-07-24 15:38:58 +0000 (Tue, 24 Jul 2012) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] fix for cross-compilation + +------------------------------------------------------------------------ +r8354 | vlefevre | 2012-07-24 12:17:20 +0000 (Tue, 24 Jul 2012) | 1 line +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Improved a message and corrected gmp.h inclusion. +------------------------------------------------------------------------ +r8353 | zimmerma | 2012-07-24 12:07:44 +0000 (Tue, 24 Jul 2012) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] added test for double-to-integer conversion bug + +------------------------------------------------------------------------ +r8352 | zimmerma | 2012-07-24 11:51:22 +0000 (Tue, 24 Jul 2012) | 2 lines +Changed paths: + M /trunk/tests/tinternals.c + +revert r8349 (will do the test in configure) + +------------------------------------------------------------------------ +r8351 | vlefevre | 2012-07-24 10:48:49 +0000 (Tue, 24 Jul 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +Improved doc/mpfr.texi about MPFR_USE_INTMAX_T. +------------------------------------------------------------------------ +r8350 | vlefevre | 2012-07-24 10:21:53 +0000 (Tue, 24 Jul 2012) | 8 lines +Changed paths: + M /trunk/src/mpfr-intmax.h + +[src/mpfr-intmax.h] Define MPFR_USE_INTMAX_T if and/or + is available. This is needed on systems for which the +current (non-standard) macro tests in mpfr.h is not sufficient. +This will force the support of intmax_t/uintmax_t in this case and +also avoids a failure in the tests on such systems. +Tested by replacing the macro tests in mpfr.h by just + #if defined (MPFR_USE_INTMAX_T) +to simulate such a system. +------------------------------------------------------------------------ +r8349 | zimmerma | 2012-07-24 06:56:54 +0000 (Tue, 24 Jul 2012) | 2 lines +Changed paths: + M /trunk/tests/tinternals.c + +[tinternals.c] added test for double -> mp_limb_t conversion + +------------------------------------------------------------------------ +r8348 | zimmerma | 2012-07-23 09:54:37 +0000 (Mon, 23 Jul 2012) | 2 lines +Changed paths: + M /trunk/src/mpfr.h + +[mpfr.h] patch for FreeBSD (tested on gcc76.fsffrance.org with freebsd-83-amd64) + +------------------------------------------------------------------------ +r8346 | vlefevre | 2012-07-10 12:17:38 +0000 (Tue, 10 Jul 2012) | 4 lines +Changed paths: + M /trunk/doc/README.dev + A /trunk/tools/announce-text + +Added tools/announce-text sh script to be run before publishing an +announce of a new GNU MPFR release (it does some checking, then it +outputs the announce text to stdout). +Mention this script in "doc/README.dev". +------------------------------------------------------------------------ +r8345 | vlefevre | 2012-07-10 08:54:17 +0000 (Tue, 10 Jul 2012) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Updated "To make a release". +------------------------------------------------------------------------ +r8344 | zimmerma | 2012-07-09 16:04:57 +0000 (Mon, 09 Jul 2012) | 2 lines +Changed paths: + M /trunk/TODO + +[TODO] added item + +------------------------------------------------------------------------ +r8340 | vlefevre | 2012-07-06 14:43:44 +0000 (Fri, 06 Jul 2012) | 2 lines +Changed paths: + M /trunk/tests/tget_flt.c + M /trunk/tests/tset_d.c + +[tests/{tset_d.c,tget_flt.c}] Disabled two tests when HAVE_SIGNEDZ +isn't defined, because these tests rely on signed zeros. +------------------------------------------------------------------------ +r8339 | vlefevre | 2012-07-06 14:38:51 +0000 (Fri, 06 Jul 2012) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Added a test for signed zeros (tcc currently doesn't +support signed zeros, and 2 MPFR tests fail because of that). +------------------------------------------------------------------------ +r8338 | vlefevre | 2012-07-06 14:26:42 +0000 (Fri, 06 Jul 2012) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Removed useless "#include " in the test +for subnormal numbers. +------------------------------------------------------------------------ +r8337 | vlefevre | 2012-07-06 14:12:15 +0000 (Fri, 06 Jul 2012) | 4 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Replaced the AC_TRY_RUN obsolete macro by +AC_RUN_IFELSE([AC_LANG_SOURCE([[...]])],...) as documented +in the GNU Autoconf manual. +Minor correction in the test for subnormal numbers. +------------------------------------------------------------------------ +r8336 | vlefevre | 2012-07-06 14:09:59 +0000 (Fri, 06 Jul 2012) | 1 line +Changed paths: + M /trunk/tests + +[tests] Added trndna to svn:ignore property. +------------------------------------------------------------------------ +r8335 | vlefevre | 2012-07-06 13:58:29 +0000 (Fri, 06 Jul 2012) | 1 line +Changed paths: + M /trunk/tests/tset_d.c + +[tests/tset_d.c] Formatting. +------------------------------------------------------------------------ +r8334 | vlefevre | 2012-07-06 13:55:47 +0000 (Fri, 06 Jul 2012) | 1 line +Changed paths: + M /trunk/acinclude.m4 + M /trunk/doc/README.dev + M /trunk/src/round_raw_generic.c + M /trunk/src/set_d.c + M /trunk/tests/tests.c + M /trunk/tests/tset_d.c + +Replaced "denormalized" by the official term "subnormal". +------------------------------------------------------------------------ +r8333 | vlefevre | 2012-07-05 20:19:07 +0000 (Thu, 05 Jul 2012) | 1 line +Changed paths: + M /trunk/tools/coverage + +[tools/coverage] unset MPFR_* environment variables in a better way. +------------------------------------------------------------------------ +r8332 | vlefevre | 2012-07-05 20:10:00 +0000 (Thu, 05 Jul 2012) | 1 line +Changed paths: + M /trunk/tools/coverage + +[tools/coverage] unset MPFR_* environment variables in a better way. +------------------------------------------------------------------------ +r8331 | zimmerma | 2012-07-05 17:09:55 +0000 (Thu, 05 Jul 2012) | 2 lines +Changed paths: + M /trunk/tools/coverage + +[coverage] unset MPFR_* environment variables to get reproducible results + +------------------------------------------------------------------------ +r8329 | zimmerma | 2012-07-05 07:26:39 +0000 (Thu, 05 Jul 2012) | 2 lines +Changed paths: + M /trunk/tests/tabort_defalloc2.c + +[tabort_defalloc2.c] changed char* into void* to please g++ compiler + +------------------------------------------------------------------------ +r8326 | vlefevre | 2012-07-04 22:51:33 +0000 (Wed, 04 Jul 2012) | 1 line +Changed paths: + M /trunk/tests/trndna.c + +[tests/trndna.c] Removed useless initialization. +------------------------------------------------------------------------ +r8325 | zimmerma | 2012-07-04 17:22:40 +0000 (Wed, 04 Jul 2012) | 2 lines +Changed paths: + M /trunk/tests/trndna.c + +[trndna.c] restore emin + +------------------------------------------------------------------------ +r8324 | zimmerma | 2012-07-04 16:18:50 +0000 (Wed, 04 Jul 2012) | 2 lines +Changed paths: + M /trunk/tools/coverage + +[coverage] unset GMP_CHECK_RANDOMIZE so that the coverage test is deterministic + +------------------------------------------------------------------------ +r8317 | vlefevre | 2012-07-04 00:36:48 +0000 (Wed, 04 Jul 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Replaced a "should not" by a "must not". +------------------------------------------------------------------------ +r8316 | vlefevre | 2012-07-04 00:34:35 +0000 (Wed, 04 Jul 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Consistency change. +------------------------------------------------------------------------ +r8313 | zimmerma | 2012-07-03 19:54:29 +0000 (Tue, 03 Jul 2012) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/mpfr.h + M /trunk/src/rndna.c + M /trunk/src/sin.c + M /trunk/tests/trndna.c + +[trndna.c] increase emin when smallest possible + +------------------------------------------------------------------------ +r8312 | zimmerma | 2012-07-03 15:34:39 +0000 (Tue, 03 Jul 2012) | 2 lines +Changed paths: + M /trunk/src/rndna.c + M /trunk/tests/trndna.c + +[rndna.c] special treatment for the case 2^(emin-2) + +------------------------------------------------------------------------ +r8311 | zimmerma | 2012-07-03 15:03:41 +0000 (Tue, 03 Jul 2012) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/TODO + M /trunk/doc/mpfr.texi + M /trunk/src/rndna.c + +several changes suggested by Vincent Lefevre + +------------------------------------------------------------------------ +r8310 | zimmerma | 2012-07-03 14:53:06 +0000 (Tue, 03 Jul 2012) | 3 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/rndna.c + +[rndna.c] changed the specification since on 32-bit machines we have no margin + for the smallest exponent emin + +------------------------------------------------------------------------ +r8308 | zimmerma | 2012-07-03 14:23:09 +0000 (Tue, 03 Jul 2012) | 3 lines +Changed paths: + M /trunk/NEWS + M /trunk/TODO + M /trunk/doc/mpfr.texi + M /trunk/src/Makefile.am + M /trunk/src/rndna.c + M /trunk/tests/Makefile.am + M /trunk/tools/cfarm.sh + +added new function mpfr_round_nearest_away() as discussed during the June 2012 +workshop + +------------------------------------------------------------------------ +r8305 | vlefevre | 2012-07-03 14:05:18 +0000 (Tue, 03 Jul 2012) | 1 line +Changed paths: + M /trunk/tools/coverage + +[tools/coverage] Minor update, just in case... +------------------------------------------------------------------------ +r8304 | zimmerma | 2012-07-03 13:56:28 +0000 (Tue, 03 Jul 2012) | 2 lines +Changed paths: + M /trunk/src/exp.c + +[exp.c] fixed typo + +------------------------------------------------------------------------ +r8302 | vlefevre | 2012-07-03 13:51:39 +0000 (Tue, 03 Jul 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r8299 | vlefevre | 2012-07-03 13:44:02 +0000 (Tue, 03 Jul 2012) | 2 lines +Changed paths: + M /trunk/tests/td_div.c + M /trunk/tests/tget_d.c + +[tests/{td_div.c,tget_d.c}] Disable tests with a division by 0 if +MPFR_ERRDIVZERO is defined. +------------------------------------------------------------------------ +r8298 | vlefevre | 2012-07-03 13:37:07 +0000 (Tue, 03 Jul 2012) | 1 line +Changed paths: + M /trunk/tests/tests.c + +[tests/tests.c] Improved an error message. +------------------------------------------------------------------------ +r8297 | vlefevre | 2012-07-03 13:04:25 +0000 (Tue, 03 Jul 2012) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + +[acinclude.m4] Fixed sigaction check to support "gcc -std=c99", like +what has been done for math/round. +------------------------------------------------------------------------ +r8296 | zimmerma | 2012-07-02 20:25:36 +0000 (Mon, 02 Jul 2012) | 2 lines +Changed paths: + A /trunk/tests/trndna.c + +[trndna.c] test file for mpfr_round_nearest_away() + +------------------------------------------------------------------------ +r8295 | vlefevre | 2012-07-02 15:08:42 +0000 (Mon, 02 Jul 2012) | 5 lines +Changed paths: + M /trunk/src/rndna.c + +[src/rndna.c] + * Handle singular cases like with other functions. Avoid the goto. + * Reordered the tests to make them simpler and easier to understand + (it wasn't immediately visible that inex could not be 0 for the + second "else") and fixed the case lastbit == 1 && inex < 0. +------------------------------------------------------------------------ +r8294 | vlefevre | 2012-07-02 14:54:30 +0000 (Mon, 02 Jul 2012) | 2 lines +Changed paths: + M /trunk/src/rndna.c + +[src/rndna.c] Added a note saying that this method doesn't work +for 2^(emin-2). +------------------------------------------------------------------------ +r8293 | zimmerma | 2012-06-29 16:10:08 +0000 (Fri, 29 Jun 2012) | 2 lines +Changed paths: + A /trunk/src/rndna.c + +[rndna.c] new function that computes rounding to nearest-away + +------------------------------------------------------------------------ +r8292 | vlefevre | 2012-06-28 17:49:36 +0000 (Thu, 28 Jun 2012) | 2 lines +Changed paths: + M /trunk/tests/tprintf.c + +[tests/tprintf.c] Test the thousands separator in some en_US locale, +if available (modified patch from Patrick). +------------------------------------------------------------------------ +r8291 | vlefevre | 2012-06-28 17:33:46 +0000 (Thu, 28 Jun 2012) | 1 line +Changed paths: + M /trunk/configure.ac + A /trunk/src/generic/coverage + A /trunk/src/generic/coverage/mparam.h + M /trunk/src/mparam_h.in + M /trunk/tools/coverage + +Added coverage tune (from a patch by Patrick). +------------------------------------------------------------------------ +r8289 | zimmerma | 2012-06-27 11:17:46 +0000 (Wed, 27 Jun 2012) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[mpfr.texi] added support by ERC grant of Andreas + +------------------------------------------------------------------------ +r8287 | vlefevre | 2012-06-27 09:13:28 +0000 (Wed, 27 Jun 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Replaced a few @samp by @code for consistency. +------------------------------------------------------------------------ +r8286 | zimmerma | 2012-06-27 08:59:59 +0000 (Wed, 27 Jun 2012) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[mpfr.texi] document MPFR_WANT_DECIMAL_FLOATS and MPFR_WANT_FLOAT128 + +------------------------------------------------------------------------ +r8285 | vlefevre | 2012-06-27 08:44:18 +0000 (Wed, 27 Jun 2012) | 1 line +Changed paths: + M /trunk/src/mulders.c + +[src/mulders.c] Clean-up and static assertions (patch from Patrick). +------------------------------------------------------------------------ +r8283 | vlefevre | 2012-06-27 08:35:56 +0000 (Wed, 27 Jun 2012) | 1 line +Changed paths: + M /trunk/tests/tgrandom.c + +[tests/tgrandom.c] Replaced GMP_RNDN by MPFR_RNDN. +------------------------------------------------------------------------ +r8280 | vlefevre | 2012-06-27 08:21:10 +0000 (Wed, 27 Jun 2012) | 2 lines +Changed paths: + M /trunk/tests/tgrandom.c + +[tests/tgrandom.c] Improved a test and added a new one for +mpfr_grandom(x, NULL, ...). +------------------------------------------------------------------------ +r8279 | vlefevre | 2012-06-27 08:17:57 +0000 (Wed, 27 Jun 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Completed spec of mpfr_grandom. +------------------------------------------------------------------------ +r8277 | zimmerma | 2012-06-27 08:10:41 +0000 (Wed, 27 Jun 2012) | 2 lines +Changed paths: + M /trunk/tools/coverage + +[coverage] added instructions how to use this script + +------------------------------------------------------------------------ +r8276 | vlefevre | 2012-06-27 08:09:32 +0000 (Wed, 27 Jun 2012) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Update: test coverage. +------------------------------------------------------------------------ +r8275 | vlefevre | 2012-06-27 07:27:28 +0000 (Wed, 27 Jun 2012) | 1 line +Changed paths: + M /trunk/tools/coverage + +[tools/coverage] Detailed coverage (from a patch by Patrick). +------------------------------------------------------------------------ +r8274 | vlefevre | 2012-06-26 23:19:56 +0000 (Tue, 26 Jun 2012) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + M /trunk/src/print_raw.c + +[src/{mpfr-impl.h,print_raw.c}] Removed unused function mpfr_dump_mant +(added in r3410, but never used); patch by Patrick. +------------------------------------------------------------------------ +r8273 | vlefevre | 2012-06-26 22:43:16 +0000 (Tue, 26 Jun 2012) | 1 line +Changed paths: + M /trunk/tests/tsin.c + +[tests/tsin.c] Improved coverage. +------------------------------------------------------------------------ +r8272 | vlefevre | 2012-06-26 22:40:33 +0000 (Tue, 26 Jun 2012) | 1 line +Changed paths: + M /trunk/tests/tset.c + +[tests/tset.c] Test the mpfr_set function too (patch by Patrick). +------------------------------------------------------------------------ +r8271 | vlefevre | 2012-06-26 22:35:39 +0000 (Tue, 26 Jun 2012) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/configure.ac + M /trunk/doc/README.dev + M /trunk/src/mpfr-impl.h + M /trunk/tests/mpfr-test.h + M /trunk/tests/tsqrt.c + M /trunk/tools/coverage + +Added configure option --enable-assert=none to avoid checking any +assertion (this is based on a patch by Patrick). +------------------------------------------------------------------------ +r8270 | vlefevre | 2012-06-26 22:27:18 +0000 (Tue, 26 Jun 2012) | 1 line +Changed paths: + M /trunk/src/digamma.c + +[src/digamma.c] Correction: assertions must never have any side effect. +------------------------------------------------------------------------ +r8269 | vlefevre | 2012-06-26 17:30:18 +0000 (Tue, 26 Jun 2012) | 1 line +Changed paths: + M /trunk/tests + +[tests] Updated svn:ignore property. +------------------------------------------------------------------------ +r8268 | vlefevre | 2012-06-26 17:26:54 +0000 (Tue, 26 Jun 2012) | 1 line +Changed paths: + M /trunk/src/atan.c + +[src/atan.c] Removed trailing whitespace. +------------------------------------------------------------------------ +r8267 | vlefevre | 2012-06-26 17:26:00 +0000 (Tue, 26 Jun 2012) | 1 line +Changed paths: + A /trunk/tests/tabort_defalloc1.c + A /trunk/tests/tabort_defalloc2.c + A /trunk/tests/tabort_prec_max.c + A /trunk/tests/tassert.c + +Forgot to add some files in r8266 (tests that are expected to fail). +------------------------------------------------------------------------ +r8266 | vlefevre | 2012-06-26 17:17:05 +0000 (Tue, 26 Jun 2012) | 1 line +Changed paths: + M /trunk/acinclude.m4 + M /trunk/tests/Makefile.am + M /trunk/tests/mpfr-test.h + M /trunk/tests/tests.c + +Support tests that are expected to fail (from a patch by Patrick). +------------------------------------------------------------------------ +r8265 | vlefevre | 2012-06-26 17:10:52 +0000 (Tue, 26 Jun 2012) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Output the applied patches (if any). +------------------------------------------------------------------------ +r8264 | vlefevre | 2012-06-26 17:06:47 +0000 (Tue, 26 Jun 2012) | 2 lines +Changed paths: + M /trunk/tests/tstckintc.c + +[tests/tstckintc.c] Correction and test improvement (from a patch +by Patrick). +------------------------------------------------------------------------ +r8263 | vlefevre | 2012-06-26 16:55:15 +0000 (Tue, 26 Jun 2012) | 1 line +Changed paths: + M /trunk/tools/coverage + +[tools/coverage] Correction by Patrick. +------------------------------------------------------------------------ +r8260 | zimmerma | 2012-06-26 16:03:31 +0000 (Tue, 26 Jun 2012) | 3 lines +Changed paths: + M /trunk/src/atan.c + +[atan.c] improved code coverage by removing some dead code after some numerical + analysis with Benjamin Dadoun + +------------------------------------------------------------------------ +r8258 | vlefevre | 2012-06-26 14:53:46 +0000 (Tue, 26 Jun 2012) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Removed obsolete "but see below". +------------------------------------------------------------------------ +r8253 | vlefevre | 2012-06-26 14:00:59 +0000 (Tue, 26 Jun 2012) | 1 line +Changed paths: + M /trunk/tests/tinternals.c + +[tests/tinternals.c] mpfr_set_prec_raw missing tests (thanks to Patrick). +------------------------------------------------------------------------ +r8251 | vlefevre | 2012-06-26 13:56:26 +0000 (Tue, 26 Jun 2012) | 1 line +Changed paths: + M /trunk/tests/tset_si.c + +[tests/tset_si.c] Also test the mpfr_set_ui function (instead of macro). +------------------------------------------------------------------------ +r8250 | vlefevre | 2012-06-26 08:47:49 +0000 (Tue, 26 Jun 2012) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] 3.2.0 will be "dinde aux marrons". +------------------------------------------------------------------------ +r8249 | zimmerma | 2012-06-25 17:48:10 +0000 (Mon, 25 Jun 2012) | 3 lines +Changed paths: + M /trunk/src/gamma.c + +[gamma.c] simplified mpfr_gamma_1_minus_x_exact() after code coverage analysis + with Benjamin Dadoun + +------------------------------------------------------------------------ +r8248 | vlefevre | 2012-06-25 17:44:54 +0000 (Mon, 25 Jun 2012) | 1 line +Changed paths: + M /trunk/configure.ac + +[configure.ac] aclocal -> acinclude.m4 in a comment. +------------------------------------------------------------------------ +r8247 | vlefevre | 2012-06-25 17:31:04 +0000 (Mon, 25 Jun 2012) | 1 line +Changed paths: + M /trunk/src/init2.c + M /trunk/src/mpfr-impl.h + +[src/{init2.c,mpfr-impl.h}] Clean-up. +------------------------------------------------------------------------ +r8246 | zimmerma | 2012-06-25 17:25:17 +0000 (Mon, 25 Jun 2012) | 2 lines +Changed paths: + M /trunk/TODO + +[TODO] removed one item, added one + +------------------------------------------------------------------------ +r8245 | vlefevre | 2012-06-25 17:15:04 +0000 (Mon, 25 Jun 2012) | 3 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/src/mpfr-thread.h + +[acinclude.m4] Detect whether _Thread_local (C11) is supported. +[src/mpfr-thread.h] Use _Thread_local if supported, instead of __thread. +(Patch from Patrick) +------------------------------------------------------------------------ +r8244 | zimmerma | 2012-06-25 17:03:27 +0000 (Mon, 25 Jun 2012) | 3 lines +Changed paths: + M /trunk/src/gamma.c + +[gamma.c] simplified code for mpfr_gamma_2_minus_x_exact() (thanks to coverage + analysis by Benjamin Dadoun) + +------------------------------------------------------------------------ +r8243 | vlefevre | 2012-06-25 17:02:37 +0000 (Mon, 25 Jun 2012) | 1 line +Changed paths: + M /trunk/src/Makefile.am + +[src/Makefile.am] Added mpfr-sassert.h to libmpfr_la_SOURCES. +------------------------------------------------------------------------ +r8242 | vlefevre | 2012-06-25 16:52:37 +0000 (Mon, 25 Jun 2012) | 1 line +Changed paths: + M /trunk/src/init2.c + +[src/init2.c] Replaced classic assertions by static assertions. +------------------------------------------------------------------------ +r8241 | vlefevre | 2012-06-25 16:50:38 +0000 (Mon, 25 Jun 2012) | 4 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/src/mpfr-impl.h + A /trunk/src/mpfr-sassert.h + +Added Static Assertion support (modified patch from Patrick). + * Added src/mpfr-sassert.h: implementation of static assertions. + * src/mpfr-impl.h: include "mpfr-sassert.h". + * acinclude.m4: test whether static assertions are supported. +------------------------------------------------------------------------ +r8240 | vlefevre | 2012-06-25 16:46:30 +0000 (Mon, 25 Jun 2012) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Suggest to test with and without -std=c11. +------------------------------------------------------------------------ +r8239 | vlefevre | 2012-06-25 16:33:57 +0000 (Mon, 25 Jun 2012) | 1 line +Changed paths: + M /trunk/src/mpfr-intmax.h + +[src/mpfr-intmax.h] Removed svn:mime-type property for consistency. +------------------------------------------------------------------------ +r8238 | vlefevre | 2012-06-25 15:47:25 +0000 (Mon, 25 Jun 2012) | 2 lines +Changed paths: + M /trunk/tests/tset_float128.c + +[tests/tset_float128.c] Test the sign of 0. Use mpfr_equal_p instead of +mpfr_cmp (this is safer if a result is NaN). +------------------------------------------------------------------------ +r8237 | vlefevre | 2012-06-25 15:39:38 +0000 (Mon, 25 Jun 2012) | 1 line +Changed paths: + M /trunk/src/set_float128.c + +[src/set_float128.c] Avoid a goto (useless here, contrary to set_ld.c). +------------------------------------------------------------------------ +r8236 | vlefevre | 2012-06-25 15:30:44 +0000 (Mon, 25 Jun 2012) | 1 line +Changed paths: + M /trunk/src/get_float128.c + +[src/get_float128.c] !MPFR_IS_ZERO -> MPFR_NOTZERO; GNU coding style. +------------------------------------------------------------------------ +r8235 | vlefevre | 2012-06-25 15:17:01 +0000 (Mon, 25 Jun 2012) | 1 line +Changed paths: + M /trunk/tests + +tests: updated svn:ignore property. +------------------------------------------------------------------------ +r8234 | vlefevre | 2012-06-25 15:15:35 +0000 (Mon, 25 Jun 2012) | 1 line +Changed paths: + M /trunk/tests/tset_float128.c + +[tests/tset_float128.c] Got rid of the remaining mpfr_printf's. +------------------------------------------------------------------------ +r8233 | zimmerma | 2012-06-25 15:10:04 +0000 (Mon, 25 Jun 2012) | 2 lines +Changed paths: + M /trunk/tests/tset_float128.c + +[tset_float128.c] added missing empty main when functions are not tested + +------------------------------------------------------------------------ +r8232 | zimmerma | 2012-06-25 15:05:45 +0000 (Mon, 25 Jun 2012) | 2 lines +Changed paths: + M /trunk/src/set_float128.c + M /trunk/tests/tset_float128.c + +[set_float128.c,tset_float128.c] untabified and got rid of mpfr_printf + +------------------------------------------------------------------------ +r8231 | vlefevre | 2012-06-25 14:54:28 +0000 (Mon, 25 Jun 2012) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Added a period. +------------------------------------------------------------------------ +r8230 | vlefevre | 2012-06-25 14:44:28 +0000 (Mon, 25 Jun 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r8229 | vlefevre | 2012-06-25 14:35:20 +0000 (Mon, 25 Jun 2012) | 1 line +Changed paths: + M /trunk/configure.ac + +[configure.ac] "configure --help" formatting for --enable-float128. +------------------------------------------------------------------------ +r8228 | zimmerma | 2012-06-25 14:33:01 +0000 (Mon, 25 Jun 2012) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/get_float128.c + M /trunk/src/set_float128.c + M /trunk/tests/tset_float128.c + +compile mpfr_set_float128 and mpfr_get_float128 only when __float128 is supported + +------------------------------------------------------------------------ +r8227 | zimmerma | 2012-06-25 14:25:48 +0000 (Mon, 25 Jun 2012) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] __float128 is supported by GCC >= 4.3 + +------------------------------------------------------------------------ +r8226 | vlefevre | 2012-06-25 14:25:38 +0000 (Mon, 25 Jun 2012) | 1 line +Changed paths: + M /trunk/tests/tset_float128.c + +[tests/tset_float128.c] mp_rnd_t -> mpfr_rnd_t +------------------------------------------------------------------------ +r8225 | zimmerma | 2012-06-25 14:20:29 +0000 (Mon, 25 Jun 2012) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/configure.ac + M /trunk/doc/mpfr.texi + M /trunk/src/Makefile.am + A /trunk/src/get_float128.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + A /trunk/src/set_float128.c + M /trunk/tests/Makefile.am + A /trunk/tests/tset_float128.c + +added new functions mpfr_set_float128 and mpfr_get_float128 + +------------------------------------------------------------------------ +r8224 | zimmerma | 2012-06-25 14:17:55 +0000 (Mon, 25 Jun 2012) | 2 lines +Changed paths: + M /trunk/src/get_ld.c + +[get_ld.c] fixed typo + +------------------------------------------------------------------------ +r8223 | vlefevre | 2012-06-25 13:52:05 +0000 (Mon, 25 Jun 2012) | 1 line +Changed paths: + M /trunk/tests/tversion.c + +[tests/tversion.c] Test mpfr_buildopt_tune_case() vs MPFR_TUNE_CASE. +------------------------------------------------------------------------ +r8222 | vlefevre | 2012-06-25 13:51:20 +0000 (Mon, 25 Jun 2012) | 1 line +Changed paths: + M /trunk/src/buildopt.c + +[src/buildopt.c] Made mpfr_buildopt_tune_case() simpler. +------------------------------------------------------------------------ +r8221 | zimmerma | 2012-06-22 15:38:14 +0000 (Fri, 22 Jun 2012) | 2 lines +Changed paths: + M /trunk/src/li2.c + +[li2.c] replaced mpfr_cmp_d by mpfr_cmp_ui_2exp + +------------------------------------------------------------------------ +r8219 | vlefevre | 2012-06-21 23:01:37 +0000 (Thu, 21 Jun 2012) | 2 lines +Changed paths: + M /trunk/tests/tset_ld.c + +[tests/tset_ld.c] For _GMP_IEEE_FLOATS, use #if instead of #ifdef +since mpfr-impl.h defines it to 0 if it was undefined. +------------------------------------------------------------------------ +r8217 | vlefevre | 2012-05-18 12:07:53 +0000 (Fri, 18 May 2012) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Added a reference to a new discussion concerning __float128. +------------------------------------------------------------------------ +r8213 | schevill | 2012-05-14 14:51:33 +0000 (Mon, 14 May 2012) | 3 lines +Changed paths: + M /trunk/tools/metaMPFR/metaMPFR_straightforwardAlgo.mpl + +* Other corrections (essentially bad or missing declarations) in metaMPFR. + + +------------------------------------------------------------------------ +r8212 | vlefevre | 2012-05-11 07:59:28 +0000 (Fri, 11 May 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Improved the description of the mpfr_flags_ functions. +------------------------------------------------------------------------ +r8211 | schevill | 2012-05-10 16:10:06 +0000 (Thu, 10 May 2012) | 3 lines +Changed paths: + M /trunk/tools/metaMPFR/metaMPFR_straightforwardAlgo.mpl + +* Corrected small errors. + + +------------------------------------------------------------------------ +r8210 | vlefevre | 2012-05-10 10:46:23 +0000 (Thu, 10 May 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Improved mpfr_flags_test description, giving an example. +------------------------------------------------------------------------ +r8209 | vlefevre | 2012-05-10 10:19:11 +0000 (Thu, 10 May 2012) | 3 lines +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Define MPFR_FLAGS_ALL from the individual flags +(MPFR_FLAGS_UNDERFLOW...). Suggestion by Paul Zimmermann. +Note: the output expression looks OK in assertion failures. +------------------------------------------------------------------------ +r8208 | vlefevre | 2012-05-10 08:13:51 +0000 (Thu, 10 May 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Correction on mpfr_clear_flags description. +------------------------------------------------------------------------ +r8206 | vlefevre | 2012-05-09 08:25:17 +0000 (Wed, 09 May 2012) | 3 lines +Changed paths: + M /trunk + M /trunk/NEWS + M /trunk/TODO + M /trunk/doc/mpfr.texi + M /trunk/src/exceptions.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + M /trunk/tests/texceptions.c + +Added functions that operate on groups of flags: mpfr_flags_clear, +mpfr_flags_set, mpfr_flags_test, mpfr_flags_save and mpfr_flags_restore. +(reintegrated flags branch to the trunk: svn merge --reintegrate ...) +------------------------------------------------------------------------ +r8204 | zimmerma | 2012-05-08 19:06:58 +0000 (Tue, 08 May 2012) | 5 lines +Changed paths: + M /trunk/configure.ac + M /trunk/tests/Makefile.am + +patch from Nitin A Kamble for automake 1.12. +This patch avoids these issues with automake 1.12: +| configure.ac:304: error: automatic de-ANSI-fication support has been removed +| tests/Makefile.am:12: error: automatic de-ANSI-fication support has been removed + +------------------------------------------------------------------------ +r8201 | vlefevre | 2012-05-07 18:11:47 +0000 (Mon, 07 May 2012) | 5 lines +Changed paths: + M /trunk/AUTHORS + M /trunk/INSTALL + M /trunk/doc/mpfr.texi [AUTHORS,INSTALL,doc/mpfr.texi] Updated the e-mail address of the MPFR mailing-list to match the List-* headers written by the new @@ -4774,1427 +28257,2716 @@ interaction with MUA's that attempt to honor the List-Post header when replying to the list(s)). ------------------------------------------------------------------------ -r8200 | vlefevre | 2012-05-07 17:58:04 +0000 (Mon, 07 May 2012) | 6 lines +r8199 | vlefevre | 2012-05-07 15:17:31 +0000 (Mon, 07 May 2012) | 4 lines +Changed paths: + M /trunk/src/gamma.c + M /trunk/src/lngamma.c + +[src/lngamma.c] Added mpfr_explgamma internal function to handle + overflows/underflows (intermediate or not) in mpfr_gamma. + Updated the general overflow detection to use this function. +[src/gamma.c] Fixed the general underflow detection. +------------------------------------------------------------------------ +r8198 | vlefevre | 2012-05-07 12:51:34 +0000 (Mon, 07 May 2012) | 1 line +Changed paths: + M /trunk/src/lngamma.c + +[src/lngamma.c] Removed spurious parentheses. +------------------------------------------------------------------------ +r8197 | vlefevre | 2012-05-07 12:36:22 +0000 (Mon, 07 May 2012) | 2 lines +Changed paths: + M /trunk/tests/tgamma.c + +[tests/tgamma.c] Added tests for 32-bit and 64-bit machines, showing an +underflow detection bug in gamma.c (see FIXME comment added in r8185). +------------------------------------------------------------------------ +r8196 | vlefevre | 2012-05-07 12:23:44 +0000 (Mon, 07 May 2012) | 2 lines +Changed paths: + M /trunk/tests/tgamma.c + +[tests/tgamma.c] Added tests to trigger the pre-r8189 endless loop +on 32-bit machines. +------------------------------------------------------------------------ +r8195 | vlefevre | 2012-05-04 15:23:02 +0000 (Fri, 04 May 2012) | 1 line +Changed paths: + M /trunk/tests/tgamma.c + +[tests/tgamma.c] Updated exp_lgamma to test the ternary value. +------------------------------------------------------------------------ +r8194 | vlefevre | 2012-05-04 15:10:06 +0000 (Fri, 04 May 2012) | 1 line +Changed paths: + M /trunk/src/lngamma.c + +[src/lngamma.c] Fixed the problem with the overflow flag (r8192). +------------------------------------------------------------------------ +r8193 | vlefevre | 2012-05-04 14:33:58 +0000 (Fri, 04 May 2012) | 6 lines +Changed paths: + M /trunk/src/lngamma.c + +Improved src/lngamma.c (mainly on changes from r8189): + * Declarations of ok variable were used in nested block. + * Added a missing "MPFR_ZIV_FREE (loop);". + * In the overflow detection code, call mpfr_lngamma only once, use + mpfr_equal_p instead of mpfr_cmp, and share code with the end. +Note: the problem with the overflow flag (r8192) hasn't been solved yet. +------------------------------------------------------------------------ +r8192 | vlefevre | 2012-05-04 14:23:46 +0000 (Fri, 04 May 2012) | 2 lines +Changed paths: + M /trunk/tests/tgamma.c + +[tests/tgamma.c] Added a test showing a failure on 64-bit machines +due to an unset overflow flag. +------------------------------------------------------------------------ +r8191 | vlefevre | 2012-05-04 14:09:23 +0000 (Fri, 04 May 2012) | 1 line +Changed paths: + M /trunk/tests/tgamma.c + +[tests/tgamma.c] Updated exp_lgamma to test underflow & overflow flags. +------------------------------------------------------------------------ +r8190 | vlefevre | 2012-05-04 13:19:31 +0000 (Fri, 04 May 2012) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] For mpfr_get_flt, etc., exception flags should be raised. +------------------------------------------------------------------------ +r8189 | zimmerma | 2012-05-04 12:55:57 +0000 (Fri, 04 May 2012) | 2 lines +Changed paths: + M /trunk/src/lngamma.c + M /trunk/tests/tgamma.c + +[src/lngamma.c] fixed endless loop with test cases introduced in r8188 + +------------------------------------------------------------------------ +r8188 | vlefevre | 2012-05-03 17:34:16 +0000 (Thu, 03 May 2012) | 2 lines +Changed paths: + M /trunk/tests/tgamma.c + +[tests/tgamma.c] Updated the exp_lgamma_tests test to trigger an +endless loop due to undetected overflow on 64-bit machines. +------------------------------------------------------------------------ +r8187 | vlefevre | 2012-05-03 16:20:35 +0000 (Thu, 03 May 2012) | 1 line +Changed paths: + M /trunk/tests/tgamma.c + +[tests/tgamma.c] Say that the freeze is for 64-bit machines only. +------------------------------------------------------------------------ +r8186 | vlefevre | 2012-05-03 16:17:59 +0000 (Thu, 03 May 2012) | 1 line +Changed paths: + M /trunk/tests/tgamma.c + +[tests/tgamma.c] Added more mpfr_tgamma tests, showing a freeze. +------------------------------------------------------------------------ +r8185 | vlefevre | 2012-05-03 14:49:46 +0000 (Thu, 03 May 2012) | 2 lines +Changed paths: + M /trunk/src/gamma.c + +[src/gamma.c] Corrected the FIXME comment concerning the underflow +detection. +------------------------------------------------------------------------ +r8183 | vlefevre | 2012-05-03 14:28:32 +0000 (Thu, 03 May 2012) | 2 lines +Changed paths: + M /trunk/src/gamma.c + +[src/gamma.c] Added a FIXME comment: the underflow detection may still +be buggy (or the explanation is incomplete). +------------------------------------------------------------------------ +r8182 | vlefevre | 2012-05-03 14:21:57 +0000 (Thu, 03 May 2012) | 2 lines +Changed paths: + M /trunk/src/gamma.c + +[src/gamma.c] Completed the explanation concerning the new underflow +detection. +------------------------------------------------------------------------ +r8181 | vlefevre | 2012-05-03 14:15:02 +0000 (Thu, 03 May 2012) | 1 line +Changed paths: + M /trunk/src/gamma.c + +[src/gamma.c] Removed the FIXME comment (from r8169). +------------------------------------------------------------------------ +r8179 | vlefevre | 2012-05-03 13:42:13 +0000 (Thu, 03 May 2012) | 1 line +Changed paths: + M /trunk/src/gamma.c + +[src/gamma.c] Untabified. +------------------------------------------------------------------------ +r8177 | vlefevre | 2012-05-03 13:23:23 +0000 (Thu, 03 May 2012) | 1 line +Changed paths: + M /trunk/ChangeLog + +ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC svn log -rHEAD:0 -v". +------------------------------------------------------------------------ +r8175 | vlefevre | 2012-05-03 12:33:24 +0000 (Thu, 03 May 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r8174 | zimmerma | 2012-05-03 10:08:19 +0000 (Thu, 03 May 2012) | 2 lines +Changed paths: + M /trunk/src/gamma.c + +[gamma.c] tentative fix for the underflow problem + +------------------------------------------------------------------------ +r8173 | vlefevre | 2012-05-03 09:39:18 +0000 (Thu, 03 May 2012) | 2 lines +Changed paths: + M /trunk/doc/README.dev + M /trunk/doc/mpfr.texi + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + M /trunk/src/subnormal.c + M /trunk/tests/Makefile.am + M /trunk/tests/tatan.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tsqr.c + M /trunk/tools/cfarm.sh + +Updated URL's of mailing-list archives/messages in all files +(except ChangeLog, as it is generated). +------------------------------------------------------------------------ +r8172 | vlefevre | 2012-05-03 09:35:55 +0000 (Thu, 03 May 2012) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Updated URL's of mailing-list archives/messages. +------------------------------------------------------------------------ +r8170 | vlefevre | 2012-05-02 16:07:13 +0000 (Wed, 02 May 2012) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Updated concerning MPFR_RNDNA. +------------------------------------------------------------------------ +r8169 | vlefevre | 2012-04-27 14:27:58 +0000 (Fri, 27 Apr 2012) | 1 line +Changed paths: + M /trunk/src/gamma.c + +[src/gamma.c] Added a FIXME comment. +------------------------------------------------------------------------ +r8168 | vlefevre | 2012-04-27 13:51:49 +0000 (Fri, 27 Apr 2012) | 2 lines +Changed paths: + M /trunk/TODO + +[TODO] Suggested a new rounding mode: MPFR_RNDE, to be used when the +result is known to be exact (normal mode: optimize; debug mode: check). +------------------------------------------------------------------------ +r8167 | vlefevre | 2012-04-27 13:24:54 +0000 (Fri, 27 Apr 2012) | 1 line +Changed paths: + M /trunk/src/gamma.c + +[src/gamma.c] Use the new MPFR_DBGRES macro. +------------------------------------------------------------------------ +r8164 | vlefevre | 2012-04-27 12:38:03 +0000 (Fri, 27 Apr 2012) | 1 line +Changed paths: + M /trunk/tests/tgamma.c + +[tests/tgamma.c] Improved testcase test20100709. +------------------------------------------------------------------------ +r8162 | vlefevre | 2012-04-27 12:27:09 +0000 (Fri, 27 Apr 2012) | 2 lines +Changed paths: + M /trunk/tests/tgamma.c + +[tests/tgamma.c] Updated testcase test20100709 for 64-bit machines, +as this bug reappeared in r8159. +------------------------------------------------------------------------ +r8159 | zimmerma | 2012-04-26 16:05:56 +0000 (Thu, 26 Apr 2012) | 5 lines +Changed paths: + M /trunk/src/gamma.c + M /trunk/tests/tgamma.c + +[src/gamma.c] fixed bug found by Giridhar Tammana + https://sympa.inria.fr/sympa/arc/mpfr/2012-04/msg00013.html +Note (VL): this fix triggers an infinite loop on 32-bit machines + (or with -m32) in test20100709 from tgamma.c and this is partly + the opposite of changeset r6996. +------------------------------------------------------------------------ +r8157 | vlefevre | 2012-04-26 11:24:54 +0000 (Thu, 26 Apr 2012) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Improved the noreturn feature. +------------------------------------------------------------------------ +r8156 | vlefevre | 2012-04-25 12:48:17 +0000 (Wed, 25 Apr 2012) | 4 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/src/mpfr-impl.h + +Added support for _Noreturn function specifier (ISO C11). + * acinclude.m4: define MPFR_HAVE_NORETURN if _Noreturn is supported. + * src/mpfr-impl.h: use _Noreturn when MPFR_HAVE_NORETURN is defined. +Tested with GCC 4.6 (no _Noreturn) and 4.7 (supports _Noreturn). +------------------------------------------------------------------------ +r8155 | vlefevre | 2012-04-25 11:36:24 +0000 (Wed, 25 Apr 2012) | 2 lines +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Added a note about the new experimental +-ftrack-macro-expansion GCC option. +------------------------------------------------------------------------ +r8152 | vlefevre | 2012-04-24 15:36:58 +0000 (Tue, 24 Apr 2012) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Forgot to replace the mpfr_clear_divby0 internal macro +by MPFR_CLEAR_DIVBY0 in r8141. +------------------------------------------------------------------------ +r8150 | vlefevre | 2012-04-23 15:00:22 +0000 (Mon, 23 Apr 2012) | 2 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Added a comment concerning MPFR_INT_CEIL_LOG2 and +macro expansion. +------------------------------------------------------------------------ +r8149 | vlefevre | 2012-04-23 14:44:54 +0000 (Mon, 23 Apr 2012) | 2 lines +Changed paths: + M /trunk/src/ai.c + +[src/ai.c] Use an intermediate variable to avoid a huge macro expansion +in ASSERT_FAIL with gcc -ansi -pedantic-errors. +------------------------------------------------------------------------ +r8147 | vlefevre | 2012-04-23 07:17:40 +0000 (Mon, 23 Apr 2012) | 1 line +Changed paths: + M /trunk/tools/mpfrlint + +[tools/mpfrlint] Update after r8141. +------------------------------------------------------------------------ +r8142 | vlefevre | 2012-04-20 09:24:17 +0000 (Fri, 20 Apr 2012) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Improved comment about MPFR_CLEAR_* macros. +------------------------------------------------------------------------ +r8141 | vlefevre | 2012-04-20 09:17:47 +0000 (Fri, 20 Apr 2012) | 4 lines +Changed paths: + M /trunk/src/add_d.c + M /trunk/src/agm.c + M /trunk/src/cmp.c + M /trunk/src/cmp_abs.c + M /trunk/src/cmp_si.c + M /trunk/src/cmp_ui.c + M /trunk/src/d_div.c + M /trunk/src/d_sub.c + M /trunk/src/div_d.c + M /trunk/src/exp2.c + M /trunk/src/exp_2.c + M /trunk/src/get_f.c + M /trunk/src/get_si.c + M /trunk/src/get_sj.c + M /trunk/src/get_ui.c + M /trunk/src/get_uj.c + M /trunk/src/get_z.c + M /trunk/src/get_z_exp.c + M /trunk/src/jn.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mul_d.c + M /trunk/src/pow.c + M /trunk/src/sgn.c + M /trunk/src/sub_d.c + +[src] Replaced the flags-related mpfr_clear_* internal macros by an +uppercase version with a do-while in order to prevent one from using +them in an expression. Renamed MPFR_SET_ERANGE to MPFR_SET_ERANGEFLAG +for consistency. +------------------------------------------------------------------------ +r8139 | vlefevre | 2012-04-19 12:13:28 +0000 (Thu, 19 Apr 2012) | 8 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Use a do-while statement for the MPFR_SET_ERANGE() +macro in order to prevent one from using this macro in an expression, +as the sequence point rules could be broken if __gmpfr_flags is +assigned twice in the same expression (via macro expansions). +Note: This cannot be done for the mpfr_clear_* flags macros because +we want to be able to follow the API inside MPFR (thus these macros +must be usable wherever a function is). These macros should probably +be removed or renamed in the future (e.g. via the flags branch). +------------------------------------------------------------------------ +r8136 | vlefevre | 2012-04-11 10:38:55 +0000 (Wed, 11 Apr 2012) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Suggest mpfr_pow_q and variants. +------------------------------------------------------------------------ +r8135 | vlefevre | 2012-03-28 13:23:27 +0000 (Wed, 28 Mar 2012) | 3 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated "API Compatibility" section: functions +mpfr_fmodquo, mpfr_fpif_export and mpfr_fpif_import are new in +MPFR 3.2. +------------------------------------------------------------------------ +r8133 | vlefevre | 2012-03-27 00:58:57 +0000 (Tue, 27 Mar 2012) | 1 line +Changed paths: + M /trunk/tests/tfpif.c + +[tests/tfpif.c] Removed trailing whitespace. +------------------------------------------------------------------------ +r8132 | zimmerma | 2012-03-26 19:08:58 +0000 (Mon, 26 Mar 2012) | 2 lines +Changed paths: + M /trunk/src/fpif.c + M /trunk/tests/tfpif.c + +[src/fpif.c,tests/tfpif.c] changed to GNU style + +------------------------------------------------------------------------ +r8131 | demengeo | 2012-03-26 16:00:30 +0000 (Mon, 26 Mar 2012) | 1 line +Changed paths: + M /trunk/src/fpif.c + M /trunk/tests/tfpif.c + +Add a test on FILE* in fpif.c; Added a missing test on a return value; Changed the way to compute number of bytes needed for the limb of a mpfr number; Increase coverage test of fpif.c +------------------------------------------------------------------------ +r8130 | vlefevre | 2012-03-26 14:40:34 +0000 (Mon, 26 Mar 2012) | 5 lines +Changed paths: + M /trunk/src/atan2.c + M /trunk/src/exceptions.c + M /trunk/src/gmp_op.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + M /trunk/src/round_near_x.c + M /trunk/tests/texp.c + M /trunk/tests/tfma.c + M /trunk/tests/tfms.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow_z.c + +[src] New mpfr_flags_t type, defined as an unsigned int. For the + __gmpfr_flags variable and internal flags-related variables, + replaced unsigned int by mpfr_flags_t (note that this doesn't + change the ABI, since unsigned int was already used). +[tests] Cast __gmpfr_flags to unsigned int when printed with %u. +------------------------------------------------------------------------ +r8129 | zimmerma | 2012-03-26 14:11:26 +0000 (Mon, 26 Mar 2012) | 3 lines +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + M /trunk/src/mpfr.h + M /trunk/src/rem1.c + M /trunk/tests/tremquo.c + M /trunk/tools/cfarm.sh + +added new function mpfr_fmodquo +(cf https://sympa.inria.fr/sympa/arc/mpfr/2012-03/msg00020.html) + +------------------------------------------------------------------------ +r8128 | vlefevre | 2012-03-26 12:30:31 +0000 (Mon, 26 Mar 2012) | 1 line +Changed paths: + M /trunk/examples/version.c + +[src/mpfr-examples/version.c] Output sizeof(mpfr_t) value. +------------------------------------------------------------------------ +r8126 | vlefevre | 2012-03-26 12:12:51 +0000 (Mon, 26 Mar 2012) | 1 line +Changed paths: + M /trunk/tests/tests.c + +[tests/tests.c] Improved src_fopen() a bit. +------------------------------------------------------------------------ +r8125 | vlefevre | 2012-03-26 10:58:49 +0000 (Mon, 26 Mar 2012) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Explain the use of the new MPFR_DBGRES macro. +------------------------------------------------------------------------ +r8124 | vlefevre | 2012-03-26 10:52:58 +0000 (Mon, 26 Mar 2012) | 4 lines +Changed paths: + M /trunk/src/const_euler.c + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Added a MPFR_DBGRES macro to avoid a warning in +non-debug mode, e.g. with GCC's -Wunused-but-set-variable, when a +result is tested only in an MPFR_ASSERTD expression. +[src/const_euler.c] Avoid such a warning by using MPFR_DBGRES. +------------------------------------------------------------------------ +r8123 | vlefevre | 2012-03-26 09:19:12 +0000 (Mon, 26 Mar 2012) | 1 line +Changed paths: + M /trunk/src/fpif.c + M /trunk/src/get_ld.c + M /trunk/src/mpfr-gmp.h + M /trunk/tools/mpfrlint + +MPFR_ASSERTD or MPFR_ASSERTN must be used for assertions, not ASSERT. +------------------------------------------------------------------------ +r8122 | zimmerma | 2012-03-20 13:53:33 +0000 (Tue, 20 Mar 2012) | 3 lines +Changed paths: + M /trunk/tests/Makefile.am + M /trunk/tests/tests.c + +[tests/tests.c] fixed problem with src_fopen + (https://sympa.inria.fr/sympa/arc/mpfr/2012-03/msg00021.html) + +------------------------------------------------------------------------ +r8121 | zimmerma | 2012-03-20 13:41:06 +0000 (Tue, 20 Mar 2012) | 2 lines +Changed paths: + M /trunk/tests/Makefile.am + +[tests/Makefile.am] inp_str.data -> inp_str.dat + +------------------------------------------------------------------------ +r8120 | zimmerma | 2012-03-20 13:28:49 +0000 (Tue, 20 Mar 2012) | 4 lines +Changed paths: + A /trunk/tests/inp_str.dat (from /trunk/tests/inp_str.data:8119) + D /trunk/tests/inp_str.data + M /trunk/tests/tfpif.c + M /trunk/tests/tinp_str.c + +renamed tests/inp_str.data into tests/inp_str.dat +[tests/tinp_str.c] now use tests/inp_str.dat +[tests/tfpif.c] use src_fopen instead of fopen + +------------------------------------------------------------------------ +r8119 | zimmerma | 2012-03-20 08:39:39 +0000 (Tue, 20 Mar 2012) | 2 lines +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] simplified &x[i] into x+i + +------------------------------------------------------------------------ +r8118 | zimmerma | 2012-03-20 08:13:52 +0000 (Tue, 20 Mar 2012) | 3 lines +Changed paths: + M /trunk/src/mparam_h.in + M /trunk/tools/cfarm.sh + +[src/mparam_h.in] better recognition of AMD64 systems +[tools/cfarm.sh] updated + +------------------------------------------------------------------------ +r8117 | zimmerma | 2012-03-20 07:39:40 +0000 (Tue, 20 Mar 2012) | 2 lines +Changed paths: + M /trunk/tests/tests.c + +[tests.c] fixed compiler warning (gcc70.fsffrance.org, NetBSD, gcc 4.1.3) + +------------------------------------------------------------------------ +r8116 | zimmerma | 2012-03-19 17:06:41 +0000 (Mon, 19 Mar 2012) | 2 lines +Changed paths: + M /trunk/src/fpif.c + +[fpif.c] simplified code since nb_data is always 1 + +------------------------------------------------------------------------ +r8115 | zimmerma | 2012-03-19 16:03:55 +0000 (Mon, 19 Mar 2012) | 2 lines +Changed paths: + M /trunk/src/mparam_h.in + +[mparam_h.in] recognize __tune_amdfam10__ (for example gcc10.fsffrance.org) + +------------------------------------------------------------------------ +r8114 | zimmerma | 2012-03-19 15:33:33 +0000 (Mon, 19 Mar 2012) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/configure.ac + +[configure.ac] use AC_C_BIGENDIAN to determine endianness of words + +------------------------------------------------------------------------ +r8113 | zimmerma | 2012-03-19 15:27:43 +0000 (Mon, 19 Mar 2012) | 2 lines +Changed paths: + M /trunk/tests/Makefile.am + +[tests/Makefile.am] the name of the test file for the export/import functions has changed + +------------------------------------------------------------------------ +r8112 | vlefevre | 2012-03-19 15:22:46 +0000 (Mon, 19 Mar 2012) | 1 line +Changed paths: + M /trunk/tests + +tests: updated svn:ignore property. +------------------------------------------------------------------------ +r8111 | vlefevre | 2012-03-19 15:20:34 +0000 (Mon, 19 Mar 2012) | 1 line +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Indentation. +------------------------------------------------------------------------ +r8110 | zimmerma | 2012-03-19 15:14:58 +0000 (Mon, 19 Mar 2012) | 3 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/fpif.c + M /trunk/src/mpfr.h + M /trunk/tests/tfpif.c + +changed the order of arguments of mpfr_fpif_import so that the modified +argument is first + +------------------------------------------------------------------------ +r8109 | zimmerma | 2012-03-19 15:02:04 +0000 (Mon, 19 Mar 2012) | 2 lines +Changed paths: + M /trunk/NEWS + +[NEWS] updated item about the new mpfr_fpif_export and mpfr_fpif_import functions + +------------------------------------------------------------------------ +r8108 | zimmerma | 2012-03-19 15:00:10 +0000 (Mon, 19 Mar 2012) | 3 lines +Changed paths: + M /trunk/doc/mpfr.texi + M /trunk/src/fpif.c + M /trunk/src/mpfr.h + M /trunk/tests/tfpif.c + +mpfr_fpif_export_binary -> mpfr_fpif_export +mpfr_fpif_import_binary -> mpfr_fpif_import + +------------------------------------------------------------------------ +r8107 | zimmerma | 2012-03-19 14:50:31 +0000 (Mon, 19 Mar 2012) | 3 lines +Changed paths: + A /trunk/tests/mpfrtest.dat (from /trunk/tests/stream.data:8106) + D /trunk/tests/stream.data + M /trunk/tests/tfpif.c + +stream.data renamed to mpfrtest.dat +[tfpif.c] now use remove() + +------------------------------------------------------------------------ +r8106 | vlefevre | 2012-03-19 14:13:32 +0000 (Mon, 19 Mar 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] "in future version" → "in future versions". +------------------------------------------------------------------------ +r8105 | vlefevre | 2012-03-19 14:10:58 +0000 (Mon, 19 Mar 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r8104 | vlefevre | 2012-03-19 14:08:21 +0000 (Mon, 19 Mar 2012) | 1 line +Changed paths: + M /trunk/src/fpif.c + M /trunk/tests/tfpif.c + +[src/fpif.c,tests/tfpif.c] Corrected coding style. +------------------------------------------------------------------------ +r8103 | zimmerma | 2012-03-17 06:53:15 +0000 (Sat, 17 Mar 2012) | 2 lines +Changed paths: + M /trunk/src/fpif.c + +[src/fpif.c] fixed a few warnings and errors with g++ (found on hydra) + +------------------------------------------------------------------------ +r8102 | zimmerma | 2012-03-16 21:18:56 +0000 (Fri, 16 Mar 2012) | 2 lines +Changed paths: + D /trunk/src/out_raw.c + +[out_raw.c] removed obsolete file (replaced by fpif.c) + +------------------------------------------------------------------------ +r8101 | zimmerma | 2012-03-16 21:15:20 +0000 (Fri, 16 Mar 2012) | 2 lines +Changed paths: + M /trunk/tests/Makefile.am + +[tests/Makefile.am] put tfpif at its right place + +------------------------------------------------------------------------ +r8100 | zimmerma | 2012-03-16 21:07:50 +0000 (Fri, 16 Mar 2012) | 6 lines +Changed paths: + M /trunk/src/fpif.c + M /trunk/tests/Makefile.am + A /trunk/tests/stream.data + M /trunk/tests/tfpif.c + +[src/fpif.c] fixed problem with sign on gcc38 +[tests/tfpif.c] solved FIXME's, added new test with fixed data file +[tests/stream.data] data file for tfpif.c (to check we get same results with + different word size and endianness) +[tests/Makefile.am] added stream.data to make dist + +------------------------------------------------------------------------ +r8099 | zimmerma | 2012-03-16 20:14:28 +0000 (Fri, 16 Mar 2012) | 4 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/src/fpif.c + M /trunk/tests/tfpif.c + +[fpif.c] added comments +[tfpif.c] improve error message in case of mismatch +[acinclude.m4] forgot double-double big endian + +------------------------------------------------------------------------ +r8098 | zimmerma | 2012-03-16 17:30:21 +0000 (Fri, 16 Mar 2012) | 3 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[mpfr.texi] added note saying that mpfr_fpif_export_binary and + mpfr_fpif_import_binary are experimental + +------------------------------------------------------------------------ +r8097 | zimmerma | 2012-03-16 17:25:34 +0000 (Fri, 16 Mar 2012) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[mpfr.texi] added documentation for mpfr_fpif_export_binary and mpfr_fpif_import_binary + +------------------------------------------------------------------------ +r8096 | zimmerma | 2012-03-16 16:50:23 +0000 (Fri, 16 Mar 2012) | 2 lines +Changed paths: + M /trunk/src/fpif.c + +[fpif.c] replaced sizeof(var) by sizeof(type) + +------------------------------------------------------------------------ +r8095 | zimmerma | 2012-03-15 20:58:22 +0000 (Thu, 15 Mar 2012) | 2 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/src/fpif.c + +[fpif.c] fixed a few issues + +------------------------------------------------------------------------ +r8094 | zimmerma | 2012-03-15 18:40:39 +0000 (Thu, 15 Mar 2012) | 4 lines +Changed paths: + M /trunk/src/fpif.c + M /trunk/src/mpfr.h + M /trunk/tests/tfpif.c + +[src/fpif.c,src/mpfr.h,tests/tfpif.c] a few fixes so that make and make check + pass on one machine. Will fix the + remaining issues later. + +------------------------------------------------------------------------ +r8093 | vlefevre | 2012-03-15 16:00:47 +0000 (Thu, 15 Mar 2012) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/src/fpif.c + M /trunk/src/mpfr.h + M /trunk/tests/tfpif.c + +Added FIXME for export/import MPFR numbers, did some corrections, +updated NEWS file. +------------------------------------------------------------------------ +r8092 | vlefevre | 2012-03-15 15:51:01 +0000 (Thu, 15 Mar 2012) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Update about C headers. +------------------------------------------------------------------------ +r8091 | demengeo | 2012-03-15 13:43:20 +0000 (Thu, 15 Mar 2012) | 1 line +Changed paths: + M /trunk/src/fpif.c + M /trunk/tests/tfpif.c + +Add copyright material in fpif.c and test_fpif.c +------------------------------------------------------------------------ +r8090 | demengeo | 2012-03-15 09:49:17 +0000 (Thu, 15 Mar 2012) | 1 line +Changed paths: + M /trunk/src/Makefile.am + A /trunk/src/fpif.c + M /trunk/src/mpfr.h + M /trunk/tests/Makefile.am + A /trunk/tests/tfpif.c + +Add functions/tests to export/import mpfr number in a binary format +------------------------------------------------------------------------ +r8089 | vlefevre | 2012-03-13 09:44:51 +0000 (Tue, 13 Mar 2012) | 1 line +Changed paths: + M /trunk/src/check.c + M /trunk/tests/tcheck.c + +Improved mpfr_check and added a missing testcase. +------------------------------------------------------------------------ +r8085 | vlefevre | 2012-03-09 14:04:39 +0000 (Fri, 09 Mar 2012) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Corrected information about valgrind. +------------------------------------------------------------------------ +r8083 | vlefevre | 2012-03-09 11:59:39 +0000 (Fri, 09 Mar 2012) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Updated a comment. +------------------------------------------------------------------------ +r8082 | vlefevre | 2012-03-09 11:40:09 +0000 (Fri, 09 Mar 2012) | 3 lines +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Improved macros from the changeset r8025, in +particular to avoid an error with the --enable-assert configure +option and the -ansi -pedantic-errors gcc compiler flags. +------------------------------------------------------------------------ +r8079 | vlefevre | 2012-03-08 13:54:43 +0000 (Thu, 08 Mar 2012) | 3 lines +Changed paths: + M /trunk/tests/tprintf.c + +[tests/tprintf.c] Corrected the test with MPFR_CHECK_LARGEMEM=1 again, +and improved it in case _MPFR_PREC_FORMAT == 2, where MPFR_PREC_MAX is +INT_MAX minus some small constant (see r8035). +------------------------------------------------------------------------ +r8078 | vlefevre | 2012-03-08 13:01:07 +0000 (Thu, 08 Mar 2012) | 1 line +Changed paths: + M /trunk/tests/tprintf.c + +[tests/tprintf.c] Corrected the test with MPFR_CHECK_LARGEMEM=1. +------------------------------------------------------------------------ +r8077 | vlefevre | 2012-03-08 12:22:04 +0000 (Thu, 08 Mar 2012) | 2 lines +Changed paths: + M /trunk/tests/tinits.c + +[tests/tinits.c] Improved the large precision test so that it is still +performed after r8035 (where MPFR_PREC_MAX has been decreased). +------------------------------------------------------------------------ +r8076 | vlefevre | 2012-03-08 09:12:38 +0000 (Thu, 08 Mar 2012) | 1 line +Changed paths: + M /trunk/tests/tconst_log2.c + +[tests/tconst_log2.c] Replaced mpfr_printf by mpfr_out_str. +------------------------------------------------------------------------ +r8075 | zimmerma | 2012-03-08 08:17:48 +0000 (Thu, 08 Mar 2012) | 2 lines +Changed paths: + M /trunk/tests/tconst_log2.c + +[tconst_log2.c] use hexadecimal output in case of error in check_large() + +------------------------------------------------------------------------ +r8074 | zimmerma | 2012-03-08 08:11:59 +0000 (Thu, 08 Mar 2012) | 4 lines +Changed paths: + M /trunk/src/get_ld.c + M /trunk/tests/tset_ld.c + +[get_ld.c] added comments and ASSERT() +[tset_ld.c] added test to better exercise get_ld and set_ld for subnormals, + and replaced some 64 by MPFR_LDBL_MANT_DIG + +------------------------------------------------------------------------ +r8073 | zimmerma | 2012-03-07 20:28:43 +0000 (Wed, 07 Mar 2012) | 3 lines +Changed paths: + M /trunk/tests/tconst_log2.c + +[tconst_log2.c] improved error message, cf + https://sympa.inria.fr/sympa/arc/mpfr/2012-03/msg00017.html + +------------------------------------------------------------------------ +r8072 | zimmerma | 2012-03-07 18:22:41 +0000 (Wed, 07 Mar 2012) | 2 lines +Changed paths: + M /trunk/src/get_ld.c + +[get_ld.c] deal with the case "long double" == "double" + +------------------------------------------------------------------------ +r8071 | zimmerma | 2012-03-07 18:15:21 +0000 (Wed, 07 Mar 2012) | 3 lines +Changed paths: + M /trunk/acinclude.m4 + M /trunk/src/set_ld.c + +[acinclude.m4] deal with long double == double +[src/set_ld.c] idem + +------------------------------------------------------------------------ +r8070 | vlefevre | 2012-03-07 15:15:09 +0000 (Wed, 07 Mar 2012) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Prepare for new version 3.2.0 (will be 4.0.0). +------------------------------------------------------------------------ +r8068 | vlefevre | 2012-03-07 13:06:40 +0000 (Wed, 07 Mar 2012) | 1 line +Changed paths: + M /trunk/INSTALL + +[INSTALL] Added information about --with-sysroot. +------------------------------------------------------------------------ +r8067 | vlefevre | 2012-03-07 12:41:49 +0000 (Wed, 07 Mar 2012) | 3 lines +Changed paths: + M /trunk/INSTALL + +[INSTALL] Removed an obsolete paragraph saying that the test suite +can't be run with a C++ compiler. C++ related problems have been +fixed a long time ago. +------------------------------------------------------------------------ +r8066 | zimmerma | 2012-03-06 12:51:17 +0000 (Tue, 06 Mar 2012) | 2 lines +Changed paths: + M /trunk/TODO + +[TODO] added new item about saving/restoring flags + +------------------------------------------------------------------------ +r8065 | zimmerma | 2012-03-06 11:31:55 +0000 (Tue, 06 Mar 2012) | 2 lines +Changed paths: + M /trunk/src/Makefile.am + A /trunk/src/mips + A /trunk/src/mips/mparam.h + M /trunk/src/mparam_h.in + +added tuning parameters for mips (on gcc49.fsffrance.org) + +------------------------------------------------------------------------ +r8064 | zimmerma | 2012-03-05 17:51:58 +0000 (Mon, 05 Mar 2012) | 2 lines +Changed paths: + M /trunk/tune/tuneup.c + +[tuneup.c] fixed compiler warning (got on gcc49.fsffrance.org) + +------------------------------------------------------------------------ +r8063 | vlefevre | 2012-03-05 01:40:49 +0000 (Mon, 05 Mar 2012) | 1 line +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Minor change to be consistent with "src/mpfr-gmp.h". +------------------------------------------------------------------------ +r8062 | vlefevre | 2012-03-05 01:09:52 +0000 (Mon, 05 Mar 2012) | 1 line +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Added a reference to MPFR bug 13947. +------------------------------------------------------------------------ +r8061 | vlefevre | 2012-03-05 01:00:50 +0000 (Mon, 05 Mar 2012) | 4 lines +Changed paths: + M /trunk/src/mpfr.h + +[src/mpfr.h] Simple temporary fix following GMP's internal __gmp_const +macro removal in (and its +replacement by const): if __gmp_const isn't define, let's define it to +const. +------------------------------------------------------------------------ +r8058 | vlefevre | 2012-03-03 02:59:36 +0000 (Sat, 03 Mar 2012) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Mention the mpfr_exp bug fix (from r6964 in exp_2.c). +------------------------------------------------------------------------ +r8056 | vlefevre | 2012-02-27 12:09:25 +0000 (Mon, 27 Feb 2012) | 2 lines +Changed paths: + M /trunk/configure.ac + +[configure.ac] If 'gmp.h' and 'libgmp' seem to have different versions, +output the temporary LD_RUN_PATH value (may be useful for debugging). +------------------------------------------------------------------------ +r8054 | vlefevre | 2012-02-24 16:13:48 +0000 (Fri, 24 Feb 2012) | 3 lines +Changed paths: + M /trunk/tests/memory.c + M /trunk/tests/reuse.c + M /trunk/tests/tabs.c + M /trunk/tests/tacos.c + M /trunk/tests/tacosh.c + M /trunk/tests/tadd.c + M /trunk/tests/tadd1sp.c + M /trunk/tests/tadd_d.c + M /trunk/tests/tadd_ui.c + M /trunk/tests/tagm.c + M /trunk/tests/tai.c + M /trunk/tests/tasin.c + M /trunk/tests/tasinh.c + M /trunk/tests/tatan.c + M /trunk/tests/tatanh.c + M /trunk/tests/taway.c + M /trunk/tests/tbuildopt.c + M /trunk/tests/tcan_round.c + M /trunk/tests/tcbrt.c + M /trunk/tests/tcheck.c + M /trunk/tests/tcmp.c + M /trunk/tests/tcmp2.c + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + M /trunk/tests/tcmp_ui.c + M /trunk/tests/tcmpabs.c + M /trunk/tests/tcomparisons.c + M /trunk/tests/tconst_catalan.c + M /trunk/tests/tconst_euler.c + M /trunk/tests/tconst_log2.c + M /trunk/tests/tconst_pi.c + M /trunk/tests/tcopysign.c + M /trunk/tests/tcos.c + M /trunk/tests/tcosh.c + M /trunk/tests/tcot.c + M /trunk/tests/tcoth.c + M /trunk/tests/tcsc.c + M /trunk/tests/tcsch.c + M /trunk/tests/td_div.c + M /trunk/tests/td_sub.c + M /trunk/tests/tdigamma.c + M /trunk/tests/tdim.c + M /trunk/tests/tdiv.c + M /trunk/tests/tdiv_d.c + M /trunk/tests/tdiv_ui.c + M /trunk/tests/teint.c + M /trunk/tests/teq.c + M /trunk/tests/terf.c + M /trunk/tests/tests.c + M /trunk/tests/texceptions.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/texpm1.c + M /trunk/tests/tfactorial.c + M /trunk/tests/tfits.c + M /trunk/tests/tfma.c + M /trunk/tests/tfmod.c + M /trunk/tests/tfms.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tfrac.c + M /trunk/tests/tfrexp.c + M /trunk/tests/tgamma.c + M /trunk/tests/tget_d.c + M /trunk/tests/tget_d_2exp.c + M /trunk/tests/tget_f.c + M /trunk/tests/tget_flt.c + M /trunk/tests/tget_ld_2exp.c + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tget_sj.c + M /trunk/tests/tget_str.c + M /trunk/tests/tget_z.c + M /trunk/tests/tgmpop.c + M /trunk/tests/tgrandom.c + M /trunk/tests/thyperbolic.c + M /trunk/tests/thypot.c + M /trunk/tests/tinits.c + M /trunk/tests/tinp_str.c + M /trunk/tests/tinternals.c + M /trunk/tests/tisnan.c + M /trunk/tests/tisqrt.c + M /trunk/tests/tj0.c + M /trunk/tests/tj1.c + M /trunk/tests/tjn.c + M /trunk/tests/tl2b.c + M /trunk/tests/tlgamma.c + M /trunk/tests/tli2.c + M /trunk/tests/tlngamma.c + M /trunk/tests/tlog.c + M /trunk/tests/tlog10.c + M /trunk/tests/tlog1p.c + M /trunk/tests/tlog2.c + M /trunk/tests/tmin_prec.c + M /trunk/tests/tminmax.c + M /trunk/tests/tmodf.c + M /trunk/tests/tmul.c + M /trunk/tests/tmul_2exp.c + M /trunk/tests/tmul_d.c + M /trunk/tests/tmul_ui.c + M /trunk/tests/tnext.c + M /trunk/tests/tout_str.c + M /trunk/tests/toutimpl.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow3.c + M /trunk/tests/tpow_all.c + M /trunk/tests/tpow_z.c + M /trunk/tests/tprintf.c + M /trunk/tests/trandom.c + M /trunk/tests/trec_sqrt.c + M /trunk/tests/tremquo.c + M /trunk/tests/trint.c + M /trunk/tests/troot.c + M /trunk/tests/tround_prec.c + M /trunk/tests/tsec.c + M /trunk/tests/tsech.c + M /trunk/tests/tset.c + M /trunk/tests/tset_d.c + M /trunk/tests/tset_exp.c + M /trunk/tests/tset_f.c + M /trunk/tests/tset_ld.c + M /trunk/tests/tset_q.c + M /trunk/tests/tset_si.c + M /trunk/tests/tset_sj.c + M /trunk/tests/tset_str.c + M /trunk/tests/tset_z.c + M /trunk/tests/tset_z_exp.c + M /trunk/tests/tsgn.c + M /trunk/tests/tsi_op.c + M /trunk/tests/tsin.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tsinh.c + M /trunk/tests/tsinh_cosh.c + M /trunk/tests/tsprintf.c + M /trunk/tests/tsqr.c + M /trunk/tests/tsqrt.c + M /trunk/tests/tsqrt_ui.c + M /trunk/tests/tstckintc.c + M /trunk/tests/tstrtofr.c + M /trunk/tests/tsub.c + M /trunk/tests/tsub1sp.c + M /trunk/tests/tsub_d.c + M /trunk/tests/tsub_ui.c + M /trunk/tests/tsubnormal.c + M /trunk/tests/tsum.c + M /trunk/tests/tswap.c + M /trunk/tests/ttan.c + M /trunk/tests/ttanh.c + M /trunk/tests/ttrunc.c + M /trunk/tests/tui_div.c + M /trunk/tests/tui_pow.c + M /trunk/tests/tui_sub.c + M /trunk/tests/turandom.c + M /trunk/tests/tversion.c + M /trunk/tests/ty0.c + M /trunk/tests/ty1.c + M /trunk/tests/tyn.c + M /trunk/tests/tzeta.c + M /trunk/tests/tzeta_ui.c + +[tests] Removed #include of headers already included via "mpfr-test.h" +(, , ). Note: this change doesn't apply +to tvalist.c, which is a special test that doesn't use "mpfr-test.h". +------------------------------------------------------------------------ +r8053 | vlefevre | 2012-02-24 15:50:55 +0000 (Fri, 24 Feb 2012) | 2 lines +Changed paths: + M /trunk/src/abort_prec_max.c + M /trunk/src/get_d64.c + M /trunk/src/logging.c + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-impl.h + M /trunk/src/rec_sqrt.c + M /trunk/src/strtofr.c + +[src] #include unconditionally in mpfr-impl.h; removed +this #include from the .c files. +------------------------------------------------------------------------ +r8052 | vlefevre | 2012-02-24 15:32:50 +0000 (Fri, 24 Feb 2012) | 1 line +Changed paths: + M /trunk/src/logging.c + +[src/logging.c] #include was no longer necessary. Removed. +------------------------------------------------------------------------ +r8051 | vlefevre | 2012-02-24 15:27:26 +0000 (Fri, 24 Feb 2012) | 1 line +Changed paths: + M /trunk/src/logging.c + +[src/logging.c] Updated a comment (contained obsolete information). +------------------------------------------------------------------------ +r8048 | vlefevre | 2012-02-24 13:44:05 +0000 (Fri, 24 Feb 2012) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Use %.*Rg instead of %.*Rf for MPFR_LOG_VAR. +------------------------------------------------------------------------ +r8044 | vlefevre | 2012-02-24 12:21:18 +0000 (Fri, 24 Feb 2012) | 1 line +Changed paths: + M /trunk/NEWS + +[NEWS] Mention an internal change in MPFR 3.1.0. +------------------------------------------------------------------------ +r8043 | vlefevre | 2012-02-24 11:59:09 +0000 (Fri, 24 Feb 2012) | 5 lines +Changed paths: + M /trunk/src/add_d.c + M /trunk/src/add_ui.c + M /trunk/src/mul_d.c + +Corrected a typo in MPFR_LOG_FUNC of add_d.c, add_ui.c and mul_d.c +(mpfr_get_prec → mpfr_log_prec), fixing bug 13933. +The consequence was random freezes (on the same binary) with dynamic +linking (and just more memory with static linking to the MPFR library) +when logging was used. +------------------------------------------------------------------------ +r8042 | vlefevre | 2012-02-24 09:41:09 +0000 (Fri, 24 Feb 2012) | 1 line +Changed paths: + M /trunk/src/const_euler.c + +[src/const_euler.c] Use the safer MPFR_BLOCK. +------------------------------------------------------------------------ +r8041 | vlefevre | 2012-02-23 16:24:17 +0000 (Thu, 23 Feb 2012) | 1 line +Changed paths: + M /trunk/src/const_euler.c + +[src/const_euler.c] Removed a useless log message added in r8040. +------------------------------------------------------------------------ +r8040 | vlefevre | 2012-02-23 16:08:23 +0000 (Thu, 23 Feb 2012) | 4 lines +Changed paths: + M /trunk/src/const_euler.c + M /trunk/src/mpfr-impl.h + +[src/const_euler.c] Replaced computations on double by computations + on MPFR types, with detection of overflows. Fixed inconsistencies + with algorithms.tex (due to rounding) in the computation of n. +[src/mpfr-impl.h] Removed #define ALPHA (no longer used). +------------------------------------------------------------------------ +r8039 | vlefevre | 2012-02-23 14:09:05 +0000 (Thu, 23 Feb 2012) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Removed obsolete #define EXPM1. +------------------------------------------------------------------------ +r8038 | vlefevre | 2012-02-23 14:05:12 +0000 (Thu, 23 Feb 2012) | 1 line +Changed paths: + M /trunk/src/erf.c + +[src/erf.c] Removed an obsolete #define. +------------------------------------------------------------------------ +r8037 | vlefevre | 2012-02-23 13:57:16 +0000 (Thu, 23 Feb 2012) | 1 line +Changed paths: + M /trunk/BUGS + +[BUGS] Update concerning huge precisions and integer overflows. +------------------------------------------------------------------------ +r8036 | vlefevre | 2012-02-23 13:52:04 +0000 (Thu, 23 Feb 2012) | 2 lines +Changed paths: + M /trunk/examples/version.c + +[examples/version.c] Output mpfr_prec_t information with all MPFR +versions. Output signedness information for MPFR types/macros. +------------------------------------------------------------------------ +r8035 | vlefevre | 2012-02-23 13:27:25 +0000 (Thu, 23 Feb 2012) | 8 lines +Changed paths: + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr.h + +[src/mpfr.h] Decrease the MPFR_PREC_MAX value by 256 in order to + avoid some integer overflows in existing code that increases the + working precision (if mpfr_prec_t is on 64 bits, this does not + change anything in practice), as too large precisions should be + detected via assertions for more security. After discussion, it + has been decided to keep the MPFR_PREC_MAX value close to 2^31 + when mpfr_prec_t is on 32 bits. +[src/mpfr-impl.h] Added a comment concerning MPFR_ADD_PREC. +------------------------------------------------------------------------ +r8034 | vlefevre | 2012-02-23 12:34:22 +0000 (Thu, 23 Feb 2012) | 2 lines +Changed paths: + M /trunk/examples/version.c + +[examples/version.c] Output more information about the precision and +exponent types. +------------------------------------------------------------------------ +r8033 | vlefevre | 2012-02-22 17:49:03 +0000 (Wed, 22 Feb 2012) | 1 line +Changed paths: + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Use MPFR_ADD_PREC in MPFR_ZIV_NEXT. +------------------------------------------------------------------------ +r8032 | vlefevre | 2012-02-22 17:39:48 +0000 (Wed, 22 Feb 2012) | 5 lines +Changed paths: + M /trunk/src/ai.c + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Added an MPFR_ADD_PREC macro to safely increase some + precision (i.e. with an assertion check for integer overflow). +[src/ai.c] Use this MPFR_ADD_PREC macro, in particular in a case where + the additional precision can be huge. +TODO: Other files would need to use MPFR_ADD_PREC. +------------------------------------------------------------------------ +r8031 | vlefevre | 2012-02-22 12:32:52 +0000 (Wed, 22 Feb 2012) | 4 lines +Changed paths: + M /trunk/tests/tinits.c + +[tests/tinits.c] Updated the large precision test to trigger a bug fixed +in r8025 on 32-bit machines (or when MPFR is built with -m32). Here the +crash was due to (MPFR_PREC (b) + GMP_NUMB_BITS-1)/GMP_NUMB_BITS in +"src/set.c". +------------------------------------------------------------------------ +r8030 | vlefevre | 2012-02-22 11:40:57 +0000 (Wed, 22 Feb 2012) | 2 lines +Changed paths: + M /trunk/src/rec_sqrt.c + +[src/rec_sqrt.c] Removed useless #include (mpfr-impl.h does a better job +for stdio). +------------------------------------------------------------------------ +r8029 | vlefevre | 2012-02-22 11:33:24 +0000 (Wed, 22 Feb 2012) | 1 line +Changed paths: + M /trunk/tests/tinits.c + +[tests/tinits.c] Improved r8026 (missing #include, support 16-bit prec). +------------------------------------------------------------------------ +r8028 | vlefevre | 2012-02-22 10:39:10 +0000 (Wed, 22 Feb 2012) | 4 lines +Changed paths: + M /trunk/doc/README.dev + M /trunk/tests/tests.c + +Document the MPFR_DEBUG_BADCASES environment variable before bad_cases() +in tests/tests.c (where it is used). Remove it from "doc/README.dev" +since it is useful only in case of crash / infinite loop in bad_cases(), +and will give useless output otherwise. +------------------------------------------------------------------------ +r8027 | zimmerma | 2012-02-22 10:23:13 +0000 (Wed, 22 Feb 2012) | 3 lines +Changed paths: + M /trunk/TODO + M /trunk/doc/README.dev + +[TODO] added comment +[doc/README.dev] added environment variables + +------------------------------------------------------------------------ +r8026 | zimmerma | 2012-02-22 10:18:08 +0000 (Wed, 22 Feb 2012) | 2 lines +Changed paths: + M /trunk/tests/tinits.c + +[tinits.c] added test to check #13918 is fixed + +------------------------------------------------------------------------ +r8025 | vlefevre | 2012-02-22 03:53:19 +0000 (Wed, 22 Feb 2012) | 4 lines +Changed paths: + M /trunk/src/add1.c + M /trunk/src/add1sp.c + M /trunk/src/agm.c + M /trunk/src/eq.c + M /trunk/src/exp.c + M /trunk/src/get_d.c + M /trunk/src/get_flt.c + M /trunk/src/get_str.c + M /trunk/src/init2.c + M /trunk/src/lngamma.c + M /trunk/src/mpfr-impl.h + M /trunk/src/mul.c + M /trunk/src/pow.c + M /trunk/src/print_raw.c + M /trunk/src/round_prec.c + M /trunk/src/round_raw_generic.c + M /trunk/src/set.c + M /trunk/src/set_f.c + M /trunk/src/set_prec.c + M /trunk/src/setmax.c + M /trunk/src/sqr.c + M /trunk/src/stack_interface.c + M /trunk/src/strtofr.c + M /trunk/src/sub1sp.c + M /trunk/src/urandomb.c + +Avoid potential integer overflows and improve consistency. This should +fix bug #13918 "Segfault with precision = MPFR_PREC_MAX on 32-bit". +Note: this problem appeared in MPFR 3.0.0 when the precision type (now +mpfr_prec_t) was changed to a signed integer. +------------------------------------------------------------------------ +r8024 | vlefevre | 2012-02-22 02:54:37 +0000 (Wed, 22 Feb 2012) | 1 line +Changed paths: + M /trunk/configure.ac + +[configure.ac] Added a comment mentioning a problem with GNU gold ld. +------------------------------------------------------------------------ +r8020 | vlefevre | 2012-02-15 23:01:30 +0000 (Wed, 15 Feb 2012) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Added reference to ISO/IEC 24747:2009 (C, special functions). +------------------------------------------------------------------------ +r8016 | zimmerma | 2012-01-27 06:48:06 +0000 (Fri, 27 Jan 2012) | 3 lines +Changed paths: + M /trunk/src/Makefile.am + D /trunk/src/x86_64/xeon + +removed directory src/x86_64/xeon +[src/Makefile.am] removed x86_64/xeon/mparam.h + +------------------------------------------------------------------------ +r8015 | zimmerma | 2012-01-25 14:43:01 +0000 (Wed, 25 Jan 2012) | 2 lines +Changed paths: + M /trunk/src/mparam_h.in + M /trunk/src/x86_64/core2/mparam.h + +share parameters between x86_64/core2 and x86_64/xeon (gcc70) + +------------------------------------------------------------------------ +r8014 | zimmerma | 2012-01-25 09:34:40 +0000 (Wed, 25 Jan 2012) | 2 lines +Changed paths: + M /trunk/src/Makefile.am + +[src/Makefile.am] forgot to add new param file + +------------------------------------------------------------------------ +r8013 | zimmerma | 2012-01-25 09:29:19 +0000 (Wed, 25 Jan 2012) | 2 lines +Changed paths: + M /trunk/src/mparam_h.in + A /trunk/src/x86_64/xeon + A /trunk/src/x86_64/xeon/mparam.h + +added tuning parameters for -mtune=nocona (gcc70) + +------------------------------------------------------------------------ +r8010 | zimmerma | 2012-01-20 07:55:29 +0000 (Fri, 20 Jan 2012) | 3 lines +Changed paths: + M /trunk/src/mparam_h.in + +[mparam_h.in] swap tests for 32-bit and 64-bit powerpc, since on powerpc64 + the parameters for 32-bit are used! + +------------------------------------------------------------------------ +r8004 | vlefevre | 2012-01-15 00:21:46 +0000 (Sun, 15 Jan 2012) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Updated "To make a release". +------------------------------------------------------------------------ +r8000 | vlefevre | 2012-01-10 13:43:29 +0000 (Tue, 10 Jan 2012) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Added a note to item about sNaN/qNaN. +------------------------------------------------------------------------ +r7998 | vlefevre | 2012-01-10 12:51:16 +0000 (Tue, 10 Jan 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated the month. +------------------------------------------------------------------------ +r7996 | vlefevre | 2012-01-10 12:49:16 +0000 (Tue, 10 Jan 2012) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Mention the AriC project-team. +------------------------------------------------------------------------ +r7994 | vlefevre | 2012-01-10 12:44:24 +0000 (Tue, 10 Jan 2012) | 1 line +Changed paths: + M /trunk/ChangeLog + +Reverted incorrect change in ChangeLog from r7993. +------------------------------------------------------------------------ +r7993 | vlefevre | 2012-01-10 12:41:58 +0000 (Tue, 10 Jan 2012) | 3 lines +Changed paths: + M /trunk/BUGS + M /trunk/ChangeLog + M /trunk/INSTALL + M /trunk/NEWS + M /trunk/README + M /trunk/TODO + M /trunk/acinclude.m4 + M /trunk/configure.ac + M /trunk/doc/FAQ.html + M /trunk/doc/README.dev + M /trunk/doc/faq.xsl + M /trunk/examples/divworst.c + M /trunk/examples/rndo-add.c + M /trunk/examples/sample.c + M /trunk/examples/version.c + M /trunk/src/abort_prec_max.c + M /trunk/src/acos.c + M /trunk/src/acosh.c + M /trunk/src/add.c + M /trunk/src/add1.c + M /trunk/src/add1sp.c + M /trunk/src/add_d.c + M /trunk/src/add_ui.c + M /trunk/src/agm.c + M /trunk/src/ai.c + M /trunk/src/asin.c + M /trunk/src/asinh.c + M /trunk/src/atan.c + M /trunk/src/atan2.c + M /trunk/src/atanh.c + M /trunk/src/bernoulli.c + M /trunk/src/buildopt.c + M /trunk/src/cache.c + M /trunk/src/cbrt.c + M /trunk/src/check.c + M /trunk/src/clear.c + M /trunk/src/clears.c + M /trunk/src/cmp.c + M /trunk/src/cmp2.c + M /trunk/src/cmp_abs.c + M /trunk/src/cmp_d.c + M /trunk/src/cmp_ld.c + M /trunk/src/cmp_si.c + M /trunk/src/cmp_ui.c + M /trunk/src/comparisons.c + M /trunk/src/const_catalan.c + M /trunk/src/const_euler.c + M /trunk/src/const_log2.c + M /trunk/src/const_pi.c + M /trunk/src/constant.c + M /trunk/src/copysign.c + M /trunk/src/cos.c + M /trunk/src/cosh.c + M /trunk/src/cot.c + M /trunk/src/coth.c + M /trunk/src/csc.c + M /trunk/src/csch.c + M /trunk/src/d_div.c + M /trunk/src/d_sub.c + M /trunk/src/digamma.c + M /trunk/src/dim.c + M /trunk/src/div.c + M /trunk/src/div_2exp.c + M /trunk/src/div_2si.c + M /trunk/src/div_2ui.c + M /trunk/src/div_d.c + M /trunk/src/div_ui.c + M /trunk/src/dump.c + M /trunk/src/eint.c + M /trunk/src/eq.c + M /trunk/src/erf.c + M /trunk/src/erfc.c + M /trunk/src/exceptions.c + M /trunk/src/exp.c + M /trunk/src/exp10.c + M /trunk/src/exp2.c + M /trunk/src/exp3.c + M /trunk/src/exp_2.c + M /trunk/src/expm1.c + M /trunk/src/extract.c + M /trunk/src/factorial.c + M /trunk/src/fits_intmax.c + M /trunk/src/fits_s.h + M /trunk/src/fits_sint.c + M /trunk/src/fits_slong.c + M /trunk/src/fits_sshort.c + M /trunk/src/fits_u.h + M /trunk/src/fits_uint.c + M /trunk/src/fits_uintmax.c + M /trunk/src/fits_ulong.c + M /trunk/src/fits_ushort.c + M /trunk/src/fma.c + M /trunk/src/fms.c + M /trunk/src/frac.c + M /trunk/src/free_cache.c + M /trunk/src/frexp.c + M /trunk/src/gamma.c + M /trunk/src/gammaonethird.c + M /trunk/src/gen_inverse.h + M /trunk/src/get_d.c + M /trunk/src/get_d64.c + M /trunk/src/get_exp.c + M /trunk/src/get_f.c + M /trunk/src/get_flt.c + M /trunk/src/get_ld.c + M /trunk/src/get_si.c + M /trunk/src/get_sj.c + M /trunk/src/get_str.c + M /trunk/src/get_ui.c + M /trunk/src/get_uj.c + M /trunk/src/get_z.c + M /trunk/src/get_z_exp.c + M /trunk/src/gmp_op.c + M /trunk/src/grandom.c + M /trunk/src/hypot.c + M /trunk/src/ieee_floats.h + M /trunk/src/init.c + M /trunk/src/init2.c + M /trunk/src/inits.c + M /trunk/src/inits2.c + M /trunk/src/inp_str.c + M /trunk/src/int_ceil_log2.c + M /trunk/src/isinf.c + M /trunk/src/isinteger.c + M /trunk/src/isnan.c + M /trunk/src/isnum.c + M /trunk/src/isqrt.c + M /trunk/src/isregular.c + M /trunk/src/iszero.c + M /trunk/src/jn.c + M /trunk/src/jyn_asympt.c + M /trunk/src/li2.c + M /trunk/src/lngamma.c + M /trunk/src/log.c + M /trunk/src/log10.c + M /trunk/src/log1p.c + M /trunk/src/log2.c + M /trunk/src/logging.c + M /trunk/src/min_prec.c + M /trunk/src/minmax.c + M /trunk/src/modf.c + M /trunk/src/mpf2mpfr.h + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-intmax.h + M /trunk/src/mpfr-thread.h + M /trunk/src/mpfr.h + M /trunk/src/mpn_exp.c + M /trunk/src/mul.c + M /trunk/src/mul_2exp.c + M /trunk/src/mul_2si.c + M /trunk/src/mul_2ui.c + M /trunk/src/mul_d.c + M /trunk/src/mul_ui.c + M /trunk/src/mulders.c + M /trunk/src/neg.c + M /trunk/src/next.c + M /trunk/src/out_raw.c + M /trunk/src/out_str.c + M /trunk/src/pow.c + M /trunk/src/pow_si.c + M /trunk/src/pow_ui.c + M /trunk/src/pow_z.c + M /trunk/src/powerof2.c + M /trunk/src/print_raw.c + M /trunk/src/print_rnd_mode.c + M /trunk/src/printf.c + M /trunk/src/rec_sqrt.c + M /trunk/src/reldiff.c + M /trunk/src/rem1.c + M /trunk/src/rint.c + M /trunk/src/root.c + M /trunk/src/round_near_x.c + M /trunk/src/round_p.c + M /trunk/src/round_prec.c + M /trunk/src/round_raw_generic.c + M /trunk/src/scale2.c + M /trunk/src/sec.c + M /trunk/src/sech.c + M /trunk/src/set.c + M /trunk/src/set_d.c + M /trunk/src/set_d64.c + M /trunk/src/set_dfl_prec.c + M /trunk/src/set_exp.c + M /trunk/src/set_f.c + M /trunk/src/set_flt.c + M /trunk/src/set_inf.c + M /trunk/src/set_ld.c + M /trunk/src/set_nan.c + M /trunk/src/set_prc_raw.c + M /trunk/src/set_prec.c + M /trunk/src/set_q.c + M /trunk/src/set_rnd.c + M /trunk/src/set_si.c + M /trunk/src/set_si_2exp.c + M /trunk/src/set_sj.c + M /trunk/src/set_str.c + M /trunk/src/set_str_raw.c + M /trunk/src/set_ui.c + M /trunk/src/set_ui_2exp.c + M /trunk/src/set_uj.c + M /trunk/src/set_z.c + M /trunk/src/set_z_exp.c + M /trunk/src/set_zero.c + M /trunk/src/setmax.c + M /trunk/src/setmin.c + M /trunk/src/setsign.c + M /trunk/src/sgn.c + M /trunk/src/si_op.c + M /trunk/src/signbit.c + M /trunk/src/sin.c + M /trunk/src/sin_cos.c + M /trunk/src/sinh.c + M /trunk/src/sinh_cosh.c + M /trunk/src/sqr.c + M /trunk/src/sqrt.c + M /trunk/src/sqrt_ui.c + M /trunk/src/stack_interface.c + M /trunk/src/strtofr.c + M /trunk/src/sub.c + M /trunk/src/sub1.c + M /trunk/src/sub1sp.c + M /trunk/src/sub_d.c + M /trunk/src/sub_ui.c + M /trunk/src/subnormal.c + M /trunk/src/sum.c + M /trunk/src/swap.c + M /trunk/src/tan.c + M /trunk/src/tanh.c + M /trunk/src/uceil_exp2.c + M /trunk/src/uceil_log2.c + M /trunk/src/ufloor_log2.c + M /trunk/src/ui_div.c + M /trunk/src/ui_pow.c + M /trunk/src/ui_pow_ui.c + M /trunk/src/ui_sub.c + M /trunk/src/urandom.c + M /trunk/src/urandomb.c + M /trunk/src/vasprintf.c + M /trunk/src/version.c + M /trunk/src/volatile.c + M /trunk/src/yn.c + M /trunk/src/zeta.c + M /trunk/src/zeta_ui.c + M /trunk/tests/cmp_str.c + M /trunk/tests/data/digamma + M /trunk/tests/data/li2 + M /trunk/tests/memory.c + M /trunk/tests/mpf_compat.c + M /trunk/tests/mpf_compat.h + M /trunk/tests/mpfr-test.h + M /trunk/tests/mpfr_compat.c + M /trunk/tests/random2.c + M /trunk/tests/reuse.c + M /trunk/tests/rnd_mode.c + M /trunk/tests/tabs.c + M /trunk/tests/tacos.c + M /trunk/tests/tacosh.c + M /trunk/tests/tadd.c + M /trunk/tests/tadd1sp.c + M /trunk/tests/tadd_d.c + M /trunk/tests/tadd_ui.c + M /trunk/tests/tagm.c + M /trunk/tests/tai.c + M /trunk/tests/tasin.c + M /trunk/tests/tasinh.c + M /trunk/tests/tatan.c + M /trunk/tests/tatanh.c + M /trunk/tests/taway.c + M /trunk/tests/tbuildopt.c + M /trunk/tests/tcan_round.c + M /trunk/tests/tcbrt.c + M /trunk/tests/tcheck.c + M /trunk/tests/tcmp.c + M /trunk/tests/tcmp2.c + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + M /trunk/tests/tcmp_ui.c + M /trunk/tests/tcmpabs.c + M /trunk/tests/tcomparisons.c + M /trunk/tests/tconst_catalan.c + M /trunk/tests/tconst_euler.c + M /trunk/tests/tconst_log2.c + M /trunk/tests/tconst_pi.c + M /trunk/tests/tcopysign.c + M /trunk/tests/tcos.c + M /trunk/tests/tcosh.c + M /trunk/tests/tcot.c + M /trunk/tests/tcoth.c + M /trunk/tests/tcsc.c + M /trunk/tests/tcsch.c + M /trunk/tests/td_div.c + M /trunk/tests/td_sub.c + M /trunk/tests/tdigamma.c + M /trunk/tests/tdim.c + M /trunk/tests/tdiv.c + M /trunk/tests/tdiv_d.c + M /trunk/tests/tdiv_ui.c + M /trunk/tests/teint.c + M /trunk/tests/teq.c + M /trunk/tests/terf.c + M /trunk/tests/tests.c + M /trunk/tests/texceptions.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/texpm1.c + M /trunk/tests/tfactorial.c + M /trunk/tests/tfits.c + M /trunk/tests/tfma.c + M /trunk/tests/tfmod.c + M /trunk/tests/tfms.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tfrac.c + M /trunk/tests/tfrexp.c + M /trunk/tests/tgamma.c + M /trunk/tests/tgeneric.c + M /trunk/tests/tgeneric_ui.c + M /trunk/tests/tget_d.c + M /trunk/tests/tget_d_2exp.c + M /trunk/tests/tget_f.c + M /trunk/tests/tget_flt.c + M /trunk/tests/tget_ld_2exp.c + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tget_sj.c + M /trunk/tests/tget_str.c + M /trunk/tests/tget_z.c + M /trunk/tests/tgmpop.c + M /trunk/tests/tgrandom.c + M /trunk/tests/thyperbolic.c + M /trunk/tests/thypot.c + M /trunk/tests/tinits.c + M /trunk/tests/tinp_str.c + M /trunk/tests/tinternals.c + M /trunk/tests/tisnan.c + M /trunk/tests/tisqrt.c + M /trunk/tests/tj0.c + M /trunk/tests/tj1.c + M /trunk/tests/tjn.c + M /trunk/tests/tl2b.c + M /trunk/tests/tlgamma.c + M /trunk/tests/tli2.c + M /trunk/tests/tlngamma.c + M /trunk/tests/tlog.c + M /trunk/tests/tlog10.c + M /trunk/tests/tlog1p.c + M /trunk/tests/tlog2.c + M /trunk/tests/tmin_prec.c + M /trunk/tests/tminmax.c + M /trunk/tests/tmodf.c + M /trunk/tests/tmul.c + M /trunk/tests/tmul_2exp.c + M /trunk/tests/tmul_d.c + M /trunk/tests/tmul_ui.c + M /trunk/tests/tnext.c + M /trunk/tests/tout_str.c + M /trunk/tests/toutimpl.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow3.c + M /trunk/tests/tpow_all.c + M /trunk/tests/tpow_z.c + M /trunk/tests/tprintf.c + M /trunk/tests/trandom.c + M /trunk/tests/trec_sqrt.c + M /trunk/tests/tremquo.c + M /trunk/tests/trint.c + M /trunk/tests/troot.c + M /trunk/tests/tround_prec.c + M /trunk/tests/tsec.c + M /trunk/tests/tsech.c + M /trunk/tests/tset.c + M /trunk/tests/tset_d.c + M /trunk/tests/tset_exp.c + M /trunk/tests/tset_f.c + M /trunk/tests/tset_ld.c + M /trunk/tests/tset_q.c + M /trunk/tests/tset_si.c + M /trunk/tests/tset_sj.c + M /trunk/tests/tset_str.c + M /trunk/tests/tset_z.c + M /trunk/tests/tset_z_exp.c + M /trunk/tests/tsgn.c + M /trunk/tests/tsi_op.c + M /trunk/tests/tsin.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tsinh.c + M /trunk/tests/tsinh_cosh.c + M /trunk/tests/tsprintf.c + M /trunk/tests/tsqr.c + M /trunk/tests/tsqrt.c + M /trunk/tests/tsqrt_ui.c + M /trunk/tests/tstckintc.c + M /trunk/tests/tstdint.c + M /trunk/tests/tstrtofr.c + M /trunk/tests/tsub.c + M /trunk/tests/tsub1sp.c + M /trunk/tests/tsub_d.c + M /trunk/tests/tsub_ui.c + M /trunk/tests/tsubnormal.c + M /trunk/tests/tsum.c + M /trunk/tests/tswap.c + M /trunk/tests/ttan.c + M /trunk/tests/ttanh.c + M /trunk/tests/ttrunc.c + M /trunk/tests/tui_div.c + M /trunk/tests/tui_pow.c + M /trunk/tests/tui_sub.c + M /trunk/tests/turandom.c + M /trunk/tests/tvalist.c + M /trunk/tests/tversion.c + M /trunk/tests/ty0.c + M /trunk/tests/ty1.c + M /trunk/tests/tyn.c + M /trunk/tests/tzeta.c + M /trunk/tests/tzeta_ui.c + M /trunk/tools/get_patches.sh + M /trunk/tune/bidimensional_sample.c + M /trunk/tune/speed.c + M /trunk/tune/tuneup.c + +Changed Arenaire to AriC with: + perl -pi -e 's/Contributed by the Arenaire/Contributed by the AriC/' **/*(^/) +under zsh. +------------------------------------------------------------------------ +r7991 | vlefevre | 2012-01-10 12:25:30 +0000 (Tue, 10 Jan 2012) | 1 line +Changed paths: + M /trunk/doc/FAQ.html + +[doc] Updated FAQ.html with update-faq. +------------------------------------------------------------------------ +r7990 | vlefevre | 2012-01-10 12:24:56 +0000 (Tue, 10 Jan 2012) | 1 line +Changed paths: + M /trunk/doc/faq.xsl + +[doc/faq.xsl] Remove only the top-level comments from the HTML file. +------------------------------------------------------------------------ +r7989 | vlefevre | 2012-01-10 12:20:49 +0000 (Tue, 10 Jan 2012) | 1 line +Changed paths: + M /trunk/doc/faq.xsl + +[doc/faq.xsl] Updated a comment. +------------------------------------------------------------------------ +r7986 | vlefevre | 2012-01-10 11:46:34 +0000 (Tue, 10 Jan 2012) | 5 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/gamma.c - M /branches/3.1/src/lngamma.c - M /branches/3.1/tests/tgamma.c + M /trunk/BUGS + M /trunk/INSTALL + M /trunk/Makefile.am + M /trunk/NEWS + M /trunk/README + M /trunk/TODO + M /trunk/acinclude.m4 + M /trunk/configure.ac + M /trunk/doc/FAQ.html + M /trunk/doc/Makefile.am + M /trunk/doc/README.dev + M /trunk/doc/faq.xsl + M /trunk/doc/mpfr.texi + M /trunk/examples/divworst.c + M /trunk/examples/rndo-add.c + M /trunk/examples/sample.c + M /trunk/examples/version.c + M /trunk/src/Makefile.am + M /trunk/src/abort_prec_max.c + M /trunk/src/acos.c + M /trunk/src/acosh.c + M /trunk/src/add.c + M /trunk/src/add1.c + M /trunk/src/add1sp.c + M /trunk/src/add_d.c + M /trunk/src/add_ui.c + M /trunk/src/agm.c + M /trunk/src/ai.c + M /trunk/src/amd/amdfam10/mparam.h + M /trunk/src/amd/athlon/mparam.h + M /trunk/src/amd/k8/mparam.h + M /trunk/src/arm/mparam.h + M /trunk/src/asin.c + M /trunk/src/asinh.c + M /trunk/src/atan.c + M /trunk/src/atan2.c + M /trunk/src/atanh.c + M /trunk/src/bernoulli.c + M /trunk/src/buildopt.c + M /trunk/src/cache.c + M /trunk/src/cbrt.c + M /trunk/src/check.c + M /trunk/src/clear.c + M /trunk/src/clears.c + M /trunk/src/cmp.c + M /trunk/src/cmp2.c + M /trunk/src/cmp_abs.c + M /trunk/src/cmp_d.c + M /trunk/src/cmp_ld.c + M /trunk/src/cmp_si.c + M /trunk/src/cmp_ui.c + M /trunk/src/comparisons.c + M /trunk/src/const_catalan.c + M /trunk/src/const_euler.c + M /trunk/src/const_log2.c + M /trunk/src/const_pi.c + M /trunk/src/constant.c + M /trunk/src/copysign.c + M /trunk/src/cos.c + M /trunk/src/cosh.c + M /trunk/src/cot.c + M /trunk/src/coth.c + M /trunk/src/csc.c + M /trunk/src/csch.c + M /trunk/src/d_div.c + M /trunk/src/d_sub.c + M /trunk/src/digamma.c + M /trunk/src/dim.c + M /trunk/src/div.c + M /trunk/src/div_2exp.c + M /trunk/src/div_2si.c + M /trunk/src/div_2ui.c + M /trunk/src/div_d.c + M /trunk/src/div_ui.c + M /trunk/src/dump.c + M /trunk/src/eint.c + M /trunk/src/eq.c + M /trunk/src/erf.c + M /trunk/src/erfc.c + M /trunk/src/exceptions.c + M /trunk/src/exp.c + M /trunk/src/exp10.c + M /trunk/src/exp2.c + M /trunk/src/exp3.c + M /trunk/src/exp_2.c + M /trunk/src/expm1.c + M /trunk/src/extract.c + M /trunk/src/factorial.c + M /trunk/src/fits_intmax.c + M /trunk/src/fits_s.h + M /trunk/src/fits_sint.c + M /trunk/src/fits_slong.c + M /trunk/src/fits_sshort.c + M /trunk/src/fits_u.h + M /trunk/src/fits_uint.c + M /trunk/src/fits_uintmax.c + M /trunk/src/fits_ulong.c + M /trunk/src/fits_ushort.c + M /trunk/src/fma.c + M /trunk/src/fms.c + M /trunk/src/frac.c + M /trunk/src/free_cache.c + M /trunk/src/frexp.c + M /trunk/src/gamma.c + M /trunk/src/gammaonethird.c + M /trunk/src/gen_inverse.h + M /trunk/src/generic/mparam.h + M /trunk/src/get_d.c + M /trunk/src/get_d64.c + M /trunk/src/get_exp.c + M /trunk/src/get_f.c + M /trunk/src/get_flt.c + M /trunk/src/get_ld.c + M /trunk/src/get_si.c + M /trunk/src/get_sj.c + M /trunk/src/get_str.c + M /trunk/src/get_ui.c + M /trunk/src/get_uj.c + M /trunk/src/get_z.c + M /trunk/src/get_z_exp.c + M /trunk/src/gmp_op.c + M /trunk/src/grandom.c + M /trunk/src/hppa/mparam.h + M /trunk/src/hypot.c + M /trunk/src/ia64/mparam.h + M /trunk/src/ieee_floats.h + M /trunk/src/init.c + M /trunk/src/init2.c + M /trunk/src/inits.c + M /trunk/src/inits2.c + M /trunk/src/inp_str.c + M /trunk/src/int_ceil_log2.c + M /trunk/src/isinf.c + M /trunk/src/isinteger.c + M /trunk/src/isnan.c + M /trunk/src/isnum.c + M /trunk/src/isqrt.c + M /trunk/src/isregular.c + M /trunk/src/iszero.c + M /trunk/src/jn.c + M /trunk/src/jyn_asympt.c + M /trunk/src/li2.c + M /trunk/src/lngamma.c + M /trunk/src/log.c + M /trunk/src/log10.c + M /trunk/src/log1p.c + M /trunk/src/log2.c + M /trunk/src/logging.c + M /trunk/src/min_prec.c + M /trunk/src/minmax.c + M /trunk/src/modf.c + M /trunk/src/mp_clz_tab.c + M /trunk/src/mparam_h.in + M /trunk/src/mpf2mpfr.h + M /trunk/src/mpfr-gmp.c + M /trunk/src/mpfr-gmp.h + M /trunk/src/mpfr-impl.h + M /trunk/src/mpfr-intmax.h + M /trunk/src/mpfr-longlong.h + M /trunk/src/mpfr-thread.h + M /trunk/src/mpfr.h + M /trunk/src/mpn_exp.c + M /trunk/src/mul.c + M /trunk/src/mul_2exp.c + M /trunk/src/mul_2si.c + M /trunk/src/mul_2ui.c + M /trunk/src/mul_d.c + M /trunk/src/mul_ui.c + M /trunk/src/mulders.c + M /trunk/src/neg.c + M /trunk/src/next.c + M /trunk/src/out_raw.c + M /trunk/src/out_str.c + M /trunk/src/pow.c + M /trunk/src/pow_si.c + M /trunk/src/pow_ui.c + M /trunk/src/pow_z.c + M /trunk/src/powerof2.c + M /trunk/src/powerpc32/mparam.h + M /trunk/src/powerpc64/mparam.h + M /trunk/src/print_raw.c + M /trunk/src/print_rnd_mode.c + M /trunk/src/printf.c + M /trunk/src/rec_sqrt.c + M /trunk/src/reldiff.c + M /trunk/src/rem1.c + M /trunk/src/rint.c + M /trunk/src/root.c + M /trunk/src/round_near_x.c + M /trunk/src/round_p.c + M /trunk/src/round_prec.c + M /trunk/src/round_raw_generic.c + M /trunk/src/scale2.c + M /trunk/src/sec.c + M /trunk/src/sech.c + M /trunk/src/set.c + M /trunk/src/set_d.c + M /trunk/src/set_d64.c + M /trunk/src/set_dfl_prec.c + M /trunk/src/set_exp.c + M /trunk/src/set_f.c + M /trunk/src/set_flt.c + M /trunk/src/set_inf.c + M /trunk/src/set_ld.c + M /trunk/src/set_nan.c + M /trunk/src/set_prc_raw.c + M /trunk/src/set_prec.c + M /trunk/src/set_q.c + M /trunk/src/set_rnd.c + M /trunk/src/set_si.c + M /trunk/src/set_si_2exp.c + M /trunk/src/set_sj.c + M /trunk/src/set_str.c + M /trunk/src/set_str_raw.c + M /trunk/src/set_ui.c + M /trunk/src/set_ui_2exp.c + M /trunk/src/set_uj.c + M /trunk/src/set_z.c + M /trunk/src/set_z_exp.c + M /trunk/src/set_zero.c + M /trunk/src/setmax.c + M /trunk/src/setmin.c + M /trunk/src/setsign.c + M /trunk/src/sgn.c + M /trunk/src/si_op.c + M /trunk/src/signbit.c + M /trunk/src/sin.c + M /trunk/src/sin_cos.c + M /trunk/src/sinh.c + M /trunk/src/sinh_cosh.c + M /trunk/src/sparc64/mparam.h + M /trunk/src/sqr.c + M /trunk/src/sqrt.c + M /trunk/src/sqrt_ui.c + M /trunk/src/stack_interface.c + M /trunk/src/strtofr.c + M /trunk/src/sub.c + M /trunk/src/sub1.c + M /trunk/src/sub1sp.c + M /trunk/src/sub_d.c + M /trunk/src/sub_ui.c + M /trunk/src/subnormal.c + M /trunk/src/sum.c + M /trunk/src/swap.c + M /trunk/src/tan.c + M /trunk/src/tanh.c + M /trunk/src/uceil_exp2.c + M /trunk/src/uceil_log2.c + M /trunk/src/ufloor_log2.c + M /trunk/src/ui_div.c + M /trunk/src/ui_pow.c + M /trunk/src/ui_pow_ui.c + M /trunk/src/ui_sub.c + M /trunk/src/urandom.c + M /trunk/src/urandomb.c + M /trunk/src/vasprintf.c + M /trunk/src/version.c + M /trunk/src/volatile.c + M /trunk/src/x86/core2/mparam.h + M /trunk/src/x86/mparam.h + M /trunk/src/x86_64/core2/mparam.h + M /trunk/src/x86_64/corei5/mparam.h + M /trunk/src/x86_64/pentium4/mparam.h + M /trunk/src/yn.c + M /trunk/src/zeta.c + M /trunk/src/zeta_ui.c + M /trunk/tests/Makefile.am + M /trunk/tests/cmp_str.c + M /trunk/tests/data/digamma + M /trunk/tests/data/li2 + M /trunk/tests/memory.c + M /trunk/tests/mpf_compat.c + M /trunk/tests/mpf_compat.h + M /trunk/tests/mpfr-test.h + M /trunk/tests/mpfr_compat.c + M /trunk/tests/random2.c + M /trunk/tests/reuse.c + M /trunk/tests/rnd_mode.c + M /trunk/tests/tabs.c + M /trunk/tests/tacos.c + M /trunk/tests/tacosh.c + M /trunk/tests/tadd.c + M /trunk/tests/tadd1sp.c + M /trunk/tests/tadd_d.c + M /trunk/tests/tadd_ui.c + M /trunk/tests/tagm.c + M /trunk/tests/tai.c + M /trunk/tests/tasin.c + M /trunk/tests/tasinh.c + M /trunk/tests/tatan.c + M /trunk/tests/tatanh.c + M /trunk/tests/taway.c + M /trunk/tests/tbuildopt.c + M /trunk/tests/tcan_round.c + M /trunk/tests/tcbrt.c + M /trunk/tests/tcheck.c + M /trunk/tests/tcmp.c + M /trunk/tests/tcmp2.c + M /trunk/tests/tcmp_d.c + M /trunk/tests/tcmp_ld.c + M /trunk/tests/tcmp_ui.c + M /trunk/tests/tcmpabs.c + M /trunk/tests/tcomparisons.c + M /trunk/tests/tconst_catalan.c + M /trunk/tests/tconst_euler.c + M /trunk/tests/tconst_log2.c + M /trunk/tests/tconst_pi.c + M /trunk/tests/tcopysign.c + M /trunk/tests/tcos.c + M /trunk/tests/tcosh.c + M /trunk/tests/tcot.c + M /trunk/tests/tcoth.c + M /trunk/tests/tcsc.c + M /trunk/tests/tcsch.c + M /trunk/tests/td_div.c + M /trunk/tests/td_sub.c + M /trunk/tests/tdigamma.c + M /trunk/tests/tdim.c + M /trunk/tests/tdiv.c + M /trunk/tests/tdiv_d.c + M /trunk/tests/tdiv_ui.c + M /trunk/tests/teint.c + M /trunk/tests/teq.c + M /trunk/tests/terf.c + M /trunk/tests/tests.c + M /trunk/tests/texceptions.c + M /trunk/tests/texp.c + M /trunk/tests/texp10.c + M /trunk/tests/texp2.c + M /trunk/tests/texpm1.c + M /trunk/tests/tfactorial.c + M /trunk/tests/tfits.c + M /trunk/tests/tfma.c + M /trunk/tests/tfmod.c + M /trunk/tests/tfms.c + M /trunk/tests/tfprintf.c + M /trunk/tests/tfrac.c + M /trunk/tests/tfrexp.c + M /trunk/tests/tgamma.c + M /trunk/tests/tgeneric.c + M /trunk/tests/tgeneric_ui.c + M /trunk/tests/tget_d.c + M /trunk/tests/tget_d_2exp.c + M /trunk/tests/tget_f.c + M /trunk/tests/tget_flt.c + M /trunk/tests/tget_ld_2exp.c + M /trunk/tests/tget_set_d64.c + M /trunk/tests/tget_sj.c + M /trunk/tests/tget_str.c + M /trunk/tests/tget_z.c + M /trunk/tests/tgmpop.c + M /trunk/tests/tgrandom.c + M /trunk/tests/thyperbolic.c + M /trunk/tests/thypot.c + M /trunk/tests/tinits.c + M /trunk/tests/tinp_str.c + M /trunk/tests/tinternals.c + M /trunk/tests/tisnan.c + M /trunk/tests/tisqrt.c + M /trunk/tests/tj0.c + M /trunk/tests/tj1.c + M /trunk/tests/tjn.c + M /trunk/tests/tl2b.c + M /trunk/tests/tlgamma.c + M /trunk/tests/tli2.c + M /trunk/tests/tlngamma.c + M /trunk/tests/tlog.c + M /trunk/tests/tlog10.c + M /trunk/tests/tlog1p.c + M /trunk/tests/tlog2.c + M /trunk/tests/tmin_prec.c + M /trunk/tests/tminmax.c + M /trunk/tests/tmodf.c + M /trunk/tests/tmul.c + M /trunk/tests/tmul_2exp.c + M /trunk/tests/tmul_d.c + M /trunk/tests/tmul_ui.c + M /trunk/tests/tnext.c + M /trunk/tests/tout_str.c + M /trunk/tests/toutimpl.c + M /trunk/tests/tpow.c + M /trunk/tests/tpow3.c + M /trunk/tests/tpow_all.c + M /trunk/tests/tpow_z.c + M /trunk/tests/tprintf.c + M /trunk/tests/trandom.c + M /trunk/tests/trec_sqrt.c + M /trunk/tests/tremquo.c + M /trunk/tests/trint.c + M /trunk/tests/troot.c + M /trunk/tests/tround_prec.c + M /trunk/tests/tsec.c + M /trunk/tests/tsech.c + M /trunk/tests/tset.c + M /trunk/tests/tset_d.c + M /trunk/tests/tset_exp.c + M /trunk/tests/tset_f.c + M /trunk/tests/tset_ld.c + M /trunk/tests/tset_q.c + M /trunk/tests/tset_si.c + M /trunk/tests/tset_sj.c + M /trunk/tests/tset_str.c + M /trunk/tests/tset_z.c + M /trunk/tests/tset_z_exp.c + M /trunk/tests/tsgn.c + M /trunk/tests/tsi_op.c + M /trunk/tests/tsin.c + M /trunk/tests/tsin_cos.c + M /trunk/tests/tsinh.c + M /trunk/tests/tsinh_cosh.c + M /trunk/tests/tsprintf.c + M /trunk/tests/tsqr.c + M /trunk/tests/tsqrt.c + M /trunk/tests/tsqrt_ui.c + M /trunk/tests/tstckintc.c + M /trunk/tests/tstdint.c + M /trunk/tests/tstrtofr.c + M /trunk/tests/tsub.c + M /trunk/tests/tsub1sp.c + M /trunk/tests/tsub_d.c + M /trunk/tests/tsub_ui.c + M /trunk/tests/tsubnormal.c + M /trunk/tests/tsum.c + M /trunk/tests/tswap.c + M /trunk/tests/ttan.c + M /trunk/tests/ttanh.c + M /trunk/tests/ttrunc.c + M /trunk/tests/tui_div.c + M /trunk/tests/tui_pow.c + M /trunk/tests/tui_sub.c + M /trunk/tests/turandom.c + M /trunk/tests/tvalist.c + M /trunk/tests/tversion.c + M /trunk/tests/ty0.c + M /trunk/tests/ty1.c + M /trunk/tests/tyn.c + M /trunk/tests/tzeta.c + M /trunk/tests/tzeta_ui.c + M /trunk/tools/ck-copyright-notice + M /trunk/tools/ck-mparam + M /trunk/tools/ck-version-info + M /trunk/tools/get_patches.sh + M /trunk/tune/Makefile.am + M /trunk/tune/bidimensional_sample.c + M /trunk/tune/speed.c + M /trunk/tune/tuneup.c -[src/lngamma.c] Added mpfr_explgamma internal function to handle - overflows/underflows (intermediate or not) in mpfr_gamma. Added - general overflow detection. -[src/gamma.c] Added general underflow detection. -[tests/tgamma.c] Added testcases for 32-bit and 64-bit machines. -(merged changesets r8174,8179,8182-8183,8185-8189,8191-8199 from the trunk) +Copyright notice update: added 2012 with + perl -pi -e 's/2011 Free Software/2011, 2012 Free Software/' **/*(^/) +under zsh, reverting the ChangeLog file (the m4 and tools/mbench +directories were not modified). +Removed 2011 from the example in the doc/README.dev file. ------------------------------------------------------------------------ -r8184 | vlefevre | 2012-05-03 14:44:57 +0000 (Thu, 03 May 2012) | 1 line +r7979 | zimmerma | 2011-12-09 12:17:34 +0000 (Fri, 09 Dec 2011) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/gamma.c + M /trunk/TODO -[src/gamma.c] Reverted changeset r8180, which seems incorrect. ------------------------------------------------------------------------- -r8180 | vlefevre | 2012-05-03 13:46:22 +0000 (Thu, 03 May 2012) | 2 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/src/gamma.c +[TODO] trivial change (to test the commit logs) -[gamma.c] tentative fix for the underflow problem -(merged changesets r8174,8179 from the trunk) ------------------------------------------------------------------------ -r8178 | vlefevre | 2012-05-03 13:26:40 +0000 (Thu, 03 May 2012) | 1 line +r7978 | vlefevre | 2011-12-09 11:50:07 +0000 (Fri, 09 Dec 2011) | 1 line Changed paths: - M /branches/3.1/ChangeLog + M /trunk/configure.ac -ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). +[configure.ac] Mention --disable-thread-safe. ------------------------------------------------------------------------ -r8176 | vlefevre | 2012-05-03 13:08:51 +0000 (Thu, 03 May 2012) | 2 lines +r7977 | vlefevre | 2011-12-09 11:38:56 +0000 (Fri, 09 Dec 2011) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/TODO - M /branches/3.1/doc/README.dev - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/subnormal.c - M /branches/3.1/tests/Makefile.am - M /branches/3.1/tests/tatan.c - M /branches/3.1/tests/tsin_cos.c - M /branches/3.1/tests/tsqr.c + M /trunk/INSTALL -Merged changesets r8172-8173,8175 from the trunk to update URL's of -mailing-list archives/messages. +[INSTALL] Added information about system/compiler bugs related to TLS +or optimizations. ------------------------------------------------------------------------ -r8165 | vlefevre | 2012-04-27 12:39:54 +0000 (Fri, 27 Apr 2012) | 2 lines +r7976 | zimmerma | 2011-12-09 10:57:12 +0000 (Fri, 09 Dec 2011) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tgamma.c + M /trunk/INSTALL + +[INSTALL] added note about buggy TLS support -[tests/tgamma.c] Improved testcase test20100709. -(merged changeset r8164 from the trunk) ------------------------------------------------------------------------ -r8163 | vlefevre | 2012-04-27 12:29:02 +0000 (Fri, 27 Apr 2012) | 3 lines +r7971 | vlefevre | 2011-11-28 12:19:33 +0000 (Mon, 28 Nov 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tgamma.c + M /trunk/tests/turandom.c -[tests/tgamma.c] Updated testcase test20100709 for 64-bit machines, -as this bug reappeared in r8160 (r8159 from the trunk). -(merged changeset r8162 from the trunk) +[tests/turandom.c] Removed an obsolete comment. ------------------------------------------------------------------------ -r8160 | vlefevre | 2012-04-27 01:08:44 +0000 (Fri, 27 Apr 2012) | 5 lines +r7970 | vlefevre | 2011-11-28 11:43:39 +0000 (Mon, 28 Nov 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/gamma.c - M /branches/3.1/tests/tgamma.c + M /trunk/src/mpfr-gmp.h -[src/gamma.c] Fixed bug in the underflow detection code of mpfr_gamma, - found by Giridhar Tammana: some results may incorrectly be regarded - as underflow. -[tests/tgamma.c] Added testcase. -(merged changeset r8159 from the trunk) +[src/mpfr-gmp.h] Updated the TODO comment about the rand state. ------------------------------------------------------------------------ -r8127 | vlefevre | 2012-03-26 12:25:58 +0000 (Mon, 26 Mar 2012) | 3 lines +r7967 | vlefevre | 2011-11-28 11:22:21 +0000 (Mon, 28 Nov 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tests/Makefile.am - M /branches/3.1/tests/tests.c + M /trunk/doc/mpfr.texi -[tests/{Makefile.am,tests.c}] Fixed src_fopen to be able to run test -programs directly (without "make check") when objdir != srcdir. -(merged changesets r8122,8126 from the trunk) +[doc/mpfr.texi] Updated the month. ------------------------------------------------------------------------ -r8084 | vlefevre | 2012-03-09 12:03:59 +0000 (Fri, 09 Mar 2012) | 4 lines +r7966 | vlefevre | 2011-11-28 10:10:09 +0000 (Mon, 28 Nov 2011) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/mpfr-impl.h + M /trunk/tests/trandom.c + M /trunk/tests/turandom.c -[src/mpfr-impl.h] Improved macros from the changeset r8080, in -particular to avoid an error with the --enable-assert configure -option and the -ansi -pedantic-errors gcc compiler flags. -(merged changesets r7910,8082,8083 from the trunk) +[tests/trandom.c,tests/turandom.c] Fixed compatibility with GMP 4.1.x +(since the default PRNG has changed between GMP 4.1 and 4.2). ------------------------------------------------------------------------ -r8080 | vlefevre | 2012-03-08 14:11:02 +0000 (Thu, 08 Mar 2012) | 8 lines +r7965 | vlefevre | 2011-11-28 09:45:47 +0000 (Mon, 28 Nov 2011) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/add1.c - M /branches/3.1/src/add1sp.c - M /branches/3.1/src/agm.c - M /branches/3.1/src/eq.c - M /branches/3.1/src/exp.c - M /branches/3.1/src/get_d.c - M /branches/3.1/src/get_flt.c - M /branches/3.1/src/get_str.c - M /branches/3.1/src/init2.c - M /branches/3.1/src/lngamma.c - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/src/mul.c - M /branches/3.1/src/pow.c - M /branches/3.1/src/print_raw.c - M /branches/3.1/src/round_prec.c - M /branches/3.1/src/round_raw_generic.c - M /branches/3.1/src/set.c - M /branches/3.1/src/set_f.c - M /branches/3.1/src/set_prec.c - M /branches/3.1/src/setmax.c - M /branches/3.1/src/sqr.c - M /branches/3.1/src/stack_interface.c - M /branches/3.1/src/strtofr.c - M /branches/3.1/src/sub1sp.c - M /branches/3.1/src/urandomb.c - M /branches/3.1/tests/tinits.c + M /trunk/doc/mpfr.texi -Avoid potential integer overflows and improve consistency. This should -fix bug #13918 "Segfault with precision = MPFR_PREC_MAX on 32-bit". -Note: this problem appeared in MPFR 3.0.0 when the precision type (now -mpfr_prec_t) was changed to a signed integer. -Added a large precision test in tests/tinits.c (enabled by setting -MPFR_CHECK_LARGEMEM=1) to trigger the bug mentioned above on 32-bit -machines (or when MPFR is built with -m32). -(merged changesets r8025,8026,8029,8031,8077 from the trunk) +[doc/mpfr.texi] Mentioned the difference between GMP 4.1 and 4.2 about +the changes of mpfr_urandom and mpfr_urandomb in MPFR 3.1. ------------------------------------------------------------------------ -r8069 | vlefevre | 2012-03-07 15:02:17 +0000 (Wed, 07 Mar 2012) | 5 lines +r7964 | vlefevre | 2011-11-28 09:41:09 +0000 (Mon, 28 Nov 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/mpfr.h + M /trunk/src/mpfr-gmp.h -[src/mpfr.h] Simple temporary fix following GMP's internal __gmp_const -macro removal in (and its -replacement by const): if __gmp_const isn't define, let's define it to -const. -(merged changeset r8061 from the trunk) +[src/mpfr-gmp.h] Added a TODO comment. ------------------------------------------------------------------------ -r8059 | vlefevre | 2012-03-03 03:00:29 +0000 (Sat, 03 Mar 2012) | 2 lines +r7962 | zimmerma | 2011-11-24 14:12:42 +0000 (Thu, 24 Nov 2011) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/NEWS + M /trunk/TODO + +revert previous commit (test) -[NEWS] Mention the mpfr_exp bug fix (from r6964 in exp_2.c). -(merged changeset r8058 from the trunk) ------------------------------------------------------------------------ -r8049 | vlefevre | 2012-02-24 13:45:11 +0000 (Fri, 24 Feb 2012) | 2 lines +r7961 | zimmerma | 2011-11-24 14:11:59 +0000 (Thu, 24 Nov 2011) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/mpfr-impl.h + M /trunk/TODO + +commit test -[src/mpfr-impl.h] Use %.*Rg instead of %.*Rf for MPFR_LOG_VAR. -(merged changeset r8048 from the trunk) ------------------------------------------------------------------------ -r8047 | vlefevre | 2012-02-24 12:38:46 +0000 (Fri, 24 Feb 2012) | 6 lines +r7954 | zimmerma | 2011-11-09 20:03:45 +0000 (Wed, 09 Nov 2011) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/add_d.c - M /branches/3.1/src/add_ui.c - M /branches/3.1/src/mul_d.c + M /trunk/src/mpfr-thread.h + +[src/mpfr-thread.h] added pointer to TLS on Windows -Corrected a typo in MPFR_LOG_FUNC of add_d.c, add_ui.c and mul_d.c -(mpfr_get_prec → mpfr_log_prec), fixing bug 13933. -The consequence was random freezes (on the same binary) with dynamic -linking (and just more memory with static linking to the MPFR library) -when logging was used. -(merged changeset r8043 from the trunk) ------------------------------------------------------------------------ -r8045 | vlefevre | 2012-02-24 12:22:24 +0000 (Fri, 24 Feb 2012) | 2 lines +r7952 | vlefevre | 2011-11-09 12:28:59 +0000 (Wed, 09 Nov 2011) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/NEWS + M /trunk/tests/tsprintf.c -[NEWS] Mention an internal change in MPFR 3.1.0. -(merged changeset r8044 from the trunk) +[tests/tsprintf.c] Added a test showing a regression in MPFR 3.1.0 +(but fixed in r7931 and later). ------------------------------------------------------------------------ -r8017 | vlefevre | 2012-01-27 08:36:16 +0000 (Fri, 27 Jan 2012) | 2 lines +r7951 | zimmerma | 2011-11-09 12:20:10 +0000 (Wed, 09 Nov 2011) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/mparam_h.in - M /branches/3.1/src/x86_64/core2/mparam.h + M /trunk/tests/tatan.c + +[tests/tatan.c] mpfr_set_emin -> set_emin (idem for emax) -Use the core2 tuning parameters for nocona as timings are very similar. -[Merged r8013 through r8016 from the trunk] ------------------------------------------------------------------------ -r8012 | vlefevre | 2012-01-23 01:28:48 +0000 (Mon, 23 Jan 2012) | 3 lines +r7950 | vlefevre | 2011-11-09 10:17:11 +0000 (Wed, 09 Nov 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/mparam_h.in + M /trunk/TODO -[mparam_h.in] swap tests for 32-bit and 64-bit powerpc, since on powerpc64 - the parameters for 32-bit are used! -(merged changeset r8010 from the trunk) +[TODO] Added a reference to an old discussion concerning __float128. ------------------------------------------------------------------------ -r7999 | vlefevre | 2012-01-10 12:51:46 +0000 (Tue, 10 Jan 2012) | 1 line +r7949 | zimmerma | 2011-11-08 15:42:41 +0000 (Tue, 08 Nov 2011) | 2 lines Changed paths: - M /branches/3.1/doc/mpfr.texi + M /trunk/TODO + +[TODO] added item -[doc/mpfr.texi] Updated the month. ------------------------------------------------------------------------ -r7997 | vlefevre | 2012-01-10 12:49:58 +0000 (Tue, 10 Jan 2012) | 1 line +r7944 | vlefevre | 2011-11-03 16:09:54 +0000 (Thu, 03 Nov 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi + M /trunk/src/vasprintf.c -[doc/mpfr.texi] Mention the AriC project-team. +[src/vasprintf.c] Untabify. ------------------------------------------------------------------------ -r7995 | vlefevre | 2012-01-10 12:47:05 +0000 (Tue, 10 Jan 2012) | 3 lines +r7943 | thevenyp | 2011-11-03 14:53:08 +0000 (Thu, 03 Nov 2011) | 1 line Changed paths: - M /branches/3.1/BUGS - M /branches/3.1/INSTALL - M /branches/3.1/NEWS - M /branches/3.1/README - M /branches/3.1/TODO - M /branches/3.1/acinclude.m4 - M /branches/3.1/configure.ac - M /branches/3.1/doc/FAQ.html - M /branches/3.1/doc/README.dev - M /branches/3.1/doc/faq.xsl - M /branches/3.1/examples/divworst.c - M /branches/3.1/examples/rndo-add.c - M /branches/3.1/examples/sample.c - M /branches/3.1/examples/version.c - M /branches/3.1/src/abort_prec_max.c - M /branches/3.1/src/acos.c - M /branches/3.1/src/acosh.c - M /branches/3.1/src/add.c - M /branches/3.1/src/add1.c - M /branches/3.1/src/add1sp.c - M /branches/3.1/src/add_d.c - M /branches/3.1/src/add_ui.c - M /branches/3.1/src/agm.c - M /branches/3.1/src/ai.c - M /branches/3.1/src/asin.c - M /branches/3.1/src/asinh.c - M /branches/3.1/src/atan.c - M /branches/3.1/src/atan2.c - M /branches/3.1/src/atanh.c - M /branches/3.1/src/bernoulli.c - M /branches/3.1/src/buildopt.c - M /branches/3.1/src/cache.c - M /branches/3.1/src/cbrt.c - M /branches/3.1/src/check.c - M /branches/3.1/src/clear.c - M /branches/3.1/src/clears.c - M /branches/3.1/src/cmp.c - M /branches/3.1/src/cmp2.c - M /branches/3.1/src/cmp_abs.c - M /branches/3.1/src/cmp_d.c - M /branches/3.1/src/cmp_ld.c - M /branches/3.1/src/cmp_si.c - M /branches/3.1/src/cmp_ui.c - M /branches/3.1/src/comparisons.c - M /branches/3.1/src/const_catalan.c - M /branches/3.1/src/const_euler.c - M /branches/3.1/src/const_log2.c - M /branches/3.1/src/const_pi.c - M /branches/3.1/src/constant.c - M /branches/3.1/src/copysign.c - M /branches/3.1/src/cos.c - M /branches/3.1/src/cosh.c - M /branches/3.1/src/cot.c - M /branches/3.1/src/coth.c - M /branches/3.1/src/csc.c - M /branches/3.1/src/csch.c - M /branches/3.1/src/d_div.c - M /branches/3.1/src/d_sub.c - M /branches/3.1/src/digamma.c - M /branches/3.1/src/dim.c - M /branches/3.1/src/div.c - M /branches/3.1/src/div_2exp.c - M /branches/3.1/src/div_2si.c - M /branches/3.1/src/div_2ui.c - M /branches/3.1/src/div_d.c - M /branches/3.1/src/div_ui.c - M /branches/3.1/src/dump.c - M /branches/3.1/src/eint.c - M /branches/3.1/src/eq.c - M /branches/3.1/src/erf.c - M /branches/3.1/src/erfc.c - M /branches/3.1/src/exceptions.c - M /branches/3.1/src/exp.c - M /branches/3.1/src/exp10.c - M /branches/3.1/src/exp2.c - M /branches/3.1/src/exp3.c - M /branches/3.1/src/exp_2.c - M /branches/3.1/src/expm1.c - M /branches/3.1/src/extract.c - M /branches/3.1/src/factorial.c - M /branches/3.1/src/fits_intmax.c - M /branches/3.1/src/fits_s.h - M /branches/3.1/src/fits_sint.c - M /branches/3.1/src/fits_slong.c - M /branches/3.1/src/fits_sshort.c - M /branches/3.1/src/fits_u.h - M /branches/3.1/src/fits_uint.c - M /branches/3.1/src/fits_uintmax.c - M /branches/3.1/src/fits_ulong.c - M /branches/3.1/src/fits_ushort.c - M /branches/3.1/src/fma.c - M /branches/3.1/src/fms.c - M /branches/3.1/src/frac.c - M /branches/3.1/src/free_cache.c - M /branches/3.1/src/frexp.c - M /branches/3.1/src/gamma.c - M /branches/3.1/src/gammaonethird.c - M /branches/3.1/src/gen_inverse.h - M /branches/3.1/src/get_d.c - M /branches/3.1/src/get_d64.c - M /branches/3.1/src/get_exp.c - M /branches/3.1/src/get_f.c - M /branches/3.1/src/get_flt.c - M /branches/3.1/src/get_ld.c - M /branches/3.1/src/get_si.c - M /branches/3.1/src/get_sj.c - M /branches/3.1/src/get_str.c - M /branches/3.1/src/get_ui.c - M /branches/3.1/src/get_uj.c - M /branches/3.1/src/get_z.c - M /branches/3.1/src/get_z_exp.c - M /branches/3.1/src/gmp_op.c - M /branches/3.1/src/grandom.c - M /branches/3.1/src/hypot.c - M /branches/3.1/src/ieee_floats.h - M /branches/3.1/src/init.c - M /branches/3.1/src/init2.c - M /branches/3.1/src/inits.c - M /branches/3.1/src/inits2.c - M /branches/3.1/src/inp_str.c - M /branches/3.1/src/int_ceil_log2.c - M /branches/3.1/src/isinf.c - M /branches/3.1/src/isinteger.c - M /branches/3.1/src/isnan.c - M /branches/3.1/src/isnum.c - M /branches/3.1/src/isqrt.c - M /branches/3.1/src/isregular.c - M /branches/3.1/src/iszero.c - M /branches/3.1/src/jn.c - M /branches/3.1/src/jyn_asympt.c - M /branches/3.1/src/li2.c - M /branches/3.1/src/lngamma.c - M /branches/3.1/src/log.c - M /branches/3.1/src/log10.c - M /branches/3.1/src/log1p.c - M /branches/3.1/src/log2.c - M /branches/3.1/src/logging.c - M /branches/3.1/src/min_prec.c - M /branches/3.1/src/minmax.c - M /branches/3.1/src/modf.c - M /branches/3.1/src/mpf2mpfr.h - M /branches/3.1/src/mpfr-gmp.c - M /branches/3.1/src/mpfr-gmp.h - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/src/mpfr-intmax.h - M /branches/3.1/src/mpfr-thread.h - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/mpn_exp.c - M /branches/3.1/src/mul.c - M /branches/3.1/src/mul_2exp.c - M /branches/3.1/src/mul_2si.c - M /branches/3.1/src/mul_2ui.c - M /branches/3.1/src/mul_d.c - M /branches/3.1/src/mul_ui.c - M /branches/3.1/src/mulders.c - M /branches/3.1/src/neg.c - M /branches/3.1/src/next.c - M /branches/3.1/src/out_raw.c - M /branches/3.1/src/out_str.c - M /branches/3.1/src/pow.c - M /branches/3.1/src/pow_si.c - M /branches/3.1/src/pow_ui.c - M /branches/3.1/src/pow_z.c - M /branches/3.1/src/powerof2.c - M /branches/3.1/src/print_raw.c - M /branches/3.1/src/print_rnd_mode.c - M /branches/3.1/src/printf.c - M /branches/3.1/src/rec_sqrt.c - M /branches/3.1/src/reldiff.c - M /branches/3.1/src/rem1.c - M /branches/3.1/src/rint.c - M /branches/3.1/src/root.c - M /branches/3.1/src/round_near_x.c - M /branches/3.1/src/round_p.c - M /branches/3.1/src/round_prec.c - M /branches/3.1/src/round_raw_generic.c - M /branches/3.1/src/scale2.c - M /branches/3.1/src/sec.c - M /branches/3.1/src/sech.c - M /branches/3.1/src/set.c - M /branches/3.1/src/set_d.c - M /branches/3.1/src/set_d64.c - M /branches/3.1/src/set_dfl_prec.c - M /branches/3.1/src/set_exp.c - M /branches/3.1/src/set_f.c - M /branches/3.1/src/set_flt.c - M /branches/3.1/src/set_inf.c - M /branches/3.1/src/set_ld.c - M /branches/3.1/src/set_nan.c - M /branches/3.1/src/set_prc_raw.c - M /branches/3.1/src/set_prec.c - M /branches/3.1/src/set_q.c - M /branches/3.1/src/set_rnd.c - M /branches/3.1/src/set_si.c - M /branches/3.1/src/set_si_2exp.c - M /branches/3.1/src/set_sj.c - M /branches/3.1/src/set_str.c - M /branches/3.1/src/set_str_raw.c - M /branches/3.1/src/set_ui.c - M /branches/3.1/src/set_ui_2exp.c - M /branches/3.1/src/set_uj.c - M /branches/3.1/src/set_z.c - M /branches/3.1/src/set_z_exp.c - M /branches/3.1/src/set_zero.c - M /branches/3.1/src/setmax.c - M /branches/3.1/src/setmin.c - M /branches/3.1/src/setsign.c - M /branches/3.1/src/sgn.c - M /branches/3.1/src/si_op.c - M /branches/3.1/src/signbit.c - M /branches/3.1/src/sin.c - M /branches/3.1/src/sin_cos.c - M /branches/3.1/src/sinh.c - M /branches/3.1/src/sinh_cosh.c - M /branches/3.1/src/sqr.c - M /branches/3.1/src/sqrt.c - M /branches/3.1/src/sqrt_ui.c - M /branches/3.1/src/stack_interface.c - M /branches/3.1/src/strtofr.c - M /branches/3.1/src/sub.c - M /branches/3.1/src/sub1.c - M /branches/3.1/src/sub1sp.c - M /branches/3.1/src/sub_d.c - M /branches/3.1/src/sub_ui.c - M /branches/3.1/src/subnormal.c - M /branches/3.1/src/sum.c - M /branches/3.1/src/swap.c - M /branches/3.1/src/tan.c - M /branches/3.1/src/tanh.c - M /branches/3.1/src/uceil_exp2.c - M /branches/3.1/src/uceil_log2.c - M /branches/3.1/src/ufloor_log2.c - M /branches/3.1/src/ui_div.c - M /branches/3.1/src/ui_pow.c - M /branches/3.1/src/ui_pow_ui.c - M /branches/3.1/src/ui_sub.c - M /branches/3.1/src/urandom.c - M /branches/3.1/src/urandomb.c - M /branches/3.1/src/vasprintf.c - M /branches/3.1/src/version.c - M /branches/3.1/src/volatile.c - M /branches/3.1/src/yn.c - M /branches/3.1/src/zeta.c - M /branches/3.1/src/zeta_ui.c - M /branches/3.1/tests/cmp_str.c - M /branches/3.1/tests/data/digamma - M /branches/3.1/tests/data/li2 - M /branches/3.1/tests/memory.c - M /branches/3.1/tests/mpf_compat.c - M /branches/3.1/tests/mpf_compat.h - M /branches/3.1/tests/mpfr-test.h - M /branches/3.1/tests/mpfr_compat.c - M /branches/3.1/tests/random2.c - M /branches/3.1/tests/reuse.c - M /branches/3.1/tests/rnd_mode.c - M /branches/3.1/tests/tabs.c - M /branches/3.1/tests/tacos.c - M /branches/3.1/tests/tacosh.c - M /branches/3.1/tests/tadd.c - M /branches/3.1/tests/tadd1sp.c - M /branches/3.1/tests/tadd_d.c - M /branches/3.1/tests/tadd_ui.c - M /branches/3.1/tests/tagm.c - M /branches/3.1/tests/tai.c - M /branches/3.1/tests/tasin.c - M /branches/3.1/tests/tasinh.c - M /branches/3.1/tests/tatan.c - M /branches/3.1/tests/tatanh.c - M /branches/3.1/tests/taway.c - M /branches/3.1/tests/tbuildopt.c - M /branches/3.1/tests/tcan_round.c - M /branches/3.1/tests/tcbrt.c - M /branches/3.1/tests/tcheck.c - M /branches/3.1/tests/tcmp.c - M /branches/3.1/tests/tcmp2.c - M /branches/3.1/tests/tcmp_d.c - M /branches/3.1/tests/tcmp_ld.c - M /branches/3.1/tests/tcmp_ui.c - M /branches/3.1/tests/tcmpabs.c - M /branches/3.1/tests/tcomparisons.c - M /branches/3.1/tests/tconst_catalan.c - M /branches/3.1/tests/tconst_euler.c - M /branches/3.1/tests/tconst_log2.c - M /branches/3.1/tests/tconst_pi.c - M /branches/3.1/tests/tcopysign.c - M /branches/3.1/tests/tcos.c - M /branches/3.1/tests/tcosh.c - M /branches/3.1/tests/tcot.c - M /branches/3.1/tests/tcoth.c - M /branches/3.1/tests/tcsc.c - M /branches/3.1/tests/tcsch.c - M /branches/3.1/tests/td_div.c - M /branches/3.1/tests/td_sub.c - M /branches/3.1/tests/tdigamma.c - M /branches/3.1/tests/tdim.c - M /branches/3.1/tests/tdiv.c - M /branches/3.1/tests/tdiv_d.c - M /branches/3.1/tests/tdiv_ui.c - M /branches/3.1/tests/teint.c - M /branches/3.1/tests/teq.c - M /branches/3.1/tests/terf.c - M /branches/3.1/tests/tests.c - M /branches/3.1/tests/texceptions.c - M /branches/3.1/tests/texp.c - M /branches/3.1/tests/texp10.c - M /branches/3.1/tests/texp2.c - M /branches/3.1/tests/texpm1.c - M /branches/3.1/tests/tfactorial.c - M /branches/3.1/tests/tfits.c - M /branches/3.1/tests/tfma.c - M /branches/3.1/tests/tfmod.c - M /branches/3.1/tests/tfms.c - M /branches/3.1/tests/tfprintf.c - M /branches/3.1/tests/tfrac.c - M /branches/3.1/tests/tfrexp.c - M /branches/3.1/tests/tgamma.c - M /branches/3.1/tests/tgeneric.c - M /branches/3.1/tests/tgeneric_ui.c - M /branches/3.1/tests/tget_d.c - M /branches/3.1/tests/tget_d_2exp.c - M /branches/3.1/tests/tget_f.c - M /branches/3.1/tests/tget_flt.c - M /branches/3.1/tests/tget_ld_2exp.c - M /branches/3.1/tests/tget_set_d64.c - M /branches/3.1/tests/tget_sj.c - M /branches/3.1/tests/tget_str.c - M /branches/3.1/tests/tget_z.c - M /branches/3.1/tests/tgmpop.c - M /branches/3.1/tests/tgrandom.c - M /branches/3.1/tests/thyperbolic.c - M /branches/3.1/tests/thypot.c - M /branches/3.1/tests/tinits.c - M /branches/3.1/tests/tinp_str.c - M /branches/3.1/tests/tinternals.c - M /branches/3.1/tests/tisnan.c - M /branches/3.1/tests/tisqrt.c - M /branches/3.1/tests/tj0.c - M /branches/3.1/tests/tj1.c - M /branches/3.1/tests/tjn.c - M /branches/3.1/tests/tl2b.c - M /branches/3.1/tests/tlgamma.c - M /branches/3.1/tests/tli2.c - M /branches/3.1/tests/tlngamma.c - M /branches/3.1/tests/tlog.c - M /branches/3.1/tests/tlog10.c - M /branches/3.1/tests/tlog1p.c - M /branches/3.1/tests/tlog2.c - M /branches/3.1/tests/tmin_prec.c - M /branches/3.1/tests/tminmax.c - M /branches/3.1/tests/tmodf.c - M /branches/3.1/tests/tmul.c - M /branches/3.1/tests/tmul_2exp.c - M /branches/3.1/tests/tmul_d.c - M /branches/3.1/tests/tmul_ui.c - M /branches/3.1/tests/tnext.c - M /branches/3.1/tests/tout_str.c - M /branches/3.1/tests/toutimpl.c - M /branches/3.1/tests/tpow.c - M /branches/3.1/tests/tpow3.c - M /branches/3.1/tests/tpow_all.c - M /branches/3.1/tests/tpow_z.c - M /branches/3.1/tests/tprintf.c - M /branches/3.1/tests/trandom.c - M /branches/3.1/tests/trec_sqrt.c - M /branches/3.1/tests/tremquo.c - M /branches/3.1/tests/trint.c - M /branches/3.1/tests/troot.c - M /branches/3.1/tests/tround_prec.c - M /branches/3.1/tests/tsec.c - M /branches/3.1/tests/tsech.c - M /branches/3.1/tests/tset.c - M /branches/3.1/tests/tset_d.c - M /branches/3.1/tests/tset_exp.c - M /branches/3.1/tests/tset_f.c - M /branches/3.1/tests/tset_ld.c - M /branches/3.1/tests/tset_q.c - M /branches/3.1/tests/tset_si.c - M /branches/3.1/tests/tset_sj.c - M /branches/3.1/tests/tset_str.c - M /branches/3.1/tests/tset_z.c - M /branches/3.1/tests/tset_z_exp.c - M /branches/3.1/tests/tsgn.c - M /branches/3.1/tests/tsi_op.c - M /branches/3.1/tests/tsin.c - M /branches/3.1/tests/tsin_cos.c - M /branches/3.1/tests/tsinh.c - M /branches/3.1/tests/tsinh_cosh.c - M /branches/3.1/tests/tsprintf.c - M /branches/3.1/tests/tsqr.c - M /branches/3.1/tests/tsqrt.c - M /branches/3.1/tests/tsqrt_ui.c - M /branches/3.1/tests/tstckintc.c - M /branches/3.1/tests/tstdint.c - M /branches/3.1/tests/tstrtofr.c - M /branches/3.1/tests/tsub.c - M /branches/3.1/tests/tsub1sp.c - M /branches/3.1/tests/tsub_d.c - M /branches/3.1/tests/tsub_ui.c - M /branches/3.1/tests/tsubnormal.c - M /branches/3.1/tests/tsum.c - M /branches/3.1/tests/tswap.c - M /branches/3.1/tests/ttan.c - M /branches/3.1/tests/ttanh.c - M /branches/3.1/tests/ttrunc.c - M /branches/3.1/tests/tui_div.c - M /branches/3.1/tests/tui_pow.c - M /branches/3.1/tests/tui_sub.c - M /branches/3.1/tests/turandom.c - M /branches/3.1/tests/tvalist.c - M /branches/3.1/tests/tversion.c - M /branches/3.1/tests/ty0.c - M /branches/3.1/tests/ty1.c - M /branches/3.1/tests/tyn.c - M /branches/3.1/tests/tzeta.c - M /branches/3.1/tests/tzeta_ui.c - M /branches/3.1/tools/get_patches.sh - M /branches/3.1/tune/bidimensional_sample.c - M /branches/3.1/tune/speed.c - M /branches/3.1/tune/tuneup.c + M /trunk/src/vasprintf.c -Changed Arenaire to AriC with: - perl -pi -e 's/Contributed by the Arenaire/Contributed by the AriC/' **/*(^/) -under zsh, reverting the ChangeLog file. +[src/vasprintf.c] Corrected a comment. ------------------------------------------------------------------------ -r7992 | vlefevre | 2012-01-10 12:30:53 +0000 (Tue, 10 Jan 2012) | 2 lines +r7941 | vlefevre | 2011-11-03 14:49:07 +0000 (Thu, 03 Nov 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/doc/FAQ.html - M /branches/3.1/doc/faq.xsl + M /trunk/tests/tsprintf.c -[doc] In faq.xsl, remove only the top-level comments from the HTML file. -Updated FAQ.html with update-faq. +[tests/tsprintf.c] Coding style. ------------------------------------------------------------------------ -r7987 | vlefevre | 2012-01-10 11:54:24 +0000 (Tue, 10 Jan 2012) | 5 lines +r7938 | vlefevre | 2011-11-02 21:11:29 +0000 (Wed, 02 Nov 2011) | 1 line Changed paths: - M /branches/3.1/BUGS - M /branches/3.1/INSTALL - M /branches/3.1/Makefile.am - M /branches/3.1/NEWS - M /branches/3.1/README - M /branches/3.1/TODO - M /branches/3.1/acinclude.m4 - M /branches/3.1/configure.ac - M /branches/3.1/doc/FAQ.html - M /branches/3.1/doc/Makefile.am - M /branches/3.1/doc/README.dev - M /branches/3.1/doc/faq.xsl - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/examples/divworst.c - M /branches/3.1/examples/rndo-add.c - M /branches/3.1/examples/sample.c - M /branches/3.1/examples/version.c - M /branches/3.1/src/Makefile.am - M /branches/3.1/src/abort_prec_max.c - M /branches/3.1/src/acos.c - M /branches/3.1/src/acosh.c - M /branches/3.1/src/add.c - M /branches/3.1/src/add1.c - M /branches/3.1/src/add1sp.c - M /branches/3.1/src/add_d.c - M /branches/3.1/src/add_ui.c - M /branches/3.1/src/agm.c - M /branches/3.1/src/ai.c - M /branches/3.1/src/amd/amdfam10/mparam.h - M /branches/3.1/src/amd/athlon/mparam.h - M /branches/3.1/src/amd/k8/mparam.h - M /branches/3.1/src/arm/mparam.h - M /branches/3.1/src/asin.c - M /branches/3.1/src/asinh.c - M /branches/3.1/src/atan.c - M /branches/3.1/src/atan2.c - M /branches/3.1/src/atanh.c - M /branches/3.1/src/bernoulli.c - M /branches/3.1/src/buildopt.c - M /branches/3.1/src/cache.c - M /branches/3.1/src/cbrt.c - M /branches/3.1/src/check.c - M /branches/3.1/src/clear.c - M /branches/3.1/src/clears.c - M /branches/3.1/src/cmp.c - M /branches/3.1/src/cmp2.c - M /branches/3.1/src/cmp_abs.c - M /branches/3.1/src/cmp_d.c - M /branches/3.1/src/cmp_ld.c - M /branches/3.1/src/cmp_si.c - M /branches/3.1/src/cmp_ui.c - M /branches/3.1/src/comparisons.c - M /branches/3.1/src/const_catalan.c - M /branches/3.1/src/const_euler.c - M /branches/3.1/src/const_log2.c - M /branches/3.1/src/const_pi.c - M /branches/3.1/src/constant.c - M /branches/3.1/src/copysign.c - M /branches/3.1/src/cos.c - M /branches/3.1/src/cosh.c - M /branches/3.1/src/cot.c - M /branches/3.1/src/coth.c - M /branches/3.1/src/csc.c - M /branches/3.1/src/csch.c - M /branches/3.1/src/d_div.c - M /branches/3.1/src/d_sub.c - M /branches/3.1/src/digamma.c - M /branches/3.1/src/dim.c - M /branches/3.1/src/div.c - M /branches/3.1/src/div_2exp.c - M /branches/3.1/src/div_2si.c - M /branches/3.1/src/div_2ui.c - M /branches/3.1/src/div_d.c - M /branches/3.1/src/div_ui.c - M /branches/3.1/src/dump.c - M /branches/3.1/src/eint.c - M /branches/3.1/src/eq.c - M /branches/3.1/src/erf.c - M /branches/3.1/src/erfc.c - M /branches/3.1/src/exceptions.c - M /branches/3.1/src/exp.c - M /branches/3.1/src/exp10.c - M /branches/3.1/src/exp2.c - M /branches/3.1/src/exp3.c - M /branches/3.1/src/exp_2.c - M /branches/3.1/src/expm1.c - M /branches/3.1/src/extract.c - M /branches/3.1/src/factorial.c - M /branches/3.1/src/fits_intmax.c - M /branches/3.1/src/fits_s.h - M /branches/3.1/src/fits_sint.c - M /branches/3.1/src/fits_slong.c - M /branches/3.1/src/fits_sshort.c - M /branches/3.1/src/fits_u.h - M /branches/3.1/src/fits_uint.c - M /branches/3.1/src/fits_uintmax.c - M /branches/3.1/src/fits_ulong.c - M /branches/3.1/src/fits_ushort.c - M /branches/3.1/src/fma.c - M /branches/3.1/src/fms.c - M /branches/3.1/src/frac.c - M /branches/3.1/src/free_cache.c - M /branches/3.1/src/frexp.c - M /branches/3.1/src/gamma.c - M /branches/3.1/src/gammaonethird.c - M /branches/3.1/src/gen_inverse.h - M /branches/3.1/src/generic/mparam.h - M /branches/3.1/src/get_d.c - M /branches/3.1/src/get_d64.c - M /branches/3.1/src/get_exp.c - M /branches/3.1/src/get_f.c - M /branches/3.1/src/get_flt.c - M /branches/3.1/src/get_ld.c - M /branches/3.1/src/get_si.c - M /branches/3.1/src/get_sj.c - M /branches/3.1/src/get_str.c - M /branches/3.1/src/get_ui.c - M /branches/3.1/src/get_uj.c - M /branches/3.1/src/get_z.c - M /branches/3.1/src/get_z_exp.c - M /branches/3.1/src/gmp_op.c - M /branches/3.1/src/grandom.c - M /branches/3.1/src/hppa/mparam.h - M /branches/3.1/src/hypot.c - M /branches/3.1/src/ia64/mparam.h - M /branches/3.1/src/ieee_floats.h - M /branches/3.1/src/init.c - M /branches/3.1/src/init2.c - M /branches/3.1/src/inits.c - M /branches/3.1/src/inits2.c - M /branches/3.1/src/inp_str.c - M /branches/3.1/src/int_ceil_log2.c - M /branches/3.1/src/isinf.c - M /branches/3.1/src/isinteger.c - M /branches/3.1/src/isnan.c - M /branches/3.1/src/isnum.c - M /branches/3.1/src/isqrt.c - M /branches/3.1/src/isregular.c - M /branches/3.1/src/iszero.c - M /branches/3.1/src/jn.c - M /branches/3.1/src/jyn_asympt.c - M /branches/3.1/src/li2.c - M /branches/3.1/src/lngamma.c - M /branches/3.1/src/log.c - M /branches/3.1/src/log10.c - M /branches/3.1/src/log1p.c - M /branches/3.1/src/log2.c - M /branches/3.1/src/logging.c - M /branches/3.1/src/min_prec.c - M /branches/3.1/src/minmax.c - M /branches/3.1/src/modf.c - M /branches/3.1/src/mp_clz_tab.c - M /branches/3.1/src/mparam_h.in - M /branches/3.1/src/mpf2mpfr.h - M /branches/3.1/src/mpfr-gmp.c - M /branches/3.1/src/mpfr-gmp.h - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/src/mpfr-intmax.h - M /branches/3.1/src/mpfr-longlong.h - M /branches/3.1/src/mpfr-thread.h - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/mpn_exp.c - M /branches/3.1/src/mul.c - M /branches/3.1/src/mul_2exp.c - M /branches/3.1/src/mul_2si.c - M /branches/3.1/src/mul_2ui.c - M /branches/3.1/src/mul_d.c - M /branches/3.1/src/mul_ui.c - M /branches/3.1/src/mulders.c - M /branches/3.1/src/neg.c - M /branches/3.1/src/next.c - M /branches/3.1/src/out_raw.c - M /branches/3.1/src/out_str.c - M /branches/3.1/src/pow.c - M /branches/3.1/src/pow_si.c - M /branches/3.1/src/pow_ui.c - M /branches/3.1/src/pow_z.c - M /branches/3.1/src/powerof2.c - M /branches/3.1/src/powerpc32/mparam.h - M /branches/3.1/src/powerpc64/mparam.h - M /branches/3.1/src/print_raw.c - M /branches/3.1/src/print_rnd_mode.c - M /branches/3.1/src/printf.c - M /branches/3.1/src/rec_sqrt.c - M /branches/3.1/src/reldiff.c - M /branches/3.1/src/rem1.c - M /branches/3.1/src/rint.c - M /branches/3.1/src/root.c - M /branches/3.1/src/round_near_x.c - M /branches/3.1/src/round_p.c - M /branches/3.1/src/round_prec.c - M /branches/3.1/src/round_raw_generic.c - M /branches/3.1/src/scale2.c - M /branches/3.1/src/sec.c - M /branches/3.1/src/sech.c - M /branches/3.1/src/set.c - M /branches/3.1/src/set_d.c - M /branches/3.1/src/set_d64.c - M /branches/3.1/src/set_dfl_prec.c - M /branches/3.1/src/set_exp.c - M /branches/3.1/src/set_f.c - M /branches/3.1/src/set_flt.c - M /branches/3.1/src/set_inf.c - M /branches/3.1/src/set_ld.c - M /branches/3.1/src/set_nan.c - M /branches/3.1/src/set_prc_raw.c - M /branches/3.1/src/set_prec.c - M /branches/3.1/src/set_q.c - M /branches/3.1/src/set_rnd.c - M /branches/3.1/src/set_si.c - M /branches/3.1/src/set_si_2exp.c - M /branches/3.1/src/set_sj.c - M /branches/3.1/src/set_str.c - M /branches/3.1/src/set_str_raw.c - M /branches/3.1/src/set_ui.c - M /branches/3.1/src/set_ui_2exp.c - M /branches/3.1/src/set_uj.c - M /branches/3.1/src/set_z.c - M /branches/3.1/src/set_z_exp.c - M /branches/3.1/src/set_zero.c - M /branches/3.1/src/setmax.c - M /branches/3.1/src/setmin.c - M /branches/3.1/src/setsign.c - M /branches/3.1/src/sgn.c - M /branches/3.1/src/si_op.c - M /branches/3.1/src/signbit.c - M /branches/3.1/src/sin.c - M /branches/3.1/src/sin_cos.c - M /branches/3.1/src/sinh.c - M /branches/3.1/src/sinh_cosh.c - M /branches/3.1/src/sparc64/mparam.h - M /branches/3.1/src/sqr.c - M /branches/3.1/src/sqrt.c - M /branches/3.1/src/sqrt_ui.c - M /branches/3.1/src/stack_interface.c - M /branches/3.1/src/strtofr.c - M /branches/3.1/src/sub.c - M /branches/3.1/src/sub1.c - M /branches/3.1/src/sub1sp.c - M /branches/3.1/src/sub_d.c - M /branches/3.1/src/sub_ui.c - M /branches/3.1/src/subnormal.c - M /branches/3.1/src/sum.c - M /branches/3.1/src/swap.c - M /branches/3.1/src/tan.c - M /branches/3.1/src/tanh.c - M /branches/3.1/src/uceil_exp2.c - M /branches/3.1/src/uceil_log2.c - M /branches/3.1/src/ufloor_log2.c - M /branches/3.1/src/ui_div.c - M /branches/3.1/src/ui_pow.c - M /branches/3.1/src/ui_pow_ui.c - M /branches/3.1/src/ui_sub.c - M /branches/3.1/src/urandom.c - M /branches/3.1/src/urandomb.c - M /branches/3.1/src/vasprintf.c - M /branches/3.1/src/version.c - M /branches/3.1/src/volatile.c - M /branches/3.1/src/x86/core2/mparam.h - M /branches/3.1/src/x86/mparam.h - M /branches/3.1/src/x86_64/core2/mparam.h - M /branches/3.1/src/x86_64/pentium4/mparam.h - M /branches/3.1/src/yn.c - M /branches/3.1/src/zeta.c - M /branches/3.1/src/zeta_ui.c - M /branches/3.1/tests/Makefile.am - M /branches/3.1/tests/cmp_str.c - M /branches/3.1/tests/data/digamma - M /branches/3.1/tests/data/li2 - M /branches/3.1/tests/memory.c - M /branches/3.1/tests/mpf_compat.c - M /branches/3.1/tests/mpf_compat.h - M /branches/3.1/tests/mpfr-test.h - M /branches/3.1/tests/mpfr_compat.c - M /branches/3.1/tests/random2.c - M /branches/3.1/tests/reuse.c - M /branches/3.1/tests/rnd_mode.c - M /branches/3.1/tests/tabs.c - M /branches/3.1/tests/tacos.c - M /branches/3.1/tests/tacosh.c - M /branches/3.1/tests/tadd.c - M /branches/3.1/tests/tadd1sp.c - M /branches/3.1/tests/tadd_d.c - M /branches/3.1/tests/tadd_ui.c - M /branches/3.1/tests/tagm.c - M /branches/3.1/tests/tai.c - M /branches/3.1/tests/tasin.c - M /branches/3.1/tests/tasinh.c - M /branches/3.1/tests/tatan.c - M /branches/3.1/tests/tatanh.c - M /branches/3.1/tests/taway.c - M /branches/3.1/tests/tbuildopt.c - M /branches/3.1/tests/tcan_round.c - M /branches/3.1/tests/tcbrt.c - M /branches/3.1/tests/tcheck.c - M /branches/3.1/tests/tcmp.c - M /branches/3.1/tests/tcmp2.c - M /branches/3.1/tests/tcmp_d.c - M /branches/3.1/tests/tcmp_ld.c - M /branches/3.1/tests/tcmp_ui.c - M /branches/3.1/tests/tcmpabs.c - M /branches/3.1/tests/tcomparisons.c - M /branches/3.1/tests/tconst_catalan.c - M /branches/3.1/tests/tconst_euler.c - M /branches/3.1/tests/tconst_log2.c - M /branches/3.1/tests/tconst_pi.c - M /branches/3.1/tests/tcopysign.c - M /branches/3.1/tests/tcos.c - M /branches/3.1/tests/tcosh.c - M /branches/3.1/tests/tcot.c - M /branches/3.1/tests/tcoth.c - M /branches/3.1/tests/tcsc.c - M /branches/3.1/tests/tcsch.c - M /branches/3.1/tests/td_div.c - M /branches/3.1/tests/td_sub.c - M /branches/3.1/tests/tdigamma.c - M /branches/3.1/tests/tdim.c - M /branches/3.1/tests/tdiv.c - M /branches/3.1/tests/tdiv_d.c - M /branches/3.1/tests/tdiv_ui.c - M /branches/3.1/tests/teint.c - M /branches/3.1/tests/teq.c - M /branches/3.1/tests/terf.c - M /branches/3.1/tests/tests.c - M /branches/3.1/tests/texceptions.c - M /branches/3.1/tests/texp.c - M /branches/3.1/tests/texp10.c - M /branches/3.1/tests/texp2.c - M /branches/3.1/tests/texpm1.c - M /branches/3.1/tests/tfactorial.c - M /branches/3.1/tests/tfits.c - M /branches/3.1/tests/tfma.c - M /branches/3.1/tests/tfmod.c - M /branches/3.1/tests/tfms.c - M /branches/3.1/tests/tfprintf.c - M /branches/3.1/tests/tfrac.c - M /branches/3.1/tests/tfrexp.c - M /branches/3.1/tests/tgamma.c - M /branches/3.1/tests/tgeneric.c - M /branches/3.1/tests/tgeneric_ui.c - M /branches/3.1/tests/tget_d.c - M /branches/3.1/tests/tget_d_2exp.c - M /branches/3.1/tests/tget_f.c - M /branches/3.1/tests/tget_flt.c - M /branches/3.1/tests/tget_ld_2exp.c - M /branches/3.1/tests/tget_set_d64.c - M /branches/3.1/tests/tget_sj.c - M /branches/3.1/tests/tget_str.c - M /branches/3.1/tests/tget_z.c - M /branches/3.1/tests/tgmpop.c - M /branches/3.1/tests/tgrandom.c - M /branches/3.1/tests/thyperbolic.c - M /branches/3.1/tests/thypot.c - M /branches/3.1/tests/tinits.c - M /branches/3.1/tests/tinp_str.c - M /branches/3.1/tests/tinternals.c - M /branches/3.1/tests/tisnan.c - M /branches/3.1/tests/tisqrt.c - M /branches/3.1/tests/tj0.c - M /branches/3.1/tests/tj1.c - M /branches/3.1/tests/tjn.c - M /branches/3.1/tests/tl2b.c - M /branches/3.1/tests/tlgamma.c - M /branches/3.1/tests/tli2.c - M /branches/3.1/tests/tlngamma.c - M /branches/3.1/tests/tlog.c - M /branches/3.1/tests/tlog10.c - M /branches/3.1/tests/tlog1p.c - M /branches/3.1/tests/tlog2.c - M /branches/3.1/tests/tmin_prec.c - M /branches/3.1/tests/tminmax.c - M /branches/3.1/tests/tmodf.c - M /branches/3.1/tests/tmul.c - M /branches/3.1/tests/tmul_2exp.c - M /branches/3.1/tests/tmul_d.c - M /branches/3.1/tests/tmul_ui.c - M /branches/3.1/tests/tnext.c - M /branches/3.1/tests/tout_str.c - M /branches/3.1/tests/toutimpl.c - M /branches/3.1/tests/tpow.c - M /branches/3.1/tests/tpow3.c - M /branches/3.1/tests/tpow_all.c - M /branches/3.1/tests/tpow_z.c - M /branches/3.1/tests/tprintf.c - M /branches/3.1/tests/trandom.c - M /branches/3.1/tests/trec_sqrt.c - M /branches/3.1/tests/tremquo.c - M /branches/3.1/tests/trint.c - M /branches/3.1/tests/troot.c - M /branches/3.1/tests/tround_prec.c - M /branches/3.1/tests/tsec.c - M /branches/3.1/tests/tsech.c - M /branches/3.1/tests/tset.c - M /branches/3.1/tests/tset_d.c - M /branches/3.1/tests/tset_exp.c - M /branches/3.1/tests/tset_f.c - M /branches/3.1/tests/tset_ld.c - M /branches/3.1/tests/tset_q.c - M /branches/3.1/tests/tset_si.c - M /branches/3.1/tests/tset_sj.c - M /branches/3.1/tests/tset_str.c - M /branches/3.1/tests/tset_z.c - M /branches/3.1/tests/tset_z_exp.c - M /branches/3.1/tests/tsgn.c - M /branches/3.1/tests/tsi_op.c - M /branches/3.1/tests/tsin.c - M /branches/3.1/tests/tsin_cos.c - M /branches/3.1/tests/tsinh.c - M /branches/3.1/tests/tsinh_cosh.c - M /branches/3.1/tests/tsprintf.c - M /branches/3.1/tests/tsqr.c - M /branches/3.1/tests/tsqrt.c - M /branches/3.1/tests/tsqrt_ui.c - M /branches/3.1/tests/tstckintc.c - M /branches/3.1/tests/tstdint.c - M /branches/3.1/tests/tstrtofr.c - M /branches/3.1/tests/tsub.c - M /branches/3.1/tests/tsub1sp.c - M /branches/3.1/tests/tsub_d.c - M /branches/3.1/tests/tsub_ui.c - M /branches/3.1/tests/tsubnormal.c - M /branches/3.1/tests/tsum.c - M /branches/3.1/tests/tswap.c - M /branches/3.1/tests/ttan.c - M /branches/3.1/tests/ttanh.c - M /branches/3.1/tests/ttrunc.c - M /branches/3.1/tests/tui_div.c - M /branches/3.1/tests/tui_pow.c - M /branches/3.1/tests/tui_sub.c - M /branches/3.1/tests/turandom.c - M /branches/3.1/tests/tvalist.c - M /branches/3.1/tests/tversion.c - M /branches/3.1/tests/ty0.c - M /branches/3.1/tests/ty1.c - M /branches/3.1/tests/tyn.c - M /branches/3.1/tests/tzeta.c - M /branches/3.1/tests/tzeta_ui.c - M /branches/3.1/tools/ck-copyright-notice - M /branches/3.1/tools/ck-mparam - M /branches/3.1/tools/ck-version-info - M /branches/3.1/tools/get_patches.sh - M /branches/3.1/tune/Makefile.am - M /branches/3.1/tune/bidimensional_sample.c - M /branches/3.1/tune/speed.c - M /branches/3.1/tune/tuneup.c + M /trunk/src/strtofr.c -Copyright notice update: added 2012 with - perl -pi -e 's/2011 Free Software/2011, 2012 Free Software/' **/*(^/) -under zsh, reverting the ChangeLog file (the m4 and tools/mbench -directories were not modified). -Removed 2011 from the example in the doc/README.dev file. +[src/strtofr.c] Spelling. ------------------------------------------------------------------------ -r7980 | vlefevre | 2011-12-09 13:43:03 +0000 (Fri, 09 Dec 2011) | 4 lines +r7937 | vlefevre | 2011-11-02 21:10:43 +0000 (Wed, 02 Nov 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/INSTALL - M /branches/3.1/configure.ac + M /trunk/src/vasprintf.c -Merged changesets r7976-7978 from the trunk: -[INSTALL] Added information about system/compiler bugs related to TLS - or optimizations. -[configure.ac] Mention --disable-thread-safe. +[src/vasprintf.c] Spelling. ------------------------------------------------------------------------ -r7972 | vlefevre | 2011-11-28 12:20:46 +0000 (Mon, 28 Nov 2011) | 1 line +r7936 | vlefevre | 2011-11-02 21:03:46 +0000 (Wed, 02 Nov 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/tests/turandom.c + M /trunk/src/vasprintf.c -[tests/turandom.c] Removed an obsolete comment. +[src/vasprintf.c] Corrected a comment. ------------------------------------------------------------------------ -r7969 | vlefevre | 2011-11-28 11:36:10 +0000 (Mon, 28 Nov 2011) | 1 line +r7935 | vlefevre | 2011-11-02 21:02:52 +0000 (Wed, 02 Nov 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi + M /trunk/tests/tsprintf.c -[doc/mpfr.texi] Updated the month. +[tests/tsprintf.c] Added tests. ------------------------------------------------------------------------ -r7968 | vlefevre | 2011-11-28 11:34:34 +0000 (Mon, 28 Nov 2011) | 5 lines +r7934 | vlefevre | 2011-11-02 20:54:18 +0000 (Wed, 02 Nov 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/tests/trandom.c - M /branches/3.1/tests/turandom.c + M /trunk/src/vasprintf.c -Merged changesets r7965-7966 from the trunk: -[doc/mpfr.texi] Mentioned the difference between GMP 4.1 and 4.2 about -the changes of mpfr_urandom and mpfr_urandomb in MPFR 3.1. -[tests/trandom.c,tests/turandom.c] Fixed compatibility with GMP 4.1.x -(since the default PRNG has changed between GMP 4.1 and 4.2). +[src/vasprintf.c] Untabify. Minor correction in a comment. ------------------------------------------------------------------------ -r7945 | vlefevre | 2011-11-03 16:11:08 +0000 (Thu, 03 Nov 2011) | 1 line +r7933 | thevenyp | 2011-11-02 16:58:29 +0000 (Wed, 02 Nov 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/vasprintf.c + M /trunk/src/vasprintf.c -[src/vasprintf.c] Corrected a comment. +[src/vasprintf.c] Rewrite in a cleaner way the part of regular_fg implied in the bug reported by Pavel Holoborodko (see r7931). ------------------------------------------------------------------------ -r7942 | vlefevre | 2011-11-03 14:49:58 +0000 (Thu, 03 Nov 2011) | 1 line +r7932 | zimmerma | 2011-11-02 11:44:26 +0000 (Wed, 02 Nov 2011) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/tests/tsprintf.c + M /trunk/src/mpn_exp.c + +[src/mpn_exp.c] changed FIXME into TODO -[tests/tsprintf.c] Coding style. ------------------------------------------------------------------------ -r7940 | vlefevre | 2011-11-03 14:10:49 +0000 (Thu, 03 Nov 2011) | 3 lines +r7931 | zimmerma | 2011-11-02 10:15:41 +0000 (Wed, 02 Nov 2011) | 4 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/vasprintf.c - M /branches/3.1/tests/tsprintf.c + M /trunk/src/mpn_exp.c + M /trunk/src/vasprintf.c + M /trunk/tests/tsprintf.c + +[src/mpn_exp.c] added comment +[src/vasprintf.c] (hopefully) fixed bug reported by Pavel Holoborodko +[tests/tsprintf.c] added corresponding test case -[src/vasprintf.c] Fixed bug reported by Pavel Holoborodko. -[tests/tsprintf.c] Added testcases. -(Merged changesets r7931 (except src/mpn_exp.c) and r7933-7936.) ------------------------------------------------------------------------ -r7921 | vlefevre | 2011-10-14 10:18:30 +0000 (Fri, 14 Oct 2011) | 2 lines +r7920 | vlefevre | 2011-10-14 10:13:34 +0000 (Fri, 14 Oct 2011) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/INSTALL - M /branches/3.1/tests/Makefile.am + M /trunk/INSTALL + M /trunk/tests/Makefile.am [tests/Makefile.am] Added -L$(top_builddir)/src/.libs to AM_LDFLAGS. [INSTALL] Removed the notes on HP-UX (obsolete after the above change). ------------------------------------------------------------------------ -r7919 | vlefevre | 2011-10-13 11:30:54 +0000 (Thu, 13 Oct 2011) | 1 line +r7918 | vlefevre | 2011-10-13 11:30:33 +0000 (Thu, 13 Oct 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/INSTALL + M /trunk/INSTALL [INSTALL] Corrected notes for HP-UX. ------------------------------------------------------------------------ -r7917 | vlefevre | 2011-10-13 11:20:23 +0000 (Thu, 13 Oct 2011) | 2 lines +r7916 | vlefevre | 2011-10-13 11:17:27 +0000 (Thu, 13 Oct 2011) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/INSTALL + M /trunk/INSTALL [INSTALL] Added notes for HP-UX after a bug report. See discussion: https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00042.html ------------------------------------------------------------------------ -r7908 | vlefevre | 2011-10-04 11:14:48 +0000 (Tue, 04 Oct 2011) | 3 lines +r7915 | zimmerma | 2011-10-12 14:14:16 +0000 (Wed, 12 Oct 2011) | 2 lines Changed paths: - M /branches/3.1/src/mpfr-impl.h + M /trunk/TODO -[src/mpfr-impl.h] Fixed a bug in the MPFR_UNLIKELY macro for GCC -(found under Mac OS X / PowerPC with the mode32 GMP ABI, and MPFR -built with --enable-assert=full). ------------------------------------------------------------------------- -r7907 | vlefevre | 2011-10-04 10:04:11 +0000 (Tue, 04 Oct 2011) | 1 line -Changed paths: - M /branches/3.1/INSTALL - M /branches/3.1/VERSION - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/version.c +[TODO] added one item -Updated version to 3.1.1-dev. ------------------------------------------------------------------------ -r7897 | vlefevre | 2011-10-03 08:16:03 +0000 (Mon, 03 Oct 2011) | 1 line +r7914 | zimmerma | 2011-10-12 13:50:18 +0000 (Wed, 12 Oct 2011) | 4 lines Changed paths: - M /branches/3.1/ChangeLog + A /trunk/src/x86_64/corei5 + A /trunk/src/x86_64/corei5/mparam.h + +[corei5/mparam.h] tuning files for Core i5 (not yet used since GMP 5.0.2 does + currently recognize Core i5 as "k8", however the k8 tuning + parameters are not so bad for Core i5) -ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). ------------------------------------------------------------------------ -r7896 | vlefevre | 2011-10-03 08:10:45 +0000 (Mon, 03 Oct 2011) | 1 line +r7910 | vlefevre | 2011-10-05 22:15:52 +0000 (Wed, 05 Oct 2011) | 2 lines Changed paths: - M /branches/3.1/VERSION - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/version.c + M /trunk/src/mpfr-impl.h -Updated version to 3.1.0. +[src/mpfr-impl.h] Improved MPFR_IS_PURE_FP definition, so that +MPFR_ASSERTD takes a boolean (0 or 1). ------------------------------------------------------------------------ -r7895 | vlefevre | 2011-10-03 08:09:19 +0000 (Mon, 03 Oct 2011) | 1 line +r7909 | vlefevre | 2011-10-04 11:23:46 +0000 (Tue, 04 Oct 2011) | 4 lines Changed paths: - M /branches/3.1/doc/mpfr.texi + M /trunk + M /trunk/src/mpfr-impl.h -[doc/mpfr.texi] Updated the month. +[src/mpfr-impl.h] Fixed a bug in the MPFR_UNLIKELY macro for GCC +(found under Mac OS X / PowerPC with the mode32 GMP ABI, and MPFR +built with --enable-assert=full). +(Merged changeset r7908 from the 3.1 branch.) ------------------------------------------------------------------------ -r7893 | vlefevre | 2011-09-29 22:25:41 +0000 (Thu, 29 Sep 2011) | 2 lines +r7892 | zimmerma | 2011-09-29 18:04:39 +0000 (Thu, 29 Sep 2011) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi + M /trunk/doc/mpfr.texi [doc/mpfr.texi] added reference and comment for eint -(Merged changeset r7892 from the trunk.) + ------------------------------------------------------------------------ -r7890 | vlefevre | 2011-09-25 00:17:05 +0000 (Sun, 25 Sep 2011) | 2 lines +r7889 | vlefevre | 2011-09-25 00:15:17 +0000 (Sun, 25 Sep 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi + M /trunk/doc/mpfr.texi [doc/mpfr.texi] Rephrased mpfr_frexp description. -(Merged changeset r7889 from the trunk.) ------------------------------------------------------------------------ -r7887 | vlefevre | 2011-09-24 10:01:07 +0000 (Sat, 24 Sep 2011) | 5 lines +r7886 | vlefevre | 2011-09-24 09:58:27 +0000 (Sat, 24 Sep 2011) | 4 lines Changed paths: - M /branches/3.1 - M /branches/3.1/NEWS - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/log1p.c - M /branches/3.1/tests/tagm.c - M /branches/3.1/tests/tgeneric.c + M /trunk/NEWS + M /trunk/doc/mpfr.texi + M /trunk/src/log1p.c + M /trunk/tests/tagm.c + M /trunk/tests/tgeneric.c Renamed "division-by-zero" to "divide-by-zero" (term used by the ISO C99 standard, the IEEE 754-2008 standard using divideByZero, and the old IEEE 754-1985 standard using both "divide by zero" and "division by zero"). -(Merged changeset r7886 from the trunk.) ------------------------------------------------------------------------ -r7885 | vlefevre | 2011-09-24 09:40:03 +0000 (Sat, 24 Sep 2011) | 3 lines +r7883 | vlefevre | 2011-09-24 09:36:10 +0000 (Sat, 24 Sep 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/src/gmp_op.c - M /branches/3.1/tests/tgmpop.c + M /trunk/src/gmp_op.c -[tests/tgmpop.c] Improved division-by-zero tests. [src/gmp_op.c] Forgot to update the flags in some functions. -(Merged changesets r7882 and r7883 from the trunk.) ------------------------------------------------------------------------ -r7884 | vlefevre | 2011-09-24 09:39:02 +0000 (Sat, 24 Sep 2011) | 2 lines +r7882 | vlefevre | 2011-09-24 09:27:41 +0000 (Sat, 24 Sep 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/doc/faq.xsl + M /trunk/tests/tgmpop.c + +[tests/tgmpop.c] Improved division-by-zero tests. +------------------------------------------------------------------------ +r7881 | vlefevre | 2011-09-23 17:03:46 +0000 (Fri, 23 Sep 2011) | 1 line +Changed paths: + M /trunk/doc/faq.xsl [doc/faq.xsl] Added a comment about the MPFR logo. -(Merged changeset r7881 from the trunk.) ------------------------------------------------------------------------ -r7880 | vlefevre | 2011-09-22 10:38:10 +0000 (Thu, 22 Sep 2011) | 1 line +r7879 | vlefevre | 2011-09-22 10:37:11 +0000 (Thu, 22 Sep 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi + M /trunk/doc/mpfr.texi [doc/mpfr.texi] Improved mpfr_frexp description. ------------------------------------------------------------------------ -r7878 | vlefevre | 2011-09-22 10:09:40 +0000 (Thu, 22 Sep 2011) | 1 line +r7877 | vlefevre | 2011-09-22 10:07:31 +0000 (Thu, 22 Sep 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi + M /trunk/doc/mpfr.texi [doc/mpfr.texi] Corrected typo in the mpfr_frexp description. ------------------------------------------------------------------------ -r7874 | vlefevre | 2011-09-20 08:50:37 +0000 (Tue, 20 Sep 2011) | 1 line +r7876 | zimmerma | 2011-09-21 10:12:45 +0000 (Wed, 21 Sep 2011) | 2 lines Changed paths: - M /branches/3.1/ChangeLog + M /trunk/tools/cfarm.sh + +[tools/cfarm.sh] updated for MPFR 3.1.0 rc2 -ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). ------------------------------------------------------------------------ -r7872 | vlefevre | 2011-09-20 07:37:01 +0000 (Tue, 20 Sep 2011) | 1 line +r7873 | zimmerma | 2011-09-20 08:06:47 +0000 (Tue, 20 Sep 2011) | 2 lines Changed paths: - M /branches/3.1/VERSION - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/version.c - -Updated version to 3.1.0-rc2. ------------------------------------------------------------------------- -r7871 | vlefevre | 2011-09-20 07:35:18 +0000 (Tue, 20 Sep 2011) | 18 lines -Changed paths: - M /branches/3.1 - M /branches/3.1/NEWS - M /branches/3.1/TODO - M /branches/3.1/doc/README.dev - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/examples/version.c - M /branches/3.1/src/agm.c - M /branches/3.1/src/buildopt.c - M /branches/3.1/src/gmp_op.c - M /branches/3.1/src/mpfr-gmp.h - M /branches/3.1/src/mpfr-impl.h - M /branches/3.1/src/mpfr.h - M /branches/3.1/tests/tbuildopt.c - M /branches/3.1/tests/tgmpop.c - -Merged r7857 through r7870 from the trunk: - * [src/mpfr-gmp.h] Fixed a prototype (mpfr_limb_ptr isn't available - yet) and added missing prototype for __gmpn_sbpi1_divappr_q. - * [src/mpfr-impl.h] Define new macros MPFR_EXT_EMIN and MPFR_EXT_EMAX. - * [src/agm.c] Replaced __gmpfr_emin and __gmpfr_emax by MPFR_EXT_EMIN - and MPFR_EXT_EMAX respectively (this should be a bit faster with TLS - and also is a workaround to a bug occurring with TLS and GCC 4.3.2 - on a Linux/Sparc machine, gcc54.fsffrance.org). - * [tests/tgmpop.c] Check for erange flag in mpfr_cmp_[f,q,z]. - * [src/gmp_op.c] Handle the special cases in mpfr_cmp_q and mpfr_cmp_f - (fixing the problem with the erange flag in particular). - * [src/buildopt.c,src/mpfr.h,tests/tbuildopt.c,doc/mpfr.texi,NEWS] - Added mpfr_buildopt_gmpinternals_p function. - * [examples/version.c] Output mpfr_buildopt_gmpinternals_p() and - mpfr_buildopt_tune_case() values with MPFR 3.1 or later. - * [doc/README.dev] Updated "To make a release". Document how to - specify the minimum exponent or the maximum exponent. - * [TODO] Added an item about the minimum and maximum exponents. + M /trunk/tools/cfarm.sh + +[cfarm.sh] updated for MPFR 3.1.0-rc1 (with GMP 5.0.2) + ------------------------------------------------------------------------ -r7857 | vlefevre | 2011-09-19 08:22:17 +0000 (Mon, 19 Sep 2011) | 2 lines +r7870 | vlefevre | 2011-09-20 00:50:01 +0000 (Tue, 20 Sep 2011) | 2 lines Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi + M /trunk/examples/version.c -[doc/mpfr.texi] Correction: "5 exception types" → "6 exception types" -(thanks to Case Vanhorsen for the report). +[examples/version.c] Output mpfr_buildopt_gmpinternals_p() and +mpfr_buildopt_tune_case() values with MPFR 3.1 or later. ------------------------------------------------------------------------ -r7854 | vlefevre | 2011-09-17 11:58:18 +0000 (Sat, 17 Sep 2011) | 1 line +r7869 | vlefevre | 2011-09-20 00:31:26 +0000 (Tue, 20 Sep 2011) | 1 line Changed paths: - M /branches/3.1/ChangeLog + M /trunk/NEWS + M /trunk/doc/mpfr.texi + M /trunk/src/buildopt.c + M /trunk/src/mpfr.h + M /trunk/tests/tbuildopt.c -ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). +Renamed mpfr_buildopt_internals_p to mpfr_buildopt_gmpinternals_p. +------------------------------------------------------------------------ +r7868 | vlefevre | 2011-09-20 00:26:59 +0000 (Tue, 20 Sep 2011) | 1 line +Changed paths: + M /trunk/NEWS + M /trunk/doc/mpfr.texi + M /trunk/src/buildopt.c + M /trunk/src/mpfr.h + M /trunk/tests/tbuildopt.c + +Added mpfr_buildopt_internals_p function. +------------------------------------------------------------------------ +r7867 | vlefevre | 2011-09-20 00:13:51 +0000 (Tue, 20 Sep 2011) | 1 line +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Added commas. +------------------------------------------------------------------------ +r7866 | vlefevre | 2011-09-20 00:04:21 +0000 (Tue, 20 Sep 2011) | 1 line +Changed paths: + M /trunk/src/gmp_op.c + +[src/gmp_op.c] Handle the special cases in mpfr_cmp_q and mpfr_cmp_f. +------------------------------------------------------------------------ +r7865 | vlefevre | 2011-09-19 15:33:46 +0000 (Mon, 19 Sep 2011) | 1 line +Changed paths: + M /trunk/TODO + +[TODO] Added an item about the minimum and maximum exponents. +------------------------------------------------------------------------ +r7864 | vlefevre | 2011-09-19 15:29:14 +0000 (Mon, 19 Sep 2011) | 2 lines +Changed paths: + M /trunk/src/agm.c + +[src/agm.c] Replaced MPFR_EMIN_MIN and MPFR_EMAX_MAX by MPFR_EXT_EMIN +and MPFR_EXT_EMAX respectively (see r7862 and r7863). +------------------------------------------------------------------------ +r7863 | vlefevre | 2011-09-19 15:21:26 +0000 (Mon, 19 Sep 2011) | 3 lines +Changed paths: + M /trunk/doc/README.dev + M /trunk/src/mpfr-impl.h + +[src/mpfr-impl.h] Define new macros MPFR_EXT_EMIN and MPFR_EXT_EMAX. +[doc/README.dev] Document how to specify the minimum exponent or the + maximum exponent. +------------------------------------------------------------------------ +r7862 | zimmerma | 2011-09-19 14:37:18 +0000 (Mon, 19 Sep 2011) | 3 lines +Changed paths: + M /trunk/src/agm.c + +[src/agm.c] replaced __gmpfr_emax by MPFR_EMAX_MAX (same for __gmpfr_emin). + Solves bug on gcc54 with --enable-thread-safe and GCC 4.3.2. + +------------------------------------------------------------------------ +r7861 | vlefevre | 2011-09-19 09:40:04 +0000 (Mon, 19 Sep 2011) | 2 lines +Changed paths: + M /trunk/src/mpfr-gmp.h + +[src/mpfr-gmp.h] Added missing prototype for __gmpn_sbpi1_divappr_q +(it could be detected when building MPFR with g++). +------------------------------------------------------------------------ +r7860 | zimmerma | 2011-09-19 09:31:42 +0000 (Mon, 19 Sep 2011) | 3 lines +Changed paths: + M /trunk/tests/tgmpop.c + +[tests/tgmpop.c] check for erange flag in mpfr_cmp_[f,q,z] + (https://sympa.inria.fr/sympa/arc/mpfr/2011-09/msg00013.html) + +------------------------------------------------------------------------ +r7859 | vlefevre | 2011-09-19 09:25:04 +0000 (Mon, 19 Sep 2011) | 1 line +Changed paths: + M /trunk/doc/README.dev + +[doc/README.dev] Updated "To make a release". +------------------------------------------------------------------------ +r7858 | zimmerma | 2011-09-19 09:04:37 +0000 (Mon, 19 Sep 2011) | 4 lines +Changed paths: + M /trunk/doc/README.dev + M /trunk/src/mpfr-gmp.h + +[src/mpfr-gmp.h] fixed bug with --enable-gmp-internals introduced in r7455 + (mpfr_limb_ptr is not yet defined when reading mpfr-gmp.h + thus we can't use it) + +------------------------------------------------------------------------ +r7856 | vlefevre | 2011-09-19 08:17:30 +0000 (Mon, 19 Sep 2011) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Correction: "5 exception types" → "6 exception types" +(thanks to Case Vanhorsen for the report). ------------------------------------------------------------------------ -r7853 | vlefevre | 2011-09-14 21:38:49 +0000 (Wed, 14 Sep 2011) | 4 lines +r7852 | vlefevre | 2011-09-14 21:37:44 +0000 (Wed, 14 Sep 2011) | 4 lines Changed paths: - M /branches/3.1 - M /branches/3.1/src/mpfr-impl.h + M /trunk/src/mpfr-impl.h [src/mpfr-impl.h] Define LONGLONG_STANDALONE before including mpfr-longlong.h so that udiv_qrnnd_preinv is defined (this is useful at least on IA64 when compiling without gmp-impl.h). Thanks to Patrick Pélissier for the fix. ------------------------------------------------------------------------ -r7851 | vlefevre | 2011-09-11 09:21:52 +0000 (Sun, 11 Sep 2011) | 3 lines +r7850 | vlefevre | 2011-09-11 09:17:03 +0000 (Sun, 11 Sep 2011) | 3 lines Changed paths: - M /branches/3.1 - M /branches/3.1/NEWS - M /branches/3.1/doc/mpfr.texi + M /trunk/doc/mpfr.texi -[doc/mpfr.texi] Updated "API Compatibility" section. Documented - function mpfr_buildopt_tune_case. Minor consistency changes. -[NEWS] Function mpfr_buildopt_tune_case is new in MPFR 3.1. +[doc/mpfr.texi] Updated "API Compatibility" section: as of MPFR 3.1, +the mpfr.h header can be included several times, while still supporting +optional functions. ------------------------------------------------------------------------ -r7844 | vlefevre | 2011-09-11 07:49:03 +0000 (Sun, 11 Sep 2011) | 2 lines +r7849 | vlefevre | 2011-09-11 09:07:58 +0000 (Sun, 11 Sep 2011) | 1 line Changed paths: - M /branches/3.1 - M /branches/3.1/doc/mpfr.texi + M /trunk/doc/mpfr.texi -[doc/mpfr.texi] MPFR_RNDA was introduced in MPFR 3.0.0 and should -no longer be considered experimental. +[doc/mpfr.texi] Replaced some @code by @file for consistency. ------------------------------------------------------------------------ -r7842 | vlefevre | 2011-09-10 21:25:45 +0000 (Sat, 10 Sep 2011) | 1 line +r7848 | vlefevre | 2011-09-11 09:04:58 +0000 (Sun, 11 Sep 2011) | 2 lines Changed paths: - M /branches/3.1/ChangeLog + M /trunk/doc/mpfr.texi -ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales). +[doc/mpfr.texi] Updated "API Compatibility" section: functions +mpfr_frexp, mpfr_grandom and mpfr_z_sub are new in MPFR 3.1. ------------------------------------------------------------------------ -r7841 | vlefevre | 2011-09-10 21:24:05 +0000 (Sat, 10 Sep 2011) | 1 line +r7847 | vlefevre | 2011-09-11 09:01:48 +0000 (Sun, 11 Sep 2011) | 3 lines Changed paths: - M /branches/3.1/doc/mpfr.texi + M /trunk/NEWS + M /trunk/doc/mpfr.texi -[doc/mpfr.texi] Updated the month. +[doc/mpfr.texi] Documented function mpfr_buildopt_tune_case, +and added it to the list of added functions. +[NEWS] Function mpfr_buildopt_tune_case is new in MPFR 3.1. +------------------------------------------------------------------------ +r7846 | vlefevre | 2011-09-11 08:52:28 +0000 (Sun, 11 Sep 2011) | 2 lines +Changed paths: + M /trunk/doc/mpfr.texi + +[doc/mpfr.texi] Updated "API Compatibility" section +(new division-by-zero exception in MPFR 3.1). ------------------------------------------------------------------------ -r7840 | vlefevre | 2011-09-10 21:23:08 +0000 (Sat, 10 Sep 2011) | 1 line +r7845 | vlefevre | 2011-09-11 07:50:10 +0000 (Sun, 11 Sep 2011) | 1 line Changed paths: - M /branches/3.1/INSTALL - M /branches/3.1/VERSION - M /branches/3.1/configure.ac - M /branches/3.1/doc/mpfr.texi - M /branches/3.1/src/mpfr.h - M /branches/3.1/src/version.c + M /trunk/doc/mpfr.texi -Updated version to 3.1.0-rc1. +[doc/mpfr.texi] Updated the month. ------------------------------------------------------------------------ -r7839 | vlefevre | 2011-09-10 21:21:59 +0000 (Sat, 10 Sep 2011) | 1 line +r7843 | vlefevre | 2011-09-11 07:48:01 +0000 (Sun, 11 Sep 2011) | 2 lines Changed paths: - A /branches/3.1 (from /trunk:7838) + M /trunk/doc/mpfr.texi -Recreated 3.1 branch from the trunk. +[doc/mpfr.texi] MPFR_RNDA was introduced in MPFR 3.0.0 and should +no longer be considered experimental. ------------------------------------------------------------------------ r7836 | vlefevre | 2011-09-10 21:15:45 +0000 (Sat, 10 Sep 2011) | 2 lines Changed paths: @@ -8465,7 +33237,7 @@ Changed paths: M /trunk/tests/trint.c -Previous extented coverage test in trint.c now self generate tests in and compare values +Previous extended coverage test in trint.c now self generate tests in and compare values ------------------------------------------------------------------------ r7524 | demengeo | 2011-03-04 14:14:13 +0000 (Fri, 04 Mar 2011) | 1 line Changed paths: @@ -10466,7 +35238,7 @@ M /trunk/src/mul.c [mul.c] fixed bug introduced in revision 7183, and reported by Brian Gladman - on Windows, where mpfr_exp_t has 32 bits and mpfr_limb_t has 64 bits + on Windows, where mpfr_exp_t has 32 bits and mp_limb_t has 64 bits ------------------------------------------------------------------------ r7257 | vlefevre | 2010-11-09 14:24:34 +0000 (Tue, 09 Nov 2010) | 2 lines @@ -12284,7 +37056,7 @@ Changed paths: M /trunk/NEWS -[NEWS] Prepare for new version. +[NEWS] Prepare for new version 3.1.0. ------------------------------------------------------------------------ r7067 | vlefevre | 2010-08-12 14:13:48 +0000 (Thu, 12 Aug 2010) | 1 line Changed paths: @@ -16584,7 +41356,7 @@ M /trunk/tests/Makefile.am Makefile.am, tests/Makefile.am: patch from Ralf Wildenhues. -http://lists.gnu.org/archive/html/bug-automake/2009-09/msg00033.html +https://lists.gnu.org/archive/html/bug-automake/2009-09/msg00033.html ------------------------------------------------------------------------ r6475 | vlefevre | 2009-09-18 15:00:09 +0000 (Fri, 18 Sep 2009) | 1 line Changed paths: @@ -19235,7 +44007,7 @@ Changed paths: M /trunk/mpfr.h -Add protoype for mpfr_min_prec in mpfr.h. +Add prototype for mpfr_min_prec in mpfr.h. ------------------------------------------------------------------------ r6103 | lfousse | 2009-03-15 20:34:33 +0000 (Sun, 15 Mar 2009) | 2 lines @@ -22084,7 +46856,7 @@ M /trunk/INSTALL INSTALL: TLS on darwin may work, but I don't know anything more. -See thread . +See thread . ------------------------------------------------------------------------ r5702 | vlefevre | 2008-12-08 16:02:29 +0000 (Mon, 08 Dec 2008) | 1 line Changed paths: @@ -22419,7 +47191,7 @@ configure.in: replaced $(...) quoting style by "`...`" since the former is not supported everywhere (and indeed is not used by the autotools): -http://swox.com/list-archives/gmp-bugs/2008-October/001185.html +https://gmplib.org/list-archives/gmp-bugs/2008-October/001185.html ------------------------------------------------------------------------ r5658 | vlefevre | 2008-10-29 01:21:29 +0000 (Wed, 29 Oct 2008) | 2 lines Changed paths: @@ -26796,7 +51568,7 @@ M /trunk/tests/tprintf.c M /trunk/vasprintf.c -exponent continuity with one hexadecimal digit ouput +exponent continuity with one hexadecimal digit output ------------------------------------------------------------------------ r5104 | thevenyp | 2007-12-17 14:41:58 +0000 (Mon, 17 Dec 2007) | 2 lines @@ -35947,7 +60719,7 @@ M /trunk/zeta_ui.c Updated the copyright notices according to the new GNU rules on: - http://www.gnu.org/prep/maintain/maintain.html#Copyright-Notices + https://www.gnu.org/prep/maintain/maintain.html#Copyright-Notices i.e. added 2006 to every MPFR file. Note: the copyright notices (currently 336) should match the regexp Copyright.* 2006 Free Software @@ -38286,7 +63058,7 @@ M /trunk/extract.c M /trunk/strtofr.c -Fix warnings due to comparaison between signed and unsigned. +Fix warnings due to comparison between signed and unsigned. Reinclude string.h for strtofr. ------------------------------------------------------------------------ @@ -38524,7 +63296,7 @@ M /trunk/COPYING M /trunk/COPYING.LIB -Forget thoses two. Update from FSF site. +Forget those two. Update from FSF site. ------------------------------------------------------------------------ r3607 | pelissip | 2005-06-02 16:16:17 +0000 (Thu, 02 Jun 2005) | 2 lines @@ -39700,7 +64472,7 @@ Changed paths: M /trunk/tests/reuse.c -Add new funcions in reuse test. +Add new functions in reuse test. ------------------------------------------------------------------------ r3503 | zimmerma | 2005-04-30 11:03:47 +0000 (Sat, 30 Apr 2005) | 2 lines @@ -41088,7 +65860,7 @@ M /trunk/tanh.c M /trunk/zeta.c -Log input and ouput of functions. +Log input and output of functions. ------------------------------------------------------------------------ r3314 | pelissip | 2005-02-15 10:06:39 +0000 (Tue, 15 Feb 2005) | 2 lines @@ -41358,7 +66130,7 @@ As a consequence some tests using AC_RUN_IFELSE may fail due to ugly things like LD_LIBRARY_PATH no set or wrong selection of libgmp. So they just produce a warning, not a fatal error. -TODO: Check if we can avoid thoses problems... +TODO: Check if we can avoid those problems... ------------------------------------------------------------------------ r3283 | pelissip | 2005-02-08 15:49:12 +0000 (Tue, 08 Feb 2005) | 3 lines @@ -42567,7 +67339,7 @@ Changed paths: M /trunk/mpfr.h -Remove thread attribut until I found a good way to use it. +Remove thread attribute until I found a good way to use it. ------------------------------------------------------------------------ r3140 | pelissip | 2004-12-15 10:49:11 +0000 (Wed, 15 Dec 2004) | 2 lines @@ -42716,7 +67488,7 @@ Changed paths: M /trunk/mpfr.h -Add support for new attribut sentinel in incoming GCC 4.0 +Add support for new attribute sentinel in incoming GCC 4.0 ------------------------------------------------------------------------ r3122 | pelissip | 2004-12-09 13:23:25 +0000 (Thu, 09 Dec 2004) | 2 lines @@ -42737,7 +67509,7 @@ Optimize mpfr_set4. Inline rounding in mpfr_set4 and mpfr_cache -mpfr_set4 dosn't return MPFR_EVEN_INEX (It was undocumented before). +mpfr_set4 doesn't return MPFR_EVEN_INEX (It was undocumented before). Fix problems with tests (Avoid mixing MPFR_EVEN_INEX and 1). Add MPFR_RNDRAW_EVEN for rounding with MPFR_EVEN_INEX inexact support @@ -43646,7 +68418,7 @@ M /trunk/mpfr.texi Update documentation and NEWS to reflect new functions -and functionnality. +and functionality. ------------------------------------------------------------------------ r3008 | pelissip | 2004-09-29 12:28:17 +0000 (Wed, 29 Sep 2004) | 2 lines @@ -43738,7 +68510,7 @@ Changed paths: M /trunk/div.c -Replace variable 'near' to 'the_real_near' since MSVC incorreclty +Replace variable 'near' to 'the_real_near' since MSVC incorrectly recognize "far" and "near" as obsolete keywords (100% incorrect, and clearly MSVC fault but it doesn't cost many things to change the name). @@ -46940,7 +71712,7 @@ Changed paths: M /trunk/isinteger.c -+ Simplify the signular code. ++ Simplify the singular code. + Fix potential type errors. (Used mpfr_prec_t instead of mpfr_uexp_t). ------------------------------------------------------------------------ @@ -47415,7 +72187,7 @@ M /trunk/tests/tsub1sp.c + Add a new test in case of underflow. -+ Fix bug in case of underflow for sub1 / sub1sp (mpfr_powerof2 could be called with inalid numbers). ++ Fix bug in case of underflow for sub1 / sub1sp (mpfr_powerof2 could be called with invalid numbers). ------------------------------------------------------------------------ r2570 | pelissip | 2003-12-09 14:58:26 +0000 (Tue, 09 Dec 2003) | 3 lines @@ -47516,7 +72288,7 @@ M /trunk/mpfr-impl.h M /trunk/sub1.c -Optmize a few add1.c/sub1.c by using MPFR_LIKELY / MPFR_UNLIKELY. +Optimize a few add1.c/sub1.c by using MPFR_LIKELY / MPFR_UNLIKELY. ------------------------------------------------------------------------ r2563 | pelissip | 2003-11-21 16:26:19 +0000 (Fri, 21 Nov 2003) | 2 lines @@ -47541,7 +72313,7 @@ M /trunk/sub1.c M /trunk/zeta.c -Remove some warnings and potential errors (Comparaison between signed and unsigned). +Remove some warnings and potential errors (Comparison between signed and unsigned). ------------------------------------------------------------------------ r2562 | pelissip | 2003-11-21 15:27:35 +0000 (Fri, 21 Nov 2003) | 4 lines @@ -54888,7 +79660,7 @@ M /trunk/tests/tui_div.c M /trunk/tests/tui_sub.c -- use mpfr_test_init to initialize harware floats +- use mpfr_test_init to initialize hardware floats - use #ifdef HAVE_INFS when using DBL_NAN, ... - fixed some problems with wrongly converted f-p values (esp. under IRIX) @@ -55973,7 +80745,7 @@ Changed paths: M /trunk/acosh.c -chnage the return values +change the return values ------------------------------------------------------------------------ r1683 | daney | 2002-02-06 15:34:15 +0000 (Wed, 06 Feb 2002) | 2 lines @@ -56227,7 +80999,7 @@ Changed paths: M /trunk/fma.c -Change indendation + replace "" -> <> in header +Change indentation + replace "" -> <> in header ------------------------------------------------------------------------ r1655 | vlefevre | 2002-01-17 21:45:41 +0000 (Thu, 17 Jan 2002) | 2 lines @@ -58412,7 +83184,7 @@ Changed paths: M /trunk/fma.c -mixed version beetwen DD and Pau => (gestion des flag inexacte dirige) +mixed version between DD and Pau => (gestion des flag inexacte dirige) ------------------------------------------------------------------------ r1431 | daney | 2001-10-26 15:28:31 +0000 (Fri, 26 Oct 2001) | 2 lines @@ -59866,7 +84638,7 @@ Changed paths: M /trunk/set_d.c -implemeted inexact flag in mpfr_set_d +implemented inexact flag in mpfr_set_d ------------------------------------------------------------------------ r1234 | zimmerma | 2001-10-12 12:17:24 +0000 (Fri, 12 Oct 2001) | 2 lines @@ -67275,7 +92047,7 @@ Changed paths: M /trunk/sqrt3.c -The word added when the exponent is odd was sometimes unitialized. +The word added when the exponent is odd was sometimes uninitialized. ------------------------------------------------------------------------ r320 | hanrot | 1999-07-06 09:39:42 +0000 (Tue, 06 Jul 1999) | 2 lines diff -Nru mpfr4-3.1.4/compile mpfr4-4.0.2/compile --- mpfr4-3.1.4/compile 2016-03-06 11:33:18.000000000 +0000 +++ mpfr4-4.0.2/compile 2019-01-31 20:43:20.000000000 +0000 @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. -scriptversion=2012-10-14.11; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -255,7 +255,8 @@ echo "compile $scriptversion" exit $? ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac @@ -339,9 +340,9 @@ # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff -Nru mpfr4-3.1.4/config.guess mpfr4-4.0.2/config.guess --- mpfr4-3.1.4/config.guess 2016-03-06 11:33:18.000000000 +0000 +++ mpfr4-4.0.2/config.guess 2019-01-31 20:43:20.000000000 +0000 @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2015 Free Software Foundation, Inc. +# Copyright 1992-2018 Free Software Foundation, Inc. -timestamp='2015-08-20' +timestamp='2018-02-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -27,7 +27,7 @@ # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . @@ -39,7 +39,7 @@ Output the configuration name of the system \`$me' is run on. -Operation modes: +Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -50,7 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2015 Free Software Foundation, Inc. +Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -107,9 +107,9 @@ dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; + ,,) echo "int x;" > "$dummy.c" ; for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; @@ -132,14 +132,14 @@ UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_SYSTEM}" in +case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu - eval $set_cc_for_build - cat <<-EOF > $dummy.c + eval "$set_cc_for_build" + cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc @@ -149,13 +149,20 @@ LIBC=gnu #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" + + # If ldd exists, use it to detect musl libc. + if command -v ldd >/dev/null && \ + ldd --version 2>&1 | grep -q ^musl + then + LIBC=musl + fi ;; esac # Note: order is significant - the case branches are not exclusive. -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in +case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -169,27 +176,30 @@ # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - /sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || \ + "/sbin/$sysctl" 2>/dev/null || \ + "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` - case "${UNAME_MACHINE_ARCH}" in + case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) - arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` - machine=${arch}${endian}-unknown + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine="${arch}${endian}"-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build + # to ELF recently (or will in the future) and ABI. + case "$UNAME_MACHINE_ARCH" in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval "$set_cc_for_build" if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then @@ -205,10 +215,10 @@ ;; esac # Determine ABI tags. - case "${UNAME_MACHINE_ARCH}" in + case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release @@ -216,42 +226,55 @@ # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in + case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}${abi}" + echo "$machine-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" + exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" + exit ;; + *:MidnightBSD:*:*) + echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} + echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) - echo ${UNAME_MACHINE}-unknown-sortix + echo "$UNAME_MACHINE"-unknown-sortix exit ;; + *:Redox:*:*) + echo "$UNAME_MACHINE"-unknown-redox + exit ;; + mips:OSF1:*.*) + echo mips-dec-osf1 + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -268,63 +291,54 @@ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos + echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos + echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition @@ -336,7 +350,7 @@ echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} + echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos @@ -363,38 +377,38 @@ sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} + echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" + eval "$set_cc_for_build" + SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in @@ -403,25 +417,25 @@ ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} + echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) - echo m68k-sun-sunos${UNAME_RELEASE} + echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) - echo sparc-sun-sunos${UNAME_RELEASE} + echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} + echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not @@ -432,44 +446,44 @@ # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} + echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} + echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} + echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} + echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} + echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} + echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} + echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} + echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { @@ -478,23 +492,23 @@ #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} + echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax @@ -520,17 +534,17 @@ AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] + if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ + [ "$TARGET_BINARY_INTERFACE"x = x ] then - echo m88k-dg-dgux${UNAME_RELEASE} + echo m88k-dg-dgux"$UNAME_RELEASE" else - echo m88k-dg-dguxbcs${UNAME_RELEASE} + echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else - echo i586-dg-dgux${UNAME_RELEASE} + echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) @@ -547,7 +561,7 @@ echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id @@ -559,14 +573,14 @@ if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" #include main() @@ -577,7 +591,7 @@ exit(0); } EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else @@ -591,7 +605,7 @@ exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc @@ -600,18 +614,18 @@ IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} + echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx @@ -626,28 +640,28 @@ echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; + HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + case "$UNAME_MACHINE" in + 9000/31?) HP_ARCH=m68000 ;; + 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + case "$sc_cpu_version" in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + case "$sc_kernel_bits" in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + if [ "$HP_ARCH" = "" ]; then + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include @@ -680,13 +694,13 @@ exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = "hppa2.0w" ] + if [ "$HP_ARCH" = hppa2.0w ] then - eval $set_cc_for_build + eval "$set_cc_for_build" # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler @@ -697,23 +711,23 @@ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} + echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} + HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" #include int main () @@ -738,11 +752,11 @@ exit (0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) @@ -751,7 +765,7 @@ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) @@ -759,9 +773,9 @@ exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk + echo "$UNAME_MACHINE"-unknown-osf1mk else - echo ${UNAME_MACHINE}-unknown-osf1 + echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) @@ -786,127 +800,109 @@ echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} + echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in + case "$UNAME_PROCESSOR" in amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; esac + echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin + echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) - echo ${UNAME_MACHINE}-pc-mingw64 + echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 + echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) - echo ${UNAME_MACHINE}-pc-msys - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 + echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 + echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) - case ${UNAME_MACHINE} in + case "$UNAME_MACHINE" in x86) - echo i586-pc-interix${UNAME_RELEASE} + echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} + echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) - echo ia64-unknown-interix${UNAME_RELEASE} + echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin + echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix + echo "$UNAME_MACHINE"-pc-minix exit ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -919,61 +915,64 @@ EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) - eval $set_cc_for_build + eval "$set_cc_for_build" if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + k1om:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el @@ -987,64 +986,74 @@ #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" + test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } ;; + mips64el:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; openrisc*:Linux:*:*) - echo or1k-unknown-linux-${LIBC} + echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-${LIBC} + echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-${LIBC} + echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; - PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; - *) echo hppa-unknown-linux-${LIBC} ;; + PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; + PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; + *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-${LIBC} + echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-${LIBC} + echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-${LIBC} + echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) - echo powerpcle-unknown-linux-${LIBC} + echo powerpcle-unknown-linux-"$LIBC" + exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux-${LIBC} + echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-${LIBC} + echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} + if objdump -f /bin/sh | grep -q elf32-x86-64; then + echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32 + else + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + fi exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1058,34 +1067,34 @@ # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx + echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop + echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos + echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable + echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} + echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp + echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) @@ -1095,12 +1104,12 @@ *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 @@ -1110,9 +1119,9 @@ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else - echo ${UNAME_MACHINE}-pc-sysv32 + echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) @@ -1120,7 +1129,7 @@ # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that + # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; @@ -1132,9 +1141,9 @@ exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) @@ -1154,9 +1163,9 @@ test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; @@ -1165,28 +1174,28 @@ test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} + echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} + echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} + echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} + echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} + echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 @@ -1197,7 +1206,7 @@ *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 + echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi @@ -1217,23 +1226,23 @@ exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos + echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} + echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv"$UNAME_RELEASE" else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. @@ -1252,46 +1261,56 @@ echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} + echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} + echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} + echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} + echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} + echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} + echo sx8r-nec-superux"$UNAME_RELEASE" + exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} + echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval $set_cc_for_build + eval "$set_cc_for_build" if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi - if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub @@ -1302,27 +1321,33 @@ # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} + NEO-*:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} + echo nse-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSR-*:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} + NSV-*:NONSTOP_KERNEL:*:*) + echo nsv-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSX-*:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux @@ -1331,18 +1356,18 @@ echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi - echo ${UNAME_MACHINE}-unknown-plan9 + echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 @@ -1363,14 +1388,14 @@ echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} + echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in + case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; @@ -1379,34 +1404,48 @@ echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos + echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros + echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) - echo ${UNAME_MACHINE}-unknown-esx + echo "$UNAME_MACHINE"-unknown-esx + exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs exit ;; esac +echo "$0: unable to guess system type" >&2 + +case "$UNAME_MACHINE:$UNAME_SYSTEM" in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&2 < in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches@gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp @@ -1425,16 +1464,16 @@ /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} +UNAME_MACHINE = "$UNAME_MACHINE" +UNAME_RELEASE = "$UNAME_RELEASE" +UNAME_SYSTEM = "$UNAME_SYSTEM" +UNAME_VERSION = "$UNAME_VERSION" EOF exit 1 # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff -Nru mpfr4-3.1.4/config.sub mpfr4-4.0.2/config.sub --- mpfr4-3.1.4/config.sub 2016-03-06 11:33:18.000000000 +0000 +++ mpfr4-4.0.2/config.sub 2019-01-31 20:43:20.000000000 +0000 @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2015 Free Software Foundation, Inc. +# Copyright 1992-2018 Free Software Foundation, Inc. -timestamp='2015-08-20' +timestamp='2018-02-22' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -33,7 +33,7 @@ # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -53,12 +53,11 @@ me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. -Operation modes: +Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -68,7 +67,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2015 Free Software Foundation, Inc. +Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -95,7 +94,7 @@ *local*) # First pass through any local machine types. - echo $1 + echo "$1" exit ;; * ) @@ -113,24 +112,24 @@ # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ - kopensolaris*-gnu* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` + basic_machine=`echo "$1" | sed 's/-[^-]*$//'` + if [ "$basic_machine" != "$1" ] + then os=`echo "$1" | sed 's/.*-/-/'` else os=; fi ;; esac @@ -179,44 +178,44 @@ ;; -sco6) os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 @@ -228,10 +227,7 @@ os=-lynxos ;; -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` + basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` ;; -psos*) os=-psos @@ -264,7 +260,7 @@ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ - | i370 | i860 | i960 | ia64 \ + | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ @@ -300,8 +296,9 @@ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ - | pdp10 | pdp11 | pj | pjl \ + | pdp10 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ @@ -315,7 +312,7 @@ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ - | we32k \ + | wasm32 \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown @@ -336,7 +333,7 @@ basic_machine=$basic_machine-unknown os=-none ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) ;; ms1) basic_machine=mt-unknown @@ -365,7 +362,7 @@ ;; # Object if more than one company name word. *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. @@ -388,7 +385,7 @@ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ + | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ @@ -429,6 +426,7 @@ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ @@ -445,6 +443,7 @@ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ + | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -458,7 +457,7 @@ # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) - basic_machine=i386-unknown + basic_machine=i386-pc os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) @@ -492,7 +491,7 @@ basic_machine=x86_64-pc ;; amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl @@ -521,7 +520,7 @@ basic_machine=i386-pc os=-aros ;; - asmjs) + asmjs) basic_machine=asmjs-unknown ;; aux) @@ -537,7 +536,7 @@ os=-linux ;; blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) @@ -545,13 +544,13 @@ os=-cnk ;; c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray @@ -640,10 +639,18 @@ basic_machine=rs6000-bull os=-bosx ;; - dpx2* | dpx2*-bull) + dpx2*) basic_machine=m68k-bull os=-sysv3 ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=$os"spe" + ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -733,9 +740,6 @@ hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; - hppa-next) - os=-nextstep3 - ;; hppaosf) basic_machine=hppa1.1-hp os=-osf @@ -748,26 +752,26 @@ basic_machine=i370-ibm ;; i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; - i386-vsta | vsta) + vsta) basic_machine=i386-unknown os=-vsta ;; @@ -786,19 +790,16 @@ os=-sysv ;; leon-*|leon[3-9]-*) - basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; - m88k-omron*) - basic_machine=m88k-omron - ;; magnum | m3230) basic_machine=mips-mips os=-sysv @@ -830,10 +831,10 @@ os=-mint ;; mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` ;; mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k @@ -852,7 +853,7 @@ os=-msdos ;; ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc @@ -894,7 +895,7 @@ basic_machine=v70-nec os=-sysv ;; - next | m*-next ) + next | m*-next) basic_machine=m68k-next case $os in -nextstep* ) @@ -939,6 +940,12 @@ nsr-tandem) basic_machine=nsr-tandem ;; + nsv-tandem) + basic_machine=nsv-tandem + ;; + nsx-tandem) + basic_machine=nsx-tandem + ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf @@ -971,7 +978,7 @@ os=-linux ;; parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; pbd) @@ -987,7 +994,7 @@ basic_machine=i386-pc ;; pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc @@ -1002,16 +1009,16 @@ basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould @@ -1021,23 +1028,23 @@ ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle | ppc-le | powerpc-little) + ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) + ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm @@ -1091,17 +1098,10 @@ sequent) basic_machine=i386-sequent ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; sh5el) basic_machine=sh5le-unknown ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) + simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; @@ -1120,7 +1120,7 @@ os=-sysv4 ;; strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun @@ -1242,6 +1242,9 @@ basic_machine=hppa1.1-winbond os=-proelf ;; + x64) + basic_machine=x86_64-pc + ;; xbox) basic_machine=i686-pc os=-mingw32 @@ -1250,20 +1253,12 @@ basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; none) basic_machine=none-none os=-none @@ -1292,10 +1287,6 @@ vax) basic_machine=vax-dec ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; pdp11) basic_machine=pdp11-dec ;; @@ -1305,9 +1296,6 @@ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; cydra) basic_machine=cydra-cydrome ;; @@ -1327,7 +1315,7 @@ # Make sure to match an already-canonicalized machine name. ;; *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; esac @@ -1335,10 +1323,10 @@ # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` ;; *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` ;; *) ;; @@ -1349,8 +1337,8 @@ if [ x"$os" != x"" ] then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases that might get confused + # with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux @@ -1361,18 +1349,19 @@ -solaris) os=-solaris2 ;; - -svr4*) - os=-sysv4 - ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; - # First accept the basic system types. + # es1800 is here to avoid being matched by es* (a different OS) + -es1800*) + os=-ose + ;; + # Now accept the basic system types. # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. + # Each alternative MUST end in a * to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ @@ -1382,24 +1371,26 @@ | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ + | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -morphos* | -superux* | -rtmk* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ + | -midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1416,12 +1407,12 @@ -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + -sim | -xray | -os68k* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) - os=`echo $os | sed -e 's|mac|macos|'` + os=`echo "$os" | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc @@ -1430,10 +1421,10 @@ os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` + os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` + os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition @@ -1444,12 +1435,6 @@ -wince*) os=-wince ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; -utek*) os=-bsd ;; @@ -1474,7 +1459,7 @@ -nova*) os=-rtmk-nova ;; - -ns2 ) + -ns2) os=-nextstep2 ;; -nsk*) @@ -1496,7 +1481,7 @@ -oss*) os=-sysv3 ;; - -svr4) + -svr4*) os=-sysv4 ;; -svr3) @@ -1511,32 +1496,38 @@ -ose*) os=-ose ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; - -aros*) - os=-aros - ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; + -pikeos*) + # Until real need of OS specific support for + # particular features comes up, bare metal + # configurations are quite functional. + case $basic_machine in + arm*) + os=-eabi + ;; + *) + os=-elf + ;; + esac + ;; -nacl*) ;; + -ios) + ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac @@ -1626,12 +1617,12 @@ sparc-* | *-sun) os=-sunos4.1.1 ;; + pru-*) + os=-elf + ;; *-be) os=-beos ;; - *-haiku) - os=-haiku - ;; *-ibm) os=-aix ;; @@ -1671,7 +1662,7 @@ m88k-omron*) os=-luna ;; - *-next ) + *-next) os=-nextstep ;; *-sequent) @@ -1686,9 +1677,6 @@ i370-*) os=-mvs ;; - *-next) - os=-nextstep3 - ;; *-gould) os=-sysv ;; @@ -1798,15 +1786,15 @@ vendor=stratus ;; esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac -echo $basic_machine$os +echo "$basic_machine$os" exit # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff -Nru mpfr4-3.1.4/configure mpfr4-4.0.2/configure --- mpfr4-3.1.4/configure 2016-03-06 11:33:17.000000000 +0000 +++ mpfr4-4.0.2/configure 2019-01-31 20:43:19.000000000 +0000 @@ -1,9 +1,9 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for MPFR 3.1.4. +# Generated by GNU Autoconf 2.69 for MPFR 4.0.2. # # -# Copyright 1999-2016 Free Software Foundation, Inc. +# Copyright 1999-2019 Free Software Foundation, Inc. # Contributed by the AriC and Caramba projects, INRIA. # # This file is part of the GNU MPFR Library. @@ -20,7 +20,7 @@ # # You should have received a copy of the GNU Lesser General Public License # along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -# http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +# https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # # @@ -609,8 +609,8 @@ # Identity of this package. PACKAGE_NAME='MPFR' PACKAGE_TARNAME='mpfr' -PACKAGE_VERSION='3.1.4' -PACKAGE_STRING='MPFR 3.1.4' +PACKAGE_VERSION='4.0.2' +PACKAGE_STRING='MPFR 4.0.2' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -655,6 +655,16 @@ LTLIBOBJS LIBOBJS DATAFILES +LIBMPFR_LDFLAGS +MPFR_LDFLAGS +TUNE_LIBS +ALLOCA +PTHREAD_CFLAGS +PTHREAD_LIBS +PTHREAD_CC +ax_pthread_config +MPFR_LIBQUADMATH +MPFR_LIBM LT_SYS_LIBRARY_PATH OTOOL64 OTOOL @@ -673,11 +683,6 @@ OBJDUMP DLLTOOL AS -LIBMPFR_LDFLAGS -MPFR_LDFLAGS -TUNE_LIBS -ALLOCA -MPFR_LIBM ac_ct_AR AR CPP @@ -688,7 +693,6 @@ AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE -am__quote am__include DEPDIR OBJEXT @@ -777,7 +781,8 @@ PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR -SHELL' +SHELL +am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking @@ -792,10 +797,11 @@ enable_assert enable_logging enable_thread_safe +enable_shared_cache enable_warnings enable_tests_timeout +enable_tune_for_coverage enable_dependency_tracking -enable_decimal_float enable_shared enable_static with_pic @@ -804,6 +810,11 @@ with_gnu_ld with_sysroot enable_libtool_lock +enable_decimal_float +enable_float128 +enable_mini_gmp +enable_debug_prediction +enable_lto ' ac_precious_vars='build_alias host_alias @@ -1365,7 +1376,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures MPFR 3.1.4 to adapt to many kinds of systems. +\`configure' configures MPFR 4.0.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1436,7 +1447,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of MPFR 3.1.4:";; + short | recursive ) echo "Configuration of MPFR 4.0.2:";; esac cat <<\_ACEOF @@ -1456,21 +1467,38 @@ --disable-thread-safe explicitly disable TLS support --enable-thread-safe build MPFR as thread safe, i.e. with TLS support (the system must support it) [default=autodetect] + --enable-shared-cache enable use of caches shared by all threads, + for all MPFR constants. It usually makes MPFR + dependent on PTHREAD [default=no] --enable-warnings allow MPFR to output warnings to stderr [default=no] - --enable-tests-timeout=NUM enable timeout (NUM seconds) for test programs - (NUM <= 9999) [default=no]; if enabled, env variable - $MPFR_TESTS_TIMEOUT overrides NUM (0: no timeout). + --enable-tests-timeout=NUM + [for developers] enable timeout for test programs + (NUM seconds, <= 9999) [default=no]; if this is + enabled, the environment variable $MPFR_TESTS_TIMEOUT + overrides NUM (0: no timeout) + --enable-tune-for-coverage + [for developers] tune MPFR for coverage tests --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build - --enable-decimal-float build conversion functions from/to decimal floats - [default=no] --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --disable-decimal-float explicitly disable decimal floats support + --enable-decimal-float build conversion functions from/to decimal floats + [default=autodetect] + --disable-float128 explicitly disable __float128 support + --enable-float128 build conversion functions from/to __float128 + [default=autodetect] + --enable-mini-gmp build MPFR with mini-gmp (experimental) [default=no] + --enable-debug-prediction + [for developers] enable debug of branch prediction + (for x86 and x86-64 with GCC, static libs) + --enable-lto build MPFR with link-time-optimization + (experimental) [default: no] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1567,7 +1595,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -MPFR configure 3.1.4 +MPFR configure 4.0.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1575,7 +1603,7 @@ gives unlimited permission to copy, distribute and modify it. -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -1592,7 +1620,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. _ACEOF @@ -1678,48 +1706,6 @@ } # ac_fn_c_try_cpp -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. @@ -1766,98 +1752,83 @@ } # ac_fn_c_try_link -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes + eval "$3=yes" else - ac_header_compiler=no + eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -} # ac_fn_c_check_header_mongrel +} # ac_fn_c_try_run -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 @@ -1867,221 +1838,80 @@ else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$4 -#include <$2> +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main (void) +{ +return $2 (); + ; + return 0; +} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_c_check_header_compile +} # ac_fn_c_check_func -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES +# -------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$5 +$4 int main (void) { -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main (void) -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_member - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main (void) -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main (void) -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_type - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main (void) -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func - -# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES -# -------------------------------------------- -# Tries to find the compile-time value of EXPR in a program that includes -# INCLUDES, setting VAR accordingly. Returns whether the value could be -# computed -ac_fn_c_compute_int () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main (void) -{ -static int test_array [1 - 2 * !(($2) >= 0)]; -test_array [0] = 0; -return test_array [0]; - +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0; +return test_array [0]; + ; return 0; } @@ -2197,8 +2027,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } +static long int longval (void) { return $2; } +static unsigned long int ulongval (void) { return $2; } #include #include int @@ -2244,44 +2074,242 @@ as_fn_set_status $ac_retval } # ac_fn_c_compute_int -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by MPFR $as_me 3.1.4, which was -generated by GNU Autoconf 2.69. Invocation command line was - $ $0 $@ - -_ACEOF -exec 5>>config.log +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () { -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } -_ASUNAME +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES +# ---------------------------------------------------- +# Tries to find if the field MEMBER exists in type AGGR, after including +# INCLUDES, setting cache variable VAR accordingly. +ac_fn_c_check_member () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +$as_echo_n "checking for $2.$3... " >&6; } +if eval \${$4+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main (void) +{ +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main (void) +{ +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + eval "$4=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$4 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_member + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by MPFR $as_me 4.0.2, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. @@ -2597,7 +2625,7 @@ -am__api_version='1.15' +am__api_version='1.16' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do @@ -3112,7 +3140,7 @@ # Define the identity of the package. PACKAGE='mpfr' - VERSION='3.1.4' + VERSION='4.0.2' # Some tools Automake needs. @@ -3133,8 +3161,8 @@ # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# -# +# +# mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The @@ -3185,7 +3213,7 @@ Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . +that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -3503,13 +3531,15 @@ + unset gmp_lib_path GMP_CFLAGS GMP_CC + # Check whether --with-gmp_include was given. if test "${with_gmp_include+set}" = set; then : withval=$with_gmp_include; if test -d "$withval" ; then - local_tmp=`realpath "$withval" 2>/dev/null` + local_tmp=`realpath "$withval" 2>/dev/null` if test "$local_tmp" != "" ; then if test -d "$local_tmp" ; then withval="$local_tmp" @@ -3517,7 +3547,10 @@ withval="$withval" fi else - withval="$withval" + case "$withval" in + [\\/]* | ?:[\\/]* ) withval="$withval" ;; + *) withval="$PWD"/"$withval" ;; + esac fi if test `echo "$withval"|cut -d' ' -f1` != "$withval" ; then as_fn_error $? "\"$withval\" directory shall not contain any space." "$LINENO" 5 @@ -3530,12 +3563,13 @@ fi + # Check whether --with-gmp_lib was given. if test "${with_gmp_lib+set}" = set; then : withval=$with_gmp_lib; if test -d "$withval" ; then - local_tmp=`realpath "$withval" 2>/dev/null` + local_tmp=`realpath "$withval" 2>/dev/null` if test "$local_tmp" != "" ; then if test -d "$local_tmp" ; then withval="$local_tmp" @@ -3543,7 +3577,10 @@ withval="$withval" fi else - withval="$withval" + case "$withval" in + [\\/]* | ?:[\\/]* ) withval="$withval" ;; + *) withval="$PWD"/"$withval" ;; + esac fi if test `echo "$withval"|cut -d' ' -f1` != "$withval" ; then as_fn_error $? "\"$withval\" directory shall not contain any space." "$LINENO" 5 @@ -3558,12 +3595,13 @@ fi + # Check whether --with-gmp was given. if test "${with_gmp+set}" = set; then : withval=$with_gmp; if test -d "$withval" ; then - local_tmp=`realpath "$withval" 2>/dev/null` + local_tmp=`realpath "$withval" 2>/dev/null` if test "$local_tmp" != "" ; then if test -d "$local_tmp" ; then withval="$local_tmp" @@ -3571,7 +3609,10 @@ withval="$withval" fi else - withval="$withval" + case "$withval" in + [\\/]* | ?:[\\/]* ) withval="$withval" ;; + *) withval="$PWD"/"$withval" ;; + esac fi if test `echo "$withval"|cut -d' ' -f1` != "$withval" ; then as_fn_error $? "\"$withval\" directory shall not contain any space." "$LINENO" 5 @@ -3600,7 +3641,7 @@ withval=$with_gmp_build; if test -d "$withval" ; then - local_tmp=`realpath "$withval" 2>/dev/null` + local_tmp=`realpath "$withval" 2>/dev/null` if test "$local_tmp" != "" ; then if test -d "$local_tmp" ; then withval="$local_tmp" @@ -3608,7 +3649,10 @@ withval="$withval" fi else - withval="$withval" + case "$withval" in + [\\/]* | ?:[\\/]* ) withval="$withval" ;; + *) withval="$PWD"/"$withval" ;; + esac fi if test `echo "$withval"|cut -d' ' -f1` != "$withval" ; then as_fn_error $? "\"$withval\" directory shall not contain any space." "$LINENO" 5 @@ -3674,14 +3718,18 @@ yes) $as_echo "#define MPFR_WANT_ASSERT 1" >>confdefs.h ;; + none) +$as_echo "#define MPFR_WANT_ASSERT -1" >>confdefs.h + ;; no) ;; full) $as_echo "#define MPFR_WANT_ASSERT 2" >>confdefs.h ;; - *) as_fn_error $? "bad value for --enable-assert: yes, no or full" "$LINENO" 5 ;; + *) as_fn_error $? "bad value for --enable-assert: yes, no, none or full" "$LINENO" 5 ;; esac fi + # Check whether --enable-logging was given. if test "${enable_logging+set}" = set; then : enableval=$enable_logging; case $enableval in @@ -3693,6 +3741,7 @@ esac fi + # Check whether --enable-thread-safe was given. if test "${enable_thread_safe+set}" = set; then : enableval=$enable_thread_safe; case $enableval in @@ -3702,6 +3751,20 @@ esac fi + +# Check whether --enable-shared-cache was given. +if test "${enable_shared_cache+set}" = set; then : + enableval=$enable_shared_cache; case $enableval in + yes) + +$as_echo "#define MPFR_WANT_SHARED_CACHE 1" >>confdefs.h + ;; + no) ;; + *) as_fn_error $? "bad value for --enable-shared-cache: yes or no" "$LINENO" 5 ;; + esac +fi + + # Check whether --enable-warnings was given. if test "${enable_warnings+set}" = set; then : enableval=$enable_warnings; case $enableval in @@ -3732,6 +3795,44 @@ fi +# Check whether --enable-tune-for-coverage was given. +if test "${enable_tune_for_coverage+set}" = set; then : + enableval=$enable_tune_for_coverage; case $enableval in + no) ;; + yes) +$as_echo "#define MPFR_TUNE_COVERAGE 1" >>confdefs.h + ;; + *) as_fn_error $? "bad value for --enable-tune-for-coverage" "$LINENO" 5 ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether configure options are compatible" >&5 +$as_echo_n "checking whether configure options are compatible... " >&6; } +if test "$enable_logging" = yes; then + if test "$enable_thread_safe" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "enable either logging or thread-safe, not both" "$LINENO" 5 + fi + if test "$enable_shared_cache" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "shared cache does not work with logging support" "$LINENO" 5 + fi + enable_thread_safe=no +fi +if test "$enable_shared_cache" = yes; then + if test "$enable_thread_safe" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "shared cache needs thread-safe support" "$LINENO" 5 + fi + enable_thread_safe=yes +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + @@ -3746,37 +3847,34 @@ # /lib/cpp under Solaris doesn't support some environment variables # used by GCC, such as C_INCLUDE_PATH. If the user has set up such # environment variables, he probably wants to use them. So, let us - # prefer cpp and gcc to /lib/cpp. - for cpp in cpp gcc /lib/cpp cc c99 + # prefer cpp and gcc to /lib/cpp. However, note that this won't + # work if GCC has been installed with versioned names only (e.g. + # with cpp-5 and gcc-5). + for cpp in "cpp -P" "cpp" "gcc -P -E" "gcc -E" "/lib/cpp -P" "/lib/cpp" "cc -P -E" "cc -E" "c99 -P -E" "c99 -E" "clang -E" "cl -E" "icl -E" do - case $cpp in - *cpp*) ;; - *) cpp="$cpp -E" ;; - esac - echo foo > conftest.c - if $cpp $CPPFLAGS conftest.c > /dev/null 2> /dev/null ; then - # Get CC - echo "#include \"gmp.h\"" > conftest.c - echo "MPFR_OPTION __GMP_CC" >> conftest.c - GMP_CC=`$cpp $CPPFLAGS conftest.c 2> /dev/null | $EGREP MPFR_OPTION | $SED -e 's/MPFR_OPTION //g;s/ *" *//g'` - # Get CFLAGS - echo "#include \"gmp.h\"" > conftest.c - echo "MPFR_OPTION __GMP_CFLAGS" >> conftest.c - unset rmpedantic - test "$enable_logging" = yes && rmpedantic='s/[ "]-pedantic[ "]/ /g;' - GMP_CFLAGS=`$cpp $CPPFLAGS conftest.c 2> /dev/null | $EGREP MPFR_OPTION | $SED -e "$rmpedantic"'s/MPFR_OPTION //g;s/ *" *//g'` - break - fi + # Get CC + echo "#include \"gmp.h\"" > conftest.c + echo "MPFR_OPTION __GMP_CC" >> conftest.c + $cpp $CPPFLAGS conftest.c 2> /dev/null > conftest.txt + test $? -ne 0 && continue + GMP_CC=`$EGREP MPFR_OPTION conftest.txt | $SED -e 's/MPFR_OPTION //g;s/ *" *//g'` + # Get CFLAGS + echo "#include \"gmp.h\"" > conftest.c + echo "MPFR_OPTION __GMP_CFLAGS" >> conftest.c + $cpp $CPPFLAGS conftest.c 2> /dev/null > conftest.txt + test $? -ne 0 && continue + GMP_CFLAGS=`$EGREP MPFR_OPTION conftest.txt | $SED -e 's/[ "]-pedantic[ "]/ /g;s/MPFR_OPTION //g;s/ *" *//g'` + break done rm -f conftest* if test "x$GMP_CC" = "x__GMP_CC" || test "x$GMP_CFLAGS" = "x__GMP_CFLAGS" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } GMP_CFLAGS= GMP_CC= else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CC=$GMP_CC CFLAGS=$GMP_CFLAGS" >&5 -$as_echo "yes CC=$GMP_CC CFLAGS=$GMP_CFLAGS" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: CC=$GMP_CC CFLAGS=$GMP_CFLAGS" >&5 +$as_echo "CC=$GMP_CC CFLAGS=$GMP_CFLAGS" >&6; } fi fi @@ -4650,45 +4748,45 @@ ac_config_commands="$ac_config_commands depfiles" - -am_make=${MAKE-make} -cat > confinc << 'END' +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' am__doit: - @echo this is the am__doit target + @echo this is the am__doit target >confinc.out .PHONY: am__doit END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +$as_echo "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : @@ -5155,2418 +5253,2089 @@ esac -# Check whether --enable-decimal-float was given. -if test "${enable_decimal_float+set}" = set; then : - enableval=$enable_decimal_float; case $enableval in - yes) -$as_echo "#define MPFR_WANT_DECIMAL_FLOATS 1" >>confdefs.h +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler knows _Decimal64" >&5 -$as_echo_n "checking if compiler knows _Decimal64... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -_Decimal64 x; -int -main (void) -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - if test "$use_gmp_build" != yes ; then - as_fn_error $? "decimal float support requires --with-gmp-build" "$LINENO" 5 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _GMP_IEEE_FLOATS is defined" >&5 -$as_echo_n "checking if _GMP_IEEE_FLOATS is defined... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include "gmp.h" -#include "gmp-impl.h" -#ifndef _GMP_IEEE_FLOATS -#error "_GMP_IEEE_FLOATS is not defined" -#endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "decimal float support requires _GMP_IEEE_FLOATS" "$LINENO" 5 -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +macro_version='2.4.6' +macro_revision='2.4.6' -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -as_fn_error $? "Compiler doesn't know _Decimal64 (ISO/IEC TR 24732). -Please use another compiler or build MPFR without --enable-decimal-float." "$LINENO" 5 -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking decimal float format" >&5 -$as_echo_n "checking decimal float format... " >&6; } - if test "$cross_compiling" = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: assuming DPD" >&5 -$as_echo "assuming DPD" >&6; } - $as_echo "#define DPD_FORMAT 1" >>confdefs.h -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -volatile _Decimal64 x = 1; -union { double d; _Decimal64 d64; } y; -if (x != x) return 3; -y.d64 = 1234567890123456.0dd; -return y.d == 0.14894469406741037E-123 ? 0 : - y.d == 0.59075095508629822E-68 ? 1 : 2; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: DPD" >&5 -$as_echo "DPD" >&6; } - $as_echo "#define DPD_FORMAT 1" >>confdefs.h -else - case "$?" in - 1) { $as_echo "$as_me:${as_lineno-$LINENO}: result: BID" >&5 -$as_echo "BID" >&6; } ;; - 2) { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "neither DPD nor BID -See \`config.log' for more details" "$LINENO" 5; } ;; - 3) { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "_Decimal64 support is broken. -Please use another compiler or build MPFR without --enable-decimal-float. -See \`config.log' for more details" "$LINENO" 5; } ;; - *) { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "internal error -See \`config.log' for more details" "$LINENO" 5; } ;; - esac -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - ;; - no) ;; - *) as_fn_error $? "bad value for --enable-decimal-float: yes or no" "$LINENO" 5 ;; - esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ICC" >&5 -$as_echo_n "checking for ICC... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if !defined(__ICC) -# error "ICC Not Found" -error -#endif -int -main (void) -{ +ltmain=$ac_aux_dir/ltmain.sh - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - CFLAGS="-fp_port -mp -wd1572 -wd265 -wd186 -wd239 $CFLAGS" +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' -if test "$test_CFLAGS" != set && test -n "$GCC"; then - CFLAGS="-Wpointer-arith $CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the selected language is C++" >&5 -$as_echo_n "checking whether the selected language is C++... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' -#if defined (__cplusplus) -# error "C++" -error -#endif +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' -int -main (void) -{ +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - ; - return 0; +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" } -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - CFLAGS="-Wmissing-prototypes $CFLAGS" +case $ECHO in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - CFLAGS="-Wmissing-declarations -Wno-sign-compare $CFLAGS" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="-Wall $CFLAGS" -fi -case $host in - *-apple-darwin*) - case "$LD $LDFLAGS" in - *-Wl,-search_paths_first*) ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler understands -Wl,-search_paths_first" >&5 -$as_echo_n "checking if the compiler understands -Wl,-search_paths_first... " >&6; } - saved_LDFLAGS="$LDFLAGS" - LDFLAGS="-Wl,-search_paths_first $LDFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int -main (void) -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - LDFLAGS="$saved_LDFLAGS" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ;; - esac - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int -main (void) -{ -#ifndef __cplusplus - /* Ultrix mips cc rejects this sort of thing. */ - typedef int charset[2]; - const charset cs = { 0, 0 }; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *pcpcc; - char **ppc; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - pcpcc = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++pcpcc; - ppc = (char**) pcpcc; - pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this sort of thing. */ - char tx; - char *t = &tx; - char const *s = 0 ? (char *) 0 : (char const *) 0; - *t++ = 0; - if (s) return 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; } bx; - struct s *b = &bx; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - if (!foo) return 0; - } - return !cs[0] && !zero.x; -#endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_const=yes + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 else - ac_cv_c_const=no + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } -if test $ac_cv_c_const = no; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed -$as_echo "#define const /**/" >>confdefs.h +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5 -$as_echo_n "checking for working volatile... " >&6; } -if ${ac_cv_c_volatile+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int -main (void) -{ -volatile int x; -int * volatile y = (int *) 0; -return !x && !y; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_volatile=yes -else - ac_cv_c_volatile=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5 -$as_echo "$ac_cv_c_volatile" >&6; } -if test $ac_cv_c_volatile = no; then -$as_echo "#define volatile /**/" >>confdefs.h -fi -MPFR_LIBM='' -case $host in - *-*-beos* | *-*-cygwin* | *-*-pw32*) - # According to libtool AC CHECK LIBM, these systems don't have libm - ;; - *-*-solaris*) - # On Solaris the math functions new in C99 are in -lm9x. - # FIXME: Do we need -lm9x as well as -lm, or just instead of? - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm9x" >&5 -$as_echo_n "checking for main in -lm9x... " >&6; } -if ${ac_cv_lib_m9x_main+:} false; then : + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm9x $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_FGREP" || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac -int -main (void) -{ -return main (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_m9x_main=yes + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else - ac_cv_lib_m9x_main=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + ac_cv_path_FGREP=$FGREP fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m9x_main" >&5 -$as_echo "$ac_cv_lib_m9x_main" >&6; } -if test "x$ac_cv_lib_m9x_main" = xyes; then : - MPFR_LIBM="-lm9x" + + fi fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5 -$as_echo_n "checking for main in -lm... " >&6; } -if ${ac_cv_lib_m_main+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +test -z "$GREP" && GREP=grep -int -main (void) -{ -return main (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_m_main=yes + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else - ac_cv_lib_m_main=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5 -$as_echo "$ac_cv_lib_m_main" >&6; } -if test "x$ac_cv_lib_m_main" = xyes; then : - MPFR_LIBM="$MPFR_LIBM -lm" + with_gnu_ld=no fi - ;; - *-ncr-sysv4.3*) - # FIXME: What does -lmw mean? Libtool AC CHECK LIBM does it this way. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5 -$as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; } -if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmw $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char _mwvalidcheckl (); -int -main (void) -{ -return _mwvalidcheckl (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_mw__mwvalidcheckl=yes +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } else - ac_cv_lib_mw__mwvalidcheckl=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mw__mwvalidcheckl" >&5 -$as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; } -if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then : - MPFR_LIBM="-lmw" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5 -$as_echo_n "checking for main in -lm... " >&6; } -if ${ac_cv_lib_m_main+:} false; then : +if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -int -main (void) -{ -return main (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_m_main=yes + if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "$ac_cv_lib_m_main" >&6; } -if test "x$ac_cv_lib_m_main" = xyes; then : - MPFR_LIBM="$MPFR_LIBM -lm" fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5 -$as_echo_n "checking for main in -lm... " >&6; } -if ${ac_cv_lib_m_main+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -int -main (void) -{ -return main (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_m_main=yes +LD=$lt_cv_path_LD +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +$as_echo "$LD" >&6; } else - ac_cv_lib_m_main=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5 -$as_echo "$ac_cv_lib_m_main" >&6; } -if test "x$ac_cv_lib_m_main" = xyes; then : - MPFR_LIBM="-lm" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if ${ac_cv_header_time+:} false; then : +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include - -int -main (void) -{ -if ((struct tm *) 0) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_time=yes -else - ac_cv_header_time=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 -$as_echo "$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld -$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -int -main (void) -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : + $as_echo_n "(cached) " >&6 else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM=$NM else - ac_cv_header_stdc=no + lt_nm_to_check=${ac_tool_prefix}nm + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS=$lt_save_ifs + done + : ${lt_cv_path_NM=no} fi -rm -f conftest* - fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF + test -n "$DUMPBIN" && break + done fi - +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi done + done +IFS=$as_save_IFS - -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : - +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF - + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + test -n "$ac_ct_DUMPBIN" && break +done - - - - -ac_fn_c_check_header_mongrel "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" -if test "x$ac_cv_header_limits_h" = xyes; then : - -else - as_fn_error $? "limits.h not found" "$LINENO" 5 + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi fi + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + DUMPBIN=: + ;; + esac + fi -ac_fn_c_check_header_mongrel "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default" -if test "x$ac_cv_header_float_h" = xyes; then : - -else - as_fn_error $? "float.h not found" "$LINENO" 5 + if test : != "$DUMPBIN"; then + NM=$DUMPBIN + fi fi +test -z "$NM" && NM=nm -ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" -if test "x$ac_cv_header_string_h" = xyes; then : -else - as_fn_error $? "string.h not found" "$LINENO" 5 -fi -for ac_header in locale.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default" -if test "x$ac_cv_header_locale_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LOCALE_H 1 -_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if ${lt_cv_nm_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } fi -done +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if ${lt_cv_sys_max_cmd_len+:} false; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring=ABCD + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; -for ac_header in wchar.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default" -if test "x$ac_cv_header_wchar_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_WCHAR_H 1 -_ACEOF + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; -fi + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; -done + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; -ac_fn_c_check_header_mongrel "$LINENO" "stdarg.h" "ac_cv_header_stdarg_h" "$ac_includes_default" -if test "x$ac_cv_header_stdarg_h" = xyes; then : + bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; -$as_echo "#define HAVE_STDARG 1" >>confdefs.h + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; -else - ac_fn_c_check_header_mongrel "$LINENO" "varargs.h" "ac_cv_header_varargs_h" "$ac_includes_default" -if test "x$ac_cv_header_varargs_h" = xyes; then : + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test 17 != "$i" # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi +if test -n "$lt_cv_sys_max_cmd_len"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } else - as_fn_error $? "stdarg.h or varargs.h not found" "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } fi +max_cmd_len=$lt_cv_sys_max_cmd_len -fi -for ac_header in sys/time.h sys/fpu.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false fi -done -ac_fn_c_check_member "$LINENO" "struct lconv" "decimal_point" "ac_cv_member_struct_lconv_decimal_point" "#include -" -if test "x$ac_cv_member_struct_lconv_decimal_point" = xyes; then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_LCONV_DECIMAL_POINT 1 -_ACEOF +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac -fi -ac_fn_c_check_member "$LINENO" "struct lconv" "thousands_sep" "ac_cv_member_struct_lconv_thousands_sep" "#include -" -if test "x$ac_cv_member_struct_lconv_thousands_sep" = xyes; then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_LCONV_THOUSANDS_SEP 1 -_ACEOF -fi -# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works -# for constant arguments. Useless! -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 -$as_echo_n "checking for working alloca.h... " >&6; } -if ${ac_cv_working_alloca_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -char *p = (char *) alloca (2 * sizeof (int)); - if (p) return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_working_alloca_h=yes -else - ac_cv_working_alloca_h=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 -$as_echo "$ac_cv_working_alloca_h" >&6; } -if test $ac_cv_working_alloca_h = yes; then -$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 -$as_echo_n "checking for alloca... " >&6; } -if ${ac_cv_func_alloca_works+:} false; then : - $as_echo_n "(cached) " >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __GNUC__ -# define alloca __builtin_alloca -#else -# ifdef _MSC_VER -# include -# define alloca _alloca -# else -# ifdef HAVE_ALLOCA_H -# include -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -void *alloca (size_t); -# endif -# endif -# endif -# endif -#endif + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac -int -main (void) -{ -char *p = (char *) alloca (1); - if (p) return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_func_alloca_works=yes -else - ac_cv_func_alloca_works=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 -$as_echo "$ac_cv_func_alloca_works" >&6; } - -if test $ac_cv_func_alloca_works = yes; then -$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } -else - # The SVR3 libPW and SVR4 libucb both contain incompatible functions -# that cause trouble. Some versions do not even contain alloca or -# contain a buggy version. If you still want to use their alloca, -# use ar to extract alloca.o from them instead of compiling alloca.c. -ALLOCA=\${LIBOBJDIR}alloca.$ac_objext -$as_echo "#define C_ALLOCA 1" >>confdefs.h -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 -$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } -if ${ac_cv_os_cray+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined CRAY && ! defined CRAY2 -webecray -#else -wenotbecray -#endif + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "webecray" >/dev/null 2>&1; then : - ac_cv_os_cray=yes -else - ac_cv_os_cray=no fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 -$as_echo "$ac_cv_os_cray" >&6; } -if test $ac_cv_os_cray = yes; then - for ac_func in _getb67 GETB67 getb67; do - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } -cat >>confdefs.h <<_ACEOF -#define CRAY_STACKSEG_END $ac_func -_ACEOF - break -fi - done -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 -$as_echo_n "checking stack direction for C alloca... " >&6; } -if ${ac_cv_c_stack_direction+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_c_stack_direction=0 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -find_stack_direction (int *addr, int depth) -{ - int dir, dummy = 0; - if (! addr) - addr = &dummy; - *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; - dir = depth ? find_stack_direction (addr, depth - 1) : 0; - return dir + dummy; -} -int -main (int argc, char **argv) -{ - return find_stack_direction (0, argc + !argv + 20) < 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_c_stack_direction=1 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if ${lt_cv_ld_reload_flag+:} false; then : + $as_echo_n "(cached) " >&6 else - ac_cv_c_stack_direction=-1 -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + lt_cv_ld_reload_flag='-r' fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test yes != "$GCC"; then + reload_cmds=false + fi + ;; + darwin*) + if test yes = "$GCC"; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 -$as_echo "$ac_cv_c_stack_direction" >&6; } -cat >>confdefs.h <<_ACEOF -#define STACK_DIRECTION $ac_cv_c_stack_direction -_ACEOF -fi - for ac_header in stdint.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" -if test "x$ac_cv_header_stdint_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDINT_H 1 -_ACEOF -fi -done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SIZE_MAX" >&5 -$as_echo_n "checking for SIZE_MAX... " >&6; } - if ${gl_cv_size_max+:} false; then : +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - gl_cv_size_max= - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#ifdef HAVE_INTTYPES_H -# include -#endif -#if HAVE_STDINT_H -# include -#endif -#ifdef SIZE_MAX -Found it -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Found it" >/dev/null 2>&1; then : - gl_cv_size_max=yes fi -rm -f conftest* - - if test -z "$gl_cv_size_max"; then - if ac_fn_c_compute_int "$LINENO" "sizeof (size_t) * CHAR_BIT - 1" "size_t_bits_minus_1" "#include -#include "; then : - +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } else - size_t_bits_minus_1= + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - if ac_fn_c_compute_int "$LINENO" "sizeof (size_t) <= sizeof (unsigned int)" "fits_in_uint" "#include "; then : -else - fits_in_uint= fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then - if test $fits_in_uint = 1; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - extern size_t foo; - extern unsigned long foo; - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - fits_in_uint=0 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $fits_in_uint = 1; then - gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" - else - gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" - fi - else - gl_cv_size_max='((size_t)~(size_t)0)' - fi - fi - +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_size_max" >&5 -$as_echo "$gl_cv_size_max" >&6; } - if test "$gl_cv_size_max" != yes; then - -cat >>confdefs.h <<_ACEOF -#define SIZE_MAX $gl_cv_size_max -_ACEOF - + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to copy va_list" >&5 -$as_echo_n "checking how to copy va_list... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include - -int -main (void) -{ - - va_list ap1, ap2; - va_copy(ap1, ap2); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: va_copy" >&5 -$as_echo "va_copy" >&6; } - $as_echo "#define HAVE_VA_COPY 1" >>confdefs.h +test -z "$OBJDUMP" && OBJDUMP=objdump -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ - va_list ap1, ap2; - __va_copy(ap1, ap2); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - $as_echo "#define HAVE___VA_COPY 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: __va_copy" >&5 -$as_echo "__va_copy" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if ${lt_cv_deplibs_check_method+:} false; then : + $as_echo_n "(cached) " >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: memcpy" >&5 -$as_echo "memcpy" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# 'unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# that responds to the $file_magic_cmd with a given extended regex. +# If you have 'file' or equivalent on your system and you're not sure +# whether 'pass_all' will *always* work, you probably want this one. -for ac_func in memmove memset setlocale strtol gettimeofday -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; -fi -done +beos*) + lt_cv_deplibs_check_method=pass_all + ;; +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; -case $host in -alpha*-*-*) - saved_CFLAGS="$CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IEEE-754 switches" >&5 -$as_echo_n "checking for IEEE-754 switches... " >&6; } -if ${mpfr_cv_ieee_switches+:} false; then : - $as_echo_n "(cached) " >&6 -else +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; - if test -n "$GCC"; then - mpfr_cv_ieee_switches="-mfp-rounding-mode=d -mieee-with-inexact" +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' else - mpfr_cv_ieee_switches="-fprm d -ieee_with_inexact" + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' fi - CFLAGS="$CFLAGS $mpfr_cv_ieee_switches" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ + ;; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; -else - mpfr_cv_ieee_switches="none" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_ieee_switches" >&5 -$as_echo "$mpfr_cv_ieee_switches" >&6; } - if test "$mpfr_cv_ieee_switches" = "none"; then - CFLAGS="$saved_CFLAGS" +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac else - CFLAGS="$saved_CFLAGS $mpfr_cv_ieee_switches" + lt_cv_deplibs_check_method=pass_all fi -esac - -ac_fn_c_check_type "$LINENO" "long long int" "ac_cv_type_long_long_int" "$ac_includes_default" -if test "x$ac_cv_type_long_long_int" = xyes; then : + ;; -$as_echo "#define HAVE_LONG_LONG 1" >>confdefs.h +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; -fi +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; -ac_fn_c_check_type "$LINENO" "intmax_t" "ac_cv_type_intmax_t" "$ac_includes_default" -if test "x$ac_cv_type_intmax_t" = xyes; then : +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; -cat >>confdefs.h <<_ACEOF -#define HAVE_INTMAX_T 1 -_ACEOF +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + lt_cv_deplibs_check_method=pass_all + ;; +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; -fi +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; -if test "$ac_cv_type_intmax_t" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working INTMAX_MAX" >&5 -$as_echo_n "checking for working INTMAX_MAX... " >&6; } -if ${mpfr_cv_have_intmax_max+:} false; then : - $as_echo_n "(cached) " >&6 -else +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; - saved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I$srcdir/src" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include "mpfr-intmax.h" -int -main (void) -{ -intmax_t x = INTMAX_MAX; (void) x; +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - mpfr_cv_have_intmax_max=yes -else - mpfr_cv_have_intmax_max=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CPPFLAGS="$saved_CPPFLAGS" +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_have_intmax_max" >&5 -$as_echo "$mpfr_cv_have_intmax_max" >&6; } - if test "$mpfr_cv_have_intmax_max" = "yes"; then +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; -$as_echo "#define MPFR_HAVE_INTMAX_MAX 1" >>confdefs.h +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; - fi -fi +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; -ac_fn_c_check_type "$LINENO" "union fpc_csr" "ac_cv_type_union_fpc_csr" " -#if HAVE_SYS_FPU_H -# include -#endif +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; -" -if test "x$ac_cv_type_union_fpc_csr" = xyes; then : +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac -$as_echo "#define HAVE_FPC_CSR 1" >>confdefs.h +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac fi +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fesetround" >&5 -$as_echo_n "checking for fesetround... " >&6; } -if ${mpfr_cv_have_fesetround+:} false; then : - $as_echo_n "(cached) " >&6 -else -saved_LIBS="$LIBS" -LIBS="$LIBS $MPFR_LIBM" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -fesetround(FE_TONEAREST); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - mpfr_cv_have_fesetround=yes -else - mpfr_cv_have_fesetround=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS="$saved_LIBS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_have_fesetround" >&5 -$as_echo "$mpfr_cv_have_fesetround" >&6; } -if test "$mpfr_cv_have_fesetround" = "yes"; then -$as_echo "#define MPFR_HAVE_FESETROUND 1" >>confdefs.h -fi -if test -n "$GCC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc float-conversion bug" >&5 -$as_echo_n "checking for gcc float-conversion bug... " >&6; } -if ${mpfr_cv_gcc_floatconv_bug+:} false; then : - $as_echo_n "(cached) " >&6 -else - saved_LIBS="$LIBS" - LIBS="$LIBS $MPFR_LIBM" - if test "$cross_compiling" = yes; then : - mpfr_cv_gcc_floatconv_bug="cannot test, use -ffloat-store" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#ifdef MPFR_HAVE_FESETROUND -#include -#endif -static double get_max (void); -int main (void) { - double x = 0.5; - double y; - int i; - for (i = 1; i <= 11; i++) - x *= x; - if (x != 0) - return 1; -#ifdef MPFR_HAVE_FESETROUND - /* Useful test for the G4 PowerPC */ - fesetround(FE_TOWARDZERO); - x = y = get_max (); - x *= 2.0; - if (x != y) - return 1; -#endif - return 0; -} -static double get_max (void) { static volatile double d = DBL_MAX; return d; } -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - mpfr_cv_gcc_floatconv_bug="no" -else - mpfr_cv_gcc_floatconv_bug="yes, use -ffloat-store" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - LIBS="$saved_LIBS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_gcc_floatconv_bug" >&5 -$as_echo "$mpfr_cv_gcc_floatconv_bug" >&6; } - if test "$mpfr_cv_gcc_floatconv_bug" != "no"; then - CFLAGS="$CFLAGS -ffloat-store" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for subnormal numbers" >&5 -$as_echo_n "checking for subnormal numbers... " >&6; } -if ${mpfr_cv_have_denorms+:} false; then : - $as_echo_n "(cached) " >&6 -else -if test "$cross_compiling" = yes; then : - mpfr_cv_have_denorms="cannot test, assume no" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int main (void) { - double x = 2.22507385850720138309e-308; - fprintf (stderr, "%e\n", x / 2.0); - return 2.0 * (x / 2.0) != x; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - mpfr_cv_have_denorms="yes" -else - mpfr_cv_have_denorms="no" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_have_denorms" >&5 -$as_echo "$mpfr_cv_have_denorms" >&6; } -if test "$mpfr_cv_have_denorms" = "yes"; then -$as_echo "#define HAVE_DENORMS 1" >>confdefs.h -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for signed zeros" >&5 -$as_echo_n "checking for signed zeros... " >&6; } -if ${mpfr_cv_have_signedz+:} false; then : - $as_echo_n "(cached) " >&6 -else -if test "$cross_compiling" = yes; then : - mpfr_cv_have_signedz="cannot test, assume no" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main (void) { - return 1.0 / 0.0 == 1.0 / -0.0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - mpfr_cv_have_signedz="yes" +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 else - mpfr_cv_have_signedz="no" + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext fi - - +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_have_signedz" >&5 -$as_echo "$mpfr_cv_have_signedz" >&6; } -if test "$mpfr_cv_have_signedz" = "yes"; then -$as_echo "#define HAVE_SIGNEDZ 1" >>confdefs.h fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the FP division by 0 fails" >&5 -$as_echo_n "checking if the FP division by 0 fails... " >&6; } -if ${mpfr_cv_errdivzero+:} false; then : +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else - -if test "$cross_compiling" = yes; then : - mpfr_cv_errdivzero="cannot test, assume no" + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main (void) { - volatile double d = 0.0, x; - x = 0.0 / d; - x = 1.0 / d; - (void) x; - return 0; -} +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - mpfr_cv_errdivzero="no" -else - mpfr_cv_errdivzero="yes" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext fi - - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_errdivzero" >&5 -$as_echo "$mpfr_cv_errdivzero" >&6; } -if test "$mpfr_cv_errdivzero" = "yes"; then - -$as_echo "#define MPFR_ERRDIVZERO 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The floating-point division by 0 fails instead of" >&5 -$as_echo "$as_me: WARNING: The floating-point division by 0 fails instead of" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: returning a special value: NaN or infinity. Tests" >&5 -$as_echo "$as_me: WARNING: returning a special value: NaN or infinity. Tests" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: involving a FP division by 0 will be disabled." >&5 -$as_echo "$as_me: WARNING: involving a FP division by 0 will be disabled." >&2;} +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if NAN == NAN" >&5 -$as_echo_n "checking if NAN == NAN... " >&6; } -if ${mpfr_cv_nanisnan+:} false; then : - $as_echo_n "(cached) " >&6 + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi -if test "$cross_compiling" = yes; then : - mpfr_cv_nanisnan="cannot test, assume no" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +test -z "$DLLTOOL" && DLLTOOL=dlltool -#include -#include -#ifndef NAN -# define NAN (0.0/0.0) -#endif -int main (void) { - double d; - d = NAN; - return d != d; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - mpfr_cv_nanisnan="yes" -else - mpfr_cv_nanisnan="no" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_nanisnan" >&5 -$as_echo "$mpfr_cv_nanisnan" >&6; } -if test "$mpfr_cv_nanisnan" = "yes"; then -$as_echo "#define MPFR_NANISNAN 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The test NAN != NAN is false. The probable reason is that" >&5 -$as_echo "$as_me: WARNING: The test NAN != NAN is false. The probable reason is that" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: your compiler optimizes floating-point expressions in an" >&5 -$as_echo "$as_me: WARNING: your compiler optimizes floating-point expressions in an" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unsafe way because some option, such as -ffast-math or" >&5 -$as_echo "$as_me: WARNING: unsafe way because some option, such as -ffast-math or" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: -fast (depending on the compiler), has been used. You" >&5 -$as_echo "$as_me: WARNING: -fast (depending on the compiler), has been used. You" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: should NOT use such an option, otherwise MPFR functions" >&5 -$as_echo "$as_me: WARNING: should NOT use such an option, otherwise MPFR functions" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: such as mpfr_get_d and mpfr_set_d may return incorrect" >&5 -$as_echo "$as_me: WARNING: such as mpfr_get_d and mpfr_set_d may return incorrect" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: results on special FP numbers (e.g. NaN or signed zeros)." >&5 -$as_echo "$as_me: WARNING: results on special FP numbers (e.g. NaN or signed zeros)." >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: If you did not use such an option, please send us a bug" >&5 -$as_echo "$as_me: WARNING: If you did not use such an option, please send us a bug" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: report so that we can try to find a workaround for your" >&5 -$as_echo "$as_me: WARNING: report so that we can try to find a workaround for your" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: platform and/or document the behavior." >&5 -$as_echo "$as_me: WARNING: platform and/or document the behavior." >&2;} -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if charset has consecutive values" >&5 -$as_echo_n "checking if charset has consecutive values... " >&6; } -if test "$cross_compiling" = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot test" >&5 -$as_echo "cannot test" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -char *number = "0123456789"; -char *lower = "abcdefghijklmnopqrstuvwxyz"; -char *upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + lt_cv_sharedlib_from_linklib_cmd='unknown' -int -main (void) -{ +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd=$ECHO + ;; +esac - int i; - unsigned char *p; - for (p = (unsigned char*) number, i = 0; i < 9; i++) - if ( (*p)+1 != *(p+1) ) return 1; - for (p = (unsigned char*) lower, i = 0; i < 25; i++) - if ( (*p)+1 != *(p+1) ) return 1; - for (p = (unsigned char*) upper, i = 0; i < 25; i++) - if ( (*p)+1 != *(p+1) ) return 1; +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "#define MPFR_NO_CONSECUTIVE_CHARSET 1" >>confdefs.h -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -saved_LIBS="$LIBS" -LIBS="$LIBS $MPFR_LIBM" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for math/round" >&5 -$as_echo_n "checking for math/round... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -static int f (double (*func)(double)) { return 0; } - -int -main (void) -{ - - return f(round); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_ROUND 1" >>confdefs.h - +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for math/trunc" >&5 -$as_echo_n "checking for math/trunc... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -static int f (double (*func)(double)) { return 0; } -int -main (void) -{ - - return f(trunc); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_TRUNC 1" >>confdefs.h + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for math/floor" >&5 -$as_echo_n "checking for math/floor... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -static int f (double (*func)(double)) { return 0; } - -int -main (void) -{ - return f(floor); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : + test -n "$ac_ct_AR" && break +done - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi -$as_echo "#define HAVE_FLOOR 1" >>confdefs.h +: ${AR=ar} +: ${AR_FLAGS=cru} -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for math/ceil" >&5 -$as_echo_n "checking for math/ceil... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -static int f (double (*func)(double)) { return 0; } -int -main (void) -{ - return f(ceil); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -$as_echo "#define HAVE_CEIL 1" >>confdefs.h +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for math/nearbyint" >&5 -$as_echo_n "checking for math/nearbyint... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -static int f (double (*func)(double)) { return 0; } - int main (void) { - return f(nearbyint); - ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test 0 -eq "$ac_status"; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test 0 -ne "$ac_status"; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a -$as_echo "#define HAVE_NEARBYINT 1" >>confdefs.h +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } +if test no = "$lt_cv_ar_at_file"; then + archiver_list_spec= else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + archiver_list_spec=$lt_cv_ar_at_file fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -LIBS="$saved_LIBS" -ac_fn_c_check_type "$LINENO" "long double" "ac_cv_type_long_double" "$ac_includes_default" -if test "x$ac_cv_type_long_double" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_LONG_DOUBLE 1 -_ACEOF -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking format of \`long double' floating point" >&5 -$as_echo_n "checking format of \`long double' floating point... " >&6; } -if ${mpfr_cv_c_long_double_format+:} false; then : +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else - mpfr_cv_c_long_double_format=unknown -if test "$ac_cv_type_long_double" != yes; then - mpfr_cv_c_long_double_format="not available" + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else - cat >conftest.c <<\EOF - -/* "before" is 16 bytes to ensure there's no padding between it and "x". - We're not expecting any "long double" bigger than 16 bytes or with - alignment requirements stricter than 16 bytes. */ -struct { - char before[16]; - long double x; - char after[8]; -} foo = { - { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', - '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' }, - -123456789.0, - { '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' } -}; +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -EOF - mpfr_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >&5 2>&1" - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$mpfr_compile\""; } >&5 - (eval $mpfr_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - cat >conftest.awk <<\EOF +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -BEGIN { - found = 0 -} -# got[] holds a sliding window of bytes read the input. got[0] is the most -# recent byte read, and got[31] the oldest byte read, so when looking to -# match some data the indices are "reversed". -# -{ - for (f = 2; f <= NF; f++) - { - # new byte, shift others up - for (i = 31; i >= 0; i--) - got[i+1] = got[i]; - got[0] = $f; +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - # end sequence - if (got[7] != "376") continue - if (got[6] != "334") continue - if (got[5] != "272") continue - if (got[4] != "230") continue - if (got[3] != "166") continue - if (got[2] != "124") continue - if (got[1] != "062") continue - if (got[0] != "020") continue +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - # start sequence, with 8-byte body - if (got[23] == "001" && \ - got[22] == "043" && \ - got[21] == "105" && \ - got[20] == "147" && \ - got[19] == "211" && \ - got[18] == "253" && \ - got[17] == "315" && \ - got[16] == "357") - { - saw = " (" got[15] \ - " " got[14] \ - " " got[13] \ - " " got[12] \ - " " got[11] \ - " " got[10] \ - " " got[9] \ - " " got[8] ")" + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi - if (got[15] == "301" && \ - got[14] == "235" && \ - got[13] == "157" && \ - got[12] == "064" && \ - got[11] == "124" && \ - got[10] == "000" && \ - got[9] == "000" && \ - got[8] == "000") - { - print "IEEE double, big endian" - found = 1 - exit - } +test -z "$STRIP" && STRIP=: - if (got[15] == "000" && \ - got[14] == "000" && \ - got[13] == "000" && \ - got[12] == "124" && \ - got[11] == "064" && \ - got[10] == "157" && \ - got[9] == "235" && \ - got[8] == "301") - { - print "IEEE double, little endian" - found = 1 - exit - } - } - # start sequence, with 12-byte body - if (got[27] == "001" && \ - got[26] == "043" && \ - got[25] == "105" && \ - got[24] == "147" && \ - got[23] == "211" && \ - got[22] == "253" && \ - got[21] == "315" && \ - got[20] == "357") - { - saw = " (" got[19] \ - " " got[18] \ - " " got[17] \ - " " got[16] \ - " " got[15] \ - " " got[14] \ - " " got[13] \ - " " got[12] \ - " " got[11] \ - " " got[10] \ - " " got[9] \ - " " got[8] ")" - if (got[19] == "000" && \ - got[18] == "000" && \ - got[17] == "000" && \ - got[16] == "000" && \ - got[15] == "240" && \ - got[14] == "242" && \ - got[13] == "171" && \ - got[12] == "353" && \ - got[11] == "031" && \ - got[10] == "300") - { - print "IEEE extended, little endian" - found = 1 - exit - } - if (got[19] == "300" && \ - got[18] == "031" && \ - got[17] == "000" && \ - got[16] == "000" && \ - got[15] == "353" && \ - got[14] == "171" && \ - got[13] == "242" && \ - got[12] == "240" && \ - got[11] == "000" && \ - got[10] == "000" && \ - got[09] == "000" && \ - got[08] == "000") - { - # format found on m68k - print "IEEE extended, big endian" - found = 1 - exit - } - } - # start sequence, with 16-byte body - if (got[31] == "001" && \ - got[30] == "043" && \ - got[29] == "105" && \ - got[28] == "147" && \ - got[27] == "211" && \ - got[26] == "253" && \ - got[25] == "315" && \ - got[24] == "357") - { - saw = " (" got[23] \ - " " got[22] \ - " " got[21] \ - " " got[20] \ - " " got[19] \ - " " got[18] \ - " " got[17] \ - " " got[16] \ - " " got[15] \ - " " got[14] \ - " " got[13] \ - " " got[12] \ - " " got[11] \ - " " got[10] \ - " " got[9] \ - " " got[8] ")" - if (got[23] == "000" && \ - got[22] == "000" && \ - got[21] == "000" && \ - got[20] == "000" && \ - got[19] == "240" && \ - got[18] == "242" && \ - got[17] == "171" && \ - got[16] == "353" && \ - got[15] == "031" && \ - got[14] == "300") - { - print "IEEE extended, little endian" - found = 1 - exit - } +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - if (got[23] == "300" && \ - got[22] == "031" && \ - got[21] == "326" && \ - got[20] == "363" && \ - got[19] == "105" && \ - got[18] == "100" && \ - got[17] == "000" && \ - got[16] == "000" && \ - got[15] == "000" && \ - got[14] == "000" && \ - got[13] == "000" && \ - got[12] == "000" && \ - got[11] == "000" && \ - got[10] == "000" && \ - got[9] == "000" && \ - got[8] == "000") - { - # format used on HP 9000/785 under HP-UX - print "IEEE quad, big endian" - found = 1 - exit - } +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - if (got[23] == "000" && \ - got[22] == "000" && \ - got[21] == "000" && \ - got[20] == "000" && \ - got[19] == "000" && \ - got[18] == "000" && \ - got[17] == "000" && \ - got[16] == "000" && \ - got[15] == "000" && \ - got[14] == "000" && \ - got[13] == "100" && \ - got[12] == "105" && \ - got[11] == "363" && \ - got[10] == "326" && \ - got[9] == "031" && \ - got[8] == "300") - { - print "IEEE quad, little endian" - found = 1 - exit - } - if (got[23] == "301" && \ - got[22] == "235" && \ - got[21] == "157" && \ - got[20] == "064" && \ - got[19] == "124" && \ - got[18] == "000" && \ - got[17] == "000" && \ - got[16] == "000" && \ - got[15] == "000" && \ - got[14] == "000" && \ - got[13] == "000" && \ - got[12] == "000" && \ - got[11] == "000" && \ - got[10] == "000" && \ - got[9] == "000" && \ - got[8] == "000") - { - # format used on 32-bit PowerPC (Mac OS X and Debian GNU/Linux) - print "possibly double-double, big endian" - found = 1 - exit - } - } - } -} +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -END { - if (! found) - print "unknown", saw -} +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -EOF - mpfr_cv_c_long_double_format=`od -b conftest.$OBJEXT | $AWK -f conftest.awk` - case $mpfr_cv_c_long_double_format in - unknown*) - echo "cannot match anything, conftest.$OBJEXT contains" >&5 - od -b conftest.$OBJEXT >&5 - ;; - esac + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: oops, cannot compile test program" >&5 -$as_echo "$as_me: WARNING: oops, cannot compile test program" >&2;} + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB fi +else + RANLIB="$ac_cv_prog_RANLIB" fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_c_long_double_format" >&5 -$as_echo "$mpfr_cv_c_long_double_format" >&6; } +test -z "$RANLIB" && RANLIB=: -case $mpfr_cv_c_long_double_format in - "IEEE extended, little endian") - $as_echo "#define HAVE_LDOUBLE_IEEE_EXT_LITTLE 1" >>confdefs.h - ;; - "IEEE quad, big endian") - $as_echo "#define HAVE_LDOUBLE_IEEE_QUAD_BIG 1" >>confdefs.h - ;; - "IEEE quad, little endian") - $as_echo "#define HAVE_LDOUBLE_IEEE_QUAD_LITTLE 1" >>confdefs.h - ;; - "possibly double-double, big endian") - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This format is known on GCC/PowerPC platforms," >&5 -$as_echo "$as_me: WARNING: This format is known on GCC/PowerPC platforms," >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: but due to GCC PR26374, we can't test further." >&5 -$as_echo "$as_me: WARNING: but due to GCC PR26374, we can't test further." >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You can safely ignore this warning, though." >&5 -$as_echo "$as_me: WARNING: You can safely ignore this warning, though." >&2;} - # Since we are not sure, we do not want to define a macro. - ;; - unknown* | "not available") +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + bitrig* | openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: oops, unrecognised float format: $mpfr_cv_c_long_double_format" >&5 -$as_echo "$as_me: WARNING: oops, unrecognised float format: $mpfr_cv_c_long_double_format" >&2;} + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; esac -if test "$enable_logging" = yes; then - if test "$enable_thread_safe" = yes; then - as_fn_error $? "Enable either \`Logging' or \`thread-safe', not both" "$LINENO" 5 - else - enable_thread_safe=no - fi -fi -if test "$enable_thread_safe" != no; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TLS support using C11" >&5 -$as_echo_n "checking for TLS support using C11... " >&6; } -saved_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS -I$srcdir/src" -if test "$cross_compiling" = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot test, assume no" >&5 -$as_echo "cannot test, assume no" >&6; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define MPFR_USE_THREAD_SAFE 1 -#define MPFR_USE_C11_THREAD_SAFE 1 -#include "mpfr-thread.h" -MPFR_THREAD_ATTR int x = 17; -int main (void) { - return x != 17; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -$as_echo "#define MPFR_USE_THREAD_SAFE 1" >>confdefs.h -$as_echo "#define MPFR_USE_C11_THREAD_SAFE 1" >>confdefs.h - tls_c11_support=yes -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -CPPFLAGS="$saved_CPPFLAGS" - -if test "$tls_c11_support" != "yes" -then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TLS support" >&5 -$as_echo_n "checking for TLS support... " >&6; } - saved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I$srcdir/src" - if test "$cross_compiling" = yes; then : - if test "$enable_thread_safe" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot test, assume yes" >&5 -$as_echo "cannot test, assume yes" >&6; } -$as_echo "#define MPFR_USE_THREAD_SAFE 1" >>confdefs.h - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot test, assume no" >&5 -$as_echo "cannot test, assume no" >&6; } - fi -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - #define MPFR_USE_THREAD_SAFE 1 - #include "mpfr-thread.h" - MPFR_THREAD_ATTR int x = 17; - int main (void) { - return x != 17; - } -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -$as_echo "#define MPFR_USE_THREAD_SAFE 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - if test "$enable_thread_safe" = yes; then - as_fn_error $? "please configure with --disable-thread-safe" "$LINENO" 5 - fi -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - CPPFLAGS="$saved_CPPFLAGS" - fi -fi -# (Based on GMP 5.1) -# clock_gettime is in librt on *-*-osf5.1 and on glibc < 2.17, so add -lrt to -# TUNE_LIBS if needed (e.g. if clock_gettime is not already in the C library). -# On linux (tested on x86_32, 2.6.26), clock_getres reports ns accuracy, -# while in a quick test on osf, clock_getres said only 1 millisecond. -old_LIBS="$LIBS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 -$as_echo_n "checking for library containing clock_gettime... " >&6; } -if ${ac_cv_search_clock_gettime+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char clock_gettime (); -int -main (void) -{ -return clock_gettime (); - ; - return 0; -} -_ACEOF -for ac_lib in '' rt; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_clock_gettime=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_clock_gettime+:} false; then : - break -fi -done -if ${ac_cv_search_clock_gettime+:} false; then : -else - ac_cv_search_clock_gettime=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 -$as_echo "$ac_cv_search_clock_gettime" >&6; } -ac_res=$ac_cv_search_clock_gettime -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" -$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h -fi -TUNE_LIBS="$LIBS" -LIBS="$old_LIBS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gmp.h" >&5 -$as_echo_n "checking for gmp.h... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include "gmp.h" -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "gmp.h can't be found, or is unusable." "$LINENO" 5 -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} +# Allow CC to be a program name with arguments. +compiler=$CC -case `pwd` in - *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if ${lt_cv_sys_global_symbol_pipe+:} false; then : + $as_echo_n "(cached) " >&6 +else +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] -macro_version='2.4.6' -macro_revision='2.4.6' +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test ia64 = "$host_cpu"; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function, + # D for any global variable and I for any imported variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + # Check to see that the pipe works correctly. + pipe_works=no -ltmain=$ac_aux_dir/ltmain.sh + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF -# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&5 + if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&5 && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' +#ifdef __cplusplus +extern "C" { +#endif -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' + cat <<_LT_EOF >> conftest.$ac_ext -ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -$as_echo_n "checking how to print strings... " >&6; } -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS=conftstm.$ac_objext + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test yes = "$pipe_works"; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } fi -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "" -} +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi -case $ECHO in - printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -$as_echo "printf" >&6; } ;; - print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -$as_echo "print -r" >&6; } ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -$as_echo "cat" >&6; } ;; -esac @@ -7581,77 +7350,9 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} - if test -z "$SED"; then - ac_path_SED_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_SED" || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - $ac_path_SED_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 - fi -else - ac_cv_path_SED=$SED -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" @@ -7663,77 +7364,6 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if ${ac_cv_path_FGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - if test -z "$FGREP"; then - ac_path_FGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_FGREP" || continue -# Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_FGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_FGREP"; then - as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_FGREP=$FGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" - - -test -z "$GREP" && GREP=grep - - - @@ -7742,116 +7372,102 @@ +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi +lt_sysroot= +case $with_sysroot in #( + yes) + if test yes = "$GCC"; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 +$as_echo "$with_sysroot" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes -else - with_gnu_ld=no -fi -ac_prog=ld -if test yes = "$GCC"; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return, which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD=$ac_prog - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test yes = "$with_gnu_ld"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${lt_cv_path_LD+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 +$as_echo_n "checking for a working dd... " >&6; } +if ${ac_cv_path_lt_DD+:} false; then : $as_echo_n "(cached) " >&6 else - if test -z "$LD"; then - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD=$ac_dir/$ac_prog - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +if test -z "$lt_DD"; then + ac_path_lt_DD_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in dd; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_lt_DD" || continue +if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi + $ac_path_lt_DD_found && break 3 + done done - IFS=$lt_save_ifs + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_lt_DD"; then + : + fi else - lt_cv_path_LD=$LD # Let the user override the test with a path. -fi + ac_cv_path_lt_DD=$lt_DD fi -LD=$lt_cv_path_LD -if test -n "$LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +rm -f conftest.i conftest2.i conftest.out fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 +$as_echo "$ac_cv_path_lt_DD" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 +$as_echo_n "checking how to truncate binary pipes... " >&6; } +if ${lt_cv_truncate_bin+:} false; then : $as_echo_n "(cached) " >&6 else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 +$as_echo "$lt_cv_truncate_bin" >&6; } @@ -7859,528 +7475,597 @@ +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if ${lt_cv_path_NM+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM=$NM -else - lt_nm_to_check=${ac_tool_prefix}nm - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - tmp_nm=$ac_dir/$lt_tmp_nm - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the 'sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty - case $build_os in - mingw*) lt_bad_file=conftest.nm/nofile ;; - *) lt_bad_file=/dev/null ;; - esac - case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in - *$lt_bad_file* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break 2 - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break 2 - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS=$lt_save_ifs - done - : ${lt_cv_path_NM=no} -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -if test no != "$lt_cv_path_NM"; then - NM=$lt_cv_path_NM -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - if test -n "$ac_tool_prefix"; then - for ac_prog in dumpbin "link -dump" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DUMPBIN"; then - ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DUMPBIN=$ac_cv_prog_DUMPBIN -if test -n "$DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -$as_echo "$DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - +test no = "$enable_libtool_lock" || enable_libtool_lock=yes - test -n "$DUMPBIN" && break - done -fi -if test -z "$DUMPBIN"; then - ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in dumpbin "link -dump" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DUMPBIN"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out what ABI is being produced by ac_compile, and set mode + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE=32 + ;; + *ELF-64*) + HPUX_IA64_MODE=64 + ;; + esac fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN -if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -$as_echo "$ac_ct_DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_DUMPBIN" && break -done - - if test "x$ac_ct_DUMPBIN" = x; then - DUMPBIN=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DUMPBIN=$ac_ct_DUMPBIN + rm -rf conftest* + ;; +*-*-irix6*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test yes = "$lt_cv_prog_gnu_ld"; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi fi -fi + rm -rf conftest* + ;; - case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols -headers" - ;; - *) - DUMPBIN=: - ;; +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + emul=elf + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; esac + case `/usr/bin/file conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" fi + rm -rf conftest* + ;; - if test : != "$DUMPBIN"; then - NM=$DUMPBIN - fi -fi -test -z "$NM" && NM=nm - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -$as_echo_n "checking the name lister ($NM) interface... " >&6; } -if ${lt_cv_nm_interface+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: output\"" >&5) - cat conftest.out >&5 - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -$as_echo "$lt_cv_nm_interface" >&6; } + rm -rf conftest* + ;; -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if ${lt_cv_cc_needs_belf+:} false; then : + $as_echo_n "(cached) " >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -# find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : - $as_echo_n "(cached) " >&6 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes else - i=0 - teststring=ABCD + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test yes != "$lt_cv_cc_needs_belf"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS=$SAVE_CFLAGS + fi + ;; +*-*solaris*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*|x86_64-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD=${LD-ld}_sol2 + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; +need_locks=$enable_libtool_lock - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - os2*) - # The test takes a long time on OS/2. - lt_cv_sys_max_cmd_len=8192 - ;; +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len" && \ - test undefined != "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test X`env echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test 17 != "$i" # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi -if test -n "$lt_cv_sys_max_cmd_len"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test yes != "$lt_cv_path_mainfest_tool"; then + MANIFEST_TOOL=: fi -max_cmd_len=$lt_cv_sys_max_cmd_len -: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } else - lt_unset=false + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -$as_echo_n "checking how to convert $build file names to $host format... " >&6; } -if ${lt_cv_to_host_file_cmd+:} false; then : + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else - case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS fi - -to_host_file_cmd=$lt_cv_to_host_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 -$as_echo "$lt_cv_to_host_file_cmd" >&6; } - - - +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 -$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } -if ${lt_cv_to_tool_file_cmd+:} false; then : +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else - #assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS fi - -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 -$as_echo "$lt_cv_to_tool_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : - $as_echo_n "(cached) " >&6 +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } else - lt_cv_ld_reload_flag='-r' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - if test yes != "$GCC"; then - reload_cmds=false - fi - ;; - darwin*) - if test yes = "$GCC"; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - - - - - - - + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : +if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -8389,7 +8074,7 @@ test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -8399,10 +8084,10 @@ fi fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -8410,17 +8095,17 @@ fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -8429,7 +8114,7 @@ test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" + ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -8439,17 +8124,17 @@ fi fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" + if test "x$ac_ct_LIPO" = x; then + LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -8457,271 +8142,22 @@ $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - OBJDUMP=$ac_ct_OBJDUMP + LIPO=$ac_ct_LIPO fi else - OBJDUMP="$ac_cv_prog_OBJDUMP" + LIPO="$ac_cv_prog_LIPO" fi -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -$as_echo_n "checking how to recognize dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# 'unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# that responds to the $file_magic_cmd with a given extended regex. -# If you have 'file' or equivalent on your system and you're not sure -# whether 'pass_all' will *always* work, you probably want this one. - -case $host_os in -aix[4-9]*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[3-9]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd* | bitrig*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -os2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` - fi - ;; - esac -fi - -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - - - - - - - - - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -8730,7 +8166,7 @@ test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -8740,28 +8176,28 @@ fi fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -8770,7 +8206,7 @@ test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" + ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -8780,17 +8216,17 @@ fi fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -8798,70 +8234,22 @@ $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - DLLTOOL=$ac_ct_DLLTOOL + OTOOL=$ac_ct_OTOOL fi else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - -test -z "$DLLTOOL" && DLLTOOL=dlltool - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 -$as_echo_n "checking how to associate runtime and link libraries... " >&6; } -if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh; - # decide which one to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd=$ECHO - ;; -esac - + OTOOL="$ac_cv_prog_OTOOL" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 -$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - - - - - - -if test -n "$ac_tool_prefix"; then - for ac_prog in ar - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : +if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -8870,7 +8258,7 @@ test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -8880,32 +8268,28 @@ fi fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$AR" && break - done fi -if test -z "$AR"; then - ac_ct_AR=$AR - for ac_prog in ar -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -8914,7 +8298,7 @@ test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="$ac_prog" + ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -8924,21 +8308,17 @@ fi fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - - test -n "$ac_ct_AR" && break -done - - if test "x$ac_ct_AR" = x; then - AR="false" + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -8946,12 +8326,12 @@ $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - AR=$ac_ct_AR + OTOOL64=$ac_ct_OTOOL64 fi +else + OTOOL64="$ac_cv_prog_OTOOL64" fi -: ${AR=ar} -: ${AR_FLAGS=cru} @@ -8963,57 +8343,11 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 -$as_echo_n "checking for archiver @FILE support... " >&6; } -if ${lt_cv_ar_at_file+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ar_at_file=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int -main (void) -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test 0 -eq "$ac_status"; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test 0 -ne "$ac_status"; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 -$as_echo "$lt_cv_ar_at_file" >&6; } -if test no = "$lt_cv_ar_at_file"; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi @@ -9021,155 +8355,344 @@ -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi + lt_cv_apple_cc_single_mod=no + if test -z "$LT_MULTI_MODULE"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test 0 = "$_lt_result"; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if ${lt_cv_ld_exported_symbols_list+:} false; then : + $as_echo_n "(cached) " >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes else - STRIP="$ac_cv_prog_STRIP" + lt_cv_ld_exported_symbols_list=no fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS -test -z "$STRIP" && STRIP=: - +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 10.[012][,.]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test yes = "$lt_cv_apple_cc_single_mod"; then + _lt_dar_single_mod='$single_module' + fi + if test yes = "$lt_cv_ld_exported_symbols_list"; then + _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' + fi + if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + ac_cv_header_stdc=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + + + +# Set options +enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. +set dummy ${ac_tool_prefix}as; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AS+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -9178,7 +8701,7 @@ test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" + ac_cv_prog_AS="${ac_tool_prefix}as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -9188,17 +8711,57 @@ fi fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } +AS=$ac_cv_prog_AS +if test -n "$AS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 +$as_echo "$AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" + +fi +if test -z "$ac_cv_prog_AS"; then + ac_ct_AS=$AS + # Extract the first word of "as", so it can be a program name with args. +set dummy as; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AS+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AS"; then + ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AS="as" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AS=$ac_cv_prog_ac_ct_AS +if test -n "$ac_ct_AS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 +$as_echo "$ac_ct_AS" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AS" = x; then + AS="false" else case $cross_compiling:$ac_tool_warned in yes:) @@ -9206,56 +8769,212 @@ $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - RANLIB=$ac_ct_RANLIB + AS=$ac_ct_AS fi else - RANLIB="$ac_cv_prog_RANLIB" + AS="$ac_cv_prog_AS" fi -test -z "$RANLIB" && RANLIB=: - + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi -if test -n "$RANLIB"; then - case $host_os in - bitrig* | openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + ;; +esac +test -z "$AS" && AS=as +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$OBJDUMP" && OBJDUMP=objdump @@ -9263,9 +8982,32 @@ + enable_dlopen=no + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else + enable_shared=yes +fi @@ -9275,303 +9017,145 @@ + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else + enable_static=yes +fi -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} -# Allow CC to be a program name with arguments. -compiler=$CC -# Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if ${lt_cv_sys_global_symbol_pipe+:} false; then : - $as_echo_n "(cached) " >&6 +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $withval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac else + pic_mode=default +fi -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[ABCDGISTW]' - ;; -hpux*) - if test ia64 = "$host_cpu"; then - symcode='[ABCDEGRST]' - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris*) - symcode='[BDRT]' - ;; -sco3.2v5*) - symcode='[DT]' - ;; -sysv4.2uw2*) - symcode='[DT]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[ABDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Gets list of data symbols to import. - lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" - # Adjust the below global symbol transforms to fixup imported variables. - lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" - lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" - lt_c_name_lib_hook="\ - -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ - -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" -else - # Disable hooks by default. - lt_cv_sys_global_symbol_to_import= - lt_cdecl_hook= - lt_c_name_hook= - lt_c_name_lib_hook= -fi - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n"\ -$lt_cdecl_hook\ -" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ -$lt_c_name_hook\ -" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" - -# Transform an extracted symbol line into symbol name with lib prefix and -# symbol address. -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ -$lt_c_name_lib_hook\ -" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ -" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else + enable_fast_install=yes +fi - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function, - # D for any global variable and I for any imported variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK '"\ -" {last_section=section; section=\$ 3};"\ -" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ -" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ -" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ -" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ -" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" - # Check to see that the pipe works correctly. - pipe_works=no - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE -/* DATA imports from DLLs on WIN32 can't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined __osf__ -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif -#ifdef __cplusplus -extern "C" { -#endif -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - cat <<_LT_EOF >> conftest.$ac_ext + shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[5-9]*,yes) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 +$as_echo_n "checking which variant of shared library versioning to provide... " >&6; } -/* The mapping between symbol names and symbols. */ -LT_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; +# Check whether --with-aix-soname was given. +if test "${with_aix_soname+set}" = set; then : + withval=$with_aix_soname; case $withval in + aix|svr4|both) + ;; + *) + as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname +else + if ${lt_cv_with_aix_soname+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_with_aix_soname=aix +fi -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif + with_aix_soname=$lt_cv_with_aix_soname +fi -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS=conftstm.$ac_objext - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest$ac_exeext; then - pipe_works=yes - fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 +$as_echo "$with_aix_soname" >&6; } + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + shared_archive_member_spec=shr fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test yes = "$pipe_works"; then - break - else - lt_cv_sys_global_symbol_pipe= fi -done + ;; +*) + with_aix_soname=aix + ;; +esac -fi -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } -fi -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then - nm_file_list_spec='@' -fi @@ -9579,7 +9163,11 @@ +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS=$ltmain +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' @@ -9609,1950 +9197,2231 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 -$as_echo_n "checking for sysroot... " >&6; } -# Check whether --with-sysroot was given. -if test "${with_sysroot+set}" = set; then : - withval=$with_sysroot; -else - with_sysroot=no -fi +test -z "$LN_S" && LN_S="ln -s" -lt_sysroot= -case $with_sysroot in #( - yes) - if test yes = "$GCC"; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 -$as_echo "$with_sysroot" >&6; } - as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 -$as_echo "${lt_sysroot:-no}" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 -$as_echo_n "checking for a working dd... " >&6; } -if ${ac_cv_path_lt_DD+:} false; then : - $as_echo_n "(cached) " >&6 -else - printf 0123456789abcdef0123456789abcdef >conftest.i -cat conftest.i conftest.i >conftest2.i -: ${lt_DD:=$DD} -if test -z "$lt_DD"; then - ac_path_lt_DD_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in dd; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_lt_DD" || continue -if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then - cmp -s conftest.i conftest.out \ - && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: -fi - $ac_path_lt_DD_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_lt_DD"; then - : - fi -else - ac_cv_path_lt_DD=$lt_DD -fi -rm -f conftest.i conftest2.i conftest.out -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 -$as_echo "$ac_cv_path_lt_DD" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 -$as_echo_n "checking how to truncate binary pipes... " >&6; } -if ${lt_cv_truncate_bin+:} false; then : + + + +if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else - printf 0123456789abcdef0123456789abcdef >conftest.i -cat conftest.i conftest.i >conftest2.i -lt_cv_truncate_bin= -if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then - cmp -s conftest.i conftest.out \ - && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs fi -rm -f conftest.i conftest2.i conftest.out -test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" +rmdir .libs 2>/dev/null fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 -$as_echo "$lt_cv_truncate_bin" >&6; } - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -func_cc_basename () -{ - for cc_temp in $*""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac - done - func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -} -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : - enableval=$enable_libtool_lock; -fi -test no = "$enable_libtool_lock" || enable_libtool_lock=yes -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out what ABI is being produced by ac_compile, and set mode - # options accordingly. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE=32 - ;; - *ELF-64*) - HPUX_IA64_MODE=64 - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. - echo '#line '$LINENO' "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - if test yes = "$lt_cv_prog_gnu_ld"; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES fi - rm -rf conftest* ;; +esac -mips64*-*linux*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. - echo '#line '$LINENO' "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - emul=elf - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - emul="${emul}32" - ;; - *64-bit*) - emul="${emul}64" - ;; - esac - case `/usr/bin/file conftest.$ac_objext` in - *MSB*) - emul="${emul}btsmip" - ;; - *LSB*) - emul="${emul}ltsmip" - ;; - esac - case `/usr/bin/file conftest.$ac_objext` in - *N32*) - emul="${emul}n32" - ;; - esac - LD="${LD-ld} -m $emul" - fi - rm -rf conftest* - ;; +# Global variables: +ofile=libtool +can_build_shared=yes -x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. Note that the listed cases only cover the - # situations where additional linker options are needed (such as when - # doing 32-bit compilation for a host where ld defaults to 64-bit, or - # vice versa); the common cases where no linker options are needed do - # not appear in the list. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - case `/usr/bin/file conftest.o` in - *x86-64*) - LD="${LD-ld} -m elf32_x86_64" - ;; - *) - LD="${LD-ld} -m elf_i386" - ;; - esac - ;; - powerpc64le-*linux*) - LD="${LD-ld} -m elf32lppclinux" - ;; - powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - powerpcle-*linux*) - LD="${LD-ld} -m elf64lppc" - ;; - powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if ${lt_cv_cc_needs_belf+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +# All known linkers require a '.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +with_gnu_ld=$lt_cv_prog_gnu_ld -int -main (void) -{ +old_CC=$CC +old_CFLAGS=$CFLAGS - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_cc_needs_belf=yes -else - lt_cv_cc_needs_belf=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&6; } - if test yes != "$lt_cv_cc_needs_belf"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS=$SAVE_CFLAGS - fi - ;; -*-*solaris*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) - case $host in - i?86-*-solaris*|x86_64-*-solaris*) - LD="${LD-ld} -m elf_x86_64" - ;; - sparc*-*-solaris*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - # GNU ld 2.21 introduced _sol2 emulations. Use them if available. - if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then - LD=${LD-ld}_sol2 - fi - ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac +func_cc_basename $compiler +cc_basename=$func_cc_basename_result -need_locks=$enable_libtool_lock -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. -set dummy ${ac_tool_prefix}mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$MANIFEST_TOOL"; then - ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/${ac_tool_prefix}file"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac fi -fi -MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL -if test -n "$MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 -$as_echo "$MANIFEST_TOOL" >&6; } + +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi -fi -if test -z "$ac_cv_prog_MANIFEST_TOOL"; then - ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL - # Extract the first word of "mt", so it can be a program name with args. -set dummy mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_MANIFEST_TOOL"; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/file"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac fi -fi -ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL -if test -n "$ac_ct_MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 -$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } + +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_MANIFEST_TOOL" = x; then - MANIFEST_TOOL=":" + else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + MAGIC_CMD=: fi -else - MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 -$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } -if ${lt_cv_path_mainfest_tool+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&5 - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 -$as_echo "$lt_cv_path_mainfest_tool" >&6; } -if test yes != "$lt_cv_path_mainfest_tool"; then - MANIFEST_TOOL=: -fi + ;; +esac +# Use C for the default configuration in the libtool script +lt_save_CC=$CC +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +# Source file extension for C test sources. +ac_ext=c +# Object file extension for compiled C test sources. +objext=o +objext=$objext - case $host_os in - rhapsody* | darwin*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. -set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DSYMUTIL"; then - ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" -fi -fi -DSYMUTIL=$ac_cv_prog_DSYMUTIL -if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -$as_echo "$DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' -fi -if test -z "$ac_cv_prog_DSYMUTIL"; then - ac_ct_DSYMUTIL=$DSYMUTIL - # Extract the first word of "dsymutil", so it can be a program name with args. -set dummy dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DSYMUTIL"; then - ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS -fi -fi -ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL -if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -$as_echo "$ac_ct_DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - if test "x$ac_ct_DSYMUTIL" = x; then - DSYMUTIL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DSYMUTIL=$ac_ct_DSYMUTIL - fi -else - DSYMUTIL="$ac_cv_prog_DSYMUTIL" -fi - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. -set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NMEDIT"; then - ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS -fi -fi -NMEDIT=$ac_cv_prog_NMEDIT -if test -n "$NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 -$as_echo "$NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} -fi -if test -z "$ac_cv_prog_NMEDIT"; then - ac_ct_NMEDIT=$NMEDIT - # Extract the first word of "nmedit", so it can be a program name with args. -set dummy nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_NMEDIT"; then - ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_NMEDIT="nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} -fi -fi -ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT -if test -n "$ac_ct_NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 -$as_echo "$ac_ct_NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi +# Allow CC to be a program name with arguments. +compiler=$CC - if test "x$ac_ct_NMEDIT" = x; then - NMEDIT=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - NMEDIT=$ac_ct_NMEDIT - fi -else - NMEDIT="$ac_cv_prog_NMEDIT" -fi +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. -set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$LIPO"; then - ac_cv_prog_LIPO="$LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_LIPO="${ac_tool_prefix}lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* -fi -fi -LIPO=$ac_cv_prog_LIPO -if test -n "$LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 -$as_echo "$LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* -fi -if test -z "$ac_cv_prog_LIPO"; then - ac_ct_LIPO=$LIPO - # Extract the first word of "lipo", so it can be a program name with args. -set dummy lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_LIPO+:} false; then : +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test yes = "$GCC"; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_LIPO"; then - ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_LIPO="lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* fi -fi -ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO -if test -n "$ac_ct_LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 -$as_echo "$ac_ct_LIPO" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + : fi - if test "x$ac_ct_LIPO" = x; then - LIPO=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - LIPO=$ac_ct_LIPO - fi -else - LIPO="$ac_cv_prog_LIPO" fi - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL"; then - ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS -fi -fi -OTOOL=$ac_cv_prog_OTOOL -if test -n "$OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -$as_echo "$OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -fi -if test -z "$ac_cv_prog_OTOOL"; then - ac_ct_OTOOL=$OTOOL - # Extract the first word of "otool", so it can be a program name with args. -set dummy otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL"; then - ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OTOOL="otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL -if test -n "$ac_ct_OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -$as_echo "$ac_ct_OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL" = x; then - OTOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL=$ac_ct_OTOOL - fi -else - OTOOL="$ac_cv_prog_OTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL64"; then - ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL64=$ac_cv_prog_OTOOL64 -if test -n "$OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 -$as_echo "$OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL64"; then - ac_ct_OTOOL64=$OTOOL64 - # Extract the first word of "otool64", so it can be a program name with args. -set dummy otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL64"; then - ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OTOOL64="otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 -if test -n "$ac_ct_OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 -$as_echo "$ac_ct_OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL64" = x; then - OTOOL64=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL64=$ac_ct_OTOOL64 - fi -else - OTOOL64="$ac_cv_prog_OTOOL64" -fi - + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + if test yes = "$GCC"; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + lt_prog_compiler_pic='-fPIC' + ;; + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='$wl-a ${wl}archive' + ;; + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + # old Intel for x86_64, which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + esac + ;; + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 -$as_echo_n "checking for -single_module linker flag... " >&6; } -if ${lt_cv_apple_cc_single_mod+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_apple_cc_single_mod=no - if test -z "$LT_MULTI_MODULE"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - # If there is a non-empty error log, and "single_module" - # appears in it, assume the flag caused a linker warning - if test -s conftest.err && $GREP single_module conftest.err; then - cat conftest.err >&5 - # Otherwise, if the output was created with a 0 exit code from - # the compiler, it worked. - elif test -f libconftest.dylib && test 0 = "$_lt_result"; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&5 - fi - rm -rf libconftest.dylib* - rm -f conftest.* + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 -$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + ;; - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 -$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if ${lt_cv_ld_exported_symbols_list+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; -int -main (void) -{ + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_ld_exported_symbols_list=yes -else - lt_cv_ld_exported_symbols_list=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 -$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 -$as_echo_n "checking for -force_load linker flag... " >&6; } -if ${lt_cv_ld_force_load+:} false; then : +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else - lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cru libconftest.a conftest.o" >&5 - $AR cru libconftest.a conftest.o 2>&5 - echo "$RANLIB libconftest.a" >&5 - $RANLIB libconftest.a 2>&5 - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -s conftest.err && $GREP force_load conftest.err; then - cat conftest.err >&5 - elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&5 - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 -$as_echo "$lt_cv_ld_force_load" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; - 10.[012][,.]*) - _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test yes = "$lt_cv_apple_cc_single_mod"; then - _lt_dar_single_mod='$single_module' - fi - if test yes = "$lt_cv_ld_exported_symbols_list"; then - _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' - fi - if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic -# func_munge_path_list VARIABLE PATH -# ----------------------------------- -# VARIABLE is name of variable containing _space_ separated list of -# directories to be munged by the contents of PATH, which is string -# having a format: -# "DIR[:DIR]:" -# string "DIR[ DIR]" will be prepended to VARIABLE -# ":DIR[:DIR]" -# string "DIR[ DIR]" will be appended to VARIABLE -# "DIRP[:DIRP]::[DIRA:]DIRA" -# string "DIRP[ DIRP]" will be prepended to VARIABLE and string -# "DIRA[ DIRA]" will be appended to VARIABLE -# "DIR[:DIR]" -# VARIABLE will be replaced by "DIR[ DIR]" -func_munge_path_list () -{ - case x$2 in - x) - ;; - *:) - eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" - ;; - x:*) - eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" - ;; - *::*) - eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" - eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" - ;; - *) - eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" - ;; - esac -} +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if ${lt_cv_prog_compiler_pic_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default -" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } +if test yes = "$lt_cv_prog_compiler_pic_works"; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no fi -done +fi -# Set options -enable_win32_dll=yes -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. -set dummy ${ac_tool_prefix}as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AS="${ac_tool_prefix}as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS -fi -fi -AS=$ac_cv_prog_AS -if test -n "$AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 -$as_echo "$AS" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -fi -if test -z "$ac_cv_prog_AS"; then - ac_ct_AS=$AS - # Extract the first word of "as", so it can be a program name with args. -set dummy as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AS+:} false; then : + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_AS"; then - ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AS="as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + lt_cv_prog_compiler_static_works=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS fi -fi -ac_ct_AS=$ac_cv_prog_ac_ct_AS -if test -n "$ac_ct_AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 -$as_echo "$ac_ct_AS" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } - if test "x$ac_ct_AS" = x; then - AS="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AS=$ac_ct_AS - fi +if test yes = "$lt_cv_prog_compiler_static_works"; then + : else - AS="$ac_cv_prog_AS" + lt_prog_compiler_static= fi - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - ;; -esac - -test -z "$AS" && AS=as - - -test -z "$DLLTOOL" && DLLTOOL=dlltool - - - - - -test -z "$OBJDUMP" && OBJDUMP=objdump +hard_links=nottested +if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test no = "$hard_links"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - enable_dlopen=no + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ' (' and ')$', so one must not match beginning or + # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', + # as well as any symbol that contains 'd'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu | gnu*) + link_all_deplibs=no + ;; + esac + ld_shlibs=yes - # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for pkg in $enableval; do - IFS=$lt_save_ifs - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS=$lt_save_ifs - ;; + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test yes = "$with_gnu_ld"; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; esac -else - enable_shared=yes -fi - - - - + fi + if test yes = "$lt_use_gnu_ld_interface"; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='$wl' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + export_dynamic_flag_spec='$wl--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test ia64 != "$host_cpu"; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. - # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for pkg in $enableval; do - IFS=$lt_save_ifs - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS=$lt_save_ifs +_LT_EOF + fi ;; - esac -else - enable_static=yes -fi - - + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='$wl--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; - - -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : - withval=$with_pic; lt_p=${PACKAGE-default} - case $withval in - yes|no) pic_mode=$withval ;; - *) - pic_mode=default - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for lt_pkg in $withval; do - IFS=$lt_save_ifs - if test "X$lt_pkg" = "X$lt_p"; then - pic_mode=yes - fi - done - IFS=$lt_save_ifs + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes ;; - esac -else - pic_mode=default -fi - - - - + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + export_dynamic_flag_spec='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test linux-dietlibc = "$host_os"; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi - # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for pkg in $enableval; do - IFS=$lt_save_ifs - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS=$lt_save_ifs + case $cc_basename in + tcc*) + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + export_dynamic_flag_spec='-rdynamic' + ;; + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi ;; - esac -else - enable_fast_install=yes -fi - + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. - shared_archive_member_spec= -case $host,$enable_shared in -power*-*-aix[5-9]*,yes) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 -$as_echo_n "checking which variant of shared library versioning to provide... " >&6; } +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; -# Check whether --with-aix-soname was given. -if test "${with_aix_soname+set}" = set; then : - withval=$with_aix_soname; case $withval in - aix|svr4|both) + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no ;; + *) - as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi ;; esac - lt_cv_with_aix_soname=$with_aix_soname -else - if ${lt_cv_with_aix_soname+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_with_aix_soname=aix -fi - with_aix_soname=$lt_cv_with_aix_soname -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 -$as_echo "$with_aix_soname" >&6; } - if test aix != "$with_aix_soname"; then - # For the AIX way of multilib, we name the shared archive member - # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', - # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. - # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, - # the AIX toolchain works better with OBJECT_MODE set (default 32). - if test 64 = "${OBJECT_MODE-32}"; then - shared_archive_member_spec=shr_64 - else - shared_archive_member_spec=shr + if test no = "$ld_shlibs"; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= fi - fi - ;; -*) - with_aix_soname=aix - ;; -esac - - - - - - - - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS=$ltmain - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - - - - - - - - + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix[4-9]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + hardcode_direct=no + hardcode_direct_absolute=no + ;; + esac + if test yes = "$GCC"; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + export_dynamic_flag_spec='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main (void) +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=/usr/lib:/lib + fi +fi + aix_libpath=$lt_cv_aix_libpath_ +fi + hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main (void) +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=/usr/lib:/lib + fi +fi + aix_libpath=$lt_cv_aix_libpath_ +fi + hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' $wl-bernotok' + allow_undefined_flag=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; -test -z "$LN_S" && LN_S="ln -s" + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + darwin* | rhapsody*) + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test yes = "$lt_cv_ld_force_load"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + else + ld_shlibs=no + fi + ;; + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + hpux9*) + if test yes = "$GCC"; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='$wl-E' + ;; + hpux10*) + if test yes,no = "$GCC,$with_gnu_ld"; then + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='$wl-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; -if test -n "${ZSH_VERSION+set}"; then - setopt NO_GLOB_SUBST -fi + hpux11*) + if test yes,no = "$GCC,$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if ${lt_cv_objdir+:} false; then : + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null + lt_cv_prog_compiler__b=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } +if test yes = "$lt_cv_prog_compiler__b"; then + archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + ;; + esac + fi + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='$wl-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" + irix5* | irix6* | nonstopux*) + if test yes = "$GCC"; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } _ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test yes = "$lt_cv_irix_exported_symbol"; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + fi + link_all_deplibs=no + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + ld_shlibs=yes + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test set != "${COLLECT_NAMES+set}"; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a '.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a + *nto* | *qnx*) + ;; -with_gnu_ld=$lt_cv_prog_gnu_ld + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + export_dynamic_flag_spec='$wl-E' + else + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + fi + else + ld_shlibs=no + fi + ;; -old_CC=$CC -old_CFLAGS=$CFLAGS + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes + ;; -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o + osf3*) + if test yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + ;; -func_cc_basename $compiler -cc_basename=$func_cc_basename_result + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' + archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD=$MAGIC_CMD - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/${ac_tool_prefix}file"; then - lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD=$lt_cv_path_MAGIC_CMD - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; + solaris*) + no_undefined_flag=' -z defs' + if test yes = "$GCC"; then + wlarc='$wl' + archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='$wl' + archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; esac fi - break - fi - done - IFS=$lt_save_ifs - MAGIC_CMD=$lt_save_MAGIC_CMD - ;; -esac -fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. GCC discards it without '$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test yes = "$GCC"; then + whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; -MAGIC_CMD=$lt_cv_path_MAGIC_CMD -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi + sunos4*) + if test sequent = "$host_vendor"; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='$wl-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -$as_echo_n "checking for file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD=$MAGIC_CMD - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/file"; then - lt_cv_path_MAGIC_CMD=$ac_dir/"file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD=$lt_cv_path_MAGIC_CMD - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 + if test yes = "$GCC"; then + archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='$wl-z,text' + allow_undefined_flag='$wl-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='$wl-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='$wl-Bexport' + runpath_var='LD_RUN_PATH' -_LT_EOF - fi ;; - esac + if test yes = "$GCC"; then + archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi - break - fi - done - IFS=$lt_save_ifs - MAGIC_CMD=$lt_save_MAGIC_CMD - ;; -esac -fi + ;; -MAGIC_CMD=$lt_cv_path_MAGIC_CMD -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + *) + ld_shlibs=no + ;; + esac - else - MAGIC_CMD=: + if test sni = "$host_vendor"; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='$wl-Blargedynsym' + ;; + esac + fi fi -fi - fi - ;; -esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test no = "$ld_shlibs" && can_build_shared=no -# Use C for the default configuration in the libtool script +with_gnu_ld=$with_gnu_ld -lt_save_CC=$CC -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -# Source file extension for C test sources. -ac_ext=c -# Object file extension for compiled C test sources. -objext=o -objext=$objext -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' @@ -11560,506 +11429,128 @@ -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} -# Allow CC to be a program name with arguments. -compiler=$CC +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC + if test yes,yes = "$GCC,$enable_shared"; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -if test -n "$compiler"; then -lt_prog_compiler_no_builtin_flag= -if test yes = "$GCC"; then - case $cc_basename in - nvcc*) - lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; - *) - lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $RM conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } -if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi -fi - lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - if test yes = "$GCC"; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - case $host_os in - aix*) - # All AIX code is PIC. - if test ia64 = "$host_cpu"; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - lt_prog_compiler_pic='-fPIC' - ;; - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the '-m68020' flag to GCC prevents building anything better, - # like '-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic='-DDLL_EXPORT' - case $host_os in - os2*) - lt_prog_compiler_static='$wl-static' - ;; - esac - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static= - ;; - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - lt_prog_compiler_wl='-Xlinker ' - if test -n "$lt_prog_compiler_pic"; then - lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" - fi - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test ia64 = "$host_cpu"; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - case $cc_basename in - nagfor*) - # NAG Fortran compiler - lt_prog_compiler_wl='-Wl,-Wl,,' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - esac - ;; - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - case $host_os in - os2*) - lt_prog_compiler_static='$wl-static' - ;; - esac - ;; - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='$wl-a ${wl}archive' - ;; - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - # old Intel for x86_64, which still supported -KPIC. - ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='--shared' - lt_prog_compiler_static='--static' - ;; - nagfor*) - # NAG Fortran compiler - lt_prog_compiler_wl='-Wl,-Wl,,' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - tcc*) - # Fabrice Bellard et al's Tiny C Compiler - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-qpic' - lt_prog_compiler_static='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' - ;; - *Sun\ F* | *Sun*Fortran*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Qoption ld ' - ;; - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' - ;; - *Intel*\ [CF]*Compiler*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - *Portland\ Group*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - esac - ;; - esac - ;; - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - rdos*) - lt_prog_compiler_static='-non_shared' - ;; - solaris*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac - ;; - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi -case $host_os in - # For platforms that do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic=$lt_prog_compiler_pic -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 -$as_echo "$lt_cv_prog_compiler_pic" >&6; } -lt_prog_compiler_pic=$lt_cv_prog_compiler_pic -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if ${lt_cv_prog_compiler_pic_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works=yes - fi - fi - $RM conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } -if test yes = "$lt_cv_prog_compiler_pic_works"; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi -fi @@ -12071,46 +11562,8 @@ -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_static_works=no - save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works=yes - fi - else - lt_cv_prog_compiler_static_works=yes - fi - fi - $RM -r conftest* - LDFLAGS=$save_LDFLAGS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 -$as_echo "$lt_cv_prog_compiler_static_works" >&6; } -if test yes = "$lt_cv_prog_compiler_static_works"; then - : -else - lt_prog_compiler_static= -fi @@ -12118,1559 +11571,941 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } -hard_links=nottested -if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test no = "$hard_links"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - runpath_var= - allow_undefined_flag= - always_export_symbols=no - archive_cmds= - archive_expsym_cmds= - compiler_needs_object=no - enable_shared_with_static_runtimes=no - export_dynamic_flag_spec= - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - hardcode_automatic=no - hardcode_direct=no - hardcode_direct_absolute=no - hardcode_libdir_flag_spec= - hardcode_libdir_separator= - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - inherit_rpath=no - link_all_deplibs=unknown - module_cmds= - module_expsym_cmds= - old_archive_from_new_cmds= - old_archive_from_expsyms_cmds= - thread_safe_flag_spec= - whole_archive_flag_spec= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ' (' and ')$', so one must not match beginning or - # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', - # as well as any symbol that contains 'd'. - exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. - extract_expsyms_cmds= - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test yes != "$GCC"; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd* | bitrig*) - with_gnu_ld=no - ;; - linux* | k*bsd*-gnu | gnu*) - link_all_deplibs=no - ;; - esac - ld_shlibs=yes - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test yes = "$with_gnu_ld"; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; - *\ \(GNU\ Binutils\)\ [3-9]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - if test yes = "$lt_use_gnu_ld_interface"; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='$wl' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - export_dynamic_flag_spec='$wl--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. - case $host_os in - aix[3-9]*) - # On AIX/PPC, the GNU linker is very broken - if test ia64 != "$host_cpu"; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. -_LT_EOF - fi - ;; - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - export_dynamic_flag_spec='$wl--export-all-symbols' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file, use it as - # is; otherwise, prepend EXPORTS... - archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs=no - fi - ;; - haiku*) - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - link_all_deplibs=yes - ;; - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - shrext_cmds=.dll - archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - prefix_cmds="$SED"~ - if test EXPORTS = "`$SED 1q $export_symbols`"; then - prefix_cmds="$prefix_cmds -e 1d"; - fi~ - prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ - cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' - enable_shared_with_static_runtimes=yes - ;; - interix[3-9]*) - hardcode_direct=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='$wl-rpath,$libdir' - export_dynamic_flag_spec='$wl-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test linux-dietlibc = "$host_os"; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test no = "$tmp_diet" - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - whole_archive_flag_spec= - tmp_sharedflag='--shared' ;; - nagfor*) # NAGFOR 5.3 - tmp_sharedflag='-Wl,-shared' ;; - xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - compiler_needs_object=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - compiler_needs_object=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - if test yes = "$supports_anon_versioning"; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' - fi - case $cc_basename in - tcc*) - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - export_dynamic_flag_spec='-rdynamic' - ;; - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test yes = "$supports_anon_versioning"; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - ld_shlibs=no - fi - ;; - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - cat <<_LT_EOF 1>&2 -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - ;; - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - if test no = "$ld_shlibs"; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - aix[4-9]*) - if test ia64 = "$host_cpu"; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag= - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to GNU nm, but means don't demangle to AIX nm. - # Without the "-l" option, or with the "-B" option, AIX nm treats - # weak defined symbols like other global defined symbols, whereas - # GNU nm marks them as "W". - # While the 'weak' keyword is ignored in the Export File, we need - # it in the Import File for the 'aix-soname' feature, so we have - # to replace the "-B" option with "-P" for AIX nm. - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # have runtime linking enabled, and use it for executables. - # For shared libraries, we enable/disable runtime linking - # depending on the kind of the shared library created - - # when "with_aix_soname,aix_use_runtimelinking" is: - # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables - # "aix,yes" lib.so shared, rtl:yes, for executables - # lib.a static archive - # "both,no" lib.so.V(shr.o) shared, rtl:yes - # lib.a(lib.so.V) shared, rtl:no, for executables - # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a(lib.so.V) shared, rtl:no - # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a static archive - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then - aix_use_runtimelinking=yes - break - fi - done - if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then - # With aix-soname=svr4, we create the lib.so.V shared archives only, - # so we don't have lib.a shared libs to link our executables. - # We have to force runtime linking in this case. - aix_use_runtimelinking=yes - LDFLAGS="$LDFLAGS -Wl,-brtl" - fi - ;; - esac - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - archive_cmds='' - hardcode_direct=yes - hardcode_direct_absolute=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - file_list_spec='$wl-f,' - case $with_aix_soname,$aix_use_runtimelinking in - aix,*) ;; # traditional, no import file - svr4,* | *,yes) # use import file - # The Import File defines what to hardcode. - hardcode_direct=no - hardcode_direct_absolute=no - ;; - esac - if test yes = "$GCC"; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`$CC -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - shared_flag='-shared' - if test yes = "$aix_use_runtimelinking"; then - shared_flag="$shared_flag "'$wl-G' - fi - # Need to ensure runtime linking is disabled for the traditional - # shared library, or the linker may eventually find shared libraries - # /with/ Import File - we do not want to mix them. - shared_flag_aix='-shared' - shared_flag_svr4='-shared $wl-G' - else - # not using gcc - if test ia64 = "$host_cpu"; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test yes = "$aix_use_runtimelinking"; then - shared_flag='$wl-G' - else - shared_flag='$wl-bM:SRE' - fi - shared_flag_aix='$wl-bM:SRE' - shared_flag_svr4='$wl-G' - fi - fi - export_dynamic_flag_spec='$wl-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - if test set = "${lt_cv_aix_libpath+set}"; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int -main (void) -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=/usr/lib:/lib - fi -fi - aix_libpath=$lt_cv_aix_libpath_ -fi - hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag - else - if test ia64 = "$host_cpu"; then - hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - if test set = "${lt_cv_aix_libpath+set}"; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int -main (void) -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=/usr/lib:/lib - fi -fi - aix_libpath=$lt_cv_aix_libpath_ -fi - hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' $wl-bernotok' - allow_undefined_flag=' $wl-berok' - if test yes = "$with_gnu_ld"; then - # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - fi - archive_cmds_need_lc=yes - archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' - # -brtl affects multiple linker settings, -berok does not and is overridden later - compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' - if test svr4 != "$with_aix_soname"; then - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' - fi - if test aix != "$with_aix_soname"; then - archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' - else - # used by -dlpreopen to get the symbols - archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' - fi - archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' - fi - fi - ;; - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - case $cc_basename in - cl*) - # Native MSVC - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - always_export_symbols=yes - file_list_spec='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=.dll - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' - archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then - cp "$export_symbols" "$output_objdir/$soname.def"; - echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; - else - $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, )='true' - enable_shared_with_static_runtimes=yes - exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - old_postinstall_cmds='chmod 644 $oldlib' - postlink_cmds='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile=$lt_outputfile.exe - lt_tool_outputfile=$lt_tool_outputfile.exe - ;; - esac~ - if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=.dll - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - enable_shared_with_static_runtimes=yes - ;; - esac - ;; - darwin* | rhapsody*) - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - if test yes = "$lt_cv_ld_force_load"; then - whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - else - whole_archive_flag_spec='' - fi - link_all_deplibs=yes - allow_undefined_flag=$_lt_dar_allow_undefined - case $cc_basename in - ifort*|nagfor*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test yes = "$_lt_dar_can_shared"; then - output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" - archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" - module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" - else - ld_shlibs=no - fi - ;; - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2.*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; +if test yes = "$GCC"; then + case $host_os in + darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; + *) lt_awk_arg='/^libraries:/' ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; + *) lt_sed_strip_eq='s|=/|/|g' ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary... + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" + elif test -n "$lt_multi_os_dir"; then + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS = " "; FS = "/|\n";} { + lt_foo = ""; + lt_count = 0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo = "/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's|/\([A-Za-z]:\)|\1|g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no - hpux9*) - if test yes = "$GCC"; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' - else - archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='$wl+b $wl$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='$wl-E' - ;; - - hpux10*) - if test yes,no = "$GCC,$with_gnu_ld"; then - archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test no = "$with_gnu_ld"; then - hardcode_libdir_flag_spec='$wl+b $wl$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='$wl-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - - hpux11*) - if test yes,no = "$GCC,$with_gnu_ld"; then - case $host_cpu in - hppa*64*) - archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 -$as_echo_n "checking if $CC understands -b... " >&6; } -if ${lt_cv_prog_compiler__b+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler__b=no - save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS -b" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler__b=yes - fi - else - lt_cv_prog_compiler__b=yes - fi - fi - $RM -r conftest* - LDFLAGS=$save_LDFLAGS - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 -$as_echo "$lt_cv_prog_compiler__b" >&6; } - -if test yes = "$lt_cv_prog_compiler__b"; then - archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' -else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' -fi - ;; - esac - fi - if test no = "$with_gnu_ld"; then - hardcode_libdir_flag_spec='$wl+b $wl$libdir' - hardcode_libdir_separator=: - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - *) - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='$wl-E' +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; - irix5* | irix6* | nonstopux*) - if test yes = "$GCC"; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } -if ${lt_cv_irix_exported_symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo (void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_irix_exported_symbol=yes -else - lt_cv_irix_exported_symbol=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 -$as_echo "$lt_cv_irix_exported_symbol" >&6; } - if test yes = "$lt_cv_irix_exported_symbol"; then - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' - fi - link_all_deplibs=no +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; then + # AIX 5 supports IA64 + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + : else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' + can_build_shared=no fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - hardcode_libdir_separator=: - inherit_rpath=yes - link_all_deplibs=yes ;; + esac + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V - linux*) - case $cc_basename in - tcc*) - # Fabrice Bellard et al's Tiny C Compiler - ld_shlibs=yes - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - ;; - esac + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a(lib.so.V)' + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes ;; - - *nto* | *qnx*) + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes ;; - - openbsd* | bitrig*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - hardcode_shlibpath_var=no - hardcode_direct_absolute=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='$wl-rpath,$libdir' - export_dynamic_flag_spec='$wl-E' - else - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='$wl-rpath,$libdir' - fi - else - ld_shlibs=no - fi + *,no) # both, prefer aix + dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; + esac + shlibpath_var=LIBPATH + fi + ;; - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - shrext_cmds=.dll - archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - prefix_cmds="$SED"~ - if test EXPORTS = "`$SED 1q $export_symbols`"; then - prefix_cmds="$prefix_cmds -e 1d"; - fi~ - prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ - cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' - enable_shared_with_static_runtimes=yes - ;; +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; - osf3*) - if test yes = "$GCC"; then - allow_undefined_flag=' $wl-expect_unresolved $wl\*' - archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - hardcode_libdir_separator=: - ;; +beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test yes = "$GCC"; then - allow_undefined_flag=' $wl-expect_unresolved $wl\*' - archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - archive_cmds_need_lc='no' - hardcode_libdir_separator=: - ;; +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no - solaris*) - no_undefined_flag=' -z defs' - if test yes = "$GCC"; then - wlarc='$wl' - archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='$wl' - archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands '-z linker_flag'. GCC discards it without '$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test yes = "$GCC"; then - whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' - else - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs=yes - ;; + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes - sunos4*) - if test sequent = "$host_vendor"; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; + esac + dynamic_linker='Win32 ld.exe' + ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='$wl-z,text' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' - if test yes = "$GCC"; then - archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We CANNOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag='$wl-z,text' - allow_undefined_flag='$wl-z,nodefs' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='$wl-R,$libdir' - hardcode_libdir_separator=':' - link_all_deplibs=yes - export_dynamic_flag_spec='$wl-Bexport' - runpath_var='LD_RUN_PATH' - - if test yes = "$GCC"; then - archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; - *) - ld_shlibs=no + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac - if test sni = "$host_vendor"; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec='$wl-Blargedynsym' - ;; - esac - fi - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -$as_echo "$ld_shlibs" >&6; } -test no = "$ld_shlibs" && can_build_shared=no - -with_gnu_ld=$with_gnu_ld - - - - - - - - - - - - - + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + *) + # Assume MSVC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - if test yes,yes = "$GCC,$enable_shared"; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc+:} false; then : - $as_echo_n "(cached) " >&6 -else - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } - archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc - ;; +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; esac fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + hardcode_into_libs=yes + ;; +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + hardcode_libdir_flag_spec='-L$libdir' + ;; +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main (void) +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir +fi + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + ;; +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; +rdos*) + dynamic_linker=no + ;; +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; +sunos4*) + version_type=sunos + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test no = "$dynamic_linker" && can_build_shared=no +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH @@ -13758,872 +12593,570 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } -if test yes = "$GCC"; then - case $host_os in - darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; - *) lt_awk_arg='/^libraries:/' ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; - *) lt_sed_strip_eq='s|=/|/|g' ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary... - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - # ...but if some path component already ends with the multilib dir we assume - # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). - case "$lt_multi_os_dir; $lt_search_path_spec " in - "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) - lt_multi_os_dir= - ;; - esac - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" - elif test -n "$lt_multi_os_dir"; then - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS = " "; FS = "/|\n";} { - lt_foo = ""; - lt_count = 0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo = "/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[lt_foo]++; } - if (lt_freq[lt_foo] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's|/\([A-Za-z]:\)|\1|g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=.so -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown -case $host_os in -aix3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname.a' - shlibpath_var=LIBPATH - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='$libname$release$shared_ext$major' - ;; -aix[4-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test ia64 = "$host_cpu"; then - # AIX 5 supports IA64 - library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line '#! .'. This would cause the generated library to - # depend on '.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # Using Import Files as archive members, it is possible to support - # filename-based versioning of shared library archives on AIX. While - # this would work for both with and without runtime linking, it will - # prevent static linking of such archives. So we do filename-based - # shared library versioning with .so extension only, which is used - # when both runtime linking and shared linking is enabled. - # Unfortunately, runtime linking may impact performance, so we do - # not want this to be the default eventually. Also, we use the - # versioned .so libs for executables only if there is the -brtl - # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. - # To allow for filename-based versioning support, we need to create - # libNAME.so.V as an archive file, containing: - # *) an Import File, referring to the versioned filename of the - # archive as well as the shared archive member, telling the - # bitwidth (32 or 64) of that shared object, and providing the - # list of exported symbols of that shared object, eventually - # decorated with the 'weak' keyword - # *) the shared object with the F_LOADONLY flag set, to really avoid - # it being seen by the linker. - # At run time we better use the real file rather than another symlink, - # but for link time we create the symlink libNAME.so -> libNAME.so.V - case $with_aix_soname,$aix_use_runtimelinking in - # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - aix,yes) # traditional libtool - dynamic_linker='AIX unversionable lib.so' - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - ;; - aix,no) # traditional AIX only - dynamic_linker='AIX lib.a(lib.so.V)' - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='$libname$release.a $libname.a' - soname_spec='$libname$release$shared_ext$major' - ;; - svr4,*) # full svr4 only - dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" - library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' - # We do not specify a path in Import Files, so LIBPATH fires. - shlibpath_overrides_runpath=yes - ;; - *,yes) # both, prefer svr4 - dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" - library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' - # unpreferred sharedlib libNAME.a needs extra handling - postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' - postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' - # We do not specify a path in Import Files, so LIBPATH fires. - shlibpath_overrides_runpath=yes - ;; - *,no) # both, prefer aix - dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" - library_names_spec='$libname$release.a $libname.a' - soname_spec='$libname$release$shared_ext$major' - # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling - postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' - postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' - ;; - esac - shlibpath_var=LIBPATH + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test yes = "$hardcode_automatic"; then + + # We can hardcode non-existent directories. + if test no != "$hardcode_direct" && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && + test no != "$hardcode_minus_L"; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate fi - ;; +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; +if test relink = "$hardcode_action" || + test yes = "$inherit_rpath"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi -beos*) - library_names_spec='$libname$shared_ext' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; -bsdi[45]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=.dll - need_version=no - need_lib_prefix=no - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; + if test yes != "$enable_dlopen"; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - library_names_spec='$libname.dll.lib' + case $host_os in + beos*) + lt_cv_dlopen=load_add_on + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec=$LIB - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac + mingw* | pw32* | cegcc*) + lt_cv_dlopen=LoadLibrary + lt_cv_dlopen_libs= + ;; - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' + cygwin*) + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= ;; - *) - # Assume MSVC wrapper - library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' - soname_spec='$libname$release$major$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl +else - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; + lt_cv_dlopen=dyld + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes -dgux*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - ;; +fi -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[23].*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2.*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes ;; - esac - ;; - -haiku*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=no - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - if test 32 = "$HPUX_IA64_MODE"; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - sys_lib_dlsearch_path_spec=/usr/lib/hpux32 - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - sys_lib_dlsearch_path_spec=/usr/lib/hpux64 - fi - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[3-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test yes = "$lt_cv_prog_gnu_ld"; then - version_type=linux # correct to gnu/linux during the next big refactor - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='$libname$release$shared_ext$major' - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" - sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -linux*android*) - version_type=none # Android doesn't support versioned libraries. - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext' - soname_spec='$libname$release$shared_ext' - finish_cmds= - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - dynamic_linker='Android linker' - # Don't embed -rpath directories since the linker doesn't support them. - hardcode_libdir_flag_spec='-L$libdir' - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes; then : + lt_cv_dlopen=shl_load +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main (void) +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : + lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes; then : + lt_cv_dlopen=dlopen +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else - lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); int main (void) { +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if ${ac_cv_lib_svld_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main (void) +{ +return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - lt_cv_shlibpath_overrides_runpath=yes + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if ${ac_cv_lib_dld_dld_link+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main (void) +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : + lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld +fi + fi - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes +fi - # Ideally, we could use ldconfig to report *all* directores which are - # searched for libraries, however this is still not possible. Aside from not - # being certain /sbin/ldconfig is available, command - # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, - # even though it is searched at run-time. Try to do the best guess by - # appending ld.so.conf contents (and includes) to the search path. - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; +fi -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' +fi + + +fi + + ;; + esac + + if test no = "$lt_cv_dlopen"; then + enable_dlopen=no else - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - dynamic_linker='NetBSD ld.elf_so' + enable_dlopen=yes fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; -newsos6) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; + save_LDFLAGS=$LDFLAGS + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" -openbsd* | bitrig*) - version_type=sunos - sys_lib_dlsearch_path_spec=/usr/lib - need_lib_prefix=no - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - need_version=no - else - need_version=yes - fi - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; + save_LIBS=$LIBS + LIBS="$lt_cv_dlopen_libs $LIBS" -os2*) - libname_spec='$name' - version_type=windows - shrext_cmds=.dll - need_version=no - need_lib_prefix=no - # OS/2 can only load a DLL with a base name of 8 characters or less. - soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; - v=$($ECHO $release$versuffix | tr -d .-); - n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); - $ECHO $n$v`$shared_ext' - library_names_spec='${libname}_dll.$libext' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=BEGINLIBPATH - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test yes = "$cross_compiling"; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='$libname$release$shared_ext$major' - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; +#if HAVE_DLFCN_H +#include +#endif -rdos*) - dynamic_linker=no - ;; +#include -solaris*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif -sunos4*) - version_type=sunos - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test yes = "$with_gnu_ld"; then - need_lib_prefix=no - fi - need_version=yes - ;; +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif -sysv4 | sysv4.3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif -sysv4*MP*) - if test -d /usr/nec; then - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' - soname_spec='$libname$shared_ext.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=sco - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test yes = "$with_gnu_ld"; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac + else : + # compilation failed + lt_cv_dlopen_self=no fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; +fi +rm -fr conftest* -uts4*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - ;; -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test no = "$dynamic_linker" && can_build_shared=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test yes = "$GCC"; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then - sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec -fi - -if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then - sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec -fi - -# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... -configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + if test yes = "$lt_cv_dlopen_self"; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self_static+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test yes = "$cross_compiling"; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" -# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code -func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" +#if HAVE_DLFCN_H +#include +#endif -# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool -configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH +#include +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS + ;; + esac + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi @@ -14641,6 +13174,35 @@ +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP"; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi @@ -14653,15 +13215,58 @@ + # Report what library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test no = "$can_build_shared" && enable_shared=no + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[4-9]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +CC=$lt_save_CC @@ -14677,724 +13282,3673 @@ + ac_config_commands="$ac_config_commands libtool" +# Only expand once: +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking format of \`double' floating point" >&5 +$as_echo_n "checking format of \`double' floating point... " >&6; } +if test "$cross_compiling" = yes; then : + mpfr_ieee_double=0 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main (void) +{ +union ieee_double_extract +{ + double d; + unsigned char x[8]; +} t; +t.d = 2.877939254133025759330166692961938679218292236328125; /* exact */ +if (sizeof (double) != 8) + return 0; +if (sizeof (unsigned char) != 1) + return 0; +if (t.x[0] == 1 && t.x[1] == 2 && t.x[2] == 3 && t.x[3] == 4 && + t.x[4] == 5 && t.x[5] == 6 && t.x[6] == 7 && t.x[7] == 64) + return 1; /* little endian */ +else if (t.x[7] == 1 && t.x[6] == 2 && t.x[5] == 3 && t.x[4] == 4 && + t.x[3] == 5 && t.x[2] == 6 && t.x[1] == 7 && t.x[0] == 64) + return 2; /* big endian */ +else + return 0; /* unknown */ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + mpfr_ieee_double=$? +else + mpfr_ieee_double=$? +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +case "$mpfr_ieee_double" in + 1) { $as_echo "$as_me:${as_lineno-$LINENO}: result: IEEE little endian" >&5 +$as_echo "IEEE little endian" >&6; } + $as_echo "#define HAVE_DOUBLE_IEEE_LITTLE_ENDIAN 1" >>confdefs.h + ;; + 2) { $as_echo "$as_me:${as_lineno-$LINENO}: result: IEEE big endian" >&5 +$as_echo "IEEE big endian" >&6; } + $as_echo "#define HAVE_DOUBLE_IEEE_BIG_ENDIAN 1" >>confdefs.h + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: format of \`double' floating-point not recognized" >&5 +$as_echo "$as_me: WARNING: format of \`double' floating-point not recognized" >&2;} ;; +esac +# Check whether --enable-decimal-float was given. +if test "${enable_decimal_float+set}" = set; then : + enableval=$enable_decimal_float; case $enableval in + yes) ;; + no) ;; + *) as_fn_error $? "bad value for --enable-decimal-float: yes or no" "$LINENO" 5 ;; + esac +fi +# Check whether --enable-float128 was given. +if test "${enable_float128+set}" = set; then : + enableval=$enable_float128; case $enableval in + yes) ;; + no) ;; + *) as_fn_error $? "bad value for --enable-float128: yes or no" "$LINENO" 5 ;; + esac +fi +test_libgmp=__gmpz_init +# Check whether --enable-mini-gmp was given. +if test "${enable_mini_gmp+set}" = set; then : + enableval=$enable_mini_gmp; case $enableval in + yes) +$as_echo "#define MPFR_USE_MINI_GMP 1" >>confdefs.h + # With mini-gmp, mp_limb_t is always unsigned long. + if ac_fn_c_compute_int "$LINENO" "(sizeof(unsigned long) * CHAR_BIT)" "nettle_cv_gmp_numb_bits" "#include "; then : +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot find value of GMP_NUMB_BITS +See \`config.log' for more details" "$LINENO" 5; } +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $nettle_cv_gmp_numb_bits bits" >&5 +$as_echo "$nettle_cv_gmp_numb_bits bits" >&6; } +cat >>confdefs.h <<_ACEOF +#define GMP_NUMB_BITS $nettle_cv_gmp_numb_bits +_ACEOF +$as_echo "#define GMP_NAIL_BITS 0" >>confdefs.h + test_libgmp=mpz_init;; + no) ;; + *) as_fn_error $? "bad value for --enable-mini-gmp: yes or no" "$LINENO" 5 ;; + esac +fi +# Check whether --enable-debug-prediction was given. +if test "${enable_debug_prediction+set}" = set; then : + enableval=$enable_debug_prediction; case $enableval in + yes) if test "$enable_shared" != no; then + as_fn_error $? "--enable-debug-prediction can only work in static mode (--disable-shared)" "$LINENO" 5 + fi +$as_echo "#define MPFR_DEBUG_PREDICTION 1" >>confdefs.h + ;; + no) ;; + *) as_fn_error $? "bad value for --enable-debug-prediction: yes or no" "$LINENO" 5 ;; + esac +fi +# Check whether --enable-lto was given. +if test "${enable_lto+set}" = set; then : + enableval=$enable_lto; case $enableval in + yes) if test "$enable_shared" != "no"; then + as_fn_error $? "--enable-lto can only work in static mode (--disable-shared)" "$LINENO" 5 + fi + enable_lto=yes + ;; + no) ;; + *) as_fn_error $? "bad value for --enable-lto: yes or no" "$LINENO" 5 ;; + esac +fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || - test -n "$runpath_var" || - test yes = "$hardcode_automatic"; then - - # We can hardcode non-existent directories. - if test no != "$hardcode_direct" && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && - test no != "$hardcode_minus_L"; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } - -if test relink = "$hardcode_action" || - test yes = "$inherit_rpath"; then - # Fast installation is not supported - enable_fast_install=no -elif test yes = "$shlibpath_overrides_runpath" || - test no = "$enable_shared"; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - if test yes != "$enable_dlopen"; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen=load_add_on - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen=LoadLibrary - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen=dlopen - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ICC" >&5 +$as_echo_n "checking for ICC... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" +#if !defined(__ICC) +# error "Not ICC" +error #endif -char dlopen (); + int main (void) { -return dlopen (); + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl -else +if ac_fn_c_try_compile "$LINENO"; then : - lt_cv_dlopen=dyld - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="-fp_port -mieee-fp -wd1572 -wd265 -wd186 -wd239 $CFLAGS" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - - tpf*) - # Don't try to run any link tests for TPF. We know it's impossible - # because TPF is a cross-compiler, and we know how we open DSOs. - lt_cv_dlopen=dlopen - lt_cv_dlopen_libs= - lt_cv_dlopen_self=no - ;; - - *) - ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : - lt_cv_dlopen=shl_load -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +if test "$test_CFLAGS" != set && test -n "$GCC"; then + CFLAGS="-Wpointer-arith $CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the selected language is C++" >&5 +$as_echo_n "checking whether the selected language is C++... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" +#if defined (__cplusplus) +# error "C++" +error #endif -char shl_load (); + int main (void) { -return shl_load (); + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_shl_load=yes +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="-Wmissing-prototypes -Wc++-compat $CFLAGS" + else - ac_cv_lib_dld_shl_load=no + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="-Wmissing-declarations -Wno-sign-compare $CFLAGS" + fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="-Wall $CFLAGS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : - lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld -else - ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : - lt_cv_dlopen=dlopen -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + + +case $host in + *-apple-darwin*) + case "$LD $LDFLAGS" in + *-Wl,-search_paths_first*) ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler understands -Wl,-search_paths_first" >&5 +$as_echo_n "checking if the compiler understands -Wl,-search_paths_first... " >&6; } + saved_LDFLAGS="$LDFLAGS" + LDFLAGS="-Wl,-search_paths_first $LDFLAGS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); int main (void) { -return dlopen (); + ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - ac_cv_lib_dl_dlopen=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + LDFLAGS="$saved_LDFLAGS" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if ${ac_cv_lib_svld_dlopen+:} false; then : + ;; + esac + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); int main (void) { -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_svld_dlopen=yes -else - ac_cv_lib_svld_dlopen=no + +#ifndef __cplusplus + /* Ultrix mips cc rejects this sort of thing. */ + typedef int charset[2]; + const charset cs = { 0, 0 }; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this sort of thing. */ + char tx; + char *t = &tx; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; } bx; + struct s *b = &bx; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_const=yes +else + ac_cv_c_const=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes; then : - lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +$as_echo "#define const /**/" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5 +$as_echo_n "checking for working volatile... " >&6; } +if ${ac_cv_c_volatile+:} false; then : + $as_echo_n "(cached) " >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if ${ac_cv_lib_dld_dld_link+:} false; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + +volatile int x; +int * volatile y = (int *) 0; +return !x && !y; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_volatile=yes +else + ac_cv_c_volatile=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5 +$as_echo "$ac_cv_c_volatile" >&6; } +if test $ac_cv_c_volatile = no; then + +$as_echo "#define volatile /**/" >>confdefs.h + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +$as_echo_n "checking whether byte ordering is bigendian... " >&6; } +if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dld_link (); int main (void) { -return dld_link (); +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_dld_link=yes +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main (void) +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes else - ac_cv_lib_dld_dld_link=no + ac_cv_c_bigendian=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes; then : - lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +#ifndef _BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes; then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; + +int +main (void) +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main (void) +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_c_bigendian=no +else + ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + fi fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +$as_echo "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + $as_echo "#define HAVE_BIG_ENDIAN 1" >>confdefs.h +;; #( + no) + $as_echo "#define HAVE_LITTLE_ENDIAN 1" >>confdefs.h + ;; #( + universal) + true + ;; #( + *) + true ;; + esac + + + + +MPFR_LIBM='' + +case $host in + *-*-beos* | *-*-cygwin* | *-*-pw32*) + # According to libtool AC CHECK LIBM, these systems don't have libm + ;; + *-*-solaris*) + # On Solaris the math functions new in C99 are in -lm9x. + # FIXME: Do we need -lm9x as well as -lm, or just instead of? + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm9x" >&5 +$as_echo_n "checking for main in -lm9x... " >&6; } +if ${ac_cv_lib_m9x_main+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm9x $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main (void) +{ +return main (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_m9x_main=yes +else + ac_cv_lib_m9x_main=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m9x_main" >&5 +$as_echo "$ac_cv_lib_m9x_main" >&6; } +if test "x$ac_cv_lib_m9x_main" = xyes; then : + MPFR_LIBM="-lm9x" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5 +$as_echo_n "checking for main in -lm... " >&6; } +if ${ac_cv_lib_m_main+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main (void) +{ +return main (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_m_main=yes +else + ac_cv_lib_m_main=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5 +$as_echo "$ac_cv_lib_m_main" >&6; } +if test "x$ac_cv_lib_m_main" = xyes; then : + MPFR_LIBM="$MPFR_LIBM -lm" +fi + + ;; + *-ncr-sysv4.3*) + # FIXME: What does -lmw mean? Libtool AC CHECK LIBM does it this way. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5 +$as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; } +if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmw $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char _mwvalidcheckl (); +int +main (void) +{ +return _mwvalidcheckl (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_mw__mwvalidcheckl=yes +else + ac_cv_lib_mw__mwvalidcheckl=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mw__mwvalidcheckl" >&5 +$as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; } +if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then : + MPFR_LIBM="-lmw" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5 +$as_echo_n "checking for main in -lm... " >&6; } +if ${ac_cv_lib_m_main+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main (void) +{ +return main (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_m_main=yes +else + ac_cv_lib_m_main=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5 +$as_echo "$ac_cv_lib_m_main" >&6; } +if test "x$ac_cv_lib_m_main" = xyes; then : + MPFR_LIBM="$MPFR_LIBM -lm" +fi + + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5 +$as_echo_n "checking for main in -lm... " >&6; } +if ${ac_cv_lib_m_main+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main (void) +{ +return main (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_m_main=yes +else + ac_cv_lib_m_main=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5 +$as_echo "$ac_cv_lib_m_main" >&6; } +if test "x$ac_cv_lib_m_main" = xyes; then : + MPFR_LIBM="-lm" +fi + + ;; +esac + + +MPFR_LIBQUADMATH='' + +case $host in + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lquadmath" >&5 +$as_echo_n "checking for main in -lquadmath... " >&6; } +if ${ac_cv_lib_quadmath_main+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lquadmath $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main (void) +{ +return main (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_quadmath_main=yes +else + ac_cv_lib_quadmath_main=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_quadmath_main" >&5 +$as_echo "$ac_cv_lib_quadmath_main" >&6; } +if test "x$ac_cv_lib_quadmath_main" = xyes; then : + MPFR_LIBQUADMATH="-lquadmath" +fi + + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 +$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +if ${ac_cv_header_time+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include + +int +main (void) +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_time=yes +else + ac_cv_header_time=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 +$as_echo "$ac_cv_header_time" >&6; } +if test $ac_cv_header_time = yes; then + +$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h + +fi + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + + + + + + + + + +if test "$enable_shared_cache" = yes; then + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C11 thread support" >&5 +$as_echo_n "checking for ISO C11 thread support... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + mtx_t lock; + once_flag once = ONCE_FLAG_INIT; + thrd_t thd_idx; + int x = 0; + void once_call (void) { x = 1; } + +int +main (void) +{ + + int err; + err = mtx_init(&lock, mtx_plain); + assert(err == thrd_success); + err = mtx_lock(&lock); + assert(err == thrd_success); + err = mtx_unlock(&lock); + assert(err == thrd_success); + mtx_destroy(&lock); + once_call(&once, once_call); + return x == 1 ? 0 : -1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + mpfr_c11_thread_ok=yes +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +if test "$mpfr_c11_thread_ok" = "yes"; then + +$as_echo "#define MPFR_HAVE_C11_LOCK 1" >>confdefs.h + +fi + + + if test "$mpfr_c11_thread_ok" != yes; then + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ax_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on Tru64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then + ax_pthread_save_CC="$CC" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + if test "x$PTHREAD_CC" != "x"; then : + CC="$PTHREAD_CC" +fi + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS" >&5 +$as_echo_n "checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_join (); +int +main (void) +{ +return pthread_join (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_pthread_ok=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 +$as_echo "$ax_pthread_ok" >&6; } + if test "x$ax_pthread_ok" = "xno"; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + CC="$ax_pthread_save_CC" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 +# (Note: HP C rejects this with "bad form for `-t' option") +# -pthreads: Solaris/gcc (Note: HP C also rejects) +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads and +# -D_REENTRANT too), HP C (must be checked before -lpthread, which +# is present but should not be used directly; and before -mthreads, +# because the compiler interprets this as "-mt" + "-hreads") +# -mthreads: Mingw32/gcc, Lynx/gcc +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case $host_os in + + freebsd*) + + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + + ax_pthread_flags="-kthread lthread $ax_pthread_flags" + ;; + + hpux*) + + # From the cc(1) man page: "[-mt] Sets various -D flags to enable + # multi-threading and also sets -lpthread." + + ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" + ;; + + openedition*) + + # IBM z/OS requires a feature-test macro to be defined in order to + # enable POSIX threads at all, so give the user a hint if this is + # not set. (We don't define these ourselves, as they can affect + # other portions of the system API in unpredictable ways.) + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) + AX_PTHREAD_ZOS_MISSING +# endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&5 +$as_echo "$as_me: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&2;} +fi +rm -f conftest* + + ;; + + solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (N.B.: The stubs are missing + # pthread_cleanup_push, or rather a function called by this macro, + # so we could check for that, but who knows whether they'll stub + # that too in a future libc.) So we'll check first for the + # standard Solaris way of linking pthreads (-mt -lpthread). + + ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags" + ;; +esac + +# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) + +if test "x$GCC" = "xyes"; then : + ax_pthread_flags="-pthread -pthreads $ax_pthread_flags" +fi + +# The presence of a feature test macro requesting re-entrant function +# definitions is, on some systems, a strong hint that pthreads support is +# correctly enabled + +case $host_os in + darwin* | hpux* | linux* | osf* | solaris*) + ax_pthread_check_macro="_REENTRANT" + ;; + + aix*) + ax_pthread_check_macro="_THREAD_SAFE" + ;; + + *) + ax_pthread_check_macro="--" + ;; +esac +if test "x$ax_pthread_check_macro" = "x--"; then : + ax_pthread_check_cond=0 +else + ax_pthread_check_cond="!defined($ax_pthread_check_macro)" +fi + +# Are we compiling with Clang? + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC is Clang" >&5 +$as_echo_n "checking whether $CC is Clang... " >&6; } +if ${ax_cv_PTHREAD_CLANG+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_CLANG=no + # Note that Autoconf sets GCC=yes for Clang as well as GCC + if test "x$GCC" = "xyes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ +# if defined(__clang__) && defined(__llvm__) + AX_PTHREAD_CC_IS_CLANG +# endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1; then : + ax_cv_PTHREAD_CLANG=yes +fi +rm -f conftest* + + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG" >&5 +$as_echo "$ax_cv_PTHREAD_CLANG" >&6; } +ax_pthread_clang="$ax_cv_PTHREAD_CLANG" + +ax_pthread_clang_warning=no + +# Clang needs special handling, because older versions handle the -pthread +# option in a rather... idiosyncratic way + +if test "x$ax_pthread_clang" = "xyes"; then + + # Clang takes -pthread; it has never supported any other flag + + # (Note 1: This will need to be revisited if a system that Clang + # supports has POSIX threads in a separate library. This tends not + # to be the way of modern systems, but it's conceivable.) + + # (Note 2: On some systems, notably Darwin, -pthread is not needed + # to get POSIX threads support; the API is always present and + # active. We could reasonably leave PTHREAD_CFLAGS empty. But + # -pthread does define _REENTRANT, and while the Darwin headers + # ignore this macro, third-party headers might not.) + + PTHREAD_CFLAGS="-pthread" + PTHREAD_LIBS= + + ax_pthread_ok=yes + + # However, older versions of Clang make a point of warning the user + # that, in an invocation where only linking and no compilation is + # taking place, the -pthread option has no effect ("argument unused + # during compilation"). They expect -pthread to be passed in only + # when source code is being compiled. + # + # Problem is, this is at odds with the way Automake and most other + # C build frameworks function, which is that the same flags used in + # compilation (CFLAGS) are also used in linking. Many systems + # supported by AX_PTHREAD require exactly this for POSIX threads + # support, and in fact it is often not straightforward to specify a + # flag that is used only in the compilation phase and not in + # linking. Such a scenario is extremely rare in practice. + # + # Even though use of the -pthread flag in linking would only print + # a warning, this can be a nuisance for well-run software projects + # that build with -Werror. So if the active version of Clang has + # this misfeature, we search for an option to squash it. + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread" >&5 +$as_echo_n "checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread... " >&6; } +if ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown + # Create an alternate version of $ac_link that compiles and + # links in two steps (.c -> .o, .o -> exe) instead of one + # (.c -> exe), because the warning occurs only in the second + # step + ax_pthread_save_ac_link="$ac_link" + ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' + ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` + ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" + ax_pthread_save_CFLAGS="$CFLAGS" + for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do + if test "x$ax_pthread_try" = "xunknown"; then : + break +fi + CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" + ac_link="$ax_pthread_save_ac_link" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void){return 0;} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_link="$ax_pthread_2step_ac_link" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void){return 0;} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done + ac_link="$ax_pthread_save_ac_link" + CFLAGS="$ax_pthread_save_CFLAGS" + if test "x$ax_pthread_try" = "x"; then : + ax_pthread_try=no +fi + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5 +$as_echo "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; } + + case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in + no | unknown) ;; + *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; + esac + +fi # $ax_pthread_clang = yes + +if test "x$ax_pthread_ok" = "xno"; then +for ax_pthread_try_flag in $ax_pthread_flags; do + + case $ax_pthread_try_flag in + none) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 +$as_echo_n "checking whether pthreads work without any flags... " >&6; } + ;; + + -mt,pthread) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with -mt -lpthread" >&5 +$as_echo_n "checking whether pthreads work with -mt -lpthread... " >&6; } + PTHREAD_CFLAGS="-mt" + PTHREAD_LIBS="-lpthread" + ;; + + -*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $ax_pthread_try_flag" >&5 +$as_echo_n "checking whether pthreads work with $ax_pthread_try_flag... " >&6; } + PTHREAD_CFLAGS="$ax_pthread_try_flag" + ;; + + pthread-config) + # Extract the first word of "pthread-config", so it can be a program name with args. +set dummy pthread-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ax_pthread_config+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ax_pthread_config"; then + ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ax_pthread_config="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no" +fi +fi +ax_pthread_config=$ac_cv_prog_ax_pthread_config +if test -n "$ax_pthread_config"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5 +$as_echo "$ax_pthread_config" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$ax_pthread_config" = "xno"; then : + continue +fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$ax_pthread_try_flag" >&5 +$as_echo_n "checking for the pthreads library -l$ax_pthread_try_flag... " >&6; } + PTHREAD_LIBS="-l$ax_pthread_try_flag" + ;; + esac + + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +# if $ax_pthread_check_cond +# error "$ax_pthread_check_macro must be defined" +# endif + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; } +int +main (void) +{ +pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_pthread_ok=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 +$as_echo "$ax_pthread_ok" >&6; } + if test "x$ax_pthread_ok" = "xyes"; then : + break +fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$ax_pthread_ok" = "xyes"; then + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 +$as_echo_n "checking for joinable pthread attribute... " >&6; } +if ${ax_cv_PTHREAD_JOINABLE_ATTR+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_JOINABLE_ATTR=unknown + for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +int attr = $ax_pthread_attr; return attr /* ; */ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_JOINABLE_ATTR" >&5 +$as_echo "$ax_cv_PTHREAD_JOINABLE_ATTR" >&6; } + if test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ + test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ + test "x$ax_pthread_joinable_attr_defined" != "xyes"; then : + +cat >>confdefs.h <<_ACEOF +#define PTHREAD_CREATE_JOINABLE $ax_cv_PTHREAD_JOINABLE_ATTR +_ACEOF + + ax_pthread_joinable_attr_defined=yes + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether more special flags are required for pthreads" >&5 +$as_echo_n "checking whether more special flags are required for pthreads... " >&6; } +if ${ax_cv_PTHREAD_SPECIAL_FLAGS+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_SPECIAL_FLAGS=no + case $host_os in + solaris*) + ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" + ;; + esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_SPECIAL_FLAGS" >&5 +$as_echo "$ax_cv_PTHREAD_SPECIAL_FLAGS" >&6; } + if test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ + test "x$ax_pthread_special_flags_added" != "xyes"; then : + PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" + ax_pthread_special_flags_added=yes +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5 +$as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; } +if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +int i = PTHREAD_PRIO_INHERIT; + return i; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_cv_PTHREAD_PRIO_INHERIT=yes +else + ax_cv_PTHREAD_PRIO_INHERIT=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 +$as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } + if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ + test "x$ax_pthread_prio_inherit_defined" != "xyes"; then : + +$as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h + + ax_pthread_prio_inherit_defined=yes + +fi + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + # More AIX lossage: compile with *_r variant + if test "x$GCC" != "xyes"; then + case $host_os in + aix*) + case "x/$CC" in #( + x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) : + #handle absolute path differently from PATH based program lookup + case "x$CC" in #( + x/*) : + if as_fn_executable_p ${CC}_r; then : + PTHREAD_CC="${CC}_r" +fi ;; #( + *) : + for ac_prog in ${CC}_r +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_PTHREAD_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$PTHREAD_CC"; then + ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_PTHREAD_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +PTHREAD_CC=$ac_cv_prog_PTHREAD_CC +if test -n "$PTHREAD_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 +$as_echo "$PTHREAD_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$PTHREAD_CC" && break +done +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + ;; +esac ;; #( + *) : + ;; +esac + ;; + esac + fi +fi + +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + + + + + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test "x$ax_pthread_ok" = "xyes"; then + +$as_echo "#define HAVE_PTHREAD 1" >>confdefs.h + + : +else + ax_pthread_ok=no + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + if test "$ax_pthread_ok" = yes; then + CC="$PTHREAD_CC" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$LIBS $PTHREAD_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_rwlock_t" >&5 +$as_echo_n "checking for pthread_rwlock_t... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main (void) +{ + +pthread_rwlock_t lock; (void) lock; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + mpfr_pthread_ok=yes +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + mpfr_pthread_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + else + mpfr_pthread_ok=no + fi + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if shared cache can be supported" >&5 +$as_echo_n "checking if shared cache can be supported... " >&6; } + if test "$mpfr_c11_thread_ok" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, with ISO C11 threads" >&5 +$as_echo "yes, with ISO C11 threads" >&6; } + elif test "$mpfr_pthread_ok" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, with pthread" >&5 +$as_echo "yes, with pthread" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "shared cache needs C11 threads or pthread support" "$LINENO" 5 + fi + +fi + + +ac_fn_c_check_header_mongrel "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" +if test "x$ac_cv_header_limits_h" = xyes; then : + +else + as_fn_error $? "limits.h not found" "$LINENO" 5 +fi + + +ac_fn_c_check_header_mongrel "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default" +if test "x$ac_cv_header_float_h" = xyes; then : + +else + as_fn_error $? "float.h not found" "$LINENO" 5 +fi + + +ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" +if test "x$ac_cv_header_string_h" = xyes; then : + +else + as_fn_error $? "string.h not found" "$LINENO" 5 +fi + + + +for ac_header in locale.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default" +if test "x$ac_cv_header_locale_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LOCALE_H 1 +_ACEOF + +fi + +done + + +for ac_header in wchar.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default" +if test "x$ac_cv_header_wchar_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_WCHAR_H 1 +_ACEOF + +fi + +done + + +ac_fn_c_check_header_mongrel "$LINENO" "stdarg.h" "ac_cv_header_stdarg_h" "$ac_includes_default" +if test "x$ac_cv_header_stdarg_h" = xyes; then : + +$as_echo "#define HAVE_STDARG 1" >>confdefs.h + +else + ac_fn_c_check_header_mongrel "$LINENO" "varargs.h" "ac_cv_header_varargs_h" "$ac_includes_default" +if test "x$ac_cv_header_varargs_h" = xyes; then : + +else + as_fn_error $? "stdarg.h or varargs.h not found" "$LINENO" 5 +fi + + +fi + + + +for ac_header in sys/time.h sys/fpu.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +ac_fn_c_check_member "$LINENO" "struct lconv" "decimal_point" "ac_cv_member_struct_lconv_decimal_point" "#include +" +if test "x$ac_cv_member_struct_lconv_decimal_point" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_LCONV_DECIMAL_POINT 1 +_ACEOF + + +fi +ac_fn_c_check_member "$LINENO" "struct lconv" "thousands_sep" "ac_cv_member_struct_lconv_thousands_sep" "#include +" +if test "x$ac_cv_member_struct_lconv_thousands_sep" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_LCONV_THOUSANDS_SEP 1 +_ACEOF + + +fi + + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 +$as_echo_n "checking for working alloca.h... " >&6; } +if ${ac_cv_working_alloca_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +char *p = (char *) alloca (2 * sizeof (int)); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_working_alloca_h=yes +else + ac_cv_working_alloca_h=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 +$as_echo "$ac_cv_working_alloca_h" >&6; } +if test $ac_cv_working_alloca_h = yes; then + +$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 +$as_echo_n "checking for alloca... " >&6; } +if ${ac_cv_func_alloca_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include +# define alloca _alloca +# else +# ifdef HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +void *alloca (size_t); +# endif +# endif +# endif +# endif +#endif + +int +main (void) +{ +char *p = (char *) alloca (1); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_func_alloca_works=yes +else + ac_cv_func_alloca_works=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 +$as_echo "$ac_cv_func_alloca_works" >&6; } + +if test $ac_cv_func_alloca_works = yes; then + +$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h + +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. + +ALLOCA=\${LIBOBJDIR}alloca.$ac_objext + +$as_echo "#define C_ALLOCA 1" >>confdefs.h + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 +$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } +if ${ac_cv_os_cray+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined CRAY && ! defined CRAY2 +webecray +#else +wenotbecray +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "webecray" >/dev/null 2>&1; then : + ac_cv_os_cray=yes +else + ac_cv_os_cray=no +fi +rm -f conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 +$as_echo "$ac_cv_os_cray" >&6; } +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + +cat >>confdefs.h <<_ACEOF +#define CRAY_STACKSEG_END $ac_func +_ACEOF + + break +fi + + done +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 +$as_echo_n "checking stack direction for C alloca... " >&6; } +if ${ac_cv_c_stack_direction+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_c_stack_direction=0 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +find_stack_direction (int *addr, int depth) +{ + int dir, dummy = 0; + if (! addr) + addr = &dummy; + *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; + dir = depth ? find_stack_direction (addr, depth - 1) : 0; + return dir + dummy; +} + +int +main (int argc, char **argv) +{ + return find_stack_direction (0, argc + !argv + 20) < 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_c_stack_direction=1 +else + ac_cv_c_stack_direction=-1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 +$as_echo "$ac_cv_c_stack_direction" >&6; } +cat >>confdefs.h <<_ACEOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +_ACEOF + + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to copy va_list" >&5 +$as_echo_n "checking how to copy va_list... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main (void) +{ + + va_list ap1, ap2; + va_copy(ap1, ap2); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: va_copy" >&5 +$as_echo "va_copy" >&6; } + $as_echo "#define HAVE_VA_COPY 1" >>confdefs.h + + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main (void) +{ + + va_list ap1, ap2; + __va_copy(ap1, ap2); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + $as_echo "#define HAVE___VA_COPY 1" >>confdefs.h + { $as_echo "$as_me:${as_lineno-$LINENO}: result: __va_copy" >&5 +$as_echo "__va_copy" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: memcpy" >&5 +$as_echo "memcpy" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +for ac_func in memmove memset setlocale strtol gettimeofday signal +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigaction and its associated structure" >&5 +$as_echo_n "checking for sigaction and its associated structure... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +static int f (int (*func)(int, const struct sigaction *, struct sigaction *)) +{ return 0; } + +int +main (void) +{ + + return f(sigaction); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_SIGACTION 1" >>confdefs.h + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +ac_fn_c_check_type "$LINENO" "long long int" "ac_cv_type_long_long_int" "$ac_includes_default" +if test "x$ac_cv_type_long_long_int" = xyes; then : + +$as_echo "#define HAVE_LONG_LONG 1" >>confdefs.h + +fi + + +ac_fn_c_check_type "$LINENO" "intmax_t" "ac_cv_type_intmax_t" "$ac_includes_default" +if test "x$ac_cv_type_intmax_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_INTMAX_T 1 +_ACEOF + + +fi + +if test "$ac_cv_type_intmax_t" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working INTMAX_MAX" >&5 +$as_echo_n "checking for working INTMAX_MAX... " >&6; } +if ${mpfr_cv_have_intmax_max+:} false; then : + $as_echo_n "(cached) " >&6 +else + + saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I$srcdir/src" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include "mpfr-intmax.h" +int +main (void) +{ +intmax_t x = INTMAX_MAX; (void) x; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mpfr_cv_have_intmax_max=yes +else + mpfr_cv_have_intmax_max=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$saved_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_have_intmax_max" >&5 +$as_echo "$mpfr_cv_have_intmax_max" >&6; } + if test "$mpfr_cv_have_intmax_max" = "yes"; then + +$as_echo "#define MPFR_HAVE_INTMAX_MAX 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working printf length modifier for intmax_t" >&5 +$as_echo_n "checking for working printf length modifier for intmax_t... " >&6; } +if ${mpfr_cv_printf_maxlm+:} false; then : + $as_echo_n "(cached) " >&6 +else + + saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I$srcdir/src" + for modifier in j ll l + do + if test "$cross_compiling" = yes; then : + mpfr_cv_printf_maxlm=j; break + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include "mpfr-intmax.h" + +int +main (void) +{ + + char s[64]; + sprintf (s, "%${modifier}d %${modifier}u", + (intmax_t) -17, (uintmax_t) 42); + return strcmp (s, "-17 42") != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + mpfr_cv_printf_maxlm=${modifier}; break +else + mpfr_cv_printf_maxlm=none +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + done + CPPFLAGS="$saved_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_printf_maxlm" >&5 +$as_echo "$mpfr_cv_printf_maxlm" >&6; } + if test "$mpfr_cv_printf_maxlm" != "none"; then + +cat >>confdefs.h <<_ACEOF +#define MPFR_PRINTF_MAXLM "$mpfr_cv_printf_maxlm" +_ACEOF + + fi +fi + +ac_fn_c_check_type "$LINENO" "union fpc_csr" "ac_cv_type_union_fpc_csr" " +#if HAVE_SYS_FPU_H +# include +#endif + +" +if test "x$ac_cv_type_union_fpc_csr" = xyes; then : + +$as_echo "#define HAVE_FPC_CSR 1" >>confdefs.h + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _Noreturn" >&5 +$as_echo_n "checking for _Noreturn... " >&6; } +if ${mpfr_cv_have_noreturn+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +_Noreturn void foo(int); +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mpfr_cv_have_noreturn=yes +else + mpfr_cv_have_noreturn=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_have_noreturn" >&5 +$as_echo "$mpfr_cv_have_noreturn" >&6; } +if test "$mpfr_cv_have_noreturn" = "yes"; then + +$as_echo "#define MPFR_HAVE_NORETURN 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_unreachable" >&5 +$as_echo_n "checking for __builtin_unreachable... " >&6; } +if ${mpfr_cv_have_builtin_unreachable+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int x; +int +main (void) +{ +if (x) __builtin_unreachable(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + mpfr_cv_have_builtin_unreachable=yes +else + mpfr_cv_have_builtin_unreachable=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_have_builtin_unreachable" >&5 +$as_echo "$mpfr_cv_have_builtin_unreachable" >&6; } +if test "$mpfr_cv_have_builtin_unreachable" = "yes"; then + +$as_echo "#define MPFR_HAVE_BUILTIN_UNREACHABLE 1" >>confdefs.h + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for constructor and destructor attributes" >&5 +$as_echo_n "checking for constructor and destructor attributes... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +int x = 0; +__attribute__((constructor)) static void +call_f(void) { x = 1742; } +__attribute__((destructor)) static void +call_g(void) { x = 1448; } + +int +main (void) +{ + + return (x == 1742) ? 0 : 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + mpfr_have_constructor_destructor_attributes=yes +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +if test "$mpfr_have_constructor_destructor_attributes" = "yes"; then + +$as_echo "#define MPFR_HAVE_CONSTRUCTOR_ATTR 1" >>confdefs.h + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fesetround" >&5 +$as_echo_n "checking for fesetround... " >&6; } +if ${mpfr_cv_have_fesetround+:} false; then : + $as_echo_n "(cached) " >&6 +else + +saved_LIBS="$LIBS" +LIBS="$LIBS $MPFR_LIBM" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +fesetround(FE_TONEAREST); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + mpfr_cv_have_fesetround=yes +else + mpfr_cv_have_fesetround=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS="$saved_LIBS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_have_fesetround" >&5 +$as_echo "$mpfr_cv_have_fesetround" >&6; } +if test "$mpfr_cv_have_fesetround" = "yes"; then + +$as_echo "#define MPFR_HAVE_FESETROUND 1" >>confdefs.h + +fi + +if test -n "$GCC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc float-conversion bug" >&5 +$as_echo_n "checking for gcc float-conversion bug... " >&6; } +if ${mpfr_cv_gcc_floatconv_bug+:} false; then : + $as_echo_n "(cached) " >&6 +else + + saved_LIBS="$LIBS" + LIBS="$LIBS $MPFR_LIBM" + if test "$cross_compiling" = yes; then : + mpfr_cv_gcc_floatconv_bug="cannot test, use -ffloat-store" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef MPFR_HAVE_FESETROUND +#include +#endif +static double get_max (void); +int main (void) { + double x = 0.5; + double y; + int i; + for (i = 1; i <= 11; i++) + x *= x; + if (x != 0) + return 1; +#ifdef MPFR_HAVE_FESETROUND + /* Useful test for the G4 PowerPC */ + fesetround(FE_TOWARDZERO); + x = y = get_max (); + x *= 2.0; + if (x != y) + return 1; +#endif + return 0; +} +static double get_max (void) { static volatile double d = DBL_MAX; return d; } + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + mpfr_cv_gcc_floatconv_bug="no" +else + mpfr_cv_gcc_floatconv_bug="yes, use -ffloat-store" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + LIBS="$saved_LIBS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_gcc_floatconv_bug" >&5 +$as_echo "$mpfr_cv_gcc_floatconv_bug" >&6; } + if test "$mpfr_cv_gcc_floatconv_bug" != "no"; then + CFLAGS="$CFLAGS -ffloat-store" + fi +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for subnormal double-precision numbers" >&5 +$as_echo_n "checking for subnormal double-precision numbers... " >&6; } +if ${mpfr_cv_have_denorms+:} false; then : + $as_echo_n "(cached) " >&6 +else + +if test "$cross_compiling" = yes; then : + mpfr_cv_have_denorms="cannot test, assume no" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +int main (void) { + double x = 2.22507385850720138309e-308; + fprintf (stderr, "%e\n", x / 2.0); + return 2.0 * (double) (x / 2.0) != x; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + mpfr_cv_have_denorms="yes" +else + mpfr_cv_have_denorms="no" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_have_denorms" >&5 +$as_echo "$mpfr_cv_have_denorms" >&6; } +if test "$mpfr_cv_have_denorms" = "yes"; then + +$as_echo "#define HAVE_DENORMS 1" >>confdefs.h + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for subnormal single-precision numbers" >&5 +$as_echo_n "checking for subnormal single-precision numbers... " >&6; } +if ${mpfr_cv_have_denorms_flt+:} false; then : + $as_echo_n "(cached) " >&6 +else + +if test "$cross_compiling" = yes; then : + mpfr_cv_have_denorms_flt="cannot test, assume no" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +int main (void) { + float x = 1.17549435082229e-38; + fprintf (stderr, "%e\n", x / 2.0); + return 2.0 * (float) (x / 2.0) != x; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + mpfr_cv_have_denorms_flt="yes" +else + mpfr_cv_have_denorms_flt="no" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_have_denorms_flt" >&5 +$as_echo "$mpfr_cv_have_denorms_flt" >&6; } +if test "$mpfr_cv_have_denorms_flt" = "yes"; then + +$as_echo "#define HAVE_DENORMS_FLT 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for signed zeros" >&5 +$as_echo_n "checking for signed zeros... " >&6; } +if ${mpfr_cv_have_signedz+:} false; then : + $as_echo_n "(cached) " >&6 +else + +if test "$cross_compiling" = yes; then : + mpfr_cv_have_signedz="cannot test, assume no" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) { + return 1.0 / 0.0 == 1.0 / -0.0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + mpfr_cv_have_signedz="yes" +else + mpfr_cv_have_signedz="no" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_have_signedz" >&5 +$as_echo "$mpfr_cv_have_signedz" >&6; } +if test "$mpfr_cv_have_signedz" = "yes"; then + +$as_echo "#define HAVE_SIGNEDZ 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the FP division by 0 fails" >&5 +$as_echo_n "checking if the FP division by 0 fails... " >&6; } +if ${mpfr_cv_errdivzero+:} false; then : + $as_echo_n "(cached) " >&6 +else + +if test "$cross_compiling" = yes; then : + mpfr_cv_errdivzero="cannot test, assume no" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) { + volatile double d = 0.0, x; + x = 0.0 / d; + x = 1.0 / d; + (void) x; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + mpfr_cv_errdivzero="no" +else + mpfr_cv_errdivzero="yes" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_errdivzero" >&5 +$as_echo "$mpfr_cv_errdivzero" >&6; } +if test "$mpfr_cv_errdivzero" = "yes"; then + +$as_echo "#define MPFR_ERRDIVZERO 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The floating-point division by 0 fails instead of" >&5 +$as_echo "$as_me: WARNING: The floating-point division by 0 fails instead of" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: returning a special value: NaN or infinity. Tests" >&5 +$as_echo "$as_me: WARNING: returning a special value: NaN or infinity. Tests" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: involving a FP division by 0 will be disabled." >&5 +$as_echo "$as_me: WARNING: involving a FP division by 0 will be disabled." >&2;} +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if NAN == NAN" >&5 +$as_echo_n "checking if NAN == NAN... " >&6; } +if ${mpfr_cv_nanisnan+:} false; then : + $as_echo_n "(cached) " >&6 +else + +if test "$cross_compiling" = yes; then : + mpfr_cv_nanisnan="cannot test, assume no" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#ifndef NAN +# define NAN (0.0/0.0) +#endif +int main (void) { + double d; + d = NAN; + return d != d; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + mpfr_cv_nanisnan="yes" +else + mpfr_cv_nanisnan="no" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_nanisnan" >&5 +$as_echo "$mpfr_cv_nanisnan" >&6; } +if test "$mpfr_cv_nanisnan" = "yes"; then + +$as_echo "#define MPFR_NANISNAN 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The test NAN != NAN is false. The probable reason is that" >&5 +$as_echo "$as_me: WARNING: The test NAN != NAN is false. The probable reason is that" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: your compiler optimizes floating-point expressions in an" >&5 +$as_echo "$as_me: WARNING: your compiler optimizes floating-point expressions in an" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unsafe way because some option, such as -ffast-math or" >&5 +$as_echo "$as_me: WARNING: unsafe way because some option, such as -ffast-math or" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: -fast (depending on the compiler), has been used. You" >&5 +$as_echo "$as_me: WARNING: -fast (depending on the compiler), has been used. You" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: should NOT use such an option, otherwise MPFR functions" >&5 +$as_echo "$as_me: WARNING: should NOT use such an option, otherwise MPFR functions" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: such as mpfr_get_d and mpfr_set_d may return incorrect" >&5 +$as_echo "$as_me: WARNING: such as mpfr_get_d and mpfr_set_d may return incorrect" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: results on special FP numbers (e.g. NaN or signed zeros)." >&5 +$as_echo "$as_me: WARNING: results on special FP numbers (e.g. NaN or signed zeros)." >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: If you did not use such an option, please send us a bug" >&5 +$as_echo "$as_me: WARNING: If you did not use such an option, please send us a bug" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: report so that we can try to find a workaround for your" >&5 +$as_echo "$as_me: WARNING: report so that we can try to find a workaround for your" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: platform and/or document the behavior." >&5 +$as_echo "$as_me: WARNING: platform and/or document the behavior." >&2;} +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if charset has consecutive values" >&5 +$as_echo_n "checking if charset has consecutive values... " >&6; } +if test "$cross_compiling" = yes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot test" >&5 +$as_echo "cannot test" >&6; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +char *number = "0123456789"; +char *lower = "abcdefghijklmnopqrstuvwxyz"; +char *upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + +int +main (void) +{ + + int i; + unsigned char *p; + for (p = (unsigned char*) number, i = 0; i < 9; i++) + if ( (*p)+1 != *(p+1) ) return 1; + for (p = (unsigned char*) lower, i = 0; i < 25; i++) + if ( (*p)+1 != *(p+1) ) return 1; + for (p = (unsigned char*) upper, i = 0; i < 25; i++) + if ( (*p)+1 != *(p+1) ) return 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define MPFR_NO_CONSECUTIVE_CHARSET 1" >>confdefs.h + + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +saved_LIBS="$LIBS" +LIBS="$LIBS $MPFR_LIBM" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for math/round" >&5 +$as_echo_n "checking for math/round... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +static int f (double (*func)(double)) { return 0; } + +int +main (void) +{ + + return f(round); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_ROUND 1" >>confdefs.h + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for math/trunc" >&5 +$as_echo_n "checking for math/trunc... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +static int f (double (*func)(double)) { return 0; } + +int +main (void) +{ + + return f(trunc); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_TRUNC 1" >>confdefs.h + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for math/floor" >&5 +$as_echo_n "checking for math/floor... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +static int f (double (*func)(double)) { return 0; } + +int +main (void) +{ + + return f(floor); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_FLOOR 1" >>confdefs.h + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for math/ceil" >&5 +$as_echo_n "checking for math/ceil... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +static int f (double (*func)(double)) { return 0; } + +int +main (void) +{ + + return f(ceil); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_CEIL 1" >>confdefs.h + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for math/nearbyint" >&5 +$as_echo_n "checking for math/nearbyint... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +static int f (double (*func)(double)) { return 0; } + +int +main (void) +{ + + return f(nearbyint); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_NEARBYINT 1" >>confdefs.h + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mulx_u64" >&5 +$as_echo_n "checking for _mulx_u64... " >&6; } +if test "$cross_compiling" = yes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot test, assume no" >&5 +$as_echo "cannot test, assume no" >&6; } + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main (void) +{ + + unsigned long long h1, h2; + _mulx_u64(17, 42, &h1); + _mulx_u64(-1, -1, &h2); + return h1 == 0 && h2 == -2 ? 0 : 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_MULX_U64 1" >>confdefs.h + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +LIBS="$saved_LIBS" + + + + +ac_fn_c_check_type "$LINENO" "long double" "ac_cv_type_long_double" "$ac_includes_default" +if test "x$ac_cv_type_long_double" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_LONG_DOUBLE 1 +_ACEOF + + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking format of \`long double' floating point" >&5 +$as_echo_n "checking format of \`long double' floating point... " >&6; } +if ${mpfr_cv_c_long_double_format+:} false; then : + $as_echo_n "(cached) " >&6 +else + mpfr_cv_c_long_double_format=unknown +if test "$ac_cv_type_long_double" != yes; then + mpfr_cv_c_long_double_format="not available" +else + cat >conftest.c <<\EOF + +/* "before" is 16 bytes to ensure there's no padding between it and "x". + We're not expecting any "long double" bigger than 16 bytes or with + alignment requirements stricter than 16 bytes. */ +typedef struct { + char before[16]; + long double x; + char after[8]; +} foo_t; + +foo_t foo = { + { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' }, + -123456789.0, + { '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' } +}; + +EOF + mpfr_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >&5 2>&1" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$mpfr_compile\""; } >&5 + (eval $mpfr_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + cat >conftest.awk <<\EOF + +BEGIN { + found = 0 +} + +# got[] holds a sliding window of bytes read the input. got[0] is the most +# recent byte read, and got[31] the oldest byte read, so when looking to +# match some data the indices are "reversed". +# +{ + for (f = 2; f <= NF; f++) + { + # new byte, shift others up + for (i = 31; i >= 0; i--) + got[i+1] = got[i]; + got[0] = $f; + + # end sequence + if (got[7] != "376") continue + if (got[6] != "334") continue + if (got[5] != "272") continue + if (got[4] != "230") continue + if (got[3] != "166") continue + if (got[2] != "124") continue + if (got[1] != "062") continue + if (got[0] != "020") continue + + # start sequence, with 8-byte body + if (got[23] == "001" && \ + got[22] == "043" && \ + got[21] == "105" && \ + got[20] == "147" && \ + got[19] == "211" && \ + got[18] == "253" && \ + got[17] == "315" && \ + got[16] == "357") + { + saw = " (" got[15] \ + " " got[14] \ + " " got[13] \ + " " got[12] \ + " " got[11] \ + " " got[10] \ + " " got[9] \ + " " got[8] ")" + + if (got[15] == "301" && \ + got[14] == "235" && \ + got[13] == "157" && \ + got[12] == "064" && \ + got[11] == "124" && \ + got[10] == "000" && \ + got[9] == "000" && \ + got[8] == "000") + { + print "IEEE double, big endian" + found = 1 + exit + } + + if (got[15] == "000" && \ + got[14] == "000" && \ + got[13] == "000" && \ + got[12] == "124" && \ + got[11] == "064" && \ + got[10] == "157" && \ + got[9] == "235" && \ + got[8] == "301") + { + print "IEEE double, little endian" + found = 1 + exit + } + } + + # start sequence, with 12-byte body + if (got[27] == "001" && \ + got[26] == "043" && \ + got[25] == "105" && \ + got[24] == "147" && \ + got[23] == "211" && \ + got[22] == "253" && \ + got[21] == "315" && \ + got[20] == "357") + { + saw = " (" got[19] \ + " " got[18] \ + " " got[17] \ + " " got[16] \ + " " got[15] \ + " " got[14] \ + " " got[13] \ + " " got[12] \ + " " got[11] \ + " " got[10] \ + " " got[9] \ + " " got[8] ")" + + if (got[19] == "000" && \ + got[18] == "000" && \ + got[17] == "000" && \ + got[16] == "000" && \ + got[15] == "240" && \ + got[14] == "242" && \ + got[13] == "171" && \ + got[12] == "353" && \ + got[11] == "031" && \ + got[10] == "300") + { + print "IEEE extended, little endian" + found = 1 + exit + } + + if (got[19] == "300" && \ + got[18] == "031" && \ + got[17] == "000" && \ + got[16] == "000" && \ + got[15] == "353" && \ + got[14] == "171" && \ + got[13] == "242" && \ + got[12] == "240" && \ + got[11] == "000" && \ + got[10] == "000" && \ + got[09] == "000" && \ + got[08] == "000") + { + # format found on m68k + print "IEEE extended, big endian" + found = 1 + exit + } + } + + # start sequence, with 16-byte body + if (got[31] == "001" && \ + got[30] == "043" && \ + got[29] == "105" && \ + got[28] == "147" && \ + got[27] == "211" && \ + got[26] == "253" && \ + got[25] == "315" && \ + got[24] == "357") + { + saw = " (" got[23] \ + " " got[22] \ + " " got[21] \ + " " got[20] \ + " " got[19] \ + " " got[18] \ + " " got[17] \ + " " got[16] \ + " " got[15] \ + " " got[14] \ + " " got[13] \ + " " got[12] \ + " " got[11] \ + " " got[10] \ + " " got[9] \ + " " got[8] ")" + + if (got[23] == "000" && \ + got[22] == "000" && \ + got[21] == "000" && \ + got[20] == "000" && \ + got[19] == "240" && \ + got[18] == "242" && \ + got[17] == "171" && \ + got[16] == "353" && \ + got[15] == "031" && \ + got[14] == "300") + { + print "IEEE extended, little endian" + found = 1 + exit + } + + if (got[23] == "300" && \ + got[22] == "031" && \ + got[21] == "326" && \ + got[20] == "363" && \ + got[19] == "105" && \ + got[18] == "100" && \ + got[17] == "000" && \ + got[16] == "000" && \ + got[15] == "000" && \ + got[14] == "000" && \ + got[13] == "000" && \ + got[12] == "000" && \ + got[11] == "000" && \ + got[10] == "000" && \ + got[9] == "000" && \ + got[8] == "000") + { + # format used on HP 9000/785 under HP-UX + print "IEEE quad, big endian" + found = 1 + exit + } + + if (got[23] == "000" && \ + got[22] == "000" && \ + got[21] == "000" && \ + got[20] == "000" && \ + got[19] == "000" && \ + got[18] == "000" && \ + got[17] == "000" && \ + got[16] == "000" && \ + got[15] == "000" && \ + got[14] == "000" && \ + got[13] == "100" && \ + got[12] == "105" && \ + got[11] == "363" && \ + got[10] == "326" && \ + got[9] == "031" && \ + got[8] == "300") + { + print "IEEE quad, little endian" + found = 1 + exit + } + + if (got[23] == "301" && \ + got[22] == "235" && \ + got[21] == "157" && \ + got[20] == "064" && \ + got[19] == "124" && \ + got[18] == "000" && \ + got[17] == "000" && \ + got[16] == "000" && \ + got[15] == "000" && \ + got[14] == "000" && \ + got[13] == "000" && \ + got[12] == "000" && \ + got[11] == "000" && \ + got[10] == "000" && \ + got[9] == "000" && \ + got[8] == "000") + { + # format used on 32-bit PowerPC (Mac OS X and Debian GNU/Linux) + print "possibly double-double, big endian" + found = 1 + exit + } + + if (got[23] == "000" && \ + got[22] == "000" && \ + got[21] == "000" && \ + got[20] == "124" && \ + got[19] == "064" && \ + got[18] == "157" && \ + got[17] == "235" && \ + got[16] == "301" && \ + got[15] == "000" && \ + got[14] == "000" && \ + got[13] == "000" && \ + got[12] == "000" && \ + got[11] == "000" && \ + got[10] == "000" && \ + got[9] == "000" && \ + got[8] == "000") + { + # format used on ppc64le + print "possibly double-double, little endian" + found = 1 + exit + } + } + } +} +END { + if (! found) + print "unknown", saw +} +EOF + mpfr_cv_c_long_double_format=`od -b conftest.$OBJEXT | $AWK -f conftest.awk` + case $mpfr_cv_c_long_double_format in + unknown*) + echo "cannot match anything, conftest.$OBJEXT contains" >&5 + od -b conftest.$OBJEXT >&5 + ;; + esac + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: oops, cannot compile test program" >&5 +$as_echo "$as_me: WARNING: oops, cannot compile test program" >&2;} + fi fi - +rm -f conftest* fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_c_long_double_format" >&5 +$as_echo "$mpfr_cv_c_long_double_format" >&6; } -fi +case $mpfr_cv_c_long_double_format in + "IEEE double, big endian") + $as_echo "#define HAVE_LDOUBLE_IS_DOUBLE 1" >>confdefs.h -fi + ;; + "IEEE double, little endian") + $as_echo "#define HAVE_LDOUBLE_IS_DOUBLE 1" >>confdefs.h ;; - esac + "IEEE extended, little endian") + $as_echo "#define HAVE_LDOUBLE_IEEE_EXT_LITTLE 1" >>confdefs.h - if test no = "$lt_cv_dlopen"; then - enable_dlopen=no - else - enable_dlopen=yes - fi + ;; + "IEEE extended, big endian") + $as_echo "#define HAVE_LDOUBLE_IEEE_EXT_BIG 1" >>confdefs.h - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS=$CPPFLAGS - test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + ;; + "IEEE quad, big endian") + $as_echo "#define HAVE_LDOUBLE_IEEE_QUAD_BIG 1" >>confdefs.h - save_LDFLAGS=$LDFLAGS - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + ;; + "IEEE quad, little endian") + $as_echo "#define HAVE_LDOUBLE_IEEE_QUAD_LITTLE 1" >>confdefs.h - save_LIBS=$LIBS - LIBS="$lt_cv_dlopen_libs $LIBS" + ;; + "possibly double-double, big endian") + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This format is known on GCC/PowerPC platforms," >&5 +$as_echo "$as_me: WARNING: This format is known on GCC/PowerPC platforms," >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: but due to GCC PR26374, we can't test further." >&5 +$as_echo "$as_me: WARNING: but due to GCC PR26374, we can't test further." >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You can safely ignore this warning, though." >&5 +$as_echo "$as_me: WARNING: You can safely ignore this warning, though." >&2;} + $as_echo "#define HAVE_LDOUBLE_MAYBE_DOUBLE_DOUBLE 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test yes = "$cross_compiling"; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" + ;; + "possibly double-double, little endian") + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This format is known on GCC/PowerPC platforms," >&5 +$as_echo "$as_me: WARNING: This format is known on GCC/PowerPC platforms," >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: but due to GCC PR26374, we can't test further." >&5 +$as_echo "$as_me: WARNING: but due to GCC PR26374, we can't test further." >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You can safely ignore this warning, though." >&5 +$as_echo "$as_me: WARNING: You can safely ignore this warning, though." >&2;} + $as_echo "#define HAVE_LDOUBLE_MAYBE_DOUBLE_DOUBLE 1" >>confdefs.h -#if HAVE_DLFCN_H -#include -#endif + ;; + unknown* | "not available") + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized long double FP format: $mpfr_cv_c_long_double_format" >&5 +$as_echo "$as_me: WARNING: unrecognized long double FP format: $mpfr_cv_c_long_double_format" >&2;} + ;; +esac -#include -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif +if test "$enable_thread_safe" != no; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TLS support using C11" >&5 +$as_echo_n "checking for TLS support using C11... " >&6; } +saved_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS -I$srcdir/src" +if test "$cross_compiling" = yes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot test, assume no" >&5 +$as_echo "cannot test, assume no" >&6; } -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -/* When -fvisibility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif +#define MPFR_USE_THREAD_SAFE 1 +#define MPFR_USE_C11_THREAD_SAFE 1 +#include "mpfr-thread.h" +MPFR_THREAD_ATTR int x = 17; +int main (void) { + return x != 17; +} -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); +$as_echo "#define MPFR_USE_THREAD_SAFE 1" >>confdefs.h - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* +$as_echo "#define MPFR_USE_C11_THREAD_SAFE 1" >>confdefs.h -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } + tls_c11_support=yes + enable_thread_safe=yes - if test yes = "$lt_cv_dlopen_self"; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self_static+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test yes = "$cross_compiling"; then : - lt_cv_dlopen_self_static=cross else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } -#if HAVE_DLFCN_H -#include -#endif +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi -#include +CPPFLAGS="$saved_CPPFLAGS" -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif +if test "$tls_c11_support" != "yes" +then -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TLS support" >&5 +$as_echo_n "checking for TLS support... " >&6; } + saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I$srcdir/src" + if test "$cross_compiling" = yes; then : + if test "$enable_thread_safe" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot test, assume yes" >&5 +$as_echo "cannot test, assume yes" >&6; } -/* When -fvisibility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif +$as_echo "#define MPFR_USE_THREAD_SAFE 1" >>confdefs.h -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot test, assume no" >&5 +$as_echo "cannot test, assume no" >&6; } + fi - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* + #define MPFR_USE_THREAD_SAFE 1 + #include "mpfr-thread.h" + MPFR_THREAD_ATTR int x = 17; + int main (void) { + return x != 17; + } +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } - fi +$as_echo "#define MPFR_USE_THREAD_SAFE 1" >>confdefs.h - CPPFLAGS=$save_CPPFLAGS - LDFLAGS=$save_LDFLAGS - LIBS=$save_LIBS - ;; - esac + enable_thread_safe=yes - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + if test "$enable_thread_safe" = yes; then + as_fn_error $? "please configure with --disable-thread-safe" "$LINENO" 5 + fi - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi + CPPFLAGS="$saved_CPPFLAGS" + fi +fi +if test "$enable_decimal_float" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler knows _Decimal64" >&5 +$as_echo_n "checking if compiler knows _Decimal64... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +_Decimal64 x; +int +main (void) +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking decimal float format" >&5 +$as_echo_n "checking decimal float format... " >&6; } + if test "$cross_compiling" = yes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: assuming DPD" >&5 +$as_echo "assuming DPD" >&6; } + $as_echo "#define DPD_FORMAT 1" >>confdefs.h +$as_echo "#define MPFR_WANT_DECIMAL_FLOATS 1" >>confdefs.h +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +volatile _Decimal64 x = 1; +union { double d; _Decimal64 d64; } y; +if (x != x) return 83; +y.d64 = 1234567890123456.0dd; +return y.d == 0.14894469406741037E-123 ? 80 : + y.d == 0.59075095508629822E-68 ? 81 : 82; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: internal error" >&5 +$as_echo "internal error" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "unexpected exit status 0 +See \`config.log' for more details" "$LINENO" 5; } +else + d64_exit_status=$? + case "$d64_exit_status" in + 80) { $as_echo "$as_me:${as_lineno-$LINENO}: result: DPD" >&5 +$as_echo "DPD" >&6; } +$as_echo "#define DPD_FORMAT 1" >>confdefs.h +$as_echo "#define MPFR_WANT_DECIMAL_FLOATS 1" >>confdefs.h + ;; + 81) { $as_echo "$as_me:${as_lineno-$LINENO}: result: BID" >&5 +$as_echo "BID" >&6; } +$as_echo "#define MPFR_WANT_DECIMAL_FLOATS 1" >>confdefs.h + ;; + 82) { $as_echo "$as_me:${as_lineno-$LINENO}: result: neither DPD nor BID" >&5 +$as_echo "neither DPD nor BID" >&6; } + if test "$enable_decimal_float" = yes; then + as_fn_error $? "unsupported decimal float format. +Please build MPFR without --enable-decimal-float." "$LINENO" 5 + fi ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown (exit status $d64_exit_status)" >&5 +$as_echo "unknown (exit status $d64_exit_status)" >&6; } + if test "$enable_decimal_float" = yes; then + as_fn_error $? "internal or link error. +Please build MPFR without --enable-decimal-float." "$LINENO" 5 + fi ;; + esac +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - -striplib= -old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP"; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - ;; - esac + if test "$enable_decimal_float" = yes; then + as_fn_error $? "compiler doesn't know _Decimal64 (ISO/IEC TR 24732). +Please use another compiler or build MPFR without --enable-decimal-float." "$LINENO" 5 + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +if test "$enable_float128" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if __float128 with hex constants is supported" >&5 +$as_echo_n "checking if __float128 with hex constants is supported... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +volatile __float128 x = 0x1.fp+16383q; +return x == 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +$as_echo "#define MPFR_WANT_FLOAT128 1" >>confdefs.h +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + if test "$enable_float128" = yes; then + as_fn_error $? "compiler doesn't know __float128 with C99 constants +Please use another compiler or build MPFR without --enable-float128." "$LINENO" 5 + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Static Assertion support" >&5 +$as_echo_n "checking for Static Assertion support... " >&6; } +saved_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS -I$srcdir/src" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define MPFR_USE_STATIC_ASSERT 1 +#include "mpfr-sassert.h" +/* Test if Static Assertions work */ +MPFR_DECL_STATIC_ASSERT(sizeof(char) <= sizeof(int)); +int main (void) { + MPFR_DECL_STATIC_ASSERT(sizeof(int) <= sizeof(long)); + int x; + (void) (x = 1); /* cast to void: avoid a warning, at least with GCC */ + /* Test of the macro after a declaraction and a statement. */ + MPFR_STAT_STATIC_ASSERT(sizeof(short) <= sizeof(int)); + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +$as_echo "#define MPFR_USE_STATIC_ASSERT 1" >>confdefs.h - # Report what library types will actually be built - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } - test no = "$can_build_shared" && enable_shared=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +CPPFLAGS="$saved_CPPFLAGS" - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test yes = "$enable_shared" && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; +if test "$enable_lto" = "yes" ; then - aix[4-9]*) - if test ia64 != "$host_cpu"; then - case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in - yes,aix,yes) ;; # shared object as lib.so file only - yes,svr4,*) ;; # shared object as lib.so archive member only - yes,*) enable_static=no ;; # shared object in lib.a archive as well - esac - fi - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } +CFLAGS="$CFLAGS -flto" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } - # Make sure either enable_shared or enable_static is yes. - test yes = "$enable_shared" || enable_static=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if Link Time Optimisation flag '-flto' is supported..." >&5 +$as_echo_n "checking if Link Time Optimisation flag '-flto' is supported...... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void) { return 0; } +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "Link Time Optimisation flag '-flto' is not supported." "$LINENO" 5 fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC=$lt_save_CC +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +mpfr_compile_and_link() +{ + echo "int f(int); int f(int n) { return n; }" > conftest-f.c + echo "int f(int); int main() { return f(0); }" > conftest-m.c + echo "$CC $CFLAGS -c -o conftest-f.o conftest-f.c" >&2 + $CC $CFLAGS -c -o conftest-f.o conftest-f.c || return 1 + echo "$AR cru conftest-lib.a conftest-f.o" >&2 + $AR cru conftest-lib.a conftest-f.o || return 1 + echo "$RANLIB conftest-lib.a" >&2 + $RANLIB conftest-lib.a || return 1 + echo "$CC $CFLAGS conftest-m.c conftest-lib.a" >&2 + $CC $CFLAGS conftest-m.c conftest-lib.a || return 1 + return 0 +} + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Link Time Optimisation works with AR=$AR" >&5 +$as_echo_n "checking if Link Time Optimisation works with AR=$AR... " >&6; } + if mpfr_compile_and_link 2> conftest-log1.txt ; then + cat conftest-log1.txt >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + cat conftest-log1.txt >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + AR=gcc-ar + RANLIB=gcc-ranlib + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Link Time Optimisation works with AR=$AR" >&5 +$as_echo_n "checking if Link Time Optimisation works with AR=$AR... " >&6; } + if mpfr_compile_and_link 2> conftest-log2.txt; then + cat conftest-log2.txt >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + cat conftest-log2.txt >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "Link Time Optimisation is not supported (see config.log for details)." "$LINENO" 5 + fi + fi +rm -f conftest* +fi +# (Based on GMP 5.1) +# clock_gettime is in librt on *-*-osf5.1 and on glibc < 2.17, so add -lrt to +# TUNE_LIBS if needed (e.g. if clock_gettime is not already in the C library). +# On linux (tested on x86_32, 2.6.26), clock_getres reports ns accuracy, +# while in a quick test on osf, clock_getres said only 1 millisecond. +old_LIBS="$LIBS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 +$as_echo_n "checking for library containing clock_gettime... " >&6; } +if ${ac_cv_search_clock_gettime+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (); +int +main (void) +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +for ac_lib in '' rt; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_clock_gettime=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_clock_gettime+:} false; then : + break +fi +done +if ${ac_cv_search_clock_gettime+:} false; then : +else + ac_cv_search_clock_gettime=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 +$as_echo "$ac_cv_search_clock_gettime" >&6; } +ac_res=$ac_cv_search_clock_gettime +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" +$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h +fi +TUNE_LIBS="$LIBS" +LIBS="$old_LIBS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gmp.h" >&5 +$as_echo_n "checking for gmp.h... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - ac_config_commands="$ac_config_commands libtool" +#include "gmp.h" +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "gmp.h can't be found, or is unusable." "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Only expand once: case $host in @@ -15403,7 +16957,7 @@ $as_echo_n "checking for DLL/static GMP... " >&6; } if test "$enable_shared" = yes; then MPFR_LDFLAGS="$MPFR_LDFLAGS -no-undefined" - LIBMPFR_LDFLAGS="$LIBMPFR_LDFLAGS -Wl,--output-def,.libs/libmpfr-4.dll.def" + LIBMPFR_LDFLAGS="$LIBMPFR_LDFLAGS -Wl,--output-def,.libs/libmpfr-6.dll.def" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -15428,7 +16982,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5 $as_echo "static" >&6; } - as_fn_error $? "gmp.h isn't a DLL: use --enable-static --disable-shared" "$LINENO" 5 + as_fn_error $? "libgmp isn't provided as a DLL: use --enable-static --disable-shared" "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else @@ -15456,13 +17010,40 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: DLL" >&5 $as_echo "DLL" >&6; } - as_fn_error $? "gmp.h is a DLL: use --disable-static --enable-shared" "$LINENO" 5 + as_fn_error $? "libgmp is provided as a DLL: use --disable-static --enable-shared" "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ;; esac +case $host in + *-*-linux*) + if test -n "$LD_LIBRARY_PATH"; then + saved_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--disable-new-dtags" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether --disable-new-dtags is supported by the linker" >&5 +$as_echo_n "checking whether --disable-new-dtags is supported by the linker... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) { return 0; } + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (use it since LD_LIBRARY_PATH is set)" >&5 +$as_echo "yes (use it since LD_LIBRARY_PATH is set)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + LDFLAGS="$saved_LDFLAGS" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + ;; +esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc __attribute__ ((mode (XX))) works" >&5 @@ -15500,14 +17081,15 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for recent GMP" >&5 +if test -z "$enable_mini_gmp" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for recent GMP" >&5 $as_echo_n "checking for recent GMP... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "gmp.h" -#if (__GNU_MP_VERSION*100+__GNU_MP_VERSION_MINOR*10 < 410) -# error "min GMP version is 4.1.0" +#if (__GNU_MP_VERSION*100+__GNU_MP_VERSION_MINOR*10 < 500) +# error "GMP 5.0.0 or newer is required" error #endif @@ -15517,12 +17099,13 @@ $as_echo "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - as_fn_error $? "GMP 4.1.0 min required" "$LINENO" 5 + as_fn_error $? "GMP 5.0.0 or newer is required" "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking usable gmp.h at link time" >&5 $as_echo_n "checking usable gmp.h at link time... " >&6; } @@ -15546,10 +17129,8 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - as_fn_error $? "There is an incompatibility between gmp.h and the compiler. -See 'config.log' for details. -Such an incompatibility is known between GMP 4.1, which uses -\"extern __inline__\" with all GCC versions, and GCC 5." "$LINENO" 5 + as_fn_error $? "there is an incompatibility between gmp.h and the compiler. +See 'config.log' for details." "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext \ @@ -15627,10 +17208,10 @@ fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __gmpz_init in -lgmp" >&5 -$as_echo_n "checking for __gmpz_init in -lgmp... " >&6; } -if ${ac_cv_lib_gmp___gmpz_init+:} false; then : +as_ac_Lib=`$as_echo "ac_cv_lib_gmp_$test_libgmp" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $test_libgmp in -lgmp" >&5 +$as_echo_n "checking for $test_libgmp in -lgmp... " >&6; } +if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -15644,27 +17225,28 @@ #ifdef __cplusplus extern "C" #endif -char __gmpz_init (); +char $test_libgmp (); int main (void) { -return __gmpz_init (); +return $test_libgmp (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gmp___gmpz_init=yes + eval "$as_ac_Lib=yes" else - ac_cv_lib_gmp___gmpz_init=no + eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gmp___gmpz_init" >&5 -$as_echo "$ac_cv_lib_gmp___gmpz_init" >&6; } -if test "x$ac_cv_lib_gmp___gmpz_init" = xyes; then : +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : LIBS="-lgmp $LIBS" else as_fn_error $? "libgmp not found or uses a different ABI (including static vs shared). @@ -15674,10 +17256,11 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmp.h version and libgmp version are the same" >&5 $as_echo_n "checking if gmp.h version and libgmp version are the same... " >&6; } -saved_LD_RUN_PATH="$LD_RUN_PATH" -LD_RUN_PATH="${LD_RUN_PATH:+$LD_RUN_PATH$PATH_SEPARATOR}$gmp_lib_path" -export LD_RUN_PATH -if test "$cross_compiling" = yes; then : +if test -z "$enable_mini_gmp" ; then + saved_LD_RUN_PATH="$LD_RUN_PATH" + LD_RUN_PATH="${LD_RUN_PATH:+$LD_RUN_PATH$PATH_SEPARATOR}$gmp_lib_path" + export LD_RUN_PATH + if test "$cross_compiling" = yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot test" >&5 $as_echo "cannot test" >&6; } @@ -15697,6 +17280,9 @@ sprintf (buffer, "%d.%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL); printf ("(%s/%s) ", buffer, gmp_version); + fflush (stdout); + /* Also put information in config.log (stderr) */ + fprintf (stderr, "gmp.h: %s / libgmp: %s\n", buffer, gmp_version); if (strcmp (buffer, gmp_version) == 0) return 0; if (__GNU_MP_VERSION_PATCHLEVEL != 0) @@ -15996,6 +17582,8 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compiling" >&5 $as_echo "cross-compiling" >&6; } +$as_echo "#define PRINTF_L 1" >>confdefs.h + else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -16025,6 +17613,8 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +$as_echo "#define PRINTF_L 1" >>confdefs.h + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -16045,6 +17635,8 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compiling" >&5 $as_echo "cross-compiling" >&6; } +$as_echo "#define PRINTF_T 1" >>confdefs.h + else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -16079,6 +17671,8 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +$as_echo "#define PRINTF_T 1" >>confdefs.h + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -16092,6 +17686,47 @@ + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmp_printf supports the ' group flag" >&5 +$as_echo_n "checking if gmp_printf supports the ' group flag... " >&6; } +if test "$cross_compiling" = yes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot test" >&5 +$as_echo "cannot test" >&6; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main (void) +{ + + char s[256]; + + if (gmp_sprintf (s, "%'d", 17) == -1) return 1; + return (strcmp (s, "17") != 0); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define PRINTF_GROUPFLAG 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -16133,15 +17768,95 @@ conftest.$ac_objext conftest.beam conftest.$ac_ext fi -LD_RUN_PATH="$saved_LD_RUN_PATH" + LD_RUN_PATH="$saved_LD_RUN_PATH" +fi -for ac_func in __gmpn_rootrem __gmpn_sbpi1_divappr_q +for ac_func in __gmpn_sbpi1_divappr_q do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + ac_fn_c_check_func "$LINENO" "__gmpn_sbpi1_divappr_q" "ac_cv_func___gmpn_sbpi1_divappr_q" +if test "x$ac_cv_func___gmpn_sbpi1_divappr_q" = xyes; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define HAVE___GMPN_SBPI1_DIVAPPR_Q 1 +_ACEOF + +fi +done + +for ac_func in __gmpn_invert_limb +do : + ac_fn_c_check_func "$LINENO" "__gmpn_invert_limb" "ac_cv_func___gmpn_invert_limb" +if test "x$ac_cv_func___gmpn_invert_limb" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE___GMPN_INVERT_LIMB 1 +_ACEOF + +fi +done + +for ac_func in __gmpn_rsblsh_n +do : + ac_fn_c_check_func "$LINENO" "__gmpn_rsblsh_n" "ac_cv_func___gmpn_rsblsh_n" +if test "x$ac_cv_func___gmpn_rsblsh_n" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE___GMPN_RSBLSH_N 1 +_ACEOF + +fi +done + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for long to fit in mp_limb_t" >&5 +$as_echo_n "checking for long to fit in mp_limb_t... " >&6; } +if ${mpfr_cv_long_within_limb+:} false; then : + $as_echo_n "(cached) " >&6 +else + +saved_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS -I$srcdir/src" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include "mpfr-sassert.h" + +int +main (void) +{ + + MPFR_STAT_STATIC_ASSERT ((mp_limb_t) -1 >= (unsigned long) -1); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mpfr_cv_long_within_limb="yes" +else + mpfr_cv_long_within_limb="no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_long_within_limb" >&5 +$as_echo "$mpfr_cv_long_within_limb" >&6; } +case $mpfr_cv_long_within_limb in +yes*) + +$as_echo "#define MPFR_LONG_WITHIN_LIMB 1" >>confdefs.h + +esac +CPPFLAGS="$saved_CPPFLAGS" + + +for ac_func in getrusage +do : + ac_fn_c_check_func "$LINENO" "getrusage" "ac_cv_func_getrusage" +if test "x$ac_cv_func_getrusage" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GETRUSAGE 1 _ACEOF fi @@ -16174,7 +17889,7 @@ $srcdir/tests/*.c\`` fi -ac_config_files="$ac_config_files Makefile doc/Makefile src/Makefile tests/Makefile tune/Makefile src/mparam.h:src/mparam_h.in" +ac_config_files="$ac_config_files Makefile mpfr.pc doc/Makefile src/Makefile tests/Makefile tune/Makefile src/mparam.h:src/mparam_h.in tools/bench/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -16746,7 +18461,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by MPFR $as_me 3.1.4, which was +This file was extended by MPFR $as_me 4.0.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16803,7 +18518,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -MPFR config.status 3.1.4 +MPFR config.status 4.0.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -16911,7 +18626,7 @@ # # INIT-COMMANDS # -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" # The HP-UX ksh and POSIX shell print the target directory to stdout @@ -17209,11 +18924,13 @@ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "mpfr.pc") CONFIG_FILES="$CONFIG_FILES mpfr.pc" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "tune/Makefile") CONFIG_FILES="$CONFIG_FILES tune/Makefile" ;; "src/mparam.h") CONFIG_FILES="$CONFIG_FILES src/mparam.h:src/mparam_h.in" ;; + "tools/bench/Makefile") CONFIG_FILES="$CONFIG_FILES tools/bench/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac @@ -17647,29 +19364,35 @@ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -17687,53 +19410,48 @@ q } s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } - /^X\(\/\/\)$/{ + /^X\/\(\/\/\)$/{ s//\1/ q } - /^X\(\/\).*/{ + /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? done + if test $am_rc -ne 0; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. Try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk } ;; "libtool":C) @@ -17751,7 +19469,6 @@ cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. diff -Nru mpfr4-3.1.4/configure.ac mpfr4-4.0.2/configure.ac --- mpfr4-3.1.4/configure.ac 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/configure.ac 2019-01-31 20:29:48.000000000 +0000 @@ -1,7 +1,10 @@ dnl Process this file with autoconf to produce a configure script. +dnl WARNING! C code starting with # (preprocessor directives) must not +dnl be indented! + AC_COPYRIGHT([ -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,12 +21,12 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. ]) dnl Add check-news when it checks for more than 15 lines -AC_INIT([MPFR],[3.1.4]) +AC_INIT([MPFR],[4.0.2]) dnl Older Automake versions than 1.13 may still be supported, but no longer dnl tested, and many things have changed in 1.13. Moreover the INSTALL file @@ -34,10 +37,15 @@ AC_CONFIG_MACRO_DIR([m4]) -dnl FIXME: The AC_ARG_ENABLE(decimal-float...) part does things too -dnl early, even when this option is not used. In particular, it must -dnl be put after AC_PROG_CC; another problem is that the GMP CFLAGS -dnl and CC check may modify the compiler. +dnl FIXME: Several AC_RUN_IFELSE programs can return several values +dnl (one for each format to be detected), but the Autoconf manual says: +dnl "This exit status might be that of a failed compilation, or it might +dnl be that of a failed program execution." Unfortunately, we cannot +dnl know whether a non-zero exit status comes from a failed compilation, +dnl so that the detection may be incorrect. To avoid this problem, write +dnl a test program for each possible format? Alternatively, the test +dnl program could output the result of the format detection to a file +dnl and return with the 0 exit status if it could do that successfully. test_CFLAGS=${CFLAGS+set} @@ -59,17 +67,21 @@ dnl AC_CONFIG_HEADERS([mpfrconf.h:mpfrconf.in]) dnl Extra arguments to configure + unset gmp_lib_path GMP_CFLAGS GMP_CC + AC_ARG_WITH(gmp_include, [ --with-gmp-include=DIR GMP include directory ], MPFR_PARSE_DIRECTORY(["$withval"],[withval]) CPPFLAGS="$CPPFLAGS -I$withval") + AC_ARG_WITH(gmp_lib, [ --with-gmp-lib=DIR GMP lib directory ], [ MPFR_PARSE_DIRECTORY(["$withval"],[withval]) LDFLAGS="$LDFLAGS -L$withval" gmp_lib_path="$withval" ]) + AC_ARG_WITH(gmp, [ --with-gmp=DIR GMP install directory ], [ MPFR_PARSE_DIRECTORY(["$withval"],[withval]) @@ -124,19 +136,22 @@ AC_ARG_ENABLE(assert, [ --enable-assert enable ASSERT checking [[default=no]]], [ case $enableval in - yes) AC_DEFINE([MPFR_WANT_ASSERT],1,[Want assertion]) ;; + yes) AC_DEFINE([MPFR_WANT_ASSERT],1,[Want all simple assertions]) ;; + none) AC_DEFINE([MPFR_WANT_ASSERT],-1,[Do no want any assertion]) ;; no) ;; - full) AC_DEFINE([MPFR_WANT_ASSERT],2,[Want assertion]) ;; - *) AC_MSG_ERROR([bad value for --enable-assert: yes, no or full]) ;; + full) AC_DEFINE([MPFR_WANT_ASSERT],2,[Want full assertions]) ;; + *) AC_MSG_ERROR([bad value for --enable-assert: yes, no, none or full]) ;; esac]) + AC_ARG_ENABLE(logging, [ --enable-logging enable MPFR logging (the system must support it) [[default=no]]], [ case $enableval in - yes) AC_DEFINE([MPFR_USE_LOGGING],1,[Log what MPFR does]) ;; + yes) AC_DEFINE([MPFR_USE_LOGGING],1,[Enable MPFR logging support]) ;; no) ;; *) AC_MSG_ERROR([bad value for --enable-logging: yes or no]) ;; esac]) + AC_ARG_ENABLE(thread-safe, [ --disable-thread-safe explicitly disable TLS support --enable-thread-safe build MPFR as thread safe, i.e. with TLS support @@ -146,6 +161,18 @@ no) ;; *) AC_MSG_ERROR([bad value for --enable-thread-safe: yes or no]) ;; esac]) + +AC_ARG_ENABLE(shared-cache, + [ --enable-shared-cache enable use of caches shared by all threads, + for all MPFR constants. It usually makes MPFR + dependent on PTHREAD [[default=no]]], + [ case $enableval in + yes) + AC_DEFINE([MPFR_WANT_SHARED_CACHE],1,[Want shared cache]) ;; + no) ;; + *) AC_MSG_ERROR([bad value for --enable-shared-cache: yes or no]) ;; + esac]) + AC_ARG_ENABLE(warnings, [ --enable-warnings allow MPFR to output warnings to stderr [[default=no]]], [ case $enableval in @@ -155,9 +182,11 @@ esac]) AC_ARG_ENABLE(tests-timeout, - [ --enable-tests-timeout=NUM enable timeout (NUM seconds) for test programs - (NUM <= 9999) [[default=no]]; if enabled, env variable - $MPFR_TESTS_TIMEOUT overrides NUM (0: no timeout).], + [ --enable-tests-timeout=NUM + [[for developers]] enable timeout for test programs + (NUM seconds, <= 9999) [[default=no]]; if this is + enabled, the environment variable $MPFR_TESTS_TIMEOUT + overrides NUM (0: no timeout)], [ case $enableval in no) ;; yes) AC_DEFINE([MPFR_TESTS_TIMEOUT], 0, [timeout limit]) ;; @@ -166,6 +195,39 @@ *) AC_MSG_ERROR([bad value for --enable-tests-timeout]) ;; esac]) +AC_ARG_ENABLE(tune-for-coverage, + [ --enable-tune-for-coverage + [[for developers]] tune MPFR for coverage tests], + [ case $enableval in + no) ;; + yes) AC_DEFINE([MPFR_TUNE_COVERAGE], 1, [tune for coverage]) ;; + *) AC_MSG_ERROR([bad value for --enable-tune-for-coverage]) ;; + esac]) + +dnl First, detect incompatibilities between the above configure options. +AC_MSG_CHECKING([whether configure options are compatible]) +if test "$enable_logging" = yes; then + if test "$enable_thread_safe" = yes; then + AC_MSG_RESULT([no]) + AC_MSG_ERROR([enable either logging or thread-safe, not both]) + fi +dnl The following test is done only to output a specific error message, +dnl as there would otherwise be an error due to enable_thread_safe=no. + if test "$enable_shared_cache" = yes; then + AC_MSG_RESULT([no]) + AC_MSG_ERROR([shared cache does not work with logging support]) + fi + enable_thread_safe=no +fi +if test "$enable_shared_cache" = yes; then + if test "$enable_thread_safe" = no; then + AC_MSG_RESULT([no]) + AC_MSG_ERROR([shared cache needs thread-safe support]) + fi + enable_thread_safe=yes +fi +AC_MSG_RESULT([yes]) + dnl dnl Setup CC and CFLAGS @@ -186,7 +248,7 @@ dnl checking related to this compiler (such as dependency tracking dnl options); if the compiler changes due to __GMP_CC in gmp.h, one dnl would have incorrect settings. -dnl FIXME: Move this in aclocal ? +dnl FIXME: Move this in acinclude.m4 ? if test -z "$GMP_CC$GMP_CFLAGS" ; then AC_MSG_CHECKING(for CC and CFLAGS in gmp.h) GMP_CC=__GMP_CC @@ -194,35 +256,32 @@ # /lib/cpp under Solaris doesn't support some environment variables # used by GCC, such as C_INCLUDE_PATH. If the user has set up such # environment variables, he probably wants to use them. So, let us - # prefer cpp and gcc to /lib/cpp. - for cpp in cpp gcc /lib/cpp cc c99 + # prefer cpp and gcc to /lib/cpp. However, note that this won't + # work if GCC has been installed with versioned names only (e.g. + # with cpp-5 and gcc-5). + for cpp in "cpp -P" "cpp" "gcc -P -E" "gcc -E" "/lib/cpp -P" "/lib/cpp" "cc -P -E" "cc -E" "c99 -P -E" "c99 -E" "clang -E" "cl -E" "icl -E" do - case $cpp in - *cpp*) ;; - *) cpp="$cpp -E" ;; - esac - echo foo > conftest.c - if $cpp $CPPFLAGS conftest.c > /dev/null 2> /dev/null ; then - # Get CC - echo "#include \"gmp.h\"" > conftest.c - echo "MPFR_OPTION __GMP_CC" >> conftest.c - GMP_CC=`$cpp $CPPFLAGS conftest.c 2> /dev/null | $EGREP MPFR_OPTION | $SED -e 's/MPFR_OPTION //g;s/ *" *//g'` - # Get CFLAGS - echo "#include \"gmp.h\"" > conftest.c - echo "MPFR_OPTION __GMP_CFLAGS" >> conftest.c - unset rmpedantic - [test "$enable_logging" = yes && rmpedantic='s/[ "]-pedantic[ "]/ /g;'] - GMP_CFLAGS=`$cpp $CPPFLAGS conftest.c 2> /dev/null | $EGREP MPFR_OPTION | $SED -e "$rmpedantic"'s/MPFR_OPTION //g;s/ *" *//g'` - break - fi + # Get CC + echo "#include \"gmp.h\"" > conftest.c + echo "MPFR_OPTION __GMP_CC" >> conftest.c + $cpp $CPPFLAGS conftest.c 2> /dev/null > conftest.txt + test $? -ne 0 && continue + GMP_CC=`$EGREP MPFR_OPTION conftest.txt | $SED -e 's/MPFR_OPTION //g;s/ *" *//g'` + # Get CFLAGS + echo "#include \"gmp.h\"" > conftest.c + echo "MPFR_OPTION __GMP_CFLAGS" >> conftest.c + $cpp $CPPFLAGS conftest.c 2> /dev/null > conftest.txt + test $? -ne 0 && continue + [GMP_CFLAGS=`$EGREP MPFR_OPTION conftest.txt | $SED -e 's/[ "]-pedantic[ "]/ /g;s/MPFR_OPTION //g;s/ *" *//g'`] + break done rm -f conftest* if test "x$GMP_CC" = "x__GMP_CC" || test "x$GMP_CFLAGS" = "x__GMP_CFLAGS" ; then - AC_MSG_RESULT(no) + AC_MSG_RESULT(failed) GMP_CFLAGS= GMP_CC= else - AC_MSG_RESULT(yes [CC=$GMP_CC CFLAGS=$GMP_CFLAGS]) + AC_MSG_RESULT([CC=$GMP_CC CFLAGS=$GMP_CFLAGS]) fi fi @@ -249,9 +308,48 @@ AC_PROG_CPP AC_LANG(C) -dnl Support unusual archivers. +dnl AM_PROG_AR is needed so that ar-lib (wrapper for Microsoft lib.exe) +dnl gets installed by "automake -i" (if absent, "automake --warnings=all" +dnl gives a warning). AM_PROG_AR +dnl This must done before MPFR_CONFIGS. +LT_INIT(win32-dll) + +dnl Try to determine the double format +AC_MSG_CHECKING(format of `double' floating point) +AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +]], [[ +union ieee_double_extract +{ + double d; + unsigned char x[8]; +} t; +t.d = 2.877939254133025759330166692961938679218292236328125; /* exact */ +if (sizeof (double) != 8) + return 0; +if (sizeof (unsigned char) != 1) + return 0; +if (t.x[0] == 1 && t.x[1] == 2 && t.x[2] == 3 && t.x[3] == 4 && + t.x[4] == 5 && t.x[5] == 6 && t.x[6] == 7 && t.x[7] == 64) + return 1; /* little endian */ +else if (t.x[7] == 1 && t.x[6] == 2 && t.x[5] == 3 && t.x[4] == 4 && + t.x[3] == 5 && t.x[2] == 6 && t.x[1] == 7 && t.x[0] == 64) + return 2; /* big endian */ +else + return 0; /* unknown */ +]])], + [mpfr_ieee_double=$?], + [mpfr_ieee_double=$?], + [mpfr_ieee_double=0]) +case "$mpfr_ieee_double" in + 1) AC_MSG_RESULT([IEEE little endian]) + AC_DEFINE(HAVE_DOUBLE_IEEE_LITTLE_ENDIAN) ;; + 2) AC_MSG_RESULT([IEEE big endian]) + AC_DEFINE(HAVE_DOUBLE_IEEE_BIG_ENDIAN) ;; + *) AC_MSG_WARN([format of `double' floating-point not recognized]) ;; +esac + dnl For GCC, _Decimal64 was introduced in GCC 4.3 for some targets dnl (note that it is not guaranteed to be available because it may dnl be disabled in the GCC build). See: @@ -262,56 +360,72 @@ dnl with the mode32 ABI, e.g. "-m32 -mpowerpc64 -mtune=970 -O3"; this dnl is detected by the x != x test below. AC_ARG_ENABLE(decimal-float, - [ --enable-decimal-float build conversion functions from/to decimal floats - [[default=no]]], + [ --disable-decimal-float explicitly disable decimal floats support + --enable-decimal-float build conversion functions from/to decimal floats + [[default=autodetect]]], [ case $enableval in - yes) AC_DEFINE([MPFR_WANT_DECIMAL_FLOATS],1, - [Build decimal float functions]) - AC_MSG_CHECKING(if compiler knows _Decimal64) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[_Decimal64 x;]])], - [AC_MSG_RESULT(yes) - if test "$use_gmp_build" != yes ; then - AC_MSG_ERROR([decimal float support requires --with-gmp-build]) - fi - AC_MSG_CHECKING(if _GMP_IEEE_FLOATS is defined) - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ -#include "gmp.h" -#include "gmp-impl.h" -#ifndef _GMP_IEEE_FLOATS -#error "_GMP_IEEE_FLOATS is not defined" -#endif]])],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no) - AC_MSG_ERROR([decimal float support requires _GMP_IEEE_FLOATS])]) - ], - [AC_MSG_RESULT(no) -AC_MSG_ERROR([Compiler doesn't know _Decimal64 (ISO/IEC TR 24732). -Please use another compiler or build MPFR without --enable-decimal-float.])] - ) - AC_MSG_CHECKING(decimal float format) - AC_RUN_IFELSE([AC_LANG_PROGRAM([[ -#include -]], [[ -volatile _Decimal64 x = 1; -union { double d; _Decimal64 d64; } y; -if (x != x) return 3; -y.d64 = 1234567890123456.0dd; -return y.d == 0.14894469406741037E-123 ? 0 : - y.d == 0.59075095508629822E-68 ? 1 : 2; -]])], [AC_MSG_RESULT(DPD) - AC_DEFINE([DPD_FORMAT],1,[])], - [case "$?" in - 1) AC_MSG_RESULT(BID) ;; - 2) AC_MSG_FAILURE(neither DPD nor BID) ;; - 3) AC_MSG_FAILURE([_Decimal64 support is broken. -Please use another compiler or build MPFR without --enable-decimal-float.]) ;; - *) AC_MSG_FAILURE(internal error) ;; - esac], - [AC_MSG_RESULT(assuming DPD) - AC_DEFINE([DPD_FORMAT],1,[])]) - ;; + yes) ;; no) ;; *) AC_MSG_ERROR([bad value for --enable-decimal-float: yes or no]) ;; esac]) +dnl GCC >= 4.3 provides __float128, but since this is not standard, +dnl the default is "autodetect" and not "yes" +AC_ARG_ENABLE(float128, + [ --disable-float128 explicitly disable __float128 support + --enable-float128 build conversion functions from/to __float128 + [[default=autodetect]]], + [ case $enableval in + yes) ;; + no) ;; + *) AC_MSG_ERROR([bad value for --enable-float128: yes or no]) ;; + esac]) + +test_libgmp=__gmpz_init + +AC_ARG_ENABLE(mini-gmp, + [ --enable-mini-gmp build MPFR with mini-gmp (experimental) [[default=no]]], + [ case $enableval in + yes) AC_DEFINE([MPFR_USE_MINI_GMP],1,[Use mini-gmp]) + # With mini-gmp, mp_limb_t is always unsigned long. + AC_COMPUTE_INT(nettle_cv_gmp_numb_bits, [(sizeof(unsigned long) * CHAR_BIT)], + [#include ], + [AC_MSG_FAILURE([cannot find value of GMP_NUMB_BITS])]) + AC_MSG_RESULT([$nettle_cv_gmp_numb_bits bits]) + AC_DEFINE_UNQUOTED([GMP_NUMB_BITS], $nettle_cv_gmp_numb_bits, [number of bits in a limb]) + AC_DEFINE([GMP_NAIL_BITS], 0, [number of nails in a limb]) + test_libgmp=mpz_init;; + no) ;; + *) AC_MSG_ERROR([bad value for --enable-mini-gmp: yes or no]) ;; + esac]) + +AC_ARG_ENABLE(debug-prediction, + [ --enable-debug-prediction + [[for developers]] enable debug of branch prediction + (for x86 and x86-64 with GCC, static libs)], + [ case $enableval in + yes) if test "$enable_shared" != no; then + AC_MSG_ERROR([--enable-debug-prediction can only work in static mode (--disable-shared)]) + fi + AC_DEFINE([MPFR_DEBUG_PREDICTION],1, + [Enable debug of branch prediction]) ;; + no) ;; + *) AC_MSG_ERROR([bad value for --enable-debug-prediction: yes or no]) ;; + esac]) + +AC_ARG_ENABLE(lto, + [ --enable-lto build MPFR with link-time-optimization + (experimental) [[default: no]]], + [ case $enableval in + yes) if test "$enable_shared" != "no"; then + AC_MSG_ERROR([--enable-lto can only work in static mode (--disable-shared)]) + fi + enable_lto=yes + ;; + no) ;; + *) AC_MSG_ERROR([bad value for --enable-lto: yes or no]) ;; + esac]) + dnl Check if compiler is ICC, and if such a case, disable GCC dnl And add some specific flags. dnl Don't add Warnings Flags (Otherwise you'll get more than 20000 warnings). @@ -325,19 +439,31 @@ dnl https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=485421 dnl * If need be, the gcc predefined macros __GNUC_* can be disabled dnl thanks to the -no-gcc option. +dnl * Now use -mieee-fp instead of -mp (ICC 13 says: option '-mp' is +dnl deprecated and will be removed in a future release.). According +dnl to "icc -help", both options are equivalent; it also suggests +dnl to use -fp-model instead of -mp, but what is ? Anyway +dnl -mieee-fp solves the tset_d failure due to a negative zero. This +dnl option has been introduced in ICC 9.0 for Linux (2005-06): +dnl http://www.ncsa.illinois.edu/UserInfo/Resources/Software/Intel/Compilers/9.0/C_ReleaseNotes.htm AC_MSG_CHECKING(for ICC) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #if !defined(__ICC) -# error "ICC Not Found" +# error "Not ICC" error #endif ]], [[]])],[ AC_MSG_RESULT(yes) - CFLAGS="-fp_port -mp -wd1572 -wd265 -wd186 -wd239 $CFLAGS" + CFLAGS="-fp_port -mieee-fp -wd1572 -wd265 -wd186 -wd239 $CFLAGS" ],[AC_MSG_RESULT(no)]) -dnl If compiler is gcc, then use some specific flags. -dnl But don't touch user other flags. +dnl If CFLAGS has not been set explicitly and the compiler is GCC, then +dnl use some specific flags. But don't touch user other flags. +dnl Note: This is done even when CFLAGS has been set from GMP's CFLAGS +dnl (__GMP_CFLAGS macro in gmp.h) above. The consequence is that this +dnl might yield a compilation failure if the -Werror option appears in +dnl __GMP_CFLAGS. But in this case, since -Werror is not used by default, +dnl one may expect that the user would also set CFLAGS for MPFR. if test "$test_CFLAGS" != set && test -n "$GCC"; then CFLAGS="-Wpointer-arith $CFLAGS" AC_MSG_CHECKING(whether the selected language is C++) @@ -348,7 +474,7 @@ #endif ]], [[]])],[ AC_MSG_RESULT(no) - CFLAGS="-Wmissing-prototypes $CFLAGS" + CFLAGS="-Wmissing-prototypes -Wc++-compat $CFLAGS" ],[ AC_MSG_RESULT(yes) CFLAGS="-Wmissing-declarations -Wno-sign-compare $CFLAGS" @@ -373,6 +499,13 @@ AC_C_CONST AC_C_VOLATILE +dnl Determine the endianness of integer. But since MPFR doesn't use +dnl AC_CONFIG_HEADERS, configure cannot provide such information for +dnl universal binaries containing variants with different endianness +dnl (i.e. generic code must be used). +AC_C_BIGENDIAN([AC_DEFINE(HAVE_BIG_ENDIAN)],[AC_DEFINE(HAVE_LITTLE_ENDIAN)], +[true],[true]) + MPFR_CONFIGS # (Based on GMP 5.1) @@ -409,15 +542,18 @@ dnl Incidentally, libtool does generate an import library libmpfr.dll.a, dnl but it's "ar" format and cannot be used by the MS linker. There dnl doesn't seem to be any GNU tool for generating or converting to .lib. +dnl +dnl The DLL version (the number in libmpfr-*.dll.def below) must be the +dnl version of the oldest supported interface (i.e. CURRENT - AGE in +dnl src/Makefile.am). AC_SUBST(MPFR_LDFLAGS) AC_SUBST(LIBMPFR_LDFLAGS) -LT_INIT(win32-dll) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) AC_MSG_CHECKING(for DLL/static GMP) if test "$enable_shared" = yes; then MPFR_LDFLAGS="$MPFR_LDFLAGS -no-undefined" - LIBMPFR_LDFLAGS="$LIBMPFR_LDFLAGS -Wl,--output-def,.libs/libmpfr-4.dll.def" + LIBMPFR_LDFLAGS="$LIBMPFR_LDFLAGS -Wl,--output-def,.libs/libmpfr-6.dll.def" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include "gmp.h" #if !__GMP_LIBGMP_DLL @@ -426,7 +562,7 @@ #endif ]], [[]])],[AC_MSG_RESULT(DLL)],[ AC_MSG_RESULT(static) - AC_MSG_ERROR([gmp.h isn't a DLL: use --enable-static --disable-shared]) ]) + AC_MSG_ERROR([libgmp isn't provided as a DLL: use --enable-static --disable-shared]) ]) else AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include "gmp.h" @@ -436,11 +572,41 @@ #endif ]], [[]])],[AC_MSG_RESULT(static)],[ AC_MSG_RESULT(DLL) - AC_MSG_ERROR([gmp.h is a DLL: use --disable-static --enable-shared]) ]) + AC_MSG_ERROR([libgmp is provided as a DLL: use --disable-static --enable-shared]) ]) fi ;; esac +dnl Under Linux, make sure that the old dtags are used if LD_LIBRARY_PATH +dnl is defined. The issue is that with the new dtags, LD_LIBRARY_PATH has +dnl the precedence over the run path, so that if a compatible MPFR library +dnl is installed in some directory from $LD_LIBRARY_PATH, then the tested +dnl MPFR library will be this library instead of the MPFR library from the +dnl build tree. Other OS with the same issue might be added later. +dnl +dnl References: +dnl https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859732 +dnl http://lists.gnu.org/archive/html/libtool/2017-05/msg00000.html +dnl +dnl We need to check whether --disable-new-dtags is supported as alternate +dnl linkers may be used (e.g., with tcc: CC=tcc LD=tcc). +dnl +case $host in + *-*-linux*) + if test -n "$LD_LIBRARY_PATH"; then + saved_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--disable-new-dtags" + AC_MSG_CHECKING(whether --disable-new-dtags is supported by the linker) + AC_LINK_IFELSE([AC_LANG_SOURCE([[ +int main (void) { return 0; } + ]])], + [AC_MSG_RESULT(yes (use it since LD_LIBRARY_PATH is set))], + [AC_MSG_RESULT(no) + LDFLAGS="$saved_LDFLAGS" + ]) + fi + ;; +esac dnl dnl For mpfr-longlong.h - TODO: should be replaced (see acinclude.m4). @@ -458,22 +624,26 @@ dnl MPFR will compile; we do not guarantee that GMP will compile. dnl In particular fat builds are broken in GMP 4.3.2 and GMP 5.0.0 dnl (at least on 64-bit Core 2 under Linux), -dnl see http://gmplib.org/list-archives/gmp-bugs/2011-August/002345.html. -AC_MSG_CHECKING(for recent GMP) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +dnl see . +if test -z "$enable_mini_gmp" ; then + AC_MSG_CHECKING(for recent GMP) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ #include "gmp.h" -#if (__GNU_MP_VERSION*100+__GNU_MP_VERSION_MINOR*10 < 410) -# error "min GMP version is 4.1.0" +#if (__GNU_MP_VERSION*100+__GNU_MP_VERSION_MINOR*10 < 500) +# error "GMP 5.0.0 or newer is required" error #endif -]])],[AC_MSG_RESULT(yes)],[ - AC_MSG_RESULT(no) - AC_MSG_ERROR([GMP 4.1.0 min required]) + ]])],[AC_MSG_RESULT(yes)],[ + AC_MSG_RESULT(no) + AC_MSG_ERROR([GMP 5.0.0 or newer is required]) ]) +fi dnl Check if gmp.h is usable at link time; this may detect errors such as dnl with GMP 4.1, which uses "extern __inline__" unconditionally with all -dnl GCC versions, which breaks by default with GCC 5. +dnl GCC versions, which breaks by default with GCC 5 (this problem with +dnl GMP 4.1 is no longer possible as we now require GMP 5.0.0 or newer, +dnl but the same kind of problem may occur in the future). dnl Note: No linking is done against the GMP library at this time, as we dnl do not use any GMP symbol. The goal of this test is to avoid obscure dnl errors with the following gmp.h tests. @@ -482,10 +652,8 @@ #include "gmp.h" ]],[[]])],[AC_MSG_RESULT(yes)],[ AC_MSG_RESULT(no) - AC_MSG_ERROR([There is an incompatibility between gmp.h and the compiler. -See 'config.log' for details. -Such an incompatibility is known between GMP 4.1, which uses -"extern __inline__" with all GCC versions, and GCC 5.]) + AC_MSG_ERROR([there is an incompatibility between gmp.h and the compiler. +See 'config.log' for details.]) ]) dnl Check if we can use internal header files of GMP (only --with-gmp-build) @@ -527,13 +695,12 @@ See 'config.log' for details (search for GMP_NUMB_BITS).])], [AC_MSG_RESULT([cannot test])]) - dnl Check if we can link with GMP -AC_CHECK_LIB(gmp, __gmpz_init, [LIBS="-lgmp $LIBS"], - [AC_MSG_ERROR(libgmp not found or uses a different ABI (including static vs shared). -Please read the INSTALL file -- see "In case of problem".)]) +AC_CHECK_LIB(gmp, $test_libgmp, [LIBS="-lgmp $LIBS"], + [AC_MSG_ERROR([libgmp not found or uses a different ABI (including static vs shared). +Please read the INSTALL file -- see "In case of problem".])]) -dnl Check for corresponding 'gmp.h' and libgmp.a +dnl Check for corresponding 'gmp.h' and libgmp AC_MSG_CHECKING(if gmp.h version and libgmp version are the same) dnl We do not set LD_LIBRARY_PATH, as it is not possible to set it just dnl before the test program is run, and we do not want to affect other @@ -542,29 +709,34 @@ dnl WARNING! LD_RUN_PATH is not taken into account by the GNU gold ld, dnl e.g. from binutils-gold 2.22-5 under Debian; see dnl https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=660813 -saved_LD_RUN_PATH="$LD_RUN_PATH" -LD_RUN_PATH="${LD_RUN_PATH:+$LD_RUN_PATH$PATH_SEPARATOR}$gmp_lib_path" -export LD_RUN_PATH -AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +if test -z "$enable_mini_gmp" ; then + saved_LD_RUN_PATH="$LD_RUN_PATH" + LD_RUN_PATH="${LD_RUN_PATH:+$LD_RUN_PATH$PATH_SEPARATOR}$gmp_lib_path" + export LD_RUN_PATH + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include #include #include "gmp.h" -]], [[ + ]], [[ char buffer[100]; sprintf (buffer, "%d.%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL); printf ("(%s/%s) ", buffer, gmp_version); + fflush (stdout); + /* Also put information in config.log (stderr) */ + fprintf (stderr, "gmp.h: %s / libgmp: %s\n", buffer, gmp_version); if (strcmp (buffer, gmp_version) == 0) return 0; if (__GNU_MP_VERSION_PATCHLEVEL != 0) return 1; sprintf (buffer, "%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR); return (strcmp (buffer, gmp_version) != 0) ? 1 : 0; -]])], + ]])], [AC_MSG_RESULT(yes) MPFR_CHECK_GMP MPFR_CHECK_DBL2INT_BUG - MPFR_CHECK_PRINTF_SPEC], + MPFR_CHECK_PRINTF_SPEC + MPFR_CHECK_PRINTF_GROUPFLAG], [AC_MSG_RESULT(no) AC_MSG_WARN([==========================================================]) AC_MSG_WARN(['gmp.h' and 'libgmp' seem to have different versions or]) @@ -583,10 +755,11 @@ AC_MSG_WARN([Temporary LD_RUN_PATH was "$LD_RUN_PATH".]) AC_MSG_WARN([==========================================================]) ],AC_MSG_RESULT([cannot test]) -) -LD_RUN_PATH="$saved_LD_RUN_PATH" + ) + LD_RUN_PATH="$saved_LD_RUN_PATH" +fi -dnl Warning! __gmpn_rootrem is an internal GMP symbol; thus its behavior +dnl __gmpn_sbpi1_divappr_q is an internal GMP symbol; thus its behavior dnl may change or this symbol may be removed in the future (without being dnl handled by the library versioning system, which is even worse, as this dnl can mean undetected incompatibilities in case of GMP library upgrade, @@ -595,8 +768,15 @@ dnl by default, in particular by binary distributions. Moreover the check dnl below may yield an incorrect result as libtool isn't used in configure dnl (see above). -dnl Same for __gmpn_sbpi1_divappr_q. -AC_CHECK_FUNCS([__gmpn_rootrem __gmpn_sbpi1_divappr_q]) +AC_CHECK_FUNCS([__gmpn_sbpi1_divappr_q]) +dnl same for other GMP internal functions +AC_CHECK_FUNCS([__gmpn_invert_limb]) +AC_CHECK_FUNCS([__gmpn_rsblsh_n]) + +MPFR_CHECK_MP_LIMB_T_VS_LONG + +dnl The getrusage function is needed for MPFR bench (cf tools/bench) +AC_CHECK_FUNCS([getrusage]) dnl Remove also many MACROS (AC_DEFINE) which are unused by MPFR dnl and polluate (and slow down because libtool has to parse them) the build. @@ -628,7 +808,7 @@ fi dnl Output -AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile tests/Makefile tune/Makefile src/mparam.h:src/mparam_h.in]) +AC_CONFIG_FILES([Makefile mpfr.pc doc/Makefile src/Makefile tests/Makefile tune/Makefile src/mparam.h:src/mparam_h.in tools/bench/Makefile]) AC_OUTPUT dnl NEWS README AUTHORS Changelog diff -Nru mpfr4-3.1.4/COPYING mpfr4-4.0.2/COPYING --- mpfr4-3.1.4/COPYING 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/COPYING 2019-01-07 15:17:51.000000000 +0000 @@ -1,7 +1,7 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -645,7 +645,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -664,11 +664,11 @@ You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -. +. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. +. diff -Nru mpfr4-3.1.4/COPYING.LESSER mpfr4-4.0.2/COPYING.LESSER --- mpfr4-3.1.4/COPYING.LESSER 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/COPYING.LESSER 2019-01-07 15:17:51.000000000 +0000 @@ -1,7 +1,7 @@ - GNU LESSER GENERAL PUBLIC LICENSE + GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -10,7 +10,7 @@ the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. - 0. Additional Definitions. + 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU @@ -111,7 +111,7 @@ a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked - Version. + Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the diff -Nru mpfr4-3.1.4/debian/breaks.Debian mpfr4-4.0.2/debian/breaks.Debian --- mpfr4-3.1.4/debian/breaks.Debian 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/debian/breaks.Debian 2018-02-07 17:59:23.000000000 +0000 @@ -0,0 +1,5 @@ +libcgal13 (<< 4.11-2+b1), +libflint-2.5.2 (<< 2.5.2-17+b2), +libgiac0 (<< 1.2.3.57+dfsg1-2+b4), +libnormaliz3 (<< 3.5.1+ds-4), +sagemath (<< 8.1-2+b2), diff -Nru mpfr4-3.1.4/debian/changelog mpfr4-4.0.2/debian/changelog --- mpfr4-3.1.4/debian/changelog 2016-03-11 06:28:30.000000000 +0000 +++ mpfr4-4.0.2/debian/changelog 2020-01-19 02:30:53.000000000 +0000 @@ -1,3 +1,123 @@ +mpfr4 (4.0.2-1~16.04.sav0) xenial; urgency=medium + + * Backport to Xenial + + -- Rob Savoury Sat, 18 Jan 2020 18:30:53 -0800 + +mpfr4 (4.0.2-1) unstable; urgency=medium + + * mpfr 4.0.2 release. + + -- Matthias Klose Fri, 01 Feb 2019 08:05:19 +0100 + +mpfr4 (4.0.2~rc1-1) unstable; urgency=medium + + * mpfr 4.0.2 release candidate. + * Bump standards version. + + -- Matthias Klose Wed, 09 Jan 2019 10:56:17 +0100 + +mpfr4 (4.0.1-2) unstable; urgency=medium + + * Bump standards version. + * Install the mpfr pkgconfig file. Closes: #915695. + + -- Matthias Klose Thu, 06 Dec 2018 16:11:12 +0100 + +mpfr4 (4.0.1-1) unstable; urgency=medium + + * mpfr 4.0.1 release. + * Build again the pdf documentation. Closes: #889711, #889631. + * Remove obsolete README.Debian. Closes: #889723. + * Add breaks against cgal, flint, giac, normaliz and sagemath versions + built against libmpfr4. Closes: #888422. + + -- Matthias Klose Wed, 07 Feb 2018 19:00:38 +0100 + +mpfr4 (4.0.1~rc2-1) unstable; urgency=medium + + * mpfr 4.0.1 release candidate 2. + * Disable building the pdf docs for now. See #889631. + * Build using -O1 on powerpcspe. Closes: #888253. + + -- Matthias Klose Mon, 05 Feb 2018 09:11:12 +0100 + +mpfr4 (4.0.0-8) unstable; urgency=medium + + * Paste testsuite log in case of testsuite failures. + + -- Matthias Klose Tue, 30 Jan 2018 16:10:19 +0100 + +mpfr4 (4.0.0-7) unstable; urgency=medium + + * Revert the 4.0 branch 20180130 update, too many test failures. + + -- Matthias Klose Tue, 30 Jan 2018 11:36:29 +0100 + +mpfr4 (4.0.0-6) unstable; urgency=medium + + * Update to the 4.0 branch 20180130. + * libmpfr6: Break libmpc3 (<< 1.1.0-1~). Closes: #888422. + + -- Matthias Klose Tue, 30 Jan 2018 09:33:00 +0100 + +mpfr4 (4.0.0-5) unstable; urgency=medium + + * Undo the updates to mpfr.texi. + + -- Matthias Klose Tue, 23 Jan 2018 10:30:48 +0100 + +mpfr4 (4.0.0-4) unstable; urgency=medium + + * Update to the 4.0 branch 20180123. + * Update symbols file for ia64 and m68k. + + -- Matthias Klose Tue, 23 Jan 2018 05:20:51 +0100 + +mpfr4 (4.0.0-3) experimental; urgency=medium + + * More updates to the symbols file. + * Ignore test results on powerpc (tai test fails). + + -- Matthias Klose Sun, 07 Jan 2018 08:51:04 +0100 + +mpfr4 (4.0.0-2) experimental; urgency=medium + + * Update symbols file for non-x86 architectures. + + -- Matthias Klose Sun, 07 Jan 2018 00:01:00 +0100 + +mpfr4 (4.0.0-1) experimental; urgency=medium + + * New upstream release. + + -- Matthias Klose Sun, 31 Dec 2017 10:50:52 +0100 + +mpfr4 (3.1.6-1) unstable; urgency=medium + + * New upstream release. + + -- Matthias Klose Thu, 07 Sep 2017 17:25:56 +0200 + +mpfr4 (3.1.6~rc1-1) unstable; urgency=medium + + * New upstream release candidate. + * Bump debhelper and standards versions. + + -- Matthias Klose Wed, 30 Aug 2017 12:38:49 +0200 + +mpfr4 (3.1.5-1) unstable; urgency=medium + + * New upstream release. + + -- Matthias Klose Tue, 27 Sep 2016 18:09:49 +0200 + +mpfr4 (3.1.4-2) unstable; urgency=medium + + * Apply upstream fixes 01 and 02. + + -- Matthias Klose Sun, 29 May 2016 20:07:52 +0200 + mpfr4 (3.1.4-1) unstable; urgency=medium * New upstream release. diff -Nru mpfr4-3.1.4/debian/compat mpfr4-4.0.2/debian/compat --- mpfr4-3.1.4/debian/compat 2013-10-21 05:18:28.000000000 +0000 +++ mpfr4-4.0.2/debian/compat 2017-08-30 10:40:13.000000000 +0000 @@ -1 +1 @@ -7 +9 diff -Nru mpfr4-3.1.4/debian/control mpfr4-4.0.2/debian/control --- mpfr4-3.1.4/debian/control 2016-02-24 05:03:31.000000000 +0000 +++ mpfr4-4.0.2/debian/control 2019-01-09 09:57:06.000000000 +0000 @@ -1,20 +1,20 @@ Source: mpfr4 Section: math Priority: optional -Build-Depends: debhelper (>= 9), libgmp-dev, dh-autoreconf +Build-Depends: debhelper (>= 9), libgmp-dev, dh-autoreconf, autoconf-archive Build-Depends-Indep: texinfo, texlive-latex-base Maintainer: Debian GCC Maintainers Uploaders: Matthias Klose Homepage: http://www.mpfr.org/ -Standards-Version: 3.9.7 +Standards-Version: 4.3.0 -Package: libmpfr4 +Package: libmpfr6 Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Pre-Depends: ${misc:Pre-Depends} Multi-Arch: same -Breaks: libgmp3 (<< 4.1.4-3) +Breaks: libgmp3 (<< 4.1.4-3), libmpc3 (<< 1.1.0-1~), ${mpfr:Breaks} Description: multiple precision floating-point computation MPFR provides a library for multiple-precision floating-point computation with correct rounding. The computation is both efficient and has a @@ -22,25 +22,10 @@ ANSI/IEEE-754 standard for double-precision floating-point arithmetic (53-bit mantissa). -Package: libmpfr4-dbg -Section: debug -Priority: extra -Architecture: any -Multi-Arch: same -Depends: libmpfr4 (= ${binary:Version}), ${misc:Depends} -Description: multiple precision floating-point computation (debug symbols) - MPFR provides a library for multiple-precision floating-point computation - with correct rounding. The computation is both efficient and has a - well-defined semantics. It copies the good ideas from the - ANSI/IEEE-754 standard for double-precision floating-point arithmetic - (53-bit mantissa). - . - This package contains the debugging symbols for libmpfr4. - Package: libmpfr-dev Section: libdevel Architecture: any -Depends: libgmp-dev, libmpfr4 (= ${binary:Version}), ${misc:Depends} +Depends: libgmp-dev, libmpfr6 (= ${binary:Version}), ${misc:Depends} Multi-Arch: same Suggests: libmpfr-doc Breaks: libgmp3-dev (<< 4.1.4-3) @@ -59,6 +44,7 @@ Package: libmpfr-doc Section: doc Architecture: all +Multi-Arch: foreign Depends: dpkg (>= 1.15.4) | install-info, ${misc:Depends} Description: multiple precision floating-point computation documentation This package provides documentation for the multiple-precision floating-point diff -Nru mpfr4-3.1.4/debian/copyright mpfr4-4.0.2/debian/copyright --- mpfr4-3.1.4/debian/copyright 2015-06-22 10:28:32.000000000 +0000 +++ mpfr4-4.0.2/debian/copyright 2018-02-07 17:51:58.000000000 +0000 @@ -1,7 +1,7 @@ MPFR was downloaded from http://www.mpfr.org/. Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc. +2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Free Software Foundation, Inc. Contributed by the Arenaire and Cacao projects, INRIA. The GNU MPFR Library is free software; you can redistribute it and/or modify it diff -Nru mpfr4-3.1.4/debian/libmpfr1ldbl.lintian-overrides mpfr4-4.0.2/debian/libmpfr1ldbl.lintian-overrides --- mpfr4-3.1.4/debian/libmpfr1ldbl.lintian-overrides 2013-10-21 05:18:28.000000000 +0000 +++ mpfr4-4.0.2/debian/libmpfr1ldbl.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -libmpfr1ldbl: package-name-doesnt-match-sonames diff -Nru mpfr4-3.1.4/debian/libmpfr4.install mpfr4-4.0.2/debian/libmpfr4.install --- mpfr4-3.1.4/debian/libmpfr4.install 2013-10-21 05:18:28.000000000 +0000 +++ mpfr4-4.0.2/debian/libmpfr4.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/lib/*/libmpfr.so.* diff -Nru mpfr4-3.1.4/debian/libmpfr4.symbols mpfr4-4.0.2/debian/libmpfr4.symbols --- mpfr4-3.1.4/debian/libmpfr4.symbols 2015-06-22 10:57:51.000000000 +0000 +++ mpfr4-4.0.2/debian/libmpfr4.symbols 1970-01-01 00:00:00.000000000 +0000 @@ -1,486 +0,0 @@ -libmpfr.so.4 libmpfr4 #MINVER# - __gmpfr_cache_const_catalan@Base 3.1.3 - __gmpfr_cache_const_euler@Base 3.1.3 - __gmpfr_cache_const_log2@Base 3.1.3 - __gmpfr_cache_const_pi@Base 3.1.3 - __gmpfr_ceil_exp2@Base 3.1.3 - __gmpfr_ceil_log2@Base 3.1.3 - __gmpfr_cuberoot@Base 3.1.3 - __gmpfr_default_fp_bit_precision@Base 3.1.3 - __gmpfr_default_rounding_mode@Base 3.1.3 - __gmpfr_emax@Base 3.1.3 - __gmpfr_emin@Base 3.1.3 - __gmpfr_flags@Base 3.1.3 - __gmpfr_floor_log2@Base 3.1.3 - __gmpfr_four@Base 3.1.3 - __gmpfr_fprintf@Base 3.1.3 - __gmpfr_inp_str@Base 3.1.3 - __gmpfr_int_ceil_log2@Base 3.1.3 - __gmpfr_isqrt@Base 3.1.3 - __gmpfr_l2b@Base 3.1.3 - __gmpfr_mpfr_get_sj@Base 3.1.3 - __gmpfr_mpfr_get_uj@Base 3.1.3 - __gmpfr_one@Base 3.1.3 - __gmpfr_out_str@Base 3.1.3 - __gmpfr_set_sj@Base 3.1.3 - __gmpfr_set_sj_2exp@Base 3.1.3 - __gmpfr_set_uj@Base 3.1.3 - __gmpfr_set_uj_2exp@Base 3.1.3 - __gmpfr_two@Base 3.1.3 - __gmpfr_vasprintf@Base 3.1.3 - __gmpfr_vfprintf@Base 3.1.3 - __gmpfr_vprintf@Base 3.1.3 - __gmpfr_vsnprintf@Base 3.1.3 - __gmpfr_vsprintf@Base 3.1.3 - mpfr_abort_prec_max@Base 3.1.3 - mpfr_abs@Base 3.1.3 - mpfr_acos@Base 3.1.3 - mpfr_acosh@Base 3.1.3 - mpfr_add1@Base 3.1.3 - mpfr_add1sp@Base 3.1.3 - mpfr_add@Base 3.1.3 - mpfr_add_d@Base 3.1.3 - mpfr_add_q@Base 3.1.3 - mpfr_add_si@Base 3.1.3 - mpfr_add_ui@Base 3.1.3 - mpfr_add_z@Base 3.1.3 - mpfr_agm@Base 3.1.3 - mpfr_ai@Base 3.1.3 - mpfr_allocate_func@Base 3.1.3 - mpfr_asin@Base 3.1.3 - mpfr_asinh@Base 3.1.3 - mpfr_asprintf@Base 3.1.3 - mpfr_assert_fail@Base 3.1.3 - mpfr_atan2@Base 3.1.3 - mpfr_atan@Base 3.1.3 - mpfr_atanh@Base 3.1.3 - mpfr_bases@Base 3.1.3 - mpfr_bernoulli_internal@Base 3.1.3 - mpfr_buildopt_decimal_p@Base 3.1.3 - mpfr_buildopt_gmpinternals_p@Base 3.1.3 - mpfr_buildopt_tls_p@Base 3.1.3 - mpfr_buildopt_tune_case@Base 3.1.3 - mpfr_cache@Base 3.1.3 - mpfr_can_round@Base 3.1.3 - mpfr_can_round_raw@Base 3.1.3 - mpfr_cbrt@Base 3.1.3 - mpfr_ceil@Base 3.1.3 - mpfr_ceil_mul@Base 3.1.3 - mpfr_check@Base 3.1.3 - mpfr_check_range@Base 3.1.3 - mpfr_clear@Base 3.1.3 - mpfr_clear_cache@Base 3.1.3 - mpfr_clear_divby0@Base 3.1.3 - mpfr_clear_erangeflag@Base 3.1.3 - mpfr_clear_flags@Base 3.1.3 - mpfr_clear_inexflag@Base 3.1.3 - mpfr_clear_nanflag@Base 3.1.3 - mpfr_clear_overflow@Base 3.1.3 - mpfr_clear_underflow@Base 3.1.3 - mpfr_clears@Base 3.1.3 - mpfr_cmp2@Base 3.1.3 - mpfr_cmp3@Base 3.1.3 - mpfr_cmp@Base 3.1.3 - mpfr_cmp_d@Base 3.1.3 - mpfr_cmp_f@Base 3.1.3 - mpfr_cmp_ld@Base 3.1.3 - mpfr_cmp_q@Base 3.1.3 - mpfr_cmp_si@Base 3.1.3 - mpfr_cmp_si_2exp@Base 3.1.3 - mpfr_cmp_ui@Base 3.1.3 - mpfr_cmp_ui_2exp@Base 3.1.3 - mpfr_cmp_z@Base 3.1.3 - mpfr_cmpabs@Base 3.1.3 - mpfr_const_catalan@Base 3.1.3 - mpfr_const_catalan_internal@Base 3.1.3 - mpfr_const_euler@Base 3.1.3 - mpfr_const_euler_internal@Base 3.1.3 - mpfr_const_log2@Base 3.1.3 - mpfr_const_log2_internal@Base 3.1.3 - mpfr_const_pi@Base 3.1.3 - mpfr_const_pi_internal@Base 3.1.3 - mpfr_copysign@Base 3.1.3 - mpfr_cos@Base 3.1.3 - mpfr_cosh@Base 3.1.3 - mpfr_cot@Base 3.1.3 - mpfr_coth@Base 3.1.3 - mpfr_csc@Base 3.1.3 - mpfr_csch@Base 3.1.3 - mpfr_custom_get_exp@Base 3.1.3 - mpfr_custom_get_kind@Base 3.1.3 - mpfr_custom_get_significand@Base 3.1.3 - mpfr_custom_get_size@Base 3.1.3 - mpfr_custom_init@Base 3.1.3 - mpfr_custom_init_set@Base 3.1.3 - mpfr_custom_move@Base 3.1.3 - mpfr_d_div@Base 3.1.3 - mpfr_d_sub@Base 3.1.3 - mpfr_default_allocate@Base 3.1.3 - mpfr_default_free@Base 3.1.3 - mpfr_default_reallocate@Base 3.1.3 - mpfr_digamma@Base 3.1.3 - mpfr_dim@Base 3.1.3 - mpfr_div@Base 3.1.3 - mpfr_div_2exp@Base 3.1.3 - mpfr_div_2si@Base 3.1.3 - mpfr_div_2ui@Base 3.1.3 - mpfr_div_d@Base 3.1.3 - mpfr_div_q@Base 3.1.3 - mpfr_div_si@Base 3.1.3 - mpfr_div_ui2@Base 3.1.3 - mpfr_div_ui@Base 3.1.3 - mpfr_div_z@Base 3.1.3 - mpfr_divby0_p@Base 3.1.3 - mpfr_divhigh_n@Base 3.1.3 - mpfr_dump@Base 3.1.3 - mpfr_dump_mant@Base 3.1.3 - mpfr_eint@Base 3.1.3 - mpfr_eq@Base 3.1.3 - mpfr_equal_p@Base 3.1.3 - mpfr_erangeflag_p@Base 3.1.3 - mpfr_erf@Base 3.1.3 - mpfr_erfc@Base 3.1.3 - mpfr_exp10@Base 3.1.3 - mpfr_exp2@Base 3.1.3 - mpfr_exp@Base 3.1.3 - mpfr_exp_2@Base 3.1.3 - mpfr_exp_3@Base 3.1.3 - mpfr_expm1@Base 3.1.3 - mpfr_extract@Base 3.1.3 - mpfr_fac_ui@Base 3.1.3 - mpfr_fits_intmax_p@Base 3.1.3 - mpfr_fits_sint_p@Base 3.1.3 - mpfr_fits_slong_p@Base 3.1.3 - mpfr_fits_sshort_p@Base 3.1.3 - mpfr_fits_uint_p@Base 3.1.3 - mpfr_fits_uintmax_p@Base 3.1.3 - mpfr_fits_ulong_p@Base 3.1.3 - mpfr_fits_ushort_p@Base 3.1.3 - mpfr_floor@Base 3.1.3 - mpfr_fma@Base 3.1.3 - mpfr_fmod@Base 3.1.3 - mpfr_fms@Base 3.1.3 - mpfr_fprint_binary@Base 3.1.3 - mpfr_frac@Base 3.1.3 - mpfr_free_cache@Base 3.1.3 - mpfr_free_func@Base 3.1.3 - mpfr_free_str@Base 3.1.3 - mpfr_frexp@Base 3.1.3 - mpfr_gamma@Base 3.1.3 - mpfr_gamma_one_and_two_third@Base 3.1.3 - mpfr_get_d1@Base 3.1.3 - mpfr_get_d@Base 3.1.3 - mpfr_get_d_2exp@Base 3.1.3 - mpfr_get_default_prec@Base 3.1.3 - mpfr_get_default_rounding_mode@Base 3.1.3 - mpfr_get_emax@Base 3.1.3 - mpfr_get_emax_max@Base 3.1.3 - mpfr_get_emax_min@Base 3.1.3 - mpfr_get_emin@Base 3.1.3 - mpfr_get_emin_max@Base 3.1.3 - mpfr_get_emin_min@Base 3.1.3 - mpfr_get_exp@Base 3.1.3 - mpfr_get_f@Base 3.1.3 - mpfr_get_flt@Base 3.1.3 - mpfr_get_ld@Base 3.1.3 - mpfr_get_ld_2exp@Base 3.1.3 - mpfr_get_patches@Base 3.1.3 - mpfr_get_prec@Base 3.1.3 - mpfr_get_si@Base 3.1.3 - mpfr_get_str@Base 3.1.3 - mpfr_get_ui@Base 3.1.3 - mpfr_get_version@Base 3.1.3 - mpfr_get_z@Base 3.1.3 - mpfr_get_z_2exp@Base 3.1.3 - mpfr_grandom@Base 3.1.3 - mpfr_greater_p@Base 3.1.3 - mpfr_greaterequal_p@Base 3.1.3 - mpfr_hypot@Base 3.1.3 - mpfr_inexflag_p@Base 3.1.3 - mpfr_inf_p@Base 3.1.3 - mpfr_init2@Base 3.1.3 - mpfr_init@Base 3.1.3 - mpfr_init_set_str@Base 3.1.3 - mpfr_inits2@Base 3.1.3 - mpfr_inits@Base 3.1.3 - mpfr_integer_p@Base 3.1.3 - mpfr_j0@Base 3.1.3 - mpfr_j1@Base 3.1.3 - mpfr_jn@Base 3.1.3 - mpfr_l2b_10_0__tab@Base 3.1.3 - mpfr_l2b_10_1__tab@Base 3.1.3 - mpfr_l2b_11_0__tab@Base 3.1.3 - mpfr_l2b_11_1__tab@Base 3.1.3 - mpfr_l2b_12_0__tab@Base 3.1.3 - mpfr_l2b_12_1__tab@Base 3.1.3 - mpfr_l2b_13_0__tab@Base 3.1.3 - mpfr_l2b_13_1__tab@Base 3.1.3 - mpfr_l2b_14_0__tab@Base 3.1.3 - mpfr_l2b_14_1__tab@Base 3.1.3 - mpfr_l2b_15_0__tab@Base 3.1.3 - mpfr_l2b_15_1__tab@Base 3.1.3 - mpfr_l2b_16_0__tab@Base 3.1.3 - mpfr_l2b_16_1__tab@Base 3.1.3 - mpfr_l2b_17_0__tab@Base 3.1.3 - mpfr_l2b_17_1__tab@Base 3.1.3 - mpfr_l2b_18_0__tab@Base 3.1.3 - mpfr_l2b_18_1__tab@Base 3.1.3 - mpfr_l2b_19_0__tab@Base 3.1.3 - mpfr_l2b_19_1__tab@Base 3.1.3 - mpfr_l2b_20_0__tab@Base 3.1.3 - mpfr_l2b_20_1__tab@Base 3.1.3 - mpfr_l2b_21_0__tab@Base 3.1.3 - mpfr_l2b_21_1__tab@Base 3.1.3 - mpfr_l2b_22_0__tab@Base 3.1.3 - mpfr_l2b_22_1__tab@Base 3.1.3 - mpfr_l2b_23_0__tab@Base 3.1.3 - mpfr_l2b_23_1__tab@Base 3.1.3 - mpfr_l2b_24_0__tab@Base 3.1.3 - mpfr_l2b_24_1__tab@Base 3.1.3 - mpfr_l2b_25_0__tab@Base 3.1.3 - mpfr_l2b_25_1__tab@Base 3.1.3 - mpfr_l2b_26_0__tab@Base 3.1.3 - mpfr_l2b_26_1__tab@Base 3.1.3 - mpfr_l2b_27_0__tab@Base 3.1.3 - mpfr_l2b_27_1__tab@Base 3.1.3 - mpfr_l2b_28_0__tab@Base 3.1.3 - mpfr_l2b_28_1__tab@Base 3.1.3 - mpfr_l2b_29_0__tab@Base 3.1.3 - mpfr_l2b_29_1__tab@Base 3.1.3 - mpfr_l2b_2_0__tab@Base 3.1.3 - mpfr_l2b_2_1__tab@Base 3.1.3 - mpfr_l2b_30_0__tab@Base 3.1.3 - mpfr_l2b_30_1__tab@Base 3.1.3 - mpfr_l2b_31_0__tab@Base 3.1.3 - mpfr_l2b_31_1__tab@Base 3.1.3 - mpfr_l2b_32_0__tab@Base 3.1.3 - mpfr_l2b_32_1__tab@Base 3.1.3 - mpfr_l2b_33_0__tab@Base 3.1.3 - mpfr_l2b_33_1__tab@Base 3.1.3 - mpfr_l2b_34_0__tab@Base 3.1.3 - mpfr_l2b_34_1__tab@Base 3.1.3 - mpfr_l2b_35_0__tab@Base 3.1.3 - mpfr_l2b_35_1__tab@Base 3.1.3 - mpfr_l2b_36_0__tab@Base 3.1.3 - mpfr_l2b_36_1__tab@Base 3.1.3 - mpfr_l2b_37_0__tab@Base 3.1.3 - mpfr_l2b_37_1__tab@Base 3.1.3 - mpfr_l2b_38_0__tab@Base 3.1.3 - mpfr_l2b_38_1__tab@Base 3.1.3 - mpfr_l2b_39_0__tab@Base 3.1.3 - mpfr_l2b_39_1__tab@Base 3.1.3 - mpfr_l2b_3_0__tab@Base 3.1.3 - mpfr_l2b_3_1__tab@Base 3.1.3 - mpfr_l2b_40_0__tab@Base 3.1.3 - mpfr_l2b_40_1__tab@Base 3.1.3 - mpfr_l2b_41_0__tab@Base 3.1.3 - mpfr_l2b_41_1__tab@Base 3.1.3 - mpfr_l2b_42_0__tab@Base 3.1.3 - mpfr_l2b_42_1__tab@Base 3.1.3 - mpfr_l2b_43_0__tab@Base 3.1.3 - mpfr_l2b_43_1__tab@Base 3.1.3 - mpfr_l2b_44_0__tab@Base 3.1.3 - mpfr_l2b_44_1__tab@Base 3.1.3 - mpfr_l2b_45_0__tab@Base 3.1.3 - mpfr_l2b_45_1__tab@Base 3.1.3 - mpfr_l2b_46_0__tab@Base 3.1.3 - mpfr_l2b_46_1__tab@Base 3.1.3 - mpfr_l2b_47_0__tab@Base 3.1.3 - mpfr_l2b_47_1__tab@Base 3.1.3 - mpfr_l2b_48_0__tab@Base 3.1.3 - mpfr_l2b_48_1__tab@Base 3.1.3 - mpfr_l2b_49_0__tab@Base 3.1.3 - mpfr_l2b_49_1__tab@Base 3.1.3 - mpfr_l2b_4_0__tab@Base 3.1.3 - mpfr_l2b_4_1__tab@Base 3.1.3 - mpfr_l2b_50_0__tab@Base 3.1.3 - mpfr_l2b_50_1__tab@Base 3.1.3 - mpfr_l2b_51_0__tab@Base 3.1.3 - mpfr_l2b_51_1__tab@Base 3.1.3 - mpfr_l2b_52_0__tab@Base 3.1.3 - mpfr_l2b_52_1__tab@Base 3.1.3 - mpfr_l2b_53_0__tab@Base 3.1.3 - mpfr_l2b_53_1__tab@Base 3.1.3 - mpfr_l2b_54_0__tab@Base 3.1.3 - mpfr_l2b_54_1__tab@Base 3.1.3 - mpfr_l2b_55_0__tab@Base 3.1.3 - mpfr_l2b_55_1__tab@Base 3.1.3 - mpfr_l2b_56_0__tab@Base 3.1.3 - mpfr_l2b_56_1__tab@Base 3.1.3 - mpfr_l2b_57_0__tab@Base 3.1.3 - mpfr_l2b_57_1__tab@Base 3.1.3 - mpfr_l2b_58_0__tab@Base 3.1.3 - mpfr_l2b_58_1__tab@Base 3.1.3 - mpfr_l2b_59_0__tab@Base 3.1.3 - mpfr_l2b_59_1__tab@Base 3.1.3 - mpfr_l2b_5_0__tab@Base 3.1.3 - mpfr_l2b_5_1__tab@Base 3.1.3 - mpfr_l2b_60_0__tab@Base 3.1.3 - mpfr_l2b_60_1__tab@Base 3.1.3 - mpfr_l2b_61_0__tab@Base 3.1.3 - mpfr_l2b_61_1__tab@Base 3.1.3 - mpfr_l2b_62_0__tab@Base 3.1.3 - mpfr_l2b_62_1__tab@Base 3.1.3 - mpfr_l2b_6_0__tab@Base 3.1.3 - mpfr_l2b_6_1__tab@Base 3.1.3 - mpfr_l2b_7_0__tab@Base 3.1.3 - mpfr_l2b_7_1__tab@Base 3.1.3 - mpfr_l2b_8_0__tab@Base 3.1.3 - mpfr_l2b_8_1__tab@Base 3.1.3 - mpfr_l2b_9_0__tab@Base 3.1.3 - mpfr_l2b_9_1__tab@Base 3.1.3 - mpfr_less_p@Base 3.1.3 - mpfr_lessequal_p@Base 3.1.3 - mpfr_lessgreater_p@Base 3.1.3 - mpfr_lgamma@Base 3.1.3 - mpfr_li2@Base 3.1.3 - mpfr_lngamma@Base 3.1.3 - mpfr_log10@Base 3.1.3 - mpfr_log1p@Base 3.1.3 - mpfr_log2@Base 3.1.3 - mpfr_log@Base 3.1.3 - mpfr_max@Base 3.1.3 - mpfr_min@Base 3.1.3 - mpfr_min_prec@Base 3.1.3 - mpfr_modf@Base 3.1.3 - mpfr_mpn_exp@Base 3.1.3 - mpfr_mul@Base 3.1.3 - mpfr_mul_2exp@Base 3.1.3 - mpfr_mul_2si@Base 3.1.3 - mpfr_mul_2ui@Base 3.1.3 - mpfr_mul_d@Base 3.1.3 - mpfr_mul_q@Base 3.1.3 - mpfr_mul_si@Base 3.1.3 - mpfr_mul_ui@Base 3.1.3 - mpfr_mul_z@Base 3.1.3 - mpfr_mulhigh_n@Base 3.1.3 - mpfr_mullow_n@Base 3.1.3 - mpfr_nan_p@Base 3.1.3 - mpfr_nanflag_p@Base 3.1.3 - mpfr_neg@Base 3.1.3 - mpfr_nextabove@Base 3.1.3 - mpfr_nextbelow@Base 3.1.3 - mpfr_nexttoinf@Base 3.1.3 - mpfr_nexttoward@Base 3.1.3 - mpfr_nexttozero@Base 3.1.3 - mpfr_number_p@Base 3.1.3 - mpfr_overflow@Base 3.1.3 - mpfr_overflow_p@Base 3.1.3 - mpfr_pow@Base 3.1.3 - mpfr_pow_general@Base 3.1.3 - mpfr_pow_si@Base 3.1.3 - mpfr_pow_ui@Base 3.1.3 - mpfr_pow_z@Base 3.1.3 - mpfr_powerof2_raw@Base 3.1.3 - mpfr_prec_round@Base 3.1.3 - mpfr_print_binary@Base 3.1.3 - mpfr_print_mant_binary@Base 3.1.3 - mpfr_print_rnd_mode@Base 3.1.3 - mpfr_printf@Base 3.1.3 - mpfr_rand_raw@Base 3.1.3 - mpfr_rands@Base 3.1.3 - mpfr_rands_initialized@Base 3.1.3 - mpfr_reallocate_func@Base 3.1.3 - mpfr_rec_sqrt@Base 3.1.3 - mpfr_regular_p@Base 3.1.3 - mpfr_reldiff@Base 3.1.3 - mpfr_remainder@Base 3.1.3 - mpfr_remquo@Base 3.1.3 - mpfr_rint@Base 3.1.3 - mpfr_rint_ceil@Base 3.1.3 - mpfr_rint_floor@Base 3.1.3 - mpfr_rint_round@Base 3.1.3 - mpfr_rint_trunc@Base 3.1.3 - mpfr_root@Base 3.1.3 - mpfr_round@Base 3.1.3 - mpfr_round_near_x@Base 3.1.3 - mpfr_round_p@Base 3.1.3 - mpfr_round_raw@Base 3.1.3 - mpfr_round_raw_2@Base 3.1.3 - mpfr_round_raw_4@Base 3.1.3 - mpfr_scale2@Base 3.1.3 - mpfr_sec@Base 3.1.3 - mpfr_sech@Base 3.1.3 - mpfr_set4@Base 3.1.3 - mpfr_set@Base 3.1.3 - mpfr_set_d@Base 3.1.3 - mpfr_set_default_prec@Base 3.1.3 - mpfr_set_default_rounding_mode@Base 3.1.3 - mpfr_set_divby0@Base 3.1.3 - mpfr_set_emax@Base 3.1.3 - mpfr_set_emin@Base 3.1.3 - mpfr_set_erangeflag@Base 3.1.3 - mpfr_set_exp@Base 3.1.3 - mpfr_set_f@Base 3.1.3 - mpfr_set_flt@Base 3.1.3 - mpfr_set_inexflag@Base 3.1.3 - mpfr_set_inf@Base 3.1.3 - mpfr_set_ld@Base 3.1.3 - mpfr_set_nan@Base 3.1.3 - mpfr_set_nanflag@Base 3.1.3 - mpfr_set_overflow@Base 3.1.3 - mpfr_set_prec@Base 3.1.3 - mpfr_set_prec_raw@Base 3.1.3 - mpfr_set_q@Base 3.1.3 - mpfr_set_si@Base 3.1.3 - mpfr_set_si_2exp@Base 3.1.3 - mpfr_set_str@Base 3.1.3 - mpfr_set_str_binary@Base 3.1.3 - mpfr_set_ui@Base 3.1.3 - mpfr_set_ui_2exp@Base 3.1.3 - mpfr_set_underflow@Base 3.1.3 - mpfr_set_z@Base 3.1.3 - mpfr_set_z_2exp@Base 3.1.3 - mpfr_set_zero@Base 3.1.3 - mpfr_setmax@Base 3.1.3 - mpfr_setmin@Base 3.1.3 - mpfr_setsign@Base 3.1.3 - mpfr_sgn@Base 3.1.3 - mpfr_si_div@Base 3.1.3 - mpfr_si_sub@Base 3.1.3 - mpfr_signbit@Base 3.1.3 - mpfr_sin@Base 3.1.3 - mpfr_sin_cos@Base 3.1.3 - mpfr_sincos_fast@Base 3.1.3 - mpfr_sinh@Base 3.1.3 - mpfr_sinh_cosh@Base 3.1.3 - mpfr_snprintf@Base 3.1.3 - mpfr_sprintf@Base 3.1.3 - mpfr_sqr@Base 3.1.3 - mpfr_sqrhigh_n@Base 3.1.3 - mpfr_sqrt@Base 3.1.3 - mpfr_sqrt_ui@Base 3.1.3 - mpfr_strtofr@Base 3.1.3 - mpfr_sub1@Base 3.1.3 - mpfr_sub1sp@Base 3.1.3 - mpfr_sub@Base 3.1.3 - mpfr_sub_d@Base 3.1.3 - mpfr_sub_q@Base 3.1.3 - mpfr_sub_si@Base 3.1.3 - mpfr_sub_ui@Base 3.1.3 - mpfr_sub_z@Base 3.1.3 - mpfr_subnormalize@Base 3.1.3 - mpfr_sum@Base 3.1.3 - mpfr_sum_sort@Base 3.1.3 - mpfr_swap@Base 3.1.3 - mpfr_tan@Base 3.1.3 - mpfr_tanh@Base 3.1.3 - mpfr_tmp_allocate@Base 3.1.3 - mpfr_tmp_free@Base 3.1.3 - mpfr_trunc@Base 3.1.3 - mpfr_ui_div@Base 3.1.3 - mpfr_ui_pow@Base 3.1.3 - mpfr_ui_pow_ui@Base 3.1.3 - mpfr_ui_sub@Base 3.1.3 - mpfr_underflow@Base 3.1.3 - mpfr_underflow_p@Base 3.1.3 - mpfr_unordered_p@Base 3.1.3 - mpfr_urandom@Base 3.1.3 - mpfr_urandomb@Base 3.1.3 - mpfr_y0@Base 3.1.3 - mpfr_y1@Base 3.1.3 - mpfr_yn@Base 3.1.3 - mpfr_z_sub@Base 3.1.3 - mpfr_zero_p@Base 3.1.3 - mpfr_zeta@Base 3.1.3 - mpfr_zeta_ui@Base 3.1.3 diff -Nru mpfr4-3.1.4/debian/libmpfr6.install mpfr4-4.0.2/debian/libmpfr6.install --- mpfr4-3.1.4/debian/libmpfr6.install 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/debian/libmpfr6.install 2013-10-21 05:18:28.000000000 +0000 @@ -0,0 +1 @@ +usr/lib/*/libmpfr.so.* diff -Nru mpfr4-3.1.4/debian/libmpfr6.symbols mpfr4-4.0.2/debian/libmpfr6.symbols --- mpfr4-3.1.4/debian/libmpfr6.symbols 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/debian/libmpfr6.symbols 2018-01-23 04:17:12.000000000 +0000 @@ -0,0 +1,530 @@ +libmpfr.so.6 libmpfr6 #MINVER# + __gmpfr_cache_const_catalan@Base 3.1.3 + __gmpfr_cache_const_euler@Base 3.1.3 + __gmpfr_cache_const_log2@Base 3.1.3 + __gmpfr_cache_const_pi@Base 3.1.3 + __gmpfr_ceil_exp2@Base 3.1.3 + __gmpfr_ceil_log2@Base 3.1.3 + __gmpfr_const_log2_RNDD@Base 4.0.0 + __gmpfr_const_log2_RNDU@Base 4.0.0 + __gmpfr_cuberoot@Base 3.1.3 + __gmpfr_default_fp_bit_precision@Base 3.1.3 + __gmpfr_default_rounding_mode@Base 3.1.3 + __gmpfr_emax@Base 3.1.3 + __gmpfr_emin@Base 3.1.3 + __gmpfr_flags@Base 3.1.3 + __gmpfr_floor_log2@Base 3.1.3 + __gmpfr_four@Base 3.1.3 + __gmpfr_fpif_export@Base 4.0.0 + __gmpfr_fpif_import@Base 4.0.0 + __gmpfr_fprintf@Base 3.1.3 + __gmpfr_inp_str@Base 3.1.3 + __gmpfr_int_ceil_log2@Base 3.1.3 + __gmpfr_isqrt@Base 3.1.3 + __gmpfr_l2b@Base 3.1.3 + __gmpfr_mone@Base 4.0.0 + __gmpfr_mpfr_get_sj@Base 3.1.3 + __gmpfr_mpfr_get_uj@Base 3.1.3 + __gmpfr_one@Base 3.1.3 + __gmpfr_out_str@Base 3.1.3 + __gmpfr_set_sj@Base 3.1.3 + __gmpfr_set_sj_2exp@Base 3.1.3 + __gmpfr_set_uj@Base 3.1.3 + __gmpfr_set_uj_2exp@Base 3.1.3 + __gmpfr_two@Base 3.1.3 + __gmpfr_vasprintf@Base 3.1.3 + __gmpfr_vfprintf@Base 3.1.3 + __gmpfr_vprintf@Base 3.1.3 + __gmpfr_vsnprintf@Base 3.1.3 + __gmpfr_vsprintf@Base 3.1.3 + mpfr_abort_prec_max@Base 3.1.3 + mpfr_abs@Base 3.1.3 + mpfr_acos@Base 3.1.3 + mpfr_acosh@Base 3.1.3 + mpfr_add1@Base 3.1.3 + mpfr_add1sp@Base 3.1.3 + mpfr_add@Base 3.1.3 + mpfr_add_d@Base 3.1.3 + mpfr_add_q@Base 3.1.3 + mpfr_add_si@Base 3.1.3 + mpfr_add_ui@Base 3.1.3 + mpfr_add_z@Base 3.1.3 + mpfr_agm@Base 3.1.3 + mpfr_ai@Base 3.1.3 + mpfr_allocate_func@Base 3.1.3 + mpfr_asin@Base 3.1.3 + mpfr_asinh@Base 3.1.3 + mpfr_asprintf@Base 3.1.3 + mpfr_assert_fail@Base 3.1.3 + mpfr_atan2@Base 3.1.3 + mpfr_atan@Base 3.1.3 + mpfr_atanh@Base 3.1.3 + mpfr_bases@Base 3.1.3 + mpfr_bernoulli_cache@Base 4.0.0 + mpfr_bernoulli_freecache@Base 4.0.0 + mpfr_beta@Base 4.0.0 + mpfr_buildopt_decimal_p@Base 3.1.3 + mpfr_buildopt_float128_p@Base 4.0.0 + mpfr_buildopt_gmpinternals_p@Base 3.1.3 + mpfr_buildopt_sharedcache_p@Base 4.0.0 + mpfr_buildopt_tls_p@Base 3.1.3 + mpfr_buildopt_tune_case@Base 3.1.3 + mpfr_cache@Base 3.1.3 + mpfr_can_round@Base 3.1.3 + mpfr_can_round_raw@Base 3.1.3 + mpfr_cbrt@Base 3.1.3 + mpfr_ceil@Base 3.1.3 + mpfr_ceil_mul@Base 3.1.3 + mpfr_check@Base 3.1.3 + mpfr_check_range@Base 3.1.3 + mpfr_clear@Base 3.1.3 + mpfr_clear_cache@Base 3.1.3 + mpfr_clear_divby0@Base 3.1.3 + mpfr_clear_erangeflag@Base 3.1.3 + mpfr_clear_flags@Base 3.1.3 + mpfr_clear_inexflag@Base 3.1.3 + mpfr_clear_nanflag@Base 3.1.3 + mpfr_clear_overflow@Base 3.1.3 + mpfr_clear_underflow@Base 3.1.3 + mpfr_clears@Base 3.1.3 + (arch=!any-amd64 !any-i386 !x32 !arm64 !armel !armhf !hppa !ia64 !m68k)mpfr_clz_tab@Base 4.0.0 + mpfr_cmp2@Base 3.1.3 + mpfr_cmp3@Base 3.1.3 + mpfr_cmp@Base 3.1.3 + mpfr_cmp_d@Base 3.1.3 + mpfr_cmp_f@Base 3.1.3 + mpfr_cmp_ld@Base 3.1.3 + mpfr_cmp_q@Base 3.1.3 + mpfr_cmp_si@Base 3.1.3 + mpfr_cmp_si_2exp@Base 3.1.3 + mpfr_cmp_ui@Base 3.1.3 + mpfr_cmp_ui_2exp@Base 3.1.3 + mpfr_cmp_z@Base 3.1.3 + mpfr_cmpabs@Base 3.1.3 + mpfr_const_catalan@Base 3.1.3 + mpfr_const_catalan_internal@Base 3.1.3 + mpfr_const_euler@Base 3.1.3 + mpfr_const_euler_internal@Base 3.1.3 + mpfr_const_log2@Base 3.1.3 + mpfr_const_log2_internal@Base 3.1.3 + mpfr_const_pi@Base 3.1.3 + mpfr_const_pi_internal@Base 3.1.3 + mpfr_copysign@Base 3.1.3 + mpfr_cos@Base 3.1.3 + mpfr_cosh@Base 3.1.3 + mpfr_cot@Base 3.1.3 + mpfr_coth@Base 3.1.3 + mpfr_csc@Base 3.1.3 + mpfr_csch@Base 3.1.3 + mpfr_custom_get_exp@Base 3.1.3 + mpfr_custom_get_kind@Base 3.1.3 + mpfr_custom_get_significand@Base 3.1.3 + mpfr_custom_get_size@Base 3.1.3 + mpfr_custom_init@Base 3.1.3 + mpfr_custom_init_set@Base 3.1.3 + mpfr_custom_move@Base 3.1.3 + mpfr_d_div@Base 3.1.3 + mpfr_d_sub@Base 3.1.3 + mpfr_digamma@Base 3.1.3 + mpfr_dim@Base 3.1.3 + mpfr_div@Base 3.1.3 + mpfr_div_2exp@Base 3.1.3 + mpfr_div_2si@Base 3.1.3 + mpfr_div_2ui@Base 3.1.3 + mpfr_div_d@Base 3.1.3 + mpfr_div_q@Base 3.1.3 + mpfr_div_si@Base 3.1.3 + mpfr_div_ui2@Base 3.1.3 + mpfr_div_ui@Base 3.1.3 + mpfr_div_z@Base 3.1.3 + mpfr_divby0_p@Base 3.1.3 + mpfr_divhigh_n@Base 3.1.3 + mpfr_dump@Base 3.1.3 + mpfr_eint@Base 3.1.3 + mpfr_eq@Base 3.1.3 + mpfr_equal_p@Base 3.1.3 + mpfr_erandom@Base 4.0.0 + mpfr_erangeflag_p@Base 3.1.3 + mpfr_erf@Base 3.1.3 + mpfr_erfc@Base 3.1.3 + mpfr_exp10@Base 3.1.3 + mpfr_exp2@Base 3.1.3 + mpfr_exp@Base 3.1.3 + mpfr_exp_2@Base 3.1.3 + mpfr_exp_3@Base 3.1.3 + mpfr_expm1@Base 3.1.3 + mpfr_extract@Base 3.1.3 + mpfr_fac_ui@Base 3.1.3 + mpfr_fdump@Base 4.0.0 + mpfr_fits_intmax_p@Base 3.1.3 + mpfr_fits_sint_p@Base 3.1.3 + mpfr_fits_slong_p@Base 3.1.3 + mpfr_fits_sshort_p@Base 3.1.3 + mpfr_fits_uint_p@Base 3.1.3 + mpfr_fits_uintmax_p@Base 3.1.3 + mpfr_fits_ulong_p@Base 3.1.3 + mpfr_fits_ushort_p@Base 3.1.3 + mpfr_flags_clear@Base 4.0.0 + mpfr_flags_restore@Base 4.0.0 + mpfr_flags_save@Base 4.0.0 + mpfr_flags_set@Base 4.0.0 + mpfr_flags_test@Base 4.0.0 + mpfr_floor@Base 3.1.3 + mpfr_fma@Base 3.1.3 + mpfr_fmma@Base 4.0.0 + mpfr_fmms@Base 4.0.0 + mpfr_fmod@Base 3.1.3 + mpfr_fmodquo@Base 4.0.0 + mpfr_fms@Base 3.1.3 + mpfr_frac@Base 3.1.3 + mpfr_free_cache2@Base 4.0.0 + mpfr_free_cache@Base 3.1.3 + mpfr_free_func@Base 3.1.3 + mpfr_free_pool@Base 4.0.0 + mpfr_free_str@Base 3.1.3 + mpfr_frexp@Base 3.1.3 + mpfr_gamma@Base 3.1.3 + mpfr_gamma_inc@Base 4.0.0 + mpfr_gamma_one_and_two_third@Base 3.1.3 + mpfr_get_d1@Base 3.1.3 + mpfr_get_d@Base 3.1.3 + mpfr_get_d_2exp@Base 3.1.3 + (arch=any-amd64 any-i386 powerpc ppc64 ppc64el s390x)mpfr_get_decimal64@Base 4.0.0 + mpfr_get_default_prec@Base 3.1.3 + mpfr_get_default_rounding_mode@Base 3.1.3 + mpfr_get_emax@Base 3.1.3 + mpfr_get_emax_max@Base 3.1.3 + mpfr_get_emax_min@Base 3.1.3 + mpfr_get_emin@Base 3.1.3 + mpfr_get_emin_max@Base 3.1.3 + mpfr_get_emin_min@Base 3.1.3 + mpfr_get_exp@Base 3.1.3 + mpfr_get_f@Base 3.1.3 + (arch=any-amd64 any-i386 ia64)mpfr_get_float128@Base 4.0.0 + mpfr_get_flt@Base 3.1.3 + mpfr_get_ld@Base 3.1.3 + mpfr_get_ld_2exp@Base 3.1.3 + mpfr_get_patches@Base 3.1.3 + mpfr_get_prec@Base 3.1.3 + mpfr_get_q@Base 4.0.0 + mpfr_get_si@Base 3.1.3 + mpfr_get_str@Base 3.1.3 + mpfr_get_ui@Base 3.1.3 + mpfr_get_version@Base 3.1.3 + mpfr_get_z@Base 3.1.3 + mpfr_get_z_2exp@Base 3.1.3 + mpfr_grandom@Base 3.1.3 + mpfr_greater_p@Base 3.1.3 + mpfr_greaterequal_p@Base 3.1.3 + mpfr_hypot@Base 3.1.3 + mpfr_inexflag_p@Base 3.1.3 + mpfr_inf_p@Base 3.1.3 + mpfr_init2@Base 3.1.3 + mpfr_init@Base 3.1.3 + mpfr_init_set_str@Base 3.1.3 + mpfr_inits2@Base 3.1.3 + mpfr_inits@Base 3.1.3 + mpfr_integer_p@Base 3.1.3 + mpfr_j0@Base 3.1.3 + mpfr_j1@Base 3.1.3 + mpfr_jn@Base 3.1.3 + mpfr_l2b_10_0__tab@Base 3.1.3 + mpfr_l2b_10_1__tab@Base 3.1.3 + mpfr_l2b_11_0__tab@Base 3.1.3 + mpfr_l2b_11_1__tab@Base 3.1.3 + mpfr_l2b_12_0__tab@Base 3.1.3 + mpfr_l2b_12_1__tab@Base 3.1.3 + mpfr_l2b_13_0__tab@Base 3.1.3 + mpfr_l2b_13_1__tab@Base 3.1.3 + mpfr_l2b_14_0__tab@Base 3.1.3 + mpfr_l2b_14_1__tab@Base 3.1.3 + mpfr_l2b_15_0__tab@Base 3.1.3 + mpfr_l2b_15_1__tab@Base 3.1.3 + mpfr_l2b_16_0__tab@Base 3.1.3 + mpfr_l2b_16_1__tab@Base 3.1.3 + mpfr_l2b_17_0__tab@Base 3.1.3 + mpfr_l2b_17_1__tab@Base 3.1.3 + mpfr_l2b_18_0__tab@Base 3.1.3 + mpfr_l2b_18_1__tab@Base 3.1.3 + mpfr_l2b_19_0__tab@Base 3.1.3 + mpfr_l2b_19_1__tab@Base 3.1.3 + mpfr_l2b_20_0__tab@Base 3.1.3 + mpfr_l2b_20_1__tab@Base 3.1.3 + mpfr_l2b_21_0__tab@Base 3.1.3 + mpfr_l2b_21_1__tab@Base 3.1.3 + mpfr_l2b_22_0__tab@Base 3.1.3 + mpfr_l2b_22_1__tab@Base 3.1.3 + mpfr_l2b_23_0__tab@Base 3.1.3 + mpfr_l2b_23_1__tab@Base 3.1.3 + mpfr_l2b_24_0__tab@Base 3.1.3 + mpfr_l2b_24_1__tab@Base 3.1.3 + mpfr_l2b_25_0__tab@Base 3.1.3 + mpfr_l2b_25_1__tab@Base 3.1.3 + mpfr_l2b_26_0__tab@Base 3.1.3 + mpfr_l2b_26_1__tab@Base 3.1.3 + mpfr_l2b_27_0__tab@Base 3.1.3 + mpfr_l2b_27_1__tab@Base 3.1.3 + mpfr_l2b_28_0__tab@Base 3.1.3 + mpfr_l2b_28_1__tab@Base 3.1.3 + mpfr_l2b_29_0__tab@Base 3.1.3 + mpfr_l2b_29_1__tab@Base 3.1.3 + mpfr_l2b_2_0__tab@Base 3.1.3 + mpfr_l2b_2_1__tab@Base 3.1.3 + mpfr_l2b_30_0__tab@Base 3.1.3 + mpfr_l2b_30_1__tab@Base 3.1.3 + mpfr_l2b_31_0__tab@Base 3.1.3 + mpfr_l2b_31_1__tab@Base 3.1.3 + mpfr_l2b_32_0__tab@Base 3.1.3 + mpfr_l2b_32_1__tab@Base 3.1.3 + mpfr_l2b_33_0__tab@Base 3.1.3 + mpfr_l2b_33_1__tab@Base 3.1.3 + mpfr_l2b_34_0__tab@Base 3.1.3 + mpfr_l2b_34_1__tab@Base 3.1.3 + mpfr_l2b_35_0__tab@Base 3.1.3 + mpfr_l2b_35_1__tab@Base 3.1.3 + mpfr_l2b_36_0__tab@Base 3.1.3 + mpfr_l2b_36_1__tab@Base 3.1.3 + mpfr_l2b_37_0__tab@Base 3.1.3 + mpfr_l2b_37_1__tab@Base 3.1.3 + mpfr_l2b_38_0__tab@Base 3.1.3 + mpfr_l2b_38_1__tab@Base 3.1.3 + mpfr_l2b_39_0__tab@Base 3.1.3 + mpfr_l2b_39_1__tab@Base 3.1.3 + mpfr_l2b_3_0__tab@Base 3.1.3 + mpfr_l2b_3_1__tab@Base 3.1.3 + mpfr_l2b_40_0__tab@Base 3.1.3 + mpfr_l2b_40_1__tab@Base 3.1.3 + mpfr_l2b_41_0__tab@Base 3.1.3 + mpfr_l2b_41_1__tab@Base 3.1.3 + mpfr_l2b_42_0__tab@Base 3.1.3 + mpfr_l2b_42_1__tab@Base 3.1.3 + mpfr_l2b_43_0__tab@Base 3.1.3 + mpfr_l2b_43_1__tab@Base 3.1.3 + mpfr_l2b_44_0__tab@Base 3.1.3 + mpfr_l2b_44_1__tab@Base 3.1.3 + mpfr_l2b_45_0__tab@Base 3.1.3 + mpfr_l2b_45_1__tab@Base 3.1.3 + mpfr_l2b_46_0__tab@Base 3.1.3 + mpfr_l2b_46_1__tab@Base 3.1.3 + mpfr_l2b_47_0__tab@Base 3.1.3 + mpfr_l2b_47_1__tab@Base 3.1.3 + mpfr_l2b_48_0__tab@Base 3.1.3 + mpfr_l2b_48_1__tab@Base 3.1.3 + mpfr_l2b_49_0__tab@Base 3.1.3 + mpfr_l2b_49_1__tab@Base 3.1.3 + mpfr_l2b_4_0__tab@Base 3.1.3 + mpfr_l2b_4_1__tab@Base 3.1.3 + mpfr_l2b_50_0__tab@Base 3.1.3 + mpfr_l2b_50_1__tab@Base 3.1.3 + mpfr_l2b_51_0__tab@Base 3.1.3 + mpfr_l2b_51_1__tab@Base 3.1.3 + mpfr_l2b_52_0__tab@Base 3.1.3 + mpfr_l2b_52_1__tab@Base 3.1.3 + mpfr_l2b_53_0__tab@Base 3.1.3 + mpfr_l2b_53_1__tab@Base 3.1.3 + mpfr_l2b_54_0__tab@Base 3.1.3 + mpfr_l2b_54_1__tab@Base 3.1.3 + mpfr_l2b_55_0__tab@Base 3.1.3 + mpfr_l2b_55_1__tab@Base 3.1.3 + mpfr_l2b_56_0__tab@Base 3.1.3 + mpfr_l2b_56_1__tab@Base 3.1.3 + mpfr_l2b_57_0__tab@Base 3.1.3 + mpfr_l2b_57_1__tab@Base 3.1.3 + mpfr_l2b_58_0__tab@Base 3.1.3 + mpfr_l2b_58_1__tab@Base 3.1.3 + mpfr_l2b_59_0__tab@Base 3.1.3 + mpfr_l2b_59_1__tab@Base 3.1.3 + mpfr_l2b_5_0__tab@Base 3.1.3 + mpfr_l2b_5_1__tab@Base 3.1.3 + mpfr_l2b_60_0__tab@Base 3.1.3 + mpfr_l2b_60_1__tab@Base 3.1.3 + mpfr_l2b_61_0__tab@Base 3.1.3 + mpfr_l2b_61_1__tab@Base 3.1.3 + mpfr_l2b_62_0__tab@Base 3.1.3 + mpfr_l2b_62_1__tab@Base 3.1.3 + mpfr_l2b_6_0__tab@Base 3.1.3 + mpfr_l2b_6_1__tab@Base 3.1.3 + mpfr_l2b_7_0__tab@Base 3.1.3 + mpfr_l2b_7_1__tab@Base 3.1.3 + mpfr_l2b_8_0__tab@Base 3.1.3 + mpfr_l2b_8_1__tab@Base 3.1.3 + mpfr_l2b_9_0__tab@Base 3.1.3 + mpfr_l2b_9_1__tab@Base 3.1.3 + mpfr_less_p@Base 3.1.3 + mpfr_lessequal_p@Base 3.1.3 + mpfr_lessgreater_p@Base 3.1.3 + mpfr_lgamma@Base 3.1.3 + mpfr_li2@Base 3.1.3 + mpfr_lngamma@Base 3.1.3 + mpfr_log10@Base 3.1.3 + mpfr_log1p@Base 3.1.3 + mpfr_log2@Base 3.1.3 + mpfr_log@Base 3.1.3 + mpfr_log_ui@Base 4.0.0 + mpfr_max@Base 3.1.3 + mpfr_min@Base 3.1.3 + mpfr_min_prec@Base 3.1.3 + mpfr_modf@Base 3.1.3 + mpfr_mp_memory_cleanup@Base 4.0.0 + mpfr_mpn_exp@Base 3.1.3 + mpfr_mpz_clear@Base 4.0.0 + mpfr_mpz_init2@Base 4.0.0 + mpfr_mpz_init@Base 4.0.0 + mpfr_mul@Base 3.1.3 + mpfr_mul_2exp@Base 3.1.3 + mpfr_mul_2si@Base 3.1.3 + mpfr_mul_2ui@Base 3.1.3 + mpfr_mul_d@Base 3.1.3 + mpfr_mul_q@Base 3.1.3 + mpfr_mul_si@Base 3.1.3 + mpfr_mul_ui@Base 3.1.3 + mpfr_mul_z@Base 3.1.3 + mpfr_mulhigh_n@Base 3.1.3 + mpfr_nan_p@Base 3.1.3 + mpfr_nanflag_p@Base 3.1.3 + mpfr_neg@Base 3.1.3 + mpfr_nextabove@Base 3.1.3 + mpfr_nextbelow@Base 3.1.3 + mpfr_nexttoinf@Base 3.1.3 + mpfr_nexttoward@Base 3.1.3 + mpfr_nexttozero@Base 3.1.3 + mpfr_nrandom@Base 4.0.0 + mpfr_number_p@Base 3.1.3 + mpfr_odd_p@Base 4.0.0 + mpfr_overflow@Base 3.1.3 + mpfr_overflow_p@Base 3.1.3 + mpfr_pow@Base 3.1.3 + mpfr_pow_general@Base 3.1.3 + mpfr_pow_si@Base 3.1.3 + mpfr_pow_ui@Base 3.1.3 + mpfr_pow_z@Base 3.1.3 + mpfr_powerof2_raw2@Base 3.1.5 + mpfr_powerof2_raw@Base 3.1.3 + mpfr_prec_round@Base 3.1.3 + mpfr_print_mant_binary@Base 3.1.3 + mpfr_print_rnd_mode@Base 3.1.3 + mpfr_printf@Base 3.1.3 + mpfr_rand_raw@Base 3.1.3 + mpfr_random_deviate_clear@Base 4.0.0 + mpfr_random_deviate_init@Base 4.0.0 + mpfr_random_deviate_less@Base 4.0.0 + mpfr_random_deviate_reset@Base 4.0.0 + mpfr_random_deviate_swap@Base 4.0.0 + mpfr_random_deviate_tstbit@Base 4.0.0 + mpfr_random_deviate_value@Base 4.0.0 + mpfr_reallocate_func@Base 3.1.3 + mpfr_rec_sqrt@Base 3.1.3 + mpfr_regular_p@Base 3.1.3 + mpfr_reldiff@Base 3.1.3 + mpfr_remainder@Base 3.1.3 + mpfr_remquo@Base 3.1.3 + mpfr_rint@Base 3.1.3 + mpfr_rint_ceil@Base 3.1.3 + mpfr_rint_floor@Base 3.1.3 + mpfr_rint_round@Base 3.1.3 + mpfr_rint_roundeven@Base 4.0.0 + mpfr_rint_trunc@Base 3.1.3 + mpfr_root@Base 3.1.3 + mpfr_rootn_ui@Base 4.0.0 + mpfr_round@Base 3.1.3 + mpfr_round_near_x@Base 3.1.3 + mpfr_round_nearest_away_begin@Base 4.0.0 + mpfr_round_nearest_away_end@Base 4.0.0 + mpfr_round_p@Base 3.1.3 + mpfr_round_raw@Base 3.1.3 + mpfr_round_raw_2@Base 3.1.3 + mpfr_round_raw_4@Base 3.1.3 + mpfr_roundeven@Base 4.0.0 + mpfr_scale2@Base 3.1.3 + mpfr_sec@Base 3.1.3 + mpfr_sech@Base 3.1.3 + mpfr_set4@Base 3.1.3 + mpfr_set@Base 3.1.3 + mpfr_set_1_2@Base 4.0.0 + mpfr_set_d@Base 3.1.3 + (arch=any-amd64 any-i386 powerpc ppc64 ppc64el s390x)mpfr_set_decimal64@Base 4.0.0 + mpfr_set_default_prec@Base 3.1.3 + mpfr_set_default_rounding_mode@Base 3.1.3 + mpfr_set_divby0@Base 3.1.3 + mpfr_set_emax@Base 3.1.3 + mpfr_set_emin@Base 3.1.3 + mpfr_set_erangeflag@Base 3.1.3 + mpfr_set_exp@Base 3.1.3 + mpfr_set_f@Base 3.1.3 + (arch=any-amd64 any-i386 ia64)mpfr_set_float128@Base 4.0.0 + mpfr_set_flt@Base 3.1.3 + mpfr_set_inexflag@Base 3.1.3 + mpfr_set_inf@Base 3.1.3 + mpfr_set_ld@Base 3.1.3 + mpfr_set_nan@Base 3.1.3 + mpfr_set_nanflag@Base 3.1.3 + mpfr_set_overflow@Base 3.1.3 + mpfr_set_prec@Base 3.1.3 + mpfr_set_prec_raw@Base 3.1.3 + mpfr_set_q@Base 3.1.3 + mpfr_set_si@Base 3.1.3 + mpfr_set_si_2exp@Base 3.1.3 + mpfr_set_str@Base 3.1.3 + mpfr_set_str_binary@Base 3.1.3 + mpfr_set_ui@Base 3.1.3 + mpfr_set_ui_2exp@Base 3.1.3 + mpfr_set_underflow@Base 3.1.3 + mpfr_set_z@Base 3.1.3 + mpfr_set_z_2exp@Base 3.1.3 + mpfr_set_zero@Base 3.1.3 + mpfr_setmax@Base 3.1.3 + mpfr_setmin@Base 3.1.3 + mpfr_setsign@Base 3.1.3 + mpfr_sgn@Base 3.1.3 + mpfr_si_div@Base 3.1.3 + mpfr_si_sub@Base 3.1.3 + mpfr_signbit@Base 3.1.3 + mpfr_sin@Base 3.1.3 + mpfr_sin_cos@Base 3.1.3 + mpfr_sincos_fast@Base 3.1.3 + mpfr_sinh@Base 3.1.3 + mpfr_sinh_cosh@Base 3.1.3 + mpfr_snprintf@Base 3.1.3 + mpfr_sprintf@Base 3.1.3 + mpfr_sqr@Base 3.1.3 + mpfr_sqrhigh_n@Base 3.1.3 + mpfr_sqrt@Base 3.1.3 + mpfr_sqrt_ui@Base 3.1.3 + mpfr_strtofr@Base 3.1.3 + mpfr_sub1@Base 3.1.3 + mpfr_sub1sp@Base 3.1.3 + mpfr_sub@Base 3.1.3 + mpfr_sub_d@Base 3.1.3 + mpfr_sub_q@Base 3.1.3 + mpfr_sub_si@Base 3.1.3 + mpfr_sub_ui@Base 3.1.3 + mpfr_sub_z@Base 3.1.3 + mpfr_subnormalize@Base 3.1.3 + mpfr_sum@Base 3.1.3 + mpfr_swap@Base 3.1.3 + mpfr_tan@Base 3.1.3 + mpfr_tanh@Base 3.1.3 + mpfr_tmp_allocate@Base 3.1.3 + mpfr_tmp_free@Base 3.1.3 + mpfr_trunc@Base 3.1.3 + mpfr_ubf_diff_exp@Base 4.0.0 + mpfr_ubf_exp_less_p@Base 4.0.0 + mpfr_ubf_mul_exact@Base 4.0.0 + mpfr_ubf_zexp2exp@Base 4.0.0 + mpfr_ui_div@Base 3.1.3 + mpfr_ui_pow@Base 3.1.3 + mpfr_ui_pow_ui@Base 3.1.3 + mpfr_ui_sub@Base 3.1.3 + mpfr_underflow@Base 3.1.3 + mpfr_underflow_p@Base 3.1.3 + mpfr_unordered_p@Base 3.1.3 + mpfr_urandom@Base 3.1.3 + mpfr_urandomb@Base 3.1.3 + mpfr_vasnprintf_aux@Base 4.0.0 + mpfr_y0@Base 3.1.3 + mpfr_y1@Base 3.1.3 + mpfr_yn@Base 3.1.3 + mpfr_z_sub@Base 3.1.3 + mpfr_zero_p@Base 3.1.3 + mpfr_zeta@Base 3.1.3 + mpfr_zeta_ui@Base 3.1.3 diff -Nru mpfr4-3.1.4/debian/libmpfr-dev.install mpfr4-4.0.2/debian/libmpfr-dev.install --- mpfr4-3.1.4/debian/libmpfr-dev.install 2013-10-21 05:18:28.000000000 +0000 +++ mpfr4-4.0.2/debian/libmpfr-dev.install 2018-12-06 15:15:00.000000000 +0000 @@ -1,3 +1,4 @@ usr/lib/*/libmpfr.so usr/lib/*/libmpfr.a +usr/lib/*/pkgconfig/mpfr.pc usr/include/*.h usr/include/ diff -Nru mpfr4-3.1.4/debian/libmpfr-doc.doc-base mpfr4-4.0.2/debian/libmpfr-doc.doc-base --- mpfr4-3.1.4/debian/libmpfr-doc.doc-base 2013-10-21 05:18:28.000000000 +0000 +++ mpfr4-4.0.2/debian/libmpfr-doc.doc-base 2018-02-07 17:26:38.000000000 +0000 @@ -12,4 +12,4 @@ Format: Info Index: /usr/share/info/mpfr.info.gz -Files: /usr/share/info/mpfr.info.gz \ No newline at end of file +Files: /usr/share/info/mpfr.info.gz diff -Nru mpfr4-3.1.4/debian/README.Debian mpfr4-4.0.2/debian/README.Debian --- mpfr4-3.1.4/debian/README.Debian 2013-10-21 05:18:28.000000000 +0000 +++ mpfr4-4.0.2/debian/README.Debian 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -C++ interface -------------- - -We used to ship a C++ interface, but it has been broken for some time. - -MPFR Documentation ------------------- - -The documentation of MPFR is licensed under the GFDL which is -considered non-free by the debian project, and has been removed from -this package. - - -- Laurent Fousse , Sun, 12 Oct 2008 16:58:22 +0200 diff -Nru mpfr4-3.1.4/debian/rules mpfr4-4.0.2/debian/rules --- mpfr4-3.1.4/debian/rules 2015-06-22 11:25:06.000000000 +0000 +++ mpfr4-4.0.2/debian/rules 2018-02-07 17:53:06.000000000 +0000 @@ -39,7 +39,11 @@ CXXFLAGS := -g $(shell dpkg-buildflags --get CXXFLAGS) LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) -Wl,-z,defs -ifeq (m68k,$(DEB_HOST_ARCH)) +ifeq ($(shell dpkg-vendor --query Vendor),Debian) + mpfr4breaks = $(shell tr '\n' ' ' < debian/breaks.Debian) +endif + +ifneq (,$(filter $(DEB_HOST_ARCH), m68k powerpcspe)) CFLAGS += -O0 else ifeq (sh4,$(DEB_HOST_ARCH)) CFLAGS += -mieee @@ -58,6 +62,8 @@ stamps/autoreconf-stamp: dh_autoreconf + rm -f doc/texinfo.tex + ln -s /usr/share/texmf/tex/texinfo/texinfo.tex doc/texinfo.tex @mkdir -p stamps touch $@ @@ -84,7 +90,13 @@ ifeq ($(with_check),yes) ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) - GMP_CHECK_RANDOMIZE=1 $(MAKE) -C build check + if GMP_CHECK_RANDOMIZE=1 $(MAKE) -C build check; then \ + echo "testsuite passed"; \ + else \ + echo "testsuite failed"; \ + cat build/tests/test-suite.log; \ + exit 1; \ + fi endif endif touch $@ @@ -94,6 +106,7 @@ build: build-indep build-arch clean: + rm -f doc/texinfo.tex dh_autoreconf_clean rm -rf stamps dh_testdir @@ -112,7 +125,7 @@ # Miscellaneous install. dh_install -i - dh_install -plibmpfr4 + dh_install -plibmpfr6 dh_install -plibmpfr-dev binary-indep: build build-doc install @@ -127,35 +140,34 @@ dh_fixperms -i dh_lintian -i dh_installdeb -i - dh_gencontrol -i + dh_gencontrol -i -- dh_md5sums -i dh_builddeb -i binary-arch: build install dh_testdir dh_testroot - dh_installchangelogs -s ChangeLog - dh_installdocs -s -A BUGS NEWS README TODO AUTHORS - dh_installexamples -s - dh_installinfo -s - DH_COMPAT=9 dh_strip -s --dbg-package=libmpfr4-dbg - dh_link -s - dh_compress -s + dh_installchangelogs -a ChangeLog + dh_installdocs -a -A BUGS NEWS README TODO AUTHORS + dh_installexamples -a + dh_installinfo -a + dh_strip -a + dh_link -a + dh_compress -a for f in BUGS NEWS README TODO AUTHORS changelog; do \ - if [ -f debian/libmpfr4/usr/share/doc/libmpfr4/$$f.gz ]; then \ + if [ -f debian/libmpfr6/usr/share/doc/libmpfr6/$$f.gz ]; then \ f=$$f.gz; \ fi; \ - ln -sf ../libmpfr4/$$f debian/libmpfr4-dbg/usr/share/doc/libmpfr4-dbg/$$f; \ - ln -sf ../libmpfr4/$$f debian/libmpfr-dev/usr/share/doc/libmpfr-dev/$$f; \ + ln -sf ../libmpfr6/$$f debian/libmpfr-dev/usr/share/doc/libmpfr-dev/$$f; \ done - dh_makeshlibs -V -plibmpfr4 - dh_fixperms -s - dh_lintian -s - dh_installdeb -s - dh_shlibdeps -s - dh_gencontrol -s - dh_md5sums -s - dh_builddeb -s + dh_makeshlibs -V -plibmpfr6 + dh_fixperms -a + dh_lintian -a + dh_installdeb -a + dh_shlibdeps -a + dh_gencontrol -a -- '-Vmpfr:Breaks=$(mpfr4breaks)' + dh_md5sums -a + dh_builddeb -a binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary-common binary install build-arch build-indep diff -Nru mpfr4-3.1.4/debian/source/lintian-overrides mpfr4-4.0.2/debian/source/lintian-overrides --- mpfr4-3.1.4/debian/source/lintian-overrides 2015-06-22 11:00:07.000000000 +0000 +++ mpfr4-4.0.2/debian/source/lintian-overrides 2018-02-07 18:07:46.000000000 +0000 @@ -1,5 +1,2 @@ # lintian complaining about debian/copyright mpfr4 source: license-problem-gfdl-invariants - -# lintian complaining about case sensitivity, really ... -mpfr4 source: license-problem-gfdl-non-official-text diff -Nru mpfr4-3.1.4/depcomp mpfr4-4.0.2/depcomp --- mpfr4-3.1.4/depcomp 2016-03-06 11:33:18.000000000 +0000 +++ mpfr4-4.0.2/depcomp 2019-01-31 20:43:20.000000000 +0000 @@ -1,9 +1,9 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2013-05-30.07; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -783,9 +783,9 @@ # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff -Nru mpfr4-3.1.4/doc/check-typography mpfr4-4.0.2/doc/check-typography --- mpfr4-3.1.4/doc/check-typography 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/doc/check-typography 2019-01-01 21:02:47.000000000 +0000 @@ -0,0 +1,36 @@ +#!/bin/sh + +# Copyright 2016-2019 Free Software Foundation, Inc. +# This script is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +o=$(grep -E '[A-Z]\)?[.!?]( |$)' mpfr.texi | grep -Ev '^(\* .*::|@c )') +[ -z "$o" ] && exit + +# Note: The default Texinfo rules are heuristics allowing one to get +# typography correct by default in most cases, but it is also easy to +# leave errors if one does not check the generated info file. Thus it +# is better to make typography explicit concerning punctuation marks. +# The above test checks lines ending with a capital letter possibly +# followed by a closing parenthesis, followed by one of the concerned +# punctuation marks; menu items and comments are ignored. + +cat < @@ -78,6 +78,8 @@ margin-left: 2em; } +.highlight { background: #dddddd } + .nowrap { white-space: nowrap } /* @@ -118,7 +120,7 @@ bugs page.

The latest version of this FAQ is available at -http://www.mpfr.org/faq.html. +https://www.mpfr.org/faq.html. Please look at this version if possible.

    @@ -337,21 +339,21 @@

    The MPFR team does not currently recommend any autoconf code, but a section will later -be added to the MPFR manual. The -MPFR team does not wish to support -pkg-config yet.

    +be added to the MPFR manual. +Limited pkg-config support has been added for +MPFR 4.0.0; example:

    +
    cc myprogram.c $(pkg-config --cflags --libs mpfr)
    9. How to cite MPFR in a scientific publication?

    To properly cite MPFR in a scientific publication, please cite the -ACM +ACM TOMS paper -(BibTeX) and/or the library web page -http://www.mpfr.org. If your publication +https://www.mpfr.org. If your publication is related to a particular release of MPFR, for example if you report timings, please also indicate the release number for future reference.

    diff -Nru mpfr4-3.1.4/doc/fdl.texi mpfr4-4.0.2/doc/fdl.texi --- mpfr4-3.1.4/doc/fdl.texi 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/doc/fdl.texi 2019-01-07 13:53:20.000000000 +0000 @@ -395,7 +395,7 @@ of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See -@uref{http://www.gnu.org/copyleft/}. +@uref{https://www.gnu.org/copyleft/}. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this diff -Nru mpfr4-3.1.4/doc/Makefile.am mpfr4-4.0.2/doc/Makefile.am --- mpfr4-3.1.4/doc/Makefile.am 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/doc/Makefile.am 2019-01-01 21:02:47.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright 2010-2016 Free Software Foundation, Inc. +# Copyright 2010-2019 Free Software Foundation, Inc. # This Makefile.am is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff -Nru mpfr4-3.1.4/doc/Makefile.in mpfr4-4.0.2/doc/Makefile.in --- mpfr4-3.1.4/doc/Makefile.in 2016-03-06 11:33:18.000000000 +0000 +++ mpfr4-4.0.2/doc/Makefile.in 2019-01-31 20:43:20.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,7 +14,7 @@ @SET_MAKE@ -# Copyright 2010-2016 Free Software Foundation, Inc. +# Copyright 2010-2019 Free Software Foundation, Inc. # This Makefile.am is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -103,8 +103,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(dist_doc_DATA) \ @@ -253,6 +252,7 @@ MKDIR_P = @MKDIR_P@ MPFR_LDFLAGS = @MPFR_LDFLAGS@ MPFR_LIBM = @MPFR_LIBM@ +MPFR_LIBQUADMATH = @MPFR_LIBQUADMATH@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -267,6 +267,9 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -286,6 +289,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -352,8 +356,8 @@ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -539,7 +543,10 @@ cscope cscopelist: -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff -Nru mpfr4-3.1.4/doc/mpfr.info mpfr4-4.0.2/doc/mpfr.info --- mpfr4-3.1.4/doc/mpfr.info 2016-03-06 11:33:32.000000000 +0000 +++ mpfr4-4.0.2/doc/mpfr.info 2019-01-31 20:43:30.000000000 +0000 @@ -1,9 +1,9 @@ -This is mpfr.info, produced by makeinfo version 6.1 from mpfr.texi. +This is mpfr.info, produced by makeinfo version 6.5 from mpfr.texi. This manual documents how to install and use the Multiple Precision -Floating-Point Reliable Library, version 3.1.4. +Floating-Point Reliable Library, version 4.0.2. - Copyright 1991, 1993-2016 Free Software Foundation, Inc. + Copyright 1991, 1993-2019 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or @@ -23,9 +23,9 @@ ******** This manual documents how to install and use the Multiple Precision -Floating-Point Reliable Library, version 3.1.4. +Floating-Point Reliable Library, version 4.0.2. - Copyright 1991, 1993-2016 Free Software Foundation, Inc. + Copyright 1991, 1993-2019 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or @@ -43,6 +43,7 @@ * MPFR Basics:: What every MPFR user should now. * MPFR Interface:: MPFR functions and macros. * API Compatibility:: API compatibility with previous MPFR versions. +* MPFR and the IEEE 754 Standard:: * Contributors:: * References:: * GNU Free Documentation License:: @@ -98,22 +99,27 @@ • the MPFR code is portable, i.e., the result of any operation does not depend on the machine word size ‘mp_bits_per_limb’ (64 on most - current processors); + current processors), possibly except in faithful rounding. It does + not depend either on the machine rounding mode or rounding + precision; • the precision in bits can be set _exactly_ to any valid value for each variable (including very small precision); • MPFR provides the four rounding modes from the IEEE 754-1985 standard, plus away-from-zero, as well as for basic operations as - for other mathematical functions. - - In particular, with a precision of 53 bits, MPFR is able to exactly -reproduce all computations with double-precision machine floating-point -numbers (e.g., ‘double’ type in C, with a C implementation that -rigorously follows Annex F of the ISO C99 standard and ‘FP_CONTRACT’ -pragma set to ‘OFF’) on the four arithmetic operations and the square -root, except the default exponent range is much wider and subnormal -numbers are not implemented (but can be emulated). + for other mathematical functions. Faithful rounding (partially + supported) is provided too, but the results may no longer be + reproducible. + + In particular, with a precision of 53 bits and in any of the four +standard rounding modes, MPFR is able to exactly reproduce all +computations with double-precision machine floating-point numbers (e.g., +‘double’ type in C, with a C implementation that rigorously follows +Annex F of the ISO C99 standard and ‘FP_CONTRACT’ pragma set to ‘OFF’) +on the four arithmetic operations and the square root, except the +default exponent range is much wider and subnormal numbers are not +implemented (but can be emulated). This version of MPFR is released under the GNU Lesser General Public License, version 3 or any later version. It is permitted to link MPFR @@ -175,7 +181,7 @@ Here are the steps needed to install the library on Unix systems (more details are provided in the ‘INSTALL’ file): - 1. To build MPFR, you first have to install GNU MP (version 4.1 or + 1. To build MPFR, you first have to install GNU MP (version 5.0.0 or higher) on your computer. You need a C compiler, preferably GCC, but any reasonable compiler should work. And you need the standard Unix ‘make’ command, plus some other standard Unix utility @@ -273,17 +279,17 @@ reporting a bug, in particular section “In case of problemâ€. Some problems are due to bad configuration on the user side (not specific to MPFR). Problems are also mentioned in the FAQ -. +. Please report problems to the MPFR mailing-list ‘mpfr@inria.fr’. -*Note Reporting Bugs::. Some bug fixes are available on the MPFR 3.1.4 -web page . +*Note Reporting Bugs::. Some bug fixes are available on the MPFR 4.0.2 +web page . 2.4 Getting the Latest Version of MPFR ====================================== The latest version of MPFR is available from - or . + or .  File: mpfr.info, Node: Reporting Bugs, Next: MPFR Basics, Prev: Installing MPFR, Up: Top @@ -292,10 +298,10 @@ **************** If you think you have found a bug in the MPFR library, first have a look -on the MPFR 3.1.4 web page and the FAQ -: perhaps this bug is already known, in -which case you may find there a workaround for it. You might also look -in the archives of the MPFR mailing-list: +on the MPFR 4.0.2 web page and the +FAQ : perhaps this bug is already known, +in which case you may find there a workaround for it. You might also +look in the archives of the MPFR mailing-list: . Otherwise, please investigate and report it. We have made this library available to you, and it is not to ask too much from you, to ask you to report the bugs that you @@ -312,7 +318,7 @@ results you get are incorrect and in that case, in what way. Please include compiler version information in your bug report. This -can be extracted using ‘cc -V’ on some machines, or, if you’re using +can be extracted using ‘cc -V’ on some machines, or, if you are using GCC, ‘gcc -v’. Also, include the output from ‘uname -a’ and the MPFR version (the GMP version may be useful too). If you get a failure while running ‘make’ or ‘make check’, please include the ‘config.log’ file in @@ -344,6 +350,7 @@ * Floating-Point Values on Special Numbers:: * Exceptions:: * Memory Handling:: +* Getting the Best Efficiency Out of MPFR::  File: mpfr.info, Node: Headers and Libraries, Next: Nomenclature and Types, Prev: MPFR Basics, Up: MPFR Basics @@ -369,11 +376,11 @@ And for any functions using ‘intmax_t’, you must include ‘’ or ‘’ before ‘mpfr.h’, to allow ‘mpfr.h’ to define -prototypes for these functions. Moreover, users of C++ compilers under -some platforms may need to define ‘MPFR_USE_INTMAX_T’ (and should do it -for portability) before ‘mpfr.h’ has been included; of course, it is -possible to do that on the command line, e.g., with -‘-DMPFR_USE_INTMAX_T’. +prototypes for these functions. Moreover, under some platforms (in +particular with C++ compilers), users may need to define +‘MPFR_USE_INTMAX_T’ (and should do it for portability) before ‘mpfr.h’ +has been included; of course, it is possible to do that on the command +line, e.g., with ‘-DMPFR_USE_INTMAX_T’. Note: If ‘mpfr.h’ and/or ‘gmp.h’ (used by ‘mpfr.h’) are included several times (possibly from another header file), ‘’ and/or @@ -412,31 +419,46 @@ ‘LD_LIBRARY_PATH’) on some systems. Please read the ‘INSTALL’ file for additional information. + Alternatively, it is possible to use ‘pkg-config’ (a file ‘mpfr.pc’ +is provided as of MPFR 4.0): + + cc myprogram.c $(pkg-config --cflags --libs mpfr) + + Note that the ‘MPFR_’ and ‘mpfr_’ prefixes are reserved for MPFR. As +a general rule, in order to avoid clashes, software using MPFR (directly +or indirectly) and system headers/libraries should not define macros and +symbols using these prefixes. +  File: mpfr.info, Node: Nomenclature and Types, Next: MPFR Variable Conventions, Prev: Headers and Libraries, Up: MPFR Basics 4.2 Nomenclature and Types ========================== -A “floating-point numberâ€, or “float†for short, is an arbitrary -precision significand (also called mantissa) with a limited precision -exponent. The C data type for such objects is ‘mpfr_t’ (internally -defined as a one-element array of a structure, and ‘mpfr_ptr’ is the C -data type representing a pointer to this structure). A floating-point -number can have three special values: Not-a-Number (NaN) or plus or -minus Infinity. NaN represents an uninitialized object, the result of -an invalid operation (like 0 divided by 0), or a value that cannot be -determined (like +Infinity minus +Infinity). Moreover, like in the IEEE -754 standard, zero is signed, i.e., there are both +0 and −0; the -behavior is the same as in the IEEE 754 standard and it is generalized -to the other functions supported by MPFR. Unless documented otherwise, -the sign bit of a NaN is unspecified. +A “floating-point numberâ€, or “float†for short, is an object +representing a radix-2 floating-point number consisting of a sign, an +arbitrary-precision normalized significand (also called mantissa), and +an exponent (an integer in some given range); these are called “regular +numbersâ€. Like in the IEEE 754 standard, a floating-point number can +also have three kinds of special values: a signed zero, a signed +infinity, and Not-a-Number (NaN). NaN can represent the default value +of a floating-point object and the result of some operations for which +no other results would make sense, such as 0 divided by 0 or +Infinity +minus +Infinity; unless documented otherwise, the sign bit of a NaN is +unspecified. Note that contrary to IEEE 754, MPFR has a single kind of +NaN and does not have subnormals. Other than that, the behavior is very +similar to IEEE 754, but there may be some differences. + + The C data type for such objects is ‘mpfr_t’, internally defined as a +one-element array of a structure (so that when passed as an argument to +a function, it is the pointer that is actually passed), and ‘mpfr_ptr’ +is the C data type representing a pointer to this structure. -The “precision†is the number of bits used to represent the significand -of a floating-point number; the corresponding C data type is + The “precision†is the number of bits used to represent the +significand of a floating-point number; the corresponding C data type is ‘mpfr_prec_t’. The precision can be any integer between ‘MPFR_PREC_MIN’ and ‘MPFR_PREC_MAX’. In the current implementation, ‘MPFR_PREC_MIN’ is -equal to 2. +equal to 1. Warning! MPFR needs to increase the precision internally, in order to provide accurate results (and in particular, correct rounding). Do @@ -446,10 +468,20 @@ may abort, crash or have undefined behavior (depending on your C implementation). -The “rounding mode†specifies the way to round the result of a + An “exponent†is a component of a regular floating-point number. Its +C data type is ‘mpfr_exp_t’. Valid exponents are restricted to a subset +of this type, and the exponent range can be changed globally as +described in *note Exception Related Functions::. Special values do not +have an exponent. + + The “rounding mode†specifies the way to round the result of a floating-point operation, in case the exact result can not be -represented exactly in the destination significand; the corresponding C -data type is ‘mpfr_rnd_t’. +represented exactly in the destination; the corresponding C data type is +‘mpfr_rnd_t’. + + MPFR has a global (or per-thread) flag for each supported exception +and provides operations on flags (*note Exceptions::). This C data type +is used to represent a group of flags (or a mask).  File: mpfr.info, Node: MPFR Variable Conventions, Next: Rounding Modes, Prev: Nomenclature and Types, Up: MPFR Basics @@ -457,8 +489,8 @@ 4.3 MPFR Variable Conventions ============================= -Before you can assign to an MPFR variable, you need to initialize it by -calling one of the special initialization functions. When you’re done +Before you can assign to a MPFR variable, you need to initialize it by +calling one of the special initialization functions. When you are done with a variable, you need to clear it out, using one of the functions for that purpose. A variable should only be initialized once, or at least cleared out between each initialization. After a variable has @@ -485,7 +517,7 @@ 4.4 Rounding Modes ================== -The following five rounding modes are supported: +The following rounding modes are supported: • ‘MPFR_RNDN’: round to nearest (roundTiesToEven in IEEE 754-2008), • ‘MPFR_RNDZ’: round toward zero (roundTowardZero in IEEE 754-2008), • ‘MPFR_RNDU’: round toward plus infinity (roundTowardPositive in @@ -493,6 +525,16 @@ • ‘MPFR_RNDD’: round toward minus infinity (roundTowardNegative in IEEE 754-2008), • ‘MPFR_RNDA’: round away from zero. + • ‘MPFR_RNDF’: faithful rounding. This feature is currently + experimental. Specific support for this rounding mode has been + added to some functions, such as the basic operations (addition, + subtraction, multiplication, square, division, square root) or when + explicitly documented. It might also work with other functions, as + it is possible that they do not need modification in their code; + even though a correct behavior is not guaranteed yet (corrections + were done when failures occurred in the test suite, but almost + nothing has been checked manually), failures should be regarded as + bugs and reported, so that they can be fixed. The ‘round to nearest’ mode works as in the IEEE 754 standard: in case the number to be rounded lies exactly in the middle of two @@ -503,6 +545,20 @@ phenomenon mentioned by Knuth in volume 2 of The Art of Computer Programming (Section 4.2.2). + The ‘MPFR_RNDF’ mode works as follows: the computed value is either +that corresponding to ‘MPFR_RNDD’ or that corresponding to ‘MPFR_RNDU’. +In particular when those values are identical, i.e., when the result of +the corresponding operation is exactly representable, that exact result +is returned. Thus, the computed result can take at most two possible +values, and in absence of underflow/overflow, the corresponding error is +strictly less than one ulp (unit in the last place) of that result and +of the exact result. For ‘MPFR_RNDF’, the ternary value (defined below) +and the inexact flag (defined later, as with the other flags) are +unspecified, the divide-by-zero flag is as with other roundings, and the +underflow and overflow flags match what would be obtained in the case +the computed value is the same as with ‘MPFR_RNDD’ or ‘MPFR_RNDU’. The +results may not be reproducible. + Most MPFR functions take as first argument the destination variable, as second and following arguments the input variables, as last argument a rounding mode, and have a return value of type ‘int’, called the @@ -602,14 +658,23 @@ 4.6 Exceptions ============== -MPFR supports 6 exception types: - - • Underflow: An underflow occurs when the exact result of a function - is a non-zero real number and the result obtained after the - rounding, assuming an unbounded exponent range (for the rounding), - has an exponent smaller than the minimum value of the current - exponent range. (In the round-to-nearest mode, the halfway case is - rounded toward zero.) +MPFR defines a global (or per-thread) flag for each supported exception. +A macro evaluating to a power of two is associated with each flag and +exception, in order to be able to specify a group of flags (or a mask) +by OR’ing such macros. + + Flags can be cleared (lowered), set (raised), and tested by functions +described in *note Exception Related Functions::. + + The supported exceptions are listed below. The macro associated with +each exception is in parentheses. + + • Underflow (‘MPFR_FLAGS_UNDERFLOW’): An underflow occurs when the + exact result of a function is a non-zero real number and the result + obtained after the rounding, assuming an unbounded exponent range + (for the rounding), has an exponent smaller than the minimum value + of the current exponent range. (In the round-to-nearest mode, the + halfway case is rounded toward zero.) Note: This is not the single possible definition of the underflow. MPFR chooses to consider the underflow _after_ rounding. The @@ -626,30 +691,33 @@ times 2 to E, which is representable in the current exponent range. As a consequence, this will not yield an underflow in MPFR. - • Overflow: An overflow occurs when the exact result of a function is - a non-zero real number and the result obtained after the rounding, - assuming an unbounded exponent range (for the rounding), has an - exponent larger than the maximum value of the current exponent - range. In the round-to-nearest mode, the result is infinite. - Note: unlike the underflow case, there is only one possible - definition of overflow here. - - • Divide-by-zero: An exact infinite result is obtained from finite - inputs. - - • NaN: A NaN exception occurs when the result of a function is NaN. - - • Inexact: An inexact exception occurs when the result of a function - cannot be represented exactly and must be rounded. - - • Range error: A range exception occurs when a function that does not - return a MPFR number (such as comparisons and conversions to an - integer) has an invalid result (e.g., an argument is NaN in - ‘mpfr_cmp’, or a conversion to an integer cannot be represented in - the target type). - - MPFR has a global flag for each exception, which can be cleared, set -or tested by functions described in *note Exception Related Functions::. + • Overflow (‘MPFR_FLAGS_OVERFLOW’): An overflow occurs when the exact + result of a function is a non-zero real number and the result + obtained after the rounding, assuming an unbounded exponent range + (for the rounding), has an exponent larger than the maximum value + of the current exponent range. In the round-to-nearest mode, the + result is infinite. Note: unlike the underflow case, there is only + one possible definition of overflow here. + + • Divide-by-zero (‘MPFR_FLAGS_DIVBY0’): An exact infinite result is + obtained from finite inputs. + + • NaN (‘MPFR_FLAGS_NAN’): A NaN exception occurs when the result of a + function is NaN. + + • Inexact (‘MPFR_FLAGS_INEXACT’): An inexact exception occurs when + the result of a function cannot be represented exactly and must be + rounded. + + • Range error (‘MPFR_FLAGS_ERANGE’): A range exception occurs when a + function that does not return a MPFR number (such as comparisons + and conversions to an integer) has an invalid result (e.g., an + argument is NaN in ‘mpfr_cmp’, or a conversion to an integer cannot + be represented in the target type). + + Moreover, the group consisting of all the flags is represented by the +‘MPFR_FLAGS_ALL’ macro (if new flags are added in future MPFR versions, +they will be added to this macro too). Differences with the ISO C99 standard: @@ -662,7 +730,7 @@ a range error in MPFR.  -File: mpfr.info, Node: Memory Handling, Prev: Exceptions, Up: MPFR Basics +File: mpfr.info, Node: Memory Handling, Next: Getting the Best Efficiency Out of MPFR, Prev: Exceptions, Up: MPFR Basics 4.7 Memory Handling =================== @@ -670,12 +738,43 @@ MPFR functions may create caches, e.g., when computing constants such as Pi, either because the user has called a function like ‘mpfr_const_pi’ directly or because such a function was called internally by the MPFR -library itself to compute some other function. - - At any time, the user can free the various caches with -‘mpfr_free_cache’. It is strongly advised to do that before terminating -a thread, or before exiting when using tools like ‘valgrind’ (to avoid -memory leaks being reported). +library itself to compute some other function. When more precision is +needed, the value is automatically recomputed; a minimum of 10% increase +of the precision is guaranteed to avoid too many recomputations. + + MPFR functions may also create thread-local pools for internal use to +avoid the cost of memory allocation. The pools can be freed with +‘mpfr_free_pool’ (but with a default MPFR build, they should not take +much memory, as the allocation size is limited). + + At any time, the user can free various caches and pools with +‘mpfr_free_cache’ and ‘mpfr_free_cache2’. It is strongly advised to +free thread-local caches before terminating a thread, and all caches +before exiting when using tools like ‘valgrind’ (to avoid memory leaks +being reported). + + MPFR allocates its memory either on the stack (for temporary memory +only) or with the same allocator as the one configured for GMP: *note +(gmp.info)Custom Allocation::. This means that the application must +make sure that data allocated with the current allocator will not be +reallocated or freed with a new allocator. So, in practice, if an +application needs to change the allocator with +‘mp_set_memory_functions’, it should first free all data allocated with +the current allocator: for its own data, with ‘mpfr_clear’, etc.; for +the caches and pools, with ‘mpfr_mp_memory_cleanup’ in all threads where +MPFR is potentially used. This function is currently equivalent to +‘mpfr_free_cache’, but ‘mpfr_mp_memory_cleanup’ is the recommended way +in case the allocation method changes in the future (for instance, one +may choose to allocate the caches for floating-point constants with +‘malloc’ to avoid freeing them if the allocator changes). Developers +should also be aware that MPFR may also be used indirectly by libraries, +so that libraries based on MPFR should provide a clean-up function +calling ‘mpfr_mp_memory_cleanup’ and/or warn their users about this +issue. + + Note: For multithreaded applications, the allocator must be valid in +all threads where MPFR may be used; data allocated in one thread may be +reallocated and/or freed in some other thread. MPFR internal data such as flags, the exponent range, the default precision and rounding mode, and caches (i.e., data that are not @@ -686,6 +785,41 @@ variable initialization, the variables being declared with an implementation-defined TLS specifier). + Writers of libraries using MPFR should be aware that the application +and/or another library used by the application may also use MPFR, so +that changing the exponent range, the default precision, or the default +rounding mode may have an effect on this other use of MPFR since these +data are not duplicated (unless they are in a different thread). +Therefore any such value changed in a library function should be +restored before the function returns (unless the purpose of the function +is to do such a change). Writers of software using MPFR should also be +careful when changing such a value if they use a library using MPFR +(directly or indirectly), in order to make sure that such a change is +compatible with the library. + + +File: mpfr.info, Node: Getting the Best Efficiency Out of MPFR, Prev: Memory Handling, Up: MPFR Basics + +4.8 Getting the Best Efficiency Out of MPFR +=========================================== + +Here are a few hints to get the best efficiency out of MPFR: + + • you should avoid allocating and clearing variables. Reuse + variables whenever possible, allocate or clear outside of loops, + pass temporary variables to subroutines instead of allocating them + inside the subroutines; + + • use ‘mpfr_swap’ instead of ‘mpfr_set’ whenever possible. This will + avoid copying the significands; + + • avoid using MPFR from C++, or make sure your C++ interface does not + perform unnecessary allocations or copies; + + • MPFR functions work in-place: to compute ‘a = a + b’ you don’t need + an auxiliary variable, you can directly write ‘mpfr_add (a, a, b, + ...)’. +  File: mpfr.info, Node: MPFR Interface, Next: API Compatibility, Prev: MPFR Basics, Up: Top @@ -718,8 +852,11 @@ variable with large precision, then MPFR will still compute the result with full precision. - The value of the standard C macro ‘errno’ may be set to non-zero by -any MPFR function or macro, whether or not there is an error. + The value of the standard C macro ‘errno’ may be set to non-zero +after calling any MPFR function or macro, whether or not there is an +error. Except when documented, MPFR will not set ‘errno’, but functions +called by the MPFR code (libc functions, memory allocator, etc.) may do +so. * Menu: @@ -732,8 +869,8 @@ * Special Functions:: * Input and Output Functions:: * Formatted Output Functions:: -* Integer Related Functions:: -* Rounding Related Functions:: +* Integer and Remainder Related Functions:: +* Rounding-Related Functions:: * Miscellaneous Functions:: * Exception Related Functions:: * Compatibility with MPF:: @@ -912,6 +1049,8 @@ -- Function: int mpfr_set_d (mpfr_t ROP, double OP, mpfr_rnd_t RND) -- Function: int mpfr_set_ld (mpfr_t ROP, long double OP, mpfr_rnd_t RND) + -- Function: int mpfr_set_float128 (mpfr_t ROP, __float128 OP, + mpfr_rnd_t RND) -- Function: int mpfr_set_decimal64 (mpfr_t ROP, _Decimal64 OP, mpfr_rnd_t RND) -- Function: int mpfr_set_z (mpfr_t ROP, mpz_t OP, mpfr_rnd_t RND) @@ -919,18 +1058,27 @@ -- Function: int mpfr_set_f (mpfr_t ROP, mpf_t OP, mpfr_rnd_t RND) Set the value of ROP from OP, rounded toward the given direction RND. Note that the input 0 is converted to +0 by ‘mpfr_set_ui’, - ‘mpfr_set_si’, ‘mpfr_set_uj’, ‘mpfr_set_sj’, ‘mpfr_set_z’, + ‘mpfr_set_si’, ‘mpfr_set_uj’, ‘mpfr_set_sj’, The + ‘mpfr_set_float128’ function is built only with the configure + option ‘--enable-float128’, which requires the compiler or system + provides the ‘__float128’ data type (GCC 4.3 or later supports this + data type); to use ‘mpfr_set_float128’, one should define the macro + ‘MPFR_WANT_FLOAT128’ before including ‘mpfr.h’. ‘mpfr_set_z’, ‘mpfr_set_q’ and ‘mpfr_set_f’, regardless of the rounding mode. If the system does not support the IEEE 754 standard, ‘mpfr_set_flt’, ‘mpfr_set_d’, ‘mpfr_set_ld’ and ‘mpfr_set_decimal64’ might not preserve the signed zeros. The ‘mpfr_set_decimal64’ function is - built only with the configure option ‘--enable-decimal-float’, - which also requires ‘--with-gmp-build’, and when the compiler or - system provides the ‘_Decimal64’ data type (recent versions of GCC - support this data type); to use ‘mpfr_set_decimal64’, one should - define the macro ‘MPFR_WANT_DECIMAL_FLOATS’ before including - ‘mpfr.h’. ‘mpfr_set_q’ might fail if the numerator (or the - denominator) can not be represented as a ‘mpfr_t’. + built only with the configure option ‘--enable-decimal-float’, and + when the compiler or system provides the ‘_Decimal64’ data type + (recent versions of GCC support this data type); to use + ‘mpfr_set_decimal64’, one should define the macro + ‘MPFR_WANT_DECIMAL_FLOATS’ before including ‘mpfr.h’. ‘mpfr_set_q’ + might fail if the numerator (or the denominator) can not be + represented as a ‘mpfr_t’. + + For ‘mpfr_set’, the sign of a NaN is propagated in order to mimic + the IEEE 754 ‘copy’ operation. But contrary to IEEE 754, the NaN + flag is set as usual. Note: If you want to store a floating-point constant to a ‘mpfr_t’, you should use ‘mpfr_set_str’ (or one of the MPFR constant @@ -1091,6 +1239,7 @@ -- Function: float mpfr_get_flt (mpfr_t OP, mpfr_rnd_t RND) -- Function: double mpfr_get_d (mpfr_t OP, mpfr_rnd_t RND) -- Function: long double mpfr_get_ld (mpfr_t OP, mpfr_rnd_t RND) + -- Function: __float128 mpfr_get_float128 (mpfr_t OP, mpfr_rnd_t RND) -- Function: _Decimal64 mpfr_get_decimal64 (mpfr_t OP, mpfr_rnd_t RND) Convert OP to a ‘float’ (respectively ‘double’, ‘long double’ or ‘_Decimal64’), using the rounding mode RND. If OP is NaN, some @@ -1098,21 +1247,24 @@ returned. If OP is ±Inf, an infinity of the same sign or the result of ±1.0/0.0 is returned. If OP is zero, these functions return a zero, trying to preserve its sign, if possible. The - ‘mpfr_get_decimal64’ function is built only under some conditions: - see the documentation of ‘mpfr_set_decimal64’. + ‘mpfr_get_float128’ and ‘mpfr_get_decimal64’ functions are built + only under some conditions: see the documentation of + ‘mpfr_set_float128’ and ‘mpfr_set_decimal64’ respectively. -- Function: long mpfr_get_si (mpfr_t OP, mpfr_rnd_t RND) -- Function: unsigned long mpfr_get_ui (mpfr_t OP, mpfr_rnd_t RND) -- Function: intmax_t mpfr_get_sj (mpfr_t OP, mpfr_rnd_t RND) -- Function: uintmax_t mpfr_get_uj (mpfr_t OP, mpfr_rnd_t RND) Convert OP to a ‘long’, an ‘unsigned long’, an ‘intmax_t’ or an - ‘uintmax_t’ (respectively) after rounding it with respect to RND. - If OP is NaN, 0 is returned and the _erange_ flag is set. If OP is - too big for the return type, the function returns the maximum or - the minimum of the corresponding C type, depending on the direction - of the overflow; the _erange_ flag is set too. See also - ‘mpfr_fits_slong_p’, ‘mpfr_fits_ulong_p’, ‘mpfr_fits_intmax_p’ and - ‘mpfr_fits_uintmax_p’. + ‘uintmax_t’ (respectively) after rounding it to an integer with + respect to RND. If OP is NaN, 0 is returned and the _erange_ flag + is set. If OP is too big for the return type, the function returns + the maximum or the minimum of the corresponding C type, depending + on the direction of the overflow; the _erange_ flag is set too. + When there is no such range error, if the return value differs from + OP, i.e., if OP is not an integer, the inexact flag is set. See + also ‘mpfr_fits_slong_p’, ‘mpfr_fits_ulong_p’, ‘mpfr_fits_intmax_p’ + and ‘mpfr_fits_uintmax_p’. -- Function: double mpfr_get_d_2exp (long *EXP, mpfr_t OP, mpfr_rnd_t RND) @@ -1152,7 +1304,16 @@ -- Function: int mpfr_get_z (mpz_t ROP, mpfr_t OP, mpfr_rnd_t RND) Convert OP to a ‘mpz_t’, after rounding it with respect to RND. If OP is NaN or an infinity, the _erange_ flag is set, ROP is set to - 0, and 0 is returned. + 0, and 0 is returned. Otherwise the return value is zero when ROP + is equal to OP (i.e., when OP is an integer), positive when it is + greater than OP, and negative when it is smaller than OP; moreover, + if ROP differs from OP, i.e., if OP is not an integer, the inexact + flag is set. + + -- Function: void mpfr_get_q (mpq_t ROP, mpfr_t OP) + Convert OP to a ‘mpq_t’. If OP is NaN or an infinity, the _erange_ + flag is set and ROP is set to 0. Otherwise the conversion is + always exact. -- Function: int mpfr_get_f (mpf_t ROP, mpfr_t OP, mpfr_rnd_t RND) Convert OP to a ‘mpf_t’, after rounding it with respect to RND. @@ -1169,15 +1330,29 @@ -- Function: char * mpfr_get_str (char *STR, mpfr_exp_t *EXPPTR, int B, size_t N, mpfr_t OP, mpfr_rnd_t RND) - Convert OP to a string of digits in base B, with rounding in the - direction RND, where N is either zero (see below) or the number of - significant digits output in the string; in the latter case, N must - be greater or equal to 2. The base may vary from 2 to 62; - otherwise the function does nothing and immediately returns a null - pointer. If the input number is an ordinary number, the exponent - is written through the pointer EXPPTR (for input 0, the current - minimal exponent is written); the type ‘mpfr_exp_t’ is large enough - to hold the exponent in all cases. + Convert OP to a string of digits in base abs(B), with rounding in + the direction RND, where N is either zero (see below) or the number + of significant digits output in the string. The argument B may + vary from 2 to 62 or from −2 to −36; otherwise the function does + nothing and immediately returns a null pointer. + + For B in the range 2 to 36, digits and lower-case letters are used; + for −2 to −36, digits and upper-case letters are used; for 37 to + 62, digits, upper-case letters, and lower-case letters, in that + significance order, are used. Warning! This implies that for B > + 10, the successor of the digit 9 depends on B. This choice has + been done for compatibility with GMP’s ‘mpf_get_str’ function. + Users who wish a more consistent behavior should write a simple + wrapper. + + If the input is NaN, then the returned string is ‘@NaN@’ and the + NaN flag is set. If the input is +Inf (resp. −Inf), then the + returned string is ‘@Inf@’ (resp. ‘-@Inf@’). + + If the input number is a finite number, the exponent is written + through the pointer EXPPTR (for input 0, the current minimal + exponent is written); the type ‘mpfr_exp_t’ is large enough to hold + the exponent in all cases. The generated string is a fraction, with an implicit radix point immediately to the left of the first digit. For example, the @@ -1203,27 +1378,26 @@ 186564318007 for bases 7 and 49). If STR is a null pointer, space for the significand is allocated - using the current allocation function and a pointer to the string - is returned (unless the base is invalid). To free the returned - string, you must use ‘mpfr_free_str’. + using the allocation function (*note Memory Handling::) and a + pointer to the string is returned (unless the base is invalid). To + free the returned string, you must use ‘mpfr_free_str’. If STR is not a null pointer, it should point to a block of storage - large enough for the significand, i.e., at least ‘max(N + 2, 7)’. - The extra two bytes are for a possible minus sign, and for the - terminating null character, and the value 7 accounts for ‘-@Inf@’ - plus the terminating null character. The pointer to the string STR - is returned (unless the base is invalid). - - Note: The NaN and inexact flags are currently not set when need be; - this will be fixed in future versions. Programmers should - currently assume that whether the flags are set by this function is - unspecified. + large enough for the significand. A safe block size (sufficient + for any value) is ‘max(N + 2, 7)’ if N is not zero; if N is zero, + replace it by m+1, as discussed above. The extra two bytes are for + a possible minus sign, and for the terminating null character, and + the value 7 accounts for ‘-@Inf@’ plus the terminating null + character. The pointer to the string STR is returned (unless the + base is invalid). + + Like in usual functions, the inexact flag is set iff the result is + inexact. -- Function: void mpfr_free_str (char *STR) - Free a string allocated by ‘mpfr_get_str’ using the current - unallocation function. The block is assumed to be ‘strlen(STR)+1’ - bytes. For more information about how it is done: *note - (gmp.info)Custom Allocation::. + Free a string allocated by ‘mpfr_get_str’ using the unallocation + function (*note Memory Handling::). The block is assumed to be + ‘strlen(STR)+1’ bytes. -- Function: int mpfr_fits_ulong_p (mpfr_t OP, mpfr_rnd_t RND) -- Function: int mpfr_fits_slong_p (mpfr_t OP, mpfr_rnd_t RND) @@ -1236,7 +1410,15 @@ Return non-zero if OP would fit in the respective C data type, respectively ‘unsigned long’, ‘long’, ‘unsigned int’, ‘int’, ‘unsigned short’, ‘short’, ‘uintmax_t’, ‘intmax_t’, when rounded to - an integer in the direction RND. + an integer in the direction RND. For instance, with the + ‘MPFR_RNDU’ rounding mode on −0.5, the result will be non-zero for + all these functions. For ‘MPFR_RNDF’, those functions return + non-zero when it is guaranteed that the corresponding conversion + function (for example ‘mpfr_get_ui’ for ‘mpfr_fits_ulong_p’), when + called with faithful rounding, will always return a number that is + representable in the corresponding type. As a consequence, for + ‘MPFR_RNDF’, ‘mpfr_fits_ulong_p’ will return non-zero for a + non-negative number less or equal to ‘ULONG_MAX’.  File: mpfr.info, Node: Basic Arithmetic Functions, Next: Comparison Functions, Prev: Conversion Functions, Up: MPFR Interface @@ -1256,7 +1438,7 @@ mpfr_rnd_t RND) -- Function: int mpfr_add_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2, mpfr_rnd_t RND) - Set ROP to OP1 + OP2 rounded in the direction RND. The IEEE-754 + Set ROP to OP1 + OP2 rounded in the direction RND. The IEEE 754 rules are used, in particular for signed zeros. But for types having no signed zeros, 0 is considered unsigned (i.e., (+0) + 0 = (+0) and (−0) + 0 = (−0)). The ‘mpfr_add_d’ function assumes that @@ -1284,7 +1466,7 @@ mpfr_rnd_t RND) -- Function: int mpfr_sub_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2, mpfr_rnd_t RND) - Set ROP to OP1 - OP2 rounded in the direction RND. The IEEE-754 + Set ROP to OP1 - OP2 rounded in the direction RND. The IEEE 754 rules are used, in particular for signed zeros. But for types having no signed zeros, 0 is considered unsigned (i.e., (+0) − 0 = (+0), (−0) − 0 = (−0), 0 − (+0) = (−0) and 0 − (−0) = (+0)). The @@ -1331,10 +1513,12 @@ -- Function: int mpfr_div_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2, mpfr_rnd_t RND) Set ROP to OP1/OP2 rounded in the direction RND. When a result is - zero, its sign is the product of the signs of the operands (for - types having no signed zeros, 0 is considered positive). The same - restrictions than for ‘mpfr_add_d’ apply to ‘mpfr_d_div’ and - ‘mpfr_div_d’. + zero, its sign is the product of the signs of the operands. For + types having no signed zeros, 0 is considered positive; but note + that if OP1 is non-zero and OP2 is zero, the result might change + from ±Inf to NaN in future MPFR versions if there is an opposite + decision on the IEEE 754 side. The same restrictions than for + ‘mpfr_add_d’ apply to ‘mpfr_d_div’ and ‘mpfr_div_d’. -- Function: int mpfr_sqrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) -- Function: int mpfr_sqrt_ui (mpfr_t ROP, unsigned long int OP, @@ -1352,12 +1536,28 @@ +Inf. -- Function: int mpfr_cbrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) + -- Function: int mpfr_rootn_ui (mpfr_t ROP, mpfr_t OP, unsigned long + int K, mpfr_rnd_t RND) + Set ROP to the cubic root (resp. the Kth root) of OP rounded in the + direction RND. For K = 0, set ROP to NaN. For K odd (resp. even) + and OP negative (including −Inf), set ROP to a negative number + (resp. NaN). If OP is zero, set ROP to zero with the sign obtained + by the usual limit rules, i.e., the same sign as OP if K is odd, + and positive if K is even. + + These functions agree with the rootn function of the IEEE 754-2008 + standard (Section 9.2). + -- Function: int mpfr_root (mpfr_t ROP, mpfr_t OP, unsigned long int K, mpfr_rnd_t RND) - Set ROP to the cubic root (resp. the Kth root) of OP rounded in the - direction RND. For K odd (resp. even) and OP negative (including - −Inf), set ROP to a negative number (resp. NaN). The Kth root of - −0 is defined to be −0, whatever the parity of K. + This function is the same as ‘mpfr_rootn_ui’ except when OP is −0 + and K is even: the result is −0 instead of +0 (the reason was to be + consistent with ‘mpfr_sqrt’). Said otherwise, if OP is zero, set + ROP to OP. + + This function predates the IEEE 754-2008 standard and behaves + differently from its rootn function. It is marked as deprecated + and will be removed in a future release. -- Function: int mpfr_pow (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_rnd_t RND) @@ -1401,6 +1601,9 @@ odd integer. • ‘pow(+Inf, Y)’ returns plus zero for Y negative, and plus infinity for Y positive. + Note: When 0 is of integer type, it is regarded as +0 by these + functions. We do not use the usual limit rules in this case, as + these rules are not used for ‘pow’. -- Function: int mpfr_neg (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) -- Function: int mpfr_abs (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) @@ -1409,6 +1612,11 @@ OP are the same variable, otherwise a rounding might occur if the precision of ROP is less than that of OP. + The sign rule also applies to NaN in order to mimic the IEEE 754 + ‘negate’ and ‘abs’ operations, i.e., for ‘mpfr_neg’, the sign is + reversed, and for ‘mpfr_abs’, the sign is set to positive. But + contrary to IEEE 754, the NaN flag is set as usual. + -- Function: int mpfr_dim (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_rnd_t RND) Set ROP to the positive difference of OP1 and OP2, i.e., OP1 - OP2 @@ -1514,12 +1722,17 @@ return value, a positive value for a return value larger than the exact result, and a negative value otherwise. - Important note: in some domains, computing special functions (either -with correct or incorrect rounding) is expensive, even for small -precision, for example the trigonometric and Bessel functions for large -argument. + Important note: in some domains, computing special functions (even +more with correct rounding) is expensive, even for small precision, for +example the trigonometric and Bessel functions for large argument. For +some functions, the memory usage might depend not only on the output +precision: it is the case of the ‘mpfr_rootn_ui’ function where the +memory usage is also linear in the argument K, and of the incomplete +Gamma function (dependence on the precision of OP). -- Function: int mpfr_log (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) + -- Function: int mpfr_log_ui (mpfr_t ROP, unsigned long OP, mpfr_rnd_t + RND) -- Function: int mpfr_log2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) -- Function: int mpfr_log10 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) Set ROP to the natural logarithm of OP, log2(OP) or log10(OP), @@ -1528,12 +1741,20 @@ IEEE 754-2008 standards. Set ROP to −Inf if OP is ±0 (i.e., the sign of the zero has no influence on the result). + -- Function: int mpfr_log1p (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) + Set ROP to the logarithm of one plus OP, rounded in the direction + RND. Set ROP to −Inf if OP is −1. + -- Function: int mpfr_exp (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) -- Function: int mpfr_exp2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) -- Function: int mpfr_exp10 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) Set ROP to the exponential of OP, to 2 power of OP or to 10 power of OP, respectively, rounded in the direction RND. + -- Function: int mpfr_expm1 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) + Set ROP to the exponential of OP followed by a subtraction by one, + rounded in the direction RND. + -- Function: int mpfr_cos (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) -- Function: int mpfr_sin (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) -- Function: int mpfr_tan (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) @@ -1562,17 +1783,17 @@ Set ROP to the arc-cosine, arc-sine or arc-tangent of OP, rounded in the direction RND. Note that since ‘acos(-1)’ returns the floating-point number closest to Pi according to the given rounding - mode, this number might not be in the output range 0 <= ROP < \pi - of the arc-cosine function; still, the result lies in the image of - the output range by the rounding function. The same holds for + mode, this number might not be in the output range 0 <= ROP < Pi of + the arc-cosine function; still, the result lies in the image of the + output range by the rounding function. The same holds for ‘asin(-1)’, ‘asin(1)’, ‘atan(-Inf)’, ‘atan(+Inf)’ or for ‘atan(op)’ with large OP and small precision of ROP. -- Function: int mpfr_atan2 (mpfr_t ROP, mpfr_t Y, mpfr_t X, mpfr_rnd_t RND) Set ROP to the arc-tangent2 of Y and X, rounded in the direction - RND: if ‘x > 0’, ‘atan2(y, x) = atan (y/x)’; if ‘x < 0’, ‘atan2(y, - x) = sign(y)*(Pi - atan (abs(y/x)))’, thus a number from -Pi to Pi. + RND: if ‘x > 0’, ‘atan2(y, x) = atan(y/x)’; if ‘x < 0’, ‘atan2(y, + x) = sign(y)*(Pi - atan(abs(y/x)))’, thus a number from -Pi to Pi. As for ‘atan’, in case the exact mathematical result is +Pi or -Pi, its rounded result might be outside the function output range. @@ -1630,23 +1851,15 @@ mpfr_rnd_t RND) Set ROP to the factorial of OP, rounded in the direction RND. - -- Function: int mpfr_log1p (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) - Set ROP to the logarithm of one plus OP, rounded in the direction - RND. - - -- Function: int mpfr_expm1 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) - Set ROP to the exponential of OP followed by a subtraction by one, - rounded in the direction RND. - -- Function: int mpfr_eint (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) Set ROP to the exponential integral of OP, rounded in the direction - RND. For positive OP, the exponential integral is the sum of - Euler’s constant, of the logarithm of OP, and of the sum for k from - 1 to infinity of OP to the power k, divided by k and factorial(k). - For negative OP, ROP is set to NaN (this definition for negative - argument follows formula 5.1.2 from the Handbook of Mathematical - Functions from Abramowitz and Stegun, a future version might use - another definition). + RND. This is the sum of Euler’s constant, of the logarithm of the + absolute value of OP, and of the sum for k from 1 to infinity of OP + to the power k, divided by k and factorial(k). For positive OP, it + corresponds to the Ei function at OP (see formula 5.1.10 from the + Handbook of Mathematical Functions from Abramowitz and Stegun), and + for negative OP, to the opposite of the E1 function (sometimes + called eint1) at −OP (formula 5.1.1 from the same reference). -- Function: int mpfr_li2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) Set ROP to real part of the dilogarithm of OP, rounded in the @@ -1654,8 +1867,18 @@ integral of -log(1-t)/t from 0 to OP. -- Function: int mpfr_gamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) - Set ROP to the value of the Gamma function on OP, rounded in the - direction RND. When OP is a negative integer, ROP is set to NaN. + -- Function: int mpfr_gamma_inc (mpfr_t ROP, mpfr_t OP, mpfr_t OP2, + mpfr_rnd_t RND) + Set ROP to the value of the Gamma function on OP, resp. the + incomplete Gamma function on OP and OP2, rounded in the direction + RND. (In the literature, ‘mpfr_gamma_inc’ is called upper + incomplete Gamma function, or sometimes complementary incomplete + Gamma function.) For ‘mpfr_gamma’ (and ‘mpfr_gamma_inc’ when OP2 + is zero), when OP is a negative integer, ROP is set to NaN. + + Note: the current implementation of ‘mpfr_gamma_inc’ is slow for + large values of ROP or OP, in which case some internal overflow + might also occur. -- Function: int mpfr_lngamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) Set ROP to the value of the logarithm of the Gamma function on OP, @@ -1680,6 +1903,12 @@ function on OP, rounded in the direction RND. When OP is a negative integer, set ROP to NaN. + -- Function: int mpfr_beta (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, + mpfr_rnd_t RND) + Set ROP to the value of the Beta function at arguments OP1 and OP2. + Note: the current code does not try to avoid internal overflow or + underflow, and might use a huge internal precision in some cases. + -- Function: int mpfr_zeta (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) -- Function: int mpfr_zeta_ui (mpfr_t ROP, unsigned long OP, mpfr_rnd_t RND) @@ -1722,13 +1951,25 @@ multiplication followed by a separate addition or subtraction. That is, the fused operation matters only for rounding. + -- Function: int mpfr_fmma (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_t + OP3, mpfr_t OP4, mpfr_rnd_t RND) + -- Function: int mpfr_fmms (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_t + OP3, mpfr_t OP4, mpfr_rnd_t RND) + Set ROP to (OP1 times OP2) + (OP3 times OP4) (resp. (OP1 times OP2) + - (OP3 times OP4)) rounded in the direction RND. In case the + computation of OP1 times OP2 overflows or underflows (or that of + OP3 times OP4), the result ROP is computed as if the two + intermediate products were computed with rounding toward zero. + -- Function: int mpfr_agm (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_rnd_t RND) Set ROP to the arithmetic-geometric mean of OP1 and OP2, rounded in the direction RND. The arithmetic-geometric mean is the common limit of the sequences U_N and V_N, where U_0=OP1, V_0=OP2, U_(N+1) is the arithmetic mean of U_N and V_N, and V_(N+1) is the geometric - mean of U_N and V_N. If any operand is negative, set ROP to NaN. + mean of U_N and V_N. If any operand is negative and the other one + is not zero, set ROP to NaN. If any operand is zero and the other + one is finite (resp. infinite), set ROP to +0 (resp. NaN). -- Function: int mpfr_hypot (mpfr_t ROP, mpfr_t X, mpfr_t Y, mpfr_rnd_t RND) @@ -1755,25 +1996,58 @@ 0.577..., of Catalan’s constant 0.915..., respectively, rounded in the direction RND. These functions cache the computed values to avoid other calculations if a lower or equal precision is - requested. To free these caches, use ‘mpfr_free_cache’. + requested. To free these caches, use ‘mpfr_free_cache’ or + ‘mpfr_free_cache2’. -- Function: void mpfr_free_cache (void) - Free various caches used by MPFR internally, in particular the - caches used by the functions computing constants - (‘mpfr_const_log2’, ‘mpfr_const_pi’, ‘mpfr_const_euler’ and - ‘mpfr_const_catalan’). You should call this function before - terminating a thread, even if you did not call these functions - directly (they could have been called internally). + Free all caches and pools used by MPFR internally (those local to + the current thread and those shared by all threads). You should + call this function before terminating a thread, even if you did not + call ‘mpfr_const_*’ functions directly (they could have been called + internally). + + -- Function: void mpfr_free_cache2 (mpfr_free_cache_t WAY) + Free various caches and pools used by MPFR internally, as specified + by WAY, which is a set of flags: + • those local to the current thread if flag + ‘MPFR_FREE_LOCAL_CACHE’ is set; + • those shared by all threads if flag ‘MPFR_FREE_GLOBAL_CACHE’ + is set. + The other bits of WAY are currently ignored and are reserved for + future use; they should be zero. + + Note: + ‘mpfr_free_cache2(MPFR_FREE_LOCAL_CACHE|MPFR_FREE_GLOBAL_CACHE)’ is + currently equivalent to ‘mpfr_free_cache()’. + + -- Function: void mpfr_free_pool (void) + Free the pools used by MPFR internally. Note: This function is + automatically called after the thread-local caches are freed (with + ‘mpfr_free_cache’ or ‘mpfr_free_cache2’). + + -- Function: int mpfr_mp_memory_cleanup (void) + This function should be called before calling + ‘mp_set_memory_functions’. *Note Memory Handling::, for more + information. Zero is returned in case of success, non-zero in case + of error. Errors are currently not possible, but checking the + return value is recommended for future compatibility. - -- Function: int mpfr_sum (mpfr_t ROP, mpfr_ptr const TAB[], unsigned + -- Function: int mpfr_sum (mpfr_t ROP, const mpfr_ptr TAB[], unsigned long int N, mpfr_rnd_t RND) - Set ROP to the sum of all elements of TAB, whose size is N, rounded - in the direction RND. Warning: for efficiency reasons, TAB is an - array of pointers to ‘mpfr_t’, not an array of ‘mpfr_t’. If the - returned ‘int’ value is zero, ROP is guaranteed to be the exact - sum; otherwise ROP might be smaller than, equal to, or larger than - the exact sum (in accordance to the rounding mode). However, - ‘mpfr_sum’ does guarantee the result is correctly rounded. + Set ROP to the sum of all elements of TAB, whose size is N, + correctly rounded in the direction RND. Warning: for efficiency + reasons, TAB is an array of pointers to ‘mpfr_t’, not an array of + ‘mpfr_t’. If N = 0, then the result is +0, and if N = 1, then the + function is equivalent to ‘mpfr_set’. For the special exact cases, + the result is the same as the one obtained with a succession of + additions (‘mpfr_add’) in infinite precision. In particular, if + the result is an exact zero and N >= 1: + • if all the inputs have the same sign (i.e., all +0 or all −0), + then the result has the same sign as the inputs; + • otherwise, either because all inputs are zeros with at least a + +0 and a −0, or because some inputs are non-zero (but they + globally cancel), the result is +0, except for the ‘MPFR_RNDD’ + rounding mode, where it is −0.  File: mpfr.info, Node: Input and Output Functions, Next: Formatted Output Functions, Prev: Special Functions, Up: MPFR Interface @@ -1786,9 +2060,9 @@ null pointer for a ‘stream’ to any of these functions will make them read from ‘stdin’ and write to ‘stdout’, respectively. - When using any of these functions, you must include the ‘’ -standard header before ‘mpfr.h’, to allow ‘mpfr.h’ to define prototypes -for these functions. + When using a function that takes a ‘FILE *’ argument, you must +include the ‘’ standard header before ‘mpfr.h’, to allow +‘mpfr.h’ to define prototypes for these functions. -- Function: size_t mpfr_out_str (FILE *STREAM, int BASE, size_t N, mpfr_t OP, mpfr_rnd_t RND) @@ -1818,8 +2092,57 @@ Return the number of bytes read, or if an error occurred, return 0. + -- Function: int mpfr_fpif_export (FILE *STREAM, mpfr_t OP) + Export the number OP to the stream STREAM in a floating-point + interchange format. In particular one can export on a 32-bit + computer and import on a 64-bit computer, or export on a + little-endian computer and import on a big-endian computer. The + precision of OP and the sign bit of a NaN are stored too. Return 0 + iff the export was successful. + + Note: this function is experimental and its interface might change + in future versions. + + -- Function: int mpfr_fpif_import (mpfr_t OP, FILE *STREAM) + Import the number OP from the stream STREAM in a floating-point + interchange format (see ‘mpfr_fpif_export’). Note that the + precision of OP is set to the one read from the stream, and the + sign bit is always retrieved (even for NaN). If the stored + precision is zero or greater than ‘MPFR_PREC_MAX’, the function + fails (it returns non-zero) and OP is unchanged. If the function + fails for another reason, OP is set to NaN and it is unspecified + whether the precision of OP has changed to the one read from the + file. Return 0 iff the import was successful. + + Note: this function is experimental and its interface might change + in future versions. + + -- Function: void mpfr_dump (mpfr_t OP) + Output OP on ‘stdout’ in some unspecified format, then a newline + character. This function is mainly for debugging purpose. Thus + invalid data may be supported. Everything that is not specified + may change without breaking the ABI and may depend on the + environment. + + The current output format is the following: a minus sign if the + sign bit is set (even for NaN); ‘@NaN@’, ‘@Inf@’ or ‘0’ if the + argument is NaN, an infinity or zero, respectively; otherwise the + remaining of the output is as follows: ‘0.’ then the P bits of the + binary significand, where P is the precision of the number; if the + trailing bits are not all zeros (which must not occur with valid + data), they are output enclosed by square brackets; the character + ‘E’ followed by the exponent written in base 10; in case of invalid + data or out-of-range exponent, this function outputs three + exclamation marks (‘!!!’), followed by flags, followed by three + exclamation marks (‘!!!’) again. These flags are: ‘N’ if the most + significant bit of the significand is 0 (i.e., the number is not + normalized); ‘T’ if there are non-zero trailing bits; ‘U’ if this + is a UBF number (internal use only); ‘<’ if the exponent is less + than the current minimum exponent; ‘>’ if the exponent is greater + than the current maximum exponent. +  -File: mpfr.info, Node: Formatted Output Functions, Next: Integer Related Functions, Prev: Input and Output Functions, Up: MPFR Interface +File: mpfr.info, Node: Formatted Output Functions, Next: Integer and Remainder Related Functions, Prev: Input and Output Functions, Up: MPFR Interface 5.9 Formatted Output Functions ============================== @@ -1845,7 +2168,8 @@ ‘flags’, ‘width’, and ‘precision’ have the same meaning as for the standard ‘printf’ (in particular, notice that the ‘precision’ is related to the number of digits displayed in the base chosen by ‘conv’ and not -related to the internal precision of the ‘mpfr_t’ variable). +related to the internal precision of the ‘mpfr_t’ variable), but note +that for ‘Re’, the default precision is not the same as the one for ‘e’. ‘mpfr_printf’ accepts the same ‘type’ specifiers as GMP (except the non-standard and deprecated ‘q’, use ‘ll’ instead), namely the length modifiers defined in the C standard: @@ -1930,9 +2254,9 @@ ‘a’ ‘A’ hex float, C99 style ‘b’ binary output - ‘e’ ‘E’ scientific format float - ‘f’ ‘F’ fixed point float - ‘g’ ‘G’ fixed or scientific float + ‘e’ ‘E’ scientific-format float + ‘f’ ‘F’ fixed-point float + ‘g’ ‘G’ fixed-point or scientific float The conversion specifier ‘b’ which displays the argument in binary is specific to ‘mpfr_t’ arguments and should not be used with other types. @@ -1969,11 +2293,14 @@ 5.9.3 Functions --------------- -For all the following functions, if the number of characters which ought -to be written appears to exceed the maximum limit for an ‘int’, nothing +For all the following functions, if the number of characters that ought +to be written exceeds the maximum limit ‘INT_MAX’ for an ‘int’, nothing is written in the stream (resp. to ‘stdout’, to BUF, to STR), the -function returns −1, sets the _erange_ flag, and (in POSIX system only) -‘errno’ is set to ‘EOVERFLOW’. +function returns −1, sets the _erange_ flag, and ‘errno’ is set to +‘EOVERFLOW’ if the ‘EOVERFLOW’ macro is defined (such as on POSIX +systems). Note, however, that ‘errno’ might be changed to another value +by some internal library call if another error occurs there (currently, +this would come from the unallocation function). -- Function: int mpfr_fprintf (FILE *STREAM, const char *TEMPLATE, ...) -- Function: int mpfr_vfprintf (FILE *STREAM, const char *TEMPLATE, @@ -2007,7 +2334,7 @@ print it in BUF. If N is zero, nothing is written and BUF may be a null pointer, otherwise, the N−1 first characters are written in BUF and the N-th is a null character. Return the number of - characters that would have been written had N be sufficiently + characters that would have been written had N been sufficiently large, _not counting_ the terminating null character, or a negative value if an error occurred. @@ -2015,14 +2342,15 @@ -- Function: int mpfr_vasprintf (char **STR, const char *TEMPLATE, va_list AP) Write their output as a null terminated string in a block of memory - allocated using the current allocation function. A pointer to the - block is stored in STR. The block of memory must be freed using - ‘mpfr_free_str’. The return value is the number of characters - written in the string, excluding the null-terminator, or a negative - value if an error occurred. + allocated using the allocation function (*note Memory Handling::). + A pointer to the block is stored in STR. The block of memory must + be freed using ‘mpfr_free_str’. The return value is the number of + characters written in the string, excluding the null-terminator, or + a negative value if an error occurred, in which case the contents + of STR are undefined.  -File: mpfr.info, Node: Integer Related Functions, Next: Rounding Related Functions, Prev: Formatted Output Functions, Up: MPFR Interface +File: mpfr.info, Node: Integer and Remainder Related Functions, Next: Rounding-Related Functions, Prev: Formatted Output Functions, Up: MPFR Interface 5.10 Integer and Remainder Related Functions ============================================ @@ -2031,19 +2359,30 @@ -- Function: int mpfr_ceil (mpfr_t ROP, mpfr_t OP) -- Function: int mpfr_floor (mpfr_t ROP, mpfr_t OP) -- Function: int mpfr_round (mpfr_t ROP, mpfr_t OP) + -- Function: int mpfr_roundeven (mpfr_t ROP, mpfr_t OP) -- Function: int mpfr_trunc (mpfr_t ROP, mpfr_t OP) Set ROP to OP rounded to an integer. ‘mpfr_rint’ rounds to the - nearest representable integer in the given direction RND, - ‘mpfr_ceil’ rounds to the next higher or equal representable - integer, ‘mpfr_floor’ to the next lower or equal representable - integer, ‘mpfr_round’ to the nearest representable integer, - rounding halfway cases away from zero (as in the roundTiesToAway - mode of IEEE 754-2008), and ‘mpfr_trunc’ to the next representable - integer toward zero. - - The returned value is zero when the result is exact, positive when - it is greater than the original value of OP, and negative when it - is smaller. More precisely, the returned value is 0 when OP is an + nearest representable integer in the given direction RND, and the + other five functions behave in a similar way with some fixed + rounding mode: + • ‘mpfr_ceil’: to the next higher or equal representable integer + (like ‘mpfr_rint’ with ‘MPFR_RNDU’); + • ‘mpfr_floor’ to the next lower or equal representable integer + (like ‘mpfr_rint’ with ‘MPFR_RNDD’); + • ‘mpfr_round’ to the nearest representable integer, rounding + halfway cases away from zero (as in the roundTiesToAway mode + of IEEE 754-2008); + • ‘mpfr_roundeven’ to the nearest representable integer, + rounding halfway cases with the even-rounding rule (like + ‘mpfr_rint’ with ‘MPFR_RNDN’); + • ‘mpfr_trunc’ to the next representable integer toward zero + (like ‘mpfr_rint’ with ‘MPFR_RNDZ’). + When OP is a zero or an infinity, set ROP to the same value (with + the same sign). + + The return value is zero when the result is exact, positive when it + is greater than the original value of OP, and negative when it is + smaller. More precisely, the return value is 0 when OP is an integer representable in ROP, 1 or −1 when OP is an integer that is not representable in ROP, 2 or −2 when OP is not an integer. @@ -2052,36 +2391,38 @@ C99 rule for the ‘rint’ function. If you want the behavior to be more like IEEE 754 / ISO TS 18661-1, i.e., the usual behavior where the round-to-integer function is regarded as any other mathematical - function, you should use one the ‘mpfr_rint_*’ functions instead - (however it is not possible to round to nearest with the even - rounding rule yet). - - Note that ‘mpfr_round’ is different from ‘mpfr_rint’ called with - the rounding to nearest mode (where halfway cases are rounded to an - even integer or significand). Note also that no double rounding is - performed; for instance, 10.5 (1010.1 in binary) is rounded by - ‘mpfr_rint’ with rounding to nearest to 12 (1100 in binary) in - 2-bit precision, because the two enclosing numbers representable on - two bits are 8 and 12, and the closest is 12. (If one first - rounded to an integer, one would round 10.5 to 10 with even - rounding, and then 10 would be rounded to 8 again with even - rounding.) + function, you should use one the ‘mpfr_rint_*’ functions instead. + + Note that no double rounding is performed; for instance, 10.5 + (1010.1 in binary) is rounded by ‘mpfr_rint’ with rounding to + nearest to 12 (1100 in binary) in 2-bit precision, because the two + enclosing numbers representable on two bits are 8 and 12, and the + closest is 12. (If one first rounded to an integer, one would + round 10.5 to 10 with even rounding, and then 10 would be rounded + to 8 again with even rounding.) -- Function: int mpfr_rint_ceil (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) -- Function: int mpfr_rint_floor (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) -- Function: int mpfr_rint_round (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) + -- Function: int mpfr_rint_roundeven (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t + RND) -- Function: int mpfr_rint_trunc (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) - Set ROP to OP rounded to an integer. ‘mpfr_rint_ceil’ rounds to - the next higher or equal integer, ‘mpfr_rint_floor’ to the next - lower or equal integer, ‘mpfr_rint_round’ to the nearest integer, - rounding halfway cases away from zero, and ‘mpfr_rint_trunc’ to the - next integer toward zero. If the result is not representable, it - is rounded in the direction RND. The returned value is the ternary - value associated with the considered round-to-integer function - (regarded in the same way as any other mathematical function). + Set ROP to OP rounded to an integer: + • ‘mpfr_rint_ceil’: to the next higher or equal integer; + • ‘mpfr_rint_floor’: to the next lower or equal integer; + • ‘mpfr_rint_round’: to the nearest integer, rounding halfway + cases away from zero; + • ‘mpfr_rint_roundeven’: to the nearest integer, rounding + halfway cases to the nearest even integer; + • ‘mpfr_rint_trunc’ to the next integer toward zero. + If the result is not representable, it is rounded in the direction + RND. When OP is a zero or an infinity, set ROP to the same value + (with the same sign). The return value is the ternary value + associated with the considered round-to-integer function (regarded + in the same way as any other mathematical function). Contrary to ‘mpfr_rint’, those functions do perform a double rounding: first OP is rounded to the nearest integer in the @@ -2101,7 +2442,8 @@ Set ROP to the fractional part of OP, having the same sign as OP, rounded in the direction RND (unlike in ‘mpfr_rint’, RND affects only how the exact fractional part is rounded, not how the - fractional part is generated). + fractional part is generated). When OP is an integer or an + infinity, set ROP to zero with the same sign as OP. -- Function: int mpfr_modf (mpfr_t IOP, mpfr_t FOP, mpfr_t OP, mpfr_rnd_t RND) @@ -2115,15 +2457,17 @@ -- Function: int mpfr_fmod (mpfr_t R, mpfr_t X, mpfr_t Y, mpfr_rnd_t RND) + -- Function: int mpfr_fmodquo (mpfr_t R, long* Q, mpfr_t X, mpfr_t Y, + mpfr_rnd_t RND) -- Function: int mpfr_remainder (mpfr_t R, mpfr_t X, mpfr_t Y, mpfr_rnd_t RND) -- Function: int mpfr_remquo (mpfr_t R, long* Q, mpfr_t X, mpfr_t Y, mpfr_rnd_t RND) Set R to the value of X - NY, rounded according to the direction RND, where N is the integer quotient of X divided by Y, defined as - follows: N is rounded toward zero for ‘mpfr_fmod’, and to the - nearest integer (ties rounded to even) for ‘mpfr_remainder’ and - ‘mpfr_remquo’. + follows: N is rounded toward zero for ‘mpfr_fmod’ and + ‘mpfr_fmodquo’, and to the nearest integer (ties rounded to even) + for ‘mpfr_remainder’ and ‘mpfr_remquo’. Special values are handled as described in Section F.9.7.1 of the ISO C99 standard: If X is infinite or Y is zero, R is NaN. If Y is @@ -2131,12 +2475,12 @@ R is zero, it has the sign of X. The return value is the ternary value corresponding to R. - Additionally, ‘mpfr_remquo’ stores the low significant bits from - the quotient N in *Q (more precisely the number of bits in a ‘long’ - minus one), with the sign of X divided by Y (except if those low - bits are all zero, in which case zero is returned). Note that X - may be so large in magnitude relative to Y that an exact - representation of the quotient is not practical. The + Additionally, ‘mpfr_fmodquo’ and ‘mpfr_remquo’ store the low + significant bits from the quotient N in *Q (more precisely the + number of bits in a ‘long’ minus one), with the sign of X divided + by Y (except if those low bits are all zero, in which case zero is + returned). Note that X may be so large in magnitude relative to Y + that an exact representation of the quotient is not practical. The ‘mpfr_remainder’ and ‘mpfr_remquo’ functions are useful for additive argument reduction. @@ -2144,9 +2488,9 @@ Return non-zero iff OP is an integer.  -File: mpfr.info, Node: Rounding Related Functions, Next: Miscellaneous Functions, Prev: Integer Related Functions, Up: MPFR Interface +File: mpfr.info, Node: Rounding-Related Functions, Next: Miscellaneous Functions, Prev: Integer and Remainder Related Functions, Up: MPFR Interface -5.11 Rounding Related Functions +5.11 Rounding-Related Functions =============================== -- Function: void mpfr_set_default_rounding_mode (mpfr_rnd_t RND) @@ -2187,52 +2531,97 @@ Assuming B is an approximation of an unknown number X in the direction RND1 with error at most two to the power E(b)-ERR where E(b) is the exponent of B, return a non-zero value if one is able - to round correctly X to precision PREC with the direction RND2, and - 0 otherwise (including for NaN and Inf). This function *does not - modify* its arguments. - - If RND1 is ‘MPFR_RNDN’, then the sign of the error is unknown, but - its absolute value is the same, so that the possible range is twice - as large as with a directed rounding for RND1. - - Note: if one wants to also determine the correct *note ternary - value:: when rounding B to precision PREC with rounding mode RND, a - useful trick is the following: + to round correctly X to precision PREC with the direction RND2 + assuming an unbounded exponent range, and 0 otherwise (including + for NaN and Inf). In other words, if the error on B is bounded by + two to the power K ulps, and B has precision PREC, you should give + ERR=PREC−K. This function *does not modify* its arguments. + + If RND1 is ‘MPFR_RNDN’ or ‘MPFR_RNDF’, the error is considered to + be either positive or negative, thus the possible range is twice as + large as with a directed rounding for RND1 (with the same value of + ERR). + + When RND2 is ‘MPFR_RNDF’, let RND3 be the opposite direction if + RND1 is a directed rounding, and ‘MPFR_RNDN’ if RND1 is ‘MPFR_RNDN’ + or ‘MPFR_RNDF’. The returned value of ‘mpfr_can_round (b, err, + rnd1, MPFR_RNDF, prec)’ is non-zero iff after the call ‘mpfr_set + (y, b, rnd3)’ with Y of precision PREC, Y is guaranteed to be a + faithful rounding of X. + + Note: The *note ternary value:: cannot be determined in general + with this function. However, if it is known that the exact value + is not exactly representable in precision PREC, then one can use + the following trick to determine the (non-zero) ternary value in + any rounding mode RND2 (note that ‘MPFR_RNDZ’ below can be replaced + by any directed rounding mode): if (mpfr_can_round (b, err, MPFR_RNDN, MPFR_RNDZ, - prec + (rnd == MPFR_RNDN))) - ... - Indeed, if RND is ‘MPFR_RNDN’, this will check if one can round to + prec + (rnd2 == MPFR_RNDN))) + { + /* round the approximation 'b' to the result 'r' of 'prec' bits + with rounding mode 'rnd2' and get the ternary value 'inex' */ + inex = mpfr_set (r, b, rnd2); + } + Indeed, if RND2 is ‘MPFR_RNDN’, this will check if one can round to PREC+1 bits with a directed rounding: if so, one can surely round to nearest to PREC bits, and in addition one can determine the correct ternary value, which would not be the case when B is near from a value exactly representable on PREC bits. + A detailed example is available in the ‘examples’ subdirectory, + file ‘can_round.c’. + -- Function: mpfr_prec_t mpfr_min_prec (mpfr_t X) Return the minimal number of bits required to store the significand - of X, and 0 for special values, including 0. (Warning: the - returned value can be less than ‘MPFR_PREC_MIN’.) - - The function name is subject to change. + of X, and 0 for special values, including 0. -- Function: const char * mpfr_print_rnd_mode (mpfr_rnd_t RND) Return a string ("MPFR_RNDD", "MPFR_RNDU", "MPFR_RNDN", "MPFR_RNDZ", "MPFR_RNDA") corresponding to the rounding mode RND, or a null pointer if RND is an invalid rounding mode. + -- Macro: int mpfr_round_nearest_away (int (FOO)(mpfr_t, type1_t, ..., + mpfr_rnd_t), mpfr_t ROP, type1_t OP, ...) + Given a function FOO and one or more values OP (which may be a + ‘mpfr_t’, a ‘long’, a ‘double’, etc.), put in ROP the + round-to-nearest-away rounding of ‘FOO(OP,...)’. This rounding is + defined in the same way as round-to-nearest-even, except in case of + tie, where the value away from zero is returned. The function FOO + takes as input, from second to penultimate argument(s), the + argument list given after ROP, a rounding mode as final argument, + puts in its first argument the value ‘FOO(OP,...)’ rounded + according to this rounding mode, and returns the corresponding + ternary value (which is expected to be correct, otherwise + ‘mpfr_round_nearest_away’ will not work as desired). Due to + implementation constraints, this function must not be called when + the minimal exponent ‘emin’ is the smallest possible one. This + macro has been made such that the compiler is able to detect + mismatch between the argument list OP and the function prototype of + FOO. Multiple input arguments OP are supported only with C99 + compilers. Otherwise, for C89 compilers, only one such argument is + supported. + + Note: this macro is experimental and its interface might change in + future versions. + unsigned long ul; + mpfr_t f, r; + /* Code that inits and sets r, f, and ul, and if needed sets emin */ + int i = mpfr_round_nearest_away (mpfr_add_ui, r, f, ul); +  -File: mpfr.info, Node: Miscellaneous Functions, Next: Exception Related Functions, Prev: Rounding Related Functions, Up: MPFR Interface +File: mpfr.info, Node: Miscellaneous Functions, Next: Exception Related Functions, Prev: Rounding-Related Functions, Up: MPFR Interface 5.12 Miscellaneous Functions ============================ -- Function: void mpfr_nexttoward (mpfr_t X, mpfr_t Y) - If X or Y is NaN, set X to NaN. If X and Y are equal, X is - unchanged. Otherwise, if X is different from Y, replace X by the - next floating-point number (with the precision of X and the current - exponent range) in the direction of Y (the infinite values are seen - as the smallest and largest floating-point numbers). If the result - is zero, it keeps the same sign. No underflow or overflow is - generated. + If X or Y is NaN, set X to NaN; note that the NaN flag is set as + usual. If X and Y are equal, X is unchanged. Otherwise, if X is + different from Y, replace X by the next floating-point number (with + the precision of X and the current exponent range) in the direction + of Y (the infinite values are seen as the smallest and largest + floating-point numbers). If the result is zero, it keeps the same + sign. No underflow, overflow, or inexact exception is raised. -- Function: void mpfr_nextabove (mpfr_t X) -- Function: void mpfr_nextbelow (mpfr_t X) @@ -2278,45 +2667,63 @@ be created using the GMP ‘gmp_randinit’ function (see the GMP manual). - Note: the note for ‘mpfr_urandomb’ holds too. In addition, the - exponent range and the rounding mode might have a side effect on - the next random state. + Note: the note for ‘mpfr_urandomb’ holds too. Moreover, the exact + number (the random value to be rounded) and the next random state + do not depend on the current exponent range and the rounding mode. + However, they depend on the target precision: from the same state + of the random generator, if the precision of the destination is + changed, then the value may be completely different (and the state + of the random generator is different too). + -- Function: int mpfr_nrandom (mpfr_t ROP1, gmp_randstate_t STATE, + mpfr_rnd_t RND) -- Function: int mpfr_grandom (mpfr_t ROP1, mpfr_t ROP2, gmp_randstate_t STATE, mpfr_rnd_t RND) - Generate two random floats according to a standard normal gaussian - distribution. If ROP2 is a null pointer, then only one value is + Generate one (possibly two for ‘mpfr_grandom’) random + floating-point number according to a standard normal Gaussian + distribution (with mean zero and variance one). For + ‘mpfr_grandom’, if ROP2 is a null pointer, then only one value is generated and stored in ROP1. The floating-point number ROP1 (and ROP2) can be seen as if a random real number were generated according to the standard normal - gaussian distribution and then rounded in the direction RND. + Gaussian distribution and then rounded in the direction RND. - The third argument is a ‘gmp_randstate_t’ structure, which should - be created using the GMP ‘gmp_randinit’ function (see the GMP - manual). + The ‘gmp_randstate_t’ argument should be created using the GMP + ‘gmp_randinit’ function (see the GMP manual). - The combination of the ternary values is returned like with - ‘mpfr_sin_cos’. If ROP2 is a null pointer, the second ternary - value is assumed to be 0 (note that the encoding of the only - ternary value is not the same as the usual encoding for functions - that return only one result). Otherwise the ternary value of a - random number is always non-zero. + For ‘mpfr_grandom’, the combination of the ternary values is + returned like with ‘mpfr_sin_cos’. If ROP2 is a null pointer, the + second ternary value is assumed to be 0 (note that the encoding of + the only ternary value is not the same as the usual encoding for + functions that return only one result). Otherwise the ternary + value of a random number is always non-zero. Note: the note for ‘mpfr_urandomb’ holds too. In addition, the exponent range and the rounding mode might have a side effect on the next random state. + Note: ‘mpfr_nrandom’ is much more efficient than ‘mpfr_grandom’, + especially for large precision. Thus ‘mpfr_grandom’ is marked as + deprecated and will be removed in a future release. + + -- Function: int mpfr_erandom (mpfr_t ROP1, gmp_randstate_t STATE, + mpfr_rnd_t RND) + Generate one random floating-point number according to an + exponential distribution, with mean one. Other characteristics are + identical to ‘mpfr_nrandom’. + -- Function: mpfr_exp_t mpfr_get_exp (mpfr_t X) Return the exponent of X, assuming that X is a non-zero ordinary - number and the significand is considered in [1/2,1). The behavior - for NaN, infinity or zero is undefined. + number and the significand is considered in [1/2,1). For this + function, X is allowed to be outside of the current range of + acceptable values. The behavior for NaN, infinity or zero is + undefined. -- Function: int mpfr_set_exp (mpfr_t X, mpfr_exp_t E) - Set the exponent of X if E is in the current exponent range, and - return 0 (even if X is not a non-zero ordinary number); otherwise, - return a non-zero value. The significand is assumed to be in - [1/2,1). + Set the exponent of X to E if X is a non-zero ordinary number and E + is in the current exponent range, and return 0; otherwise, return a + non-zero value (X is not changed). -- Function: int mpfr_signbit (mpfr_t OP) Return a non-zero value iff OP has its sign bit set (i.e., if it is @@ -2381,6 +2788,11 @@ the ‘--enable-thread-safe’ configure option, see ‘INSTALL’ file), return zero otherwise. + -- Function: int mpfr_buildopt_float128_p (void) + Return a non-zero value if MPFR was compiled with ‘__float128’ + support (that is, MPFR was built with the ‘--enable-float128’ + configure option), return zero otherwise. + -- Function: int mpfr_buildopt_decimal_p (void) Return a non-zero value if MPFR was compiled with decimal float support (that is, MPFR was built with the ‘--enable-decimal-float’ @@ -2391,6 +2803,14 @@ (that is, MPFR was built with either ‘--with-gmp-build’ or ‘--enable-gmp-internals’ configure option), return zero otherwise. + -- Function: int mpfr_buildopt_sharedcache_p (void) + Return a non-zero value if MPFR was compiled so that all threads + share the same cache for one MPFR constant, like ‘mpfr_const_pi’ or + ‘mpfr_const_log2’ (that is, MPFR was built with the + ‘--enable-shared-cache’ configure option), return zero otherwise. + If the return value is non-zero, MPFR applications may need to be + compiled with the ‘-pthread’ option. + -- Function: const char * mpfr_buildopt_tune_case (void) Return a string saying which thresholds file has been used at compile time. This file is normally selected from the processor @@ -2416,12 +2836,25 @@ Set the smallest and largest exponents allowed for a floating-point variable. Return a non-zero value when EXP is not in the range accepted by the implementation (in that case the smallest or - largest exponent is not changed), and zero otherwise. If the user - changes the exponent range, it is her/his responsibility to check - that all current floating-point variables are in the new allowed - range (for example using ‘mpfr_check_range’), otherwise the - subsequent behavior will be undefined, in the sense of the ISO C - standard. + largest exponent is not changed), and zero otherwise. + + For the subsequent operations, it is the user’s responsibility to + check that any floating-point value used as an input is in the new + exponent range (for example using ‘mpfr_check_range’). If a + floating-point value outside the new exponent range is used as an + input, the default behavior is undefined, in the sense of the ISO C + standard; the behavior may also be explicitly documented, such as + for ‘mpfr_check_range’. + + Note: Caches may still have values outside the current exponent + range. This is not an issue as the user cannot use these caches + directly via the API (MPFR extends the exponent range internally + when need be). + + If ‘emin’ > ‘emax’ and a floating-point value needs to be produced + as output, the behavior is undefined (‘mpfr_set_emin’ and + ‘mpfr_set_emax’ do not check this condition as it might occur + between successive calls to these two functions). -- Function: mpfr_exp_t mpfr_get_emin_min (void) -- Function: mpfr_exp_t mpfr_get_emin_max (void) @@ -2434,7 +2867,7 @@ ‘mpfr_set_emin(mpfr_get_emin_min())’ may not be portable. -- Function: int mpfr_check_range (mpfr_t X, int T, mpfr_rnd_t RND) - This function assumes that X is the correctly-rounded value of some + This function assumes that X is the correctly rounded value of some real value Y in the direction RND and some extended exponent range, and that T is the corresponding *note ternary value::. For example, one performed ‘t = mpfr_log (x, u, rnd)’, and Y is the @@ -2458,9 +2891,10 @@ -- Function: int mpfr_subnormalize (mpfr_t X, int T, mpfr_rnd_t RND) This function rounds X emulating subnormal number arithmetic: if X - is outside the subnormal exponent range, it just propagates the - *note ternary value:: T; otherwise, it rounds X to precision - ‘EXP(x)-emin+1’ according to rounding mode RND and previous ternary + is outside the subnormal exponent range of the emulated + floating-point system, this function just propagates the *note + ternary value:: T; otherwise, it rounds X to precision + ‘EXP(X)-emin+1’ according to rounding mode RND and previous ternary value T, avoiding double rounding problems. More precisely in the subnormal domain, denoting by E the value of ‘emin’, X is rounded in fixed-point arithmetic to an integer multiple of two to the @@ -2468,11 +2902,11 @@ when T is zero is rounded to two to the power E with rounding to nearest. - ‘PREC(x)’ is not modified by this function. RND and T must be the + ‘PREC(X)’ is not modified by this function. RND and T must be the rounding mode and the returned ternary value used when computing X (as in ‘mpfr_check_range’). The subnormal exponent range is from - ‘emin’ to ‘emin+PREC(x)-1’. If the result cannot be represented in - the current exponent range (due to a too small ‘emax’), the + ‘emin’ to ‘emin+PREC(X)-1’. If the result cannot be represented in + the current exponent range of MPFR (due to a too small ‘emax’), the behavior is undefined. Note that unlike most functions, the result is compared to the exact one, not the input value X, i.e., the ternary value is propagated. @@ -2481,6 +2915,11 @@ flag is set. Moreover, if a second rounding occurred (because the input X was in the subnormal range), the underflow flag is set. + Warning! If you change ‘emin’ (with ‘mpfr_set_emin’) just before + calling ‘mpfr_subnormalize’, you need to make sure that the value + is in the current exponent range of MPFR. But it is better to + change ‘emin’ before any computation, if possible. + This is an example of how to emulate binary double IEEE 754 arithmetic (binary64 in IEEE 754-2008) using MPFR: @@ -2502,9 +2941,31 @@ mpfr_clear (xa); mpfr_clear (xb); } - Warning: this emulates a double IEEE 754 arithmetic with correct -rounding in the subnormal range, which may not be the case for your -hardware. + Note that ‘mpfr_set_emin’ and ‘mpfr_set_emax’ are called early enough +in order to make sure that all computed values are in the current +exponent range. Warning! This emulates a double IEEE 754 arithmetic +with correct rounding in the subnormal range, which may not be the case +for your hardware. + + Below is another example showing how to emulate fixed-point +arithmetic in a specific case. Here we compute the sine of the integers +1 to 17 with a result in a fixed-point arithmetic rounded at 2 power -42 +(using the fact that the result is at most 1 in absolute value): + + { + mpfr_t x; int i, inex; + + mpfr_set_emin (-41); + mpfr_init2 (x, 42); + for (i = 1; i <= 17; i++) + { + mpfr_set_ui (x, i, MPFR_RNDN); + inex = mpfr_sin (x, x, MPFR_RNDZ); + mpfr_subnormalize (x, inex, MPFR_RNDZ); + mpfr_dump (x); + } + mpfr_clear (x); + } -- Function: void mpfr_clear_underflow (void) -- Function: void mpfr_clear_overflow (void) @@ -2512,8 +2973,13 @@ -- Function: void mpfr_clear_nanflag (void) -- Function: void mpfr_clear_inexflag (void) -- Function: void mpfr_clear_erangeflag (void) - Clear the underflow, overflow, divide-by-zero, invalid, inexact and - _erange_ flags. + Clear (lower) the underflow, overflow, divide-by-zero, invalid, + inexact and _erange_ flags. + + -- Function: void mpfr_clear_flags (void) + Clear (lower) all global flags (underflow, overflow, + divide-by-zero, invalid, inexact, _erange_). Note: a group of + flags can be cleared by using ‘mpfr_flags_clear’. -- Function: void mpfr_set_underflow (void) -- Function: void mpfr_set_overflow (void) @@ -2521,12 +2987,8 @@ -- Function: void mpfr_set_nanflag (void) -- Function: void mpfr_set_inexflag (void) -- Function: void mpfr_set_erangeflag (void) - Set the underflow, overflow, divide-by-zero, invalid, inexact and - _erange_ flags. - - -- Function: void mpfr_clear_flags (void) - Clear all global flags (underflow, overflow, divide-by-zero, - invalid, inexact, _erange_). + Set (raise) the underflow, overflow, divide-by-zero, invalid, + inexact and _erange_ flags. -- Function: int mpfr_underflow_p (void) -- Function: int mpfr_overflow_p (void) @@ -2538,6 +3000,41 @@ invalid, inexact, _erange_) flag, which is non-zero iff the flag is set. + The ‘mpfr_flags_’ functions below that take an argument MASK can +operate on any subset of the exception flags: a flag is part of this +subset (or group) if and only if the corresponding bit of the argument +MASK is set. The ‘MPFR_FLAGS_’ macros will normally be used to build +this argument. *Note Exceptions::. + + -- Function: void mpfr_flags_clear (mpfr_flags_t MASK) + Clear (lower) the group of flags specified by MASK. + + -- Function: void mpfr_flags_set (mpfr_flags_t MASK) + Set (raise) the group of flags specified by MASK. + + -- Function: mpfr_flags_t mpfr_flags_test (mpfr_flags_t MASK) + Return the flags specified by MASK. To test whether any flag from + MASK is set, compare the return value to 0. You can also test + individual flags by AND’ing the result with ‘MPFR_FLAGS_’ macros. + Example: + mpfr_flags_t t = mpfr_flags_test (MPFR_FLAGS_UNDERFLOW| + MPFR_FLAGS_OVERFLOW) + ... + if (t) /* underflow and/or overflow (unlikely) */ + { + if (t & MPFR_FLAGS_UNDERFLOW) { /* handle underflow */ } + if (t & MPFR_FLAGS_OVERFLOW) { /* handle overflow */ } + } + + -- Function: mpfr_flags_t mpfr_flags_save (void) + Return all the flags. It is equivalent to + ‘mpfr_flags_test(MPFR_FLAGS_ALL)’. + + -- Function: void mpfr_flags_restore (mpfr_flags_t FLAGS, mpfr_flags_t + MASK) + Restore the flags specified by MASK to their state represented in + FLAGS. +  File: mpfr.info, Node: Compatibility with MPF, Next: Custom Interface, Prev: Exception Related Functions, Up: MPFR Interface @@ -2549,16 +3046,19 @@ lines after the ‘#include ’ line, #include #include -any program written for MPF can be compiled directly with MPFR without -any changes (except the ‘gmp_printf’ functions will not work for -arguments of type ‘mpfr_t’). All operations are then performed with the -default MPFR rounding mode, which can be reset with +many programs written for MPF can be compiled directly against MPFR +without any changes. All operations are then performed with the default +MPFR rounding mode, which can be reset with ‘mpfr_set_default_rounding_mode’. - Warning: the ‘mpf_init’ and ‘mpf_init2’ functions initialize to zero, -whereas the corresponding MPFR functions initialize to NaN: this is -useful to detect uninitialized values, but is slightly incompatible with -MPF. + Warning! There are some differences. In particular: + • The precision is different: MPFR rounds to the exact number of bits + (zeroing trailing bits in the internal representation). Users may + need to increase the precision of their variables. + • The exponent range is also different. + • The formatted output functions (‘gmp_printf’, etc.) will not work + for arguments of arbitrary-precision floating-point type (‘mpf_t’, + which ‘mpf2mpfr.h’ redefines as ‘mpfr_t’). -- Function: void mpfr_set_prec_raw (mpfr_t X, mpfr_prec_t PREC) Reset the precision of X to be *exactly* PREC bits. The only @@ -2644,19 +3144,20 @@ -- Function: void mpfr_custom_init_set (mpfr_t X, int KIND, mpfr_exp_t EXP, mpfr_prec_t PREC, void *SIGNIFICAND) Perform a dummy initialization of a ‘mpfr_t’ and set it to: - • if ‘ABS(kind) == MPFR_NAN_KIND’, X is set to NaN; - • if ‘ABS(kind) == MPFR_INF_KIND’, X is set to the infinity of - sign ‘sign(kind)’; - • if ‘ABS(kind) == MPFR_ZERO_KIND’, X is set to the zero of sign - ‘sign(kind)’; - • if ‘ABS(kind) == MPFR_REGULAR_KIND’, X is set to a regular - number: ‘x = sign(kind)*significand*2^exp’. - In all cases, it uses SIGNIFICAND directly for further computing - involving X. It will not allocate anything. A floating-point - number initialized with this function cannot be resized using - ‘mpfr_set_prec’ or ‘mpfr_prec_round’, or cleared using - ‘mpfr_clear’! The SIGNIFICAND must have been initialized with - ‘mpfr_custom_init’ using the same precision PREC. + • if abs(KIND) = ‘MPFR_NAN_KIND’, X is set to NaN; + • if abs(KIND) = ‘MPFR_INF_KIND’, X is set to the infinity of + the same sign as KIND; + • if abs(KIND) = ‘MPFR_ZERO_KIND’, X is set to the zero of the + same sign as KIND; + • if abs(KIND) = ‘MPFR_REGULAR_KIND’, X is set to the regular + number whose sign is the one of KIND, and whose exponent and + significand are given by EXP and SIGNIFICAND. + In all cases, SIGNIFICAND will be used directly for further + computing involving X. This function does not allocate anything. + A floating-point number initialized with this function cannot be + resized using ‘mpfr_set_prec’ or ‘mpfr_prec_round’, or cleared + using ‘mpfr_clear’! The SIGNIFICAND must have been initialized + with ‘mpfr_custom_init’ using the same precision PREC. -- Function: int mpfr_custom_get_kind (mpfr_t X) Return the current kind of a ‘mpfr_t’ as created by @@ -2670,10 +3171,12 @@ -- Function: mpfr_exp_t mpfr_custom_get_exp (mpfr_t X) Return the exponent of X, assuming that X is a non-zero ordinary - number. The return value for NaN, Infinity or zero is unspecified - but does not produce any trap. The behavior of this function for - any ‘mpfr_t’ not initialized with ‘mpfr_custom_init_set’ is - undefined. + number and the significand is considered in [1/2,1). But if X is + NaN, infinity or zero, contrary to ‘mpfr_get_exp’ (where the + behavior is undefined), the return value is here an unspecified, + valid value of the ‘mpfr_exp_t’ type. The behavior of this + function for any ‘mpfr_t’ not initialized with + ‘mpfr_custom_init_set’ is undefined. -- Function: void mpfr_custom_move (mpfr_t X, void *NEW_POSITION) Inform MPFR that the significand of X has moved due to a garbage @@ -2717,7 +3220,7 @@ excess bits at the low end of the data are zeros.  -File: mpfr.info, Node: API Compatibility, Next: Contributors, Prev: MPFR Interface, Up: Top +File: mpfr.info, Node: API Compatibility, Next: MPFR and the IEEE 754 Standard, Prev: MPFR Interface, Up: Top 6 API Compatibility ******************* @@ -2816,7 +3319,14 @@ #define GMP_RNDU MPFR_RNDU #define GMP_RNDD MPFR_RNDD The rounding mode “round away from zero†(‘MPFR_RNDA’) was added in -MPFR 3.0 (however no rounding mode ‘GMP_RNDA’ exists). +MPFR 3.0 (however no rounding mode ‘GMP_RNDA’ exists). Faithful +rounding (‘MPFR_RNDF’) was added in MPFR 4.0, but currently, it is +partially supported. + + The flags-related macros, whose name starts with ‘MPFR_FLAGS_’, were +added in MPFR 4.0 (for the new functions ‘mpfr_flags_clear’, +‘mpfr_flags_restore’, ‘mpfr_flags_set’ and ‘mpfr_flags_test’, in +particular).  File: mpfr.info, Node: Added Functions, Next: Changed Functions, Prev: Type and Macro Changes, Up: API Compatibility @@ -2824,8 +3334,8 @@ 6.2 Added Functions =================== -We give here in alphabetical order the functions that were added after -MPFR 2.2, and in which MPFR version. +We give here in alphabetical order the functions (and function-like +macros) that were added after MPFR 2.2, and in which MPFR version. • ‘mpfr_add_d’ in MPFR 2.4. @@ -2833,10 +3343,19 @@ • ‘mpfr_asprintf’ in MPFR 2.4. - • ‘mpfr_buildopt_decimal_p’ and ‘mpfr_buildopt_tls_p’ in MPFR 3.0. + • ‘mpfr_beta’ in MPFR 4.0 (incomplete, experimental). + + • ‘mpfr_buildopt_decimal_p’ in MPFR 3.0. + + • ‘mpfr_buildopt_float128_p’ in MPFR 4.0. - • ‘mpfr_buildopt_gmpinternals_p’ and ‘mpfr_buildopt_tune_case’ in - MPFR 3.1. + • ‘mpfr_buildopt_gmpinternals_p’ in MPFR 3.1. + + • ‘mpfr_buildopt_sharedcache_p’ in MPFR 4.0. + + • ‘mpfr_buildopt_tls_p’ in MPFR 3.0. + + • ‘mpfr_buildopt_tune_case’ in MPFR 3.1. • ‘mpfr_clear_divby0’ in MPFR 3.1 (new divide-by-zero exception). @@ -2861,18 +3380,40 @@ • ‘mpfr_div_d’ in MPFR 2.4. + • ‘mpfr_erandom’ in MPFR 4.0. + + • ‘mpfr_flags_clear’, ‘mpfr_flags_restore’, ‘mpfr_flags_save’, + ‘mpfr_flags_set’ and ‘mpfr_flags_test’ in MPFR 4.0. + + • ‘mpfr_fmma’ and ‘mpfr_fmms’ in MPFR 4.0. + • ‘mpfr_fmod’ in MPFR 2.4. + • ‘mpfr_fmodquo’ in MPFR 4.0. + • ‘mpfr_fms’ in MPFR 2.3. + • ‘mpfr_fpif_export’ and ‘mpfr_fpif_import’ in MPFR 4.0. + • ‘mpfr_fprintf’ in MPFR 2.4. + • ‘mpfr_free_cache2’ in MPFR 4.0. + + • ‘mpfr_free_pool’ in MPFR 4.0. + • ‘mpfr_frexp’ in MPFR 3.1. + • ‘mpfr_gamma_inc’ in MPFR 4.0. + + • ‘mpfr_get_float128’ in MPFR 4.0 if configured with + ‘--enable-float128’. + • ‘mpfr_get_flt’ in MPFR 3.0. • ‘mpfr_get_patches’ in MPFR 2.3. + • ‘mpfr_get_q’ in MPFR 4.0. + • ‘mpfr_get_z_2exp’ in MPFR 3.0. This function was named ‘mpfr_get_z_exp’ in previous versions; ‘mpfr_get_z_exp’ is still available via a macro in ‘mpfr.h’: @@ -2888,12 +3429,18 @@ • ‘mpfr_li2’ in MPFR 2.4. + • ‘mpfr_log_ui’ in MPFR 4.0. + • ‘mpfr_min_prec’ in MPFR 3.0. • ‘mpfr_modf’ in MPFR 2.4. + • ‘mpfr_mp_memory_cleanup’ in MPFR 4.0. + • ‘mpfr_mul_d’ in MPFR 2.4. + • ‘mpfr_nrandom’ in MPFR 4.0. + • ‘mpfr_printf’ in MPFR 2.4. • ‘mpfr_rec_sqrt’ in MPFR 2.4. @@ -2902,8 +3449,17 @@ • ‘mpfr_remainder’ and ‘mpfr_remquo’ in MPFR 2.3. + • ‘mpfr_rint_roundeven’ and ‘mpfr_roundeven’ in MPFR 4.0. + + • ‘mpfr_round_nearest_away’ in MPFR 4.0. + + • ‘mpfr_rootn_ui’ in MPFR 4.0. + • ‘mpfr_set_divby0’ in MPFR 3.1 (new divide-by-zero exception). + • ‘mpfr_set_float128’ in MPFR 4.0 if configured with + ‘--enable-float128’. + • ‘mpfr_set_flt’ in MPFR 3.0. • ‘mpfr_set_z_2exp’ in MPFR 3.0. @@ -2939,6 +3495,11 @@ the behavior of code written for some MPFR version when built and run against another MPFR version (older or newer), as described below. + • ‘mpfr_abs’, ‘mpfr_neg’ and ‘mpfr_set’ changed in MPFR 4.0. In + previous MPFR versions, the sign bit of a NaN was unspecified; + however, in practice, it was set as now specified except for + ‘mpfr_neg’ with a reused argument: ‘mpfr_neg(x,x,rnd)’. + • ‘mpfr_check_range’ changed in MPFR 2.3.2 and MPFR 2.4. If the value is an inexact infinity, the overflow flag is now set (in case it was lost), while it was previously left unchanged. This is @@ -2946,6 +3507,10 @@ expecting), so that the previous behavior was regarded as a bug. Hence the change in MPFR 2.3.2. + • ‘mpfr_eint’ changed in MPFR 4.0. This function now returns the + value of the E1/eint1 function for negative argument (before MPFR + 4.0, it was returning NaN). + • ‘mpfr_get_f’ changed in MPFR 3.0. This function was returning zero, except for NaN and Inf, which do not exist in MPF. The _erange_ flag is now set in these cases, and ‘mpfr_get_f’ now @@ -2955,6 +3520,11 @@ changed in MPFR 3.0. In previous MPFR versions, the cases where the _erange_ flag is set were unspecified. + • ‘mpfr_get_str’ changed in MPFR 4.0. This function now sets the NaN + flag on NaN input (to follow the usual MPFR rules on NaN and IEEE + 754-2008 recommendations on string conversions from Subclause + 5.12.1) and sets the inexact flag when the conversion is inexact. + • ‘mpfr_get_z’ changed in MPFR 3.0. The return type was ‘void’; it is now ‘int’, and the usual ternary value is returned. Thus programs that need to work with both MPFR 2.x and 3.x must not use @@ -2980,6 +3550,16 @@ this function has been renamed to ‘mpfr_get_z_2exp’ in MPFR 3.0, but ‘mpfr_get_z_exp’ is still available for compatibility reasons. + • ‘mpfr_set_exp’ changed in MPFR 4.0. Before MPFR 4.0, the exponent + was set whatever the contents of the MPFR object in argument. In + practice, this could be useful as a low-level function when the + MPFR number was being constructed by setting the fields of its + internal structure, but the API does not provide a way to do this + except by using internals. Thus, for the API, this behavior was + useless and could quickly lead to undefined behavior due to the + fact that the generated value could have an invalid format if the + MPFR object contained a special value (NaN, infinity or zero). + • ‘mpfr_strtofr’ changed in MPFR 2.3.1 and MPFR 2.4. This was actually a bug fix since the code and the documentation did not match. But both were changed in order to have a more consistent @@ -3002,6 +3582,13 @@ behavior was specified). The case of the underflow flag was more a lack of specification. + • ‘mpfr_sum’ changed in MPFR 4.0. The ‘mpfr_sum’ function has + completely been rewritten for MPFR 4.0, with an update of the + specification: the sign of an exact zero result is now specified, + and the return value is now the usual ternary value. The old + ‘mpfr_sum’ implementation could also take all the memory and crash + on inputs of very different magnitude. + • ‘mpfr_urandom’ and ‘mpfr_urandomb’ changed in MPFR 3.1. Their behavior no longer depends on the platform (assuming this is also true for GMP’s random generator, which is not the case between GMP @@ -3011,6 +3598,13 @@ not specified before MPFR 3.1, the MPFR 3.1 behavior is _not_ regarded as backward incompatible with previous versions. + • ‘mpfr_urandom’ changed in MPFR 4.0. The next random state no + longer depends on the current exponent range and the rounding mode. + The exceptions due to the rounding of the random number are now + correctly generated, following the uniform distribution. As a + consequence, the returned values can be different between MPFR 4.0 + and previous MPFR versions. +  File: mpfr.info, Node: Removed Functions, Next: Other Changes, Prev: Changed Functions, Up: API Compatibility @@ -3022,6 +3616,13 @@ function ‘mpfr_random’ had been deprecated since at least MPFR 2.2.0, and ‘mpfr_random2’ since MPFR 2.4.0.) + Macros ‘mpfr_add_one_ulp’ and ‘mpfr_sub_one_ulp’ have been removed in +MPFR 4.0. They were no longer documented since MPFR 2.1.0 and were +announced as deprecated since MPFR 3.1.0. + + Function ‘mpfr_grandom’ is marked as deprecated in MPFR 4.0. It will +be removed in a future release. +  File: mpfr.info, Node: Other Changes, Prev: Removed Functions, Up: API Compatibility @@ -3055,8 +3656,61 @@ while still supporting optional functions (*note Headers and Libraries::). + The way memory is allocated by MPFR should be regarded as +well-specified only as of MPFR 4.0. + + +File: mpfr.info, Node: MPFR and the IEEE 754 Standard, Next: Contributors, Prev: API Compatibility, Up: Top + +7 MPFR and the IEEE 754 Standard +******************************** + +This section describes differences between MPFR and the IEEE 754 +standard, and behaviors that are not specified yet in IEEE 754. + + The MPFR numbers do not include subnormals. The reason is that +subnormals are less useful than in IEEE 754 as the default exponent +range in MPFR is large and they would have made the implementation more +complex. However, subnormals can be emulated using ‘mpfr_subnormalize’. + + MPFR has a single NaN. The behavior is similar either to a signaling +NaN or to a quiet NaN, depending on the context. For any function +returning a NaN (either produced or propagated), the NaN flag is set, +while in IEEE 754, some operations are quiet (even on a signaling NaN). + + The ‘mpfr_rec_sqrt’ function differs from IEEE 754 on −0, where it +gives +Inf (like for +0), following the usual limit rules, instead of +−Inf. + + The ‘mpfr_root’ function predates IEEE 754-2008 and behaves +differently from its rootn operation. It is deprecated and +‘mpfr_rootn_ui’ should be used instead. + + Operations with an unsigned zero: For functions taking an argument of +integer or rational type, a zero of such a type is unsigned unlike the +floating-point zero (this includes the zero of type ‘unsigned long’, +which is a mathematical, exact zero, as opposed to a floating-point +zero, which may come from an underflow and whose sign would correspond +to the sign of the real non-zero value). Unless documented otherwise, +this zero is regarded as +0, as if it were first converted to a MPFR +number with ‘mpfr_set_ui’ or ‘mpfr_set_si’ (thus the result may not +agree with the usual limit rules applied to a mathematical zero). This +is not the case of addition and subtraction (‘mpfr_add_ui’, etc.), but +for these functions, only the sign of a zero result would be affected, +with +0 and −0 considered equal. Such operations are currently out of +the scope of the IEEE 754 standard, and at the time of specification in +MPFR, the Floating-Point Working Group in charge of the revision of IEEE +754 did not want to discuss issues with non-floating-point types in +general. + + Note also that some obvious differences may come from the fact that +in MPFR, each variable has its own precision. For instance, a +subtraction of two numbers of the same sign may yield an overflow; idem +for a call to ‘mpfr_set’, ‘mpfr_neg’ or ‘mpfr_abs’, if the destination +variable has a smaller precision. +  -File: mpfr.info, Node: Contributors, Next: References, Prev: API Compatibility, Up: Top +File: mpfr.info, Node: Contributors, Next: References, Prev: MPFR and the IEEE 754 Standard, Up: Top Contributors ************ @@ -3071,15 +3725,16 @@ Delplanque contributed the new version of the ‘mpfr_get_str’ function. Mathieu Dutour contributed the functions ‘mpfr_acos’, ‘mpfr_asin’ and ‘mpfr_atan’, and a previous version of ‘mpfr_gamma’. Laurent Fousse -contributed the ‘mpfr_sum’ function. Emmanuel Jeandel, from ENS-Lyon -too, contributed the generic hypergeometric code, as well as the -internal function ‘mpfr_exp3’, a first implementation of the sine and -cosine, and improved versions of ‘mpfr_const_log2’ and ‘mpfr_const_pi’. -Ludovic Meunier helped in the design of the ‘mpfr_erf’ code. Jean-Luc -Rémy contributed the ‘mpfr_zeta’ code. Fabrice Rouillier contributed -the ‘mpfr_xxx_z’ and ‘mpfr_xxx_q’ functions, and helped to the Microsoft -Windows porting. Damien Stehlé contributed the ‘mpfr_get_ld_2exp’ -function. +contributed the original version of the ‘mpfr_sum’ function (used up to +MPFR 3.1). Emmanuel Jeandel, from ENS-Lyon too, contributed the generic +hypergeometric code, as well as the internal function ‘mpfr_exp3’, a +first implementation of the sine and cosine, and improved versions of +‘mpfr_const_log2’ and ‘mpfr_const_pi’. Ludovic Meunier helped in the +design of the ‘mpfr_erf’ code. Jean-Luc Rémy contributed the +‘mpfr_zeta’ code. Fabrice Rouillier contributed the ‘mpfr_xxx_z’ and +‘mpfr_xxx_q’ functions, and helped to the Microsoft Windows porting. +Damien Stehlé contributed the ‘mpfr_get_ld_2exp’ function. Charles +Karney contributed the ‘mpfr_nrandom’ and ‘mpfr_erandom’ functions. We would like to thank Jean-Michel Muller and Joris van der Hoeven for very fruitful discussions at the beginning of that project, Torbjörn @@ -3100,7 +3755,11 @@ from INRIA by an "associate engineer" grant (2003-2005), an "opération de développement logiciel" grant (2007-2009), and the post-doctoral grant of Sylvain Chevillard in 2009-2010. The MPFR-MPC workshop in June -2012 was partly supported by the ERC grant ANTICS of Andreas Enge. +2012 was partly supported by the ERC grant ANTICS of Andreas Enge. The +MPFR-MPC workshop in January 2013 was partly supported by the ERC grant +ANTICS, the GDR IM and the Caramel project-team, during which Mickaël +Gastineau contributed the MPFRbench program, and Fredrik Johansson a +faster version of ‘mpfr_const_euler’.  File: mpfr.info, Node: References, Next: GNU Free Documentation License, Prev: Contributors, Up: Top @@ -3109,8 +3768,10 @@ ********** • Richard Brent and Paul Zimmermann, "Modern Computer Arithmetic", - Cambridge University Press (to appear), also available from the - authors’ web pages. + Cambridge University Press, Cambridge Monographs on Applied and + Computational Mathematics, Number 18, 2010. Electronic version + freely available at + . • Laurent Fousse, Guillaume Hanrot, Vincent Lefèvre, Patrick Pélissier and Paul Zimmermann, "MPFR: A Multiple-Precision Binary @@ -3119,7 +3780,7 @@ 2007, . • Torbjörn Granlund, "GNU MP: The GNU Multiple Precision Arithmetic - Library", version 5.0.1, 2010, . + Library", version 6.1.2, 2016, . • IEEE standard for binary floating-point arithmetic, Technical Report ANSI-IEEE Standard 754-1985, New York, 1985. Approved March @@ -3134,7 +3795,7 @@ "Seminumerical Algorithms", 2nd edition, Addison-Wesley, 1981. • Jean-Michel Muller, "Elementary Functions, Algorithms and - Implementation", Birkhäuser, Boston, 2nd edition, 2006. + Implementation", Birkhäuser, Boston, 3rd edition, 2016. • Jean-Michel Muller, Nicolas Brisebarre, Florent de Dinechin, Claude-Pierre Jeannerod, Vincent Lefèvre, Guillaume Melquiond, @@ -3527,7 +4188,7 @@ the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See - . + . Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered @@ -3596,6 +4257,8 @@ * Custom interface: Custom Interface. (line 3) * Exception related functions: Exception Related Functions. (line 3) +* Exponent: Nomenclature and Types. + (line 39) * Float arithmetic functions: Basic Arithmetic Functions. (line 3) * Float comparisons functions: Comparison Functions. (line 3) @@ -3611,6 +4274,8 @@ (line 6) * GNU Free Documentation License <1>: GNU Free Documentation License. (line 6) +* Group of flags: Nomenclature and Types. + (line 50) * I/O functions: Input and Output Functions. (line 3) * I/O functions <1>: Formatted Output Functions. @@ -3620,7 +4285,7 @@ * Input functions: Input and Output Functions. (line 3) * Installation: Installing MPFR. (line 6) -* Integer related functions: Integer Related Functions. +* Integer related functions: Integer and Remainder Related Functions. (line 3) * Internals: Internals. (line 3) * intmax_t: Headers and Libraries. @@ -3645,13 +4310,17 @@ * Output functions <1>: Formatted Output Functions. (line 3) * Precision: Nomenclature and Types. - (line 20) + (line 25) * Precision <1>: MPFR Interface. (line 17) +* Regular number: Nomenclature and Types. + (line 6) +* Remainder related functions: Integer and Remainder Related Functions. + (line 3) * Reporting bugs: Reporting Bugs. (line 6) -* Rounding mode related functions: Rounding Related Functions. +* Rounding mode related functions: Rounding-Related Functions. (line 3) * Rounding Modes: Nomenclature and Types. - (line 34) + (line 45) * Special functions: Special Functions. (line 3) * stdarg.h: Headers and Libraries. (line 19) @@ -3659,7 +4328,7 @@ (line 22) * stdio.h: Headers and Libraries. (line 12) -* Ternary value: Rounding Modes. (line 24) +* Ternary value: Rounding Modes. (line 48) * uintmax_t: Headers and Libraries. (line 22) @@ -3673,9 +4342,9 @@ * Menu: * mpfr_abs: Basic Arithmetic Functions. - (line 165) -* mpfr_acos: Special Functions. (line 53) -* mpfr_acosh: Special Functions. (line 117) + (line 186) +* mpfr_acos: Special Functions. (line 66) +* mpfr_acosh: Special Functions. (line 130) * mpfr_add: Basic Arithmetic Functions. (line 6) * mpfr_add_d: Basic Arithmetic Functions. @@ -3688,49 +4357,54 @@ (line 8) * mpfr_add_z: Basic Arithmetic Functions. (line 14) -* mpfr_agm: Special Functions. (line 219) -* mpfr_ai: Special Functions. (line 236) -* mpfr_asin: Special Functions. (line 54) -* mpfr_asinh: Special Functions. (line 118) +* mpfr_agm: Special Functions. (line 250) +* mpfr_ai: Special Functions. (line 269) +* mpfr_asin: Special Functions. (line 67) +* mpfr_asinh: Special Functions. (line 131) * mpfr_asprintf: Formatted Output Functions. - (line 193) -* mpfr_atan: Special Functions. (line 55) -* mpfr_atan2: Special Functions. (line 65) -* mpfr_atanh: Special Functions. (line 119) + (line 197) +* mpfr_atan: Special Functions. (line 68) +* mpfr_atan2: Special Functions. (line 78) +* mpfr_atanh: Special Functions. (line 132) +* mpfr_beta: Special Functions. (line 192) * mpfr_buildopt_decimal_p: Miscellaneous Functions. - (line 162) + (line 185) +* mpfr_buildopt_float128_p: Miscellaneous Functions. + (line 180) * mpfr_buildopt_gmpinternals_p: Miscellaneous Functions. - (line 167) + (line 190) +* mpfr_buildopt_sharedcache_p: Miscellaneous Functions. + (line 195) * mpfr_buildopt_tls_p: Miscellaneous Functions. - (line 156) + (line 174) * mpfr_buildopt_tune_case: Miscellaneous Functions. - (line 172) -* mpfr_can_round: Rounding Related Functions. + (line 203) +* mpfr_can_round: Rounding-Related Functions. (line 39) * mpfr_cbrt: Basic Arithmetic Functions. - (line 113) -* mpfr_ceil: Integer Related Functions. + (line 115) +* mpfr_ceil: Integer and Remainder Related Functions. (line 7) * mpfr_check_range: Exception Related Functions. - (line 37) + (line 50) * mpfr_clear: Initialization Functions. (line 30) * mpfr_clears: Initialization Functions. (line 35) * mpfr_clear_divby0: Exception Related Functions. - (line 112) + (line 153) * mpfr_clear_erangeflag: Exception Related Functions. - (line 115) + (line 156) * mpfr_clear_flags: Exception Related Functions. - (line 128) + (line 160) * mpfr_clear_inexflag: Exception Related Functions. - (line 114) + (line 155) * mpfr_clear_nanflag: Exception Related Functions. - (line 113) + (line 154) * mpfr_clear_overflow: Exception Related Functions. - (line 111) + (line 152) * mpfr_clear_underflow: Exception Related Functions. - (line 110) + (line 151) * mpfr_cmp: Comparison Functions. (line 6) * mpfr_cmpabs: Comparison Functions. @@ -3753,40 +4427,40 @@ (line 27) * mpfr_cmp_z: Comparison Functions. (line 11) -* mpfr_const_catalan: Special Functions. (line 247) -* mpfr_const_euler: Special Functions. (line 246) -* mpfr_const_log2: Special Functions. (line 244) -* mpfr_const_pi: Special Functions. (line 245) +* mpfr_const_catalan: Special Functions. (line 280) +* mpfr_const_euler: Special Functions. (line 279) +* mpfr_const_log2: Special Functions. (line 277) +* mpfr_const_pi: Special Functions. (line 278) * mpfr_copysign: Miscellaneous Functions. - (line 109) -* mpfr_cos: Special Functions. (line 31) -* mpfr_cosh: Special Functions. (line 97) -* mpfr_cot: Special Functions. (line 49) -* mpfr_coth: Special Functions. (line 113) -* mpfr_csc: Special Functions. (line 48) -* mpfr_csch: Special Functions. (line 112) -* mpfr_custom_get_exp: Custom Interface. (line 75) -* mpfr_custom_get_kind: Custom Interface. (line 65) -* mpfr_custom_get_significand: Custom Interface. (line 70) + (line 127) +* mpfr_cos: Special Functions. (line 44) +* mpfr_cosh: Special Functions. (line 110) +* mpfr_cot: Special Functions. (line 62) +* mpfr_coth: Special Functions. (line 126) +* mpfr_csc: Special Functions. (line 61) +* mpfr_csch: Special Functions. (line 125) +* mpfr_custom_get_exp: Custom Interface. (line 76) +* mpfr_custom_get_kind: Custom Interface. (line 66) +* mpfr_custom_get_significand: Custom Interface. (line 71) * mpfr_custom_get_size: Custom Interface. (line 37) * mpfr_custom_init: Custom Interface. (line 41) * mpfr_custom_init_set: Custom Interface. (line 48) -* mpfr_custom_move: Custom Interface. (line 82) +* mpfr_custom_move: Custom Interface. (line 85) * MPFR_DECL_INIT: Initialization Functions. (line 74) -* mpfr_digamma: Special Functions. (line 172) +* mpfr_digamma: Special Functions. (line 187) * mpfr_dim: Basic Arithmetic Functions. - (line 171) + (line 197) * mpfr_div: Basic Arithmetic Functions. (line 74) * mpfr_divby0_p: Exception Related Functions. - (line 134) + (line 176) * mpfr_div_2exp: Compatibility with MPF. - (line 49) + (line 52) * mpfr_div_2si: Basic Arithmetic Functions. - (line 186) + (line 212) * mpfr_div_2ui: Basic Arithmetic Functions. - (line 184) + (line 210) * mpfr_div_d: Basic Arithmetic Functions. (line 86) * mpfr_div_q: Basic Arithmetic Functions. @@ -3797,117 +4471,150 @@ (line 78) * mpfr_div_z: Basic Arithmetic Functions. (line 88) +* mpfr_dump: Input and Output Functions. + (line 68) * mpfr_d_div: Basic Arithmetic Functions. (line 84) * mpfr_d_sub: Basic Arithmetic Functions. (line 36) -* mpfr_eint: Special Functions. (line 135) +* mpfr_eint: Special Functions. (line 140) * mpfr_eq: Compatibility with MPF. - (line 28) + (line 31) * mpfr_equal_p: Comparison Functions. (line 59) +* mpfr_erandom: Miscellaneous Functions. + (line 99) * mpfr_erangeflag_p: Exception Related Functions. - (line 137) -* mpfr_erf: Special Functions. (line 183) -* mpfr_erfc: Special Functions. (line 184) -* mpfr_exp: Special Functions. (line 25) -* mpfr_exp10: Special Functions. (line 27) -* mpfr_exp2: Special Functions. (line 26) -* mpfr_expm1: Special Functions. (line 131) -* mpfr_fac_ui: Special Functions. (line 123) + (line 179) +* mpfr_erf: Special Functions. (line 204) +* mpfr_erfc: Special Functions. (line 205) +* mpfr_exp: Special Functions. (line 34) +* mpfr_exp10: Special Functions. (line 36) +* mpfr_exp2: Special Functions. (line 35) +* mpfr_expm1: Special Functions. (line 40) +* mpfr_exp_t: Nomenclature and Types. + (line 39) +* mpfr_fac_ui: Special Functions. (line 136) * mpfr_fits_intmax_p: Conversion Functions. - (line 150) + (line 176) * mpfr_fits_sint_p: Conversion Functions. - (line 146) + (line 172) * mpfr_fits_slong_p: Conversion Functions. - (line 144) + (line 170) * mpfr_fits_sshort_p: Conversion Functions. - (line 148) + (line 174) * mpfr_fits_uintmax_p: Conversion Functions. - (line 149) + (line 175) * mpfr_fits_uint_p: Conversion Functions. - (line 145) + (line 171) * mpfr_fits_ulong_p: Conversion Functions. - (line 143) + (line 169) * mpfr_fits_ushort_p: Conversion Functions. - (line 147) -* mpfr_floor: Integer Related Functions. + (line 173) +* mpfr_flags_clear: Exception Related Functions. + (line 190) +* mpfr_flags_restore: Exception Related Functions. + (line 214) +* mpfr_flags_save: Exception Related Functions. + (line 210) +* mpfr_flags_set: Exception Related Functions. + (line 193) +* mpfr_flags_t: Nomenclature and Types. + (line 50) +* mpfr_flags_test: Exception Related Functions. + (line 196) +* mpfr_floor: Integer and Remainder Related Functions. (line 8) -* mpfr_fma: Special Functions. (line 209) -* mpfr_fmod: Integer Related Functions. - (line 92) -* mpfr_fms: Special Functions. (line 211) +* mpfr_fma: Special Functions. (line 230) +* mpfr_fmma: Special Functions. (line 240) +* mpfr_fmms: Special Functions. (line 242) +* mpfr_fmod: Integer and Remainder Related Functions. + (line 106) +* mpfr_fmodquo: Integer and Remainder Related Functions. + (line 108) +* mpfr_fms: Special Functions. (line 232) +* mpfr_fpif_export: Input and Output Functions. + (line 43) +* mpfr_fpif_import: Input and Output Functions. + (line 54) * mpfr_fprintf: Formatted Output Functions. - (line 157) -* mpfr_frac: Integer Related Functions. - (line 76) -* mpfr_free_cache: Special Functions. (line 254) + (line 161) +* mpfr_frac: Integer and Remainder Related Functions. + (line 89) +* mpfr_free_cache: Special Functions. (line 288) +* mpfr_free_cache2: Special Functions. (line 295) +* mpfr_free_pool: Special Functions. (line 309) * mpfr_free_str: Conversion Functions. - (line 137) + (line 164) * mpfr_frexp: Conversion Functions. - (line 45) -* mpfr_gamma: Special Functions. (line 150) + (line 49) +* mpfr_gamma: Special Functions. (line 155) +* mpfr_gamma_inc: Special Functions. (line 156) * mpfr_get_d: Conversion Functions. (line 7) * mpfr_get_decimal64: Conversion Functions. - (line 9) + (line 10) * mpfr_get_default_prec: Initialization Functions. (line 112) -* mpfr_get_default_rounding_mode: Rounding Related Functions. +* mpfr_get_default_rounding_mode: Rounding-Related Functions. (line 10) * mpfr_get_d_2exp: Conversion Functions. - (line 32) + (line 36) * mpfr_get_emax: Exception Related Functions. (line 7) * mpfr_get_emax_max: Exception Related Functions. - (line 30) + (line 43) * mpfr_get_emax_min: Exception Related Functions. - (line 29) + (line 42) * mpfr_get_emin: Exception Related Functions. (line 6) * mpfr_get_emin_max: Exception Related Functions. - (line 28) + (line 41) * mpfr_get_emin_min: Exception Related Functions. - (line 27) + (line 40) * mpfr_get_exp: Miscellaneous Functions. - (line 88) + (line 105) * mpfr_get_f: Conversion Functions. - (line 72) + (line 85) +* mpfr_get_float128: Conversion Functions. + (line 9) * mpfr_get_flt: Conversion Functions. (line 6) * mpfr_get_ld: Conversion Functions. (line 8) * mpfr_get_ld_2exp: Conversion Functions. - (line 34) + (line 38) * mpfr_get_patches: Miscellaneous Functions. - (line 147) + (line 165) * mpfr_get_prec: Initialization Functions. (line 149) +* mpfr_get_q: Conversion Functions. + (line 80) * mpfr_get_si: Conversion Functions. - (line 19) -* mpfr_get_sj: Conversion Functions. (line 21) +* mpfr_get_sj: Conversion Functions. + (line 23) * mpfr_get_str: Conversion Functions. - (line 85) + (line 98) * mpfr_get_ui: Conversion Functions. - (line 20) -* mpfr_get_uj: Conversion Functions. (line 22) +* mpfr_get_uj: Conversion Functions. + (line 24) * mpfr_get_version: Miscellaneous Functions. - (line 116) + (line 134) * mpfr_get_z: Conversion Functions. - (line 67) + (line 71) * mpfr_get_z_2exp: Conversion Functions. - (line 54) + (line 58) * mpfr_grandom: Miscellaneous Functions. - (line 63) + (line 69) * mpfr_greaterequal_p: Comparison Functions. (line 56) * mpfr_greater_p: Comparison Functions. (line 55) -* mpfr_hypot: Special Functions. (line 227) +* mpfr_hypot: Special Functions. (line 260) * mpfr_inexflag_p: Exception Related Functions. - (line 136) + (line 178) * mpfr_inf_p: Comparison Functions. (line 40) * mpfr_init: Initialization Functions. @@ -3938,40 +4645,42 @@ (line 14) * mpfr_inp_str: Input and Output Functions. (line 31) -* mpfr_integer_p: Integer Related Functions. - (line 119) -* mpfr_j0: Special Functions. (line 188) -* mpfr_j1: Special Functions. (line 189) -* mpfr_jn: Special Functions. (line 190) +* mpfr_integer_p: Integer and Remainder Related Functions. + (line 135) +* mpfr_j0: Special Functions. (line 209) +* mpfr_j1: Special Functions. (line 210) +* mpfr_jn: Special Functions. (line 211) * mpfr_lessequal_p: Comparison Functions. (line 58) * mpfr_lessgreater_p: Comparison Functions. (line 64) * mpfr_less_p: Comparison Functions. (line 57) -* mpfr_lgamma: Special Functions. (line 162) -* mpfr_li2: Special Functions. (line 145) -* mpfr_lngamma: Special Functions. (line 154) -* mpfr_log: Special Functions. (line 16) -* mpfr_log10: Special Functions. (line 18) -* mpfr_log1p: Special Functions. (line 127) -* mpfr_log2: Special Functions. (line 17) +* mpfr_lgamma: Special Functions. (line 177) +* mpfr_li2: Special Functions. (line 150) +* mpfr_lngamma: Special Functions. (line 169) +* mpfr_log: Special Functions. (line 19) +* mpfr_log10: Special Functions. (line 23) +* mpfr_log1p: Special Functions. (line 30) +* mpfr_log2: Special Functions. (line 22) +* mpfr_log_ui: Special Functions. (line 20) * mpfr_max: Miscellaneous Functions. (line 22) * mpfr_min: Miscellaneous Functions. (line 20) -* mpfr_min_prec: Rounding Related Functions. - (line 64) -* mpfr_modf: Integer Related Functions. - (line 82) +* mpfr_min_prec: Rounding-Related Functions. + (line 84) +* mpfr_modf: Integer and Remainder Related Functions. + (line 96) +* mpfr_mp_memory_cleanup: Special Functions. (line 314) * mpfr_mul: Basic Arithmetic Functions. (line 53) * mpfr_mul_2exp: Compatibility with MPF. - (line 47) + (line 50) * mpfr_mul_2si: Basic Arithmetic Functions. - (line 179) + (line 205) * mpfr_mul_2ui: Basic Arithmetic Functions. - (line 177) + (line 203) * mpfr_mul_d: Basic Arithmetic Functions. (line 59) * mpfr_mul_q: Basic Arithmetic Functions. @@ -3983,165 +4692,179 @@ * mpfr_mul_z: Basic Arithmetic Functions. (line 61) * mpfr_nanflag_p: Exception Related Functions. - (line 135) + (line 177) * mpfr_nan_p: Comparison Functions. (line 39) * mpfr_neg: Basic Arithmetic Functions. - (line 164) + (line 185) * mpfr_nextabove: Miscellaneous Functions. (line 15) * mpfr_nextbelow: Miscellaneous Functions. (line 16) * mpfr_nexttoward: Miscellaneous Functions. (line 6) +* mpfr_nrandom: Miscellaneous Functions. + (line 67) * mpfr_number_p: Comparison Functions. (line 41) * mpfr_out_str: Input and Output Functions. (line 15) * mpfr_overflow_p: Exception Related Functions. - (line 133) + (line 175) * mpfr_pow: Basic Arithmetic Functions. - (line 121) + (line 139) * mpfr_pow_si: Basic Arithmetic Functions. - (line 125) + (line 143) * mpfr_pow_ui: Basic Arithmetic Functions. - (line 123) + (line 141) * mpfr_pow_z: Basic Arithmetic Functions. - (line 127) -* mpfr_prec_round: Rounding Related Functions. + (line 145) +* mpfr_prec_round: Rounding-Related Functions. (line 13) * mpfr_prec_t: Nomenclature and Types. - (line 20) + (line 25) * mpfr_printf: Formatted Output Functions. - (line 164) -* mpfr_print_rnd_mode: Rounding Related Functions. - (line 71) + (line 168) +* mpfr_print_rnd_mode: Rounding-Related Functions. + (line 88) +* mpfr_ptr: Nomenclature and Types. + (line 6) * mpfr_rec_sqrt: Basic Arithmetic Functions. - (line 105) + (line 107) * mpfr_regular_p: Comparison Functions. (line 43) * mpfr_reldiff: Compatibility with MPF. - (line 39) -* mpfr_remainder: Integer Related Functions. - (line 94) -* mpfr_remquo: Integer Related Functions. - (line 96) -* mpfr_rint: Integer Related Functions. + (line 42) +* mpfr_remainder: Integer and Remainder Related Functions. + (line 110) +* mpfr_remquo: Integer and Remainder Related Functions. + (line 112) +* mpfr_rint: Integer and Remainder Related Functions. (line 6) -* mpfr_rint_ceil: Integer Related Functions. - (line 46) -* mpfr_rint_floor: Integer Related Functions. - (line 47) -* mpfr_rint_round: Integer Related Functions. - (line 49) -* mpfr_rint_trunc: Integer Related Functions. - (line 51) +* mpfr_rint_ceil: Integer and Remainder Related Functions. + (line 52) +* mpfr_rint_floor: Integer and Remainder Related Functions. + (line 53) +* mpfr_rint_round: Integer and Remainder Related Functions. + (line 55) +* mpfr_rint_roundeven: Integer and Remainder Related Functions. + (line 57) +* mpfr_rint_trunc: Integer and Remainder Related Functions. + (line 59) * mpfr_rnd_t: Nomenclature and Types. - (line 34) + (line 45) * mpfr_root: Basic Arithmetic Functions. - (line 114) -* mpfr_round: Integer Related Functions. + (line 128) +* mpfr_rootn_ui: Basic Arithmetic Functions. + (line 116) +* mpfr_round: Integer and Remainder Related Functions. (line 9) -* mpfr_sec: Special Functions. (line 47) -* mpfr_sech: Special Functions. (line 111) +* mpfr_roundeven: Integer and Remainder Related Functions. + (line 10) +* mpfr_round_nearest_away: Rounding-Related Functions. + (line 93) +* mpfr_sec: Special Functions. (line 60) +* mpfr_sech: Special Functions. (line 124) * mpfr_set: Assignment Functions. (line 9) * mpfr_setsign: Miscellaneous Functions. - (line 103) + (line 121) * mpfr_set_d: Assignment Functions. (line 16) * mpfr_set_decimal64: Assignment Functions. - (line 19) + (line 21) * mpfr_set_default_prec: Initialization Functions. (line 100) -* mpfr_set_default_rounding_mode: Rounding Related Functions. +* mpfr_set_default_rounding_mode: Rounding-Related Functions. (line 6) * mpfr_set_divby0: Exception Related Functions. - (line 121) + (line 167) * mpfr_set_emax: Exception Related Functions. (line 16) * mpfr_set_emin: Exception Related Functions. (line 15) * mpfr_set_erangeflag: Exception Related Functions. - (line 124) + (line 170) * mpfr_set_exp: Miscellaneous Functions. - (line 93) + (line 112) * mpfr_set_f: Assignment Functions. - (line 23) + (line 25) +* mpfr_set_float128: Assignment Functions. + (line 19) * mpfr_set_flt: Assignment Functions. (line 15) * mpfr_set_inexflag: Exception Related Functions. - (line 123) + (line 169) * mpfr_set_inf: Assignment Functions. - (line 143) + (line 154) * mpfr_set_ld: Assignment Functions. (line 17) * mpfr_set_nan: Assignment Functions. - (line 142) + (line 153) * mpfr_set_nanflag: Exception Related Functions. - (line 122) + (line 168) * mpfr_set_overflow: Exception Related Functions. - (line 120) + (line 166) * mpfr_set_prec: Initialization Functions. (line 135) * mpfr_set_prec_raw: Compatibility with MPF. - (line 22) + (line 25) * mpfr_set_q: Assignment Functions. - (line 22) + (line 24) * mpfr_set_si: Assignment Functions. (line 12) * mpfr_set_si_2exp: Assignment Functions. - (line 50) + (line 61) * mpfr_set_sj: Assignment Functions. (line 14) * mpfr_set_sj_2exp: Assignment Functions. - (line 54) + (line 65) * mpfr_set_str: Assignment Functions. - (line 62) + (line 73) * mpfr_set_ui: Assignment Functions. (line 10) * mpfr_set_ui_2exp: Assignment Functions. - (line 48) + (line 59) * mpfr_set_uj: Assignment Functions. (line 13) * mpfr_set_uj_2exp: Assignment Functions. - (line 52) + (line 63) * mpfr_set_underflow: Exception Related Functions. - (line 119) + (line 165) * mpfr_set_z: Assignment Functions. - (line 21) + (line 23) * mpfr_set_zero: Assignment Functions. - (line 144) + (line 155) * mpfr_set_z_2exp: Assignment Functions. - (line 56) + (line 67) * mpfr_sgn: Comparison Functions. (line 49) * mpfr_signbit: Miscellaneous Functions. - (line 99) -* mpfr_sin: Special Functions. (line 32) -* mpfr_sinh: Special Functions. (line 98) -* mpfr_sinh_cosh: Special Functions. (line 103) -* mpfr_sin_cos: Special Functions. (line 37) + (line 117) +* mpfr_sin: Special Functions. (line 45) +* mpfr_sinh: Special Functions. (line 111) +* mpfr_sinh_cosh: Special Functions. (line 116) +* mpfr_sin_cos: Special Functions. (line 50) * mpfr_si_div: Basic Arithmetic Functions. (line 80) * mpfr_si_sub: Basic Arithmetic Functions. (line 32) * mpfr_snprintf: Formatted Output Functions. - (line 180) + (line 184) * mpfr_sprintf: Formatted Output Functions. - (line 170) + (line 174) * mpfr_sqr: Basic Arithmetic Functions. (line 71) * mpfr_sqrt: Basic Arithmetic Functions. - (line 98) + (line 100) * mpfr_sqrt_ui: Basic Arithmetic Functions. - (line 99) + (line 101) * mpfr_strtofr: Assignment Functions. - (line 80) + (line 91) * mpfr_sub: Basic Arithmetic Functions. (line 26) * mpfr_subnormalize: Exception Related Functions. - (line 60) + (line 73) * mpfr_sub_d: Basic Arithmetic Functions. (line 38) * mpfr_sub_q: Basic Arithmetic Functions. @@ -4152,25 +4875,25 @@ (line 30) * mpfr_sub_z: Basic Arithmetic Functions. (line 42) -* mpfr_sum: Special Functions. (line 262) +* mpfr_sum: Special Functions. (line 321) * mpfr_swap: Assignment Functions. - (line 150) + (line 161) * mpfr_t: Nomenclature and Types. (line 6) -* mpfr_tan: Special Functions. (line 33) -* mpfr_tanh: Special Functions. (line 99) -* mpfr_trunc: Integer Related Functions. - (line 10) +* mpfr_tan: Special Functions. (line 46) +* mpfr_tanh: Special Functions. (line 112) +* mpfr_trunc: Integer and Remainder Related Functions. + (line 11) * mpfr_ui_div: Basic Arithmetic Functions. (line 76) * mpfr_ui_pow: Basic Arithmetic Functions. - (line 131) + (line 149) * mpfr_ui_pow_ui: Basic Arithmetic Functions. - (line 129) + (line 147) * mpfr_ui_sub: Basic Arithmetic Functions. (line 28) * mpfr_underflow_p: Exception Related Functions. - (line 132) + (line 174) * mpfr_unordered_p: Comparison Functions. (line 69) * mpfr_urandom: Miscellaneous Functions. @@ -4178,34 +4901,34 @@ * mpfr_urandomb: Miscellaneous Functions. (line 29) * mpfr_vasprintf: Formatted Output Functions. - (line 194) + (line 198) * MPFR_VERSION: Miscellaneous Functions. - (line 119) + (line 137) * MPFR_VERSION_MAJOR: Miscellaneous Functions. - (line 120) + (line 138) * MPFR_VERSION_MINOR: Miscellaneous Functions. - (line 121) -* MPFR_VERSION_NUM: Miscellaneous Functions. (line 139) +* MPFR_VERSION_NUM: Miscellaneous Functions. + (line 157) * MPFR_VERSION_PATCHLEVEL: Miscellaneous Functions. - (line 122) + (line 140) * MPFR_VERSION_STRING: Miscellaneous Functions. - (line 123) + (line 141) * mpfr_vfprintf: Formatted Output Functions. - (line 158) + (line 162) * mpfr_vprintf: Formatted Output Functions. - (line 165) + (line 169) * mpfr_vsnprintf: Formatted Output Functions. - (line 182) + (line 186) * mpfr_vsprintf: Formatted Output Functions. - (line 171) -* mpfr_y0: Special Functions. (line 199) -* mpfr_y1: Special Functions. (line 200) -* mpfr_yn: Special Functions. (line 201) + (line 175) +* mpfr_y0: Special Functions. (line 220) +* mpfr_y1: Special Functions. (line 221) +* mpfr_yn: Special Functions. (line 222) * mpfr_zero_p: Comparison Functions. (line 42) -* mpfr_zeta: Special Functions. (line 177) -* mpfr_zeta_ui: Special Functions. (line 178) +* mpfr_zeta: Special Functions. (line 198) +* mpfr_zeta_ui: Special Functions. (line 199) * mpfr_z_sub: Basic Arithmetic Functions. (line 40) @@ -4213,47 +4936,49 @@  Tag Table: Node: Top775 -Node: Copying2007 -Node: Introduction to MPFR3770 -Node: Installing MPFR5884 -Node: Reporting Bugs11328 -Node: MPFR Basics13359 -Node: Headers and Libraries13675 -Node: Nomenclature and Types16829 -Node: MPFR Variable Conventions18892 -Node: Rounding Modes20436 -Ref: ternary value21566 -Node: Floating-Point Values on Special Numbers23552 -Node: Exceptions26812 -Node: Memory Handling29989 -Node: MPFR Interface31135 -Node: Initialization Functions33249 -Node: Assignment Functions40564 -Node: Combined Initialization and Assignment Functions49920 -Node: Conversion Functions51221 -Node: Basic Arithmetic Functions60283 -Node: Comparison Functions69785 -Node: Special Functions73273 -Node: Input and Output Functions87874 -Node: Formatted Output Functions89846 -Node: Integer Related Functions99633 -Node: Rounding Related Functions106254 -Node: Miscellaneous Functions110091 -Node: Exception Related Functions118774 -Node: Compatibility with MPF125592 -Node: Custom Interface128334 -Node: Internals132733 -Node: API Compatibility134277 -Node: Type and Macro Changes136207 -Node: Added Functions139056 -Node: Changed Functions142344 -Node: Removed Functions146758 -Node: Other Changes147186 -Node: Contributors148789 -Node: References151442 -Node: GNU Free Documentation License153196 -Node: Concept Index175789 -Node: Function and Type Index181854 +Node: Copying2042 +Node: Introduction to MPFR3805 +Node: Installing MPFR6208 +Node: Reporting Bugs11659 +Node: MPFR Basics13691 +Node: Headers and Libraries14051 +Node: Nomenclature and Types17647 +Node: MPFR Variable Conventions20511 +Node: Rounding Modes22053 +Ref: ternary value24778 +Node: Floating-Point Values on Special Numbers26764 +Node: Exceptions30024 +Node: Memory Handling33852 +Node: Getting the Best Efficiency Out of MPFR37652 +Node: MPFR Interface38564 +Node: Initialization Functions40850 +Node: Assignment Functions48165 +Node: Combined Initialization and Assignment Functions58111 +Node: Conversion Functions59412 +Node: Basic Arithmetic Functions70483 +Node: Comparison Functions81379 +Node: Special Functions84867 +Node: Input and Output Functions103074 +Node: Formatted Output Functions107851 +Node: Integer and Remainder Related Functions118056 +Node: Rounding-Related Functions125584 +Node: Miscellaneous Functions132101 +Node: Exception Related Functions142593 +Node: Compatibility with MPF152833 +Node: Custom Interface155779 +Node: Internals160410 +Node: API Compatibility161954 +Node: Type and Macro Changes163902 +Node: Added Functions167085 +Node: Changed Functions171599 +Node: Removed Functions178195 +Node: Other Changes178925 +Node: MPFR and the IEEE 754 Standard180626 +Node: Contributors183243 +Node: References186299 +Node: GNU Free Documentation License188183 +Node: Concept Index210777 +Node: Function and Type Index217425  End Tag Table diff -Nru mpfr4-3.1.4/doc/mpfr.texi mpfr4-4.0.2/doc/mpfr.texi --- mpfr4-3.1.4/doc/mpfr.texi 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/doc/mpfr.texi 2019-01-31 20:29:48.000000000 +0000 @@ -2,8 +2,8 @@ @c %**start of header @setfilename mpfr.info @documentencoding UTF-8 -@set VERSION 3.1.4 -@set UPDATED-MONTH March 2016 +@set VERSION 4.0.2 +@set UPDATED-MONTH January 2019 @settitle GNU MPFR @value{VERSION} @synindex tp fn @iftex @@ -15,11 +15,15 @@ @c as the "info" utility cannot currently handle them. @c https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=212549 +@c Warning! If a macro is used with @iftex, it must also be defined for +@c info at least (e.g. with @ifnottex) in order to avoid a failure with +@c makeinfo 5.2 (there is no such problem with makeinfo 6.5). + @copying This manual documents how to install and use the Multiple Precision Floating-Point Reliable Library, version @value{VERSION}. -Copyright 1991, 1993-2016 Free Software Foundation, Inc. +Copyright 1991, 1993-2019 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later @@ -28,19 +32,6 @@ license is included in @ref{GNU Free Documentation License}. @end copying - -@c Texinfo version 4.2 or later will be needed to process this file. -@c Texinfo version 5.0 or later should be used since the formatting -@c has been modified for this version (tested with 5.2). -@c -@c A suitable texinfo.tex is supplied, a newer one should work -@c equally well. -@c -@c The edition number is in the VERSION variable above and should be -@c updated where appropriate. Also, update the month and year in -@c UPDATED-MONTH. - - @dircategory Software libraries @direntry * mpfr: (mpfr). Multiple Precision Floating-Point Reliable Library. @@ -107,6 +98,7 @@ * MPFR Basics:: What every MPFR user should now. * MPFR Interface:: MPFR functions and macros. * API Compatibility:: API compatibility with previous MPFR versions. +* MPFR and the IEEE 754 Standard:: * Contributors:: * References:: * GNU Free Documentation License:: @@ -131,8 +123,11 @@ @c Usage: @GMPabs{x} @c Give either |x| in tex, or abs(x) in info or html. +@c The \ensuremath is needed because the OT1 encoding is used, where +@c the pipe character corresponds to a wide dash: +@c https://tex.stackexchange.com/a/1775/58921 @tex -\gdef\GMPabs#1{|#1|} +\gdef\GMPabs#1{\ensuremath{|#1|}} @end tex @ifnottex @macro GMPabs {X} @@ -275,18 +270,22 @@ @item the MPFR code is portable, i.e., the result of any operation does not depend on the machine word size -@code{mp_bits_per_limb} (64 on most current processors); +@code{mp_bits_per_limb} (64 on most current processors), possibly +except in faithful rounding. +It does not depend either on the machine rounding mode or rounding precision; @item the precision in bits can be set @emph{exactly} to any valid value for each variable (including very small precision); @item MPFR provides the four rounding modes from the IEEE 754-1985 standard, plus away-from-zero, as well as for basic operations as for other -mathematical functions. +mathematical functions. Faithful rounding (partially supported) is provided +too, but the results may no longer be reproducible. @end itemize -In particular, with a precision of 53 bits, MPFR is able to +In particular, with a precision of 53 bits and in any of the four standard +rounding modes, MPFR is able to exactly reproduce all computations with double-precision machine floating-point numbers (e.g., @code{double} type in C, with a C implementation that rigorously follows Annex F of the ISO C99 standard @@ -362,8 +361,8 @@ @enumerate @item -To build MPFR, you first have to install GNU MP -(version 4.1 or higher) on your computer. +To build MPFR, you first have to install GNU MP (version 5.0.0 or higher) +on your computer. You need a C compiler, preferably GCC, but any reasonable compiler should work. And you need the standard Unix @samp{make} command, plus some other standard Unix utility commands. @@ -473,19 +472,19 @@ before reporting a bug, in particular section ``In case of problem''. Some problems are due to bad configuration on the user side (not specific to MPFR)@. Problems are also mentioned in the FAQ -@url{http://www.mpfr.org/faq.html}. +@url{https://www.mpfr.org/faq.html}. @comment Warning! Do not split "MPFR ... @url{...}" across several lines @comment as this needs to be updated with update-version. Please report problems to the MPFR mailing-list @samp{mpfr@@inria.fr}. @xref{Reporting Bugs}. Some bug fixes are available on the -MPFR 3.1.4 web page @url{http://www.mpfr.org/mpfr-3.1.4/}. +MPFR 4.0.2 web page @url{https://www.mpfr.org/mpfr-4.0.2/}. @section Getting the Latest Version of MPFR The latest version of MPFR is available from -@url{ftp://ftp.gnu.org/gnu/mpfr/} or @url{http://www.mpfr.org/}. +@url{https://ftp.gnu.org/gnu/mpfr/} or @url{https://www.mpfr.org/}. @node Reporting Bugs, MPFR Basics, Installing MPFR, Top @comment node-name, next, previous, up @@ -495,8 +494,8 @@ @comment Warning! Do not split "MPFR ... @url{...}" across several lines @comment as this needs to be updated with update-version. If you think you have found a bug in the MPFR library, first have a look -on the MPFR 3.1.4 web page @url{http://www.mpfr.org/mpfr-3.1.4/} and the -FAQ @url{http://www.mpfr.org/faq.html}: +on the MPFR 4.0.2 web page @url{https://www.mpfr.org/mpfr-4.0.2/} and the +FAQ @url{https://www.mpfr.org/faq.html}: perhaps this bug is already known, in which case you may find there a workaround for it. You might also look in the archives of the MPFR mailing-list: @@ -516,7 +515,7 @@ you get are incorrect and in that case, in what way. Please include compiler version information in your bug report. This can -be extracted using @samp{cc -V} on some machines, or, if you're using GCC, +be extracted using @samp{cc -V} on some machines, or, if you are using GCC, @samp{gcc -v}. Also, include the output from @samp{uname -a} and the MPFR version (the GMP version may be useful too). If you get a failure while running @samp{make} or @samp{make check}, please @@ -544,6 +543,7 @@ * Floating-Point Values on Special Numbers:: * Exceptions:: * Memory Handling:: +* Getting the Best Efficiency Out of MPFR:: @end menu @node Headers and Libraries, Nomenclature and Types, MPFR Basics, MPFR Basics @@ -578,8 +578,9 @@ @cindex @code{uintmax_t} And for any functions using @code{intmax_t}, you must include @code{} or @code{} before @file{mpfr.h}, to -allow @file{mpfr.h} to define prototypes for these functions. Moreover, -users of C++ compilers under some platforms may need to define +allow @file{mpfr.h} to define prototypes for these functions. +Moreover, under some platforms (in particular with C++ compilers), +users may need to define @code{MPFR_USE_INTMAX_T} (and should do it for portability) before @file{mpfr.h} has been included; of course, it is possible to do that on the command line, e.g., with @code{-DMPFR_USE_INTMAX_T}. @@ -635,41 +636,55 @@ @samp{LD_LIBRARY_PATH}) on some systems. Please read the @file{INSTALL} file for additional information. +Alternatively, it is possible to use @samp{pkg-config} (a file +@samp{mpfr.pc} is provided as of MPFR 4.0): + +@example +cc myprogram.c $(pkg-config --cflags --libs mpfr) +@end example + +Note that the @samp{MPFR_} and @samp{mpfr_} prefixes are reserved for MPFR@. +As a general rule, in order to avoid clashes, software using MPFR (directly +or indirectly) and system headers/libraries should not define macros and +symbols using these prefixes. +@c Concerning system headers/libraries: those that may be used by MPFR. + @node Nomenclature and Types, MPFR Variable Conventions, Headers and Libraries, MPFR Basics @comment node-name, next, previous, up @section Nomenclature and Types @cindex Floating-point number +@cindex Regular number @tindex @code{mpfr_t} -@noindent -A @dfn{floating-point number}, or @dfn{float} for short, is an arbitrary -precision significand (also called mantissa) with a limited precision -exponent. The C data type -for such objects is @code{mpfr_t} (internally defined as a one-element -array of a structure, and @code{mpfr_ptr} is the C data type representing -a pointer to this structure). A floating-point number can have -three special values: Not-a-Number (NaN) or plus or minus Infinity. NaN -represents an uninitialized object, the result of an invalid operation -(like 0 divided by 0), or a value that cannot be determined (like -+Infinity minus +Infinity). Moreover, like in the IEEE 754 standard, -zero is signed, i.e., there are both +0 and @minus{}0; the behavior -is the same as in the IEEE 754 standard and it is generalized to -the other functions supported by MPFR@. Unless documented otherwise, -the sign bit of a NaN is unspecified. -@c VL: re-added how mpfr_t is defined, due to some questions from users -@c in the past (the fact that the result was returned in an argument -@c seemed strange); also, mpfr_ptr needs to be defined here, as it is -@c used in the API. +@tindex @code{mpfr_ptr} +A @dfn{floating-point number}, or @dfn{float} for short, is an object +representing a radix-2 floating-point number consisting of a sign, +an arbitrary-precision normalized significand (also called mantissa), +and an exponent (an integer in some given range); these are called +@dfn{regular numbers}. Like in the IEEE 754 standard, a floating-point +number can also have three kinds of special values: a signed zero, a +signed infinity, and Not-a-Number (NaN)@. NaN can represent the default +value of a floating-point object and the result of some operations for +which no other results would make sense, such as 0 divided by 0 or ++Infinity minus +Infinity; unless documented otherwise, the sign bit of +a NaN is unspecified. Note that contrary to IEEE 754, MPFR has a single +kind of NaN and does not have subnormals. Other than that, the behavior +is very similar to IEEE 754, but there may be some differences. + +The C data type for such objects is @code{mpfr_t}, internally defined +as a one-element array of a structure (so that when passed as an +argument to a function, it is the pointer that is actually passed), +and @code{mpfr_ptr} is the C data type representing a pointer to this +structure. @cindex Precision @tindex @code{mpfr_prec_t} -@noindent The @dfn{precision} is the number of bits used to represent the significand of a floating-point number; the corresponding C data type is @code{mpfr_prec_t}. The precision can be any integer between @code{MPFR_PREC_MIN} and @code{MPFR_PREC_MAX}. In the current implementation, @code{MPFR_PREC_MIN} -is equal to 2. +is equal to 1. Warning! MPFR needs to increase the precision internally, in order to provide accurate results (and in particular, correct rounding). Do not @@ -679,20 +694,33 @@ may abort, crash or have undefined behavior (depending on your C implementation). +@cindex Exponent +@tindex @code{mpfr_exp_t} +An @dfn{exponent} is a component of a regular floating-point number. +Its C data type is @code{mpfr_exp_t}. Valid exponents are restricted +to a subset of this type, and the exponent range can be changed globally +as described in @ref{Exception Related Functions}. Special values do not +have an exponent. + @cindex Rounding Modes @tindex @code{mpfr_rnd_t} -@noindent The @dfn{rounding mode} specifies the way to round the result of a floating-point operation, in case the exact result can not be represented -exactly in the destination significand; +exactly in the destination; the corresponding C data type is @code{mpfr_rnd_t}. +@cindex Group of flags +@tindex @code{mpfr_flags_t} +MPFR has a global (or per-thread) flag for each supported exception and +provides operations on flags (@ref{Exceptions}). This C data type is used +to represent a group of flags (or a mask). + @node MPFR Variable Conventions, Rounding Modes, Nomenclature and Types, MPFR Basics @comment node-name, next, previous, up @section MPFR Variable Conventions -Before you can assign to an MPFR variable, you need to initialize it by calling -one of the special initialization functions. When you're done with a +Before you can assign to a MPFR variable, you need to initialize it by calling +one of the special initialization functions. When you are done with a variable, you need to clear it out, using one of the functions for that purpose. A variable should only be initialized once, or at least cleared out between @@ -712,21 +740,29 @@ MPFR allows you to use the same variable for both input and output in the same expression. For example, the main function for floating-point multiplication, @code{mpfr_mul}, can be used like this: @code{mpfr_mul (x, x, x, rnd)}. -This -computes the square of @var{x} with rounding mode @code{rnd} +This computes the square of @var{x} with rounding mode @code{rnd} and puts the result back in @var{x}. @node Rounding Modes, Floating-Point Values on Special Numbers, MPFR Variable Conventions, MPFR Basics @comment node-name, next, previous, up @section Rounding Modes -The following five rounding modes are supported: +The following rounding modes are supported: @itemize @bullet @item @code{MPFR_RNDN}: round to nearest (roundTiesToEven in IEEE 754-2008), @item @code{MPFR_RNDZ}: round toward zero (roundTowardZero in IEEE 754-2008), @item @code{MPFR_RNDU}: round toward plus infinity (roundTowardPositive in IEEE 754-2008), @item @code{MPFR_RNDD}: round toward minus infinity (roundTowardNegative in IEEE 754-2008), @item @code{MPFR_RNDA}: round away from zero. +@item @code{MPFR_RNDF}: faithful rounding. This feature is currently +experimental. Specific support for this rounding mode has been added +to some functions, such as the basic operations (addition, subtraction, +multiplication, square, division, square root) or when explicitly +documented. It might also work with other functions, as it is possible that +they do not need modification in their code; even though a correct behavior +is not guaranteed yet (corrections were done when failures occurred in the +test suite, but almost nothing has been checked manually), failures should +be regarded as bugs and reported, so that they can be fixed. @end itemize The @samp{round to nearest} mode works as in the IEEE 754 standard: in @@ -737,6 +773,25 @@ This rule avoids the @dfn{drift} phenomenon mentioned by Knuth in volume 2 of The Art of Computer Programming (Section 4.2.2). +The @code{MPFR_RNDF} mode works as follows: the computed value is either +that corresponding to @code{MPFR_RNDD} or that corresponding to +@code{MPFR_RNDU}. +In particular when those values are identical, +i.e., when the result of the corresponding operation is exactly +representable, that exact result is returned. +Thus, the computed result can take at most two possible values, and +in absence of underflow/overflow, the corresponding error is strictly +less than one ulp (unit in the last place) of that result and of the +exact result. +For @code{MPFR_RNDF}, the ternary value (defined below) and the inexact flag +(defined later, as with the other flags) are unspecified, the divide-by-zero +flag is as with other roundings, and the underflow and overflow flags match +what would be obtained in the case the computed value is the same as with +@code{MPFR_RNDD} or @code{MPFR_RNDU}. +The results may not be reproducible. +@c Or should one guarantee reproducibility under some condition? +@c But this may be non-obvious if the caches may have an influence. + @anchor{ternary value}@cindex Ternary value Most MPFR functions take as first argument the destination variable, as second and following arguments the input variables, as last argument a @@ -843,11 +898,20 @@ @comment node-name, next, previous, up @section Exceptions -MPFR supports 6 exception types: +MPFR defines a global (or per-thread) flag for each supported exception. +A macro evaluating to a power of two is associated with each flag and +exception, in order to be able to specify a group of flags (or a mask) +by OR'ing such macros. + +Flags can be cleared (lowered), set (raised), and tested by functions +described in @ref{Exception Related Functions}. + +The supported exceptions are listed below. The macro associated with +each exception is in parentheses. @itemize @bullet -@item Underflow: +@item Underflow (@code{MPFR_FLAGS_UNDERFLOW}): An underflow occurs when the exact result of a function is a non-zero real number and the result obtained after the rounding, assuming an unbounded exponent range (for the rounding), has an exponent smaller @@ -870,7 +934,7 @@ representable in the current exponent range. As a consequence, this will not yield an underflow in MPFR@. -@item Overflow: +@item Overflow (@code{MPFR_FLAGS_OVERFLOW}): An overflow occurs when the exact result of a function is a non-zero real number and the result obtained after the rounding, assuming an unbounded exponent range (for the rounding), has an exponent larger @@ -879,18 +943,18 @@ Note: unlike the underflow case, there is only one possible definition of overflow here. -@item Divide-by-zero: +@item Divide-by-zero (@code{MPFR_FLAGS_DIVBY0}): An exact infinite result is obtained from finite inputs. -@item NaN: +@item NaN (@code{MPFR_FLAGS_NAN}): A NaN exception occurs when the result of a function is NaN@. @c NaN is defined above. So, we don't say anything more. -@item Inexact: +@item Inexact (@code{MPFR_FLAGS_INEXACT}): An inexact exception occurs when the result of a function cannot be represented exactly and must be rounded. -@item Range error: +@item Range error (@code{MPFR_FLAGS_ERANGE}): A range exception occurs when a function that does not return a MPFR number (such as comparisons and conversions to an integer) has an invalid result (e.g., an argument is NaN in @code{mpfr_cmp}, or a @@ -898,8 +962,9 @@ @end itemize -MPFR has a global flag for each exception, which can be cleared, set -or tested by functions described in @ref{Exception Related Functions}. +Moreover, the group consisting of all the flags is represented by +the @code{MPFR_FLAGS_ALL} macro (if new flags are added in future +MPFR versions, they will be added to this macro too). Differences with the ISO C99 standard: @@ -915,7 +980,7 @@ @end itemize -@node Memory Handling, , Exceptions, MPFR Basics +@node Memory Handling, Getting the Best Efficiency Out of MPFR, Exceptions, MPFR Basics @comment node-name, next, previous, up @section Memory Handling @@ -923,11 +988,49 @@ as @m{\pi,Pi}, either because the user has called a function like @code{mpfr_const_pi} directly or because such a function was called internally by the MPFR library itself to compute some other function. +When more precision is needed, the value is automatically recomputed; +a minimum of 10% increase of the precision is guaranteed to avoid too +many recomputations. + +MPFR functions may also create thread-local pools for internal use +to avoid the cost of memory allocation. The pools can be freed with +@code{mpfr_free_pool} (but with a default MPFR build, they should not +take much memory, as the allocation size is limited). + +At any time, the user can free various caches and pools with +@code{mpfr_free_cache} and @code{mpfr_free_cache2}. It is strongly advised +to free thread-local caches before terminating a thread, and all caches +before exiting when using tools like @samp{valgrind} (to avoid memory leaks +being reported). -At any time, the user can free the various caches with -@code{mpfr_free_cache}. It is strongly advised to do that before -terminating a thread, or before exiting when using tools like -@samp{valgrind} (to avoid memory leaks being reported). +MPFR allocates its memory either on the stack (for temporary memory only) +or with the same allocator as the one configured for GMP: +@ifinfo +@pxref{Custom Allocation,,, gmp.info,GNU MP}. +@end ifinfo +@ifnotinfo +see Section ``Custom Allocation'' in @cite{GNU MP}. +@end ifnotinfo +This means that the application must make sure that data allocated with the +current allocator will not be reallocated or freed with a new allocator. +So, in practice, if an application needs to change the allocator with +@code{mp_set_memory_functions}, it should first free all data allocated +with the current allocator: for its own data, with @code{mpfr_clear}, +etc.; for the caches and pools, with @code{mpfr_mp_memory_cleanup} in +all threads where MPFR is potentially used. This function is currently +equivalent to @code{mpfr_free_cache}, but @code{mpfr_mp_memory_cleanup} +is the recommended way in case the allocation method changes in the future +(for instance, one may choose to allocate the caches for floating-point +constants with @code{malloc} to avoid freeing them if the allocator +changes). Developers should also be aware that MPFR may also be used +indirectly by libraries, so that libraries based on MPFR should provide +a clean-up function calling @code{mpfr_mp_memory_cleanup} and/or warn +their users about this issue. + +@c This is important for shared caches. +Note: For multithreaded applications, the allocator must be valid in +all threads where MPFR may be used; data allocated in one thread may +be reallocated and/or freed in some other thread. MPFR internal data such as flags, the exponent range, the default precision and rounding mode, and caches (i.e., data that are not @@ -943,6 +1046,42 @@ @c is just a GCC extension. There is currently no clear documentation @c about TLS variable initialization. +Writers of libraries using MPFR should be aware that the application and/or +another library used by the application may also use MPFR, so that changing +the exponent range, the default precision, or the default rounding mode may +have an effect on this other use of MPFR since these data are not duplicated +(unless they are in a different thread). Therefore any such value changed in +a library function should be restored before the function returns (unless +the purpose of the function is to do such a change). Writers of software +using MPFR should also be careful when changing such a value if they use +a library using MPFR (directly or indirectly), in order to make sure that +such a change is compatible with the library. + +@node Getting the Best Efficiency Out of MPFR, , Memory Handling, MPFR Basics +@comment node-name, next, previous, up +@section Getting the Best Efficiency Out of MPFR + +Here are a few hints to get the best efficiency out of MPFR: + +@itemize @bullet + +@item you should avoid allocating and clearing variables. Reuse variables + whenever possible, allocate or clear outside of loops, pass + temporary variables to subroutines instead of allocating them inside + the subroutines; + +@item use @code{mpfr_swap} instead of @code{mpfr_set} whenever possible. + This will avoid copying the significands; + +@item avoid using MPFR from C++, or make sure your C++ interface does not + perform unnecessary allocations or copies; + +@item MPFR functions work in-place: to compute @code{a = a + b} you don't + need an auxiliary variable, you can directly write + @code{mpfr_add (a, a, b, ...)}. + +@end itemize + @node MPFR Interface, API Compatibility, MPFR Basics, Top @comment node-name, next, previous, up @chapter MPFR Interface @@ -978,8 +1117,10 @@ only a few significant bits, and their product is stored in a variable with large precision, then MPFR will still compute the result with full precision. -The value of the standard C macro @code{errno} may be set to non-zero by -any MPFR function or macro, whether or not there is an error. +The value of the standard C macro @code{errno} may be set to non-zero after +calling any MPFR function or macro, whether or not there is an error. Except +when documented, MPFR will not set @code{errno}, but functions called by the +MPFR code (libc functions, memory allocator, etc.) may do so. @menu * Initialization Functions:: @@ -991,8 +1132,8 @@ * Special Functions:: * Input and Output Functions:: * Formatted Output Functions:: -* Integer Related Functions:: -* Rounding Related Functions:: +* Integer and Remainder Related Functions:: +* Rounding-Related Functions:: * Miscellaneous Functions:: * Exception Related Functions:: * Compatibility with MPF:: @@ -1126,7 +1267,7 @@ initialized variables are unaffected. The default precision is set to 53 bits initially. -Note: when MPFR is built with the @code{--enable-thread-safe} configure option, +Note: when MPFR is built with the @samp{--enable-thread-safe} configure option, the default precision is local to each thread. @xref{Memory Handling}, for more information. @end deftypefun @@ -1195,6 +1336,7 @@ @deftypefunx int mpfr_set_flt (mpfr_t @var{rop}, float @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_set_d (mpfr_t @var{rop}, double @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_set_ld (mpfr_t @var{rop}, long double @var{op}, mpfr_rnd_t @var{rnd}) +@deftypefunx int mpfr_set_float128 (mpfr_t @var{rop}, __float128 @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_set_decimal64 (mpfr_t @var{rop}, _Decimal64 @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_set_z (mpfr_t @var{rop}, mpz_t @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_set_q (mpfr_t @var{rop}, mpq_t @var{op}, mpfr_rnd_t @var{rnd}) @@ -1203,23 +1345,30 @@ toward the given direction @var{rnd}. Note that the input 0 is converted to +0 by @code{mpfr_set_ui}, @code{mpfr_set_si}, @code{mpfr_set_uj}, @code{mpfr_set_sj}, +The @code{mpfr_set_float128} function is built only with the configure +option @samp{--enable-float128}, which requires the compiler or +system provides the @samp{__float128} data type +(GCC 4.3 or later supports this data type); +to use @code{mpfr_set_float128}, one should define the macro +@code{MPFR_WANT_FLOAT128} before including @file{mpfr.h}. @code{mpfr_set_z}, @code{mpfr_set_q} and @code{mpfr_set_f}, regardless of the rounding mode. If the system does not support the IEEE 754 standard, @code{mpfr_set_flt}, @code{mpfr_set_d}, @code{mpfr_set_ld} and @code{mpfr_set_decimal64} might not preserve the signed zeros. The @code{mpfr_set_decimal64} function is built only with the configure -option @samp{--enable-decimal-float}, which also requires -@samp{--with-gmp-build}, and when the compiler or +option @samp{--enable-decimal-float}, and when the compiler or system provides the @samp{_Decimal64} data type (recent versions of GCC support this data type); to use @code{mpfr_set_decimal64}, one should define the macro @code{MPFR_WANT_DECIMAL_FLOATS} before including @file{mpfr.h}. -@c GCC 4.2.0 required to be configured with --enable-decimal-float -@c but GCC 4.4.3 seems to have decimal support by default @code{mpfr_set_q} might fail if the numerator (or the denominator) can not be represented as a @code{mpfr_t}. +For @code{mpfr_set}, the sign of a NaN is propagated in order to mimic the +IEEE 754 @code{copy} operation. But contrary to IEEE 754, the NaN flag is +set as usual. + Note: If you want to store a floating-point constant to a @code{mpfr_t}, you should use @code{mpfr_set_str} (or one of the MPFR constant functions, such as @code{mpfr_const_pi} for @m{\pi,Pi}) instead of @@ -1249,7 +1398,7 @@ Contrary to @code{mpfr_strtofr}, @code{mpfr_set_str} requires the @emph{whole} string to represent a valid floating-point number. @c Additionally, special values -@c @code{@@NaN@@}, @code{@@Inf@@}, @code{+@@Inf@@} and @code{-@@Inf@@}, +@c @samp{@@NaN@@}, @samp{@@Inf@@}, @samp{+@@Inf@@} and @samp{-@@Inf@@}, @c all case insensitive, without leading whitespace and possibly followed by @c other characters, are accepted too (it may change). @@ -1278,7 +1427,7 @@ Parsing follows the standard C @code{strtod} function with some extensions. After optional leading whitespace, one has a subject sequence consisting of an -optional sign (@code{+} or @code{-}), and either numeric data or special +optional sign (@samp{+} or @samp{-}), and either numeric data or special data. The subject sequence is defined as the longest initial subsequence of the input string, starting with the first non-whitespace character, that is of the expected form. @@ -1287,45 +1436,45 @@ optional decimal point, and an optional exponent consisting of an exponent prefix followed by an optional sign and a non-empty sequence of decimal digits. A significand digit is either a decimal digit or a Latin letter (62 -possible characters), with @code{A} = 10, @code{B} = 11, @dots{}, @code{Z} = +possible characters), with @samp{A} = 10, @samp{B} = 11, @dots{}, @samp{Z} = 35; case is ignored in bases less or equal to 36, in bases larger than 36, -@code{a} = 36, @code{b} = 37, @dots{}, @code{z} = 61. +@samp{a} = 36, @samp{b} = 37, @dots{}, @samp{z} = 61. The value of a significand digit must be strictly less than the base. The decimal point can be either the one defined by the current locale or the period (the first one is accepted for consistency with the C standard and the practice, the second one is accepted to allow the programmer to provide MPFR numbers from strings in a way that does not depend on the current locale). -The exponent prefix can be @code{e} or @code{E} for bases up to 10, or -@code{@@} in any base; it indicates a multiplication by a power of the -base. In bases 2 and 16, the exponent prefix can also be @code{p} or @code{P}, +The exponent prefix can be @samp{e} or @samp{E} for bases up to 10, or +@samp{@@} in any base; it indicates a multiplication by a power of the +base. In bases 2 and 16, the exponent prefix can also be @samp{p} or @samp{P}, in which case the exponent, called @emph{binary exponent}, indicates a multiplication by a power of 2 instead of the base (there is a difference -only for base 16); in base 16 for example @code{1p2} represents 4 whereas -@code{1@@2} represents 256. The value of an exponent is always written in +only for base 16); in base 16 for example @samp{1p2} represents 4 whereas +@samp{1@@2} represents 256. The value of an exponent is always written in base 10. If the argument @var{base} is 0, then the base is automatically detected -as follows. If the significand starts with @code{0b} or @code{0B}, base 2 -is assumed. If the significand starts with @code{0x} or @code{0X}, base 16 +as follows. If the significand starts with @samp{0b} or @samp{0B}, base 2 +is assumed. If the significand starts with @samp{0x} or @samp{0X}, base 16 is assumed. Otherwise base 10 is assumed. Note: The exponent (if present) must contain at least a digit. Otherwise the possible exponent prefix and sign are not part of the number (which ends with the -significand). Similarly, if @code{0b}, @code{0B}, @code{0x} or @code{0X} +significand). Similarly, if @samp{0b}, @samp{0B}, @samp{0x} or @samp{0X} is not followed by a binary/hexadecimal digit, then the subject sequence -stops at the character @code{0}, thus 0 is read. +stops at the character @samp{0}, thus 0 is read. -Special data (for infinities and NaN) can be @code{@@inf@@} or -@code{@@nan@@(n-char-sequence-opt)}, and if @math{@var{base} @le{} 16}, -it can also be @code{infinity}, @code{inf}, @code{nan} or -@code{nan(n-char-sequence-opt)}, all case insensitive. -A @code{n-char-sequence-opt} is a possibly empty string containing only digits, +Special data (for infinities and NaN) can be @samp{@@inf@@} or +@samp{@@nan@@(n-char-sequence-opt)}, and if @math{@var{base} @le{} 16}, +it can also be @samp{infinity}, @samp{inf}, @samp{nan} or +@samp{nan(n-char-sequence-opt)}, all case insensitive. +A @samp{n-char-sequence-opt} is a possibly empty string containing only digits, Latin letters and the underscore (0, 1, 2, @dots{}, 9, a, b, @dots{}, z, A, B, @dots{}, Z, _). Note: one has an optional sign for all data, even NaN@. -For example, @code{-@@nAn@@(This_Is_Not_17)} is a valid representation for NaN +For example, @samp{-@@nAn@@(This_Is_Not_17)} is a valid representation for NaN in base 17. @end deftypefun @@ -1386,6 +1535,7 @@ @deftypefun float mpfr_get_flt (mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx double mpfr_get_d (mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx {long double} mpfr_get_ld (mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) +@deftypefunx {__float128} mpfr_get_float128 (mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx _Decimal64 mpfr_get_decimal64 (mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) Convert @var{op} to a @code{float} (respectively @code{double}, @code{long double} or @code{_Decimal64}), using the rounding mode @var{rnd}. @@ -1393,8 +1543,9 @@ of 0.0/0.0 is returned. If @var{op} is @pom{}Inf, an infinity of the same sign or the result of @pom{}1.0/0.0 is returned. If @var{op} is zero, these functions return a zero, trying to preserve its sign, if possible. -The @code{mpfr_get_decimal64} function is built only under some conditions: -see the documentation of @code{mpfr_set_decimal64}. +The @code{mpfr_get_float128} and @code{mpfr_get_decimal64} functions are built +only under some conditions: see the documentation of @code{mpfr_set_float128} +and @code{mpfr_set_decimal64} respectively. @end deftypefun @deftypefun long mpfr_get_si (mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @@ -1403,11 +1554,26 @@ @deftypefunx uintmax_t mpfr_get_uj (mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) Convert @var{op} to a @code{long}, an @code{unsigned long}, an @code{intmax_t} or an @code{uintmax_t} (respectively) after rounding -it with respect to @var{rnd}. +it to an integer with respect to @var{rnd}. If @var{op} is NaN, 0 is returned and the @emph{erange} flag is set. If @var{op} is too big for the return type, the function returns the maximum or the minimum of the corresponding C type, depending on the direction of the overflow; the @emph{erange} flag is set too. +When there is no such range error, if the return value differs from +@var{op}, i.e., if @var{op} is not an integer, the inexact flag is set. +@c For the flag specification, we simply followed the historical behavior. +@c See . +@c In summary, this was a consequence of the use of mpfr_rint in case of +@c no range error. IEEE 754-2008 specifies two kinds of operations: with +@c inexact flag either affected or not. Here this is the former kind of +@c operations. The easiest way to get the latter kind of operations is to +@c save the status of the inexact flag just before the call and restore it +@c just after (but in user code, there may be other possibilities); this +@c can be done with mpfr_inexflag_p and mpfr_set_inexflag (knowing that +@c the inexact flag can only be set, never cleared). A more readable way +@c with MPFR 4.0+ is to use mpfr_flags_test or mpfr_flags_save to save +@c the status of the inexact flag, and mpfr_flags_restore to restore it. +@c The mpfr_get_z function follows the same specification. See also @code{mpfr_fits_slong_p}, @code{mpfr_fits_ulong_p}, @code{mpfr_fits_intmax_p} and @code{mpfr_fits_uintmax_p}. @end deftypefun @@ -1465,7 +1631,17 @@ @deftypefun int mpfr_get_z (mpz_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) Convert @var{op} to a @code{mpz_t}, after rounding it with respect to @var{rnd}. If @var{op} is NaN or an infinity, the @emph{erange} flag is -set, @var{rop} is set to 0, and 0 is returned. +set, @var{rop} is set to 0, and 0 is returned. Otherwise the return +value is zero when @var{rop} is equal to @var{op} (i.e., when @var{op} +is an integer), positive when it is greater than @var{op}, and negative +when it is smaller than @var{op}; moreover, if @var{rop} differs from +@var{op}, i.e., if @var{op} is not an integer, the inexact flag is set. +@end deftypefun + +@deftypefun void mpfr_get_q (mpq_t @var{rop}, mpfr_t @var{op}) +Convert @var{op} to a @code{mpq_t}. +If @var{op} is NaN or an infinity, the @emph{erange} flag is +set and @var{rop} is set to 0. Otherwise the conversion is always exact. @end deftypefun @deftypefun int mpfr_get_f (mpf_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @@ -1485,12 +1661,26 @@ @end deftypefun @deftypefun {char *} mpfr_get_str (char *@var{str}, mpfr_exp_t *@var{expptr}, int @var{b}, size_t @var{n}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) -Convert @var{op} to a string of digits in base @var{b}, with rounding in -the direction @var{rnd}, where @var{n} is either zero (see below) or the -number of significant digits output in the string; in the latter case, -@var{n} must be greater or equal to 2. The base may vary from 2 to 62; +Convert @var{op} to a string of digits in base @GMPabs{@var{b}}, with +rounding in the direction @var{rnd}, where @var{n} is either zero +(see below) or the number of significant digits output in the string. +The argument @var{b} may vary from 2 to 62 or from @minus{}2 to @minus{}36; otherwise the function does nothing and immediately returns a null pointer. -If the input number is an ordinary number, the exponent is written through + +For @var{b} in the range 2 to 36, digits and lower-case letters are used; +for @minus{}2 to @minus{}36, digits and upper-case letters are used; for +37 to 62, digits, upper-case letters, and lower-case letters, in that +significance order, are used. Warning! This implies that for +@math{@var{b} > 10}, the successor of the digit 9 depends on @var{b}. +This choice has been done for compatibility with GMP's @code{mpf_get_str} +function. Users who wish a more consistent behavior should write a simple +wrapper. + +If the input is NaN, then the returned string is @samp{@@NaN@@} and the +NaN flag is set. If the input is +Inf (resp.@: @minus{}Inf), then the +returned string is @samp{@@Inf@@} (resp.@: @samp{-@@Inf@@}). + +If the input number is a finite number, the exponent is written through the pointer @var{expptr} (for input 0, the current minimal exponent is written); the type @code{mpfr_exp_t} is large enough to hold the exponent in all cases. @@ -1520,41 +1710,34 @@ m = 1 + ceil(@var{p}*log(2)/log(@var{b})), @end ifnottex @tex -$m = 1 + \lceil p {\log 2 \over \log b} \rceil$, +$m = 1 + \left\lceil @var{p} {\log 2 \over \log @var{b}} \right\rceil$, @end tex with @var{p} replaced by @var{p}@minus{}1 if @var{b} is a power of 2, but in some very rare cases, it might be @math{m+1} (the smallest case for bases up to 62 is when @var{p} equals 186564318007 for bases 7 and 49). +@c In the source src/get_str.c, this is due to the approximate mpfr_ceil_mul. If @var{str} is a null pointer, space for the significand is allocated using -the current allocation function and a pointer to the string is returned -(unless the base is invalid). +the allocation function (@pxref{Memory Handling}) and a pointer to the string +is returned (unless the base is invalid). To free the returned string, you must use @code{mpfr_free_str}. If @var{str} is not a null pointer, it should point to a block of storage -large enough for the significand, i.e., at least @code{max(@var{n} + 2, 7)}. -The extra two bytes are for a possible minus sign, and for the terminating null -character, and the value 7 accounts for @code{-@@Inf@@} -plus the terminating null character. The pointer to the string @var{str} -is returned (unless the base is invalid). +large enough for the significand. A safe block size (sufficient for any +value) is @code{max(@var{n} + 2, 7)} if @var{n} is not zero; if @var{n} is +zero, replace it by @math{m+1}, as discussed above. The extra two bytes are +for a possible minus sign, and for the terminating null character, and the +value 7 accounts for @samp{-@@Inf@@} plus the terminating null character. +The pointer to the string @var{str} is returned (unless the base is invalid). -Note: The NaN and inexact flags are currently not set when need be; this -will be fixed in future versions. Programmers should currently assume that -whether the flags are set by this function is unspecified. +Like in usual functions, the inexact flag is set iff the result is inexact. @end deftypefun @deftypefun void mpfr_free_str (char *@var{str}) -Free a string allocated by @code{mpfr_get_str} using the current unallocation -function. +Free a string allocated by @code{mpfr_get_str} using the unallocation +function (@pxref{Memory Handling}). The block is assumed to be @code{strlen(@var{str})+1} bytes. -For more information about how it is done: -@ifinfo -@pxref{Custom Allocation,,, gmp.info,GNU MP}. -@end ifinfo -@ifnotinfo -see Section ``Custom Allocation'' in @cite{GNU MP}. -@end ifnotinfo @end deftypefun @deftypefun int mpfr_fits_ulong_p (mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @@ -1569,6 +1752,14 @@ respectively @code{unsigned long}, @code{long}, @code{unsigned int}, @code{int}, @code{unsigned short}, @code{short}, @code{uintmax_t}, @code{intmax_t}, when rounded to an integer in the direction @var{rnd}. +For instance, with the @code{MPFR_RNDU} rounding mode on @minus{}0.5, +the result will be non-zero for all these functions. +For @code{MPFR_RNDF}, those functions return non-zero when it is guaranteed +that the corresponding conversion function (for example @code{mpfr_get_ui} +for @code{mpfr_fits_ulong_p}), when called with faithful rounding, +will always return a number that is representable in the corresponding type. +As a consequence, for @code{MPFR_RNDF}, @code{mpfr_fits_ulong_p} will return +non-zero for a non-negative number less or equal to @code{ULONG_MAX}. @end deftypefun @node Basic Arithmetic Functions, Comparison Functions, Conversion Functions, MPFR Interface @@ -1585,7 +1776,7 @@ @deftypefunx int mpfr_add_z (mpfr_t @var{rop}, mpfr_t @var{op1}, mpz_t @var{op2}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_add_q (mpfr_t @var{rop}, mpfr_t @var{op1}, mpq_t @var{op2}, mpfr_rnd_t @var{rnd}) Set @var{rop} to @math{@var{op1} + @var{op2}} rounded in the direction -@var{rnd}. The IEEE-754 rules are used, in particular for signed zeros. +@var{rnd}. The IEEE 754 rules are used, in particular for signed zeros. But for types having no signed zeros, 0 is considered unsigned (i.e., (+0) + 0 = (+0) and (@minus{}0) + 0 = (@minus{}0)). The @code{mpfr_add_d} function assumes that the radix of the @code{double} type @@ -1604,7 +1795,7 @@ @deftypefunx int mpfr_sub_z (mpfr_t @var{rop}, mpfr_t @var{op1}, mpz_t @var{op2}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_sub_q (mpfr_t @var{rop}, mpfr_t @var{op1}, mpq_t @var{op2}, mpfr_rnd_t @var{rnd}) Set @var{rop} to @math{@var{op1} - @var{op2}} rounded in the direction -@var{rnd}. The IEEE-754 rules are used, in particular for signed zeros. +@var{rnd}. The IEEE 754 rules are used, in particular for signed zeros. But for types having no signed zeros, 0 is considered unsigned (i.e., (+0) @minus{} 0 = (+0), (@minus{}0) @minus{} 0 = (@minus{}0), 0 @minus{} (+0) = (@minus{}0) and 0 @minus{} (@minus{}0) = (+0)). @@ -1640,8 +1831,11 @@ @deftypefunx int mpfr_div_z (mpfr_t @var{rop}, mpfr_t @var{op1}, mpz_t @var{op2}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_div_q (mpfr_t @var{rop}, mpfr_t @var{op1}, mpq_t @var{op2}, mpfr_rnd_t @var{rnd}) Set @var{rop} to @math{@var{op1}/@var{op2}} rounded in the direction @var{rnd}. -When a result is zero, its sign is the product of the signs of the operands -(for types having no signed zeros, 0 is considered positive). +When a result is zero, its sign is the product of the signs of the operands. +For types having no signed zeros, 0 is considered positive; but note that if +@var{op1} is non-zero and @var{op2} is zero, the result might change from +@pom{}Inf to NaN in future MPFR versions if there is an opposite decision +on the IEEE 754 side. The same restrictions than for @code{mpfr_add_d} apply to @code{mpfr_d_div} and @code{mpfr_div_d}. @end deftypefun @@ -1664,13 +1858,29 @@ @end deftypefun @deftypefun int mpfr_cbrt (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) -@deftypefunx int mpfr_root (mpfr_t @var{rop}, mpfr_t @var{op}, unsigned long int @var{k}, mpfr_rnd_t @var{rnd}) +@deftypefunx int mpfr_rootn_ui (mpfr_t @var{rop}, mpfr_t @var{op}, unsigned long int @var{k}, mpfr_rnd_t @var{rnd}) Set @var{rop} to the cubic root (resp.@: the @var{k}th root) of @var{op} rounded in the direction @var{rnd}. +For @var{k} = 0, set @var{rop} to NaN@. For @var{k} odd (resp.@: even) and @var{op} negative (including @minus{}Inf), set @var{rop} to a negative number (resp.@: NaN)@. -The @var{k}th root of @minus{}0 is defined to be @minus{}0, -whatever the parity of @var{k}. +If @var{op} is zero, set @var{rop} to zero with the sign obtained by the +usual limit rules, i.e., the same sign as @var{op} if @var{k} is odd, and +positive if @var{k} is even. + +These functions agree with the rootn function of the IEEE 754-2008 standard +(Section 9.2). +@end deftypefun + +@deftypefun int mpfr_root (mpfr_t @var{rop}, mpfr_t @var{op}, unsigned long int @var{k}, mpfr_rnd_t @var{rnd}) +This function is the same as @code{mpfr_rootn_ui} except when @var{op} +is @minus{}0 and @var{k} is even: the result is @minus{}0 instead of +0 +(the reason was to be consistent with @code{mpfr_sqrt}). Said otherwise, +if @var{op} is zero, set @var{rop} to @var{op}. + +This function predates the IEEE 754-2008 standard and behaves differently +from its rootn function. It is marked as deprecated and will be removed in +a future release. @end deftypefun @deftypefun int mpfr_pow (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd}) @@ -1700,6 +1910,9 @@ @item @code{pow(-Inf, @var{y})} returns plus infinity for @var{y} positive and not an odd integer. @item @code{pow(+Inf, @var{y})} returns plus zero for @var{y} negative, and plus infinity for @var{y} positive. @end itemize +Note: When 0 is of integer type, it is regarded as +0 by these functions. +We do not use the usual limit rules in this case, as these rules are not +used for @code{pow}. @end deftypefun @deftypefun int mpfr_neg (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @@ -1710,6 +1923,11 @@ the sign if @var{rop} and @var{op} are the same variable, otherwise a rounding might occur if the precision of @var{rop} is less than that of @var{op}. + +The sign rule also applies to NaN in order to mimic the IEEE 754 +@code{negate} and @code{abs} operations, i.e., for @code{mpfr_neg}, the +sign is reversed, and for @code{mpfr_abs}, the sign is set to positive. +But contrary to IEEE 754, the NaN flag is set as usual. @end deftypefun @deftypefun int mpfr_dim (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd}) @@ -1766,7 +1984,7 @@ @deftypefun int mpfr_cmp_ui_2exp (mpfr_t @var{op1}, unsigned long int @var{op2}, mpfr_exp_t @var{e}) @deftypefunx int mpfr_cmp_si_2exp (mpfr_t @var{op1}, long int @var{op2}, mpfr_exp_t @var{e}) -Compare @var{op1} and @m{@var{op2} \times 2^e, @var{op2} multiplied by two to +Compare @var{op1} and @m{@var{op2} \times 2^{@var{e}}, @var{op2} multiplied by two to the power @var{e}}. Similar as above. @end deftypefun @@ -1830,11 +2048,16 @@ exact return value, a positive value for a return value larger than the exact result, and a negative value otherwise. -Important note: in some domains, computing special functions (either with -correct or incorrect rounding) is expensive, even for small precision, +Important note: in some domains, computing special functions (even more +with correct rounding) is expensive, even for small precision, for example the trigonometric and Bessel functions for large argument. +For some functions, the memory usage might depend not only on the output +precision: it is the case of the @code{mpfr_rootn_ui} function where the +memory usage is also linear in the argument @var{k}, +and of the incomplete Gamma function (dependence on the precision of @var{op}). @deftypefun int mpfr_log (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) +@deftypefunx int mpfr_log_ui (mpfr_t @var{rop}, unsigned long @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_log2 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_log10 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) Set @var{rop} to the natural logarithm of @var{op}, @@ -1847,6 +2070,12 @@ (i.e., the sign of the zero has no influence on the result). @end deftypefun +@deftypefun int mpfr_log1p (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) +Set @var{rop} to the logarithm of one plus @var{op}, +rounded in the direction @var{rnd}. +Set @var{rop} to @minus{}Inf if @var{op} is @minus{}1. +@end deftypefun + @deftypefun int mpfr_exp (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_exp2 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_exp10 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @@ -1856,6 +2085,11 @@ rounded in the direction @var{rnd}. @end deftypefun +@deftypefun int mpfr_expm1 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) +Set @var{rop} to @m{e^{op}-1,the exponential of @var{op} followed by a +subtraction by one}, rounded in the direction @var{rnd}. +@end deftypefun + @deftypefun int mpfr_cos (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_sin (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_tan (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @@ -1887,7 +2121,7 @@ rounded in the direction @var{rnd}. Note that since @code{acos(-1)} returns the floating-point number closest to @m{\pi,Pi} according to the given rounding mode, this number might not be -in the output range @math{0 @le{} @var{rop} < \pi} +in the output range @m{0 @le{} @var{rop} < \pi,0 @le{} @var{rop} < Pi} of the arc-cosine function; still, the result lies in the image of the output range by the rounding function. @@ -1900,8 +2134,8 @@ @deftypefun int mpfr_atan2 (mpfr_t @var{rop}, mpfr_t @var{y}, mpfr_t @var{x}, mpfr_rnd_t @var{rnd}) Set @var{rop} to the arc-tangent2 of @var{y} and @var{x}, rounded in the direction @var{rnd}: -if @code{x > 0}, @code{atan2(y, x) = atan (y/x)}; -if @code{x < 0}, @code{atan2(y, x) = sign(y)*(Pi - atan (@GMPabs{y/x}))}, +if @code{x > 0}, @code{atan2(y, x) = atan(y/x)}; +if @code{x < 0}, @code{atan2(y, x) = sign(y)*(Pi - atan(@GMPabs{y/x}))}, thus a number from @m{-\pi,-Pi} to @m{\pi,Pi}. As for @code{atan}, in case the exact mathematical result is @m{+\pi,+Pi} or @m{-\pi,-Pi}, @@ -1968,47 +2202,46 @@ Set @var{rop} to the factorial of @var{op}, rounded in the direction @var{rnd}. @end deftypefun -@deftypefun int mpfr_log1p (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) -Set @var{rop} to the logarithm of one plus @var{op}, -rounded in the direction @var{rnd}. -@end deftypefun - -@deftypefun int mpfr_expm1 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) -Set @var{rop} to @m{e^{op}-1,the exponential of @var{op} followed by a -subtraction by one}, rounded in the direction @var{rnd}. -@end deftypefun - @deftypefun int mpfr_eint (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) Set @var{rop} to the exponential integral of @var{op}, rounded in the direction @var{rnd}. -For positive @var{op}, -the exponential integral is the sum of Euler's constant, of the logarithm -of @var{op}, and of the sum for k from 1 to infinity of +This is the sum of Euler's constant, of the logarithm +of the absolute value of @var{op}, and of the sum for k from 1 to infinity of @ifnottex @var{op} to the power k, divided by k and factorial(k). @end ifnottex @tex $@var{op}^k/(k \cdot k!)$. @end tex -For negative @var{op}, @var{rop} is set to NaN -(this definition for negative argument follows formula 5.1.2 from the -Handbook of Mathematical Functions from Abramowitz and Stegun, a future -version might use another definition). +For positive @var{op}, it corresponds to the Ei function at @var{op} +(see formula 5.1.10 from the Handbook of Mathematical Functions from +Abramowitz and Stegun), +and for negative @var{op}, to the opposite of the +E1 function (sometimes called eint1) +at @minus{}@var{op} (formula 5.1.1 from the same reference). @end deftypefun @deftypefun int mpfr_li2 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) Set @var{rop} to real part of the dilogarithm of @var{op}, rounded in the direction @var{rnd}. MPFR defines the dilogarithm function as -@m{-\int_{t=0}^{op} \log(1-t)/t\ dt,the integral of -log(1-t)/t from 0 +@m{-\int_{t=0}^{@var{op}} \log(1-t)/t\ dt,the integral of -log(1-t)/t from 0 to @var{op}}. -@c FIXME: It should be {@var{op}} instead of {op} above, but pdftex fails -@c on the correct form. @end deftypefun @deftypefun int mpfr_gamma (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) -Set @var{rop} to the value of the Gamma function on @var{op}, rounded in the -direction @var{rnd}. When @var{op} is a negative integer, @var{rop} is set -to NaN@. +@deftypefunx int mpfr_gamma_inc (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd}) +Set @var{rop} to the value of the Gamma function on @var{op}, resp. the +incomplete Gamma function on @var{op} and @var{op2}, +rounded in the direction @var{rnd}. +(In the literature, @code{mpfr_gamma_inc} is called upper +incomplete Gamma function, +or sometimes complementary incomplete Gamma function.) +For @code{mpfr_gamma} (and @code{mpfr_gamma_inc} when @var{op2} is zero), +when @var{op} is a negative integer, @var{rop} is set to NaN@. + +Note: the current implementation of @code{mpfr_gamma_inc} is slow for +large values of @var{rop} or @var{op}, in which case some internal overflow +might also occur. @end deftypefun @deftypefun int mpfr_lngamma (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @@ -2039,6 +2272,13 @@ When @var{op} is a negative integer, set @var{rop} to NaN@. @end deftypefun +@deftypefun int mpfr_beta (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd}) +Set @var{rop} to the value of the Beta function at arguments @var{op1} and +@var{op2}. +Note: the current code does not try to avoid internal overflow or underflow, +and might use a huge internal precision in some cases. +@end deftypefun + @deftypefun int mpfr_zeta (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_zeta_ui (mpfr_t @var{rop}, unsigned long @var{op}, mpfr_rnd_t @var{rnd}) Set @var{rop} to the value of the Riemann Zeta function on @var{op}, @@ -2085,6 +2325,17 @@ for rounding. @end deftypefun +@deftypefun int mpfr_fmma (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_t @var{op3}, mpfr_t @var{op4}, mpfr_rnd_t @var{rnd}) +@deftypefunx int mpfr_fmms (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_t @var{op3}, mpfr_t @var{op4}, mpfr_rnd_t @var{rnd}) +Set @var{rop} to @math{(@var{op1} @GMPtimes{} @var{op2}) + (@var{op3} @GMPtimes{} @var{op4})} +(resp.@: @math{(@var{op1} @GMPtimes{} @var{op2}) - (@var{op3} @GMPtimes{} @var{op4})}) +rounded in the direction @var{rnd}. +In case the computation of @math{@var{op1} @GMPtimes{} @var{op2}} overflows or +underflows (or that of @math{@var{op3} @GMPtimes{} @var{op4}}), the result +@var{rop} is computed as if the two intermediate products were computed with +rounding toward zero. +@end deftypefun + @deftypefun int mpfr_agm (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd}) Set @var{rop} to the arithmetic-geometric mean of @var{op1} and @var{op2}, rounded in the direction @var{rnd}. @@ -2095,7 +2346,10 @@ arithmetic mean of @m{u_n,@var{u}_@var{n}} and @m{v_n,@var{v}_@var{n}}, and @m{v_{n+1},@var{v}_(@var{n}+1)} is the geometric mean of @m{u_n,@var{u}_@var{n}} and @m{v_n,@var{v}_@var{n}}. -If any operand is negative, set @var{rop} to NaN@. +If any operand is negative and the other one is not zero, +set @var{rop} to NaN@. +If any operand is zero and the other one is finite (resp.@: infinite), +set @var{rop} to +0 (resp.@: NaN)@. @end deftypefun @deftypefun int mpfr_hypot (mpfr_t @var{rop}, mpfr_t @var{x}, mpfr_t @var{y}, mpfr_rnd_t @var{rnd}) @@ -2134,27 +2388,65 @@ respectively, rounded in the direction @var{rnd}. These functions cache the computed values to avoid other calculations if a lower or equal precision is requested. To free these caches, -use @code{mpfr_free_cache}. +use @code{mpfr_free_cache} or @code{mpfr_free_cache2}. @end deftypefun @deftypefun void mpfr_free_cache (void) -Free various caches used by MPFR internally, in particular the -caches used by the functions computing constants (@code{mpfr_const_log2}, -@code{mpfr_const_pi}, -@code{mpfr_const_euler} and @code{mpfr_const_catalan}). +Free all caches and pools used by MPFR internally (those local to the +current thread and those shared by all threads). You should call this function before terminating a thread, even if you did -not call these functions directly (they could have been called internally). +not call @code{mpfr_const_*} functions directly (they could have been called +internally). +@end deftypefun + +@deftypefun void mpfr_free_cache2 (mpfr_free_cache_t @var{way}) +Free various caches and pools used by MPFR internally, +as specified by @var{way}, which is a set of flags: +@itemize @bullet +@item those local to the current thread if flag @code{MPFR_FREE_LOCAL_CACHE} +is set; +@item those shared by all threads if flag @code{MPFR_FREE_GLOBAL_CACHE} +is set. +@end itemize +The other bits of @var{way} are currently ignored and are reserved for +future use; they should be zero. + +Note: @code{mpfr_free_cache2(MPFR_FREE_LOCAL_CACHE|MPFR_FREE_GLOBAL_CACHE)} +is currently equivalent to @code{mpfr_free_cache()}. +@end deftypefun + +@deftypefun void mpfr_free_pool (void) +Free the pools used by MPFR internally. +Note: This function is automatically called after the thread-local caches +are freed (with @code{mpfr_free_cache} or @code{mpfr_free_cache2}). +@end deftypefun + +@deftypefun int mpfr_mp_memory_cleanup (void) +This function should be called before calling @code{mp_set_memory_functions}. +@xref{Memory Handling}, for more information. +Zero is returned in case of success, non-zero in case of error. +Errors are currently not possible, but checking the return value +is recommended for future compatibility. @end deftypefun -@deftypefun int mpfr_sum (mpfr_t @var{rop}, mpfr_ptr const @var{tab}[], unsigned long int @var{n}, mpfr_rnd_t @var{rnd}) +@deftypefun int mpfr_sum (mpfr_t @var{rop}, const mpfr_ptr @var{tab}[], unsigned long int @var{n}, mpfr_rnd_t @var{rnd}) Set @var{rop} to the sum of all elements of @var{tab}, whose size is @var{n}, -rounded in the direction @var{rnd}. Warning: for efficiency reasons, +correctly rounded in the direction @var{rnd}. Warning: for efficiency reasons, @var{tab} is an array of pointers to @code{mpfr_t}, not an array of @code{mpfr_t}. -If the returned @code{int} value is zero, @var{rop} is guaranteed to be the -exact sum; otherwise @var{rop} might be smaller than, equal to, or larger than -the exact sum (in accordance to the rounding mode). -However, @code{mpfr_sum} does guarantee the result is correctly rounded. +If @var{n} = 0, then the result is +0, and if @var{n} = 1, then the function +is equivalent to @code{mpfr_set}. +For the special exact cases, the result is the same as the one obtained +with a succession of additions (@code{mpfr_add}) in infinite precision. +In particular, if the result is an exact zero and @math{@var{n} @ge{} 1}: +@itemize @bullet +@item if all the inputs have the same sign (i.e., all +0 or all @minus{}0), +then the result has the same sign as the inputs; +@item otherwise, either because all inputs are zeros with at least a +0 and +a @minus{}0, or because some inputs are non-zero (but they globally cancel), +the result is +0, except for the @code{MPFR_RNDD} rounding mode, where it is +@minus{}0. +@end itemize @end deftypefun @node Input and Output Functions, Formatted Output Functions, Special Functions, MPFR Interface @@ -2170,9 +2462,9 @@ Passing a null pointer for a @code{stream} to any of these functions will make them read from @code{stdin} and write to @code{stdout}, respectively. -When using any of these functions, you must include the @code{} -standard header before @file{mpfr.h}, to allow @file{mpfr.h} to define -prototypes for these functions. +When using a function that takes a @code{FILE *} argument, you must +include the @code{} standard header before @file{mpfr.h}, +to allow @file{mpfr.h} to define prototypes for these functions. @deftypefun size_t mpfr_out_str (FILE *@var{stream}, int @var{base}, size_t @var{n}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) Output @var{op} on stream @var{stream}, as a string of digits in @@ -2208,10 +2500,10 @@ See the documentation of @code{mpfr_strtofr} for a detailed description of the valid string formats. @c Special values can be read as follows (the case does not matter): -@c @code{@@NaN@@}, @code{@@Inf@@}, @code{+@@Inf@@} and @code{-@@Inf@@}, +@c @samp{@@NaN@@}, @samp{@@Inf@@}, @samp{+@@Inf@@} and @samp{-@@Inf@@}, @c possibly followed by other characters; if the base is smaller or equal -@c to 16, the following strings are accepted too: @code{NaN}, @code{Inf}, -@c @code{+Inf} and @code{-Inf}. +@c to 16, the following strings are accepted too: @samp{NaN}, @samp{Inf}, +@c @samp{+Inf} and @samp{-Inf}. Return the number of bytes read, or if an error occurred, return 0. @end deftypefun @@ -2221,7 +2513,59 @@ @c @code{mpfr_out_raw}, and put the result in @var{float}. @c @end deftypefun -@node Formatted Output Functions, Integer Related Functions, Input and Output Functions, MPFR Interface +@deftypefun int mpfr_fpif_export (FILE *@var{stream}, mpfr_t @var{op}) +Export the number @var{op} to the stream @var{stream} in a floating-point +interchange format. +In particular one can export on a 32-bit computer and import on a 64-bit +computer, or export on a little-endian computer and import on a big-endian +computer. +The precision of @var{op} and the sign bit of a NaN are stored too. +Return 0 iff the export was successful. + +Note: this function is experimental and its interface might change in future +versions. +@end deftypefun + +@deftypefun int mpfr_fpif_import (mpfr_t @var{op}, FILE *@var{stream}) +Import the number @var{op} from the stream @var{stream} in a floating-point +interchange format (see @code{mpfr_fpif_export}). +Note that the precision of @var{op} is set to the one read from the stream, +and the sign bit is always retrieved (even for NaN)@. +If the stored precision is zero or greater than @code{MPFR_PREC_MAX}, the +function fails (it returns non-zero) and @var{op} is unchanged. If the +function fails for another reason, @var{op} is set to NaN and it is +unspecified whether the precision of @var{op} has changed to the one +read from the file. +Return 0 iff the import was successful. + +Note: this function is experimental and its interface might change in future +versions. +@end deftypefun + +@deftypefun void mpfr_dump (mpfr_t @var{op}) +Output @var{op} on @code{stdout} in some unspecified format, then a newline +character. This function is mainly for debugging purpose. Thus invalid data +may be supported. Everything that is not specified may change without +breaking the ABI and may depend on the environment. + +The current output format is the following: a minus sign if the sign bit +is set (even for NaN); @samp{@@NaN@@}, @samp{@@Inf@@} or @samp{0} if the +argument is NaN, an infinity or zero, respectively; otherwise the remaining +of the output is as follows: @samp{0.} then the @var{p} bits of the binary +significand, where @var{p} is the precision of the number; if the trailing +bits are not all zeros (which must not occur with valid data), they are +output enclosed by square brackets; the character @samp{E} followed by +the exponent written in base 10; in case of invalid data or out-of-range +exponent, this function outputs three exclamation marks (@samp{!!!}), +followed by flags, followed by three exclamation marks (@samp{!!!}) again. +These flags are: @samp{N} if the most significant bit of the significand +is 0 (i.e., the number is not normalized); @samp{T} if there are non-zero +trailing bits; @samp{U} if this is a UBF number (internal use only); +@samp{<} if the exponent is less than the current minimum exponent; +@samp{>} if the exponent is greater than the current maximum exponent. +@end deftypefun + +@node Formatted Output Functions, Integer and Remainder Related Functions, Input and Output Functions, MPFR Interface @comment node-name, next, previous, up @cindex Float output functions @cindex Output functions @@ -2247,7 +2591,9 @@ @samp{flags}, @samp{width}, and @samp{precision} have the same meaning as for the standard @code{printf} (in particular, notice that the @samp{precision} is related to the number of digits displayed in the base chosen by @samp{conv} -and not related to the internal precision of the @code{mpfr_t} variable). +and not related to the internal precision of the @code{mpfr_t} variable), but +note that for @samp{Re}, the default precision is not the same as the one for +@samp{e}. @code{mpfr_printf} accepts the same @samp{type} specifiers as GMP (except the non-standard and deprecated @samp{q}, use @samp{ll} instead), namely the length modifiers defined in the C standard: @@ -2358,9 +2704,9 @@ @multitable {(space)} {MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM} @item @samp{a} @samp{A} @tab hex float, C99 style @item @samp{b} @tab binary output -@item @samp{e} @samp{E} @tab scientific format float -@item @samp{f} @samp{F} @tab fixed point float -@item @samp{g} @samp{G} @tab fixed or scientific float +@item @samp{e} @samp{E} @tab scientific-format float +@item @samp{f} @samp{F} @tab fixed-point float +@item @samp{g} @samp{G} @tab fixed-point or scientific float @end multitable @end quotation @@ -2403,11 +2749,14 @@ @subsection Functions -For all the following functions, if the number of characters which ought to be -written appears to exceed the maximum limit for an @code{int}, nothing is +For all the following functions, if the number of characters that ought to be +written exceeds the maximum limit @code{INT_MAX} for an @code{int}, nothing is written in the stream (resp.@: to @code{stdout}, to @var{buf}, to @var{str}), -the function returns @minus{}1, sets the @emph{erange} flag, and (in -POSIX system only) @code{errno} is set to @code{EOVERFLOW}. +the function returns @minus{}1, sets the @emph{erange} flag, and @code{errno} +is set to @code{EOVERFLOW} if the @code{EOVERFLOW} macro is defined (such as +on POSIX systems). Note, however, that @code{errno} might be changed to +another value by some internal library call if another error occurs there +(currently, this would come from the unallocation function). @deftypefun int mpfr_fprintf (FILE *@var{stream}, const char *@var{template}, @dots{}) @deftypefunx int mpfr_vfprintf (FILE *@var{stream}, const char *@var{template}, va_list @var{ap}) @@ -2415,10 +2764,6 @@ the template string @var{template}. Return the number of characters written or a negative value if an error occurred. -@c If the number of characters which ought to be written appears -@c to exceed the maximum limit for an @code{int}, nothing is written in the -@c stream, the function returns @minus{}1, sets the @emph{erange} flag, and (in -@c POSIX system only) @code{errno} is set to @code{EOVERFLOW}. @end deftypefun @deftypefun int mpfr_printf (const char *@var{template}, @dots{}) @@ -2427,10 +2772,6 @@ template string @var{template}. Return the number of characters written or a negative value if an error occurred. -@c If the number of characters which ought to be written appears -@c to exceed the maximum limit for an @code{int}, nothing is written in -@c @code{stdout}, the function returns @minus{}1, sets the @emph{erange} flag, -@c and (in POSIX system only) @code{errno} is set to @code{EOVERFLOW}. @end deftypefun @deftypefun int mpfr_sprintf (char *@var{buf}, const char *@var{template}, @dots{}) @@ -2442,10 +2783,6 @@ Return the number of characters written in the array @var{buf} @emph{not counting} the terminating null character or a negative value if an error occurred. -@c If the number of characters which ought to be written appears to exceed the -@c maximum limit for an @code{int}, nothing is written in @var{buf}, the function -@c returns @minus{}1, sets the @emph{erange} flag, and (in POSIX system only) -@c code{errno} is set to @code{EOVERFLOW}. @end deftypefun @deftypefun int mpfr_snprintf (char *@var{buf}, size_t @var{n}, const char *@var{template}, @dots{}) @@ -2455,53 +2792,58 @@ @var{buf}. If @var{n} is zero, nothing is written and @var{buf} may be a null pointer, otherwise, the @var{n}@minus{}1 first characters are written in @var{buf} and the @var{n}-th is a null character. -Return the number of characters that would have been written had @var{n} be +Return the number of characters that would have been written had @var{n} been sufficiently large, @emph{not counting} the terminating null character, or a negative value if an error occurred. -@c If the number of characters produced by the -@c optional arguments under the control of the template string @var{template} -@c appears to exceed the maximum limit for an @code{int}, nothing is written in -@c @var{buf}, the function returns @minus{}1, sets the @emph{erange} flag, and -@c (in POSIX system only) @code{errno} is set to @code{EOVERFLOW}. @end deftypefun @deftypefun int mpfr_asprintf (char **@var{str}, const char *@var{template}, @dots{}) @deftypefunx int mpfr_vasprintf (char **@var{str}, const char *@var{template}, va_list @var{ap}) Write their output as a null terminated string in a block of memory allocated -using the current allocation function. A pointer to the block is stored in +using the allocation function (@pxref{Memory Handling}). A pointer to the +block is stored in @var{str}. The block of memory must be freed using @code{mpfr_free_str}. The return value is the number of characters written in the string, excluding -the null-terminator, or a negative value if an error occurred. -@c If the number of -@c characters produced by the optional arguments under the control of the -@c template string @var{template} appears to exceed the maximum limit for an -@c @code{int}, @var{str} is a null pointer, the function returns @minus{}1, sets -@c the @emph{erange} flag, and (in POSIX system only) @code{errno} is set to -@c @code{EOVERFLOW}. +the null-terminator, or a negative value if an error occurred, in which case +the contents of @var{str} are undefined. @end deftypefun -@node Integer Related Functions, Rounding Related Functions, Formatted Output Functions, MPFR Interface +@node Integer and Remainder Related Functions, Rounding-Related Functions, Formatted Output Functions, MPFR Interface @comment node-name, next, previous, up @cindex Integer related functions +@cindex Remainder related functions @section Integer and Remainder Related Functions @deftypefun int mpfr_rint (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_ceil (mpfr_t @var{rop}, mpfr_t @var{op}) @deftypefunx int mpfr_floor (mpfr_t @var{rop}, mpfr_t @var{op}) @deftypefunx int mpfr_round (mpfr_t @var{rop}, mpfr_t @var{op}) +@deftypefunx int mpfr_roundeven (mpfr_t @var{rop}, mpfr_t @var{op}) @deftypefunx int mpfr_trunc (mpfr_t @var{rop}, mpfr_t @var{op}) Set @var{rop} to @var{op} rounded to an integer. @code{mpfr_rint} rounds to the nearest representable integer in the -given direction @var{rnd}, @code{mpfr_ceil} rounds -to the next higher or equal representable integer, @code{mpfr_floor} to -the next lower or equal representable integer, @code{mpfr_round} to the -nearest representable integer, rounding halfway cases away from zero -(as in the roundTiesToAway mode of IEEE 754-2008), -and @code{mpfr_trunc} to the next representable integer toward zero. +given direction @var{rnd}, and the other five functions behave in a +similar way with some fixed rounding mode: +@itemize @bullet +@item @code{mpfr_ceil}: to the next higher or equal representable integer + (like @code{mpfr_rint} with @code{MPFR_RNDU}); +@item @code{mpfr_floor} to the next lower or equal representable integer + (like @code{mpfr_rint} with @code{MPFR_RNDD}); +@item @code{mpfr_round} to the nearest representable integer, + rounding halfway cases away from zero + (as in the roundTiesToAway mode of IEEE 754-2008); +@item @code{mpfr_roundeven} to the nearest representable integer, + rounding halfway cases with the even-rounding rule + (like @code{mpfr_rint} with @code{MPFR_RNDN}); +@item @code{mpfr_trunc} to the next representable integer toward zero + (like @code{mpfr_rint} with @code{MPFR_RNDZ}). +@end itemize +When @var{op} is a zero or an infinity, set @var{rop} to the same value +(with the same sign). -The returned value is zero when the result is exact, positive when it is +The return value is zero when the result is exact, positive when it is greater than the original value of @var{op}, and negative when it is smaller. -More precisely, the returned value is 0 when @var{op} is an integer +More precisely, the return value is 0 when @var{op} is an integer representable in @var{rop}, 1 or @minus{}1 when @var{op} is an integer that is not representable in @var{rop}, 2 or @minus{}2 when @var{op} is not an integer. @@ -2511,14 +2853,10 @@ the ISO C99 rule for the @code{rint} function. If you want the behavior to be more like IEEE 754 / ISO TS 18661-1, i.e., the usual behavior where the round-to-integer function is regarded as any other mathematical function, -you should use one the @code{mpfr_rint_*} functions instead (however it is -not possible to round to nearest with the even rounding rule yet). +you should use one the @code{mpfr_rint_*} functions instead. -Note that @code{mpfr_round} is different from @code{mpfr_rint} called with -the rounding to nearest mode (where halfway cases are rounded to an even -integer or significand). Note also that no double rounding is performed; for -instance, 10.5 (1010.1 in binary) is rounded by @code{mpfr_rint} with -rounding to nearest to 12 (1100 +Note that no double rounding is performed; for instance, 10.5 (1010.1 in +binary) is rounded by @code{mpfr_rint} with rounding to nearest to 12 (1100 in binary) in 2-bit precision, because the two enclosing numbers representable on two bits are 8 and 12, and the closest is 12. (If one first rounded to an integer, one would round 10.5 to 10 with @@ -2528,14 +2866,22 @@ @deftypefun int mpfr_rint_ceil (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_rint_floor (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_rint_round (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) +@deftypefunx int mpfr_rint_roundeven (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_rint_trunc (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) -Set @var{rop} to @var{op} rounded to an integer. -@code{mpfr_rint_ceil} rounds to the next higher or equal integer, -@code{mpfr_rint_floor} to the next lower or equal integer, -@code{mpfr_rint_round} to the nearest integer, rounding halfway cases away -from zero, and @code{mpfr_rint_trunc} to the next integer toward zero. +Set @var{rop} to @var{op} rounded to an integer: +@itemize @bullet +@item @code{mpfr_rint_ceil}: to the next higher or equal integer; +@item @code{mpfr_rint_floor}: to the next lower or equal integer; +@item @code{mpfr_rint_round}: to the nearest integer, + rounding halfway cases away from zero; +@item @code{mpfr_rint_roundeven}: to the nearest integer, + rounding halfway cases to the nearest even integer; +@item @code{mpfr_rint_trunc} to the next integer toward zero. +@end itemize If the result is not representable, it is rounded in the direction @var{rnd}. -The returned value is the ternary value associated with the considered +When @var{op} is a zero or an infinity, set @var{rop} to the same value +(with the same sign). +The return value is the ternary value associated with the considered round-to-integer function (regarded in the same way as any other mathematical function). @@ -2558,6 +2904,8 @@ @var{op}, rounded in the direction @var{rnd} (unlike in @code{mpfr_rint}, @var{rnd} affects only how the exact fractional part is rounded, not how the fractional part is generated). +When @var{op} is an integer or an infinity, set @var{rop} to zero with +the same sign as @var{op}. @end deftypefun @deftypefun int mpfr_modf (mpfr_t @var{iop}, mpfr_t @var{fop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) @@ -2571,13 +2919,15 @@ @end deftypefun @deftypefun int mpfr_fmod (mpfr_t @var{r}, mpfr_t @var{x}, mpfr_t @var{y}, mpfr_rnd_t @var{rnd}) +@deftypefunx int mpfr_fmodquo (mpfr_t @var{r}, long* @var{q}, mpfr_t @var{x}, mpfr_t @var{y}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_remainder (mpfr_t @var{r}, mpfr_t @var{x}, mpfr_t @var{y}, mpfr_rnd_t @var{rnd}) @deftypefunx int mpfr_remquo (mpfr_t @var{r}, long* @var{q}, mpfr_t @var{x}, mpfr_t @var{y}, mpfr_rnd_t @var{rnd}) Set @var{r} to the value of @math{@var{x} - @var{n}@var{y}}, rounded according to the direction @var{rnd}, where @var{n} is the integer quotient of @var{x} divided by @var{y}, defined as follows: @var{n} is rounded -toward zero for @code{mpfr_fmod}, and to the nearest integer (ties rounded -to even) for @code{mpfr_remainder} and @code{mpfr_remquo}. +toward zero for @code{mpfr_fmod} and @code{mpfr_fmodquo}, +and to the nearest integer (ties rounded to even) for @code{mpfr_remainder} +and @code{mpfr_remquo}. Special values are handled as described in Section F.9.7.1 of the ISO C99 standard: @@ -2587,7 +2937,7 @@ If @var{r} is zero, it has the sign of @var{x}. The return value is the ternary value corresponding to @var{r}. -Additionally, @code{mpfr_remquo} stores +Additionally, @code{mpfr_fmodquo} and @code{mpfr_remquo} store the low significant bits from the quotient @var{n} in @var{*q} (more precisely the number of bits in a @code{long} minus one), with the sign of @var{x} divided by @var{y} @@ -2602,9 +2952,9 @@ Return non-zero iff @var{op} is an integer. @end deftypefun -@node Rounding Related Functions, Miscellaneous Functions, Integer Related Functions, MPFR Interface +@node Rounding-Related Functions, Miscellaneous Functions, Integer and Remainder Related Functions, MPFR Interface @cindex Rounding mode related functions -@section Rounding Related Functions +@section Rounding-Related Functions @deftypefun void mpfr_set_default_rounding_mode (mpfr_rnd_t @var{rnd}) Set the default rounding mode to @var{rnd}. @@ -2647,37 +2997,87 @@ Assuming @var{b} is an approximation of an unknown number @var{x} in the direction @var{rnd1} with error at most two to the power E(b)-@var{err} where E(b) is the exponent of @var{b}, return a non-zero -value if one is able to round correctly @var{x} to precision -@var{prec} with the direction @var{rnd2}, -and 0 otherwise (including for NaN and Inf). +value if one is able to round correctly @var{x} to precision @var{prec} +with the direction @var{rnd2} assuming an unbounded exponent range, and +0 otherwise (including for NaN and Inf). +In other words, if the error on @var{b} is bounded by two to the power +@var{k} ulps, and @var{b} has precision @var{prec}, +you should give @var{err}=@var{prec}@minus{}@var{k}. This function @strong{does not modify} its arguments. -If @var{rnd1} is @code{MPFR_RNDN}, then the sign of the error is -unknown, but its absolute value is the same, so that the possible range -is twice as large as with a directed rounding for @var{rnd1}. - -Note: if one wants to also determine the correct @ref{ternary value} when -rounding @var{b} to precision @var{prec} with rounding mode @var{rnd}, -a useful trick is the following: +If @var{rnd1} is @code{MPFR_RNDN} or @code{MPFR_RNDF}, +the error is considered to be either +positive or negative, thus the possible range +is twice as large as with a directed rounding for @var{rnd1} (with the +same value of @var{err}). + +When @var{rnd2} is @code{MPFR_RNDF}, let @var{rnd3} be the opposite direction +if @var{rnd1} is a directed rounding, and @code{MPFR_RNDN} +if @var{rnd1} is @code{MPFR_RNDN} or @code{MPFR_RNDF}. +The returned value of @code{mpfr_can_round (b, err, rnd1, MPFR_RNDF, prec)} +is non-zero iff after +the call @code{mpfr_set (y, b, rnd3)} with @var{y} of precision @var{prec}, +@var{y} is guaranteed to be a faithful rounding of @var{x}. +@c +@c For rnd1=RNDN, let [u,v] be the interval where x can lie, then mpfr_can_round +@c returns 1 exactly when either: +@c a) [u,v] contains a unique representable number y in precision prec, +@c and both u and v round to y with RNDN +@c b) [u,v] contains no representable number y in precision prec, then mpfr_set +@c will return either down(u) or up(v) which are both faithful roundings of x +@c (With rnd2=RNDN instead, mpfr_can_round would only return 1 in case a). +@c +@c For rnd1=RNDU, let [u,b] be the interval where x can lie (we have v=b since +@c rnd1=RNDU implies x <= b), then mpfr_can_round returns 1 exactly when either: +@c a) [u,b] contains a (unique) representable number y in precision prec, +@c then b rounds to y with rnd3=RNDD +@c b) [u,b] contains no representable number y in precision prec, then mpfr_set +@c will return down(u) which is a faithful rounding of x +@c (With rnd2 a directed rounding instead of RNDF, mpfr_can_round would only return +@c 1 in case b, apart from special cases where u or b are representable in precision +@c prec). +@c +@c Note: This spec is better than one avoiding "hard cases" (leaving +@c such cases indeterminate to have a mpfr_can_round in constant time). +@c Indeed, the time gained by having a mpfr_can_round without hard cases +@c would be lost by making the user recompute everything in a larger +@c precision if one could have returned non-zero instead of 0. + +Note: The @ref{ternary value} cannot be determined in general with this +function. However, if it is known that the exact value is not exactly +representable in precision @var{prec}, then one can use the following +trick to determine the (non-zero) ternary value in any rounding mode +@var{rnd2} (note that @code{MPFR_RNDZ} below can be replaced by any +directed rounding mode): @example if (mpfr_can_round (b, err, MPFR_RNDN, MPFR_RNDZ, - prec + (rnd == MPFR_RNDN))) - ... + prec + (rnd2 == MPFR_RNDN))) + @{ + /* round the approximation 'b' to the result 'r' of 'prec' bits + with rounding mode 'rnd2' and get the ternary value 'inex' */ + inex = mpfr_set (r, b, rnd2); + @} @end example -Indeed, if @var{rnd} is @code{MPFR_RNDN}, this will check if one can +Indeed, if @var{rnd2} is @code{MPFR_RNDN}, this will check if one can round to @var{prec}+1 bits with a directed rounding: if so, one can surely round to nearest to @var{prec} bits, and in addition one can determine the correct ternary value, which would not be the case when @var{b} is near from a value exactly representable on @var{prec} bits. + +A detailed example is available in the @file{examples} subdirectory, +file @file{can_round.c}. @end deftypefun @deftypefun mpfr_prec_t mpfr_min_prec (mpfr_t @var{x}) Return the minimal number of bits required to store the significand of -@var{x}, and 0 for special values, including 0. (Warning: the returned -value can be less than @code{MPFR_PREC_MIN}.) - -The function name is subject to change. +@var{x}, and 0 for special values, including 0. +@c This warning no longer holds now that MPFR_PREC_MIN=1. +@c Warning! The return value can be less than @code{MPFR_PREC_MIN}, +@c in particular for the powers of two. If you use this function together +@c with @code{mpfr_prec_round} in order to reduce the memory space occupied +@c by a number, you may need to take the maximum of the returned precision +@c and @code{MPFR_PREC_MIN} for @code{mpfr_prec_round}. @end deftypefun @deftypefun {const char *} mpfr_print_rnd_mode (mpfr_rnd_t @var{rnd}) @@ -2686,20 +3086,53 @@ if @var{rnd} is an invalid rounding mode. @end deftypefun -@node Miscellaneous Functions, Exception Related Functions, Rounding Related Functions, MPFR Interface +@deftypefn Macro int mpfr_round_nearest_away (int (@var{foo})(mpfr_t, type1_t, ..., mpfr_rnd_t), mpfr_t @var{rop}, type1_t @var{op}, ...) +Given a function @var{foo} and one or more values @var{op} (which may be +a @code{mpfr_t}, a @code{long}, a @code{double}, etc.), put in @var{rop} +the round-to-nearest-away rounding of @code{@var{foo}(@var{op},...)}. +This rounding is defined in the same way as round-to-nearest-even, +except in case of tie, where the value away from zero is returned. +The function @var{foo} takes as input, from second to +penultimate argument(s), the argument list given after @var{rop}, +a rounding mode as final argument, +puts in its first argument the value @code{@var{foo}(@var{op},...)} rounded +according to this rounding mode, and returns the corresponding ternary value +(which is expected to be correct, otherwise @code{mpfr_round_nearest_away} +will not work as desired). +Due to implementation constraints, this function must not be called when +the minimal exponent @code{emin} is the smallest possible one. +This macro has been made such that the compiler is able to detect +mismatch between the argument list @var{op} +and the function prototype of @var{foo}. +Multiple input arguments @var{op} are supported only with C99 compilers. +Otherwise, for C89 compilers, only one such argument is supported. + +Note: this macro is experimental and its interface might change in future +versions. +@example +unsigned long ul; +mpfr_t f, r; +/* Code that inits and sets r, f, and ul, and if needed sets emin */ +int i = mpfr_round_nearest_away (mpfr_add_ui, r, f, ul); +@end example +@end deftypefn + +@node Miscellaneous Functions, Exception Related Functions, Rounding-Related Functions, MPFR Interface @comment node-name, next, previous, up @cindex Miscellaneous float functions @section Miscellaneous Functions @deftypefun void mpfr_nexttoward (mpfr_t @var{x}, mpfr_t @var{y}) -If @var{x} or @var{y} is NaN, set @var{x} to NaN@. If @var{x} and @var{y} -are equal, @var{x} is unchanged. Otherwise, if @var{x} -is different from @var{y}, replace @var{x} by the next floating-point -number (with the precision of @var{x} and the current exponent range) -in the direction of @var{y} +If @var{x} or @var{y} is NaN, set @var{x} to NaN; note that the NaN flag +is set as usual. +If @var{x} and @var{y} are equal, @var{x} is unchanged. +Otherwise, if @var{x} is different from @var{y}, replace @var{x} by the +next floating-point number (with the precision of @var{x} and the current +exponent range) in the direction of @var{y} (the infinite values are seen as the smallest and largest floating-point -numbers). If the result is zero, it keeps the same sign. No underflow or -overflow is generated. +numbers). If the result is zero, it keeps the same sign. No underflow, +overflow, or inexact exception is raised. +@c For NaN, the behavior is like IEEE 754-2008 with sNaN. @end deftypefun @deftypefun void mpfr_nextabove (mpfr_t @var{x}) @@ -2745,23 +3178,30 @@ The second argument is a @code{gmp_randstate_t} structure which should be created using the GMP @code{gmp_randinit} function (see the GMP manual). -Note: the note for @code{mpfr_urandomb} holds too. In addition, the exponent -range and the rounding mode might have a side effect on the next random state. +Note: the note for @code{mpfr_urandomb} holds too. Moreover, the exact number +(the random value to be rounded) and the next random state do not depend on +the current exponent range and the rounding mode. However, they depend on +the target precision: from the same state of the random generator, if the +precision of the destination is changed, then the value may be completely +different (and the state of the random generator is different too). @end deftypefun -@deftypefun int mpfr_grandom (mpfr_t @var{rop1}, mpfr_t @var{rop2}, gmp_randstate_t @var{state}, mpfr_rnd_t @var{rnd}) -Generate two random floats according to a standard normal gaussian -distribution. If @var{rop2} is a null pointer, then only one value is generated -and stored in @var{rop1}. +@deftypefun int mpfr_nrandom (mpfr_t @var{rop1}, gmp_randstate_t @var{state}, mpfr_rnd_t @var{rnd}) +@deftypefunx int mpfr_grandom (mpfr_t @var{rop1}, mpfr_t @var{rop2}, gmp_randstate_t @var{state}, mpfr_rnd_t @var{rnd}) +Generate one (possibly two for @code{mpfr_grandom}) random floating-point +number according to a standard normal Gaussian distribution (with mean zero +and variance one). For @code{mpfr_grandom}, if @var{rop2} is a null pointer, +then only one value is generated and stored in @var{rop1}. The floating-point number @var{rop1} (and @var{rop2}) can be seen as if a -random real number were generated according to the standard normal gaussian +random real number were generated according to the standard normal Gaussian distribution and then rounded in the direction @var{rnd}. -The third argument is a @code{gmp_randstate_t} structure, which should be +The @code{gmp_randstate_t} argument should be created using the GMP @code{gmp_randinit} function (see the GMP manual). -The combination of the ternary values is returned like with +For @code{mpfr_grandom}, +the combination of the ternary values is returned like with @code{mpfr_sin_cos}. If @var{rop2} is a null pointer, the second ternary value is assumed to be 0 (note that the encoding of the only ternary value is not the same as the usual encoding for functions that return only one @@ -2769,19 +3209,29 @@ Note: the note for @code{mpfr_urandomb} holds too. In addition, the exponent range and the rounding mode might have a side effect on the next random state. + +Note: @code{mpfr_nrandom} is much more efficient than @code{mpfr_grandom}, +especially for large precision. Thus @code{mpfr_grandom} is marked as +deprecated and will be removed in a future release. +@end deftypefun + +@deftypefun int mpfr_erandom (mpfr_t @var{rop1}, gmp_randstate_t @var{state}, mpfr_rnd_t @var{rnd}) +Generate one random floating-point number according to an exponential +distribution, with mean one. +Other characteristics are identical to @code{mpfr_nrandom}. @end deftypefun @deftypefun mpfr_exp_t mpfr_get_exp (mpfr_t @var{x}) Return the exponent of @var{x}, assuming that @var{x} is a non-zero ordinary -number and the significand is considered in [1/2,1). The behavior for NaN, -infinity or zero is undefined. +number and the significand is considered in [1/2,1). For this function, +@var{x} is allowed to be outside of the current range of acceptable values. +The behavior for NaN, infinity or zero is undefined. @end deftypefun @deftypefun int mpfr_set_exp (mpfr_t @var{x}, mpfr_exp_t @var{e}) -Set the exponent of @var{x} if @var{e} is in the current exponent range, -and return 0 (even if @var{x} is not a non-zero ordinary number); -otherwise, return a non-zero value. -The significand is assumed to be in [1/2,1). +Set the exponent of @var{x} to @var{e} if @var{x} is a non-zero ordinary +number and @var{e} is in the current exponent range, and return 0; +otherwise, return a non-zero value (@var{x} is not changed). @end deftypefun @deftypefun int mpfr_signbit (mpfr_t @var{op}) @@ -2856,20 +3306,35 @@ @deftypefun int mpfr_buildopt_tls_p (void) Return a non-zero value if MPFR was compiled as thread safe using compiler-level Thread Local Storage (that is, MPFR was built with the -@code{--enable-thread-safe} configure option, see @code{INSTALL} file), return -zero otherwise. +@samp{--enable-thread-safe} configure option, see @code{INSTALL} file), +return zero otherwise. +@end deftypefun + +@deftypefun int mpfr_buildopt_float128_p (void) +Return a non-zero value if MPFR was compiled with @samp{__float128} support +(that is, MPFR was built with the @samp{--enable-float128} configure option), +return zero otherwise. @end deftypefun @deftypefun int mpfr_buildopt_decimal_p (void) Return a non-zero value if MPFR was compiled with decimal float support (that -is, MPFR was built with the @code{--enable-decimal-float} configure option), +is, MPFR was built with the @samp{--enable-decimal-float} configure option), return zero otherwise. @end deftypefun @deftypefun int mpfr_buildopt_gmpinternals_p (void) Return a non-zero value if MPFR was compiled with GMP internals -(that is, MPFR was built with either @code{--with-gmp-build} or -@code{--enable-gmp-internals} configure option), return zero otherwise. +(that is, MPFR was built with either @samp{--with-gmp-build} or +@samp{--enable-gmp-internals} configure option), return zero otherwise. +@end deftypefun + +@deftypefun int mpfr_buildopt_sharedcache_p (void) +Return a non-zero value if MPFR was compiled so that all threads share +the same cache for one MPFR constant, like @code{mpfr_const_pi} or +@code{mpfr_const_log2} (that is, MPFR was built with the +@samp{--enable-shared-cache} configure option), return zero otherwise. +If the return value is non-zero, MPFR applications may need to be compiled +with the @samp{-pthread} option. @end deftypefun @deftypefun {const char *} mpfr_buildopt_tune_case (void) @@ -2899,11 +3364,22 @@ Return a non-zero value when @var{exp} is not in the range accepted by the implementation (in that case the smallest or largest exponent is not changed), and zero otherwise. -If the user changes the exponent range, it is her/his responsibility to check -that all current floating-point variables are in the new allowed range -(for example using @code{mpfr_check_range}), otherwise the subsequent -behavior will be undefined, in the sense of the ISO C standard. -@c It is also her/his responsibility to check that @m {emin <= emax}. + +For the subsequent operations, it is the user's responsibility to check +that any floating-point value used as an input is in the new exponent range +(for example using @code{mpfr_check_range}). If a floating-point value +outside the new exponent range is used as an input, the default behavior +is undefined, in the sense of the ISO C standard; the behavior may also be +explicitly documented, such as for @code{mpfr_check_range}. + +Note: Caches may still have values outside the current exponent range. +This is not an issue as the user cannot use these caches directly via +the API (MPFR extends the exponent range internally when need be). + +If @math{@code{emin} > @code{emax}} and a floating-point value needs to +be produced as output, the behavior is undefined (@code{mpfr_set_emin} +and @code{mpfr_set_emax} do not check this condition as it might occur +between successive calls to these two functions). @end deftypefun @deftypefun mpfr_exp_t mpfr_get_emin_min (void) @@ -2918,7 +3394,7 @@ @end deftypefun @deftypefun int mpfr_check_range (mpfr_t @var{x}, int @var{t}, mpfr_rnd_t @var{rnd}) -This function assumes that @var{x} is the correctly-rounded value of some +This function assumes that @var{x} is the correctly rounded value of some real value @var{y} in the direction @var{rnd} and some extended exponent range, and that @var{t} is the corresponding @ref{ternary value}. For example, one performed @code{t = mpfr_log (x, u, rnd)}, and @var{y} is the @@ -2945,23 +3421,24 @@ @deftypefun int mpfr_subnormalize (mpfr_t @var{x}, int @var{t}, mpfr_rnd_t @var{rnd}) This function rounds @var{x} emulating subnormal number arithmetic: -if @var{x} is outside the subnormal exponent range, it just propagates the +if @var{x} is outside the subnormal exponent range of the emulated +floating-point system, this function just propagates the @ref{ternary value} @var{t}; otherwise, it rounds @var{x} to precision -@code{EXP(x)-emin+1} according to rounding mode @var{rnd} and previous +@code{EXP(@var{x})-emin+1} according to rounding mode @var{rnd} and previous ternary value @var{t}, avoiding double rounding problems. -More precisely in the subnormal domain, denoting by @var{e} the value of +More precisely in the subnormal domain, denoting by @m{e,@var{e}} the value of @code{emin}, @var{x} is rounded in fixed-point arithmetic to an integer multiple of @m{2^{e-1}, two to the power @var{e}@minus{}1}; as a consequence, @m{1.5 \times 2^{e-1}, 1.5 multiplied by two to the power @var{e}@minus{}1} when @var{t} is zero is rounded to @m{2^e, two to the power @var{e}} with rounding to nearest. -@code{PREC(x)} is not modified by this function. +@code{PREC(@var{x})} is not modified by this function. @var{rnd} and @var{t} must be the rounding mode and the returned ternary value used when computing @var{x} (as in @code{mpfr_check_range}). -The subnormal exponent range is from @code{emin} to @code{emin+PREC(x)-1}. -If the result cannot be represented in the current exponent range +The subnormal exponent range is from @code{emin} to @code{emin+PREC(@var{x})-1}. +If the result cannot be represented in the current exponent range of MPFR (due to a too small @code{emax}), the behavior is undefined. Note that unlike most functions, the result is compared to the exact one, not the input value @var{x}, i.e., the ternary value is propagated. @@ -2969,6 +3446,13 @@ As usual, if the returned ternary value is non zero, the inexact flag is set. Moreover, if a second rounding occurred (because the input @var{x} was in the subnormal range), the underflow flag is set. + +Warning! If you change @code{emin} (with @code{mpfr_set_emin}) just before +calling @code{mpfr_subnormalize}, you need to make sure that the value is +in the current exponent range of MPFR@. But it is better to change +@code{emin} before any computation, if possible. +@c Note: not necessarily possible if the user wants to emulate different +@c floating-point systems in the same code. @end deftypefun This is an example of how to emulate binary double IEEE 754 arithmetic @@ -2994,34 +3478,61 @@ @} @end example -Warning: this emulates a double IEEE 754 arithmetic with correct rounding +Note that @code{mpfr_set_emin} and @code{mpfr_set_emax} are called early +enough in order to make sure that all computed values are in the current +exponent range. +Warning! This emulates a double IEEE 754 arithmetic with correct rounding in the subnormal range, which may not be the case for your hardware. +Below is another example showing how to emulate fixed-point arithmetic +in a specific case. +Here we compute the sine of the integers 1 to 17 with a result in a +fixed-point arithmetic rounded at @m{2^{-42}, 2 power -42} (using the +fact that the result is at most 1 in absolute value): + +@example +@{ + mpfr_t x; int i, inex; + + mpfr_set_emin (-41); + mpfr_init2 (x, 42); + for (i = 1; i <= 17; i++) + @{ + mpfr_set_ui (x, i, MPFR_RNDN); + inex = mpfr_sin (x, x, MPFR_RNDZ); + mpfr_subnormalize (x, inex, MPFR_RNDZ); + mpfr_dump (x); + @} + mpfr_clear (x); +@} +@end example + @deftypefun void mpfr_clear_underflow (void) @deftypefunx void mpfr_clear_overflow (void) @deftypefunx void mpfr_clear_divby0 (void) @deftypefunx void mpfr_clear_nanflag (void) @deftypefunx void mpfr_clear_inexflag (void) @deftypefunx void mpfr_clear_erangeflag (void) -Clear the underflow, overflow, divide-by-zero, invalid, +Clear (lower) the underflow, overflow, divide-by-zero, invalid, inexact and @emph{erange} flags. @end deftypefun +@deftypefun void mpfr_clear_flags (void) +Clear (lower) all global flags (underflow, overflow, divide-by-zero, invalid, +inexact, @emph{erange}). Note: a group of flags can be cleared by using +@code{mpfr_flags_clear}. +@end deftypefun + @deftypefun void mpfr_set_underflow (void) @deftypefunx void mpfr_set_overflow (void) @deftypefunx void mpfr_set_divby0 (void) @deftypefunx void mpfr_set_nanflag (void) @deftypefunx void mpfr_set_inexflag (void) @deftypefunx void mpfr_set_erangeflag (void) -Set the underflow, overflow, divide-by-zero, invalid, +Set (raise) the underflow, overflow, divide-by-zero, invalid, inexact and @emph{erange} flags. @end deftypefun -@deftypefun void mpfr_clear_flags (void) -Clear all global flags (underflow, overflow, divide-by-zero, invalid, -inexact, @emph{erange}). -@end deftypefun - @deftypefun int mpfr_underflow_p (void) @deftypefunx int mpfr_overflow_p (void) @deftypefunx int mpfr_divby0_p (void) @@ -3032,6 +3543,47 @@ inexact, @emph{erange}) flag, which is non-zero iff the flag is set. @end deftypefun +The @code{mpfr_flags_} functions below that take an argument @var{mask} +can operate on any subset of the exception flags: a flag is part of this +subset (or group) if and only if the corresponding bit of the argument +@var{mask} is set. The @code{MPFR_FLAGS_} macros will normally be used +to build this argument. @xref{Exceptions}. + +@deftypefun void mpfr_flags_clear (mpfr_flags_t @var{mask}) +Clear (lower) the group of flags specified by @var{mask}. +@end deftypefun + +@deftypefun void mpfr_flags_set (mpfr_flags_t @var{mask}) +Set (raise) the group of flags specified by @var{mask}. +@end deftypefun + +@deftypefun mpfr_flags_t mpfr_flags_test (mpfr_flags_t @var{mask}) +Return the flags specified by @var{mask}. To test whether any flag from +@var{mask} is set, compare the return value to 0. You can also test +individual flags by AND'ing the result with @code{MPFR_FLAGS_} macros. +Example: +@example +mpfr_flags_t t = mpfr_flags_test (MPFR_FLAGS_UNDERFLOW| + MPFR_FLAGS_OVERFLOW) +@dots{} +if (t) /* underflow and/or overflow (unlikely) */ + @{ + if (t & MPFR_FLAGS_UNDERFLOW) @{ /* handle underflow */ @} + if (t & MPFR_FLAGS_OVERFLOW) @{ /* handle overflow */ @} + @} +@end example +@end deftypefun + +@deftypefun mpfr_flags_t mpfr_flags_save (void) +Return all the flags. It is equivalent to +@code{mpfr_flags_test(MPFR_FLAGS_ALL)}. +@end deftypefun + +@deftypefun void mpfr_flags_restore (mpfr_flags_t @var{flags}, mpfr_flags_t @var{mask}) +Restore the flags specified by @var{mask} to their state represented +in @var{flags}. +@end deftypefun + @node Compatibility with MPF, Custom Interface, Exception Related Functions, MPFR Interface @cindex Compatibility with MPF @section Compatibility With MPF @@ -3044,17 +3596,21 @@ #include @end example @noindent -any program written for -MPF can be compiled directly with MPFR without any changes -(except the @code{gmp_printf} functions will not work for arguments of type -@code{mpfr_t}). +many programs written for MPF can be compiled directly against MPFR +without any changes. All operations are then performed with the default MPFR rounding mode, which can be reset with @code{mpfr_set_default_rounding_mode}. -Warning: the @code{mpf_init} and @code{mpf_init2} functions initialize -to zero, whereas the corresponding MPFR functions initialize to NaN: -this is useful to detect uninitialized values, but is slightly incompatible -with MPF@. +Warning! There are some differences. In particular: +@itemize @bullet +@item The precision is different: MPFR rounds to the exact number of bits +(zeroing trailing bits in the internal representation). Users may need to +increase the precision of their variables. +@item The exponent range is also different. +@item The formatted output functions (@code{gmp_printf}, etc.) will not work +for arguments of arbitrary-precision floating-point type (@code{mpf_t}, which +@file{mpf2mpfr.h} redefines as @code{mpfr_t}). +@end itemize @deftypefun void mpfr_set_prec_raw (mpfr_t @var{x}, mpfr_prec_t @var{prec}) Reset the precision of @var{x} to be @strong{exactly} @var{prec} bits. @@ -3125,7 +3681,7 @@ uses the macro, while @code{(mpfr_custom_init) (s, p)} uses the function. Note 1: MPFR functions may still initialize temporary floating-point numbers -using @code{mpfr_init} and similar functions. See Custom Allocation (GNU MP). +using @code{mpfr_init} and similar functions. See Custom Allocation (GNU MP)@. Note 2: MPFR functions may use the cached functions (@code{mpfr_const_pi} for example), even if they are not explicitly called. You have to call @@ -3148,16 +3704,17 @@ @deftypefun void mpfr_custom_init_set (mpfr_t @var{x}, int @var{kind}, mpfr_exp_t @var{exp}, mpfr_prec_t @var{prec}, void *@var{significand}) Perform a dummy initialization of a @code{mpfr_t} and set it to: @itemize -@item if @code{ABS(kind) == MPFR_NAN_KIND}, @var{x} is set to NaN; -@item if @code{ABS(kind) == MPFR_INF_KIND}, @var{x} is set to the infinity -of sign @code{sign(kind)}; -@item if @code{ABS(kind) == MPFR_ZERO_KIND}, @var{x} is set to the zero of -sign @code{sign(kind)}; -@item if @code{ABS(kind) == MPFR_REGULAR_KIND}, @var{x} is set to a regular -number: @code{x = sign(kind)*significand*2^exp}. +@item if @GMPabs{@var{kind}} = @code{MPFR_NAN_KIND}, @var{x} is set to NaN; +@item if @GMPabs{@var{kind}} = @code{MPFR_INF_KIND}, @var{x} is set to the +infinity of the same sign as @var{kind}; +@item if @GMPabs{@var{kind}} = @code{MPFR_ZERO_KIND}, @var{x} is set to the +zero of the same sign as @var{kind}; +@item if @GMPabs{@var{kind}} = @code{MPFR_REGULAR_KIND}, @var{x} is set to +the regular number whose sign is the one of @var{kind}, and whose exponent +and significand are given by @var{exp} and @var{significand}. @end itemize -In all cases, it uses @var{significand} directly for further computing -involving @var{x}. It will not allocate anything. +In all cases, @var{significand} will be used directly for further computing +involving @var{x}. This function does not allocate anything. A floating-point number initialized with this function cannot be resized using @code{mpfr_set_prec} or @code{mpfr_prec_round}, or cleared using @code{mpfr_clear}! @@ -3181,8 +3738,10 @@ @deftypefun mpfr_exp_t mpfr_custom_get_exp (mpfr_t @var{x}) Return the exponent of @var{x}, assuming that @var{x} is a non-zero ordinary -number. The return value for NaN, Infinity or zero is unspecified but does not -produce any trap. +number and the significand is considered in [1/2,1). +But if @var{x} is NaN, infinity or zero, contrary to @code{mpfr_get_exp} +(where the behavior is undefined), the return value is here an unspecified, +valid value of the @code{mpfr_exp_t} type. The behavior of this function for any @code{mpfr_t} not initialized with @code{mpfr_custom_init_set} is undefined. @end deftypefun @@ -3237,7 +3796,7 @@ @end itemize -@node API Compatibility, Contributors, MPFR Interface, Top +@node API Compatibility, MPFR and the IEEE 754 Standard, MPFR Interface, Top @chapter API Compatibility The goal of this section is to describe some API changes that occurred @@ -3315,7 +3874,7 @@ @code{mpfr_prec_t} and @code{mpfr_rnd_t} in your programs. The types @code{mp_prec_t} and @code{mp_rnd_t} (defined in MPFR only) may be removed in the future, as the prefix -@code{mp_} is reserved by GMP. +@code{mp_} is reserved by GMP@. @comment r6787 The precision type @code{mpfr_prec_t} (@code{mp_prec_t}) was unsigned @@ -3345,13 +3904,22 @@ @end example The rounding mode ``round away from zero'' (@code{MPFR_RNDA}) was added in MPFR 3.0 (however no rounding mode @code{GMP_RNDA} exists). +Faithful rounding (@code{MPFR_RNDF}) was added in MPFR 4.0, but currently, +it is partially supported. +@c That's sufficient information for now. More should be said in future +@c versions (for instance, a user of 4.1 may want to know if this works +@c in 4.0). + +The flags-related macros, whose name starts with @code{MPFR_FLAGS_}, +were added in MPFR 4.0 (for the new functions @code{mpfr_flags_clear}, +@code{mpfr_flags_restore}, @code{mpfr_flags_set} and @code{mpfr_flags_test}, +in particular). @node Added Functions, Changed Functions, Type and Macro Changes, API Compatibility @section Added Functions -We give here in alphabetical order -the functions that were added after MPFR 2.2, and in which -MPFR version. +We give here in alphabetical order the functions (and function-like macros) +that were added after MPFR 2.2, and in which MPFR version. @comment The functions are listed in such a way that if a developer wonders @comment whether some function existed in some previous version, then he can @@ -3365,10 +3933,19 @@ @item @code{mpfr_asprintf} in MPFR 2.4. -@item @code{mpfr_buildopt_decimal_p} and @code{mpfr_buildopt_tls_p} in MPFR 3.0. +@item @code{mpfr_beta} in MPFR 4.0 (incomplete, experimental). + +@item @code{mpfr_buildopt_decimal_p} in MPFR 3.0. + +@item @code{mpfr_buildopt_float128_p} in MPFR 4.0. + +@item @code{mpfr_buildopt_gmpinternals_p} in MPFR 3.1. + +@item @code{mpfr_buildopt_sharedcache_p} in MPFR 4.0. -@item @code{mpfr_buildopt_gmpinternals_p} and @code{mpfr_buildopt_tune_case} -in MPFR 3.1. +@item @code{mpfr_buildopt_tls_p} in MPFR 3.0. + +@item @code{mpfr_buildopt_tune_case} in MPFR 3.1. @item @code{mpfr_clear_divby0} in MPFR 3.1 (new divide-by-zero exception). @@ -3396,18 +3973,41 @@ @item @code{mpfr_div_d} in MPFR 2.4. +@item @code{mpfr_erandom} in MPFR 4.0. + +@item @code{mpfr_flags_clear}, @code{mpfr_flags_restore}, +@code{mpfr_flags_save}, @code{mpfr_flags_set} and @code{mpfr_flags_test} +in MPFR 4.0. + +@item @code{mpfr_fmma} and @code{mpfr_fmms} in MPFR 4.0. + @item @code{mpfr_fmod} in MPFR 2.4. +@item @code{mpfr_fmodquo} in MPFR 4.0. + @item @code{mpfr_fms} in MPFR 2.3. +@item @code{mpfr_fpif_export} and @code{mpfr_fpif_import} in MPFR 4.0. + @item @code{mpfr_fprintf} in MPFR 2.4. +@item @code{mpfr_free_cache2} in MPFR 4.0. + +@item @code{mpfr_free_pool} in MPFR 4.0. + @item @code{mpfr_frexp} in MPFR 3.1. +@item @code{mpfr_gamma_inc} in MPFR 4.0. + +@item @code{mpfr_get_float128} in MPFR 4.0 if configured with +@samp{--enable-float128}. + @item @code{mpfr_get_flt} in MPFR 3.0. @item @code{mpfr_get_patches} in MPFR 2.3. +@item @code{mpfr_get_q} in MPFR 4.0. + @item @code{mpfr_get_z_2exp} in MPFR 3.0. This function was named @code{mpfr_get_z_exp} in previous versions; @code{mpfr_get_z_exp} is still available via a macro in @file{mpfr.h}: @@ -3425,12 +4025,18 @@ @item @code{mpfr_li2} in MPFR 2.4. +@item @code{mpfr_log_ui} in MPFR 4.0. + @item @code{mpfr_min_prec} in MPFR 3.0. @item @code{mpfr_modf} in MPFR 2.4. +@item @code{mpfr_mp_memory_cleanup} in MPFR 4.0. + @item @code{mpfr_mul_d} in MPFR 2.4. +@item @code{mpfr_nrandom} in MPFR 4.0. + @item @code{mpfr_printf} in MPFR 2.4. @item @code{mpfr_rec_sqrt} in MPFR 2.4. @@ -3439,8 +4045,17 @@ @item @code{mpfr_remainder} and @code{mpfr_remquo} in MPFR 2.3. +@item @code{mpfr_rint_roundeven} and @code{mpfr_roundeven} in MPFR 4.0. + +@item @code{mpfr_round_nearest_away} in MPFR 4.0. + +@item @code{mpfr_rootn_ui} in MPFR 4.0. + @item @code{mpfr_set_divby0} in MPFR 3.1 (new divide-by-zero exception). +@item @code{mpfr_set_float128} in MPFR 4.0 if configured with +@samp{--enable-float128}. + @item @code{mpfr_set_flt} in MPFR 3.0. @item @code{mpfr_set_z_2exp} in MPFR 3.0. @@ -3477,6 +4092,11 @@ @itemize @bullet +@item @code{mpfr_abs}, @code{mpfr_neg} and @code{mpfr_set} changed in MPFR 4.0. +In previous MPFR versions, the sign bit of a NaN was unspecified; however, +in practice, it was set as now specified except for @code{mpfr_neg} with +a reused argument: @code{mpfr_neg(x,x,rnd)}. + @item @code{mpfr_check_range} changed in MPFR 2.3.2 and MPFR 2.4. If the value is an inexact infinity, the overflow flag is now set (in case it was lost), while it was previously left unchanged. @@ -3484,6 +4104,10 @@ was expecting), so that the previous behavior was regarded as a bug. Hence the change in MPFR 2.3.2. +@item @code{mpfr_eint} changed in MPFR 4.0. +This function now returns the value of the E1/eint1 function for +negative argument (before MPFR 4.0, it was returning NaN)@. + @item @code{mpfr_get_f} changed in MPFR 3.0. This function was returning zero, except for NaN and Inf, which do not exist in MPF@. The @emph{erange} flag is now set in these cases, @@ -3494,6 +4118,11 @@ In previous MPFR versions, the cases where the @emph{erange} flag is set were unspecified. +@item @code{mpfr_get_str} changed in MPFR 4.0. +This function now sets the NaN flag on NaN input (to follow the usual MPFR +rules on NaN and IEEE 754-2008 recommendations on string conversions from +Subclause 5.12.1) and sets the inexact flag when the conversion is inexact. + @item @code{mpfr_get_z} changed in MPFR 3.0. The return type was @code{void}; it is now @code{int}, and the usual ternary value is returned. Thus programs that need to work with both @@ -3528,6 +4157,16 @@ in MPFR 3.0, but @code{mpfr_get_z_exp} is still available for compatibility reasons. +@item @code{mpfr_set_exp} changed in MPFR 4.0. +Before MPFR 4.0, the exponent was set whatever the contents of the MPFR +object in argument. In practice, this could be useful as a low-level +function when the MPFR number was being constructed by setting the fields +of its internal structure, but the API does not provide a way to do this +except by using internals. Thus, for the API, this behavior was useless +and could quickly lead to undefined behavior due to the fact that the +generated value could have an invalid format if the MPFR object contained +a special value (NaN, infinity or zero). + @item @code{mpfr_strtofr} changed in MPFR 2.3.1 and MPFR 2.4. This was actually a bug fix since the code and the documentation did not match. But both were changed in order to have a more consistent @@ -3550,6 +4189,13 @@ special behavior was specified). The case of the underflow flag was more a lack of specification. +@item @code{mpfr_sum} changed in MPFR 4.0. +The @code{mpfr_sum} function has completely been rewritten for MPFR 4.0, +with an update of the specification: the sign of an exact zero result +is now specified, and the return value is now the usual ternary value. +The old @code{mpfr_sum} implementation could also take all the memory +and crash on inputs of very different magnitude. + @item @code{mpfr_urandom} and @code{mpfr_urandomb} changed in MPFR 3.1. Their behavior no longer depends on the platform (assuming this is also true for GMP's random generator, which is not the case between GMP 4.1 and 4.2 if @@ -3559,6 +4205,13 @@ before MPFR 3.1, the MPFR 3.1 behavior is @emph{not} regarded as backward incompatible with previous versions. +@item @code{mpfr_urandom} changed in MPFR 4.0. +The next random state no longer depends on the current exponent range and +the rounding mode. The exceptions due to the rounding of the random number +are now correctly generated, following the uniform distribution. +As a consequence, the returned values can be different between MPFR 4.0 +and previous MPFR versions. + @end itemize @node Removed Functions, Other Changes, Changed Functions, API Compatibility @@ -3570,6 +4223,13 @@ (The function @code{mpfr_random} had been deprecated since at least MPFR 2.2.0, and @code{mpfr_random2} since MPFR 2.4.0.) +Macros @code{mpfr_add_one_ulp} and @code{mpfr_sub_one_ulp} have been +removed in MPFR 4.0. They were no longer documented since MPFR 2.1.0 +and were announced as deprecated since MPFR 3.1.0. + +Function @code{mpfr_grandom} is marked as deprecated in MPFR 4.0. +It will be removed in a future release. + @node Other Changes, , Removed Functions, API Compatibility @section Other Changes @@ -3606,7 +4266,65 @@ As of MPFR 3.1, the @file{mpfr.h} header can be included several times, while still supporting optional functions (@pxref{Headers and Libraries}). -@node Contributors, References, API Compatibility, Top +The way memory is allocated by MPFR should be regarded as well-specified +only as of MPFR 4.0. + +@node MPFR and the IEEE 754 Standard, Contributors, API Compatibility, Top +@chapter MPFR and the IEEE 754 Standard + +This section describes differences between MPFR and the IEEE 754 standard, +and behaviors that are not specified yet in IEEE 754. + +The MPFR numbers do not include subnormals. The reason is that subnormals +are less useful than in IEEE 754 as the default exponent range in MPFR is +large and they would have made the implementation more complex. +However, subnormals can be emulated using @code{mpfr_subnormalize}. + +MPFR has a single NaN@. The behavior is similar either to a signaling NaN or +to a quiet NaN, depending on the context. For any function returning a NaN +(either produced or propagated), the NaN flag is set, while in IEEE 754, +some operations are quiet (even on a signaling NaN)@. + +The @code{mpfr_rec_sqrt} function differs from IEEE 754 on @minus{}0, +where it gives +Inf (like for +0), following the usual limit rules, +instead of @minus{}Inf. + +The @code{mpfr_root} function predates IEEE 754-2008 and behaves differently +from its rootn operation. +It is deprecated and @code{mpfr_rootn_ui} should be used instead. + +@c The following paragraph should cover functions like mpfr_div_ui and +@c mpfr_log_ui. There are no issues with mpfr_pow_{ui,si,z} because the +@c IEEE 754 pown operation agrees with mpfr_pow. +@c Discussions: +@c https://sympa.inria.fr/sympa/arc/mpfr/2017-04/msg00019.html +@c https://sympa.inria.fr/sympa/arc/mpfr/2017-11/msg00009.html +@c https://sympa.inria.fr/sympa/arc/mpfr/2017-12/msg00008.html + +Operations with an unsigned zero: For functions taking an argument of +integer or rational type, a zero of such a type is unsigned unlike the +floating-point zero (this includes the zero of type @code{unsigned long}, +which is a mathematical, exact zero, as opposed to a floating-point zero, +which may come from an underflow and whose sign would correspond to the +sign of the real non-zero value). Unless documented otherwise, this zero +is regarded as +0, as if it were first converted to a MPFR number with +@code{mpfr_set_ui} or @code{mpfr_set_si} (thus the result may not agree +with the usual limit rules applied to a mathematical zero). This is not +the case of addition and subtraction (@code{mpfr_add_ui}, etc.), but for +these functions, only the sign of a zero result would be affected, with ++0 and @minus{}0 considered equal. +Such operations are currently out of the scope of the IEEE 754 standard, +and at the time of specification in MPFR, the Floating-Point Working Group +in charge of the revision of IEEE 754 did not want to discuss issues with +non-floating-point types in general. + +Note also that some obvious differences may come from the fact that in +MPFR, each variable has its own precision. For instance, a subtraction +of two numbers of the same sign may yield an overflow; idem for a call +to @code{mpfr_set}, @code{mpfr_neg} or @code{mpfr_abs}, if the destination +variable has a smaller precision. + +@node Contributors, References, MPFR and the IEEE 754 Standard, Top @comment node-name, next, previous, up @unnumbered Contributors @@ -3622,7 +4340,8 @@ function. Mathieu Dutour contributed the functions @code{mpfr_acos}, @code{mpfr_asin} and @code{mpfr_atan}, and a previous version of @code{mpfr_gamma}. -Laurent Fousse contributed the @code{mpfr_sum} function. +Laurent Fousse contributed the original version of the @code{mpfr_sum} +function (used up to MPFR 3.1). Emmanuel Jeandel, from ENS-Lyon too, contributed the generic hypergeometric code, as well as the internal function @code{mpfr_exp3}, @@ -3634,6 +4353,8 @@ Fabrice Rouillier contributed the @code{mpfr_xxx_z} and @code{mpfr_xxx_q} functions, and helped to the Microsoft Windows porting. Damien Stehl@'e contributed the @code{mpfr_get_ld_2exp} function. +Charles Karney contributed the @code{mpfr_nrandom} and @code{mpfr_erandom} +functions. We would like to thank Jean-Michel Muller and Joris van der Hoeven for very fruitful discussions at the beginning of that project, Torbj@"orn Granlund @@ -3657,6 +4378,10 @@ and the post-doctoral grant of Sylvain Chevillard in 2009-2010. The MPFR-MPC workshop in June 2012 was partly supported by the ERC grant ANTICS of Andreas Enge. +The MPFR-MPC workshop in January 2013 was partly supported by the ERC +grant ANTICS, the GDR IM and the Caramel project-team, during which +Mickaël Gastineau contributed the MPFRbench program, and +Fredrik Johansson a faster version of @code{mpfr_const_euler}. @node References, GNU Free Documentation License, Contributors, Top @comment node-name, next, previous, up @@ -3667,8 +4392,11 @@ @item Richard Brent and Paul Zimmermann, "Modern Computer Arithmetic", -Cambridge University Press (to appear), -also available from the authors' web pages. +Cambridge University Press, +Cambridge Monographs on Applied and Computational Mathematics, +Number 18, 2010. +Electronic version freely available at +@url{https://members.loria.fr/PZimmermann/mca/pub226.html}. @item Laurent Fousse, Guillaume Hanrot, Vincent Lef@`evre, @@ -3680,7 +4408,7 @@ @item Torbj@"orn Granlund, "GNU MP: The GNU Multiple Precision Arithmetic Library", - version 5.0.1, 2010, @url{http://gmplib.org}. + version 6.1.2, 2016, @url{https://gmplib.org/}. @item IEEE standard for binary floating-point arithmetic, Technical Report @@ -3695,12 +4423,12 @@ approved June 12, 2008: IEEE Standards Board, 70 pages. @item -Donald E. Knuth, "The Art of Computer Programming", vol 2, +Donald E.@: Knuth, "The Art of Computer Programming", vol 2, "Seminumerical Algorithms", 2nd edition, Addison-Wesley, 1981. @item Jean-Michel Muller, "Elementary Functions, Algorithms and Implementation", -Birkh@"auser, Boston, 2nd edition, 2006. +Birkh@"auser, Boston, 3rd edition, 2016. @item Jean-Michel Muller, Nicolas Brisebarre, Florent de Dinechin, diff -Nru mpfr4-3.1.4/doc/README.dev mpfr4-4.0.2/doc/README.dev --- mpfr4-3.1.4/doc/README.dev 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/doc/README.dev 2019-01-07 14:06:05.000000000 +0000 @@ -0,0 +1,1576 @@ +Copyright 2002-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + + +Notes for the MPFR developers and Subversion users +================================================== + +To compile source code obtained from the Subversion repository, you +need some GNU development utilities: aclocal, autoheader, automake, +autoconf 2.60 (at least), libtoolize, and the AX_PTHREAD macro from + +(for the latter, under Debian/Ubuntu it suffices to install the +autoconf-archive package). +As some files like "configure" are not part of the Subversion +repository, you first need to run "autoreconf -i" (or ./autogen.sh, +which could be used later to update the config files). Then you can +run ./configure in the usual way (see the INSTALL file, but note that +there are no patches to apply, and the URLs are not valid since the +corresponding version has not been released yet). + +To generate mpfr.info, you need texinfo version 4.2 (or higher). + +=========================================================================== + +The VERSION file contains the number of the next release version, i.e. +the version currently being developed. A suffix can be attached for the +development versions (in general, "-dev") or pre-release versions (e.g. +"-rc1"). It must be updated with the update-version script. Examples: + + tools/update-version 3 1 0 dev + tools/update-version 3 1 0 rc1 + tools/update-version 3 1 0 + +If nightly snapshots are built, the date in the yyyymmdd format and/or +the Subversion revision number (giving more accurate information) must +be added to the version as a suffix, for instance: "2.3.0-20070621" or +"2.3.0-dev-r4553". + +Patches can be tracked by adding a chunk of the form + +--- PATCHES~ Tue Nov 6 19:59:33 2001 ++++ PATCHES Tue Nov 6 19:59:42 2001 +@@ -1,0 +1 @@ ++ + +to the patch file[*]. After such patches have been applied, the file +src/get_patches.c providing the mpfr_get_patches() function will be +rebuilt by "make". MPFR distributors can still modify the version +suffix from the applied patches according to their version naming +scheme; for instance, for their own patches, MPFR developers do: + + tools/update-version 3 1 0 p1 - + +[*] This idea comes from Thomas Roessler, who implemented it in Mutt. + +For patches from MPFR developers, e.g. for MPFR 3.1.0: +1. Unarchive the tarball: a directory mpfr-3.1.0 is created. +2. Go into this directory (cd mpfr-3.1.0). +3. Apply the current patches with "patch -N -Z -p1 < /path/to/allpatches". +4. Reset the PATCHES file with "true >| PATCHES". +5. Rename mpfr-3.1.0 as mpfr-3.1.0-a and duplicate it as mpfr-3.1.0-b + without changing the timestamps (e.g. with cp -a). +6. In mpfr-3.1.0-b, apply the patch obtained with "svn diff", e.g. + patch --no-backup-if-mismatch -p0 < /path/to/new_patch + If an autotools file has been modified, run "autoreconf" and remove + the autom4te.cache directory. +7. In mpfr-3.1.0-b, update the version information: + tools/update-version 3 1 0 p - + where is the patch number. +8. In mpfr-3.1.0-b, update PATCHES file: echo >> PATCHES +9. Make the patch: TZ=UTC diff -Naurd mpfr-3.1.0-a mpfr-3.1.0-b + +The tools/build-patch script can be used to ease the process. + +Note: if autotools files are modified, the corresponding changes in the +distributed files depending on them must be included in the patch, and +the timestamps of such autotools files should be reset so that they do +not change when the patch is applied with the -Z option. Otherwise the +autotools would be needed to build MPFR (unless maintainer mode is +disabled). + +Patches are put under the misc/www directory of the Subversion repository. +The web server is updated and patches are also copied as InriaForge files. + +=========================================================================== + +When submitting patches, unified diffs (option -u) are recommended, +as they are more readable. You can also use the option -d to generate +a smaller set of changes. See diff(1) for more information. + +=========================================================================== + +Copyright Notices: For easier maintainability, make sure that the +copyright notices match the regexp "Copyright.* yyyy Free Software" +where yyyy is the year of the latest modification in the branch +(and nothing else should match it). + +The latest rules for GNU software can be found here: + + https://www.gnu.org/prep/maintain/maintain.html#Copyright-Notices + +=========================================================================== + +To make a release (for the MPFR team): + + *** Please read this section entirely before making any release. *** + + Note: The following needs to be done in a branch x.y for MPFR x.y.z. + + 0) Make sure that the src/mpfr-longlong.h file (from GMP's longlong.h) + and the libtool-related files (config.guess, etc.) are up-to-date. + Running autogen.sh may be necessary; avoid the possible warnings, + as long as this does not require too recent tools (e.g. < 4 years + old). + + 1) Check the version and change the suffix to "rc1", "rc2", etc. with + tools/update-version for the release candidates; remove the suffix + for the final release. + Update the libtool version (see src/Makefile.am). + Update the DLL version (see configure.ac) if need be. + Check these versions with tools/ck-version-info (this check will also + be done automatically by "make dist" / "make distcheck"). + Update the date in doc/mpfr.texi. + + 2) Generate the tuning parameters on different architectures and + put them in src/mparam_h.in. For each architecture: + + a) download the latest release of GMP on gmplib.org + b) build GMP with --disable-shared in say /tmp/gmp-x.y.z + There is no need in tuning GMP, since most users will build MPFR + with a vanilla GMP installation, i.e., with the default GMP tuning; + however you need to go into /tmp/gmp-x.y.z/tune and type "make speed" + (the MPFR tuning is using the resulting speed library) + c) configure MPFR with --disable-shared --with-gmp-build=/tmp/gmp-x.y.z + d) go into the "tune" directory and run "make tune" + e) put the resulting mparam.h file into mparam_h.in (please include + the version of GMP and the compiler used) + + You can produce time graphs to check the thresholds are correct (and + compare to the corresponding mpf functions) with mbench. For example + (-x1 corresponds to add, -x2 to sub, -x3 to mul, ...): + + $ cd mpfr/tools/mbench + $ make mpfr-gfx GMP=... MPFR=... + $ ./mpfr-gfx -b16 -e320 -s16 -f2 -x3 # compares mpfr_mul and mpf_mul + # from 16 to 320 bits with increment + # of 16 bits + $ gnuplot -persist plot.gnuplot + + Another example, comparing mpfr_mul and mpf_mul from 2 to 1000000 bits, + with ratio 1.1 between two sizes, 10 random values, and 10 smoothness + checks: + + $ ./mpfr-gfx -b2 -e1000000 -r1.1 -f10 -x3 -m10 + $ gnuplot -persist plot.gnuplot + + Check the coverage of each source file by the test suite is at least 90% + (or clearly justify any value under this threshold), and publish (for + example in NEWS) the global coverage of this release. The individual + coverage of each source file might also be published on the release web + page. There is a specific mparam.h file to improve coverage; it should + be tested by configuring MPFR with -DMPFR_TUNE_COVERAGE. + + Also test with -DMPFR_COV_CHECK, which allows one to check the coverage + of some combinations of variable values (as defined in the MPFR source + and test suite). + + 3) Update the NEWS file, in particular say if the release is binary + and/or API compatible (or not) with previous releases. + Also update the "API Compatibility" section in the manual (mpfr.texi). + Check with abi-compliance-checker (ABI Compliance Checker)[*], on the + latest MPFR releases built with no configure options (except --prefix), + that no changes have been missed. The ^/misc/build-multi script in the + repository may be useful to prepare data for abi-compliance-checker. + Note that abi-compliance-checker can only check the symbols, types + and constants; it cannot detect just a change in the behavior, thus + may miss some incompatibilities. + Update the FAQ.html file with update-faq (and check it) in the doc + directory. + [*] https://lvc.github.io/abi-compliance-checker/ + + 4) Update the ChangeLog file with "TZ=UTC svn log -rHEAD:0 -v" in + UTF-8 locales, e.g. "LC_ALL=en_US.UTF8 TZ=UTC svn log -rHEAD:0 -v". + Make sure that all the pending commits have been done. + + 5) Do a "svn export" of the branch to make sure to start from a clean + source tree; this also has the advantage (over a checkout) to set + the timestamps to the commit time, ensuring the right ordering of + the files by date. + Generate the tarballs with: + $ ./autogen.sh + $ ./configure + $ make distcheck + + 6) Test the release version on different machines, with --enable-assert + set to "yes", "no" (default), "none" and "full" respectively, with + and without -DMPFR_DISABLE_IEEE_FLOATS in $CFLAGS, with and without gmp + internal files (--enable-gmp-internals), with and without GMP built as + a shared library, with objdir equal to and different from srcdir (e.g. + ../mpfr-source/configure after making mpfr-source read-only), with + and without --enable-logging. + + Try different temporary allocation methods: GMP's --disable-alloca + configure option (or compile GMP with --enable-alloca=debug and MPFR + with --with-gmp-build to be able to get the memory leak errors); and + -DMPFR_ALLOCA_MAX=0. + + Try different gcc versions with different options: with and without + "-std=c99 -O3 -D_XOPEN_SOURCE=500", with and without "-ansi" (which + allows to turn off features that are incompatible with ISO C90), + with and without [-ansi] -pedantic-errors (which has the effect to + disable extensions, such as long long when used together with -ansi), + with and without -std=c11, with and without --enable-thread-safe, in + various FPU precisions (double, double extended and single) if the + platform supports that (e.g. under Linux/x86, with GCC and its -mpc64 + option to simulate the FreeBSD / NetBSD 6- behavior, where by default, + the x87 FPU is configured to round on 53 bits), and in various locales + (LC_ALL=tr_TR in particular, if installed). + On x86, test with -m96bit-long-double and -m128bit-long-double. + Try also with gcc's -fno-common option. + Check also with "-Wformat=2", but without logging support (in order + to avoid too many spurious warnings). + Check with "-UHAVE_BIG_ENDIAN -UHAVE_LITTLE_ENDIAN" to simulate + platforms where the endianness is unknown (or can't be specified + without AC_CONFIG_HEADERS). + Check also without the mpz_t pool (-DMPFR_POOL_NENTRIES=0). + Check the generic code, e.g. with -DMPFR_GENERIC_ABI in $CFLAGS + (useful because most tests are written for low precision) and with + mpfr_cv_c_long_double_format=unknown (as a variable assignment). + + Check that make and make check pass with a C++ compiler, for example: + ./configure CC=g++ (MPFR 2.3.2 did not). + Also test --enable-gmp-internals with it. + + Try different compilers, e.g., icc, opencc (x86_64 machines), + tcc , llvm-gcc, clang. + + On 64-bit PowerPC, test against GMP built with the different ABI's: + 32, mode32 and mode64 (in particular mode32, where long's have + 32 bits and limbs have 64 bits [long long]). + + Test with -DMPFR_TESTS_FPE_DIV -DMPFR_ERRDIVZERO + -DMPFR_DISABLE_IEEE_FLOATS in order + to detect whether tests can fail due to a FP division by 0 (yielding + either FE_DIVBYZERO, e.g. from 1.0 / 0.0 to generate an infinity, or + FE_INVALID, e.g. from 0.0 / 0.0 to generate a NaN) on platforms where + such an operation fails (e.g. trap). On platforms that do not support + IEEE 754, such an operation yields an undefined behavior. + If _MPFR_IEEE_FLOATS is defined to 1 (by the configure script), some + divisions by 0 are avoided in the MPFR library. + The -DMPFR_DISABLE_IEEE_FLOATS option sets _MPFR_IEEE_FLOATS to 0, + allowing one to detect more issues, for platforms without IEEE floats. + + Test with -D_MPFR_PREC_FORMAT=2 when the "int" type is smaller + than the "long" type. + + Test with mini-gmp. + + Test with valgrind by setting the environment variable: + LOG_COMPILER="valgrind -q --error-exitcode=1 --leak-check=full" + See below for more information about valgrind. + + Test with "clang -fsanitize=undefined" (available as of Clang 3.3), + e.g.: ./configure CC=clang CFLAGS='-fsanitize=undefined' + The -fno-sanitize-recover option can give more visibility by making + the corresponding tests fail (useful for automated tests). However + clang unconditionally regards the floating-point division by zero + as an error with "-fsanitize=undefined"; this is detected by a + configure test, which sets MPFR_ERRDIVZERO to disable the tests + involving a floating-point division by zero. Alternatively, on systems + supporting IEC 60559 / IEEE 754 division by zero, one can also provide + the -fno-sanitize=float-cast-overflow,float-divide-by-zero option + *after* the -fsanitize=undefined one. + + GCC 4.9 also supports "-fsanitize=undefined", but it just gives + diagnostic messages at runtime, not a failure; GCC 5 supports + -fno-sanitize-recover like clang. + + Test with GCC's AddressSanitizer (-fsanitize=address). One needs to + unset LD_PRELOAD to avoid failures. Alternatively, -static-libasan + could be used, but there are currently issues with it: + https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=836855 + https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=836864 + + Test with i586-mingw32msvc under Wine (see below). + + Test with both "make check" and the worst cases. + + Check various warnings, in particular for obsolescent features. + With GCC: "-Wall -Wold-style-declaration -Wold-style-definition + -Wmissing-parameter-type -Wmissing-prototypes -Wmissing-declarations + -Wmissing-field-initializers". The -Wint-in-bool-context option + could be added once available. These warnings can easily be checked + in automatic tests by adding "-Werror -Wno-error=unused-function", + but this needs: + * GCC 4.9+ + * a patched autoconf: + https://lists.gnu.org/archive/html/autoconf-patches/2014-01/msg00003.html + + Check that there are no abnormal regressions in the timings (both + for 100, 1000, 10000 digits, http://mpfr.org/mpfr-current/timings.html, + and for small precision, using the mbench program, see mpfr/mbench). + + Test the library interface compatibility by running the test suite + compiled against an old library version and dynamically linked with + the new library version: for instance, build the shared library of + old and new MPFR versions with the same configure options, and from + the build directory of the old version, do something like: + (cd src/.libs && \ + ln -nsf ../../../mpfr-new/src/.libs/libmpfr.so.1.* libmpfr.so.1) + then "make check". + + Also test with different environment variables set + (GMP_CHECK_RANDOMIZE, MPFR_CHECK_LIBC_PRINTF, MPFR_CHECK_LARGEMEM, + MPFR_SUSPICIOUS_OVERFLOW, MPFR_CHECK_LOCALES). + + Check there is no branch misprediction due to wrong MPFR_LIKELY or + MPFR_UNLIKELY statements. For that test, configure with + --enable-debug-prediction, run "timings-mpfr 100", and check that + the output contains no WARNING. + + For various platforms and compilers, check that: + * [make check-gmp-symbols] + MPFR does not use GMP internal symbols (unless --with-gmp-build + or --enable-gmp-internals has been used); + * [make check-exported-symbols] + MPFR does not define symbols with a GMP reserved prefix. + But note that these rules are not really portable: they may do + nothing or might even incorrectly fail on some platforms. + + 7) For the release itself (not the release candidates), if no problems + have been found, create a tag with: + svn cp .../mpfr/branches/x.y .../mpfr/tags/x.y.z + + 8) For the release itself (not the release candidates), update + the version with the update-version script to indicate the + next version (use the "dev" suffix). + + 9) * For the release itself (not the release candidates): + Create a web page for the MPFR release and add the documentation + (for mpfr.html, use "makeinfo --html --no-split mpfr.texi" from + the doc directory). WARNING! Make sure that the .ps file has an + a4 papersize; there's a bug in texinfo(?): + https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874632 + Upload the tarballs and the signatures to the MPFR web server + (via a svn working copy) and to InriaForge. + Prepare the files for the GNU FTP site with the gnu-sigdir script + in the /misc directory and upload them. + Update the mpfr-current symbolic link and the history page. + Update the old current page to point to the new release; see + examples for 3.0.1 (latest version of the branch) and 3.1.0 + (which is not the latest version of the branch). + Run the tools/announce-text script to do some checking and get + the announce text. Edit this text if need be. + Announce the release in the mpfr-announce, mpfr, gmp-discuss, gcc + and info-gnu[1] mailing-lists, and on InriaForge (MPFR News, and + contact the InriaForge administrators[2] to have the announce + published on the main page). + In case of a new patchlevel release, add a link from the web page + of the previous release. + + * For the release candidates: Announce the RC in the mpfr-announce, + mpfr, gmp-discuss, gcc and platform-testers[3] mailing-lists. + A minimal web page for the MPFR release can be created right now + (see svn history such as [4] for examples), as the manual already + contains the new URL's. + + [1] https://www.gnu.org/prep/maintain/html_node/Announcements.html + [2] http://siteadmin.gforge.inria.fr/FAQ.html + [3] See https://lists.gnu.org/mailman/listinfo/platform-testers and + https://lists.gnu.org/archive/html/platform-testers/2011-09/msg00000.html + [4] https://gforge.inria.fr/scm/viewvc.php/misc/www/mpfr-3.1.2/index.html?view=markup&revision=8472&root=mpfr + +Note: Mail sent to the mpfr-announce list should also be sent to +the mpfr list, and the Reply-To should be set to the mpfr list. + +For major or minor releases (but not patchlevels), a branch may be +created first to allow new features to be committed to the trunk. + +To add tcc support with libtool 2.4.2 or below, do the following before +running "make distcheck": +$ patch m4/libtool.m4 libtool-tcc-wl.patch +$ autoreconf + +And for libtool 2.4.3 to 2.4.6, the following is needed: +$ patch m4/libtool.m4 libtool-tcc-rpath.patch +$ autoreconf + +=========================================================================== + +Here is a non-exhaustive list of macros used for building and checking MPFR. +Most of them are automatically set up by the configure script and its options. + +List of macros used for building MPFR (also used for checking): + ++ HAVE_CONFIG_H: Define if we have to include 'config.h' first. ++ MPFR_HAVE_GMP_IMPL: Define if we have the gmp internal files. + ('gmp-impl.h', 'gmp-maparam.h', ...). ++ MPFR_USE_MINI_GMP: Define to use mini-gmp. + ++ HAVE_ALLOCA_H: Define if the function alloca() is in alloca.h. ++ HAVE_LOCALE_H: Define if is available. ++ HAVE_LONG_LONG: Define if the system supports 'long long'. + ++ HAVE_STDARG: Define if the system supports 'stdarg.h'. + Otherwise it is assumed it is 'vararg.h'. + ++ HAVE_INTTYPES_H: Define if is available (ISO C99). ++ HAVE_STDINT_H: Define if is available (ISO C99). ++ MPFR_HAVE_INTMAX_MAX: Define if the INTMAX_MAX macro works correctly + (if 'intmax_t' is supported). + ++ MPFR_HAVE_C11_LOCK: Define if C11 threads are supported. ++ HAVE_PTHREAD: Define if pthread is available. + +Format of long double. ++ HAVE_LDOUBLE_IS_DOUBLE: IEEE double. ++ HAVE_LDOUBLE_IEEE_EXT_BIG: IEEE extended, big endian. ++ HAVE_LDOUBLE_IEEE_EXT_LITTLE: IEEE extended, little endian. ++ HAVE_LDOUBLE_IEEE_QUAD_BIG: IEEE quad, big endian. ++ HAVE_LDOUBLE_IEEE_QUAD_LITTLE: IEEE quad, little endian. ++ HAVE_LDOUBLE_MAYBE_DOUBLE_DOUBLE: Double-double (a.k.a. IBM). + ++ MPFR_DISABLE_IEEE_FLOATS: + Use generic 'double' code instead of IEEE specific one. ++ MPFR_WANT_ASSERT: Assertion level. See src/mpfr-impl.h for details. ++ MPFR_EXP_CHECK: Define if we want to check the exp field. + ++ _MPFR_PREC_FORMAT: Used to define the mpfr_prec_t type. ++ _MPFR_EXP_FORMAT: Used to define the mpfr_exp_t type. + Note: these two macros are for internal use, + testing and experimented users only; they must + not be changed when the MPFR library is to be + installed in a system directory. + ++ IEEE_DBL_MANT_DIG: Number of bits in the significand (mantissa) of a + double (default: 53). ++ MPFR_LDBL_MANT_DIG: Number of bits in the significand (mantissa) of a + long double (generally based on the standard macro + LDBL_MANT_DIG). Note: be careful with formats such + as double-double (a.k.a. IBM long double). + ++ MPFR_USE_LOGGING: Define to enable logging. ++ MPFR_WANT_DECIMAL_FLOATS: + Define to build conversion functions from/to + decimal floats. ++ MPFR_WANT_FLOAT128: Define to build conversion functions from/to + __float128. + ++ MPFR_ALLOCA_MAX: Maximum size for the use of alloca by temporary + allocations (default: 16384). + This macro is not used when MPFR is built with + the GMP build directory (--with-gmp-build). + ++ MPFR_USE_THREAD_SAFE: Define to build MPFR as thread safe (TLS). ++ MPFR_USE_C11_THREAD_SAFE: + Define to implement TLS in the C11 way. + ++ MPFR_WANT_SHARED_CACHE: + Define to have caches shared by all threads. ++ MPFR_THREAD_LOCK_METHOD: + When MPFR_WANT_SHARED_CACHE is defined, this macro + gives the thread locking method (string). + ++ MPFR_HAVE_NORETURN: Define if the _Noreturn function specifier is + supported. ++ MPFR_HAVE_BUILTIN_UNREACHABLE: + Define if the __builtin_unreachable GCC built-in is + supported. + ++ MPFR_GENERIC_ABI: Define to disable code that is tied to a specific + ABI (e.g. GMP_NUMB_BITS value). + Note: Currently it is also used to disable code + specific to low precision, i.e. to use only generic + code. This is useful because most tests are written + for low precision, meaning that without this macro, + the generic code would not sufficiently be tested. + +List of macros used for checking MPFR: + ++ MPFR_HAVE_FESETROUND: Define if the function fesetround() is available + (and in header ). ++ MPFR_FPU_PREC: Allows to test MPFR on x86 processors when the + x87 FPU rounding precision has been changed (see + tests/tests.c for its usage). ++ HAVE_DENORMS: Define if subnormal (denormalized) floats work. ++ HAVE_SIGNEDZ: Define if signed zeros are supported. ++ HAVE_SYS_TIME_H: Define if the header sys/time.h is usable. ++ HAVE_GETTIMEOFDAY: Define if the function gettimeofday() is available. ++ HAVE_SETLOCALE: Define if the function setlocale() is available. ++ MPFR_ERRDIVZERO: Define if the floating-point division by 0 fails + (e.g. because a SIGFPE signal is generated, or + because it is regarded as undefined behavior by + a sanitizer). This disables the tests involving + such operations. ++ MPFR_TESTS_FPE_DIV: Define to check whether there has been a FP + exception FE_DIVBYZERO or FE_INVALID, which + probably comes from 1.0 / 0.0 or 0.0 / 0.0 to + generate an infinity or a NaN. This is normally + used together with MPFR_ERRDIVZERO, in order to + check that all divisions by 0 have been protected + in the tests (so that tests can pass on platforms + where the floating-point division by 0 fails). ++ MPFR_TESTS_FPE_TRAP: Define to trap the FE_DIVBYZERO and FE_INVALID + exceptions; MPFR_TESTS_FPE_DIV needs to be defined + too, and MPFR_ERRDIVZERO should be defined as well + to avoid spurious traps (see above). ++ MPFR_TESTS_TIMEOUT: Define to enable timeout in the tests. Its value + contains the default timeout (in seconds), or 0 + for no timeout by default, and can be overridden + at "make check" time with the MPFR_TESTS_TIMEOUT + environment variable. ++ MPFR_COV_CHECK: Define to enable value coverage checking (must not + be used in production). This macro is for the MPFR + developers, in order to improve the test suite. + +=========================================================================== + +Environment variables that affect the tests: + ++ GMP_CHECK_RANDOMIZE: Seed for the random functions, except for 0 or 1, + in which case a random (time based) seed is used. + By default, a fixed seed is used. Only developers + and testers should change the seed. + ++ MPFR_CHECK_LARGEMEM: Define to enable expensive tests. + ++ MPFR_CHECK_LIBC_PRINTF: + Define to enable comparisons with the printf + function of the C library. These comparisons are + disabled by default as failures could be due to + the C library itself on some machines, and they + do not affect MPFR. + ++ MPFR_CHECK_LOCALES: Fail in case a locale cannot be set. Developers + can set this variable on their machines to make + sure that needed locales are properly installed + and tested. + ++ MPFR_DEBUG_BADCASES: For debugging (see tests.c, function bad_cases). + ++ MPFR_SUSPICIOUS_OVERFLOW: + Define to check suspicious overflow in the generic + tests (tgeneric.c). For developers and testers. + ++ MPFR_TESTS_MEMORY_LIMIT: + The memory limit for the tests (default is + 2^22 = 4 MB). Set to 0 for unlimited. + ++ MPFR_TESTS_TIMEOUT: When timeout in the tests is enabled, this + overrides the value of the macro. + +=========================================================================== + +Before testing any macro in a .c file, one needs: + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +except if mpfr-impl.h (for the library) or mpfr-test.h (for the tests) is +included first, because these header files already have the above code. + +=========================================================================== + +The GNU Coding standards can be read at: + https://www.gnu.org/prep/standards_toc.html +ISO C Names and corresponding headers: + http://www.schweikhardt.net/identifiers.html +Language C: + http://www.vmunix.com/~gabor/c/draft.html + +To allow MPFR to be built on some buggy compiler, try to follow +theses rules: + + ===================================================================== + +Don't write: + mp_limb_t l; + [...] + if (l) do_action (); +But: + mp_limb_t l; + [...] + if (l != 0) do_action (); + +since mp_limb_t may be "unsigned long long", and some buggy compiler +produce illegal codes with the first form. + + ===================================================================== + +Try to avoid "LONG_MIN/1" since it produces a SIGNAL on (old) FreeBsd. +Don't forget that LONG_MIN/-1 is not representable (specially +with code like MPFR_EXP_MIN/n). + + ===================================================================== + +Don't use "near" and "far" as variable names since they are "Keywords" +for some C compiler (Old DOS compiler). Also don't use "pm", which is used +by the C compiler 'sharp' to design variables that should be stored in the +flash memory. Don't use "new", which is reserved in C++. + +Check C++ reserved keywords, e.g. from + + https://en.cppreference.com/w/cpp/keyword + +or more generally: + + https://www.google.com/search?q=%22C%2B%2B%22+reserved+keywords + +Quoted from : + + Avoid the use of identifiers or idioms that would prevent code + compiling with a C++ compiler. Identifiers such as new or class, + that are reserved words in C++, should not be used as variables + or field names. Explicit casts should be used to convert between + void* and other pointer types. + +When a string literal ("...") is followed by a macro name, there +must be white space between them, otherwise this is parsed as a +user-defined string literal in C++11: + + https://en.cppreference.com/w/cpp/language/user_literal + https://stackoverflow.com/a/6402166/3782797 + + ===================================================================== + +Setting errno is safe to signal some error information (as in the +formatted output functions), but errno must not be read (unless we +have just modified it) as this may yield undefined behavior in some +corner cases out of our control (ISO C99 / C11, 7.14.1.1p5, also +mentioned in J.2). + + ===================================================================== + +C-Reduce may be useful to try to identify whether a bug comes from the +compiler. + + ===================================================================== + +To do type punning (i.e. store a value of some type and reinterpret +it as another type), use a union. This is valid in ISO C99 and above +(in C99, see 6.5#7 and Note 82 of 6.5.2.3#3 for the clarification), +but not in C++. So, users of a C++ compilers should make sure that +their compiler supports type punning via a union. If some problem is +reported, we should address it either by making the code compatible +or by adding a configure test to reject the compiler. + +Some references: +* https://en.wikipedia.org/wiki/Type_punning#Use_of_union +* https://stackoverflow.com/questions/346622/opinions-on-type-punning-in-c + "Opinions on type-punning in C++?" + +=========================================================================== + +Avoid variable names "l", "I" and "O", which look like "1" and "0" with +some fonts. + +=========================================================================== + +For identifiers defined in MPFR, do not use the GMP namespaces +(gmp_..., GMP_...). + +=========================================================================== + +You are allowed to use the mpn and mpz classes of GMP functions (types +and functions starting with "mpn_" and "mpz_"). However, except for some +conversion functions where they may be needed, + * the mpq class and GMP's formatted output and input functions (i.e., + printf and scanf style) can only be used in an alternative method + by testing MPFR_USE_MINI_GMP (and only if there is a real benefit), + since they are not available in mini-gmp; + * the mpf class must not be used at all. + +=========================================================================== + +The headers , , and are always +included in mpfr-impl.h; thus you need not (and should not) include them +in usual source and test files. + +=========================================================================== + +For files that need intmax_t or similar, use: + +#if HAVE_INTTYPES_H +# include +#endif +#if HAVE_STDINT_H +# include +#endif + +Note that even though the ISO C99 standard requires that +include , in practice this is not true on all platforms, +such as OSF/1 (Tru64) 5.1. This is consistent with autoconf, which +has used this form since 2004-01-26 (in headers.m4). + +References: + https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=62ac9bbfebe879581dabeed78c6ac66b907dd51d + https://sympa.inria.fr/sympa/arc/mpfr/2010-08/msg00015.html + +=========================================================================== + +Use locale-dependent functions when the result needs to depend on the +locales, e.g. the fractional point in mpfr_out_str. + +Conversely, do not use locale-dependent functions when the result must +not depend on the locales. In particular, the alphanumeric characters +used in number strings (as created by mpfr_get_str) must be those of +the required characters from the basic character set (see ISO C99 +standard Section 5.2.1 "Character sets"). And tolower(letter) does +not necessarily return the corresponding lowercase letter from these +required characters. For instance, tolower('I') returns a dotless 'i' +in Turkish tr_TR.iso88599 locales. + +=========================================================================== + +If you have to mix TMP_DECL and MPFR_SAVE_EXPO_DECL in the declaring +section of your function, please declare MPFR_SAVE_EXPO_DECL before +TMP_DECL, since TMP_DECL may be replace by nothing: + +Instead of: Usually preprocessed as: + unsigned long t unsigned long t; + TMP_DECL (marker); ; + MPFR_SAVE_EXPO_DECL (expo); mpfr_save_expo_t expo; +use: + unsigned long t unsigned long t; + MPFR_SAVE_EXPO_DECL (expo); mpfr_save_expo_t expo; + TMP_DECL (marker); ; + +=========================================================================== + +Memory allocation +----------------- + +Do not use TMP_DECL / TMP_ALLOC, ... but MPFR_TMP_DECL, MPFR_TMP_ALLOC, ... + +In the tests, use only tests_allocate, tests_reallocate and tests_free +(there may be some rare exceptions, such as in tabort_defalloc*.c). + +Avoid code that would yield unnecessary reallocations, which can be very +expensive. In particular, for code that is based on the mpz layer of GMP, +do not use mpz_init, but mpz_init2 with the estimated maximum size; it is +better to overestimate this size a bit than underestimating it. + +=========================================================================== + +Do not use C99-only features, such as empty macro arguments or C++-style +comments. + +=========================================================================== + +When testing a "boolean" macro M (i.e. which is normally either equal +to 1 or undefined), do not use #if M, but #ifdef M or #if defined(M). +With icc, the form #if M triggers a warning ("remark #193: zero used +for undefined preprocessing identifier"). + +=========================================================================== + +If you want to use the logging of MPFR, you need to enable it: + make distclean + ./configure --enable-logging + make +Then link your program with this new build of MPFR. + +Warning! The logging code for functions sometimes output an "inexact" +value, but in case of exception, this value may be meaningless. In +fact, the output value is the value of some variable; please check +the source code of the function to understand its real meaning. + +You can control what is logged using the environment variables: + +MPFR_LOG_FILE: Name of the LOG file (default: mpfr.log). +MPFR_LOG_FLUSH: When this variable is set, flush the log stream after + each log output (useful to get the latest logs in case + of crash, but this makes logging slower). +MPFR_LOG_PREC: Number of digits of the output (set the internal variable + mpfr_log_prec, default: 6). +MPFR_LOG_LEVEL: Max recursive level (default: 7). + +MPFR_LOG_INPUT: Log the input +MPFR_LOG_OUTPUT: Log the output +MPFR_LOG_TIME: Log the time spent inside the function. +MPFR_LOG_INTERNAL: Log the intermediary variables if any. +MPFR_LOG_MSG: Log the messages sent by MPFR if any. +MPFR_LOG_ZIV: Log what the Ziv Loops do. +MPFR_LOG_STAT: Log how many times Ziv failed. +MPFR_LOG_ALL: Log everything + +Define them. Run your program, and view `mpfr.log`. + +For example, just define MPFR_LOG_ALL, run you program, and view `mpfr.log`. + +Note: The running time may be much longer. If logging is used on the +test suite with a default timeout, it may be necessary to increase the +timeout time by setting the environment variable MPFR_TESTS_TIMEOUT +to the new timeout value in seconds (or 0 to disable the timeout). + +=========================================================================== + +This feature is available only for gcc >= 3.0 and glibc >= 2.0. +To achieve this, theses macros have been added: + ++++ MPFR_LOG_VAR(y) + Log a MPFR variable if requested (INTERNAL). + Example: + mpfr_t y; + MPFR_LOG_VAR (y); + ++++ MPFR_LOG_MSG(x) + Log another message (a warning for example) +Example: + MPFR_LOG_MSG (("WARNING: Unchecked code\n", 0)); +The 0 is here a dummy value, because there must be at least an argument +after the format string. + ++++ MPFR_LOG_BEGIN(x) + Add this macro at the beginning of a function. +Example: + int dodo (mpfr_t x, mpfr_t op, int cnt, mpfr_rnd_t rnd) { + [decl] + MPFR_LOG_BEGIN (("op[%Pu]=%.*Rg rnd=%s", + mpfr_get_prec(op), mpfr_log_prec, op, RND2STR(rnd))); + ++++ MPFR_LOG_END(x) + Add this macro at the end of a function. +Example: + MPFR_LOG_END (("x[%Pu]=%.*Rg i=%d", mpfr_get_prec (x), mpfr_log_prec, x, i)); + return i; +} + ++++ MPFR_LOG_FUNC (begin,end) + Add this macro at the beginning of a function. It does +the same job as MPFR_LOG_BEGIN and MPFR_LOG_END but it is smatter +since it intercepts the return itself to put the end statement. +Example + MPFR_LOG_FUNC ( + ("op[%Pu]=%.*Rg rnd=%d", op, mpfr_get_prec (op), mpfr_log_prec, op), + ("x[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (x), mpfr_log_prec, x, i)); + + +The double brackets "((" and "))" are needed since MPFR must still +compile with non GNU compiler, so Macros with variable # of args +are not allowed. + +It uses the extension of the mpfr_printf function: %Rf to display a mpfr_t. +%Ru is used to display the precision of a mpfr_t. +It uses some extended attributes of GCC (constructor, etc.) to achieve +its goals too. + +=========================================================================== + +ZivLoop Controller + +Ziv strategy is quite used in MPFR. In order to factorize the code, you +could use theses macros: + ++++ MPFR_ZIV_DECL(_x) + Declare a ZivLoop controller + ++++ MPFR_ZIV_INIT(_x, _prec) + Init a ZivLoop controller according to the initial value of _prec. + ++++ MPFR_ZIV_NEXT(_x, _prec) + Increase the precision _prec according to the ZivLoop controller. + ++++ MPFR_ZIV_FREE(_x) + Free the ZivLoop controller. + +=========================================================================== + +If you plan to add a new function, you could follow this schema: + +int +mpfr_toto (mpfr_ptr rop, mpfr_srcptr op, mpfr_rnd_t rnd) +{ + [Declare all used variables] + int inexact; + mpfr_prec_t prec; + MPFR_ZIV_DECL (loop); + MPFR_SAVE_EXPO_DECL (expo); + + /* Log it if requested */ + MPFR_LOG_BEGIN + (("op[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (op), mpfr_log_prec, op, rnd), + ("rop[%Pu]=%.*Rg inexact=%d", + mpfr_get_prec (rop), mpfr_log_prec, rop, inexact)); + + /* First deal with particular cases */ + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (op))) + { + if (MPFR_IS_NAN (op)) + { + MPFR_SET_NAN (rop); + MPFR_RET_NAN; + } + else if (MPFR_IS_INF (op)) + { + [Code to deal with Infinity] + } + else + { + MPFR_ASSERTD (MPFR_IS_ZERO (op)); + [Code to deal with Zero] + } + } + [Other particular case: For example, op<0 or op == 1] + + [Compute the first estimation of the used precision `prec`] + [Initialize the intermediate variables using mpfr_init2] + MPFR_SAVE_EXPO_MARK (expo); /* Maximal range for exponent */ + + MPFR_ZIV_INIT (loop, prec); /* Initialize the ZivLoop controller */ + for (;;) /* Infinite loop */ + { + [Compute an estimation of the function and] + [an estimate of the error.] + if (MPFR_CAN_ROUND (...)) /* If we can round, quit the loop */ + break; + MPFR_ZIV_NEXT (loop, prec); /* Increase used precision */ + [Use `mpfr_set_prec` to resize all needed intermediate variables] + } + MPFR_ZIV_FREE (loop); /* Free the ZivLoop Controller */ + + inexact = mpfr_set (rop, temp, rnd); /* Set rop to the computed value */ + [Clear all intermediate variables] + + MPFR_SAVE_EXPO_FREE (expo); /* Restore exponent range */ + return mpfr_check_range (rop, inexact, rnd); /* Check range and quit */ +} + +Make sure that Ziv loops cannot increase the precision forever because of +internal exception. Otherwise one gets either a segmentation fault (with +limited stack size) or an assertion failure (with unlimited stack size, +e.g. with "make check"). + +Do not use code with side effects inside MPFR_ASSERTD or MPFR_ASSERTN, +as assertion checking can be disabled. If a variable is set only to test +it in an MPFR_ASSERTD expression, the MPFR_DBGRES macro should be used +with the assignment as its argument, e.g. + int inex; + MPFR_DBGRES (inex = mpfr_set (y, x, rnd)); + MPFR_ASSERTD (inex == 0); + +Exception handling (overflow/underflow in particular): + * Warning: To detect exceptions and/or possible error loss due to + internal exceptions, testing whether some variable is singular with + MPFR_IS_SINGULAR is generally not sufficient! Indeed, in case of + overflow (resp. underflow), the value may be rounded (in absolute + value) to the largest finite number (resp. to the smallest non-zero + number, possible even in round-to-nearest mode). + * The MPFR_BLOCK* macros can be useful, e.g. + { + MPFR_BLOCK_DECL (flags); + /* ... */ + MPFR_BLOCK (flags, /* expression or statements */) + /* ... */ + if (MPFR_OVERFLOW (flags)) + { /* case of overflow in expression or statements */ } + /* ... */ + } + See mpfr-impl.h (search for MPFR_BLOCK) for more information. + +=========================================================================== + +If you plan to add a new threshold in MPFR which could be tuned, +you should add its default value in the file `mparam_h.in'. When the +script configure finishes, it creates the file `mparam.h' from `mparam_h.in'. + +Then you needs to modify the program `tuneup.c' to allow it to compute +the new threshold. If it is a classical threshold (not complex), you could +use this method (example of mpfr_exp): + +/* Define the threshold as a variable instead of a constant */ +mpfr_prec_t mpfr_exp_threshold; +#undef MPFR_EXP_THRESHOLD +#define MPFR_EXP_THRESHOLD mpfr_exp_threshold +/* Include the test function to threshold directly in the test + program. It will override the mpfr_exp coming from libmpfr.a */ +#include "exp.c" +/* Define the speed function related to mpfr_exp */ +static double speed_mpfr_exp (struct speed_params *s) { + SPEED_MPFR_FUNC (mpfr_exp); +} + +Then in the function `all', you will have to call the tune function, +and write the new THRESHOLD in the file `mparam.h': + + /* Tune mpfr_exp */ + if (verbose) + printf ("Tuning mpfr_exp...\n"); + tune_simple_func (&mpfr_exp_threshold, speed_mpfr_exp); + fprintf (f, "#define MPFR_EXP_THRESHOLD %lu\n", + (unsigned long) mpfr_exp_threshold); + +More complex tuning is possible but needs special attention. + +=========================================================================== + +MPFR uses many macros, thus finding where an error occurs exactly may +be difficult when it is in some macro expansion. For GCC users, a new +experimental -ftrack-macro-expansion option has been added in GCC 4.7. +"It allows the compiler to emit diagnostic about the current macro +expansion stack when a compilation error occurs in a macro expansion." + + +=========================================================================== + +Bit Twiddling Hacks - Sean Eron Anderson maintain a list of tricks to get +efficient code on . +WARNING: some of those tricks may not take into account possible overflows, +and may not be portable. + +=========================================================================== + +MPFR manual (mpfr.texi): + * Use "significand", not "mantissa". + * Use "@minus{}" for the minus character, not "-". + * Warning! Texinfo is not like TeX. Whitespace is preserved in the + info file. So, do not use additional space for .texi indentation. + This also means that you need to care about the typography. Please + read Section "Inserting Space" in the Texinfo manual. + * Follow the English typography, not the French one! + * Beware of the following texinfo bug: + https://savannah.gnu.org/bugs/?33329 + https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=583558 + +=========================================================================== + +Running "make" outputs a lot of information, and warnings are not very +visible. The following tool "eet" allows a copy of warning messages to +be output to a different window (e.g. xterm or zenity): + + https://www.vinc17.net/unix/#eet + +Direct link to the tarball: https://www.vinc17.net/unix/eet.tar.xz + +=========================================================================== + +Be careful when avoiding "'var' may be used uninitialized in this function" +warnings from gcc. Initializing such variables to a dummy value has several +drawbacks: + * this may prevent other tools (that do static or dynamic analysis) from + detecting bugs; + * this makes code maintenance more difficult (e.g. when modifying the + code, one may more easily forget a real initialization); + * this makes the compiler add useless code (though this should not be + significant). + +The INITIALIZED macro can be used to avoid such warnings with gcc, e.g. + + int INITIALIZED(i); + +It uses the "int i = i;" pseudo-initialization trick, disabled with other +compilers as this is undefined behavior. See: + + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36296 + +If a dummy initialization must be added, use preferably an "invalid" value +(e.g. NULL for pointers, or a value that can be checked with MPFR_ASSERTN +before using it) that could make the program abort instead of returning an +incorrect value in case of a bug in MPFR. + +=========================================================================== + +Avoid mixing signed and unsigned integer types, as this can lead signed +types to be automatically converted into unsigned types (usual arithmetic +conversions). If such a signed type contains a negative value, the +result will probably be incorrect. With MPFR 2.x, this problem could +arise with mpfr_exp_t, which is signed, and mpfr_prec_t (mp_prec_t), +which was unsigned (it is now signed), meaning that in general, a cast +of a mpfr_prec_t into a mpfr_exp_t was needed. + +Note that such bugs are difficult to detect because they may depend on +the platform (e.g., on LP64, 32-bit unsigned int + 64-bit long is OK, +but on ILP32, 32-bit int + 32-bit unsigned long is incorrect), but also +on the input values. So, do not rely on tests very much. However, if +a test works on 32 bits but fails on 64 bits in the extended exponent +range (or conversely), the cause may be related to the integer types +(e.g. a signness problem or an integer overflow due to different type +sizes). + +When creating a new variable that will always contain nonnegative values, +it is generally better to define it as a signed type if it may be used in +an arithmetic expression. The exceptions are when the value is seen as an +array of bits (e.g. for limbs) and to locally avoid integer overflow. + +=========================================================================== + +You can use the features related to intmax_t only if _MPFR_H_HAVE_INTMAX_T +is defined. In such a case, do not use the macros UINTMAX_MAX, INTMAX_MAX +and INTMAX_MIN directly (because they may make the compilation fail), but +the MPFR versions: MPFR_UINTMAX_MAX, MPFR_INTMAX_MAX and MPFR_INTMAX_MIN. + +=========================================================================== + +Use mpfr_prec_t and mpfr_rnd_t instead of the old types mp_prec_t and +mp_rnd_t. Similarly, use mpfr_exp_t instead of GMP's mp_exp_t type +(unless you really want mp_exp_t, e.g. for conversions with mpf; but +you should not assume that mpfr_exp_t and mp_exp_t are identical). + +=========================================================================== + +How to specify (for reading) the minimum exponent or the maximum exponent +in the MPFR source depends on the context. + +1. The most portable form is mpfr_get_emin() and mpfr_get_emax(). In + the MPFR source, this is equivalent to __gmpfr_emin and __gmpfr_emax + respectively (macros are defined in mpfr-impl.h; the only difference + is that the macros do not evaluate to a lvalue). + +2. If the exponent range has been extended, you can use the constants + MPFR_EXT_EMIN and MPFR_EXT_EMAX instead. This will be faster if TLS + is enabled. It also avoids a bug on some Linux/Sparc machines with + some GCC versions and TLS, but this shouldn't be the primary concern, + as this might be the other way round on some other machines. This is + the most common context. + Note: If you really want to specify the current minimum or maximum + exponent, do not use MPFR_EMIN_MIN or MPFR_EMAX_MAX, even though + they have the same value. This may prevent some form of testing in + the future. + +3. If you want the minimum and maximum possible exponent values supported + by MPFR, use MPFR_EMIN_MIN and MPFR_EMAX_MAX respectively. + +4. If you want the minimum and maximum values supported by the mpfr_exp_t + type (i.e. the limits of this type), use MPFR_EXP_MIN and MPFR_EXP_MAX + respectively. This may be useful for intermediate computations on the + exponents. + +More on exponent handling: + +* The unsigned type corresponding to mpfr_exp_t is mpfr_uexp_t. It may be + useful if the considered values are nonnegative and don't necessarily + fit in mpfr_exp_t. To convert a mpfr_exp_t to mpfr_uexp_t, you should + use the MPFR_UEXP macro, as in debug mode, it checks that the value is + nonnegative (in future MPFR versions, MPFR_UEXP could tell the compiler + that the value is nonnegative, possibly allowing more optimization). + +* If a mpfr_exp_t appears in arithmetic expressions together with ISO C90 + types int and/or long, computations must be done with the largest type, + which is provided by mpfr_eexp_t. + +* If a mpfr_exp_t needs to be converted from or to a MPFR number, the + mpfr_set_exp_t or mpfr_get_exp_t macro should be used. + +* If a mpfr_exp_t needs to be converted into a character string with a + formatted output function (fprintf, printf, sprintf), the mpfr_eexp_t + type should be used, together with the MPFR_EXP_FSPEC specifier, e.g. + + printf ("%" MPFR_EXP_FSPEC "d", (mpfr_eexp_t) exponent); + +For implementation details, see the mpfr.h and mpfr-impl.h files. + +=========================================================================== + +Be careful that the ternary value (a.k.a. "inexact") is not guaranteed +to be -1, 0, or 1, in general (for some functions, the exact value may +contain other information, such as midpoint cases with MPFR_EVEN_INEX), +and the exact behavior may change in the future. So, it is not correct +to multiply ternary values returned by arbitrary functions as this may +overflow. + +To work with ternary values, mpfr-impl.h provides the following macros: + +#define SIGN(I) ((I) < 0 ? -1 : (I) > 0) +#define SAME_SIGN(I1,I2) (SIGN (I1) == SIGN (I2)) + +=========================================================================== + +Because of a bug in the Mac OS X 10.5 linker, avoid tentative definitions +(C99, 6.9.2). Depending on the context, use either a simple declaration +(with the "extern" storage-class specifier) or an external definition. +This is also cleaner. + +=========================================================================== + +In case of detected internal error, do not use printf() and exit(). +Use assertions (MPFR_ASSERTN) instead. + +=========================================================================== + +When using GNU extensions (based on the value of the __GNUC_* macros), check +whether they work with ICC. The following paper can give useful information: +"Intel® Compilers for Linux*: Compatibility with GNU Compilers" at +. + +To detect compilers, see + + https://sourceforge.net/p/predef/wiki/Compilers/ + +=========================================================================== + +For developers - Use of the svn:eol-style Subversion property + +The svn:eol-style Subversion property is traditionally set to "native" on +text files, but this has drawbacks: + * On systems where the end-of-line (EOL) sequence is not LF, the obtained + files are different from those from the tarballs. This makes maintenance + harder. + * Some tools under Windows (such as makeinfo of MinGW/MSYS) don't support + the MS-Windows EOL sequence CRLF, and the MPFR build fails. + +For these reasons, the svn:eol-style Subversion property should never be set +to "native". + +=========================================================================== + +About the test suite +-------------------- + +When adding a test file for a new function (say mpfr_func), you can use +the following prototype tfunc.c (to put in the directory 'tests'). +This file performs random tests for values of x between -5 and 5, with +a precision varying from 2 to 100. + +You can add your own tests to this basic file. When adding the expected +result, do NOT use the one obtained from the MPFR function! Otherwise, +if this function is buggy, the test will be wrong and the function will +remain buggy. For random tests, avoid mpfr_urandomb as its values are +not truly random due to how it is specified (if the exponent is less +than 0, some of the trailing bits will necessarily be 0). + +Do not forget to add 'tfunc' in the variable check_PROGRAMS +of the tests/Makefile.am file. + +/* Test file for mpfr_func. + +Copyright 2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-test.h" + +#define TEST_FUNCTION mpfr_func +#define TEST_RANDOM_EMIN -5 +#define TEST_RANDOM_EMAX 5 +#include "tgeneric.c" + +int +main (int argc, char *argv[]) +{ + tests_start_mpfr (); + + test_generic (2, 100, 100); + + tests_end_mpfr (); + return 0; +} + + --------------------------------------------------------------------- + +Here is how the test suite works since the full Automake 1.13 support +(merge of the vl-am113 branch in r8821). + +The tests_start_mpfr function, which should be called at the beginning +of each test program (unless nothing is tested and main() just contains +"return 77;"), starts by calling the test_version function, whose goal +is to do various header/library version checks of GMP and MPFR. In case +of mismatch between a header and a library, an error message is output +("make check" will redirect it to a log file). Then there are 3 cases: + +1. An error in the MPFR version check is a fatal error: test_version() + exits with an error (exit status = 1). The reason is that a different + MPFR library (somewhere in some library search path) would probably + be tested, so that the results of the test would be meaningless. + +2. An error in the GMP version check is a non-fatal error: if there are + no errors in MPFR version check, test_version() returns with value 1. + However the tversion test program will regard this as a fatal error + (thus "make check" will fail). The probable reason of the mismatch is + that the GMP library has been upgraded while the MPFR test suite has + not been rebuilt; otherwise there is probably something wrong in the + GMP installation. + +3. Otherwise test_version() returns with value 0 (everything is fine). + +Note: The tests_start_mpfr function does a setbuf on stdout to disable +buffering. As a consequence, no operations on stdout (such as printf) +must be done before this function is called. + +With Automake 1.13+, the tests are run in parallel if a -j make option +is used. In case of failure, information can be found in the log file +of each failed test program and in the global tests/test-suite.log file +(which is output automatically if the VERBOSE environment variable is +set to 1). If no tests fail, then the tests/tversion.log file is output +after the "testsuite summary"; it contains various useful information +about the MPFR build. + +To use a wrapper to run the tests, such as valgrind or wine, define +LOG_COMPILER, e.g.: + LOG_COMPILER="valgrind -q --error-exitcode=1 --leak-check=full" make check + LOG_COMPILER=wine make check + +More information about the parallel test harness: +https://www.gnu.org/software/automake/manual/automake.html#Parallel-Test-Harness + + --------------------------------------------------------------------- + +In the tests, do not use `mpfr_set_d` (except when testing it), as the +result will depend on the floating-point arithmetic of the system; +this has shown many problems in the past and problems may still occur +with new systems. Use `mpfr_set_si` or `mpfr_set_str` instead. + +To check the result of some function, use mpfr_equal_p rather than +mpfr_cmp, as mpfr_cmp will return 0 (equality) if the result is NaN. + +Do not use functions that need optional features (except in a context +where such features are required). For instance, the mpfr_printf-like +functions need (HAVE_STDARG defined), thus should not be +used, except for testing them. + +For temporary result files created by test programs, choose a unique +filename to avoid conflicts in parallel tests. To ensure that, the +filename should start with the name of the test program (for instance, +"tfprintf_out.txt" for tfprintf.c). Add the filename to CLEANFILES in +the tests/Makefile.am file. + +Also, make sure that the tests run against previous MPFR versions, +possibly by disabling some tests with code like + + #if MPFR_VERSION >= MPFR_VERSION_NUM(2,3,0) + +Indeed one can now easily run the trunk tests in a branch by executing + + svn switch .../svn/mpfr/trunk/tests tests + +from the working copy. One can know when the tests directory has been +switched, thanks to + + $ svn status + S tests + +In case of failure, freeing the memory explicitly is not necessary. +We do this in case of success just to be able to detect memory leaks +in MPFR. + + --------------------------------------------------------------------- + +To check the coverage of the test suite, you can use gcov. + ./configure CFLAGS="-fprofile-arcs -ftest-coverage" + make clean + make check + find . -name '*.c' -exec gcov '{}' ';' | grep "lines executed" | sort + +For each source file, there is a .c.gcov file which contains much more +information. + +Another solution is to run the script 'coverage' within the 'tools' directory. + + --------------------------------------------------------------------- + +To run the MPFR test suite under valgrind, you may need to do several +things. + +First, as the running time is much longer than usual, you should not use +the --enable-tests-timeout configure option, or set the timeout value to +a large value; this can be done at run time, e.g. with + + export MPFR_TESTS_TIMEOUT=0 + +to disable the timeout, so that you do not need to rebuild MPFR for +this purpose. + +Then just set the LOG_COMPILER environment variable to something like + + valgrind -q --error-exitcode=1 --leak-check=full + +before running "make check", or type directly: + + LOG_COMPILER="valgrind -q --error-exitcode=1 --leak-check=full" make check + +NOTE: with the new tests/Makefile.am file, the following is obsolete; +but it might still be useful under some occasions, e.g. if all the +valgrind output needs to be sent to a single file. + +Before running valgrind, you should run "make check" a first time so +that everything is compiled out of valgrind. + +Then you need the --trace-children=yes valgrind option (a possible +exception is when you run an individual test that has been built +statically). The reason is that libtool generates wrapper scripts +to link the tests against the right libraries. The drawback is that +you will get valgrind output for all the processes, including the +shell commands from the wrapper scripts (the --trace-children-skip +valgrind option will not allow you to filter every unwanted process). +But you can filter the output with: + + sed -n '/= Command: [^ ]*\/\.libs\/lt-/,/= ERROR SUMMARY:/p' + +For readability, you should redirect the valgrind output to a file. +You can use --log-file, but due to --trace-children=yes, you need +the %p format specifier in the filename argument to generate a file +for each child; however many files will be generated, and it may be +better to use the following method to get a single file: + + valgrind --trace-children=yes --log-fd=3 make check 3> vg.out + +then + + sed -n '/= Command: [^ ]*\/\.libs\/lt-/,/= ERROR SUMMARY:/p' vg.out + +to get only the valgrind output corresponding to the MPFR tests. + +Or if your shell supports it, you can use a process substitution +to filter the valgrind output directly to a file, e.g. with bash +or zsh: + + valgrind --trace-children=yes --log-fd=3 make check 3> >(sed -n \ + '/= Command: [^ ]*\/\.libs\/lt-/,/= ERROR SUMMARY:/p' > vg.out) + +if you do not mind about the buffering delays. + + --------------------------------------------------------------------- + +NOTE: with "AM_LDFLAGS = -no-install" in tests/Makefile.am, the following +is obsolete, as libtool no longer generates wrapper scripts; but it is left +here in case negative effects of "AM_LDFLAGS = -no-install" are seen or for +users with a special setup. + +To debug some test program, e.g. tadd, with gdb, you cannot run "gdb tadd" +since libtool has generated a wrapper script to link the program against +the correct MPFR library. Instead, run: + + libtool --mode=execute gdb tadd + +Alternatively, something like + + LD_PRELOAD=../src/.libs/libmpfr.so gdb .libs/tadd + +may also work (example for GNU/Linux). + +Note: for test programs not listed in Makefile.am (check_PROGRAMS), +libtool is not used (a static link against MPFR is done via LOADLIBES +in Makefile.am), so that gdb should be used in the conventional way. +You can use the following wrapper script to have a command that works +with both: + +------------------------------------------------------------ +#!/bin/sh + +unset cmd +case $1 in + -*) ;; + ?*) test "x$(head -c 2 "$1")" = 'x#!' && \ + grep -q "^# Generated by libtool" "$1" && \ + cmd="libtool --mode=execute" ;; +esac + +exec $cmd gdb "$@" +------------------------------------------------------------ + +and + + alias gdb='/path/to/the/wrapper/script' + +=========================================================================== + +To cross-compile MPFR for i586-mingw32msvc and test it under Wine: + +0. Install wine (at least the 32-bit version). + +1. Build and install GMP. + +In the GMP source directory: +$ ./configure --host=i586-mingw32msvc --disable-shared --prefix=... \ + CC="i586-mingw32msvc-gcc -D__USE_MINGW_ANSI_STDIO" +$ make +$ make check LOG_COMPILER=wine +[If few tests fail, ignore them.] +$ make install + +(the -D__USE_MINGW_ANSI_STDIO option is used to allow an ISO-compliant +printf as mentioned in MPFR's INSTALL file, otherwise MPFR needs to be +configured with "CPPFLAGS=-DNPRINTF_J -DNPRINTF_L -DNPRINTF_T"). + +2. Build and check MPFR. + +In the MPFR source directory: +$ ./configure --host=i586-mingw32msvc --disable-shared --with-gmp=... +$ make +$ make check LOG_COMPILER=wine + +Note: Due to bugs in autoconf[1] and dash[2], the configure script +may create files with a binary filename or have any other arbitrary +behavior if /bin/sh is dash. The cause is that it tries to execute +a MS Windows executable, which is interpreted as a shell script by +dash (thus with random, meaningless commands). This will confuse +Subversion, and these files need to be removed manually. + +[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=850329 +[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=816313 + +=========================================================================== + +After a MPFR build, the list of GMP symbols used by this particular MPFR +build can be obtained as follows: + + nm -u src/.libs/libmpfr.so | sed -n 's/^ *U \(__gmp.*\)/\1/p' + +at least under Linux, the library name and the "nm" behavior being +non-portable (adding the POSIX "-P" option may help, but there are +still differences between platforms). + +Note that this list may depend on various parameters, such as the +architecture and the compilation options. + +GMP internal symbols used by MPFR can be detected with the following +shell command (just replace /path/to/gmp.h by the actual pathname): + +nm -u src/.libs/libmpfr.so | sed -n 's/^ *U \(__gmp.*\)/\1/p' | \ +while read s +do + case $s in + __gmpn_*) regex="__MPN(${s#__gmpn_})" ;; + *) regex="$s" ;; + esac + grep -q "^#define .* ${regex}$" /path/to/gmp.h || echo "Internal: $s" +done + +A similar check can be done with "make check-gmp-symbols". + +One can also check that MPFR does not define exported symbols with a +prefix outside "mpfr_" and "__gmpfr_" by using "nm -g" and filtering +at least the "U" lines. But this can only be a manual check to avoid +false positives. Checking that a GMP reserved prefix is not used can +be done automatically, as with "make check-exported-symbols". + +=========================================================================== + +To update the FAQ, checkout the misc directory of the repository root. +Modify the faq.xhtml file and run + + xsltproc --nodtdattr faq-web.xsl faq.xhtml > www/faq.html + +Check with "svn diff" that this change has been done correctly (in case +of incorrect installation of XML tools), validate the files with + + xmllint --noout --loaddtd --valid faq.xhtml www/faq.html + +and if everything is OK (no error messages), commit both files. + +Update the FAQ.html file with update-faq in the doc directory of the +MPFR trunk and supported branches. diff -Nru mpfr4-3.1.4/doc/texinfo.tex mpfr4-4.0.2/doc/texinfo.tex --- mpfr4-3.1.4/doc/texinfo.tex 2016-03-06 11:33:18.000000000 +0000 +++ mpfr4-4.0.2/doc/texinfo.tex 2019-01-07 13:57:16.000000000 +0000 @@ -3,11 +3,12 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2013-02-01.11} +\def\texinfoversion{2018-02-12.17} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, -% 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. +% 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 +% Free Software Foundation, Inc. % % This texinfo.tex file is free software: you can redistribute it and/or % modify it under the terms of the GNU General Public License as @@ -20,7 +21,7 @@ % General Public License for more details. % % You should have received a copy of the GNU General Public License -% along with this program. If not, see . +% along with this program. If not, see . % % As a special exception, when this file is read by TeX when processing % a Texinfo source document, you may use the result without @@ -29,9 +30,9 @@ % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: -% http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or -% http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or -% http://www.gnu.org/software/texinfo/ (the Texinfo home page) +% https://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or +% https://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or +% https://www.gnu.org/software/texinfo/ (the Texinfo home page) % The texinfo.tex in any given distribution could well be out % of date, so if that's what you're using, please check. % @@ -55,7 +56,7 @@ % extent. You can get the existing language-specific files from the % full Texinfo distribution. % -% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. +% The GNU Texinfo home page is https://www.gnu.org/software/texinfo. \message{Loading texinfo [version \texinfoversion]:} @@ -66,6 +67,10 @@ \everyjob{\message{[Texinfo version \texinfoversion]}% \catcode`+=\active \catcode`\_=\active} +% LaTeX's \typeout. This ensures that the messages it is used for +% are identical in format to the corresponding ones from latex/pdflatex. +\def\typeout{\immediate\write17}% + \chardef\other=12 % We never want plain's \outer definition of \+ in Texinfo. @@ -96,7 +101,9 @@ \let\ptexraggedright=\raggedright \let\ptexrbrace=\} \let\ptexslash=\/ +\let\ptexsp=\sp \let\ptexstar=\* +\let\ptexsup=\sup \let\ptext=\t \let\ptextop=\top {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode @@ -155,22 +162,13 @@ \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi -% Since the category of space is not known, we have to be careful. -\chardef\spacecat = 10 -\def\spaceisspace{\catcode`\ =\spacecat} - -% sometimes characters are active, so we need control sequences. -\chardef\ampChar = `\& -\chardef\colonChar = `\: -\chardef\commaChar = `\, +% Give the space character the catcode for a space. +\def\spaceisspace{\catcode`\ =10\relax} + +% Likewise for ^^M, the end of line character. +\def\endlineisspace{\catcode13=10\relax} + \chardef\dashChar = `\- -\chardef\dotChar = `\. -\chardef\exclamChar= `\! -\chardef\hashChar = `\# -\chardef\lquoteChar= `\` -\chardef\questChar = `\? -\chardef\rquoteChar= `\' -\chardef\semiChar = `\; \chardef\slashChar = `\/ \chardef\underChar = `\_ @@ -184,7 +182,7 @@ % Hyphenation fixes. \hyphenation{ Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script - ap-pen-dix bit-map bit-maps + auto-ma-ti-cal-ly ap-pen-dix bit-map bit-maps data-base data-bases eshell fall-ing half-way long-est man-u-script man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces @@ -193,17 +191,6 @@ wide-spread wrap-around } -% Margin to add to right of even pages, to left of odd pages. -\newdimen\bindingoffset -\newdimen\normaloffset -\newdimen\pagewidth \newdimen\pageheight - -% For a final copy, take out the rectangles -% that mark overfull boxes (in case you have decided -% that the text looks ok even though it passes the margin). -% -\def\finalout{\overfullrule=0pt } - % Sometimes it is convenient to have everything in the transcript file % and nothing on the terminal. We don't just call \tracingall here, % since that produces some useless output on the terminal. We also make @@ -248,6 +235,15 @@ \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount \removelastskip\penalty-200\bigskip\fi\fi} +% Output routine +% + +% For a final copy, take out the rectangles +% that mark overfull boxes (in case you have decided +% that the text looks ok even though it passes the margin). +% +\def\finalout{\overfullrule=0pt } + % Do @cropmarks to get crop marks. % \newif\ifcropmarks @@ -270,10 +266,18 @@ % % Another complication is to let the user choose whether \thischapter % (\thissection) refers to the chapter (section) in effect at the top -% of a page, or that at the bottom of a page. The solution is -% described on page 260 of The TeXbook. It involves outputting two -% marks for the sectioning macros, one before the section break, and -% one after. I won't pretend I can describe this better than DEK... +% of a page, or that at the bottom of a page. + +% \domark is called twice inside \chapmacro, to add one +% mark before the section break, and one after. +% In the second call \prevchapterdefs is the same as \lastchapterdefs, +% and \prevsectiondefs is the same as \lastsectiondefs. +% Then if the page is not broken at the mark, some of the previous +% section appears on the page, and we can get the name of this section +% from \firstmark for @everyheadingmarks top. +% @everyheadingmarks bottom uses \botmark. +% +% See page 260 of The TeXbook. \def\domark{% \toks0=\expandafter{\lastchapterdefs}% \toks2=\expandafter{\lastsectiondefs}% @@ -281,11 +285,15 @@ \toks6=\expandafter{\prevsectiondefs}% \toks8=\expandafter{\lastcolordefs}% \mark{% - \the\toks0 \the\toks2 - \noexpand\or \the\toks4 \the\toks6 - \noexpand\else \the\toks8 + \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top + \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom + \noexpand\else \the\toks8 % 2: color marks }% } + +% \gettopheadingmarks, \getbottomheadingmarks, +% \getcolormarks - extract needed part of mark. +% % \topmark doesn't work for the very first chapter (after the title % page or the contents), so we use \firstmark there -- this gets us % the mark with the chapter defs, unless the user sneaks in, e.g., @@ -301,33 +309,67 @@ % Avoid "undefined control sequence" errors. \def\lastchapterdefs{} \def\lastsectiondefs{} +\def\lastsection{} \def\prevchapterdefs{} \def\prevsectiondefs{} \def\lastcolordefs{} +% Margin to add to right of even pages, to left of odd pages. +\newdimen\bindingoffset +\newdimen\normaloffset +\newdimen\txipagewidth \newdimen\txipageheight + % Main output routine. +% \chardef\PAGE = 255 \output = {\onepageout{\pagecontents\PAGE}} \newbox\headlinebox \newbox\footlinebox -% \onepageout takes a vbox as an argument. Note that \pagecontents -% does insertions, but you have to call it yourself. +% \onepageout takes a vbox as an argument. +% \shipout a vbox for a single page, adding an optional header, footer, +% cropmarks, and footnote. This also causes index entries for this page +% to be written to the auxiliary files. +% \def\onepageout#1{% \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi % \ifodd\pageno \advance\hoffset by \bindingoffset \else \advance\hoffset by -\bindingoffset\fi % + % Common context changes for both heading and footing. % Do this outside of the \shipout so @code etc. will be expanded in % the headline as they should be, not taken literally (outputting ''code). + \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars} + % + % Retrieve the information for the headings from the marks in the page, + % and call Plain TeX's \makeheadline and \makefootline, which use the + % values in \headline and \footline. + % + % This is used to check if we are on the first page of a chapter. + \ifcase1\topmark\fi + \let\prevchaptername\thischaptername + \ifcase0\firstmark\fi + \let\curchaptername\thischaptername + % \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi - \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi - \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% + % + \ifx\curchaptername\prevchaptername + \let\thischapterheading\thischapter + \else + % \thischapterheading is the same as \thischapter except it is blank + % for the first page of a chapter. This is to prevent the chapter name + % being shown twice. + \def\thischapterheading{}% + \fi + % + \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}% + \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}% % {% + % Set context for writing to auxiliary files like index files. % Have to do this stuff outside the \shipout because we want it to % take effect in \write's, yet the group defined by the \vbox ends % before the \shipout runs. @@ -336,10 +378,10 @@ \normalturnoffactive % \ in index entries must not stay \, e.g., if % the page break happens to be in the middle of an example. % We don't want .vr (or whatever) entries like this: - % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} + % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}} % "\acronym" won't work when it's read back in; % it needs to be - % {\code {{\tt \backslashcurfont }acronym} + % {\code {{\backslashcurfont }acronym} \shipout\vbox{% % Do this early so pdf references go to the beginning of the page. \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi @@ -397,7 +439,8 @@ \newinsert\margin \dimen\margin=\maxdimen -\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} +% Main part of page, including any footnotes +\def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}} {\catcode`\@ =11 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi % marginal hacks, juha@viisa.uucp (Juha Takala) @@ -419,9 +462,13 @@ \def\nsbot{\vbox {\hrule height\cornerlong depth\cornerthick width\cornerthick}} + +% Argument parsing + % Parse an argument, then pass it to #1. The argument is the rest of % the input line (except we remove a trailing comment). #1 should be a % macro which expects an ordinary undelimited TeX argument. +% For example, \def\foo{\parsearg\fooxxx}. % \def\parsearg{\parseargusing{}} \def\parseargusing#1#2{% @@ -440,9 +487,11 @@ }% } -% First remove any @comment, then any @c comment. +% First remove any @comment, then any @c comment. Also remove a @texinfoc +% comment (see \scanmacro for details). Pass the result on to \argcheckspaces. \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} -\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} +\def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm} +\def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} % Each occurrence of `\^^M' or `\^^M' is replaced by a single space. % @@ -477,14 +526,13 @@ % \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} + +% \parseargdef - define a command taking an argument on the line +% % \parseargdef\foo{...} % is roughly equivalent to % \def\foo{\parsearg\Xfoo} % \def\Xfoo#1{...} -% -% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my -% favourite TeX trick. --kasal, 16nov03 - \def\parseargdef#1{% \expandafter \doparseargdef \csname\string#1\endcsname #1% } @@ -674,21 +722,26 @@ \endgraf % Not \par, as it may have been set to \lisppar. \global\dimen1 = \prevdepth \egroup % End the \vtop. + \addgroupbox + \prevdepth = \dimen1 + \checkinserts +} + +\def\addgroupbox{ % \dimen0 is the vertical size of the group's box. \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox % \dimen2 is how much space is left on the page (more or less). - \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal % if the group doesn't fit on the current page, and it's a big big % group, force a page break. \ifdim \dimen0 > \dimen2 - \ifdim \pagetotal < \vfilllimit\pageheight + \ifdim \pagetotal < \vfilllimit\txipageheight \page \fi \fi \box\groupbox - \prevdepth = \dimen1 - \checkinserts } + % % TeX puts in an \escapechar (i.e., `@') at the beginning of the help % message, so this ends up printing `@group can only ...'. @@ -812,36 +865,6 @@ \temp } -% @| inserts a changebar to the left of the current line. It should -% surround any changed text. This approach does *not* work if the -% change spans more than two lines of output. To handle that, we would -% have adopt a much more difficult approach (putting marks into the main -% vertical list for the beginning and end of each change). This command -% is not documented, not supported, and doesn't work. -% -\def\|{% - % \vadjust can only be used in horizontal mode. - \leavevmode - % - % Append this vertical mode material after the current line in the output. - \vadjust{% - % We want to insert a rule with the height and depth of the current - % leading; that is exactly what \strutbox is supposed to record. - \vskip-\baselineskip - % - % \vadjust-items are inserted at the left edge of the type. So - % the \llap here moves out into the left-hand margin. - \llap{% - % - % For a thicker or thinner bar, change the `1pt'. - \vrule height\baselineskip width1pt - % - % This is the space between the bar and the text. - \hskip 12pt - }% - }% -} - % @include FILE -- \input text of FILE. % \def\include{\parseargusing\filenamecatcodes\includezzz} @@ -930,13 +953,14 @@ % @comment ...line which is ignored... % @c is the same as @comment % @ignore ... @end ignore is another way to write a comment -% -\def\comment{\begingroup \catcode`\^^M=\other% + + +\def\c{\begingroup \catcode`\^^M=\active% \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% -\commentxxx} -{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} +\cxxx} +{\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}} % -\let\c=\comment +\let\comment\c % @paragraphindent NCHARS % We'll use ems for NCHARS, close enough. @@ -1007,69 +1031,23 @@ % paragraph. % \gdef\dosuppressfirstparagraphindent{% - \gdef\indent{% - \restorefirstparagraphindent - \indent - }% - \gdef\noindent{% - \restorefirstparagraphindent - \noindent - }% - \global\everypar = {% - \kern -\parindent - \restorefirstparagraphindent - }% + \gdef\indent {\restorefirstparagraphindent \indent}% + \gdef\noindent{\restorefirstparagraphindent \noindent}% + \global\everypar = {\kern -\parindent \restorefirstparagraphindent}% } - +% \gdef\restorefirstparagraphindent{% - \global \let \indent = \ptexindent - \global \let \noindent = \ptexnoindent - \global \everypar = {}% + \global\let\indent = \ptexindent + \global\let\noindent = \ptexnoindent + \global\everypar = {}% } % @refill is a no-op. \let\refill=\relax -% If working on a large document in chapters, it is convenient to -% be able to disable indexing, cross-referencing, and contents, for test runs. -% This is done with @novalidate (before @setfilename). -% -\newif\iflinks \linkstrue % by default we want the aux files. -\let\novalidate = \linksfalse - -% @setfilename is done at the beginning of every texinfo file. -% So open here the files we need to have open while reading the input. -% This makes it possible to make a .fmt file for texinfo. -\def\setfilename{% - \fixbackslash % Turn off hack to swallow `\input texinfo'. - \iflinks - \tryauxfile - % Open the new aux file. TeX will close it automatically at exit. - \immediate\openout\auxfile=\jobname.aux - \fi % \openindices needs to do some work in any case. - \openindices - \let\setfilename=\comment % Ignore extra @setfilename cmds. - % - % If texinfo.cnf is present on the system, read it. - % Useful for site-wide @afourpaper, etc. - \openin 1 texinfo.cnf - \ifeof 1 \else \input texinfo.cnf \fi - \closein 1 - % - \comment % Ignore the actual filename. -} - -% Called from \setfilename. -% -\def\openindices{% - \newindex{cp}% - \newcodeindex{fn}% - \newcodeindex{vr}% - \newcodeindex{tp}% - \newcodeindex{ky}% - \newcodeindex{pg}% -} +% @setfilename INFO-FILENAME - ignored +\let\setfilename=\comment % @bye. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} @@ -1087,10 +1065,91 @@ \newtoks\toksC \newtoks\toksD \newbox\boxA +\newbox\boxB \newcount\countA \newif\ifpdf \newif\ifpdfmakepagedest +% +% For LuaTeX +% + +\newif\iftxiuseunicodedestname +\txiuseunicodedestnamefalse % For pdfTeX etc. + +\ifx\luatexversion\thisisundefined +\else + % Use Unicode destination names + \txiuseunicodedestnametrue + % Escape PDF strings with converting UTF-16 from UTF-8 + \begingroup + \catcode`\%=12 + \directlua{ + function UTF16oct(str) + tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377') + for c in string.utfvalues(str) do + if c < 0x10000 then + tex.sprint( + string.format(string.char(0x5c) .. string.char(0x25) .. '03o' .. + string.char(0x5c) .. string.char(0x25) .. '03o', + (c / 256), (c % 256))) + else + c = c - 0x10000 + local c_hi = c / 1024 + 0xd800 + local c_lo = c % 1024 + 0xdc00 + tex.sprint( + string.format(string.char(0x5c) .. string.char(0x25) .. '03o' .. + string.char(0x5c) .. string.char(0x25) .. '03o' .. + string.char(0x5c) .. string.char(0x25) .. '03o' .. + string.char(0x5c) .. string.char(0x25) .. '03o', + (c_hi / 256), (c_hi % 256), + (c_lo / 256), (c_lo % 256))) + end + end + end + } + \endgroup + \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}} + % Escape PDF strings without converting + \begingroup + \directlua{ + function PDFescstr(str) + for c in string.bytes(str) do + if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then + tex.sprint( + string.format(string.char(0x5c) .. string.char(0x25) .. '03o', + c)) + else + tex.sprint(string.char(c)) + end + end + end + } + \endgroup + \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}} + \ifnum\luatexversion>84 + % For LuaTeX >= 0.85 + \def\pdfdest{\pdfextension dest} + \let\pdfoutput\outputmode + \def\pdfliteral{\pdfextension literal} + \def\pdfcatalog{\pdfextension catalog} + \def\pdftexversion{\numexpr\pdffeedback version\relax} + \let\pdfximage\saveimageresource + \let\pdfrefximage\useimageresource + \let\pdflastximage\lastsavedimageresourceindex + \def\pdfendlink{\pdfextension endlink\relax} + \def\pdfoutline{\pdfextension outline} + \def\pdfstartlink{\pdfextension startlink} + \def\pdffontattr{\pdfextension fontattr} + \def\pdfobj{\pdfextension obj} + \def\pdflastobj{\numexpr\pdffeedback lastobj\relax} + \let\pdfpagewidth\pagewidth + \let\pdfpageheight\pageheight + \edef\pdfhorigin{\pdfvariable horigin} + \edef\pdfvorigin{\pdfvariable vorigin} + \fi +\fi + % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 % can be set). So we test for \relax and 0 as well as being undefined. \ifx\pdfoutput\thisisundefined @@ -1121,12 +1180,21 @@ \ifx\pdfescapestring\thisisundefined % No primitive available; should we give a warning or log? % Many times it won't matter. + \xdef#1{#1}% \else % The expandable \pdfescapestring primitive escapes parentheses, % backslashes, and other special chars. \xdef#1{\pdfescapestring{#1}}% \fi } +\def\txiescapepdfutfsixteen#1{% + \ifx\pdfescapestrutfsixteen\thisisundefined + % No UTF-16 converting macro available. + \txiescapepdf{#1}% + \else + \xdef#1{\pdfescapestrutfsixteen{#1}}% + \fi +} \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images with PDF output, and none of those formats could be found. (.eps cannot @@ -1135,15 +1203,17 @@ \ifpdf % - % Color manipulation macros based on pdfcolor.tex, + % Color manipulation macros using ideas from pdfcolor.tex, % except using rgb instead of cmyk; the latter is said to render as a % very dark gray on-screen and a very dark halftone in print, instead - % of actual black. + % of actual black. The dark red here is dark enough to print on paper as + % nearly black, but still distinguishable for online viewing. We use + % black by default, though. \def\rgbDarkRed{0.50 0.09 0.12} \def\rgbBlack{0 0 0} % - % k sets the color for filling (usual text, etc.); - % K sets the color for stroking (thin rules, e.g., normal _'s). + % rg sets the color for filling (usual text, etc.); + % RG sets the color for stroking (thin rules, e.g., normal _'s). \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} % % Set color, and create a mark which defines \thiscolor accordingly, @@ -1234,24 +1304,83 @@ \pdfrefximage \pdflastximage \fi} % - \def\pdfmkdest#1{{% + \def\setpdfdestname#1{{% % We have to set dummies so commands such as @code, and characters % such as \, aren't expanded when present in a section title. \indexnofonts - \turnoffactive \makevalueexpandable + \turnoffactive + \iftxiuseunicodedestname + \ifx \declaredencoding \latone + % Pass through Latin-1 characters. + % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode. + \else + \ifx \declaredencoding \utfeight + % Pass through Unicode characters. + \else + % Use ASCII approximations in destination names. + \passthroughcharsfalse + \fi + \fi + \else + % Use ASCII approximations in destination names. + \passthroughcharsfalse + \fi \def\pdfdestname{#1}% \txiescapepdf\pdfdestname - \safewhatsit{\pdfdest name{\pdfdestname} xyz}% }} % + \def\setpdfoutlinetext#1{{% + \indexnofonts + \makevalueexpandable + \turnoffactive + \ifx \declaredencoding \latone + % The PDF format can use an extended form of Latin-1 in bookmark + % strings. See Appendix D of the PDF Reference, Sixth Edition, for + % the "PDFDocEncoding". + \passthroughcharstrue + % Pass through Latin-1 characters. + % LuaTeX: Convert to Unicode + % pdfTeX: Use Latin-1 as PDFDocEncoding + \def\pdfoutlinetext{#1}% + \else + \ifx \declaredencoding \utfeight + \ifx\luatexversion\thisisundefined + % For pdfTeX with UTF-8. + % TODO: the PDF format can use UTF-16 in bookmark strings, + % but the code for this isn't done yet. + % Use ASCII approximations. + \passthroughcharsfalse + \def\pdfoutlinetext{#1}% + \else + % For LuaTeX with UTF-8. + % Pass through Unicode characters for title texts. + \passthroughcharstrue + \def\pdfoutlinetext{#1}% + \fi + \else + % For non-Latin-1 or non-UTF-8 encodings. + % Use ASCII approximations. + \passthroughcharsfalse + \def\pdfoutlinetext{#1}% + \fi + \fi + % LuaTeX: Convert to UTF-16 + % pdfTeX: Use Latin-1 as PDFDocEncoding + \txiescapepdfutfsixteen\pdfoutlinetext + }} + % + \def\pdfmkdest#1{% + \setpdfdestname{#1}% + \safewhatsit{\pdfdest name{\pdfdestname} xyz}% + } + % % used to mark target names; must be expandable. \def\pdfmkpgn#1{#1} % - % by default, use a color that is dark enough to print on paper as - % nearly black, but still distinguishable for online viewing. - \def\urlcolor{\rgbDarkRed} - \def\linkcolor{\rgbDarkRed} + % by default, use black for everything. + \def\urlcolor{\rgbBlack} + \def\linkcolor{\rgbBlack} \def\endlink{\setcolor{\maincolor}\pdfendlink} % % Adding outlines to PDF; macros for calculating structure of outlines @@ -1273,18 +1402,13 @@ % page number. We could generate a destination for the section % text in the case where a section has no node, but it doesn't % seem worth the trouble, since most documents are normally structured. - \edef\pdfoutlinedest{#3}% - \ifx\pdfoutlinedest\empty - \def\pdfoutlinedest{#4}% - \else - \txiescapepdf\pdfoutlinedest + \setpdfoutlinetext{#1} + \setpdfdestname{#3} + \ifx\pdfdestname\empty + \def\pdfdestname{#4}% \fi % - % Also escape PDF chars in the display string. - \edef\pdfoutlinetext{#1}% - \txiescapepdf\pdfoutlinetext - % - \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% + \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}% } % \def\pdfmakeoutlines{% @@ -1439,41 +1563,297 @@ \let\pdfmakeoutlines = \relax \fi % \ifx\pdfoutput - -\message{fonts,} - -% Change the current font style to #1, remembering it in \curfontstyle. -% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in -% italics, not bold italics. % -\def\setfontstyle#1{% - \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. - \csname ten#1\endcsname % change the current font -} - -% Select #1 fonts with the current style. +% For XeTeX % -\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} - -\def\rm{\fam=0 \setfontstyle{rm}} -\def\it{\fam=\itfam \setfontstyle{it}} -\def\sl{\fam=\slfam \setfontstyle{sl}} -\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} -\def\tt{\fam=\ttfam \setfontstyle{tt}} - -% Unfortunately, we have to override this for titles and the like, since -% in those cases "rm" is bold. Sigh. -\def\rmisbold{\rm\def\curfontstyle{bf}} +\ifx\XeTeXrevision\thisisundefined +\else + % + % XeTeX version check + % + \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1 + % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307. + % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941). + % For avoiding PDF destination name replacement, we use this special + % instead of xdvipdfmx's command line option `-C 0x0010'. + \special{dvipdfmx:config C 0x0010} + % XeTeX 0.99995+ comes with xdvipdfmx 20160307+. + % It can handle Unicode destination names for PDF. + \txiuseunicodedestnametrue + \else + % XeTeX < 0.99996 (TeX Live < 2016) cannot use the + % `dvipdfmx:config' special. + % So for avoiding PDF destination name replacement, + % xdvipdfmx's command line option `-C 0x0010' is necessary. + % + % XeTeX < 0.99995 can not handle Unicode destination names for PDF + % because xdvipdfmx 20150315 has a UTF-16 conversion issue. + % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753). + \txiuseunicodedestnamefalse + \fi + % + % Color support + % + \def\rgbDarkRed{0.50 0.09 0.12} + \def\rgbBlack{0 0 0} + % + \def\pdfsetcolor#1{\special{pdf:scolor [#1]}} + % + % Set color, and create a mark which defines \thiscolor accordingly, + % so that \makeheadline knows which color to restore. + \def\setcolor#1{% + \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% + \domark + \pdfsetcolor{#1}% + } + % + \def\maincolor{\rgbBlack} + \pdfsetcolor{\maincolor} + \edef\thiscolor{\maincolor} + \def\lastcolordefs{} + % + \def\makefootline{% + \baselineskip24pt + \line{\pdfsetcolor{\maincolor}\the\footline}% + } + % + \def\makeheadline{% + \vbox to 0pt{% + \vskip-22.5pt + \line{% + \vbox to8.5pt{}% + % Extract \thiscolor definition from the marks. + \getcolormarks + % Typeset the headline with \maincolor, then restore the color. + \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% + }% + \vss + }% + \nointerlineskip + } + % + % PDF outline support + % + % Emulate pdfTeX primitive + \def\pdfdest name#1 xyz{% + \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}% + } + % + \def\setpdfdestname#1{{% + % We have to set dummies so commands such as @code, and characters + % such as \, aren't expanded when present in a section title. + \indexnofonts + \makevalueexpandable + \turnoffactive + \iftxiuseunicodedestname + % Pass through Unicode characters. + \else + % Use ASCII approximations in destination names. + \passthroughcharsfalse + \fi + \def\pdfdestname{#1}% + \txiescapepdf\pdfdestname + }} + % + \def\setpdfoutlinetext#1{{% + \turnoffactive + % Always use Unicode characters in title texts. + \def\pdfoutlinetext{#1}% + % For XeTeX, xdvipdfmx converts to UTF-16. + % So we do not convert. + \txiescapepdf\pdfoutlinetext + }} + % + \def\pdfmkdest#1{% + \setpdfdestname{#1}% + \safewhatsit{\pdfdest name{\pdfdestname} xyz}% + } + % + % by default, use black for everything. + \def\urlcolor{\rgbBlack} + \def\linkcolor{\rgbBlack} + \def\endlink{\setcolor{\maincolor}\pdfendlink} + % + \def\dopdfoutline#1#2#3#4{% + \setpdfoutlinetext{#1} + \setpdfdestname{#3} + \ifx\pdfdestname\empty + \def\pdfdestname{#4}% + \fi + % + \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A + << /S /GoTo /D (\pdfdestname) >> >> }% + } + % + \def\pdfmakeoutlines{% + \begingroup + % + % For XeTeX, counts of subentries are not necessary. + % Therefore, we read toc only once. + % + % We use node names as destinations. + \def\partentry##1##2##3##4{}% ignore parts in the outlines + \def\numchapentry##1##2##3##4{% + \dopdfoutline{##1}{1}{##3}{##4}}% + \def\numsecentry##1##2##3##4{% + \dopdfoutline{##1}{2}{##3}{##4}}% + \def\numsubsecentry##1##2##3##4{% + \dopdfoutline{##1}{3}{##3}{##4}}% + \def\numsubsubsecentry##1##2##3##4{% + \dopdfoutline{##1}{4}{##3}{##4}}% + % + \let\appentry\numchapentry% + \let\appsecentry\numsecentry% + \let\appsubsecentry\numsubsecentry% + \let\appsubsubsecentry\numsubsubsecentry% + \let\unnchapentry\numchapentry% + \let\unnsecentry\numsecentry% + \let\unnsubsecentry\numsubsecentry% + \let\unnsubsubsecentry\numsubsubsecentry% + % + % For XeTeX, xdvipdfmx converts strings to UTF-16. + % Therefore, the encoding and the language may not be considered. + % + \indexnofonts + \setupdatafile + % We can have normal brace characters in the PDF outlines, unlike + % Texinfo index files. So set that up. + \def\{{\lbracecharliteral}% + \def\}{\rbracecharliteral}% + \catcode`\\=\active \otherbackslash + \input \tocreadfilename + \endgroup + } + {\catcode`[=1 \catcode`]=2 + \catcode`{=\other \catcode`}=\other + \gdef\lbracecharliteral[{]% + \gdef\rbracecharliteral[}]% + ] -% Texinfo sort of supports the sans serif font style, which plain TeX does not. -% So we set up a \sf. -\newfam\sffam -\def\sf{\fam=\sffam \setfontstyle{sf}} -\let\li = \sf % Sometimes we call it \li, not \sf. + \special{pdf:docview << /PageMode /UseOutlines >> } + % ``\special{pdf:tounicode ...}'' is not necessary + % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it. + % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315, + % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings. + % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753). +% + \def\skipspaces#1{\def\PP{#1}\def\D{|}% + \ifx\PP\D\let\nextsp\relax + \else\let\nextsp\skipspaces + \addtokens{\filename}{\PP}% + \advance\filenamelength by 1 + \fi + \nextsp} + \def\getfilename#1{% + \filenamelength=0 + % If we don't expand the argument now, \skipspaces will get + % snagged on things like "@value{foo}". + \edef\temp{#1}% + \expandafter\skipspaces\temp|\relax + } + % make a live url in pdf output. + \def\pdfurl#1{% + \begingroup + % it seems we really need yet another set of dummies; have not + % tried to figure out what each command should do in the context + % of @url. for now, just make @/ a no-op, that's the only one + % people have actually reported a problem with. + % + \normalturnoffactive + \def\@{@}% + \let\/=\empty + \makevalueexpandable + % do we want to go so far as to use \indexnofonts instead of just + % special-casing \var here? + \def\var##1{##1}% + % + \leavevmode\setcolor{\urlcolor}% + \special{pdf:bann << /Border [0 0 0] + /Subtype /Link /A << /S /URI /URI (#1) >> >>}% + \endgroup} + \def\endlink{\setcolor{\maincolor}\special{pdf:eann}} + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} + \def\maketoks{% + \expandafter\poptoks\the\toksA|ENDTOKS|\relax + \ifx\first0\adn0 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else + \ifnum0=\countA\else\makelink\fi + \ifx\first.\let\next=\done\else + \let\next=\maketoks + \addtokens{\toksB}{\the\toksD} + \ifx\first,\addtokens{\toksB}{\space}\fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \next} + \def\makelink{\addtokens{\toksB}% + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} + \def\pdflink#1{% + \special{pdf:bann << /Border [0 0 0] + /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}% + \setcolor{\linkcolor}#1\endlink} + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +% + % + % @image support + % + % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). + \def\doxeteximage#1#2#3{% + \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% + \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% + % + % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among + % others). Let's try in that order, PDF first since if + % someone has a scalable image, presumably better to use that than a + % bitmap. + \let\xeteximgext=\empty + \begingroup + \openin 1 #1.pdf \ifeof 1 + \openin 1 #1.PDF \ifeof 1 + \openin 1 #1.png \ifeof 1 + \openin 1 #1.jpg \ifeof 1 + \openin 1 #1.jpeg \ifeof 1 + \openin 1 #1.JPG \ifeof 1 + \errmessage{Could not find image file #1 for XeTeX}% + \else \gdef\xeteximgext{JPG}% + \fi + \else \gdef\xeteximgext{jpeg}% + \fi + \else \gdef\xeteximgext{jpg}% + \fi + \else \gdef\xeteximgext{png}% + \fi + \else \gdef\xeteximgext{PDF}% + \fi + \else \gdef\xeteximgext{pdf}% + \fi + \closein 1 + \endgroup + % + \def\xetexpdfext{pdf}% + \ifx\xeteximgext\xetexpdfext + \XeTeXpdffile "#1".\xeteximgext "" + \else + \def\xetexpdfext{PDF}% + \ifx\xeteximgext\xetexpdfext + \XeTeXpdffile "#1".\xeteximgext "" + \else + \XeTeXpicfile "#1".\xeteximgext "" + \fi + \fi + \ifdim \wd0 >0pt width \xeteximagewidth \fi + \ifdim \wd2 >0pt height \xeteximageheight \fi \relax + } +\fi -% We don't need math for this font style. -\def\ttsl{\setfontstyle{ttsl}} +% +\message{fonts,} % Set the baselineskip to #1, and the lineskip and strut size % correspondingly. There is no deep meaning behind these magic numbers @@ -1822,8 +2202,10 @@ % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstep1}{OT1} \setfont\deftt\ttshape{10}{\magstep1}{OT1TT} +\setfont\defsl\slshape{10}{\magstep1}{OT1TT} \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} +\def\df{\let\ttfont=\deftt \let\bffont = \defbf +\let\ttslfont=\defttsl \let\slfont=\defsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} @@ -1853,6 +2235,20 @@ \font\smallersy=cmsy8 \def\smallerecsize{0800} +% Fonts for math mode superscripts (7pt). +\def\sevennominalsize{7pt} +\setfont\sevenrm\rmshape{7}{1000}{OT1} +\setfont\seventt\ttshape{10}{700}{OT1TT} +\setfont\sevenbf\bfshape{10}{700}{OT1} +\setfont\sevenit\itshape{7}{1000}{OT1IT} +\setfont\sevensl\slshape{10}{700}{OT1} +\setfont\sevensf\sfshape{10}{700}{OT1} +\setfont\sevensc\scshape{10}{700}{OT1} +\setfont\seventtsl\ttslshape{10}{700}{OT1TT} +\font\seveni=cmmi7 +\font\sevensy=cmsy7 +\def\sevenecsize{0700} + % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} \setfont\titlerm\rmbshape{12}{\magstep3}{OT1} @@ -1884,6 +2280,7 @@ % Section fonts (14.4pt). \def\secnominalsize{14pt} \setfont\secrm\rmbshape{12}{\magstep1}{OT1} +\setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1} \setfont\secit\itbshape{10}{\magstep2}{OT1IT} \setfont\secsl\slbshape{10}{\magstep2}{OT1} \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} @@ -1909,7 +2306,7 @@ \font\ssecsy=cmsy10 scaled 1315 \def\ssececsize{1200} -% Reduced fonts for @acro in text (10pt). +% Reduced fonts for @acronym in text (10pt). \def\reducednominalsize{10pt} \setfont\reducedrm\rmshape{10}{1000}{OT1} \setfont\reducedtt\ttshape{10}{1000}{OT1TT} @@ -1953,8 +2350,10 @@ % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstephalf}{OT1} \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} +\setfont\defsl\slshape{10}{\magstephalf}{OT1TT} \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} +\def\df{\let\ttfont=\deftt \let\bffont = \defbf +\let\slfont=\defsl \let\ttslfont=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} @@ -1984,6 +2383,20 @@ \font\smallersy=cmsy8 \def\smallerecsize{0800} +% Fonts for math mode superscripts (7pt). +\def\sevennominalsize{7pt} +\setfont\sevenrm\rmshape{7}{1000}{OT1} +\setfont\seventt\ttshape{10}{700}{OT1TT} +\setfont\sevenbf\bfshape{10}{700}{OT1} +\setfont\sevenit\itshape{7}{1000}{OT1IT} +\setfont\sevensl\slshape{10}{700}{OT1} +\setfont\sevensf\sfshape{10}{700}{OT1} +\setfont\sevensc\scshape{10}{700}{OT1} +\setfont\seventtsl\ttslshape{10}{700}{OT1TT} +\font\seveni=cmmi7 +\font\sevensy=cmsy7 +\def\sevenecsize{0700} + % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} \setfont\titlerm\rmbshape{12}{\magstep3}{OT1} @@ -2040,7 +2453,7 @@ \font\ssecsy=cmsy10 \def\ssececsize{1000} -% Reduced fonts for @acro in text (9pt). +% Reduced fonts for @acronym in text (9pt). \def\reducednominalsize{9pt} \setfont\reducedrm\rmshape{9}{1000}{OT1} \setfont\reducedtt\ttshape{9}{1000}{OT1TT} @@ -2060,6 +2473,12 @@ \rm } % end of 10pt text font size definitions, \definetextfontsizex +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000}{OT1} +\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000}{OT1} +\setfont\shortconttt\ttshape{12}{1000}{OT1TT} + % We provide the user-level command % @fonttextsize 10 @@ -2086,102 +2505,121 @@ \endgroup } +% +% Change the current font style to #1, remembering it in \curfontstyle. +% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in +% italics, not bold italics. +% +\def\setfontstyle#1{% + \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. + \csname #1font\endcsname % change the current font +} + +\def\rm{\fam=0 \setfontstyle{rm}} +\def\it{\fam=\itfam \setfontstyle{it}} +\def\sl{\fam=\slfam \setfontstyle{sl}} +\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} +\def\tt{\fam=\ttfam \setfontstyle{tt}} + +% Texinfo sort of supports the sans serif font style, which plain TeX does not. +% So we set up a \sf. +\newfam\sffam +\def\sf{\fam=\sffam \setfontstyle{sf}} + +% We don't need math for this font style. +\def\ttsl{\setfontstyle{ttsl}} + % In order for the font changes to affect most math symbols and letters, -% we have to define the \textfont of the standard families. Since -% texinfo doesn't allow for producing subscripts and superscripts except -% in the main text, we don't bother to reset \scriptfont and -% \scriptscriptfont (which would also require loading a lot more fonts). +% we have to define the \textfont of the standard families. +% We don't bother to reset \scriptscriptfont; awaiting user need. % \def\resetmathfonts{% - \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy - \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf - \textfont\ttfam=\tentt \textfont\sffam=\tensf + \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont + \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont + \textfont\ttfam=\ttfont \textfont\sffam=\sffont + % + % Fonts for superscript. Note that the 7pt fonts are used regardless + % of the current font size. + \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy + \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl + \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt + \scriptfont\sffam=\sevensf } -% The font-changing commands redefine the meanings of \tenSTYLE, instead -% of just \STYLE. We do this because \STYLE needs to also set the -% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire -% \tenSTYLE to set the current font. +% + +% The font-changing commands (all called \...fonts) redefine the meanings +% of \STYLEfont, instead of just \STYLE. We do this because \STYLE needs +% to also set the current \fam for math mode. Our \STYLE (e.g., \rm) +% commands hardwire \STYLEfont to set the current font. +% +% The fonts used for \ifont are for "math italics" (\itfont is for italics +% in regular text). \syfont is also used in math mode only. % % Each font-changing command also sets the names \lsize (one size lower) -% and \lllsize (three sizes lower). These relative commands are used in -% the LaTeX logo and acronyms. +% and \lllsize (three sizes lower). These relative commands are used +% in, e.g., the LaTeX logo and acronyms. % % This all needs generalizing, badly. % -\def\textfonts{% - \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl - \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc - \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy - \let\tenttsl=\textttsl - \def\curfontsize{text}% - \def\lsize{reduced}\def\lllsize{smaller}% - \resetmathfonts \setleading{\textleading}} -\def\titlefonts{% - \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl - \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc - \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy - \let\tenttsl=\titlettsl - \def\curfontsize{title}% - \def\lsize{chap}\def\lllsize{subsec}% - \resetmathfonts \setleading{27pt}} -\def\titlefont#1{{\titlefonts\rmisbold #1}} -\def\chapfonts{% - \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl - \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc - \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy - \let\tenttsl=\chapttsl - \def\curfontsize{chap}% - \def\lsize{sec}\def\lllsize{text}% - \resetmathfonts \setleading{19pt}} -\def\secfonts{% - \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl - \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc - \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy - \let\tenttsl=\secttsl - \def\curfontsize{sec}% - \def\lsize{subsec}\def\lllsize{reduced}% - \resetmathfonts \setleading{16pt}} -\def\subsecfonts{% - \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl - \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc - \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy - \let\tenttsl=\ssecttsl - \def\curfontsize{ssec}% - \def\lsize{text}\def\lllsize{small}% - \resetmathfonts \setleading{15pt}} -\let\subsubsecfonts = \subsecfonts -\def\reducedfonts{% - \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl - \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc - \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy - \let\tenttsl=\reducedttsl - \def\curfontsize{reduced}% - \def\lsize{small}\def\lllsize{smaller}% - \resetmathfonts \setleading{10.5pt}} -\def\smallfonts{% - \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl - \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc - \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy - \let\tenttsl=\smallttsl - \def\curfontsize{small}% - \def\lsize{smaller}\def\lllsize{smaller}% - \resetmathfonts \setleading{10.5pt}} -\def\smallerfonts{% - \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl - \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc - \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy - \let\tenttsl=\smallerttsl - \def\curfontsize{smaller}% - \def\lsize{smaller}\def\lllsize{smaller}% - \resetmathfonts \setleading{9.5pt}} -% Fonts for short table of contents. -\setfont\shortcontrm\rmshape{12}{1000}{OT1} -\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 -\setfont\shortcontsl\slshape{12}{1000}{OT1} -\setfont\shortconttt\ttshape{12}{1000}{OT1TT} +\def\assignfonts#1{% + \expandafter\let\expandafter\rmfont\csname #1rm\endcsname + \expandafter\let\expandafter\itfont\csname #1it\endcsname + \expandafter\let\expandafter\slfont\csname #1sl\endcsname + \expandafter\let\expandafter\bffont\csname #1bf\endcsname + \expandafter\let\expandafter\ttfont\csname #1tt\endcsname + \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname + \expandafter\let\expandafter\sffont \csname #1sf\endcsname + \expandafter\let\expandafter\ifont \csname #1i\endcsname + \expandafter\let\expandafter\syfont \csname #1sy\endcsname + \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname +} + +\newif\ifrmisbold + +% Select smaller font size with the current style. Used to change font size +% in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for +% normal roman text, also use bold fonts for roman text in the smaller size. +\def\switchtolllsize{% + \expandafter\assignfonts\expandafter{\lllsize}% + \ifrmisbold + \let\rmfont\bffont + \fi + \csname\curfontstyle\endcsname +}% + +\def\switchtolsize{% + \expandafter\assignfonts\expandafter{\lsize}% + \ifrmisbold + \let\rmfont\bffont + \fi + \csname\curfontstyle\endcsname +}% + +\def\definefontsetatsize#1#2#3#4#5{% +\expandafter\def\csname #1fonts\endcsname{% + \def\curfontsize{#1}% + \def\lsize{#2}\def\lllsize{#3}% + \csname rmisbold#5\endcsname + \assignfonts{#1}% + \resetmathfonts + \setleading{#4}% +}} + +\definefontsetatsize{text} {reduced}{smaller}{\textleading}{false} +\definefontsetatsize{title} {chap} {subsec} {27pt} {true} +\definefontsetatsize{chap} {sec} {text} {19pt} {true} +\definefontsetatsize{sec} {subsec} {reduced}{17pt} {true} +\definefontsetatsize{ssec} {text} {small} {15pt} {true} +\definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false} +\definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false} +\definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false} + +\def\titlefont#1{{\titlefonts\rm #1}} +\let\subsecfonts = \ssecfonts +\let\subsubsecfonts = \ssecfonts % Define these just so they can be easily changed for other fonts. \def\angleleft{$\langle$} @@ -2219,26 +2657,11 @@ % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will % define and register \INITMACRO to be called on markup style changes. % \INITMACRO can check \currentmarkupstyle for the innermost -% style and the set of \ifmarkupSTYLE switches for all styles -% currently in effect. -\newif\ifmarkupvar -\newif\ifmarkupsamp -\newif\ifmarkupkey -%\newif\ifmarkupfile % @file == @samp. -%\newif\ifmarkupoption % @option == @samp. -\newif\ifmarkupcode -\newif\ifmarkupkbd -%\newif\ifmarkupenv % @env == @code. -%\newif\ifmarkupcommand % @command == @code. -\newif\ifmarkuptex % @tex (and part of @math, for now). -\newif\ifmarkupexample -\newif\ifmarkupverb -\newif\ifmarkupverbatim +% style. \let\currentmarkupstyle\empty \def\setupmarkupstyle#1{% - \csname markup#1true\endcsname \def\currentmarkupstyle{#1}% \markupstylesetup } @@ -2300,11 +2723,15 @@ % lilypond developers report. xpdf does work with the regular 0x27. % \def\codequoteright{% - \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax - \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax - '% + \ifmonospace + \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax + \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax + '% + \else \char'15 \fi \else \char'15 \fi - \else \char'15 \fi + \else + '% + \fi } % % and a similar option for the left quote char vs. a grave accent. @@ -2312,13 +2739,17 @@ % the code environments to do likewise. % \def\codequoteleft{% - \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax - \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax - % [Knuth] pp. 380,381,391 - % \relax disables Spanish ligatures ?` and !` of \tt font. - \relax`% + \ifmonospace + \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax + \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax + % [Knuth] pp. 380,381,391 + % \relax disables Spanish ligatures ?` and !` of \tt font. + \relax`% + \else \char'22 \fi \else \char'22 \fi - \else \char'22 \fi + \else + \relax`% + \fi } % Commands to set the quote options. @@ -2377,8 +2808,10 @@ \ifx\next,% \else\ifx\next-% \else\ifx\next.% + \else\ifx\next\.% + \else\ifx\next\comma% \else\ptexslash - \fi\fi\fi + \fi\fi\fi\fi\fi \aftersmartic } @@ -2426,8 +2859,8 @@ % \catcode`@=11 \def\plainfrenchspacing{% - \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m - \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m + \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m \def\endofsentencespacefactor{1000}% for @. and friends } \def\plainnonfrenchspacing{% @@ -2475,14 +2908,14 @@ } % We *must* turn on hyphenation at `-' and `_' in @code. +% (But see \codedashfinish below.) % Otherwise, it is too hard to avoid overfull hboxes % in the Emacs manual, the Library manual, etc. % % Unfortunately, TeX uses one parameter (\hyphenchar) to control % both hyphenation at - and hyphenation within words. % We must therefore turn them both off (\tclose does that) -% and arrange explicitly to hyphenate at a dash. -% -- rms. +% and arrange explicitly to hyphenate at a dash. -- rms. { \catcode`\-=\active \catcode`\_=\active \catcode`\'=\active \catcode`\`=\active @@ -2499,14 +2932,35 @@ \let-\normaldash \let_\realunder \fi + % Given -foo (with a single dash), we do not want to allow a break + % after the hyphen. + \global\let\codedashprev=\codedash + % \codex } + % + \gdef\codedash{\futurelet\next\codedashfinish} + \gdef\codedashfinish{% + \normaldash % always output the dash character itself. + % + % Now, output a discretionary to allow a line break, unless + % (a) the next character is a -, or + % (b) the preceding character is a -. + % E.g., given --posix, we do not want to allow a break after either -. + % Given --foo-bar, we do want to allow a break between the - and the b. + \ifx\next\codedash \else + \ifx\codedashprev\codedash + \else \discretionary{}{}{}\fi + \fi + % we need the space after the = for the case when \next itself is a + % space token; it would get swallowed otherwise. As in @code{- a}. + \global\let\codedashprev= \next + } } - +\def\normaldash{-} +% \def\codex #1{\tclose{#1}\endgroup} -\def\normaldash{-} -\def\codedash{-\discretionary{}{}{}} \def\codeunder{% % this is all so @math{@code{var_name}+1} can work. In math mode, _ % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) @@ -2548,37 +3002,21 @@ \let\file=\code \let\option=\code -% @uref (abbreviation for `urlref') takes an optional (comma-separated) -% second argument specifying the text to display and an optional third -% arg as text to display instead of (rather than in addition to) the url -% itself. First (mandatory) arg is the url. -% (This \urefnobreak definition isn't used now, leaving it for a while -% for comparison.) -\def\urefnobreak#1{\dourefnobreak #1,,,\finish} -\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup - \unsepspaces - \pdfurl{#1}% - \setbox0 = \hbox{\ignorespaces #3}% - \ifdim\wd0 > 0pt - \unhbox0 % third arg given, show only that - \else - \setbox0 = \hbox{\ignorespaces #2}% - \ifdim\wd0 > 0pt - \ifpdf - \unhbox0 % PDF: 2nd arg given, show only it - \else - \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url - \fi - \else - \code{#1}% only url given, so show it - \fi - \fi - \endlink -\endgroup} - -% This \urefbreak definition is the active one. +% @uref (abbreviation for `urlref') aka @url takes an optional +% (comma-separated) second argument specifying the text to display and +% an optional third arg as text to display instead of (rather than in +% addition to) the url itself. First (mandatory) arg is the url. + +% TeX-only option to allow changing PDF output to show only the second +% arg (if given), and not the url (which is then just the link target). +\newif\ifurefurlonlylink + +% The main macro is \urefbreak, which allows breaking at expected +% places within the url. (There used to be another version, which +% didn't support automatic breaking.) \def\urefbreak{\begingroup \urefcatcodes \dourefbreak} \let\uref=\urefbreak +% \def\dourefbreak#1{\urefbreakfinish #1,,,\finish} \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example \unsepspaces @@ -2587,12 +3025,32 @@ \ifdim\wd0 > 0pt \unhbox0 % third arg given, show only that \else - \setbox0 = \hbox{\ignorespaces #2}% + \setbox0 = \hbox{\ignorespaces #2}% look for second arg \ifdim\wd0 > 0pt \ifpdf - \unhbox0 % PDF: 2nd arg given, show only it + % For pdfTeX and LuaTeX + \ifurefurlonlylink + % PDF plus option to not display url, show just arg + \unhbox0 + \else + % PDF, normally display both arg and url for consistency, + % visibility, if the pdf is eventually used to print, etc. + \unhbox0\ (\urefcode{#1})% + \fi \else - \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url + \ifx\XeTeXrevision\thisisundefined + \unhbox0\ (\urefcode{#1})% DVI, always show arg and url + \else + % For XeTeX + \ifurefurlonlylink + % PDF plus option to not display url, show just arg + \unhbox0 + \else + % PDF, normally display both arg and url for consistency, + % visibility, if the pdf is eventually used to print, etc. + \unhbox0\ (\urefcode{#1})% + \fi + \fi \fi \else \urefcode{#1}% only url given, so show it @@ -2603,9 +3061,9 @@ % Allow line breaks around only a few characters (only). \def\urefcatcodes{% - \catcode\ampChar=\active \catcode\dotChar=\active - \catcode\hashChar=\active \catcode\questChar=\active - \catcode\slashChar=\active + \catcode`\&=\active \catcode`\.=\active + \catcode`\#=\active \catcode`\?=\active + \catcode`\/=\active } { \urefcatcodes @@ -2632,8 +3090,10 @@ % we put a little stretch before and after the breakable chars, to help % line breaking of long url's. The unequal skips make look better in % cmtt at least, especially for dots. -\def\urefprestretch{\urefprebreak \hskip0pt plus.13em } -\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em } +\def\urefprestretchamount{.13em} +\def\urefpoststretchamount{.1em} +\def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax} +\def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax} % \def\urefcodeamp{\urefprestretch \&\urefpoststretch} \def\urefcodedot{\urefprestretch .\urefpoststretch} @@ -2691,7 +3151,18 @@ \endlink \endgroup} \else - \let\email=\uref + \ifx\XeTeXrevision\thisisundefined + \let\email=\uref + \else + \def\email#1{\doemail#1,,\finish} + \def\doemail#1,#2,#3\finish{\begingroup + \unsepspaces + \pdfurl{mailto:#1}% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi + \endlink + \endgroup} + \fi \fi % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), @@ -2760,18 +3231,13 @@ % \def\dmn#1{\thinspace #1} -% @l was never documented to mean ``switch to the Lisp font'', -% and it is not used as such in any manual I can find. We need it for -% Polish suppressed-l. --karl, 22sep96. -%\def\l#1{{\li #1}\null} - % @acronym for "FBI", "NATO", and the like. % We print this one point size smaller, since it's intended for % all-uppercase. % \def\acronym#1{\doacronym #1,,\finish} \def\doacronym#1,#2,#3\finish{% - {\selectfonts\lsize #1}% + {\switchtolsize #1}% \def\temp{#2}% \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% @@ -2817,21 +3283,24 @@ \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} % \def\math{% - \tex - \mathunderscore - \let\\ = \mathbackslash - \mathactive - % make the texinfo accent commands work in math mode - \let\"=\ddot - \let\'=\acute - \let\==\bar - \let\^=\hat - \let\`=\grave - \let\u=\breve - \let\v=\check - \let\~=\tilde - \let\dotaccent=\dot - $\finishmath + \ifmmode\else % only go into math if not in math mode already + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + % make the texinfo accent commands work in math mode + \let\"=\ddot + \let\'=\acute + \let\==\bar + \let\^=\hat + \let\`=\grave + \let\u=\breve + \let\v=\check + \let\~=\tilde + \let\dotaccent=\dot + % have to provide another name for sup operator + \let\mathopsup=\sup + $\expandafter\finishmath\fi } \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. @@ -2854,8 +3323,17 @@ } } -% ctrl is no longer a Texinfo command, but leave this definition for fun. -\def\ctrl #1{{\tt \rawbackslash \hat}#1} +% for @sub and @sup, if in math mode, just do a normal sub/superscript. +% If in text, use math to place as sub/superscript, but switch +% into text mode, with smaller fonts. This is a different font than the +% one used for real math sub/superscripts (8pt vs. 7pt), but let's not +% fix it (significant additions to font machinery) until someone notices. +% +\def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi} +\def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}% +% +\def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi} +\def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}% % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. % Ignore unless FMTNAME == tex; then it is like @iftex and @tex, @@ -2868,6 +3346,15 @@ \def\inlinefmtname{#1}% \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi } +% +% @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if +% FMTNAME is tex, else ELSE-TEXT. +\long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish} +\long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{% + \def\inlinefmtname{#1}% + \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi +} +% % For raw, must switch into @tex before parsing the argument, to avoid % setting catcodes prematurely. Doing it this way means that, for % example, @inlineraw{html, foo{bar} gets a parse error instead of being @@ -2884,6 +3371,23 @@ \endgroup % close group opened by \tex. } +% @inlineifset{VAR, TEXT} expands TEXT if VAR is @set. +% +\long\def\inlineifset#1{\doinlineifset #1,\finish} +\long\def\doinlineifset#1,#2,\finish{% + \def\inlinevarname{#1}% + \expandafter\ifx\csname SET\inlinevarname\endcsname\relax + \else\ignorespaces#2\fi +} + +% @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set. +% +\long\def\inlineifclear#1{\doinlineifclear #1,\finish} +\long\def\doinlineifclear#1,#2,\finish{% + \def\inlinevarname{#1}% + \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi +} + \message{glyphs,} % and logos. @@ -2893,23 +3397,10 @@ \let\atchar=\@ % @{ @} @lbracechar{} @rbracechar{} all generate brace characters. -% Unless we're in typewriter, use \ecfont because the CM text fonts do -% not have braces, and we don't want to switch into math. -\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}} -\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}} -\let\{=\mylbrace \let\lbracechar=\{ -\let\}=\myrbrace \let\rbracechar=\} -\begingroup - % Definitions to produce \{ and \} commands for indices, - % and @{ and @} for the aux/toc files. - \catcode`\{ = \other \catcode`\} = \other - \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\! = 0 \catcode`\\ = \other - !gdef!lbracecmd[\{]% - !gdef!rbracecmd[\}]% - !gdef!lbraceatcmd[@{]% - !gdef!rbraceatcmd[@}]% -!endgroup +\def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}} +\def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}} +\let\{=\lbracechar +\let\}=\rbracechar % @comma{} to avoid , parsing problems. \let\comma = , @@ -2927,8 +3418,8 @@ % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. \def\questiondown{?`} \def\exclamdown{!`} -\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} -\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} +\def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}} % Dotless i and dotless j, used for accents. \def\imacro{i} @@ -2957,12 +3448,12 @@ {\setbox0=\hbox{T}% \vbox to \ht0{\hbox{% \ifx\textnominalsize\xwordpt - % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX. + % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX. % Revert to plain's \scriptsize, which is 7pt. \count255=\the\fam $\fam\count255 \scriptstyle A$% \else % For 11pt, we can use our lllsize. - \selectfonts\lllsize A% + \switchtolllsize A% \fi }% \vss @@ -2971,11 +3462,16 @@ \TeX } -% Some math mode symbols. -\def\bullet{$\ptexbullet$} -\def\geq{\ifmmode \ge\else $\ge$\fi} -\def\leq{\ifmmode \le\else $\le$\fi} -\def\minus{\ifmmode -\else $-$\fi} +% Some math mode symbols. Define \ensuremath to switch into math mode +% unless we are already there. Expansion tricks may not be needed here, +% but safer, and can't hurt. +\def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi} +\def\ensuredmath#1{$\relax#1$} +% +\def\bullet{\ensuremath\ptexbullet} +\def\geq{\ensuremath\ge} +\def\leq{\ensuremath\le} +\def\minus{\ensuremath-} % @dots{} outputs an ellipsis using the current font. % We do .5em per period so that it has the same spacing in the cm @@ -3023,7 +3519,7 @@ % \newbox\errorbox % -{\tentt \global\dimen0 = 3em}% Width of the box. +{\ttfont \global\dimen0 = 3em}% Width of the box. \dimen2 = .55pt % Thickness of rules % The text. (`r' is open on the right, `e' somewhat less so on the left.) \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt} @@ -3139,8 +3635,15 @@ \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} % -% Use the ec* fonts (cm-super in outline format) for non-CM glyphs. -\def\ecfont{% +% Use the European Computer Modern fonts (cm-super in outline format) +% for non-CM glyphs. That is ec* for regular text and tc* for the text +% companion symbols (LaTeX TS1 encoding). Both are part of the ec +% package and follow the same conventions. +% +\def\ecfont{\etcfont{e}} +\def\tcfont{\etcfont{t}} +% +\def\etcfont#1{% % We can't distinguish serif/sans and italic/slanted, but this % is used for crude hacks anyway (like adding French and German % quotes to documents typeset with CM, where we lose kerning), so @@ -3149,14 +3652,14 @@ \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% \ifmonospace % typewriter: - \font\thisecfont = ectt\ecsize \space at \nominalsize + \font\thisecfont = #1ctt\ecsize \space at \nominalsize \else \ifx\curfontstyle\bfstylename % bold: - \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize + \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize \else % regular: - \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize + \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize \fi \fi \thisecfont @@ -3167,7 +3670,7 @@ % Adapted from the plain.tex definition of \copyright. % \def\registeredsymbol{% - $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% + $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}% \hfil\crcr\Orb}}% }$% } @@ -3200,13 +3703,16 @@ \newif\ifseenauthor \newif\iffinishedtitlepage -% Do an implicit @contents or @shortcontents after @end titlepage if the -% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. -% -\newif\ifsetcontentsaftertitlepage - \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue -\newif\ifsetshortcontentsaftertitlepage - \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue +% @setcontentsaftertitlepage used to do an implicit @contents or +% @shortcontents after @end titlepage, but it is now obsolete. +\def\setcontentsaftertitlepage{% + \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo + command; move your @contents command if you want the contents + after the title page.}}% +\def\setshortcontentsaftertitlepage{% + \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo + command; move your @shortcontents and @contents commands if you + want the contents after the title page.}}% \parseargdef\shorttitlepage{% \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% @@ -3248,20 +3754,6 @@ % Need this before the \...aftertitlepage checks so that if they are % in effect the toc pages will come out with page numbers. \HEADINGSon - % - % If they want short, they certainly want long too. - \ifsetshortcontentsaftertitlepage - \shortcontents - \contents - \global\let\shortcontents = \relax - \global\let\contents = \relax - \fi - % - \ifsetcontentsaftertitlepage - \contents - \global\let\contents = \relax - \global\let\shortcontents = \relax - \fi } \def\finishtitlepage{% @@ -3272,12 +3764,11 @@ % Settings used for typesetting titles: no hyphenation, no indentation, % don't worry much about spacing, ragged right. This should be used -% inside a \vbox, and fonts need to be set appropriately first. Because -% it is always used for titles, nothing else, we call \rmisbold. \par -% should be specified before the end of the \vbox, since a vbox is a group. +% inside a \vbox, and fonts need to be set appropriately first. \par should +% be specified before the end of the \vbox, since a vbox is a group. % \def\raggedtitlesettings{% - \rmisbold + \rm \hyphenpenalty=10000 \parindent=0pt \tolerance=5000 @@ -3286,7 +3777,7 @@ % Macros to be used within @titlepage: -\let\subtitlerm=\tenrm +\let\subtitlerm=\rmfont \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} \parseargdef\title{% @@ -3312,7 +3803,7 @@ \else \checkenv\titlepage \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi - {\secfonts\rmisbold \leftline{#1}}% + {\secfonts\rm \leftline{#1}}% \fi } @@ -3326,7 +3817,7 @@ \newtoks\evenfootline % footline on even pages \newtoks\oddfootline % footline on odd pages -% Now make TeX use those variables +% Now make \makeheadline and \makefootline in Plain TeX use those variables \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}} \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline @@ -3365,7 +3856,7 @@ % % Leave some space for the footline. Hopefully ok to assume % @evenfooting will not be used by itself. - \global\advance\pageheight by -12pt + \global\advance\txipageheight by -12pt \global\advance\vsize by -12pt } @@ -3382,13 +3873,17 @@ % @everyheadingmarks % @everyfootingmarks +% These define \getoddheadingmarks, \getevenheadingmarks, +% \getoddfootingmarks, and \getevenfootingmarks, each to one of +% \gettopheadingmarks, \getbottomheadingmarks. +% \def\evenheadingmarks{\headingmarks{even}{heading}} \def\oddheadingmarks{\headingmarks{odd}{heading}} \def\evenfootingmarks{\headingmarks{even}{footing}} \def\oddfootingmarks{\headingmarks{odd}{footing}} -\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1} +\parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1} \headingmarks{odd}{heading}{#1} } -\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1} +\parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1} \headingmarks{odd}{footing}{#1} } % #1 = even/odd, #2 = heading/footing, #3 = top/bottom. \def\headingmarks#1#2#3 {% @@ -3409,7 +3904,7 @@ % By default, they are off at the start of a document, % and turned `on' after @end titlepage. -\def\headings #1 {\csname HEADINGS#1\endcsname} +\parseargdef\headings{\csname HEADINGS#1\endcsname} \def\headingsoff{% non-global headings elimination \evenheadline={\hfil}\evenfootline={\hfil}% @@ -3429,7 +3924,7 @@ \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapterheading\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } \let\contentsalignmacro = \chappager @@ -3440,8 +3935,8 @@ \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\evenheadline={\line{\thischapterheading\hfil\folio}} +\global\oddheadline={\line{\thischapterheading\hfil\folio}} \global\let\contentsalignmacro = \chappager } \def\HEADINGSon{\HEADINGSdouble} @@ -3452,7 +3947,7 @@ \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapterheading\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } @@ -3460,8 +3955,8 @@ \def\HEADINGSsinglex{% \global\evenfootline={\hfil} \global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\evenheadline={\line{\thischapterheading\hfil\folio}} +\global\oddheadline={\line{\thischapterheading\hfil\folio}} \global\let\contentsalignmacro = \chappager } @@ -3639,7 +4134,7 @@ \parskip=\smallskipamount \ifdim\parskip=0pt \parskip=2pt \fi % - % Try typesetting the item mark that if the document erroneously says + % Try typesetting the item mark so that if the document erroneously says % something like @itemize @samp (intending @table), there's an error % right away at the @itemize. It's not the best error message in the % world, but it's better than leaving it to the @item. This means if @@ -3671,7 +4166,12 @@ \noindent \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% % - \vadjust{\penalty 1200}}% not good to break after first line of item. + \ifinner\else + \vadjust{\penalty 1200}% not good to break after first line of item. + \fi + % We can be in inner vertical mode in a footnote, although an + % @itemize looks awful there. + }% \flushcr } @@ -3889,19 +4389,23 @@ } % multitable-only commands. -% -% @headitem starts a heading row, which we typeset in bold. -% Assignments have to be global since we are inside the implicit group -% of an alignment entry. \everycr resets \everytab so we don't have to +% +% @headitem starts a heading row, which we typeset in bold. Assignments +% have to be global since we are inside the implicit group of an +% alignment entry. \everycr below resets \everytab so we don't have to % undo it ourselves. \def\headitemfont{\b}% for people to use in the template row; not changeable \def\headitem{% \checkenv\multitable \crcr + \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings \global\everytab={\bf}% can't use \headitemfont since the parsing differs \the\everytab % for the first item }% % +% default for tables with no headings. +\let\headitemcrhook=\relax +% % A \tab used to include \hskip1sp. But then the space in a template % line is not enough. That is bad. So let's go back to just `&' until % we again encounter the problem the 1sp was intended to solve. @@ -3932,15 +4436,15 @@ % \everycr = {% \noalign{% - \global\everytab={}% + \global\everytab={}% Reset from possible headitem. \global\colcount=0 % Reset the column counter. - % Check for saved footnotes, etc. + % + % Check for saved footnotes, etc.: \checkinserts - % Keeps underfull box messages off when table breaks over pages. - %\filbreak - % Maybe so, but it also creates really weird page breaks when the - % table breaks over pages. Wouldn't \vfil be better? Wait until the - % problem manifests itself, so it can be fixed for real --karl. + % + % Perhaps a \nobreak, then reset: + \headitemcrhook + \global\let\headitemcrhook=\relax }% }% % @@ -4179,7 +4683,7 @@ \def\value{\begingroup\makevalueexpandable\valuexxx} \def\valuexxx#1{\expandablevalue{#1}\endgroup} { - \catcode`\- = \active \catcode`\_ = \active + \catcode`\-=\active \catcode`\_=\active % \gdef\makevalueexpandable{% \let\value = \expandablevalue @@ -4199,7 +4703,12 @@ % variable's value contains other Texinfo commands, it's almost certain % it will fail (although perhaps we could fix that with sufficient work % to do a one-level expansion on the result, instead of complete). -% +% +% Unfortunately, this has the consequence that when _ is in the *value* +% of an @set, it does not print properly in the roman fonts (get the cmr +% dot accent at position 126 instead). No fix comes to mind, and it's +% been this way since 2003 or earlier, so just ignore it. +% \def\expandablevalue#1{% \expandafter\ifx\csname SET#1\endcsname\relax {[No value for ``#1'']}% @@ -4209,10 +4718,36 @@ \fi } +% Like \expandablevalue, but completely expandable (the \message in the +% definition above operates at the execution level of TeX). Used when +% writing to auxiliary files, due to the expansion that \write does. +% If flag is undefined, pass through an unexpanded @value command: maybe it +% will be set by the time it is read back in. +% +% NB flag names containing - or _ may not work here. +\def\dummyvalue#1{% + \expandafter\ifx\csname SET#1\endcsname\relax + \noexpand\value{#1}% + \else + \csname SET#1\endcsname + \fi +} + +% Used for @value's in index entries to form the sort key: expand the @value +% if possible, otherwise sort late. +\def\indexnofontsvalue#1{% + \expandafter\ifx\csname SET#1\endcsname\relax + ZZZZZZZ + \else + \csname SET#1\endcsname + \fi +} + % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined % with @set. -% -% To get special treatment of `@end ifset,' call \makeond and the redefine. +% +% To get the special treatment we need for `@end ifset,' we call +% \makecond and then redefine. % \makecond{ifset} \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} @@ -4283,19 +4818,16 @@ % except not \outer, so it can be used within macros and \if's. \edef\newwrite{\makecsname{ptexnewwrite}} -% \newindex {foo} defines an index named foo. -% It automatically defines \fooindex such that -% \fooindex ...rest of line... puts an entry in the index foo. -% It also defines \fooindfile to be the number of the output channel for -% the file that accumulates this index. The file's extension is foo. +% \newindex {foo} defines an index named IX. +% It automatically defines \IXindex such that +% \IXindex ...rest of line... puts an entry in the index IX. +% It also defines \IXindfile to be the number of the output channel for +% the file that accumulates this index. The file's extension is IX. % The name of an index should be no more than 2 characters long % for the sake of vms. % \def\newindex#1{% - \iflinks - \expandafter\newwrite \csname#1indfile\endcsname - \openout \csname#1indfile\endcsname \jobname.#1 % Open the file - \fi + \expandafter\chardef\csname#1indfile\endcsname=0 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index \noexpand\doindex{#1}} } @@ -4309,14 +4841,19 @@ \def\defcodeindex{\parsearg\newcodeindex} % \def\newcodeindex#1{% - \iflinks - \expandafter\newwrite \csname#1indfile\endcsname - \openout \csname#1indfile\endcsname \jobname.#1 - \fi + \expandafter\chardef\csname#1indfile\endcsname=0 \expandafter\xdef\csname#1index\endcsname{% \noexpand\docodeindex{#1}}% } +% The default indices: +\newindex{cp}% concepts, +\newcodeindex{fn}% functions, +\newcodeindex{vr}% variables, +\newcodeindex{tp}% types, +\newcodeindex{ky}% keys +\newcodeindex{pg}% and programs. + % @synindex foo bar makes index foo feed into index bar. % Do this instead of @defindex foo if you don't want it as a separate index. @@ -4330,14 +4867,7 @@ % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), % #3 the target index (bar). \def\dosynindex#1#2#3{% - % Only do \closeout if we haven't already done it, else we'll end up - % closing the target index. - \expandafter \ifx\csname donesynindex#2\endcsname \relax - % The \closeout helps reduce unnecessary open files; the limit on the - % Acorn RISC OS is a mere 16 files. - \expandafter\closeout\csname#2indfile\endcsname - \expandafter\let\csname donesynindex#2\endcsname = 1 - \fi + \requireopenindexfile{#3}% % redefine \fooindfile: \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname \expandafter\let\csname#2indfile\endcsname=\temp @@ -4345,108 +4875,72 @@ \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% } -% Define \doindex, the driver for all \fooindex macros. +% Define \doindex, the driver for all index macros. % Argument #1 is generated by the calling \fooindex macro, -% and it is "foo", the name of the index. - -% \doindex just uses \parsearg; it calls \doind for the actual work. -% This is because \doind is more useful to call from other macros. - -% There is also \dosubind {index}{topic}{subtopic} -% which makes an entry in a two-level index such as the operation index. +% and it is the two-letter name of the index. -\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} -\def\singleindexer #1{\doind{\indexname}{#1}} +\def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx} +\def\doindexxxx #1{\doind{\indexname}{#1}} % like the previous two, but they put @code around the argument. -\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} -\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} +\def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx} +\def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}} -% Take care of Texinfo commands that can appear in an index entry. -% Since there are some commands we want to expand, and others we don't, -% we have to laboriously prevent expansion for those that we don't. + +% Used when writing an index entry out to an index file to prevent +% expansion of Texinfo commands that can appear in an index entry. % \def\indexdummies{% \escapechar = `\\ % use backslash in output files. - \def\@{@}% change to @@ when we switch to @ as escape char in index files. - \def\ {\realbackslash\space }% - % - % Need these unexpandable (because we define \tt as a dummy) - % definitions when @{ or @} appear in index entry text. Also, more - % complicated, when \tex is in effect and \{ is a \delimiter again. - % We can't use \lbracecmd and \rbracecmd because texindex assumes - % braces and backslashes are used only as delimiters. Perhaps we - % should define @lbrace and @rbrace commands a la @comma. - \def\{{{\tt\char123}}% - \def\}{{\tt\char125}}% - % - % I don't entirely understand this, but when an index entry is - % generated from a macro call, the \endinput which \scanmacro inserts - % causes processing to be prematurely terminated. This is, - % apparently, because \indexsorttmp is fully expanded, and \endinput - % is an expandable command. The redefinition below makes \endinput - % disappear altogether for that purpose -- although logging shows that - % processing continues to some further point. On the other hand, it - % seems \endinput does not hurt in the printed index arg, since that - % is still getting written without apparent harm. - % - % Sample source (mac-idx3.tex, reported by Graham Percival to - % help-texinfo, 22may06): - % @macro funindex {WORD} - % @findex xyz - % @end macro - % ... - % @funindex commtest - % - % The above is not enough to reproduce the bug, but it gives the flavor. + \definedummyletter\@% + \definedummyletter\ % % - % Sample whatsit resulting: - % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}} - % - % So: - \let\endinput = \empty + % For texindex which always views { and } as separators. + \def\{{\lbracechar{}}% + \def\}{\rbracechar{}}% % % Do the redefinitions. - \commondummies + \definedummies } -% For the aux and toc files, @ is the escape character. So we want to -% redefine everything using @ as the escape character (instead of -% \realbackslash, still used for index files). When everything uses @, -% this will be simpler. +% Used for the aux and toc files, where @ is the escape character. % \def\atdummies{% - \def\@{@@}% - \def\ {@ }% - \let\{ = \lbraceatcmd - \let\} = \rbraceatcmd + \definedummyletter\@% + \definedummyletter\ % + \definedummyletter\{% + \definedummyletter\}% % % Do the redefinitions. - \commondummies + \definedummies \otherbackslash } -% Called from \indexdummies and \atdummies. -% -\def\commondummies{% - % - % \definedummyword defines \#1 as \string\#1\space, thus effectively - % preventing its expansion. This is used only for control words, - % not control letters, because the \space would be incorrect for - % control characters, but is needed to separate the control word - % from whatever follows. - % - % For control letters, we have \definedummyletter, which omits the - % space. - % - % These can be used both for control words that take an argument and - % those that do not. If it is followed by {arg} in the input, then - % that will dutifully get written to the index (or wherever). - % - \def\definedummyword ##1{\def##1{\string##1\space}}% - \def\definedummyletter##1{\def##1{\string##1}}% - \let\definedummyaccent\definedummyletter - % +% \definedummyword defines \#1 as \string\#1\space, thus effectively +% preventing its expansion. This is used only for control words, +% not control letters, because the \space would be incorrect for +% control characters, but is needed to separate the control word +% from whatever follows. +% +% These can be used both for control words that take an argument and +% those that do not. If it is followed by {arg} in the input, then +% that will dutifully get written to the index (or wherever). +% +% For control letters, we have \definedummyletter, which omits the +% space. +% +\def\definedummyword #1{\def#1{\string#1\space}}% +\def\definedummyletter#1{\def#1{\string#1}}% +\let\definedummyaccent\definedummyletter + +% Called from \indexdummies and \atdummies, to effectively prevent +% the expansion of commands. +% +\def\definedummies{% + % + \let\commondummyword\definedummyword + \let\commondummyletter\definedummyletter + \let\commondummyaccent\definedummyaccent \commondummiesnofonts % \definedummyletter\_% @@ -4487,6 +4981,7 @@ \definedummyword\TeX % % Assorted special characters. + \definedummyword\atchar \definedummyword\arrow \definedummyword\bullet \definedummyword\comma @@ -4506,6 +5001,7 @@ \definedummyword\guilsinglright \definedummyword\lbracechar \definedummyword\leq + \definedummyword\mathopsup \definedummyword\minus \definedummyword\ogonek \definedummyword\pounds @@ -4519,88 +5015,136 @@ \definedummyword\quotesinglbase \definedummyword\rbracechar \definedummyword\result + \definedummyword\sub + \definedummyword\sup \definedummyword\textdegree % % We want to disable all macros so that they are not expanded by \write. \macrolist + \let\value\dummyvalue % \normalturnoffactive - % - % Handle some cases of @value -- where it does not contain any - % (non-fully-expandable) commands. - \makevalueexpandable } -% \commondummiesnofonts: common to \commondummies and \indexnofonts. +% \commondummiesnofonts: common to \definedummies and \indexnofonts. +% Define \commondummyletter, \commondummyaccent and \commondummyword before +% using. Used for accents, font commands, and various control letters. % \def\commondummiesnofonts{% % Control letters and accents. - \definedummyletter\!% - \definedummyaccent\"% - \definedummyaccent\'% - \definedummyletter\*% - \definedummyaccent\,% - \definedummyletter\.% - \definedummyletter\/% - \definedummyletter\:% - \definedummyaccent\=% - \definedummyletter\?% - \definedummyaccent\^% - \definedummyaccent\`% - \definedummyaccent\~% - \definedummyword\u - \definedummyword\v - \definedummyword\H - \definedummyword\dotaccent - \definedummyword\ogonek - \definedummyword\ringaccent - \definedummyword\tieaccent - \definedummyword\ubaraccent - \definedummyword\udotaccent - \definedummyword\dotless + \commondummyletter\!% + \commondummyaccent\"% + \commondummyaccent\'% + \commondummyletter\*% + \commondummyaccent\,% + \commondummyletter\.% + \commondummyletter\/% + \commondummyletter\:% + \commondummyaccent\=% + \commondummyletter\?% + \commondummyaccent\^% + \commondummyaccent\`% + \commondummyaccent\~% + \commondummyword\u + \commondummyword\v + \commondummyword\H + \commondummyword\dotaccent + \commondummyword\ogonek + \commondummyword\ringaccent + \commondummyword\tieaccent + \commondummyword\ubaraccent + \commondummyword\udotaccent + \commondummyword\dotless % % Texinfo font commands. - \definedummyword\b - \definedummyword\i - \definedummyword\r - \definedummyword\sansserif - \definedummyword\sc - \definedummyword\slanted - \definedummyword\t + \commondummyword\b + \commondummyword\i + \commondummyword\r + \commondummyword\sansserif + \commondummyword\sc + \commondummyword\slanted + \commondummyword\t % % Commands that take arguments. - \definedummyword\abbr - \definedummyword\acronym - \definedummyword\anchor - \definedummyword\cite - \definedummyword\code - \definedummyword\command - \definedummyword\dfn - \definedummyword\dmn - \definedummyword\email - \definedummyword\emph - \definedummyword\env - \definedummyword\file - \definedummyword\image - \definedummyword\indicateurl - \definedummyword\inforef - \definedummyword\kbd - \definedummyword\key - \definedummyword\math - \definedummyword\option - \definedummyword\pxref - \definedummyword\ref - \definedummyword\samp - \definedummyword\strong - \definedummyword\tie - \definedummyword\uref - \definedummyword\url - \definedummyword\var - \definedummyword\verb - \definedummyword\w - \definedummyword\xref + \commondummyword\abbr + \commondummyword\acronym + \commondummyword\anchor + \commondummyword\cite + \commondummyword\code + \commondummyword\command + \commondummyword\dfn + \commondummyword\dmn + \commondummyword\email + \commondummyword\emph + \commondummyword\env + \commondummyword\file + \commondummyword\image + \commondummyword\indicateurl + \commondummyword\inforef + \commondummyword\kbd + \commondummyword\key + \commondummyword\math + \commondummyword\option + \commondummyword\pxref + \commondummyword\ref + \commondummyword\samp + \commondummyword\strong + \commondummyword\tie + \commondummyword\U + \commondummyword\uref + \commondummyword\url + \commondummyword\var + \commondummyword\verb + \commondummyword\w + \commondummyword\xref +} + +% For testing: output @{ and @} in index sort strings as \{ and \}. +\newif\ifusebracesinindexes + +\let\indexlbrace\relax +\let\indexrbrace\relax + +{\catcode`\@=0 +\catcode`\\=13 + @gdef@backslashdisappear{@def\{}} +} + +{ +\catcode`\<=13 +\catcode`\-=13 +\catcode`\`=13 + \gdef\indexnonalnumdisappear{% + \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else + % @set txiindexlquoteignore makes us ignore left quotes in the sort term. + % (Introduced for FSFS 2nd ed.) + \let`=\empty + \fi + % + \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else + \backslashdisappear + \fi + % + \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else + \def-{}% + \fi + \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else + \def<{}% + \fi + \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else + \def\@{}% + \fi + } + + \gdef\indexnonalnumreappear{% + \useindexbackslash + \let-\normaldash + \let<\normalless + \def\@{@}% + } } + % \indexnofonts is used when outputting the strings to sort the index % by, and when constructing control sequence names. It eliminates all % control sequences and just writes whatever the best ASCII sort string @@ -4608,12 +5152,11 @@ % \def\indexnofonts{% % Accent commands should become @asis. - \def\definedummyaccent##1{\let##1\asis}% + \def\commondummyaccent##1{\let##1\asis}% % We can just ignore other control letters. - \def\definedummyletter##1{\let##1\empty}% + \def\commondummyletter##1{\let##1\empty}% % All control words become @asis by default; overrides below. - \let\definedummyword\definedummyaccent - % + \let\commondummyword\commondummyaccent \commondummiesnofonts % % Don't no-op \tt, since it isn't a user-level command @@ -4626,14 +5169,10 @@ \def\_{\normalunderscore}% \def\-{}% @- shouldn't affect sorting % - % Unfortunately, texindex is not prepared to handle braces in the - % content at all. So for index sorting, we map @{ and @} to strings - % starting with |, since that ASCII character is between ASCII { and }. - \def\{{|a}% - \def\lbracechar{|a}% - % - \def\}{|b}% - \def\rbracechar{|b}% + \uccode`\1=`\{ \uppercase{\def\{{1}}% + \uccode`\1=`\} \uppercase{\def\}{1}}% + \let\lbracechar\{% + \let\rbracechar\}% % % Non-English letters. \def\AA{AA}% @@ -4642,7 +5181,7 @@ \def\L{L}% \def\OE{OE}% \def\O{O}% - \def\TH{ZZZ}% + \def\TH{TH}% \def\aa{aa}% \def\ae{ae}% \def\dh{dzz}% @@ -4654,45 +5193,45 @@ \def\o{o}% \def\questiondown{?}% \def\ss{ss}% - \def\th{zzz}% + \def\th{th}% % \def\LaTeX{LaTeX}% \def\TeX{TeX}% % - % Assorted special characters. - % (The following {} will end up in the sort string, but that's ok.) - \def\arrow{->}% - \def\bullet{bullet}% - \def\comma{,}% - \def\copyright{copyright}% - \def\dots{...}% - \def\enddots{...}% - \def\equiv{==}% - \def\error{error}% - \def\euro{euro}% - \def\expansion{==>}% - \def\geq{>=}% - \def\guillemetleft{<<}% - \def\guillemetright{>>}% - \def\guilsinglleft{<}% - \def\guilsinglright{>}% - \def\leq{<=}% - \def\minus{-}% - \def\point{.}% - \def\pounds{pounds}% - \def\print{-|}% - \def\quotedblbase{"}% - \def\quotedblleft{"}% - \def\quotedblright{"}% - \def\quoteleft{`}% - \def\quoteright{'}% - \def\quotesinglbase{,}% - \def\registeredsymbol{R}% - \def\result{=>}% - \def\textdegree{o}% - % - \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax - \else \indexlquoteignore \fi + % Assorted special characters. \defglyph gives the control sequence a + % definition that removes the {} that follows its use. + \defglyph\atchar{@}% + \defglyph\arrow{->}% + \defglyph\bullet{bullet}% + \defglyph\comma{,}% + \defglyph\copyright{copyright}% + \defglyph\dots{...}% + \defglyph\enddots{...}% + \defglyph\equiv{==}% + \defglyph\error{error}% + \defglyph\euro{euro}% + \defglyph\expansion{==>}% + \defglyph\geq{>=}% + \defglyph\guillemetleft{<<}% + \defglyph\guillemetright{>>}% + \defglyph\guilsinglleft{<}% + \defglyph\guilsinglright{>}% + \defglyph\leq{<=}% + \defglyph\lbracechar{\{}% + \defglyph\minus{-}% + \defglyph\point{.}% + \defglyph\pounds{pounds}% + \defglyph\print{-|}% + \defglyph\quotedblbase{"}% + \defglyph\quotedblleft{"}% + \defglyph\quotedblright{"}% + \defglyph\quoteleft{`}% + \defglyph\quoteright{'}% + \defglyph\quotesinglbase{,}% + \defglyph\rbracechar{\}}% + \defglyph\registeredsymbol{R}% + \defglyph\result{=>}% + \defglyph\textdegree{o}% % % We need to get rid of all macros, leaving only the arguments (if present). % Of course this is not nearly correct, but it is the best we can do for now. @@ -4705,21 +5244,24 @@ % goes to end-of-line is not handled. % \macrolist + \let\value\indexnofontsvalue } +\def\defglyph#1#2{\def#1##1{#2}} % see above + + -% Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us -% ignore left quotes in the sort term. -{\catcode`\`=\active - \gdef\indexlquoteignore{\let`=\empty}} -\let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? % Most index entries go through here, but \dosubind is the general case. % #1 is the index name, #2 is the entry text. \def\doind#1#2{\dosubind{#1}{#2}{}} -% Workhorse for all \fooindexes. +% There is also \dosubind {index}{topic}{subtopic} +% which makes an entry in a two-level index such as the operation index. +% TODO: Two-level index? Operation index? + +% Workhorse for all indexes. % #1 is name of index, #2 is stuff to put there, #3 is subentry -- % empty if called from \doind, as we usually are (the main exception % is with most defuns, which call us directly). @@ -4727,6 +5269,7 @@ \def\dosubind#1#2#3{% \iflinks {% + \requireopenindexfile{#1}% % Store the main index entry text (including the third arg). \toks0 = {#2}% % If third arg is present, precede it with a space. @@ -4742,7 +5285,50 @@ \fi } -% Write the entry in \toks0 to the index file: +% Check if an index file has been opened, and if not, open it. +\def\requireopenindexfile#1{% +\ifnum\csname #1indfile\endcsname=0 + \expandafter\newwrite \csname#1indfile\endcsname + \edef\suffix{#1}% + % A .fls suffix would conflict with the file extension for the output + % of -recorder, so use .f1s instead. + \ifx\suffix\indexisfl\def\suffix{f1}\fi + % Open the file + \immediate\openout\csname#1indfile\endcsname \jobname.\suffix + % Using \immediate above here prevents an object entering into the current + % box, which could confound checks such as those in \safewhatsit for + % preceding skips. + \typeout{Writing index file \jobname.\suffix}% +\fi} +\def\indexisfl{fl} + +% Output \ as {\indexbackslash}, because \ is an escape character in +% the index files. +\let\indexbackslash=\relax +{\catcode`\@=0 \catcode`\\=\active + @gdef@useindexbackslash{@def\{{@indexbackslash}}} +} + +% Definition for writing index entry text. +\def\sortas#1{\ignorespaces}% + +% Definition for writing index entry sort key. Should occur at the at +% the beginning of the index entry, like +% @cindex @sortas{september} \september +% The \ignorespaces takes care of following space, but there's no way +% to remove space before it. +{ +\catcode`\-=13 +\gdef\indexwritesortas{% + \begingroup + \indexnonalnumreappear + \indexwritesortasxxx} +\gdef\indexwritesortasxxx#1{% + \xdef\indexsortkey{#1}\endgroup} +} + + +% Write the entry in \toks0 to the index file. % \def\dosubindwrite{% % Put the index entry in the margin if desired. @@ -4752,14 +5338,26 @@ % % Remember, we are within a group. \indexdummies % Must do this here, since \bf, etc expand at this stage - \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now - % so it will be output as is; and it will print as backslash. + \useindexbackslash % \indexbackslash isn't defined now so it will be output + % as is; and it will print as backslash. + % The braces around \indexbrace are recognized by texindex. % - % Process the index entry with all font commands turned off, to - % get the string to sort by. + % Get the string to sort by, by processing the index entry with all + % font commands turned off. {\indexnofonts - \edef\temp{\the\toks0}% need full expansion - \xdef\indexsorttmp{\temp}% + \def\lbracechar{{\indexlbrace}}% + \def\rbracechar{{\indexrbrace}}% + \let\{=\lbracechar + \let\}=\rbracechar + \indexnonalnumdisappear + \xdef\indexsortkey{}% + \let\sortas=\indexwritesortas + \edef\temp{\the\toks0}% + \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas + \ifx\indexsortkey\empty + \xdef\indexsortkey{\temp}% + \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi + \fi }% % % Set up the complete index entry, with both the sort key and @@ -4769,10 +5367,11 @@ % sorted result. \edef\temp{% \write\writeto{% - \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% + \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}% }% \temp } +\newbox\dummybox % used above % Take care of unwanted page breaks/skips around a whatsit: % @@ -4897,52 +5496,113 @@ % \initial {@} % as its first line, TeX doesn't complain about mismatched braces % (because it thinks @} is a control sequence). - \catcode`\@ = 11 - \openin 1 \jobname.#1s + \catcode`\@ = 12 + % See comment in \requireopenindexfile. + \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi + \openin 1 \jobname.\indexname s \ifeof 1 % \enddoublecolumns gets confused if there is no text in the index, % and it loses the chapter title and the aux file entries for the % index. The easiest way to prevent this problem is to make sure % there is some text. \putwordIndexNonexistent + \typeout{No file \jobname.\indexname s.}% \else + \catcode`\\ = 0 % % If the index file exists but is empty, then \openin leaves \ifeof % false. We have to make TeX try to read something from the file, so % it can discover if there is anything in it. - \read 1 to \temp + \read 1 to \thisline \ifeof 1 \putwordIndexIsEmpty \else % Index files are almost Texinfo source, but we use \ as the escape % character. It would be better to use @, but that's too big a change % to make right now. - \def\indexbackslash{\backslashcurfont}% - \catcode`\\ = 0 - \escapechar = `\\ + \def\indexbackslash{\ttbackslash}% + \let\indexlbrace\{ % Likewise, set these sequences for braces + \let\indexrbrace\} % used in the sort key. \begindoublecolumns - \input \jobname.#1s + \let\dotheinsertentrybox\dotheinsertentryboxwithpenalty + % + % Read input from the index file line by line. + \loopdo + \ifeof1 \else + \read 1 to \nextline + \fi + % + \indexinputprocessing + \thisline + % + \ifeof1\else + \let\thisline\nextline + \repeat + %% \enddoublecolumns \fi \fi \closein 1 \endgroup} +\def\loopdo#1\repeat{\def\body{#1}\loopdoxxx} +\def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next} + +\def\indexinputprocessing{% + \ifeof1 + \let\firsttoken\relax + \else + \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}% + \act + \fi +} +\def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken} +\long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1} + % These macros are used by the sorted index file itself. % Change them to control the appearance of the index. -\def\initial#1{{% - % Some minor font changes for the special characters. - \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt - % +{\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13 +\catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13 +\catcode`\$=3 +\gdef\initialglyphs{% + % Some changes for non-alphabetic characters. Using the glyphs from the + % math fonts looks more consistent than the typewriter font used elsewhere + % for these characters. + \def\indexbackslash{\math{\backslash}}% + \let\\=\indexbackslash + % + % Can't get bold backslash so don't use bold forward slash + \catcode`\/=13 + \def/{{\secrmnotbold \normalslash}}% + \def-{{\normaldash\normaldash}}% en dash `--' + \def^{{\chapbf \normalcaret}}% + \def~{{\chapbf \normaltilde}}% + \def\_{% + \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }% + \def|{$\vert$}% + \def<{$\less$}% + \def>{$\gtr$}% + \def+{$\normalplus$}% +}} + +\def\initial{% + \bgroup + \initialglyphs + \initialx +} + +\def\initialx#1{% % Remove any glue we may have, we'll be inserting our own. \removelastskip % % We like breaks before the index initials, so insert a bonus. + % The glue before the bonus allows a little bit of space at the + % bottom of a column to reduce an increase in inter-line spacing. \nobreak - \vskip 0pt plus 3\baselineskip - \penalty 0 - \vskip 0pt plus -3\baselineskip + \vskip 0pt plus 5\baselineskip + \penalty -300 + \vskip 0pt plus -5\baselineskip % % Typeset the initial. Making this add up to a whole number of % baselineskips increases the chance of the dots lining up from column @@ -4950,63 +5610,45 @@ % we need before each entry, but it's better. % % No shrink because it confuses \balancecolumns. - \vskip 1.67\baselineskip plus .5\baselineskip - \leftline{\secbf #1}% + \vskip 1.67\baselineskip plus 1\baselineskip + \leftline{\secfonts \kern-0.05em \secbf #1}% + % \secfonts is inside the argument of \leftline so that the change of + % \baselineskip will not affect any glue inserted before the vbox that + % \leftline creates. % Do our best not to break after the initial. \nobreak \vskip .33\baselineskip plus .1\baselineskip -}} + \egroup % \initialglyphs +} + +\newdimen\entryrightmargin +\entryrightmargin=0pt % \entry typesets a paragraph consisting of the text (#1), dot leaders, and % then page number (#2) flushed to the right margin. It is used for index % and table of contents entries. The paragraph is indented by \leftskip. % -% A straightforward implementation would start like this: -% \def\entry#1#2{... -% But this freezes the catcodes in the argument, and can cause problems to -% @code, which sets - active. This problem was fixed by a kludge--- -% ``-'' was active throughout whole index, but this isn't really right. -% The right solution is to prevent \entry from swallowing the whole text. -% --kasal, 21nov03 \def\entry{% \begingroup % + % For pdfTeX and XeTeX. + % The redefinition of \domark stops marks being added in \pdflink to + % preserve coloured links across page boundaries. Otherwise the marks + % would get in the way of \lastbox in \insertentrybox. + \let\domark\relax + % % Start a new paragraph if necessary, so our assignments below can't % affect previous text. \par % - % Do not fill out the last line with white space. - \parfillskip = 0in - % % No extra space above this paragraph. \parskip = 0in % - % Do not prefer a separate line ending with a hyphen to fewer lines. - \finalhyphendemerits = 0 - % - % \hangindent is only relevant when the entry text and page number - % don't both fit on one line. In that case, bob suggests starting the - % dots pretty far over on the line. Unfortunately, a large - % indentation looks wrong when the entry text itself is broken across - % lines. So we use a small indentation and put up with long leaders. - % - % \hangafter is reset to 1 (which is the value we want) at the start - % of each paragraph, so we need not do anything with that. - \hangindent = 2em - % - % When the entry text needs to be broken, just fill out the first line - % with blank space. - \rightskip = 0pt plus1fil - % - % A bit of stretch before each entry for the benefit of balancing - % columns. - \vskip 0pt plus1pt - % % When reading the text of entry, convert explicit line breaks % from @* into spaces. The user might give these in long section % titles, for instance. \def\*{\unskip\space\ignorespaces}% - \def\entrybreak{\hfil\break}% + \def\entrybreak{\hfil\break}% An undocumented command % % Swallow the left brace of the text (first parameter): \afterassignment\doentry @@ -5014,45 +5656,168 @@ } \def\entrybreak{\unskip\space\ignorespaces}% \def\doentry{% + % Save the text of the entry + \global\setbox\boxA=\hbox\bgroup \bgroup % Instead of the swallowed brace. \noindent \aftergroup\finishentry % And now comes the text of the entry. + % Not absorbing as a macro argument reduces the chance of problems + % with catcodes occurring. } -\def\finishentry#1{% +{\catcode`\@=11 +\gdef\finishentry#1{% + \egroup % end box A + \dimen@ = \wd\boxA % Length of text of entry + \global\setbox\boxA=\hbox\bgroup\unhbox\boxA % #1 is the page number. % - % The following is kludged to not output a line of dots in the index if - % there are no page numbers. The next person who breaks this will be - % cursed by a Unix daemon. - \setbox\boxA = \hbox{#1}% - \ifdim\wd\boxA = 0pt - \ % + % Get the width of the page numbers, and only use + % leaders if they are present. + \global\setbox\boxB = \hbox{#1}% + \ifdim\wd\boxB = 0pt + \null\nobreak\hfill\ % \else % - % If we must, put the page number on a line of its own, and fill out - % this line with blank space. (The \hfil is overwhelmed with the - % fill leaders glue in \indexdotfill if the page number does fit.) - \hfil\penalty50 \null\nobreak\indexdotfill % Have leaders before the page number. % - % The `\ ' here is removed by the implicit \unskip that TeX does as - % part of (the primitive) \par. Without it, a spurious underfull - % \hbox ensues. \ifpdf - \pdfgettoks#1.% - \ \the\toksA + \pdfgettoks#1.% + \hskip\skip\thinshrinkable\the\toksA \else - \ #1% + \ifx\XeTeXrevision\thisisundefined + \hskip\skip\thinshrinkable #1% + \else + \pdfgettoks#1.% + \hskip\skip\thinshrinkable\the\toksA + \fi \fi \fi - \par + \egroup % end \boxA + \ifdim\wd\boxB = 0pt + \global\setbox\entrybox=\vbox{\unhbox\boxA}% + \else + \global\setbox\entrybox=\vbox\bgroup + % We want the text of the entries to be aligned to the left, and the + % page numbers to be aligned to the right. + % + \parindent = 0pt + \advance\leftskip by 0pt plus 1fil + \advance\leftskip by 0pt plus -1fill + \rightskip = 0pt plus -1fil + \advance\rightskip by 0pt plus 1fill + % Cause last line, which could consist of page numbers on their own + % if the list of page numbers is long, to be aligned to the right. + \parfillskip=0pt plus -1fill + % + \advance\rightskip by \entryrightmargin + % Determine how far we can stretch into the margin. + % This allows, e.g., "Appendix H GNU Free Documentation License" to + % fit on one line in @letterpaper format. + \ifdim\entryrightmargin>2.1em + \dimen@i=2.1em + \else + \dimen@i=0em + \fi + \advance \parfillskip by 0pt minus 1\dimen@i + % + \dimen@ii = \hsize + \advance\dimen@ii by -1\leftskip + \advance\dimen@ii by -1\entryrightmargin + \advance\dimen@ii by 1\dimen@i + \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line + \ifdim\dimen@ > 0.8\dimen@ii % due to long index text + % Try to split the text roughly evenly. \dimen@ will be the length of + % the first line. + \dimen@ = 0.7\dimen@ + \dimen@ii = \hsize + \ifnum\dimen@>\dimen@ii + % If the entry is too long (for example, if it needs more than + % two lines), use all the space in the first line. + \dimen@ = \dimen@ii + \fi + \advance\leftskip by 0pt plus 1fill % ragged right + \advance \dimen@ by 1\rightskip + \parshape = 2 0pt \dimen@ 0em \dimen@ii + % Ideally we'd add a finite glue at the end of the first line only, + % instead of using \parshape with explicit line lengths, but TeX + % doesn't seem to provide a way to do such a thing. + % + % Indent all lines but the first one. + \advance\leftskip by 1em + \advance\parindent by -1em + \fi\fi + \indent % start paragraph + \unhbox\boxA + % + % Do not prefer a separate line ending with a hyphen to fewer lines. + \finalhyphendemerits = 0 + % + % Word spacing - no stretch + \spaceskip=\fontdimen2\font minus \fontdimen4\font + % + \linepenalty=1000 % Discourage line breaks. + \hyphenpenalty=5000 % Discourage hyphenation. + % + \par % format the paragraph + \egroup % The \vbox + \fi \endgroup + \dotheinsertentrybox +}} + +\newskip\thinshrinkable +\skip\thinshrinkable=.15em minus .15em + +\newbox\entrybox +\def\insertentrybox{% + \ourunvbox\entrybox +} + +% default definition +\let\dotheinsertentrybox\insertentrybox + +% Use \lastbox to take apart vbox box by box, and add each sub-box +% to the current vertical list. +\def\ourunvbox#1{% +\bgroup % for local binding of \delayedbox + % Remove the last box from box #1 + \global\setbox#1=\vbox{% + \unvbox#1% + \unskip % remove any glue + \unpenalty + \global\setbox\interbox=\lastbox + }% + \setbox\delayedbox=\box\interbox + \ifdim\ht#1=0pt\else + \ourunvbox#1 % Repeat on what's left of the box + \nobreak + \fi + \box\delayedbox +\egroup } +\newbox\delayedbox +\newbox\interbox + +% Used from \printindex. \firsttoken should be the first token +% after the \entry. If it's not another \entry, we are at the last +% line of a group of index entries, so insert a penalty to discourage +% widowed index entries. +\def\dotheinsertentryboxwithpenalty{% + \ifx\firsttoken\isentry + \else + \penalty 9000 + \fi + \insertentrybox +} +\def\isentry{\entry}% % Like plain.tex's \dotfill, except uses up at least 1 em. +% The filll stretch here overpowers both the fil and fill stretch to push +% the page number to the right. \def\indexdotfill{\cleaders - \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} + \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll} + \def\primary #1{\line{#1\hfil}} @@ -5066,7 +5831,11 @@ \ifpdf \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. \else - #2 + \ifx\XeTeXrevision\thisisundefined + #2 + \else + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + \fi \fi \par }} @@ -5074,12 +5843,37 @@ % Define two-column mode, which we use to typeset indexes. % Adapted from the TeXbook, page 416, which is to say, % the manmac.tex format used to print the TeXbook itself. -\catcode`\@=11 +\catcode`\@=11 % private names \newbox\partialpage \newdimen\doublecolumnhsize +% Use inside an output routine to save \topmark and \firstmark +\def\savemarks{% + \global\savedtopmark=\expandafter{\topmark }% + \global\savedfirstmark=\expandafter{\firstmark }% +} +\newtoks\savedtopmark +\newtoks\savedfirstmark + +% Set \topmark and \firstmark for next time \output runs. +% Can't be run from withinside \output (because any material +% added while an output routine is active, including +% penalties, is saved for after it finishes). The page so far +% should be empty, otherwise what's on it will be thrown away. +\def\restoremarks{% + \mark{\the\savedtopmark}% + \bgroup\output = {% + \setbox\dummybox=\box\PAGE + }abc\eject\egroup + % "abc" because output routine doesn't fire for a completely empty page. + \mark{\the\savedfirstmark}% +} + \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns + % If not much space left on page, start a new page. + \ifdim\pagetotal>0.8\vsize\vfill\eject\fi + % % Grab any single-column material above us. \output = {% % @@ -5099,8 +5893,15 @@ \unvbox\PAGE \kern-\topskip \kern\baselineskip }% + \savemarks }% \eject % run that output routine to set \partialpage + \restoremarks + % + % We recover the two marks that the last output routine saved in order + % to propagate the information in marks added around a chapter heading, + % which could be otherwise be lost by the time the final page is output. + % % % Use the double-column output routine for subsequent pages. \output = {\doublecolumnout}% @@ -5126,27 +5927,31 @@ \divide\doublecolumnhsize by 2 \hsize = \doublecolumnhsize % - % Double the \vsize as well. (We don't need a separate register here, - % since nobody clobbers \vsize.) + % Double the \vsize as well. + \advance\vsize by -\ht\partialpage \vsize = 2\vsize + % + % For the benefit of balancing columns + \advance\baselineskip by 0pt plus 0.5pt } % The double-column output routine for all double-column pages except -% the last. +% the last, which is done by \balancecolumns. % \def\doublecolumnout{% + % \splittopskip=\topskip \splitmaxdepth=\maxdepth % Get the available space for the double columns -- the normal % (undoubled) page height minus any material left over from the % previous page. \dimen@ = \vsize \divide\dimen@ by 2 - \advance\dimen@ by -\ht\partialpage % % box0 will be the left-hand column, box2 the right. - \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ + \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@ + \global\advance\vsize by 2\ht\partialpage \onepageout\pagesofar - \unvbox255 + \unvbox\PAGE \penalty\outputpenalty } % @@ -5157,10 +5962,11 @@ % \hsize = \doublecolumnhsize \wd0=\hsize \wd2=\hsize - \hbox to\pagewidth{\box0\hfil\box2}% + \hbox to\txipagewidth{\box0\hfil\box2}% } -% -% All done with double columns. + + +% Finished with with double columns. \def\enddoublecolumns{% % The following penalty ensures that the page builder is exercised % _before_ we change the output routine. This is necessary in the @@ -5183,7 +5989,7 @@ % goal. When TeX sees \eject from below which follows the final % section, it invokes the new output routine that we've set after % \balancecolumns below; \onepageout will try to fit the two columns - % and the final section into the vbox of \pageheight (see + % and the final section into the vbox of \txipageheight (see % \pagebody), causing an overfull box. % % Note that glue won't work here, because glue does not exercise the @@ -5191,53 +5997,88 @@ \penalty0 % \output = {% - % Split the last of the double-column material. Leave it on the - % current page, no automatic page break. + % Split the last of the double-column material. + \savemarks \balancecolumns - % - % If we end up splitting too much material for the current page, - % though, there will be another page break right after this \output - % invocation ends. Having called \balancecolumns once, we do not + }% + \eject % call the \output just set + \ifdim\pagetotal=0pt + % Having called \balancecolumns once, we do not % want to call it again. Therefore, reset \output to its normal - % definition right away. (We hope \balancecolumns will never be - % called on to balance too much material, but if it is, this makes - % the output somewhat more palatable.) + % definition right away. \global\output = {\onepageout{\pagecontents\PAGE}}% - }% - \eject - \endgroup % started in \begindoublecolumns - % - % \pagegoal was set to the doubled \vsize above, since we restarted - % the current page. We're now back to normal single-column - % typesetting, so reset \pagegoal to the normal \vsize (after the - % \endgroup where \vsize got restored). - \pagegoal = \vsize + % + \endgroup % started in \begindoublecolumns + \restoremarks + % Leave the double-column material on the current page, no automatic + % page break. + \box\balancedcolumns + % + % \pagegoal was set to the doubled \vsize above, since we restarted + % the current page. We're now back to normal single-column + % typesetting, so reset \pagegoal to the normal \vsize. + \global\vsize = \txipageheight % + \pagegoal = \txipageheight % + \else + % We had some left-over material. This might happen when \doublecolumnout + % is called in \balancecolumns. Try again. + \expandafter\enddoublecolumns + \fi } +\newbox\balancedcolumns +\setbox\balancedcolumns=\vbox{shouldnt see this}% % -% Called at the end of the double column material. +% Only called for the last of the double column material. \doublecolumnout +% does the others. \def\balancecolumns{% - \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. + \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120. \dimen@ = \ht0 \advance\dimen@ by \topskip \advance\dimen@ by-\baselineskip - \divide\dimen@ by 2 % target to split to - %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% - \splittopskip = \topskip - % Loop until we get a decent breakpoint. - {% - \vbadness = 10000 - \loop - \global\setbox3 = \copy0 - \global\setbox1 = \vsplit3 to \dimen@ - \ifdim\ht3>\dimen@ - \global\advance\dimen@ by 1pt - \repeat - }% - %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% - \setbox0=\vbox to\dimen@{\unvbox1}% - \setbox2=\vbox to\dimen@{\unvbox3}% + \ifdim\dimen@<5\baselineskip + % Don't split a short final column in two. + \setbox2=\vbox{}% + \global\setbox\balancedcolumns=\vbox{\pagesofar}% + \else + \divide\dimen@ by 2 % target to split to + \dimen@ii = \dimen@ + \splittopskip = \topskip + % Loop until left column is at least as high as the right column. + {% + \vbadness = 10000 + \loop + \global\setbox3 = \copy0 + \global\setbox1 = \vsplit3 to \dimen@ + \ifdim\ht1<\ht3 + \global\advance\dimen@ by 1pt + \repeat + }% + % Now the left column is in box 1, and the right column in box 3. + % + % Check whether the left column has come out higher than the page itself. + % (Note that we have doubled \vsize for the double columns, so + % the actual height of the page is 0.5\vsize). + \ifdim2\ht1>\vsize + % It appears that we have been called upon to balance too much material. + % Output some of it with \doublecolumnout, leaving the rest on the page. + \setbox\PAGE=\box0 + \doublecolumnout + \else + % Compare the heights of the two columns. + \ifdim4\ht1>5\ht3 + % Column heights are too different, so don't make their bottoms + % flush with each other. + \setbox2=\vbox to \ht1 {\unvbox3\vfill}% + \setbox0=\vbox to \ht1 {\unvbox1\vfill}% + \else + % Make column bottoms flush with each other. + \setbox2=\vbox to\ht1{\unvbox3\unskip}% + \setbox0=\vbox to\ht1{\unvbox1\unskip}% + \fi + \global\setbox\balancedcolumns=\vbox{\pagesofar}% + \fi + \fi % - \pagesofar } \catcode`\@ = \other @@ -5252,10 +6093,14 @@ \null \vskip.3\vsize % move it down on the page a bit \begingroup - \noindent \titlefonts\rmisbold #1\par % the text + \noindent \titlefonts\rm #1\par % the text \let\lastnode=\empty % no node to associate with \writetocentry{part}{#1}{}% but put it in the toc \headingsoff % no headline or footline on the part page + % This outputs a mark at the end of the page that clears \thischapter + % and \thissection, as is done in \startcontents. + \let\pchapsepmacro\relax + \chapmacro{}{Yomitfromtoc}{}% \chapoddpage \endgroup } @@ -5500,9 +6345,6 @@ % @centerchap is like @unnumbered, but the heading is centered. \outer\parseargdef\centerchap{% - % Well, we could do the following in a group, but that would break - % an assumption that \chapmacro is called at the outermost level. - % Thus we are safer this way: --kasal, 24feb04 \let\centerparametersmaybe = \centerparameters \unnmhead0{#1}% \let\centerparametersmaybe = \relax @@ -5626,7 +6468,11 @@ % Define plain chapter starts, and page on/off switching for it. \def\chapbreak{\dobreak \chapheadingskip {-4000}} + +% Start a new page \def\chappager{\par\vfill\supereject} + +% \chapoddpage - start on an odd page for a new chapter % Because \domark is called before \chapoddpage, the filler page will % get the headings for the next chapter, which is wrong. But we don't % care -- we just disable all headings on the filler page. @@ -5641,7 +6487,7 @@ \fi } -\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} +\parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname} \def\CHAPPAGoff{% \global\let\contentsalignmacro = \chappager @@ -5662,17 +6508,26 @@ \CHAPPAGon -% Chapter opening. +% \chapmacro - Chapter opening. % % #1 is the text, #2 is the section type (Ynumbered, Ynothing, % Yappendix, Yomitfromtoc), #3 the chapter number. +% Not used for @heading series. % % To test against our argument. \def\Ynothingkeyword{Ynothing} -\def\Yomitfromtockeyword{Yomitfromtoc} \def\Yappendixkeyword{Yappendix} +\def\Yomitfromtockeyword{Yomitfromtoc} % \def\chapmacro#1#2#3{% + \expandafter\ifx\thisenv\titlepage\else + \checkenv{}% chapters, etc., should not start inside an environment. + \fi + % FIXME: \chapmacro is currently called from inside \titlepage when + % \setcontentsaftertitlepage to print the "Table of Contents" heading, but + % this should probably be done by \sectionheading with an option to print + % in chapter size. + % % Insert the first mark before the heading break (see notes for \domark). \let\prevchapterdefs=\lastchapterdefs \let\prevsectiondefs=\lastsectiondefs @@ -5724,7 +6579,8 @@ \domark % {% - \chapfonts \rmisbold + \chapfonts \rm + \let\footnote=\errfootnoteheading % give better error message % % Have to define \lastsection before calling \donoderef, because the % xref code eventually uses it. On the other hand, it has to be called @@ -5777,30 +6633,6 @@ } -% I don't think this chapter style is supported any more, so I'm not -% updating it with the new noderef stuff. We'll see. --karl, 11aug03. -% -\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} -% -\def\unnchfopen #1{% - \chapoddpage - \vbox{\chapfonts \raggedtitlesettings #1\par}% - \nobreak\bigskip\nobreak -} -\def\chfopen #1#2{\chapoddpage {\chapfonts -\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% -\par\penalty 5000 % -} -\def\centerchfopen #1{% - \chapoddpage - \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}% - \nobreak\bigskip \nobreak -} -\def\CHAPFopen{% - \global\let\chapmacro=\chfopen - \global\let\centerchapmacro=\centerchfopen} - - % Section titles. These macros combine the section number parts and % call the generic \sectionheading to do the printing. % @@ -5818,22 +6650,29 @@ % Print any size, any type, section title. % -% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is -% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the -% section number. +% #1 is the text of the title, +% #2 is the section level (sec/subsec/subsubsec), +% #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc), +% #4 is the section number. % \def\seckeyword{sec} % \def\sectionheading#1#2#3#4{% {% - \checkenv{}% should not be in an environment. - % - % Switch to the right set of fonts. - \csname #2fonts\endcsname \rmisbold - % \def\sectionlevel{#2}% \def\temptype{#3}% % + % It is ok for the @heading series commands to appear inside an + % environment (it's been historically allowed, though the logic is + % dubious), but not the others. + \ifx\temptype\Yomitfromtockeyword\else + \checkenv{}% non-@*heading should not be in an environment. + \fi + \let\footnote=\errfootnoteheading + % + % Switch to the right set of fonts. + \csname #2fonts\endcsname \rm + % % Insert first mark before the heading break (see notes for \domark). \let\prevsectiondefs=\lastsectiondefs \ifx\temptype\Ynothingkeyword @@ -5885,7 +6724,7 @@ % % Now the second mark, after the heading break. No break points % between here and the heading. - \let\prevsectiondefs=\lastsectiondefs + \global\let\prevsectiondefs=\lastsectiondefs \domark % % Only insert the space after the number if we have a section number. @@ -5996,7 +6835,14 @@ % 1 and 2 (the page numbers aren't printed), and so are the first % two pages of the document. Thus, we'd have two destinations named % `1', and two named `2'. - \ifpdf \global\pdfmakepagedesttrue \fi + \ifpdf + \global\pdfmakepagedesttrue + \else + \ifx\XeTeXrevision\thisisundefined + \else + \global\pdfmakepagedesttrue + \fi + \fi } @@ -6045,7 +6891,7 @@ \savepageno = \pageno \begingroup % Set up to handle contents files properly. \raggedbottom % Worry more about breakpoints than the bottom. - \advance\hsize by -\contentsrightmargin % Don't use the full line length. + \entryrightmargin=\contentsrightmargin % Don't use the full line length. % % Roman numerals for page numbers. \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi @@ -6139,7 +6985,15 @@ % exist, with an empty box. Let's hope all the numbers have the same width. % Also ignore the page number, which is conventionally not printed. \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}} -\def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}} +\def\partentry#1#2#3#4{% + % Add stretch and a bonus for breaking the page before the part heading. + % This reduces the chance of the page being broken immediately after the + % part heading, before a following chapter heading. + \vskip 0pt plus 5\baselineskip + \penalty-300 + \vskip 0pt plus -5\baselineskip + \dochapentry{\numeralbox\labelspace#1}{}% +} % % Parts, in the short toc. \def\shortpartentry#1#2#3#4{% @@ -6150,7 +7004,7 @@ % Chapters, in the main contents. \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} -% + % Chapters, in the short toc. % See comments in \dochapentry re vbox and related settings. \def\shortchapentry#1#2#3#4{% @@ -6165,7 +7019,7 @@ \setbox0 = \hbox{\putwordAppendix{} M}% \hbox to \wd0{\putwordAppendix{} #1\hss}} % -\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} +\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}} % Unnumbered chapters. \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} @@ -6198,6 +7052,8 @@ \def\dochapentry#1#2{% \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip \begingroup + % Move the page numbers slightly to the right + \advance\entryrightmargin by -0.05em \chapentryfonts \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup @@ -6252,14 +7108,14 @@ \catcode `\|=\other \catcode `\<=\other \catcode `\>=\other - \catcode`\`=\other - \catcode`\'=\other - \escapechar=`\\ + \catcode `\`=\other + \catcode `\'=\other % % ' is active in math mode (mathcode"8000). So reset it, and all our % other math active characters (just in case), to plain's definitions. \mathactive % + % Inverse of the list at the beginning of the file. \let\b=\ptexb \let\bullet=\ptexbullet \let\c=\ptexc @@ -6275,9 +7131,11 @@ \let\+=\tabalign \let\}=\ptexrbrace \let\/=\ptexslash + \let\sp=\ptexsp \let\*=\ptexstar + %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode \let\t=\ptext - \expandafter \let\csname top\endcsname=\ptextop % outer + \expandafter \let\csname top\endcsname=\ptextop % we've made it outer \let\frenchspacing=\plainfrenchspacing % \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% @@ -6314,6 +7172,24 @@ \endgraf \ifdim\lastskip<\envskipamount \removelastskip + \ifnum\lastpenalty<10000 + % Penalize breaking before the environment, because preceding text + % often leads into it. + \penalty100 + \fi + \vskip\envskipamount + \fi + \fi +}} + +\def\afterenvbreak{{% + % =10000 instead of <10000 because of a special case in \itemzzz and + % \sectionheading, q.v. + \ifnum \lastpenalty=10000 \else + \advance\envskipamount by \parskip + \endgraf + \ifdim\lastskip<\envskipamount + \removelastskip % it's not a good place to break if the last penalty was \nobreak % or better ... \ifnum\lastpenalty<10000 \penalty-50 \fi @@ -6322,8 +7198,6 @@ \fi }} -\let\afterenvbreak = \aboveenvbreak - % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will % also clear it, so that its embedded environments do the narrowing again. \let\nonarrowing=\relax @@ -6361,15 +7235,13 @@ % side, and for 6pt waste from % each corner char, and rule thickness \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip - % Flag to tell @lisp, etc., not to narrow margin. - \let\nonarrowing = t% % % If this cartouche directly follows a sectioning command, we need the % \parskip glue (backspaced over by default) or the cartouche can % collide with the section heading. \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi % - \vbox\bgroup + \setbox\groupbox=\vbox\bgroup \baselineskip=0pt\parskip=0pt\lineskip=0pt \carttop \hbox\bgroup @@ -6393,6 +7265,7 @@ \egroup \cartbot \egroup + \addgroupbox \checkinserts } @@ -6402,7 +7275,7 @@ \newdimen\nonfillparindent \def\nonfillstart{% \aboveenvbreak - \hfuzz = 12pt % Don't be fussy + \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy \sepspaces % Make spaces be word-separators rather than space tokens. \let\par = \lisppar % don't ignore blank lines \obeylines % each line of input is a line of output @@ -6529,9 +7402,13 @@ % @raggedright does more-or-less normal line breaking but no right -% justification. From plain.tex. +% justification. From plain.tex. Don't stretch around special +% characters in urls in this environment, since the stretch at the right +% should be enough. \envdef\raggedright{% - \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax + \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax + \def\urefprestretchamount{0pt}% + \def\urefpoststretchamount{0pt}% } \let\Eraggedright\par @@ -6771,7 +7648,7 @@ % typesetting commands (@smallbook, font changes, etc.) have to be done % beforehand -- and a) we want @copying to be done first in the source % file; b) letting users define the frontmatter in as flexible order as -% possible is very desirable. +% possible is desirable. % \def\copying{\checkenv{}\begingroup\scanargctxt\docopying} \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} @@ -6866,7 +7743,7 @@ \temp } -% \domakedefun \deffn \deffnx \deffnheader +% \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) } % % Define \deffn and \deffnx, without parameters. % \deffnheader has to be defined explicitly. @@ -7075,7 +7952,7 @@ \fi % no return type #3% output function name }% - {\rm\enskip}% hskip 0.5 em of \tenrm + {\rm\enskip}% hskip 0.5 em of \rmfont % \boldbrax % arguments will be output next, if any. @@ -7204,34 +8081,41 @@ } \fi -\def\scanmacro#1{\begingroup +% alias because \c means cedilla in @tex or @math +\let\texinfoc=\c + +\newcount\savedcatcodeone +\newcount\savedcatcodetwo + +% Used at the time of macro expansion. +% Argument is macro body with arguments substituted +\def\scanmacro#1{% \newlinechar`\^^M - \let\xeatspaces\eatspaces + \def\xeatspaces{\eatspaces}% + % + % Temporarily undo catcode changes of \printindex. Set catcode of @ to + % 0 so that @-commands in macro expansions aren't printed literally when + % formatting an index file, where \ is used as the escape character. + \savedcatcodeone=\catcode`\@ + \savedcatcodetwo=\catcode`\\ + \catcode`\@=0 + \catcode`\\=\active % - % Undo catcode changes of \startcontents and \doprintindex - % When called from @insertcopying or (short)caption, we need active - % backslash to get it printed correctly. Previously, we had - % \catcode`\\=\other instead. We'll see whether a problem appears - % with macro expansion. --kasal, 19aug04 - \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ + % Process the macro body under the current catcode regime. + \scantokens{#1@texinfoc}% % - % ... and for \example: - \spaceisspace + \catcode`\@=\savedcatcodeone + \catcode`\\=\savedcatcodetwo % - % The \empty here causes a following catcode 5 newline to be eaten as - % part of reading whitespace after a control sequence. It does not - % eat a catcode 13 newline. There's no good way to handle the two - % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX - % would then have different behavior). See the Macro Details node in - % the manual for the workaround we recommend for macros and - % line-oriented commands. - % - \scantokens{#1\empty}% -\endgroup} + % The \texinfoc is to remove the \newlinechar added by \scantokens, and + % can be noticed by \parsearg. + % We avoid surrounding the call to \scantokens with \bgroup and \egroup + % to allow macros to open or close groups themselves. +} +% Used for copying and captions \def\scanexp#1{% - \edef\temp{\noexpand\scanmacro{#1}}% - \temp + \expandafter\scanmacro\expandafter{#1}% } \newcount\paramno % Count of parameters @@ -7239,7 +8123,7 @@ \newif\ifrecursive % Is it recursive? % List of all defined macros in the form -% \definedummyword\macro1\definedummyword\macro2... +% \commondummyword\macro1\commondummyword\macro2... % Currently is also contains all @aliases; the list can be split % if there is a need. \def\macrolist{} @@ -7247,7 +8131,7 @@ % Add the macro to \macrolist \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} \def\addtomacrolistxxx#1{% - \toks0 = \expandafter{\macrolist\definedummyword#1}% + \toks0 = \expandafter{\macrolist\commondummyword#1}% \xdef\macrolist{\the\toks0}% } @@ -7297,48 +8181,45 @@ \catcode`\+=\other \catcode`\<=\other \catcode`\>=\other - \catcode`\@=\other \catcode`\^=\other \catcode`\_=\other \catcode`\|=\other \catcode`\~=\other - \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi + \passthroughcharstrue } \def\scanargctxt{% used for copying and captions, not macros. \scanctxt + \catcode`\@=\other \catcode`\\=\other \catcode`\^^M=\other } \def\macrobodyctxt{% used for @macro definitions \scanctxt + \catcode`\ =\other + \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other \catcode`\^^M=\other \usembodybackslash } -\def\macroargctxt{% used when scanning invocations +% Used when scanning braced macro arguments. Note, however, that catcode +% changes here are ineffectual if the macro invocation was nested inside +% an argument to another Texinfo command. +\def\macroargctxt{% \scanctxt - \catcode`\\=0 + \catcode`\ =\active + \catcode`\^^M=\other + \catcode`\\=\active } -% why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes" -% for the single characters \ { }. Thus, we end up with the "commands" -% that would be written @\ @{ @} in a Texinfo document. -% -% We already have @{ and @}. For @\, we define it here, and only for -% this purpose, to produce a typewriter backslash (so, the @\ that we -% define for @math can't be used with @macro calls): -% -\def\\{\normalbackslash}% -% -% We would like to do this for \, too, since that is what makeinfo does. -% But it is not possible, because Texinfo already has a command @, for a -% cedilla accent. Documents must use @comma{} instead. -% -% \anythingelse will almost certainly be an error of some kind. +\def\macrolineargctxt{% used for whole-line arguments without braces + \scanctxt + \catcode`\{=\other + \catcode`\}=\other +} % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N @@ -7391,7 +8272,7 @@ % Remove the macro name from \macrolist: \begingroup \expandafter\let\csname#1\endcsname \relax - \let\definedummyword\unmacrodo + \let\commondummyword\unmacrodo \xdef\macrolist{\macrolist}% \endgroup \else @@ -7406,61 +8287,40 @@ \ifx #1\relax % remove this \else - \noexpand\definedummyword \noexpand#1% + \noexpand\commondummyword \noexpand#1% \fi } -% This makes use of the obscure feature that if the last token of a -% is #, then the preceding argument is delimited by -% an opening brace, and that opening brace is not consumed. +% \getargs -- Parse the arguments to a @macro line. Set \macname to +% the name of the macro, and \argl to the braced argument list. \def\getargs#1{\getargsxxx#1{}} \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} \def\getmacname#1 #2\relax{\macname={#1}} \def\getmacargs#1{\def\argl{#1}} +% This made use of the feature that if the last token of a +% is #, then the preceding argument is delimited by +% an opening brace, and that opening brace is not consumed. -% For macro processing make @ a letter so that we can make Texinfo private macro names. -\edef\texiatcatcode{\the\catcode`\@} -\catcode `@=11\relax - -% Parse the optional {params} list. Set up \paramno and \paramlist -% so \defmacro knows what to do. Define \macarg.BLAH for each BLAH -% in the params list to some hook where the argument si to be expanded. If -% there are less than 10 arguments that hook is to be replaced by ##N where N +% Parse the optional {params} list to @macro or @rmacro. +% Set \paramno to the number of arguments, +% and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a +% three-param macro.) Define \macarg.BLAH for each BLAH in the params +% list to some hook where the argument is to be expanded. If there are +% less than 10 arguments that hook is to be replaced by ##N where N % is the position in that list, that is to say the macro arguments are to be % defined `a la TeX in the macro body. % % That gets used by \mbodybackslash (above). % -% We need to get `macro parameter char #' into several definitions. -% The technique used is stolen from LaTeX: let \hash be something -% unexpandable, insert that wherever you need a #, and then redefine -% it to # just before using the token list produced. -% -% The same technique is used to protect \eatspaces till just before -% the macro is used. -% -% If there are 10 or more arguments, a different technique is used, where the -% hook remains in the body, and when macro is to be expanded the body is -% processed again to replace the arguments. -% -% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the -% argument N value and then \edef the body (nothing else will expand because of -% the catcode regime underwhich the body was input). +% If there are 10 or more arguments, a different technique is used: see +% \parsemmanyargdef. % -% If you compile with TeX (not eTeX), and you have macros with 10 or more -% arguments, you need that no macro has more than 256 arguments, otherwise an -% error is produced. \def\parsemargdef#1;{% \paramno=0\def\paramlist{}% \let\hash\relax + % \hash is redefined to `#' later to get it into definitions \let\xeatspaces\relax \parsemargdefxxx#1,;,% - % In case that there are 10 or more arguments we parse again the arguments - % list to set new definitions for the \macarg.BLAH macros corresponding to - % each BLAH argument. It was anyhow needed to parse already once this list - % in order to count the arguments, and as macros with at most 9 arguments - % are by far more frequent than macro with 10 or more arguments, defining - % twice the \macarg.BLAH macros does not cost too much processing power. \ifnum\paramno<10\relax\else \paramno0\relax \parsemmanyargdef@@#1,;,% 10 or more arguments @@ -7475,6 +8335,43 @@ \edef\paramlist{\paramlist\hash\the\paramno,}% \fi\next} +% \parsemacbody, \parsermacbody +% +% Read recursive and nonrecursive macro bodies. (They're different since +% rec and nonrec macros end differently.) +% +% We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro +% body to be transformed. +% Set \macrobody to the body of the macro, and call \defmacro. +% +{\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{% +\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}% +{\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{% +\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}% + +% Make @ a letter, so that we can make private-to-Texinfo macro names. +\edef\texiatcatcode{\the\catcode`\@} +\catcode `@=11\relax + +%%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%% + +% If there are 10 or more arguments, a different technique is used, where the +% hook remains in the body, and when macro is to be expanded the body is +% processed again to replace the arguments. +% +% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the +% argument N value and then \edef the body (nothing else will expand because of +% the catcode regime under which the body was input). +% +% If you compile with TeX (not eTeX), and you have macros with 10 or more +% arguments, no macro can have more than 256 arguments (else error). +% +% In case that there are 10 or more arguments we parse again the arguments +% list to set new definitions for the \macarg.BLAH macros corresponding to +% each BLAH argument. It was anyhow needed to parse already once this list +% in order to count the arguments, and as macros with at most 9 arguments +% are by far more frequent than macro with 10 or more arguments, defining +% twice the \macarg.BLAH macros does not cost too much processing power. \def\parsemmanyargdef@@#1,{% \if#1;\let\next=\relax \else @@ -7490,16 +8387,6 @@ \advance\paramno by 1\relax \fi\next} -% These two commands read recursive and nonrecursive macro bodies. -% (They're different since rec and nonrec macros end differently.) -% - -\catcode `\@\texiatcatcode -\long\def\parsemacbody#1@end macro% -{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% -\long\def\parsermacbody#1@end rmacro% -{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% -\catcode `\@=11\relax \let\endargs@\relax \let\nil@\relax @@ -7507,7 +8394,7 @@ \long\def\nillm@{\nil@}% % This macro is expanded during the Texinfo macro expansion, not during its -% definition. It gets all the arguments values and assigns them to macros +% definition. It gets all the arguments' values and assigns them to macros % macarg.ARGNAME % % #1 is the macro name @@ -7528,8 +8415,6 @@ \getargvals@@ \fi } - -% \def\getargvals@@{% \ifx\paramlist\nilm@ % Some sanity check needed here that \argvaluelist is also empty. @@ -7573,7 +8458,8 @@ } % Replace arguments by their values in the macro body, and place the result -% in macro \@tempa +% in macro \@tempa. +% \def\macvalstoargs@{% % To do this we use the property that token registers that are \the'ed % within an \edef expand only once. So we are going to place all argument @@ -7597,8 +8483,9 @@ \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% } +% Define the named-macro outside of this group and then close this group. +% \def\macargexpandinbody@{% - %% Define the named-macro outside of this group and then close this group. \expandafter \endgroup \macargdeflist@ @@ -7635,14 +8522,8 @@ \next } -% Save the token stack pointer into macro #1 -\def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}} -% Restore the token stack pointer from number in macro #1 -\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax} -% newtoks that can be used non \outer . -\def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi} - -% Tailing missing arguments are set to empty +% Trailing missing arguments are set to empty. +% \def\setemptyargvalues@{% \ifx\paramlist\nilm@ \let\next\macargexpandinbody@ @@ -7672,99 +8553,191 @@ \long\def#2{#4}% } -% This defines a Texinfo @macro. There are eight cases: recursive and -% nonrecursive macros of zero, one, up to nine, and many arguments. -% Much magic with \expandafter here. + +%%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%% + + +% This defines a Texinfo @macro or @rmacro, called by \parsemacbody. +% \macrobody has the body of the macro in it, with placeholders for +% its parameters, looking like "\xeatspaces{\hash 1}". +% \paramno is the number of parameters +% \paramlist is a TeX parameter text, e.g. "#1,#2,#3," +% There are four cases: macros of zero, one, up to nine, and many arguments. % \xdef is used so that macro definitions will survive the file -% they're defined in; @include reads the file inside a group. +% they're defined in: @include reads the file inside a group. % \def\defmacro{% \let\hash=##% convert placeholders to macro parameter chars - \ifrecursive - \ifcase\paramno - % 0 - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\scanmacro{\temp}}% - \or % 1 - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\braceorline - \expandafter\noexpand\csname\the\macname xxx\endcsname}% - \expandafter\xdef\csname\the\macname xxx\endcsname##1{% - \egroup\noexpand\scanmacro{\temp}}% - \else - \ifnum\paramno<10\relax % at most 9 - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{\egroup\noexpand\scanmacro{\temp}}% - \else % 10 or more - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\getargvals@{\the\macname}{\argl}% - }% - \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp - \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble - \fi - \fi - \else - \ifcase\paramno - % 0 + \ifnum\paramno=1 + \def\xeatspaces##1{##1}% + % This removes the pair of braces around the argument. We don't + % use \eatspaces, because this can cause ends of lines to be lost + % when the argument to \eatspaces is read, leading to line-based + % commands like "@itemize" not being read correctly. + \else + \let\xeatspaces\relax % suppress expansion + \fi + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup + \noexpand\spaceisspace + \noexpand\endlineisspace + \noexpand\expandafter % skip any whitespace after the macro name. + \expandafter\noexpand\csname\the\macname @@@\endcsname}% + \expandafter\xdef\csname\the\macname @@@\endcsname{% + \egroup + \noexpand\scanmacro{\macrobody}}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname @@@\endcsname}% + \expandafter\xdef\csname\the\macname @@@\endcsname##1{% + \egroup + \noexpand\scanmacro{\macrobody}% + }% + \else % at most 9 + \ifnum\paramno<10\relax + % @MACNAME sets the context for reading the macro argument + % @MACNAME@@ gets the argument, processes backslashes and appends a + % comma. + % @MACNAME@@@ removes braces surrounding the argument list. + % @MACNAME@@@@ scans the macro body with arguments substituted. \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \or % 1 + \bgroup + \noexpand\expandafter % This \expandafter skip any spaces after the + \noexpand\macroargctxt % macro before we change the catcode of space. + \noexpand\expandafter + \expandafter\noexpand\csname\the\macname @@\endcsname}% + \expandafter\xdef\csname\the\macname @@\endcsname##1{% + \noexpand\passargtomacro + \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}% + \expandafter\xdef\csname\the\macname @@@\endcsname##1{% + \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname @@@@\endcsname\paramlist{% + \egroup\noexpand\scanmacro{\macrobody}}% + \else % 10 or more: \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\braceorline - \expandafter\noexpand\csname\the\macname xxx\endcsname}% - \expandafter\xdef\csname\the\macname xxx\endcsname##1{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \else % at most 9 - \ifnum\paramno<10\relax - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \expandafter\noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \else % 10 or more: - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\getargvals@{\the\macname}{\argl}% - }% - \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp - \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse - \fi + \noexpand\getargvals@{\the\macname}{\argl}% + }% + \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody + \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble \fi \fi} -\catcode `\@\texiatcatcode\relax +\catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} -% \braceorline decides whether the next nonwhitespace character is a -% {. If so it reads up to the closing }, if not, it reads the whole -% line. Whatever was read is then fed to the next control sequence -% as an argument (by \parsebrace or \parsearg). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +{\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape +@catcode`@_=11 % private names +@catcode`@!=11 % used as argument separator + +% \passargtomacro#1#2 - +% Call #1 with a list of tokens #2, with any doubled backslashes in #2 +% compressed to one. +% +% This implementation works by expansion, and not execution (so we cannot use +% \def or similar). This reduces the risk of this failing in contexts where +% complete expansion is done with no execution (for example, in writing out to +% an auxiliary file for an index entry). +% +% State is kept in the input stream: the argument passed to +% @look_ahead, @gobble_and_check_finish and @add_segment is +% +% THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input) +% +% where: +% THE_MACRO - name of the macro we want to call +% ARG_RESULT - argument list we build to pass to that macro +% PENDING_BS - either a backslash or nothing +% NEXT_TOKEN - used to look ahead in the input stream to see what's coming next + +@gdef@passargtomacro#1#2{% + @add_segment #1!{}@relax#2\@_finish\% +} +@gdef@_finish{@_finishx} @global@let@_finishx@relax + +% #1 - THE_MACRO ARG_RESULT +% #2 - PENDING_BS +% #3 - NEXT_TOKEN +% #4 used to look ahead +% +% If the next token is not a backslash, process the rest of the argument; +% otherwise, remove the next token. +@gdef@look_ahead#1!#2#3#4{% + @ifx#4\% + @expandafter@gobble_and_check_finish + @else + @expandafter@add_segment + @fi#1!{#2}#4#4% +} + +% #1 - THE_MACRO ARG_RESULT +% #2 - PENDING_BS +% #3 - NEXT_TOKEN +% #4 should be a backslash, which is gobbled. +% #5 looks ahead +% +% Double backslash found. Add a single backslash, and look ahead. +@gdef@gobble_and_check_finish#1!#2#3#4#5{% + @add_segment#1\!{}#5#5% +} + +@gdef@is_fi{@fi} + +% #1 - THE_MACRO ARG_RESULT +% #2 - PENDING_BS +% #3 - NEXT_TOKEN +% #4 is input stream until next backslash +% +% Input stream is either at the start of the argument, or just after a +% backslash sequence, either a lone backslash, or a doubled backslash. +% NEXT_TOKEN contains the first token in the input stream: if it is \finish, +% finish; otherwise, append to ARG_RESULT the segment of the argument up until +% the next backslash. PENDING_BACKSLASH contains a backslash to represent +% a backslash just before the start of the input stream that has not been +% added to ARG_RESULT. +@gdef@add_segment#1!#2#3#4\{% +@ifx#3@_finish + @call_the_macro#1!% +@else + % append the pending backslash to the result, followed by the next segment + @expandafter@is_fi@look_ahead#1#2#4!{\}@fi + % this @fi is discarded by @look_ahead. + % we can't get rid of it with \expandafter because we don't know how + % long #4 is. +} + +% #1 - THE_MACRO +% #2 - ARG_RESULT +% #3 discards the res of the conditional in @add_segment, and @is_fi ends the +% conditional. +@gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}} + +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% \braceorline MAC is used for a one-argument macro MAC. It checks +% whether the next non-whitespace character is a {. It sets the context +% for reading the argument (slightly different in the two cases). Then, +% to read the argument, in the whole-line case, it then calls the regular +% \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC. % \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} \def\braceorlinexxx{% - \ifx\nchar\bgroup\else - \expandafter\parsearg + \ifx\nchar\bgroup + \macroargctxt + \expandafter\passargtomacro + \else + \macrolineargctxt\expandafter\parsearg \fi \macnamexxx} @@ -7846,7 +8819,10 @@ \pdfmkdest{#1}% \iflinks {% + \requireauxfile \atdummies % preserve commands, but don't expand them + % match definition in \xrdef, \refx, \xrefX. + \def\value##1{##1}% \edef\writexrdef##1##2{% \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef ##1}{##2}}% these are parameters of \writexrdef @@ -7885,9 +8861,12 @@ % node name, #4 the name of the Info file, #5 the name of the printed % manual. All but the node name can be omitted. % -\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} -\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} -\def\ref#1{\xrefX[#1,,,,,,,]} +\def\pxref{\putwordsee{} \xrefXX} +\def\xref{\putwordSee{} \xrefXX} +\def\ref{\xrefXX} + +\def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX} +\def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]} % \newbox\toprefbox \newbox\printedrefnamebox @@ -7934,9 +8913,10 @@ % % Make link in pdf output. \ifpdf + % For pdfTeX and LuaTeX {\indexnofonts - \turnoffactive \makevalueexpandable + \turnoffactive % This expands tokens, so do it after making catcode changes, so _ % etc. don't get their TeX definitions. This ignores all spaces in % #4, including (wrongly) those in the middle of the filename. @@ -7944,35 +8924,74 @@ % % This (wrongly) does not take account of leading or trailing % spaces in #1, which should be ignored. - \edef\pdfxrefdest{#1}% - \ifx\pdfxrefdest\empty - \def\pdfxrefdest{Top}% no empty targets - \else - \txiescapepdf\pdfxrefdest % escape PDF special chars + \setpdfdestname{#1}% + % + \ifx\pdfdestname\empty + \def\pdfdestname{Top}% no empty targets \fi % \leavevmode \startlink attr{/Border [0 0 0]}% \ifnum\filenamelength>0 - goto file{\the\filename.pdf} name{\pdfxrefdest}% + goto file{\the\filename.pdf} name{\pdfdestname}% \else - goto name{\pdfmkpgn{\pdfxrefdest}}% + goto name{\pdfmkpgn{\pdfdestname}}% \fi }% \setcolor{\linkcolor}% + \else + \ifx\XeTeXrevision\thisisundefined + \else + % For XeTeX + {\indexnofonts + \makevalueexpandable + \turnoffactive + % This expands tokens, so do it after making catcode changes, so _ + % etc. don't get their TeX definitions. This ignores all spaces in + % #4, including (wrongly) those in the middle of the filename. + \getfilename{#4}% + % + % This (wrongly) does not take account of leading or trailing + % spaces in #1, which should be ignored. + \setpdfdestname{#1}% + % + \ifx\pdfdestname\empty + \def\pdfdestname{Top}% no empty targets + \fi + % + \leavevmode + \ifnum\filenamelength>0 + % With default settings, + % XeTeX (xdvipdfmx) replaces link destination names with integers. + % In this case, the replaced destination names of + % remote PDFs are no longer known. In order to avoid a replacement, + % you can use xdvipdfmx's command line option `-C 0x0010'. + % If you use XeTeX 0.99996+ (TeX Live 2016+), + % this command line option is no longer necessary + % because we can use the `dvipdfmx:config' special. + \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A + << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}% + \else + \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A + << /S /GoTo /D (\pdfdestname) >> >>}% + \fi + }% + \setcolor{\linkcolor}% + \fi \fi - % - % Float references are printed completely differently: "Figure 1.2" - % instead of "[somenode], p.3". We distinguish them by the - % LABEL-title being set to a magic string. {% % Have to otherify everything special to allow the \csname to % include an _ in the xref name, etc. \indexnofonts \turnoffactive + \def\value##1{##1}% \expandafter\global\expandafter\let\expandafter\Xthisreftitle \csname XR#1-title\endcsname }% + % + % Float references are printed completely differently: "Figure 1.2" + % instead of "[somenode], p.3". \iffloat distinguishes them by + % \Xthisreftitle being set to a magic string. \iffloat\Xthisreftitle % If the user specified the print name (third arg) to the ref, % print it instead of our usual "Figure 1.2". @@ -8031,6 +9050,15 @@ % % output the `page 3'. \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + % Add a , if xref followed by a space + \if\space\noexpand\tokenafterxref ,% + \else\ifx\ \tokenafterxref ,% @TAB + \else\ifx\*\tokenafterxref ,% @* + \else\ifx\ \tokenafterxref ,% @SPACE + \else\ifx\ + \tokenafterxref ,% @NL + \else\ifx\tie\tokenafterxref ,% @tie + \fi\fi\fi\fi\fi\fi \fi\fi \fi \endlink @@ -8097,13 +9125,14 @@ \fi\fi\fi } -% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. -% If its value is nonempty, SUFFIX is output afterward. -% +% \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX +% is output afterwards if non-empty. \def\refx#1#2{% + \requireauxfile {% \indexnofonts \otherbackslash + \def\value##1{##1}% \expandafter\global\expandafter\let\expandafter\thisrefX \csname XR#1\endcsname }% @@ -8128,20 +9157,28 @@ #2% Output the suffix in any case. } -% This is the macro invoked by entries in the aux file. Usually it's -% just a \def (we prepend XR to the control sequence name to avoid -% collisions). But if this is a float type, we have more work to do. +% This is the macro invoked by entries in the aux file. Define a control +% sequence for a cross-reference target (we prepend XR to the control sequence +% name to avoid collisions). The value is the page number. If this is a float +% type, we have more work to do. % \def\xrdef#1#2{% - {% The node name might contain 8-bit characters, which in our current - % implementation are changed to commands like @'e. Don't let these - % mess up the control sequence name. + {% Expand the node or anchor name to remove control sequences. + % \turnoffactive stops 8-bit characters being changed to commands + % like @'e. \refx does the same to retrieve the value in the definition. \indexnofonts \turnoffactive + \def\value##1{##1}% \xdef\safexrefname{#1}% }% % - \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref + \bgroup + \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% + \egroup + % We put the \gdef inside a group to avoid the definitions building up on + % TeX's save stack, which can cause it to run out of space for aux files with + % thousands of lines. \gdef doesn't use the save stack, but \csname does + % when it defines an unknown control sequence as \relax. % % Was that xref control sequence that we just defined for a float? \expandafter\iffloat\csname XR\safexrefname\endcsname @@ -8164,6 +9201,23 @@ \fi } +% If working on a large document in chapters, it is convenient to +% be able to disable indexing, cross-referencing, and contents, for test runs. +% This is done with @novalidate at the beginning of the file. +% +\newif\iflinks \linkstrue % by default we want the aux files. +\let\novalidate = \linksfalse + +% Used when writing to the aux file, or when using data from it. +\def\requireauxfile{% + \iflinks + \tryauxfile + % Open the new aux file. TeX will close it automatically at exit. + \immediate\openout\auxfile=\jobname.aux + \fi + \global\let\requireauxfile=\relax % Only do this once. +} + % Read the last existing aux file, if any. No error if none exists. % \def\tryauxfile{% @@ -8242,16 +9296,6 @@ % now. --karl, 15jan04. \catcode`\\=\other % - % Make the characters 128-255 be printing characters. - {% - \count1=128 - \def\loop{% - \catcode\count1=\other - \advance\count1 by 1 - \ifnum \count1<256 \loop \fi - }% - }% - % % @ is our escape character in .aux files, and we need braces. \catcode`\{=1 \catcode`\}=2 @@ -8284,8 +9328,6 @@ % % Auto-number footnotes. Otherwise like plain. \gdef\footnote{% - \let\indent=\ptexindent - \let\noindent=\ptexnoindent \global\advance\footnoteno by \@ne \edef\thisfootno{$^{\the\footnoteno}$}% % @@ -8309,10 +9351,15 @@ % \gdef\dofootnote{% \insert\footins\bgroup + % + % Nested footnotes are not supported in TeX, that would take a lot + % more work. (\startsavinginserts does not suffice.) + \let\footnote=\errfootnotenest + % % We want to typeset this text as a normal paragraph, even if the % footnote reference occurs in (for example) a display environment. % So reset some parameters. - \hsize=\pagewidth + \hsize=\txipagewidth \interlinepenalty\interfootnotelinepenalty \splittopskip\ht\strutbox % top baseline for broken footnotes \splitmaxdepth\dp\strutbox @@ -8346,13 +9393,24 @@ } }%end \catcode `\@=11 +\def\errfootnotenest{% + \errhelp=\EMsimple + \errmessage{Nested footnotes not supported in texinfo.tex, + even though they work in makeinfo; sorry} +} + +\def\errfootnoteheading{% + \errhelp=\EMsimple + \errmessage{Footnotes in chapters, sections, etc., are not supported} +} + % In case a @footnote appears in a vbox, save the footnote text and create % the real \insert just after the vbox finished. Otherwise, the insertion % would be lost. % Similarly, if a @footnote appears inside an alignment, save the footnote % text to a box and make the \insert when a row of the table is finished. % And the same can be done for other insert classes. --kasal, 16nov03. - +% % Replace the \insert primitive by a cheating macro. % Deeper inside, just make sure that the saved insertions are not spilled % out prematurely. @@ -8426,7 +9484,7 @@ \newif\ifwarnednoepsf \newhelp\noepsfhelp{epsf.tex must be installed for images to work. It is also included in the Texinfo distribution, or you can get - it from ftp://tug.org/tex/epsf.tex.} + it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.} % \def\image#1{% \ifx\epsfbox\thisisundefined @@ -8450,6 +9508,7 @@ \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup \catcode`\^^M = 5 % in case we're inside an example \normalturnoffactive % allow _ et al. in names + \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro % If the image is by itself, center it. \ifvmode \imagevmodetrue @@ -8479,12 +9538,21 @@ % % Output the image. \ifpdf + % For pdfTeX and LuaTeX <= 0.80 \dopdfimage{#1}{#2}{#3}% \else - % \epsfbox itself resets \epsf?size at each figure. - \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi - \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi - \epsfbox{#1.eps}% + \ifx\XeTeXrevision\thisisundefined + % For epsf.tex + % \epsfbox itself resets \epsf?size at each figure. + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi + \epsfbox{#1.eps}% + \else + % For XeTeX + \doxeteximage{#1}{#2}{#3}% + \fi \fi % \ifimagevmode @@ -8606,7 +9674,7 @@ % \ifx\thiscaption\empty \else \ifx\floatident\empty \else - \appendtomacro\captionline{: }% had ident, so need a colon between + \appendtomacro\captionline{: }% had ident, so need a colon between \fi % % caption text. @@ -8630,32 +9698,20 @@ % \floatlabel-lof. Besides \floatident, we include the short % caption if specified, else the full caption if specified, else nothing. {% + \requireauxfile \atdummies % - % since we read the caption text in the macro world, where ^^M - % is turned into a normal character, we have to scan it back, so - % we don't write the literal three characters "^^M" into the aux file. - \scanexp{% - \xdef\noexpand\gtemp{% - \ifx\thisshortcaption\empty - \thiscaption - \else - \thisshortcaption - \fi - }% - }% + \ifx\thisshortcaption\empty + \def\gtemp{\thiscaption}% + \else + \def\gtemp{\thisshortcaption}% + \fi \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident - \ifx\gtemp\empty \else : \gtemp \fi}}% + \ifx\gtemp\empty \else : \gtemp \fi}}% }% \fi \egroup % end of \vtop % - % place the captured inserts - % - % BEWARE: when the floats start floating, we have to issue warning - % whenever an insert appears inside a float which could possibly - % float. --kasal, 26may04 - % \checkinserts } @@ -8769,20 +9825,20 @@ { \catcode`\_ = \active \globaldefs=1 -\parseargdef\documentlanguage{\begingroup - \let_=\normalunderscore % normal _ character for filenames +\parseargdef\documentlanguage{% \tex % read txi-??.tex file in plain TeX. % Read the file by the name they passed if it exists. + \let_ = \normalunderscore % normal _ character for filename test \openin 1 txi-#1.tex \ifeof 1 - \documentlanguagetrywithoutunderscore{#1_\finish}% + \documentlanguagetrywithoutunderscore #1_\finish \else \globaldefs = 1 % everything in the txi-LL files needs to persist \input txi-#1.tex \fi \closein 1 \endgroup % end raw TeX -\endgroup} +} % % If they passed de_DE, and txi-de_DE.tex doesn't exist, % try txi-de.tex. @@ -8830,6 +9886,70 @@ \global\righthyphenmin = #3\relax } +% XeTeX and LuaTeX can handle Unicode natively. +% Their default I/O uses UTF-8 sequences instead of a byte-wise operation. +% Other TeX engines' I/O (pdfTeX, etc.) is byte-wise. +% +\newif\iftxinativeunicodecapable +\newif\iftxiusebytewiseio + +\ifx\XeTeXrevision\thisisundefined + \ifx\luatexversion\thisisundefined + \txinativeunicodecapablefalse + \txiusebytewiseiotrue + \else + \txinativeunicodecapabletrue + \txiusebytewiseiofalse + \fi +\else + \txinativeunicodecapabletrue + \txiusebytewiseiofalse +\fi + +% Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex +% for non-UTF-8 (byte-wise) encodings. +% +\def\setbytewiseio{% + \ifx\XeTeXrevision\thisisundefined + \else + \XeTeXdefaultencoding "bytes" % For subsequent files to be read + \XeTeXinputencoding "bytes" % For document root file + % Unfortunately, there seems to be no corresponding XeTeX command for + % output encoding. This is a problem for auxiliary index and TOC files. + % The only solution would be perhaps to write out @U{...} sequences in + % place of non-ASCII characters. + \fi + + \ifx\luatexversion\thisisundefined + \else + \directlua{ + local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub + local function convert_char (char) + return utf8_char(byte(char)) + end + + local function convert_line (line) + return gsub(line, ".", convert_char) + end + + callback.register("process_input_buffer", convert_line) + + local function convert_line_out (line) + local line_out = "" + for c in string.utfvalues(line) do + line_out = line_out .. string.char(c) + end + return line_out + end + + callback.register("process_output_buffer", convert_line_out) + } + \fi + + \txiusebytewiseiotrue +} + + % Helpers for encodings. % Set the catcode of characters 128 through 255 to the specified number. % @@ -8852,7 +9972,9 @@ % @documentencoding sets the definition of non-ASCII characters % according to the specified encoding. % -\parseargdef\documentencoding{% +\def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz} +\def\documentencodingzzz#1{% + % % Encoding being declared for the document. \def\declaredencoding{\csname #1.enc\endcsname}% % @@ -8868,35 +9990,66 @@ \asciichardefs % \else \ifx \declaredencoding \lattwo + \iftxinativeunicodecapable + \setbytewiseio + \fi \setnonasciicharscatcode\active \lattwochardefs % \else \ifx \declaredencoding \latone + \iftxinativeunicodecapable + \setbytewiseio + \fi \setnonasciicharscatcode\active \latonechardefs % \else \ifx \declaredencoding \latnine + \iftxinativeunicodecapable + \setbytewiseio + \fi \setnonasciicharscatcode\active \latninechardefs % \else \ifx \declaredencoding \utfeight - \setnonasciicharscatcode\active - \utfeightchardefs + \iftxinativeunicodecapable + % For native Unicode handling (XeTeX and LuaTeX) + \nativeunicodechardefs + \else + % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX) + \setnonasciicharscatcode\active + % since we already invoked \utfeightchardefs at the top level + % (below), do not re-invoke it, otherwise our check for duplicated + % definitions gets triggered. Making non-ascii chars active is + % sufficient. + \fi % \else - \message{Unknown document encoding #1, ignoring.}% + \message{Ignoring unknown document encoding: #1.}% % \fi % utfeight \fi % latnine \fi % latone \fi % lattwo \fi % ascii + % + \ifx\XeTeXrevision\thisisundefined + \else + \ifx \declaredencoding \utfeight + \else + \ifx \declaredencoding \ascii + \else + \message{Warning: XeTeX with non-UTF-8 encodings cannot handle % + non-ASCII characters in auxiliary files.}% + \fi + \fi + \fi } +% emacs-page % A message to be logged when using a character that isn't available % the default font encoding (OT1). % -\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}} +\def\missingcharmsg#1{\message{Character missing, sorry: #1.}} % Take account of \c (plain) vs. \, (Texinfo) difference. \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} @@ -8906,111 +10059,119 @@ % macros containing the character definitions. \setnonasciicharscatcode\active % + +\def\gdefchar#1#2{% +\gdef#1{% + \ifpassthroughchars + \string#1% + \else + #2% + \fi +}} + % Latin1 (ISO-8859-1) character definitions. \def\latonechardefs{% - \gdef^^a0{\tie} - \gdef^^a1{\exclamdown} - \gdef^^a2{\missingcharmsg{CENT SIGN}} - \gdef^^a3{{\pounds}} - \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} - \gdef^^a5{\missingcharmsg{YEN SIGN}} - \gdef^^a6{\missingcharmsg{BROKEN BAR}} - \gdef^^a7{\S} - \gdef^^a8{\"{}} - \gdef^^a9{\copyright} - \gdef^^aa{\ordf} - \gdef^^ab{\guillemetleft} - \gdef^^ac{$\lnot$} - \gdef^^ad{\-} - \gdef^^ae{\registeredsymbol} - \gdef^^af{\={}} - % - \gdef^^b0{\textdegree} - \gdef^^b1{$\pm$} - \gdef^^b2{$^2$} - \gdef^^b3{$^3$} - \gdef^^b4{\'{}} - \gdef^^b5{$\mu$} - \gdef^^b6{\P} - % - \gdef^^b7{$^.$} - \gdef^^b8{\cedilla\ } - \gdef^^b9{$^1$} - \gdef^^ba{\ordm} - % - \gdef^^bb{\guillemetright} - \gdef^^bc{$1\over4$} - \gdef^^bd{$1\over2$} - \gdef^^be{$3\over4$} - \gdef^^bf{\questiondown} - % - \gdef^^c0{\`A} - \gdef^^c1{\'A} - \gdef^^c2{\^A} - \gdef^^c3{\~A} - \gdef^^c4{\"A} - \gdef^^c5{\ringaccent A} - \gdef^^c6{\AE} - \gdef^^c7{\cedilla C} - \gdef^^c8{\`E} - \gdef^^c9{\'E} - \gdef^^ca{\^E} - \gdef^^cb{\"E} - \gdef^^cc{\`I} - \gdef^^cd{\'I} - \gdef^^ce{\^I} - \gdef^^cf{\"I} - % - \gdef^^d0{\DH} - \gdef^^d1{\~N} - \gdef^^d2{\`O} - \gdef^^d3{\'O} - \gdef^^d4{\^O} - \gdef^^d5{\~O} - \gdef^^d6{\"O} - \gdef^^d7{$\times$} - \gdef^^d8{\O} - \gdef^^d9{\`U} - \gdef^^da{\'U} - \gdef^^db{\^U} - \gdef^^dc{\"U} - \gdef^^dd{\'Y} - \gdef^^de{\TH} - \gdef^^df{\ss} - % - \gdef^^e0{\`a} - \gdef^^e1{\'a} - \gdef^^e2{\^a} - \gdef^^e3{\~a} - \gdef^^e4{\"a} - \gdef^^e5{\ringaccent a} - \gdef^^e6{\ae} - \gdef^^e7{\cedilla c} - \gdef^^e8{\`e} - \gdef^^e9{\'e} - \gdef^^ea{\^e} - \gdef^^eb{\"e} - \gdef^^ec{\`{\dotless i}} - \gdef^^ed{\'{\dotless i}} - \gdef^^ee{\^{\dotless i}} - \gdef^^ef{\"{\dotless i}} - % - \gdef^^f0{\dh} - \gdef^^f1{\~n} - \gdef^^f2{\`o} - \gdef^^f3{\'o} - \gdef^^f4{\^o} - \gdef^^f5{\~o} - \gdef^^f6{\"o} - \gdef^^f7{$\div$} - \gdef^^f8{\o} - \gdef^^f9{\`u} - \gdef^^fa{\'u} - \gdef^^fb{\^u} - \gdef^^fc{\"u} - \gdef^^fd{\'y} - \gdef^^fe{\th} - \gdef^^ff{\"y} + \gdefchar^^a0{\tie} + \gdefchar^^a1{\exclamdown} + \gdefchar^^a2{{\tcfont \char162}} % cent + \gdefchar^^a3{\pounds{}} + \gdefchar^^a4{{\tcfont \char164}} % currency + \gdefchar^^a5{{\tcfont \char165}} % yen + \gdefchar^^a6{{\tcfont \char166}} % broken bar + \gdefchar^^a7{\S} + \gdefchar^^a8{\"{}} + \gdefchar^^a9{\copyright{}} + \gdefchar^^aa{\ordf} + \gdefchar^^ab{\guillemetleft{}} + \gdefchar^^ac{\ensuremath\lnot} + \gdefchar^^ad{\-} + \gdefchar^^ae{\registeredsymbol{}} + \gdefchar^^af{\={}} + % + \gdefchar^^b0{\textdegree} + \gdefchar^^b1{$\pm$} + \gdefchar^^b2{$^2$} + \gdefchar^^b3{$^3$} + \gdefchar^^b4{\'{}} + \gdefchar^^b5{$\mu$} + \gdefchar^^b6{\P} + \gdefchar^^b7{\ensuremath\cdot} + \gdefchar^^b8{\cedilla\ } + \gdefchar^^b9{$^1$} + \gdefchar^^ba{\ordm} + \gdefchar^^bb{\guillemetright{}} + \gdefchar^^bc{$1\over4$} + \gdefchar^^bd{$1\over2$} + \gdefchar^^be{$3\over4$} + \gdefchar^^bf{\questiondown} + % + \gdefchar^^c0{\`A} + \gdefchar^^c1{\'A} + \gdefchar^^c2{\^A} + \gdefchar^^c3{\~A} + \gdefchar^^c4{\"A} + \gdefchar^^c5{\ringaccent A} + \gdefchar^^c6{\AE} + \gdefchar^^c7{\cedilla C} + \gdefchar^^c8{\`E} + \gdefchar^^c9{\'E} + \gdefchar^^ca{\^E} + \gdefchar^^cb{\"E} + \gdefchar^^cc{\`I} + \gdefchar^^cd{\'I} + \gdefchar^^ce{\^I} + \gdefchar^^cf{\"I} + % + \gdefchar^^d0{\DH} + \gdefchar^^d1{\~N} + \gdefchar^^d2{\`O} + \gdefchar^^d3{\'O} + \gdefchar^^d4{\^O} + \gdefchar^^d5{\~O} + \gdefchar^^d6{\"O} + \gdefchar^^d7{$\times$} + \gdefchar^^d8{\O} + \gdefchar^^d9{\`U} + \gdefchar^^da{\'U} + \gdefchar^^db{\^U} + \gdefchar^^dc{\"U} + \gdefchar^^dd{\'Y} + \gdefchar^^de{\TH} + \gdefchar^^df{\ss} + % + \gdefchar^^e0{\`a} + \gdefchar^^e1{\'a} + \gdefchar^^e2{\^a} + \gdefchar^^e3{\~a} + \gdefchar^^e4{\"a} + \gdefchar^^e5{\ringaccent a} + \gdefchar^^e6{\ae} + \gdefchar^^e7{\cedilla c} + \gdefchar^^e8{\`e} + \gdefchar^^e9{\'e} + \gdefchar^^ea{\^e} + \gdefchar^^eb{\"e} + \gdefchar^^ec{\`{\dotless i}} + \gdefchar^^ed{\'{\dotless i}} + \gdefchar^^ee{\^{\dotless i}} + \gdefchar^^ef{\"{\dotless i}} + % + \gdefchar^^f0{\dh} + \gdefchar^^f1{\~n} + \gdefchar^^f2{\`o} + \gdefchar^^f3{\'o} + \gdefchar^^f4{\^o} + \gdefchar^^f5{\~o} + \gdefchar^^f6{\"o} + \gdefchar^^f7{$\div$} + \gdefchar^^f8{\o} + \gdefchar^^f9{\`u} + \gdefchar^^fa{\'u} + \gdefchar^^fb{\^u} + \gdefchar^^fc{\"u} + \gdefchar^^fd{\'y} + \gdefchar^^fe{\th} + \gdefchar^^ff{\"y} } % Latin9 (ISO-8859-15) encoding character definitions. @@ -9018,119 +10179,119 @@ % Encoding is almost identical to Latin1. \latonechardefs % - \gdef^^a4{\euro} - \gdef^^a6{\v S} - \gdef^^a8{\v s} - \gdef^^b4{\v Z} - \gdef^^b8{\v z} - \gdef^^bc{\OE} - \gdef^^bd{\oe} - \gdef^^be{\"Y} + \gdefchar^^a4{\euro{}} + \gdefchar^^a6{\v S} + \gdefchar^^a8{\v s} + \gdefchar^^b4{\v Z} + \gdefchar^^b8{\v z} + \gdefchar^^bc{\OE} + \gdefchar^^bd{\oe} + \gdefchar^^be{\"Y} } % Latin2 (ISO-8859-2) character definitions. \def\lattwochardefs{% - \gdef^^a0{\tie} - \gdef^^a1{\ogonek{A}} - \gdef^^a2{\u{}} - \gdef^^a3{\L} - \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} - \gdef^^a5{\v L} - \gdef^^a6{\'S} - \gdef^^a7{\S} - \gdef^^a8{\"{}} - \gdef^^a9{\v S} - \gdef^^aa{\cedilla S} - \gdef^^ab{\v T} - \gdef^^ac{\'Z} - \gdef^^ad{\-} - \gdef^^ae{\v Z} - \gdef^^af{\dotaccent Z} - % - \gdef^^b0{\textdegree} - \gdef^^b1{\ogonek{a}} - \gdef^^b2{\ogonek{ }} - \gdef^^b3{\l} - \gdef^^b4{\'{}} - \gdef^^b5{\v l} - \gdef^^b6{\'s} - \gdef^^b7{\v{}} - \gdef^^b8{\cedilla\ } - \gdef^^b9{\v s} - \gdef^^ba{\cedilla s} - \gdef^^bb{\v t} - \gdef^^bc{\'z} - \gdef^^bd{\H{}} - \gdef^^be{\v z} - \gdef^^bf{\dotaccent z} - % - \gdef^^c0{\'R} - \gdef^^c1{\'A} - \gdef^^c2{\^A} - \gdef^^c3{\u A} - \gdef^^c4{\"A} - \gdef^^c5{\'L} - \gdef^^c6{\'C} - \gdef^^c7{\cedilla C} - \gdef^^c8{\v C} - \gdef^^c9{\'E} - \gdef^^ca{\ogonek{E}} - \gdef^^cb{\"E} - \gdef^^cc{\v E} - \gdef^^cd{\'I} - \gdef^^ce{\^I} - \gdef^^cf{\v D} - % - \gdef^^d0{\DH} - \gdef^^d1{\'N} - \gdef^^d2{\v N} - \gdef^^d3{\'O} - \gdef^^d4{\^O} - \gdef^^d5{\H O} - \gdef^^d6{\"O} - \gdef^^d7{$\times$} - \gdef^^d8{\v R} - \gdef^^d9{\ringaccent U} - \gdef^^da{\'U} - \gdef^^db{\H U} - \gdef^^dc{\"U} - \gdef^^dd{\'Y} - \gdef^^de{\cedilla T} - \gdef^^df{\ss} - % - \gdef^^e0{\'r} - \gdef^^e1{\'a} - \gdef^^e2{\^a} - \gdef^^e3{\u a} - \gdef^^e4{\"a} - \gdef^^e5{\'l} - \gdef^^e6{\'c} - \gdef^^e7{\cedilla c} - \gdef^^e8{\v c} - \gdef^^e9{\'e} - \gdef^^ea{\ogonek{e}} - \gdef^^eb{\"e} - \gdef^^ec{\v e} - \gdef^^ed{\'{\dotless{i}}} - \gdef^^ee{\^{\dotless{i}}} - \gdef^^ef{\v d} - % - \gdef^^f0{\dh} - \gdef^^f1{\'n} - \gdef^^f2{\v n} - \gdef^^f3{\'o} - \gdef^^f4{\^o} - \gdef^^f5{\H o} - \gdef^^f6{\"o} - \gdef^^f7{$\div$} - \gdef^^f8{\v r} - \gdef^^f9{\ringaccent u} - \gdef^^fa{\'u} - \gdef^^fb{\H u} - \gdef^^fc{\"u} - \gdef^^fd{\'y} - \gdef^^fe{\cedilla t} - \gdef^^ff{\dotaccent{}} + \gdefchar^^a0{\tie} + \gdefchar^^a1{\ogonek{A}} + \gdefchar^^a2{\u{}} + \gdefchar^^a3{\L} + \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdefchar^^a5{\v L} + \gdefchar^^a6{\'S} + \gdefchar^^a7{\S} + \gdefchar^^a8{\"{}} + \gdefchar^^a9{\v S} + \gdefchar^^aa{\cedilla S} + \gdefchar^^ab{\v T} + \gdefchar^^ac{\'Z} + \gdefchar^^ad{\-} + \gdefchar^^ae{\v Z} + \gdefchar^^af{\dotaccent Z} + % + \gdefchar^^b0{\textdegree{}} + \gdefchar^^b1{\ogonek{a}} + \gdefchar^^b2{\ogonek{ }} + \gdefchar^^b3{\l} + \gdefchar^^b4{\'{}} + \gdefchar^^b5{\v l} + \gdefchar^^b6{\'s} + \gdefchar^^b7{\v{}} + \gdefchar^^b8{\cedilla\ } + \gdefchar^^b9{\v s} + \gdefchar^^ba{\cedilla s} + \gdefchar^^bb{\v t} + \gdefchar^^bc{\'z} + \gdefchar^^bd{\H{}} + \gdefchar^^be{\v z} + \gdefchar^^bf{\dotaccent z} + % + \gdefchar^^c0{\'R} + \gdefchar^^c1{\'A} + \gdefchar^^c2{\^A} + \gdefchar^^c3{\u A} + \gdefchar^^c4{\"A} + \gdefchar^^c5{\'L} + \gdefchar^^c6{\'C} + \gdefchar^^c7{\cedilla C} + \gdefchar^^c8{\v C} + \gdefchar^^c9{\'E} + \gdefchar^^ca{\ogonek{E}} + \gdefchar^^cb{\"E} + \gdefchar^^cc{\v E} + \gdefchar^^cd{\'I} + \gdefchar^^ce{\^I} + \gdefchar^^cf{\v D} + % + \gdefchar^^d0{\DH} + \gdefchar^^d1{\'N} + \gdefchar^^d2{\v N} + \gdefchar^^d3{\'O} + \gdefchar^^d4{\^O} + \gdefchar^^d5{\H O} + \gdefchar^^d6{\"O} + \gdefchar^^d7{$\times$} + \gdefchar^^d8{\v R} + \gdefchar^^d9{\ringaccent U} + \gdefchar^^da{\'U} + \gdefchar^^db{\H U} + \gdefchar^^dc{\"U} + \gdefchar^^dd{\'Y} + \gdefchar^^de{\cedilla T} + \gdefchar^^df{\ss} + % + \gdefchar^^e0{\'r} + \gdefchar^^e1{\'a} + \gdefchar^^e2{\^a} + \gdefchar^^e3{\u a} + \gdefchar^^e4{\"a} + \gdefchar^^e5{\'l} + \gdefchar^^e6{\'c} + \gdefchar^^e7{\cedilla c} + \gdefchar^^e8{\v c} + \gdefchar^^e9{\'e} + \gdefchar^^ea{\ogonek{e}} + \gdefchar^^eb{\"e} + \gdefchar^^ec{\v e} + \gdefchar^^ed{\'{\dotless{i}}} + \gdefchar^^ee{\^{\dotless{i}}} + \gdefchar^^ef{\v d} + % + \gdefchar^^f0{\dh} + \gdefchar^^f1{\'n} + \gdefchar^^f2{\v n} + \gdefchar^^f3{\'o} + \gdefchar^^f4{\^o} + \gdefchar^^f5{\H o} + \gdefchar^^f6{\"o} + \gdefchar^^f7{$\div$} + \gdefchar^^f8{\v r} + \gdefchar^^f9{\ringaccent u} + \gdefchar^^fa{\'u} + \gdefchar^^fb{\H u} + \gdefchar^^fc{\"u} + \gdefchar^^fd{\'y} + \gdefchar^^fe{\cedilla t} + \gdefchar^^ff{\dotaccent{}} } % UTF-8 character definitions. @@ -9160,38 +10321,94 @@ \fi } +% Give non-ASCII bytes the active definitions for processing UTF-8 sequences \begingroup \catcode`\~13 + \catcode`\$12 \catcode`\"12 + % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp + % substituting ~ and $ with a character token of that value. \def\UTFviiiLoop{% \global\catcode\countUTFx\active \uccode`\~\countUTFx + \uccode`\$\countUTFx \uppercase\expandafter{\UTFviiiTmp}% \advance\countUTFx by 1 \ifnum\countUTFx < \countUTFy \expandafter\UTFviiiLoop \fi} + % For bytes other than the first in a UTF-8 sequence. Not expected to + % be expanded except when writing to auxiliary files. + \countUTFx = "80 + \countUTFy = "C2 + \def\UTFviiiTmp{% + \gdef~{% + \ifpassthroughchars $\fi}}% + \UTFviiiLoop + \countUTFx = "C2 \countUTFy = "E0 \def\UTFviiiTmp{% - \xdef~{\noexpand\UTFviiiTwoOctets\string~}} + \gdef~{% + \ifpassthroughchars $% + \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}% \UTFviiiLoop \countUTFx = "E0 \countUTFy = "F0 \def\UTFviiiTmp{% - \xdef~{\noexpand\UTFviiiThreeOctets\string~}} + \gdef~{% + \ifpassthroughchars $% + \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}% \UTFviiiLoop \countUTFx = "F0 \countUTFy = "F4 \def\UTFviiiTmp{% - \xdef~{\noexpand\UTFviiiFourOctets\string~}} + \gdef~{% + \ifpassthroughchars $% + \else\expandafter\UTFviiiFourOctets\expandafter$\fi + }}% \UTFviiiLoop \endgroup +\def\globallet{\global\let} % save some \expandafter's below + +% @U{xxxx} to produce U+xxxx, if we support it. +\def\U#1{% + \expandafter\ifx\csname uni:#1\endcsname \relax + \iftxinativeunicodecapable + % All Unicode characters can be used if native Unicode handling is + % active. However, if the font does not have the glyph, + % letters are missing. + \begingroup + \uccode`\.="#1\relax + \uppercase{.} + \endgroup + \else + \errhelp = \EMsimple + \errmessage{Unicode character U+#1 not supported, sorry}% + \fi + \else + \csname uni:#1\endcsname + \fi +} + +% These macros are used here to construct the name of a control +% sequence to be defined. +\def\UTFviiiTwoOctetsName#1#2{% + \csname u8:#1\string #2\endcsname}% +\def\UTFviiiThreeOctetsName#1#2#3{% + \csname u8:#1\string #2\string #3\endcsname}% +\def\UTFviiiFourOctetsName#1#2#3#4{% + \csname u8:#1\string #2\string #3\string #4\endcsname}% + +% For UTF-8 byte sequences (TeX, e-TeX and pdfTeX), +% provide a definition macro to replace a Unicode character; +% this gets used by the @U command +% \begingroup \catcode`\"=12 \catcode`\<=12 @@ -9200,459 +10417,839 @@ \catcode`\;=12 \catcode`\!=12 \catcode`\~=13 - - \gdef\DeclareUnicodeCharacter#1#2{% + \gdef\DeclareUnicodeCharacterUTFviii#1#2{% \countUTFz = "#1\relax - %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% \begingroup \parseXMLCharref - \def\UTFviiiTwoOctets##1##2{% - \csname u8:##1\string ##2\endcsname}% - \def\UTFviiiThreeOctets##1##2##3{% - \csname u8:##1\string ##2\string ##3\endcsname}% - \def\UTFviiiFourOctets##1##2##3##4{% - \csname u8:##1\string ##2\string ##3\string ##4\endcsname}% - \expandafter\expandafter\expandafter\expandafter - \expandafter\expandafter\expandafter - \gdef\UTFviiiTmp{#2}% + + % Give \u8:... its definition. The sequence of seven \expandafter's + % expands after the \gdef three times, e.g. + % + % 1. \UTFviiTwoOctetsName B1 B2 + % 2. \csname u8:B1 \string B2 \endcsname + % 3. \u8: B1 B2 (a single control sequence token) + % + \expandafter\expandafter + \expandafter\expandafter + \expandafter\expandafter + \expandafter\gdef \UTFviiiTmp{#2}% + % + \expandafter\ifx\csname uni:#1\endcsname \relax \else + \message{Internal error, already defined: #1}% + \fi + % + % define an additional control sequence for this code point. + \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp \endgroup} - + % + % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp + % to the corresponding UTF-8 sequence. \gdef\parseXMLCharref{% \ifnum\countUTFz < "A0\relax \errhelp = \EMsimple \errmessage{Cannot define Unicode char value < 00A0}% \else\ifnum\countUTFz < "800\relax \parseUTFviiiA,% - \parseUTFviiiB C\UTFviiiTwoOctets.,% + \parseUTFviiiB C\UTFviiiTwoOctetsName.,% \else\ifnum\countUTFz < "10000\relax \parseUTFviiiA;% \parseUTFviiiA,% - \parseUTFviiiB E\UTFviiiThreeOctets.{,;}% + \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}% \else \parseUTFviiiA;% \parseUTFviiiA,% \parseUTFviiiA!% - \parseUTFviiiB F\UTFviiiFourOctets.{!,;}% + \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}% \fi\fi\fi } + % Extract a byte from the end of the UTF-8 representation of \countUTFx. + % It must be a non-initial byte in the sequence. + % Change \uccode of #1 for it to be used in \parseUTFviiiB as one + % of the bytes. \gdef\parseUTFviiiA#1{% \countUTFx = \countUTFz \divide\countUTFz by 64 - \countUTFy = \countUTFz + \countUTFy = \countUTFz % Save to be the future value of \countUTFz. \multiply\countUTFz by 64 + + % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract + % in order to get the last five bits. \advance\countUTFx by -\countUTFz + + % Convert this to the byte in the UTF-8 sequence. \advance\countUTFx by 128 \uccode `#1\countUTFx \countUTFz = \countUTFy} + % Used to put a UTF-8 byte sequence into \UTFviiiTmp + % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8 + % sequence. + % #2 is one of the \UTFviii*OctetsName macros. + % #3 is always a full stop (.) + % #4 is a template for the other bytes in the sequence. The values for these + % bytes is substituted in here with \uppercase using the \uccode's. \gdef\parseUTFviiiB#1#2#3#4{% \advance\countUTFz by "#10\relax \uccode `#3\countUTFz \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} \endgroup +% For native Unicode handling (XeTeX and LuaTeX), +% provide a definition macro that sets a catcode to `other' non-globally +% +\def\DeclareUnicodeCharacterNativeOther#1#2{% + \catcode"#1=\other +} + +% https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M +% U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block) +% U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block) +% U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A +% U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B +% +% Many of our renditions are less than wonderful, and all the missing +% characters are available somewhere. Loading the necessary fonts +% awaits user request. We can't truly support Unicode without +% reimplementing everything that's been done in LaTeX for many years, +% plus probably using luatex or xetex, and who knows what else. +% We won't be doing that here in this simple file. But we can try to at +% least make most of the characters not bomb out. +% +\def\unicodechardefs{% + \DeclareUnicodeCharacter{00A0}{\tie}% + \DeclareUnicodeCharacter{00A1}{\exclamdown}% + \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent + \DeclareUnicodeCharacter{00A3}{\pounds{}}% + \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency + \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen + \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar + \DeclareUnicodeCharacter{00A7}{\S}% + \DeclareUnicodeCharacter{00A8}{\"{ }}% + \DeclareUnicodeCharacter{00A9}{\copyright{}}% + \DeclareUnicodeCharacter{00AA}{\ordf}% + \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}% + \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}% + \DeclareUnicodeCharacter{00AD}{\-}% + \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}% + \DeclareUnicodeCharacter{00AF}{\={ }}% + % + \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}% + \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}% + \DeclareUnicodeCharacter{00B2}{$^2$}% + \DeclareUnicodeCharacter{00B3}{$^3$}% + \DeclareUnicodeCharacter{00B4}{\'{ }}% + \DeclareUnicodeCharacter{00B5}{$\mu$}% + \DeclareUnicodeCharacter{00B6}{\P}% + \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}% + \DeclareUnicodeCharacter{00B8}{\cedilla{ }}% + \DeclareUnicodeCharacter{00B9}{$^1$}% + \DeclareUnicodeCharacter{00BA}{\ordm}% + \DeclareUnicodeCharacter{00BB}{\guillemetright{}}% + \DeclareUnicodeCharacter{00BC}{$1\over4$}% + \DeclareUnicodeCharacter{00BD}{$1\over2$}% + \DeclareUnicodeCharacter{00BE}{$3\over4$}% + \DeclareUnicodeCharacter{00BF}{\questiondown}% + % + \DeclareUnicodeCharacter{00C0}{\`A}% + \DeclareUnicodeCharacter{00C1}{\'A}% + \DeclareUnicodeCharacter{00C2}{\^A}% + \DeclareUnicodeCharacter{00C3}{\~A}% + \DeclareUnicodeCharacter{00C4}{\"A}% + \DeclareUnicodeCharacter{00C5}{\AA}% + \DeclareUnicodeCharacter{00C6}{\AE}% + \DeclareUnicodeCharacter{00C7}{\cedilla{C}}% + \DeclareUnicodeCharacter{00C8}{\`E}% + \DeclareUnicodeCharacter{00C9}{\'E}% + \DeclareUnicodeCharacter{00CA}{\^E}% + \DeclareUnicodeCharacter{00CB}{\"E}% + \DeclareUnicodeCharacter{00CC}{\`I}% + \DeclareUnicodeCharacter{00CD}{\'I}% + \DeclareUnicodeCharacter{00CE}{\^I}% + \DeclareUnicodeCharacter{00CF}{\"I}% + % + \DeclareUnicodeCharacter{00D0}{\DH}% + \DeclareUnicodeCharacter{00D1}{\~N}% + \DeclareUnicodeCharacter{00D2}{\`O}% + \DeclareUnicodeCharacter{00D3}{\'O}% + \DeclareUnicodeCharacter{00D4}{\^O}% + \DeclareUnicodeCharacter{00D5}{\~O}% + \DeclareUnicodeCharacter{00D6}{\"O}% + \DeclareUnicodeCharacter{00D7}{\ensuremath\times}% + \DeclareUnicodeCharacter{00D8}{\O}% + \DeclareUnicodeCharacter{00D9}{\`U}% + \DeclareUnicodeCharacter{00DA}{\'U}% + \DeclareUnicodeCharacter{00DB}{\^U}% + \DeclareUnicodeCharacter{00DC}{\"U}% + \DeclareUnicodeCharacter{00DD}{\'Y}% + \DeclareUnicodeCharacter{00DE}{\TH}% + \DeclareUnicodeCharacter{00DF}{\ss}% + % + \DeclareUnicodeCharacter{00E0}{\`a}% + \DeclareUnicodeCharacter{00E1}{\'a}% + \DeclareUnicodeCharacter{00E2}{\^a}% + \DeclareUnicodeCharacter{00E3}{\~a}% + \DeclareUnicodeCharacter{00E4}{\"a}% + \DeclareUnicodeCharacter{00E5}{\aa}% + \DeclareUnicodeCharacter{00E6}{\ae}% + \DeclareUnicodeCharacter{00E7}{\cedilla{c}}% + \DeclareUnicodeCharacter{00E8}{\`e}% + \DeclareUnicodeCharacter{00E9}{\'e}% + \DeclareUnicodeCharacter{00EA}{\^e}% + \DeclareUnicodeCharacter{00EB}{\"e}% + \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}% + \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}% + \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}% + \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}% + % + \DeclareUnicodeCharacter{00F0}{\dh}% + \DeclareUnicodeCharacter{00F1}{\~n}% + \DeclareUnicodeCharacter{00F2}{\`o}% + \DeclareUnicodeCharacter{00F3}{\'o}% + \DeclareUnicodeCharacter{00F4}{\^o}% + \DeclareUnicodeCharacter{00F5}{\~o}% + \DeclareUnicodeCharacter{00F6}{\"o}% + \DeclareUnicodeCharacter{00F7}{\ensuremath\div}% + \DeclareUnicodeCharacter{00F8}{\o}% + \DeclareUnicodeCharacter{00F9}{\`u}% + \DeclareUnicodeCharacter{00FA}{\'u}% + \DeclareUnicodeCharacter{00FB}{\^u}% + \DeclareUnicodeCharacter{00FC}{\"u}% + \DeclareUnicodeCharacter{00FD}{\'y}% + \DeclareUnicodeCharacter{00FE}{\th}% + \DeclareUnicodeCharacter{00FF}{\"y}% + % + \DeclareUnicodeCharacter{0100}{\=A}% + \DeclareUnicodeCharacter{0101}{\=a}% + \DeclareUnicodeCharacter{0102}{\u{A}}% + \DeclareUnicodeCharacter{0103}{\u{a}}% + \DeclareUnicodeCharacter{0104}{\ogonek{A}}% + \DeclareUnicodeCharacter{0105}{\ogonek{a}}% + \DeclareUnicodeCharacter{0106}{\'C}% + \DeclareUnicodeCharacter{0107}{\'c}% + \DeclareUnicodeCharacter{0108}{\^C}% + \DeclareUnicodeCharacter{0109}{\^c}% + \DeclareUnicodeCharacter{010A}{\dotaccent{C}}% + \DeclareUnicodeCharacter{010B}{\dotaccent{c}}% + \DeclareUnicodeCharacter{010C}{\v{C}}% + \DeclareUnicodeCharacter{010D}{\v{c}}% + \DeclareUnicodeCharacter{010E}{\v{D}}% + \DeclareUnicodeCharacter{010F}{d'}% + % + \DeclareUnicodeCharacter{0110}{\DH}% + \DeclareUnicodeCharacter{0111}{\dh}% + \DeclareUnicodeCharacter{0112}{\=E}% + \DeclareUnicodeCharacter{0113}{\=e}% + \DeclareUnicodeCharacter{0114}{\u{E}}% + \DeclareUnicodeCharacter{0115}{\u{e}}% + \DeclareUnicodeCharacter{0116}{\dotaccent{E}}% + \DeclareUnicodeCharacter{0117}{\dotaccent{e}}% + \DeclareUnicodeCharacter{0118}{\ogonek{E}}% + \DeclareUnicodeCharacter{0119}{\ogonek{e}}% + \DeclareUnicodeCharacter{011A}{\v{E}}% + \DeclareUnicodeCharacter{011B}{\v{e}}% + \DeclareUnicodeCharacter{011C}{\^G}% + \DeclareUnicodeCharacter{011D}{\^g}% + \DeclareUnicodeCharacter{011E}{\u{G}}% + \DeclareUnicodeCharacter{011F}{\u{g}}% + % + \DeclareUnicodeCharacter{0120}{\dotaccent{G}}% + \DeclareUnicodeCharacter{0121}{\dotaccent{g}}% + \DeclareUnicodeCharacter{0122}{\cedilla{G}}% + \DeclareUnicodeCharacter{0123}{\cedilla{g}}% + \DeclareUnicodeCharacter{0124}{\^H}% + \DeclareUnicodeCharacter{0125}{\^h}% + \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}% + \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}% + \DeclareUnicodeCharacter{0128}{\~I}% + \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}% + \DeclareUnicodeCharacter{012A}{\=I}% + \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}% + \DeclareUnicodeCharacter{012C}{\u{I}}% + \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}% + \DeclareUnicodeCharacter{012E}{\ogonek{I}}% + \DeclareUnicodeCharacter{012F}{\ogonek{i}}% + % + \DeclareUnicodeCharacter{0130}{\dotaccent{I}}% + \DeclareUnicodeCharacter{0131}{\dotless{i}}% + \DeclareUnicodeCharacter{0132}{IJ}% + \DeclareUnicodeCharacter{0133}{ij}% + \DeclareUnicodeCharacter{0134}{\^J}% + \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}% + \DeclareUnicodeCharacter{0136}{\cedilla{K}}% + \DeclareUnicodeCharacter{0137}{\cedilla{k}}% + \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}% + \DeclareUnicodeCharacter{0139}{\'L}% + \DeclareUnicodeCharacter{013A}{\'l}% + \DeclareUnicodeCharacter{013B}{\cedilla{L}}% + \DeclareUnicodeCharacter{013C}{\cedilla{l}}% + \DeclareUnicodeCharacter{013D}{L'}% should kern + \DeclareUnicodeCharacter{013E}{l'}% should kern + \DeclareUnicodeCharacter{013F}{L\U{00B7}}% + % + \DeclareUnicodeCharacter{0140}{l\U{00B7}}% + \DeclareUnicodeCharacter{0141}{\L}% + \DeclareUnicodeCharacter{0142}{\l}% + \DeclareUnicodeCharacter{0143}{\'N}% + \DeclareUnicodeCharacter{0144}{\'n}% + \DeclareUnicodeCharacter{0145}{\cedilla{N}}% + \DeclareUnicodeCharacter{0146}{\cedilla{n}}% + \DeclareUnicodeCharacter{0147}{\v{N}}% + \DeclareUnicodeCharacter{0148}{\v{n}}% + \DeclareUnicodeCharacter{0149}{'n}% + \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}% + \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}% + \DeclareUnicodeCharacter{014C}{\=O}% + \DeclareUnicodeCharacter{014D}{\=o}% + \DeclareUnicodeCharacter{014E}{\u{O}}% + \DeclareUnicodeCharacter{014F}{\u{o}}% + % + \DeclareUnicodeCharacter{0150}{\H{O}}% + \DeclareUnicodeCharacter{0151}{\H{o}}% + \DeclareUnicodeCharacter{0152}{\OE}% + \DeclareUnicodeCharacter{0153}{\oe}% + \DeclareUnicodeCharacter{0154}{\'R}% + \DeclareUnicodeCharacter{0155}{\'r}% + \DeclareUnicodeCharacter{0156}{\cedilla{R}}% + \DeclareUnicodeCharacter{0157}{\cedilla{r}}% + \DeclareUnicodeCharacter{0158}{\v{R}}% + \DeclareUnicodeCharacter{0159}{\v{r}}% + \DeclareUnicodeCharacter{015A}{\'S}% + \DeclareUnicodeCharacter{015B}{\'s}% + \DeclareUnicodeCharacter{015C}{\^S}% + \DeclareUnicodeCharacter{015D}{\^s}% + \DeclareUnicodeCharacter{015E}{\cedilla{S}}% + \DeclareUnicodeCharacter{015F}{\cedilla{s}}% + % + \DeclareUnicodeCharacter{0160}{\v{S}}% + \DeclareUnicodeCharacter{0161}{\v{s}}% + \DeclareUnicodeCharacter{0162}{\cedilla{T}}% + \DeclareUnicodeCharacter{0163}{\cedilla{t}}% + \DeclareUnicodeCharacter{0164}{\v{T}}% + \DeclareUnicodeCharacter{0165}{\v{t}}% + \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}% + \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}% + \DeclareUnicodeCharacter{0168}{\~U}% + \DeclareUnicodeCharacter{0169}{\~u}% + \DeclareUnicodeCharacter{016A}{\=U}% + \DeclareUnicodeCharacter{016B}{\=u}% + \DeclareUnicodeCharacter{016C}{\u{U}}% + \DeclareUnicodeCharacter{016D}{\u{u}}% + \DeclareUnicodeCharacter{016E}{\ringaccent{U}}% + \DeclareUnicodeCharacter{016F}{\ringaccent{u}}% + % + \DeclareUnicodeCharacter{0170}{\H{U}}% + \DeclareUnicodeCharacter{0171}{\H{u}}% + \DeclareUnicodeCharacter{0172}{\ogonek{U}}% + \DeclareUnicodeCharacter{0173}{\ogonek{u}}% + \DeclareUnicodeCharacter{0174}{\^W}% + \DeclareUnicodeCharacter{0175}{\^w}% + \DeclareUnicodeCharacter{0176}{\^Y}% + \DeclareUnicodeCharacter{0177}{\^y}% + \DeclareUnicodeCharacter{0178}{\"Y}% + \DeclareUnicodeCharacter{0179}{\'Z}% + \DeclareUnicodeCharacter{017A}{\'z}% + \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}% + \DeclareUnicodeCharacter{017C}{\dotaccent{z}}% + \DeclareUnicodeCharacter{017D}{\v{Z}}% + \DeclareUnicodeCharacter{017E}{\v{z}}% + \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}% + % + \DeclareUnicodeCharacter{01C4}{D\v{Z}}% + \DeclareUnicodeCharacter{01C5}{D\v{z}}% + \DeclareUnicodeCharacter{01C6}{d\v{z}}% + \DeclareUnicodeCharacter{01C7}{LJ}% + \DeclareUnicodeCharacter{01C8}{Lj}% + \DeclareUnicodeCharacter{01C9}{lj}% + \DeclareUnicodeCharacter{01CA}{NJ}% + \DeclareUnicodeCharacter{01CB}{Nj}% + \DeclareUnicodeCharacter{01CC}{nj}% + \DeclareUnicodeCharacter{01CD}{\v{A}}% + \DeclareUnicodeCharacter{01CE}{\v{a}}% + \DeclareUnicodeCharacter{01CF}{\v{I}}% + % + \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}% + \DeclareUnicodeCharacter{01D1}{\v{O}}% + \DeclareUnicodeCharacter{01D2}{\v{o}}% + \DeclareUnicodeCharacter{01D3}{\v{U}}% + \DeclareUnicodeCharacter{01D4}{\v{u}}% + % + \DeclareUnicodeCharacter{01E2}{\={\AE}}% + \DeclareUnicodeCharacter{01E3}{\={\ae}}% + \DeclareUnicodeCharacter{01E6}{\v{G}}% + \DeclareUnicodeCharacter{01E7}{\v{g}}% + \DeclareUnicodeCharacter{01E8}{\v{K}}% + \DeclareUnicodeCharacter{01E9}{\v{k}}% + % + \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}% + \DeclareUnicodeCharacter{01F1}{DZ}% + \DeclareUnicodeCharacter{01F2}{Dz}% + \DeclareUnicodeCharacter{01F3}{dz}% + \DeclareUnicodeCharacter{01F4}{\'G}% + \DeclareUnicodeCharacter{01F5}{\'g}% + \DeclareUnicodeCharacter{01F8}{\`N}% + \DeclareUnicodeCharacter{01F9}{\`n}% + \DeclareUnicodeCharacter{01FC}{\'{\AE}}% + \DeclareUnicodeCharacter{01FD}{\'{\ae}}% + \DeclareUnicodeCharacter{01FE}{\'{\O}}% + \DeclareUnicodeCharacter{01FF}{\'{\o}}% + % + \DeclareUnicodeCharacter{021E}{\v{H}}% + \DeclareUnicodeCharacter{021F}{\v{h}}% + % + \DeclareUnicodeCharacter{0226}{\dotaccent{A}}% + \DeclareUnicodeCharacter{0227}{\dotaccent{a}}% + \DeclareUnicodeCharacter{0228}{\cedilla{E}}% + \DeclareUnicodeCharacter{0229}{\cedilla{e}}% + \DeclareUnicodeCharacter{022E}{\dotaccent{O}}% + \DeclareUnicodeCharacter{022F}{\dotaccent{o}}% + % + \DeclareUnicodeCharacter{0232}{\=Y}% + \DeclareUnicodeCharacter{0233}{\=y}% + \DeclareUnicodeCharacter{0237}{\dotless{j}}% + % + \DeclareUnicodeCharacter{02DB}{\ogonek{ }}% + % + % Greek letters upper case + \DeclareUnicodeCharacter{0391}{{\it A}}% + \DeclareUnicodeCharacter{0392}{{\it B}}% + \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}% + \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}% + \DeclareUnicodeCharacter{0395}{{\it E}}% + \DeclareUnicodeCharacter{0396}{{\it Z}}% + \DeclareUnicodeCharacter{0397}{{\it H}}% + \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}% + \DeclareUnicodeCharacter{0399}{{\it I}}% + \DeclareUnicodeCharacter{039A}{{\it K}}% + \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}% + \DeclareUnicodeCharacter{039C}{{\it M}}% + \DeclareUnicodeCharacter{039D}{{\it N}}% + \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}% + \DeclareUnicodeCharacter{039F}{{\it O}}% + \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}% + \DeclareUnicodeCharacter{03A1}{{\it P}}% + %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma + \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}% + \DeclareUnicodeCharacter{03A4}{{\it T}}% + \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}% + \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}% + \DeclareUnicodeCharacter{03A7}{{\it X}}% + \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}% + \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}% + % + % Vowels with accents + \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}% + \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}% + \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}% + \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}% + \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}% + \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}% + % + % Standalone accent + \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}% + % + % Greek letters lower case + \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}% + \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}% + \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}% + \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}% + \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}% + \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}% + \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}% + \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}% + \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}% + \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}% + \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}% + \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}% + \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}% + \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}% + \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron + \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}% + \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}% + \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}% + \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}% + \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}% + \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}% + \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}% + \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}% + \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}% + \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}% + % + % More Greek vowels with accents + \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}% + \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}% + \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}% + \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}% + \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}% + % + % Variant Greek letters + \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}% + \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}% + \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}% + % + \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}% + \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}% + \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}% + \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}% + \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}% + \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}% + \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}% + \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}% + \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}% + \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}% + \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}% + \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}% + % + \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}% + \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}% + % + \DeclareUnicodeCharacter{1E20}{\=G}% + \DeclareUnicodeCharacter{1E21}{\=g}% + \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}% + \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}% + \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}% + \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}% + \DeclareUnicodeCharacter{1E26}{\"H}% + \DeclareUnicodeCharacter{1E27}{\"h}% + % + \DeclareUnicodeCharacter{1E30}{\'K}% + \DeclareUnicodeCharacter{1E31}{\'k}% + \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}% + \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}% + \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}% + \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}% + \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}% + \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}% + \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}% + \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}% + \DeclareUnicodeCharacter{1E3E}{\'M}% + \DeclareUnicodeCharacter{1E3F}{\'m}% + % + \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}% + \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}% + \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}% + \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}% + \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}% + \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}% + \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}% + \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}% + \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}% + \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}% + % + \DeclareUnicodeCharacter{1E54}{\'P}% + \DeclareUnicodeCharacter{1E55}{\'p}% + \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}% + \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}% + \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}% + \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}% + \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}% + \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}% + \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}% + \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}% + % + \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}% + \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}% + \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}% + \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}% + \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}% + \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}% + \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}% + \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}% + \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}% + \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}% + % + \DeclareUnicodeCharacter{1E7C}{\~V}% + \DeclareUnicodeCharacter{1E7D}{\~v}% + \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}% + \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}% + % + \DeclareUnicodeCharacter{1E80}{\`W}% + \DeclareUnicodeCharacter{1E81}{\`w}% + \DeclareUnicodeCharacter{1E82}{\'W}% + \DeclareUnicodeCharacter{1E83}{\'w}% + \DeclareUnicodeCharacter{1E84}{\"W}% + \DeclareUnicodeCharacter{1E85}{\"w}% + \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}% + \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}% + \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}% + \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}% + \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}% + \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}% + \DeclareUnicodeCharacter{1E8C}{\"X}% + \DeclareUnicodeCharacter{1E8D}{\"x}% + \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}% + \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}% + % + \DeclareUnicodeCharacter{1E90}{\^Z}% + \DeclareUnicodeCharacter{1E91}{\^z}% + \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}% + \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}% + \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}% + \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}% + \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}% + \DeclareUnicodeCharacter{1E97}{\"t}% + \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}% + \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}% + % + \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}% + \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}% + % + \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}% + \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}% + \DeclareUnicodeCharacter{1EBC}{\~E}% + \DeclareUnicodeCharacter{1EBD}{\~e}% + % + \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}% + \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}% + \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}% + \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}% + % + \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}% + \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}% + % + \DeclareUnicodeCharacter{1EF2}{\`Y}% + \DeclareUnicodeCharacter{1EF3}{\`y}% + \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}% + % + \DeclareUnicodeCharacter{1EF8}{\~Y}% + \DeclareUnicodeCharacter{1EF9}{\~y}% + % + % Punctuation + \DeclareUnicodeCharacter{2013}{--}% + \DeclareUnicodeCharacter{2014}{---}% + \DeclareUnicodeCharacter{2018}{\quoteleft{}}% + \DeclareUnicodeCharacter{2019}{\quoteright{}}% + \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}% + \DeclareUnicodeCharacter{201C}{\quotedblleft{}}% + \DeclareUnicodeCharacter{201D}{\quotedblright{}}% + \DeclareUnicodeCharacter{201E}{\quotedblbase{}}% + \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}% + \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}% + \DeclareUnicodeCharacter{2022}{\bullet{}}% + \DeclareUnicodeCharacter{202F}{\thinspace}% + \DeclareUnicodeCharacter{2026}{\dots{}}% + \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}% + \DeclareUnicodeCharacter{203A}{\guilsinglright{}}% + % + \DeclareUnicodeCharacter{20AC}{\euro{}}% + % + \DeclareUnicodeCharacter{2192}{\expansion{}}% + \DeclareUnicodeCharacter{21D2}{\result{}}% + % + % Mathematical symbols + \DeclareUnicodeCharacter{2200}{\ensuremath\forall}% + \DeclareUnicodeCharacter{2203}{\ensuremath\exists}% + \DeclareUnicodeCharacter{2208}{\ensuremath\in}% + \DeclareUnicodeCharacter{2212}{\minus{}}% + \DeclareUnicodeCharacter{2217}{\ast}% + \DeclareUnicodeCharacter{221E}{\ensuremath\infty}% + \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}% + \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}% + \DeclareUnicodeCharacter{2229}{\ensuremath\cap}% + \DeclareUnicodeCharacter{2261}{\equiv{}}% + \DeclareUnicodeCharacter{2264}{\ensuremath\leq}% + \DeclareUnicodeCharacter{2265}{\ensuremath\geq}% + \DeclareUnicodeCharacter{2282}{\ensuremath\subset}% + \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}% + % + \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}% + \DeclareUnicodeCharacter{2032}{\ensuremath\prime}% + \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}% + \DeclareUnicodeCharacter{2111}{\ensuremath\Im}% + \DeclareUnicodeCharacter{2113}{\ensuremath\ell}% + \DeclareUnicodeCharacter{2118}{\ensuremath\wp}% + \DeclareUnicodeCharacter{211C}{\ensuremath\Re}% + \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}% + \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}% + \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}% + \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}% + \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}% + \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}% + \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}% + \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}% + \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}% + \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}% + \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}% + \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}% + \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}% + \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}% + \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}% + \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}% + \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}% + \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}% + \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}% + \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}% + \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}% + \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}% + \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}% + \DeclareUnicodeCharacter{2202}{\ensuremath\partial}% + \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}% + \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}% + \DeclareUnicodeCharacter{2209}{\ensuremath\notin}% + \DeclareUnicodeCharacter{220B}{\ensuremath\owns}% + \DeclareUnicodeCharacter{220F}{\ensuremath\prod}% + \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}% + \DeclareUnicodeCharacter{2211}{\ensuremath\sum}% + \DeclareUnicodeCharacter{2213}{\ensuremath\mp}% + \DeclareUnicodeCharacter{2218}{\ensuremath\circ}% + \DeclareUnicodeCharacter{221A}{\ensuremath\surd}% + \DeclareUnicodeCharacter{221D}{\ensuremath\propto}% + \DeclareUnicodeCharacter{2220}{\ensuremath\angle}% + \DeclareUnicodeCharacter{2223}{\ensuremath\mid}% + \DeclareUnicodeCharacter{2228}{\ensuremath\vee}% + \DeclareUnicodeCharacter{222A}{\ensuremath\cup}% + \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}% + \DeclareUnicodeCharacter{222E}{\ensuremath\oint}% + \DeclareUnicodeCharacter{223C}{\ensuremath\sim}% + \DeclareUnicodeCharacter{2240}{\ensuremath\wr}% + \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}% + \DeclareUnicodeCharacter{2245}{\ensuremath\cong}% + \DeclareUnicodeCharacter{2248}{\ensuremath\approx}% + \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}% + \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}% + \DeclareUnicodeCharacter{2260}{\ensuremath\neq}% + \DeclareUnicodeCharacter{226A}{\ensuremath\ll}% + \DeclareUnicodeCharacter{226B}{\ensuremath\gg}% + \DeclareUnicodeCharacter{227A}{\ensuremath\prec}% + \DeclareUnicodeCharacter{227B}{\ensuremath\succ}% + \DeclareUnicodeCharacter{2283}{\ensuremath\supset}% + \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}% + \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}% + \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}% + \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}% + \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}% + \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}% + \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}% + \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}% + \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}% + \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}% + \DeclareUnicodeCharacter{2299}{\ensuremath\odot}% + \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}% + \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}% + \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}% + \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}% + \DeclareUnicodeCharacter{22A8}{\ensuremath\models}% + \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}% + \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}% + \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}% + \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}% + \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}% + \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}% + \DeclareUnicodeCharacter{22C6}{\ensuremath\star}% + \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}% + \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}% + \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}% + \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}% + \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}% + \DeclareUnicodeCharacter{2322}{\ensuremath\frown}% + \DeclareUnicodeCharacter{2323}{\ensuremath\smile}% + % + \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}% + \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}% + \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}% + \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}% + \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}% + \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}% + \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}% + \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}% + \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}% + \DeclareUnicodeCharacter{266D}{\ensuremath\flat}% + \DeclareUnicodeCharacter{266E}{\ensuremath\natural}% + \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}% + \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}% + \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}% + \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}% + \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}% + \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}% + \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}% + \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}% + \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}% + \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}% + \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}% + \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}% + \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}% + \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}% + \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}% + \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}% + \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}% + \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}% + % + \global\mathchardef\checkmark="1370% actually the square root sign + \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}% +}% end of \unicodechardefs + +% UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command) +% It makes the setting that replace UTF-8 byte sequence. \def\utfeightchardefs{% - \DeclareUnicodeCharacter{00A0}{\tie} - \DeclareUnicodeCharacter{00A1}{\exclamdown} - \DeclareUnicodeCharacter{00A3}{\pounds} - \DeclareUnicodeCharacter{00A8}{\"{ }} - \DeclareUnicodeCharacter{00A9}{\copyright} - \DeclareUnicodeCharacter{00AA}{\ordf} - \DeclareUnicodeCharacter{00AB}{\guillemetleft} - \DeclareUnicodeCharacter{00AD}{\-} - \DeclareUnicodeCharacter{00AE}{\registeredsymbol} - \DeclareUnicodeCharacter{00AF}{\={ }} - - \DeclareUnicodeCharacter{00B0}{\ringaccent{ }} - \DeclareUnicodeCharacter{00B4}{\'{ }} - \DeclareUnicodeCharacter{00B8}{\cedilla{ }} - \DeclareUnicodeCharacter{00BA}{\ordm} - \DeclareUnicodeCharacter{00BB}{\guillemetright} - \DeclareUnicodeCharacter{00BF}{\questiondown} - - \DeclareUnicodeCharacter{00C0}{\`A} - \DeclareUnicodeCharacter{00C1}{\'A} - \DeclareUnicodeCharacter{00C2}{\^A} - \DeclareUnicodeCharacter{00C3}{\~A} - \DeclareUnicodeCharacter{00C4}{\"A} - \DeclareUnicodeCharacter{00C5}{\AA} - \DeclareUnicodeCharacter{00C6}{\AE} - \DeclareUnicodeCharacter{00C7}{\cedilla{C}} - \DeclareUnicodeCharacter{00C8}{\`E} - \DeclareUnicodeCharacter{00C9}{\'E} - \DeclareUnicodeCharacter{00CA}{\^E} - \DeclareUnicodeCharacter{00CB}{\"E} - \DeclareUnicodeCharacter{00CC}{\`I} - \DeclareUnicodeCharacter{00CD}{\'I} - \DeclareUnicodeCharacter{00CE}{\^I} - \DeclareUnicodeCharacter{00CF}{\"I} - - \DeclareUnicodeCharacter{00D0}{\DH} - \DeclareUnicodeCharacter{00D1}{\~N} - \DeclareUnicodeCharacter{00D2}{\`O} - \DeclareUnicodeCharacter{00D3}{\'O} - \DeclareUnicodeCharacter{00D4}{\^O} - \DeclareUnicodeCharacter{00D5}{\~O} - \DeclareUnicodeCharacter{00D6}{\"O} - \DeclareUnicodeCharacter{00D8}{\O} - \DeclareUnicodeCharacter{00D9}{\`U} - \DeclareUnicodeCharacter{00DA}{\'U} - \DeclareUnicodeCharacter{00DB}{\^U} - \DeclareUnicodeCharacter{00DC}{\"U} - \DeclareUnicodeCharacter{00DD}{\'Y} - \DeclareUnicodeCharacter{00DE}{\TH} - \DeclareUnicodeCharacter{00DF}{\ss} - - \DeclareUnicodeCharacter{00E0}{\`a} - \DeclareUnicodeCharacter{00E1}{\'a} - \DeclareUnicodeCharacter{00E2}{\^a} - \DeclareUnicodeCharacter{00E3}{\~a} - \DeclareUnicodeCharacter{00E4}{\"a} - \DeclareUnicodeCharacter{00E5}{\aa} - \DeclareUnicodeCharacter{00E6}{\ae} - \DeclareUnicodeCharacter{00E7}{\cedilla{c}} - \DeclareUnicodeCharacter{00E8}{\`e} - \DeclareUnicodeCharacter{00E9}{\'e} - \DeclareUnicodeCharacter{00EA}{\^e} - \DeclareUnicodeCharacter{00EB}{\"e} - \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}} - \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}} - \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}} - \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}} - - \DeclareUnicodeCharacter{00F0}{\dh} - \DeclareUnicodeCharacter{00F1}{\~n} - \DeclareUnicodeCharacter{00F2}{\`o} - \DeclareUnicodeCharacter{00F3}{\'o} - \DeclareUnicodeCharacter{00F4}{\^o} - \DeclareUnicodeCharacter{00F5}{\~o} - \DeclareUnicodeCharacter{00F6}{\"o} - \DeclareUnicodeCharacter{00F8}{\o} - \DeclareUnicodeCharacter{00F9}{\`u} - \DeclareUnicodeCharacter{00FA}{\'u} - \DeclareUnicodeCharacter{00FB}{\^u} - \DeclareUnicodeCharacter{00FC}{\"u} - \DeclareUnicodeCharacter{00FD}{\'y} - \DeclareUnicodeCharacter{00FE}{\th} - \DeclareUnicodeCharacter{00FF}{\"y} - - \DeclareUnicodeCharacter{0100}{\=A} - \DeclareUnicodeCharacter{0101}{\=a} - \DeclareUnicodeCharacter{0102}{\u{A}} - \DeclareUnicodeCharacter{0103}{\u{a}} - \DeclareUnicodeCharacter{0104}{\ogonek{A}} - \DeclareUnicodeCharacter{0105}{\ogonek{a}} - \DeclareUnicodeCharacter{0106}{\'C} - \DeclareUnicodeCharacter{0107}{\'c} - \DeclareUnicodeCharacter{0108}{\^C} - \DeclareUnicodeCharacter{0109}{\^c} - \DeclareUnicodeCharacter{0118}{\ogonek{E}} - \DeclareUnicodeCharacter{0119}{\ogonek{e}} - \DeclareUnicodeCharacter{010A}{\dotaccent{C}} - \DeclareUnicodeCharacter{010B}{\dotaccent{c}} - \DeclareUnicodeCharacter{010C}{\v{C}} - \DeclareUnicodeCharacter{010D}{\v{c}} - \DeclareUnicodeCharacter{010E}{\v{D}} - - \DeclareUnicodeCharacter{0112}{\=E} - \DeclareUnicodeCharacter{0113}{\=e} - \DeclareUnicodeCharacter{0114}{\u{E}} - \DeclareUnicodeCharacter{0115}{\u{e}} - \DeclareUnicodeCharacter{0116}{\dotaccent{E}} - \DeclareUnicodeCharacter{0117}{\dotaccent{e}} - \DeclareUnicodeCharacter{011A}{\v{E}} - \DeclareUnicodeCharacter{011B}{\v{e}} - \DeclareUnicodeCharacter{011C}{\^G} - \DeclareUnicodeCharacter{011D}{\^g} - \DeclareUnicodeCharacter{011E}{\u{G}} - \DeclareUnicodeCharacter{011F}{\u{g}} - - \DeclareUnicodeCharacter{0120}{\dotaccent{G}} - \DeclareUnicodeCharacter{0121}{\dotaccent{g}} - \DeclareUnicodeCharacter{0124}{\^H} - \DeclareUnicodeCharacter{0125}{\^h} - \DeclareUnicodeCharacter{0128}{\~I} - \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}} - \DeclareUnicodeCharacter{012A}{\=I} - \DeclareUnicodeCharacter{012B}{\={\dotless{i}}} - \DeclareUnicodeCharacter{012C}{\u{I}} - \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}} - - \DeclareUnicodeCharacter{0130}{\dotaccent{I}} - \DeclareUnicodeCharacter{0131}{\dotless{i}} - \DeclareUnicodeCharacter{0132}{IJ} - \DeclareUnicodeCharacter{0133}{ij} - \DeclareUnicodeCharacter{0134}{\^J} - \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}} - \DeclareUnicodeCharacter{0139}{\'L} - \DeclareUnicodeCharacter{013A}{\'l} - - \DeclareUnicodeCharacter{0141}{\L} - \DeclareUnicodeCharacter{0142}{\l} - \DeclareUnicodeCharacter{0143}{\'N} - \DeclareUnicodeCharacter{0144}{\'n} - \DeclareUnicodeCharacter{0147}{\v{N}} - \DeclareUnicodeCharacter{0148}{\v{n}} - \DeclareUnicodeCharacter{014C}{\=O} - \DeclareUnicodeCharacter{014D}{\=o} - \DeclareUnicodeCharacter{014E}{\u{O}} - \DeclareUnicodeCharacter{014F}{\u{o}} - - \DeclareUnicodeCharacter{0150}{\H{O}} - \DeclareUnicodeCharacter{0151}{\H{o}} - \DeclareUnicodeCharacter{0152}{\OE} - \DeclareUnicodeCharacter{0153}{\oe} - \DeclareUnicodeCharacter{0154}{\'R} - \DeclareUnicodeCharacter{0155}{\'r} - \DeclareUnicodeCharacter{0158}{\v{R}} - \DeclareUnicodeCharacter{0159}{\v{r}} - \DeclareUnicodeCharacter{015A}{\'S} - \DeclareUnicodeCharacter{015B}{\'s} - \DeclareUnicodeCharacter{015C}{\^S} - \DeclareUnicodeCharacter{015D}{\^s} - \DeclareUnicodeCharacter{015E}{\cedilla{S}} - \DeclareUnicodeCharacter{015F}{\cedilla{s}} - - \DeclareUnicodeCharacter{0160}{\v{S}} - \DeclareUnicodeCharacter{0161}{\v{s}} - \DeclareUnicodeCharacter{0162}{\cedilla{t}} - \DeclareUnicodeCharacter{0163}{\cedilla{T}} - \DeclareUnicodeCharacter{0164}{\v{T}} - - \DeclareUnicodeCharacter{0168}{\~U} - \DeclareUnicodeCharacter{0169}{\~u} - \DeclareUnicodeCharacter{016A}{\=U} - \DeclareUnicodeCharacter{016B}{\=u} - \DeclareUnicodeCharacter{016C}{\u{U}} - \DeclareUnicodeCharacter{016D}{\u{u}} - \DeclareUnicodeCharacter{016E}{\ringaccent{U}} - \DeclareUnicodeCharacter{016F}{\ringaccent{u}} - - \DeclareUnicodeCharacter{0170}{\H{U}} - \DeclareUnicodeCharacter{0171}{\H{u}} - \DeclareUnicodeCharacter{0174}{\^W} - \DeclareUnicodeCharacter{0175}{\^w} - \DeclareUnicodeCharacter{0176}{\^Y} - \DeclareUnicodeCharacter{0177}{\^y} - \DeclareUnicodeCharacter{0178}{\"Y} - \DeclareUnicodeCharacter{0179}{\'Z} - \DeclareUnicodeCharacter{017A}{\'z} - \DeclareUnicodeCharacter{017B}{\dotaccent{Z}} - \DeclareUnicodeCharacter{017C}{\dotaccent{z}} - \DeclareUnicodeCharacter{017D}{\v{Z}} - \DeclareUnicodeCharacter{017E}{\v{z}} - - \DeclareUnicodeCharacter{01C4}{D\v{Z}} - \DeclareUnicodeCharacter{01C5}{D\v{z}} - \DeclareUnicodeCharacter{01C6}{d\v{z}} - \DeclareUnicodeCharacter{01C7}{LJ} - \DeclareUnicodeCharacter{01C8}{Lj} - \DeclareUnicodeCharacter{01C9}{lj} - \DeclareUnicodeCharacter{01CA}{NJ} - \DeclareUnicodeCharacter{01CB}{Nj} - \DeclareUnicodeCharacter{01CC}{nj} - \DeclareUnicodeCharacter{01CD}{\v{A}} - \DeclareUnicodeCharacter{01CE}{\v{a}} - \DeclareUnicodeCharacter{01CF}{\v{I}} - - \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}} - \DeclareUnicodeCharacter{01D1}{\v{O}} - \DeclareUnicodeCharacter{01D2}{\v{o}} - \DeclareUnicodeCharacter{01D3}{\v{U}} - \DeclareUnicodeCharacter{01D4}{\v{u}} - - \DeclareUnicodeCharacter{01E2}{\={\AE}} - \DeclareUnicodeCharacter{01E3}{\={\ae}} - \DeclareUnicodeCharacter{01E6}{\v{G}} - \DeclareUnicodeCharacter{01E7}{\v{g}} - \DeclareUnicodeCharacter{01E8}{\v{K}} - \DeclareUnicodeCharacter{01E9}{\v{k}} - - \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}} - \DeclareUnicodeCharacter{01F1}{DZ} - \DeclareUnicodeCharacter{01F2}{Dz} - \DeclareUnicodeCharacter{01F3}{dz} - \DeclareUnicodeCharacter{01F4}{\'G} - \DeclareUnicodeCharacter{01F5}{\'g} - \DeclareUnicodeCharacter{01F8}{\`N} - \DeclareUnicodeCharacter{01F9}{\`n} - \DeclareUnicodeCharacter{01FC}{\'{\AE}} - \DeclareUnicodeCharacter{01FD}{\'{\ae}} - \DeclareUnicodeCharacter{01FE}{\'{\O}} - \DeclareUnicodeCharacter{01FF}{\'{\o}} - - \DeclareUnicodeCharacter{021E}{\v{H}} - \DeclareUnicodeCharacter{021F}{\v{h}} - - \DeclareUnicodeCharacter{0226}{\dotaccent{A}} - \DeclareUnicodeCharacter{0227}{\dotaccent{a}} - \DeclareUnicodeCharacter{0228}{\cedilla{E}} - \DeclareUnicodeCharacter{0229}{\cedilla{e}} - \DeclareUnicodeCharacter{022E}{\dotaccent{O}} - \DeclareUnicodeCharacter{022F}{\dotaccent{o}} - - \DeclareUnicodeCharacter{0232}{\=Y} - \DeclareUnicodeCharacter{0233}{\=y} - \DeclareUnicodeCharacter{0237}{\dotless{j}} - - \DeclareUnicodeCharacter{02DB}{\ogonek{ }} - - \DeclareUnicodeCharacter{1E02}{\dotaccent{B}} - \DeclareUnicodeCharacter{1E03}{\dotaccent{b}} - \DeclareUnicodeCharacter{1E04}{\udotaccent{B}} - \DeclareUnicodeCharacter{1E05}{\udotaccent{b}} - \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}} - \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}} - \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}} - \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}} - \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}} - \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}} - \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}} - \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}} - - \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}} - \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}} - - \DeclareUnicodeCharacter{1E20}{\=G} - \DeclareUnicodeCharacter{1E21}{\=g} - \DeclareUnicodeCharacter{1E22}{\dotaccent{H}} - \DeclareUnicodeCharacter{1E23}{\dotaccent{h}} - \DeclareUnicodeCharacter{1E24}{\udotaccent{H}} - \DeclareUnicodeCharacter{1E25}{\udotaccent{h}} - \DeclareUnicodeCharacter{1E26}{\"H} - \DeclareUnicodeCharacter{1E27}{\"h} - - \DeclareUnicodeCharacter{1E30}{\'K} - \DeclareUnicodeCharacter{1E31}{\'k} - \DeclareUnicodeCharacter{1E32}{\udotaccent{K}} - \DeclareUnicodeCharacter{1E33}{\udotaccent{k}} - \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}} - \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}} - \DeclareUnicodeCharacter{1E36}{\udotaccent{L}} - \DeclareUnicodeCharacter{1E37}{\udotaccent{l}} - \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}} - \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}} - \DeclareUnicodeCharacter{1E3E}{\'M} - \DeclareUnicodeCharacter{1E3F}{\'m} - - \DeclareUnicodeCharacter{1E40}{\dotaccent{M}} - \DeclareUnicodeCharacter{1E41}{\dotaccent{m}} - \DeclareUnicodeCharacter{1E42}{\udotaccent{M}} - \DeclareUnicodeCharacter{1E43}{\udotaccent{m}} - \DeclareUnicodeCharacter{1E44}{\dotaccent{N}} - \DeclareUnicodeCharacter{1E45}{\dotaccent{n}} - \DeclareUnicodeCharacter{1E46}{\udotaccent{N}} - \DeclareUnicodeCharacter{1E47}{\udotaccent{n}} - \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}} - \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}} - - \DeclareUnicodeCharacter{1E54}{\'P} - \DeclareUnicodeCharacter{1E55}{\'p} - \DeclareUnicodeCharacter{1E56}{\dotaccent{P}} - \DeclareUnicodeCharacter{1E57}{\dotaccent{p}} - \DeclareUnicodeCharacter{1E58}{\dotaccent{R}} - \DeclareUnicodeCharacter{1E59}{\dotaccent{r}} - \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}} - \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}} - \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}} - \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}} - - \DeclareUnicodeCharacter{1E60}{\dotaccent{S}} - \DeclareUnicodeCharacter{1E61}{\dotaccent{s}} - \DeclareUnicodeCharacter{1E62}{\udotaccent{S}} - \DeclareUnicodeCharacter{1E63}{\udotaccent{s}} - \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}} - \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}} - \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}} - \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}} - \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}} - \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}} - - \DeclareUnicodeCharacter{1E7C}{\~V} - \DeclareUnicodeCharacter{1E7D}{\~v} - \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}} - \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}} - - \DeclareUnicodeCharacter{1E80}{\`W} - \DeclareUnicodeCharacter{1E81}{\`w} - \DeclareUnicodeCharacter{1E82}{\'W} - \DeclareUnicodeCharacter{1E83}{\'w} - \DeclareUnicodeCharacter{1E84}{\"W} - \DeclareUnicodeCharacter{1E85}{\"w} - \DeclareUnicodeCharacter{1E86}{\dotaccent{W}} - \DeclareUnicodeCharacter{1E87}{\dotaccent{w}} - \DeclareUnicodeCharacter{1E88}{\udotaccent{W}} - \DeclareUnicodeCharacter{1E89}{\udotaccent{w}} - \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}} - \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}} - \DeclareUnicodeCharacter{1E8C}{\"X} - \DeclareUnicodeCharacter{1E8D}{\"x} - \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}} - \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}} - - \DeclareUnicodeCharacter{1E90}{\^Z} - \DeclareUnicodeCharacter{1E91}{\^z} - \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}} - \DeclareUnicodeCharacter{1E93}{\udotaccent{z}} - \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}} - \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}} - \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}} - \DeclareUnicodeCharacter{1E97}{\"t} - \DeclareUnicodeCharacter{1E98}{\ringaccent{w}} - \DeclareUnicodeCharacter{1E99}{\ringaccent{y}} - - \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}} - \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}} - - \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}} - \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}} - \DeclareUnicodeCharacter{1EBC}{\~E} - \DeclareUnicodeCharacter{1EBD}{\~e} - - \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}} - \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}} - \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}} - \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}} - - \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}} - \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}} - - \DeclareUnicodeCharacter{1EF2}{\`Y} - \DeclareUnicodeCharacter{1EF3}{\`y} - \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}} - - \DeclareUnicodeCharacter{1EF8}{\~Y} - \DeclareUnicodeCharacter{1EF9}{\~y} - - \DeclareUnicodeCharacter{2013}{--} - \DeclareUnicodeCharacter{2014}{---} - \DeclareUnicodeCharacter{2018}{\quoteleft} - \DeclareUnicodeCharacter{2019}{\quoteright} - \DeclareUnicodeCharacter{201A}{\quotesinglbase} - \DeclareUnicodeCharacter{201C}{\quotedblleft} - \DeclareUnicodeCharacter{201D}{\quotedblright} - \DeclareUnicodeCharacter{201E}{\quotedblbase} - \DeclareUnicodeCharacter{2022}{\bullet} - \DeclareUnicodeCharacter{2026}{\dots} - \DeclareUnicodeCharacter{2039}{\guilsinglleft} - \DeclareUnicodeCharacter{203A}{\guilsinglright} - \DeclareUnicodeCharacter{20AC}{\euro} - - \DeclareUnicodeCharacter{2192}{\expansion} - \DeclareUnicodeCharacter{21D2}{\result} - - \DeclareUnicodeCharacter{2212}{\minus} - \DeclareUnicodeCharacter{2217}{\point} - \DeclareUnicodeCharacter{2261}{\equiv} -}% end of \utfeightchardefs + \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii + \unicodechardefs +} + +% Whether the active definitions of non-ASCII characters expand to +% non-active tokens with the same character code. This is used to +% write characters literally, instead of using active definitions for +% printing the correct glyphs. +\newif\ifpassthroughchars +\passthroughcharsfalse + +% For native Unicode handling (XeTeX and LuaTeX), +% provide a definition macro to replace/pass-through a Unicode character +% +\def\DeclareUnicodeCharacterNative#1#2{% + \catcode"#1=\active + \def\dodeclareunicodecharacternative##1##2##3{% + \begingroup + \uccode`\~="##2\relax + \uppercase{\gdef~}{% + \ifpassthroughchars + ##1% + \else + ##3% + \fi + } + \endgroup + } + \begingroup + \uccode`\.="#1\relax + \uppercase{\def\UTFNativeTmp{.}}% + \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}% + \endgroup +} +% Native Unicode handling (XeTeX and LuaTeX) character replacing definition. +% It activates the setting that replaces Unicode characters. +\def\nativeunicodechardefs{% + \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative + \unicodechardefs +} + +% For native Unicode handling (XeTeX and LuaTeX), +% make the character token expand +% to the sequences given in \unicodechardefs for printing. +\def\DeclareUnicodeCharacterNativeAtU#1#2{% + \def\UTFAtUTmp{#2} + \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp +} + +% @U command definitions for native Unicode handling (XeTeX and LuaTeX). +\def\nativeunicodechardefsatu{% + \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU + \unicodechardefs +} % US-ASCII character definitions. \def\asciichardefs{% nothing need be done \relax } +% define all Unicode characters we know about, for the sake of @U. +\iftxinativeunicodecapable + \nativeunicodechardefsatu +\else + \utfeightchardefs +\fi + + % Make non-ASCII characters printable again for compatibility with % existing Texinfo documents that may use them, even without declaring a % document encoding. @@ -9708,12 +11305,12 @@ \advance\vsize by \topskip \outervsize = \vsize \advance\outervsize by 2\topandbottommargin - \pageheight = \vsize + \txipageheight = \vsize % \hsize = #2\relax \outerhsize = \hsize \advance\outerhsize by 0.5in - \pagewidth = \hsize + \txipagewidth = \hsize % \normaloffset = #4\relax \bindingoffset = #5\relax @@ -9725,6 +11322,14 @@ % whatever layout pdftex was dumped with. \pdfhorigin = 1 true in \pdfvorigin = 1 true in + \else + \ifx\XeTeXrevision\thisisundefined + \special{papersize=#8,#7}% + \else + \pdfpageheight #7\relax + \pdfpagewidth #8\relax + % XeTeX does not have \pdfhorigin and \pdfvorigin. + \fi \fi % \setleading{\textleading} @@ -9757,7 +11362,6 @@ % \lispnarrowing = 0.3in \tolerance = 700 - \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = .5cm }} @@ -9775,7 +11379,6 @@ % \lispnarrowing = 0.25in \tolerance = 700 - \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = .4cm }} @@ -9801,7 +11404,6 @@ {297mm}{210mm}% % \tolerance = 700 - \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = 5mm }} @@ -9820,7 +11422,6 @@ % \lispnarrowing = 0.2in \tolerance = 800 - \hfuzz = 1.2pt \contentsrightmargin = 0pt \defbodyindent = 2mm \tableindent = 12mm @@ -9862,9 +11463,11 @@ % \dimen0 = #1\relax \advance\dimen0 by \voffset + \advance\dimen0 by 1in % reference point for DVI is 1 inch from top of page % \dimen2 = \hsize \advance\dimen2 by \normaloffset + \advance\dimen2 by 1in % reference point is 1 inch from left edge of page % \internalpagesizes{#1}{\hsize}% {\voffset}{\normaloffset}% @@ -9876,6 +11479,9 @@ % \letterpaper +% Default value of \hfuzz, for suppressing warnings about overfull hboxes. +\hfuzz = 1pt + \message{and turning on texinfo input format.} @@ -9912,44 +11518,47 @@ % this is not a problem. \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} -% Turn off all special characters except @ -% (and those which the user can use as if they were ordinary). +% Set catcodes for Texinfo file + +% Active characters for printing the wanted glyph. % Most of these we simply print from the \tt font, but for some, we can % use math or other variants that look better in normal text. - +% \catcode`\"=\active \def\activedoublequote{{\tt\char34}} \let"=\activedoublequote -\catcode`\~=\active -\def~{{\tt\char126}} -\chardef\hat=`\^ -\catcode`\^=\active -\def^{{\tt \hat}} +\catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde +\chardef\hatchar=`\^ +\catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat \catcode`\_=\active \def_{\ifusingtt\normalunderscore\_} -\let\realunder=_ -% Subroutine for the previous macro. \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } +\let\realunder=_ + +\catcode`\|=\active \def|{{\tt\char124}} -\catcode`\|=\active -\def|{{\tt\char124}} \chardef \less=`\< -\catcode`\<=\active -\def<{{\tt \less}} +\catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless \chardef \gtr=`\> -\catcode`\>=\active -\def>{{\tt \gtr}} -\catcode`\+=\active -\def+{{\tt \char 43}} -\catcode`\$=\active -\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix - -% If a .fmt file is being used, characters that might appear in a file -% name cannot be active until we have parsed the command line. -% So turn them off again, and have \everyjob (or @setfilename) turn them on. -% \otherifyactive is called near the end of this file. -\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} +\catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr +\catcode`\+=\active \def+{{\tt \char 43}} +\catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix +\catcode`\-=\active \let-=\normaldash + + +% used for headline/footline in the output routine, in case the page +% breaks in the middle of an @tex block. +\def\texinfochars{% + \let< = \activeless + \let> = \activegtr + \let~ = \activetilde + \let^ = \activehat + \markupsetuplqdefault \markupsetuprqdefault + \let\b = \strong + \let\i = \smartitalic + % in principle, all other definitions in \tex have to be undone too. +} % Used sometimes to turn off (effectively) the active characters even after % parsing them. @@ -9969,23 +11578,22 @@ % \doublebackslash is two of them (for the pdf outlines). {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} -% In texinfo, backslash is an active character; it prints the backslash +% In Texinfo, backslash is an active character; it prints the backslash % in fixed width font. \catcode`\\=\active % @ for escape char from now on. -% The story here is that in math mode, the \char of \backslashcurfont -% ends up printing the roman \ from the math symbol font (because \char -% in math mode uses the \mathcode, and plain.tex sets -% \mathcode`\\="026E). It seems better for @backslashchar{} to always -% print a typewriter backslash, hence we use an explicit \mathchar, +% Print a typewriter backslash. For math mode, we can't simply use +% \backslashcurfont: the story here is that in math mode, the \char +% of \backslashcurfont ends up printing the roman \ from the math symbol +% font (because \char in math mode uses the \mathcode, and plain.tex +% sets \mathcode`\\="026E). Hence we use an explicit \mathchar, % which is the decimal equivalent of "715c (class 7, e.g., use \fam; % ignored family value; char position "5C). We can't use " for the % usual hex value because it has already been made active. -@def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} -@let@backslashchar = @normalbackslash % @backslashchar{} is for user documents. -% On startup, @fixbackslash assigns: -% @let \ = @normalbackslash +@def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} +@let@backslashchar = @ttbackslash % @backslashchar{} is for user documents. + % \rawbackslash defines an active \ to do \backslashcurfont. % \otherbackslash defines an active \ to be a literal `\' character with % catcode other. We switch back and forth between these. @@ -9993,51 +11601,93 @@ @gdef@otherbackslash{@let\=@realbackslash} % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of -% the literal character `\'. Also revert - to its normal character, in -% case the active - from code has slipped in. +% the literal character `\'. % {@catcode`- = @active @gdef@normalturnoffactive{% + @passthroughcharstrue @let-=@normaldash @let"=@normaldoublequote @let$=@normaldollar %$ font-lock fix @let+=@normalplus @let<=@normalless @let>=@normalgreater - @let\=@normalbackslash @let^=@normalcaret @let_=@normalunderscore @let|=@normalverticalbar @let~=@normaltilde + @let\=@ttbackslash @markupsetuplqdefault @markupsetuprqdefault @unsepspaces } } -% Make _ and + \other characters, temporarily. -% This is canceled by @fixbackslash. -@otherifyactive +% If a .fmt file is being used, characters that might appear in a file +% name cannot be active until we have parsed the command line. +% So turn them off again, and have @fixbackslash turn them back on. +@catcode`+=@other @catcode`@_=@other +% \enablebackslashhack - allow file to begin `\input texinfo' +% % If a .fmt file is being used, we don't want the `\input texinfo' to show up. % That is what \eatinput is for; after that, the `\' should revert to printing % a backslash. -% -@gdef@eatinput input texinfo{@fixbackslash} -@global@let\ = @eatinput +% If the file did not have a `\input texinfo', then it is turned off after +% the first line; otherwise the first `\' in the file would cause an error. +% This is used on the very last line of this file, texinfo.tex. +% We also use @c to call @fixbackslash, in case ends of lines are hidden. +{ +@catcode`@^=7 +@catcode`@^^M=13@gdef@enablebackslashhack{% + @global@let\ = @eatinput% + @catcode`@^^M=13% + @def@c{@fixbackslash@c}% + % Definition for the newline at the end of this file. + @def ^^M{@let^^M@secondlinenl}% + % Definition for a newline in the main Texinfo file. + @gdef @secondlinenl{@fixbackslash}% + % In case the first line has a whole-line command on it + @let@originalparsearg@parsearg + @def@parsearg{@fixbackslash@originalparsearg} +}} + +{@catcode`@^=7 @catcode`@^^M=13% +@gdef@eatinput input texinfo#1^^M{@fixbackslash}} + +% Emergency active definition of newline, in case an active newline token +% appears by mistake. +{@catcode`@^=7 @catcode13=13% +@gdef@enableemergencynewline{% + @gdef^^M{% + @par% + %@par% +}}} + -% On the other hand, perhaps the file did not have a `\input texinfo'. Then -% the first `\' in the file would cause an error. This macro tries to fix -% that, assuming it is called before the first `\' could plausibly occur. -% Also turn back on active characters that might appear in the input -% file name, in case not using a pre-dumped format. -% @gdef@fixbackslash{% - @ifx\@eatinput @let\ = @normalbackslash @fi + @ifx\@eatinput @let\ = @ttbackslash @fi + @catcode13=5 % regular end of line + @enableemergencynewline + @let@c=@texinfoc + @let@parsearg@originalparsearg + % Also turn back on active characters that might appear in the input + % file name, in case not using a pre-dumped format. @catcode`+=@active @catcode`@_=@active + % + % If texinfo.cnf is present on the system, read it. + % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets + % called at the beginning of every Texinfo file. Not opening texinfo.cnf + % directly in this file, texinfo.tex, makes it possible to make a format + % file for Texinfo. + % + @openin 1 texinfo.cnf + @ifeof 1 @else @input texinfo.cnf @fi + @closein 1 } + % Say @foo, not \foo, in error messages. @escapechar = `@@ @@ -10066,7 +11716,7 @@ @c Local variables: @c eval: (add-hook 'write-file-hooks 'time-stamp) -@c page-delimiter: "^\\\\message" +@c page-delimiter: "^\\\\message\\|emacs-page" @c time-stamp-start: "def\\\\texinfoversion{" @c time-stamp-format: "%:y-%02m-%02d.%02H" @c time-stamp-end: "}" @@ -10074,6 +11724,4 @@ @c vim:sw=2: -@ignore - arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 -@end ignore +@enablebackslashhack diff -Nru mpfr4-3.1.4/examples/can_round.c mpfr4-4.0.2/examples/can_round.c --- mpfr4-3.1.4/examples/can_round.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/examples/can_round.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,64 @@ +/* Example illustrating how to use mpfr_can_round. */ + +/* +Copyright 2016-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include +#include + +int +main (void) +{ + mpfr_t x, y; + mpfr_prec_t px = 53, py = 50; + mpfr_rnd_t r1, r2; + int ok; + + /* Given an approximation of Pi to px bits computed with rounding mode r1, + we call mpfr_can_round() to see if we can deduced the correct rounding + of Pi to py bits with rounding mode r2. + The error is at most 1 = 2^0 ulp. This translates into err = prec(x). */ + mpfr_init2 (x, px); + mpfr_init2 (y, py); + for (r1 = 0; r1 < 4; r1++) + { + mpfr_const_pi (x, r1); + printf ("r1=%s approx=", mpfr_print_rnd_mode (r1)); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); + printf ("\n"); + for (r2 = 0; r2 < 4; r2++) + { + ok = mpfr_can_round (x, mpfr_get_prec (x), r1, r2, py); + printf ("r2=%s ok=%d", mpfr_print_rnd_mode (r2), ok); + if (ok) + { + mpfr_set (y, x, r2); + printf (" "); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); + } + printf ("\n"); + } + } + mpfr_clear (x); + mpfr_clear (y); + return 0; +} diff -Nru mpfr4-3.1.4/examples/divworst.c mpfr4-4.0.2/examples/divworst.c --- mpfr4-3.1.4/examples/divworst.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/examples/divworst.c 2019-01-07 13:53:20.000000000 +0000 @@ -13,7 +13,7 @@ */ /* -Copyright 2009-2016 Free Software Foundation, Inc. +Copyright 2009-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -30,7 +30,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff -Nru mpfr4-3.1.4/examples/rndo-add.c mpfr4-4.0.2/examples/rndo-add.c --- mpfr4-3.1.4/examples/rndo-add.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/examples/rndo-add.c 2019-01-07 13:53:20.000000000 +0000 @@ -8,7 +8,7 @@ */ /* -Copyright 2009-2016 Free Software Foundation, Inc. +Copyright 2009-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -25,7 +25,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff -Nru mpfr4-3.1.4/examples/sample.c mpfr4-4.0.2/examples/sample.c --- mpfr4-3.1.4/examples/sample.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/examples/sample.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,9 +1,9 @@ /* This is the example given and commented on the MPFR web site: - * http://www.mpfr.org/sample.html + * https://www.mpfr.org/sample.html */ /* -Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -20,7 +20,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff -Nru mpfr4-3.1.4/examples/version.c mpfr4-4.0.2/examples/version.c --- mpfr4-3.1.4/examples/version.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/examples/version.c 2019-01-07 13:53:20.000000000 +0000 @@ -3,7 +3,7 @@ */ /* -Copyright 2010-2016 Free Software Foundation, Inc. +Copyright 2010-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -20,7 +20,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ @@ -46,37 +46,156 @@ mpfr_clear (x); } +static void patches (void) +{ + const char *p = mpfr_get_patches (); + printf ("MPFR patches: %s\n", p[0] ? p : "[none]"); +} + +#define STRINGIZE(S) #S +#define MAKE_STR(S) STRINGIZE(S) + +#define SIGNED_STR(V) ((V) < 0 ? "signed" : "unsigned") +#define SIGNED(I) SIGNED_STR((I) - (I) - 1) + int main (void) { unsigned long c; - mp_limb_t t[4] = { -1, -1, -1, -1 }; + mp_limb_t t[4]; + int i; + + /* Casts are for C++ compilers. */ + for (i = 0; i < (int) (sizeof (t) / sizeof (mp_limb_t)); i++) + t[i] = (mp_limb_t) -1; + + /**************** Information about the C implementation ****************/ + + /* This is useful, as this can affect the behavior of MPFR. */ + +#define COMP "Compiler: " +#ifdef __INTEL_COMPILER +# ifdef __VERSION__ +# define ICCV " [" __VERSION__ "]" +# else +# define ICCV "" +# endif + printf (COMP "ICC %d.%d.%d" ICCV "\n", __INTEL_COMPILER / 100, + __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE); +#elif (defined(__GNUC__) || defined(__clang__)) && defined(__VERSION__) +# ifdef __clang__ +# define COMP2 COMP +# else +# define COMP2 COMP "GCC " +# endif + printf (COMP2 "%s\n", __VERSION__); +#endif +#if defined(__STDC__) || defined(__STDC_VERSION__) + printf ("C/C++: __STDC__ = " +#if defined(__STDC__) + MAKE_STR(__STDC__) +#else + "undef" +#endif + ", __STDC_VERSION__ = " +#if defined(__STDC_VERSION__) + MAKE_STR(__STDC_VERSION__) +#else + "undef" +#endif #if defined(__cplusplus) - printf ("A C++ compiler is used.\n"); + ", C++" +#endif + "\n"); +#endif + +#if defined(__GNUC__) + printf ("GNU compatibility: __GNUC__ = " MAKE_STR(__GNUC__) + ", __GNUC_MINOR__ = " +#if defined(__GNUC_MINOR__) + MAKE_STR(__GNUC_MINOR__) +#else + "undef" +#endif + "\n"); +#endif + +#if defined(__ICC) || defined(__INTEL_COMPILER) + printf ("Intel compiler: __ICC = " +#if defined(__ICC) + MAKE_STR(__ICC) +#else + "undef" +#endif + ", __INTEL_COMPILER = " +#if defined(__INTEL_COMPILER) + MAKE_STR(__INTEL_COMPILER) +#else + "undef" #endif + "\n"); +#endif + +#if defined(_WIN32) || defined(_MSC_VER) + printf ("MS Windows: _WIN32 = " +#if defined(_WIN32) + MAKE_STR(_WIN32) +#else + "undef" +#endif + ", _MSC_VER = " +#if defined(_MSC_VER) + MAKE_STR(_MSC_VER) +#else + "undef" +#endif + "\n"); +#endif + +#if defined(__GLIBC__) + printf ("GNU C library: __GLIBC__ = " MAKE_STR(__GLIBC__) + ", __GLIBC_MINOR__ = " +#if defined(__GLIBC_MINOR__) + MAKE_STR(__GLIBC_MINOR__) +#else + "undef" +#endif + "\n"); +#endif + + printf ("\n"); + + /************************************************************************/ +#if defined(__MPIR_VERSION) + printf ("MPIR .... Library: %-12s Header: %d.%d.%d\n", + mpir_version, __MPIR_VERSION, __MPIR_VERSION_MINOR, + __MPIR_VERSION_PATCHLEVEL); +#else printf ("GMP ..... Library: %-12s Header: %d.%d.%d\n", gmp_version, __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL); +#endif printf ("MPFR .... Library: %-12s Header: %s (based on %d.%d.%d)\n", mpfr_get_version (), MPFR_VERSION_STRING, MPFR_VERSION_MAJOR, MPFR_VERSION_MINOR, MPFR_VERSION_PATCHLEVEL); -#if MPFR_VERSION_MAJOR >= 3 - printf ("MPFR features: TLS = %s, decimal = %s", - mpfr_buildopt_tls_p () ? "yes" : "no", - mpfr_buildopt_decimal_p () ? "yes" : "no"); -# if MPFR_VERSION_MAJOR > 3 || MPFR_VERSION_MINOR >= 1 + printf ("MPFR features: TLS = %s", mpfr_buildopt_tls_p () ? "yes" : "no"); +#if MPFR_VERSION_MAJOR >= 4 + printf (", float128 = %s", mpfr_buildopt_float128_p () ? "yes" : "no"); +#endif + printf (", decimal = %s", mpfr_buildopt_decimal_p () ? "yes" : "no"); +#if MPFR_VERSION_MAJOR > 3 || MPFR_VERSION_MINOR >= 1 printf (", GMP internals = %s\nMPFR tuning: %s", mpfr_buildopt_gmpinternals_p () ? "yes" : "no", mpfr_buildopt_tune_case ()); -# endif +#endif /* 3.1 */ printf ("\n"); -#endif - printf ("MPFR patches: %s\n\n", mpfr_get_patches ()); + patches (); + printf ("\n"); #ifdef __GMP_CC printf ("__GMP_CC = \"%s\"\n", __GMP_CC); #endif @@ -99,12 +218,25 @@ printf ("Warning! This is different from GMP_LIMB_BITS!\n" "Different ABI caused by a GMP library upgrade?\n"); -#if MPFR_VERSION_MAJOR >= 3 printf ("\n"); - printf ("sizeof(mpfr_prec_t) = %d\n", (int) sizeof(mpfr_prec_t)); - printf ("sizeof(mpfr_exp_t) = %d\n", (int) sizeof(mpfr_exp_t)); + printf ("sizeof(mpfr_prec_t) = %d (%s type)\n", (int) sizeof(mpfr_prec_t), + SIGNED_STR((mpfr_prec_t) -1)); + printf ("sizeof(mpfr_exp_t) = %d (%s type)\n", (int) sizeof(mpfr_exp_t), + SIGNED_STR((mpfr_exp_t) -1)); +#ifdef _MPFR_PREC_FORMAT + printf ("_MPFR_PREC_FORMAT = %d\n", (int) _MPFR_PREC_FORMAT); #endif - + /* Note: "long" is sufficient for all current _MPFR_PREC_FORMAT values + (1, 2, 3). Thus we do not need to depend on ISO C99 or later. */ + printf ("MPFR_PREC_MIN = %ld (%s)\n", (long) MPFR_PREC_MIN, + SIGNED (MPFR_PREC_MIN)); + printf ("MPFR_PREC_MAX = %ld (%s)\n", (long) MPFR_PREC_MAX, + SIGNED (MPFR_PREC_MAX)); +#ifdef _MPFR_EXP_FORMAT + printf ("_MPFR_EXP_FORMAT = %d\n", (int) _MPFR_EXP_FORMAT); +#endif + printf ("sizeof(mpfr_t) = %d\n", (int) sizeof(mpfr_t)); + printf ("sizeof(mpfr_ptr) = %d\n", (int) sizeof(mpfr_ptr)); failure_test (); return 0; diff -Nru mpfr4-3.1.4/INSTALL mpfr4-4.0.2/INSTALL --- mpfr4-3.1.4/INSTALL 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/INSTALL 2019-01-30 09:26:44.000000000 +0000 @@ -1,4 +1,4 @@ -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. @@ -28,8 +28,8 @@ problems are due to bad configuration on the user side (not specific to MPFR). -0. You first need to install GMP. See . - MPFR requires GMP version 4.1 or later. +0. You first need to install GMP. See . + MPFR requires GMP version 5.0.0 or later. 1. Extract the files from the archive. @@ -37,17 +37,17 @@ not been done yet and if patches are available. You can check on the release page: - http://www.mpfr.org/mpfr-3.1.4/ + https://www.mpfr.org/mpfr-4.0.2/ which may have additional information. The patches can be applied with commands like: - wget http://www.mpfr.org/mpfr-3.1.4/allpatches + wget https://www.mpfr.org/mpfr-4.0.2/allpatches patch -N -Z -p1 < allpatches or - curl http://www.mpfr.org/mpfr-3.1.4/allpatches | patch -N -Z -p1 + curl https://www.mpfr.org/mpfr-4.0.2/allpatches | patch -N -Z -p1 (Those instructions are for the GNU patch command, for example /usr/bin/gpatch on Solaris.) @@ -80,7 +80,17 @@ running "make check", for instance by typing: VERBOSE=1 make check -6. To install it (default "/usr/local" | see "--prefix" option), type: +6. [Optional / experimental] Binary distributions may also want to run: + make check-gmp-symbols + + This will check that MPFR does not use GMP internal symbols, which + could yield failures in case of GMP upgrade without a MPFR rebuild. + But note that this is a heuristic and might give false positives or + false negatives. Please report any problem to the MPFR developers. + End users may also be interested in this check, unless they have + allowed GMP internals with configure options (see below). + +7. To install it (default "/usr/local" | see "--prefix" option), type: make install If you installed MPFR (header and library) in directories that are @@ -154,6 +164,8 @@ Tuning MPFR =========== +[For the current GMP version (6.1.0), a Unix-like OS is required.] + For this, you need to build MPFR with a GMP build directory (see above). In the GMP build directory, you also need to go into the "tune" subdirectory and type "make speed". This will build the GMP speed library, which is used @@ -218,15 +230,34 @@ this option is used. Thus it must not be used in binary distributions. -Note: By default, the configure script tries to set CC/CFLAGS to GMP's -ones (this feature needs GMP 4.3.0 or later, or the --with-gmp-build -option). However this is not guaranteed to work as the configure script -does some compiler tests earlier, and the change may be too late. Also, -the values obtained from GMP may be incorrect if GMP has been built -on a different machine. In such a case, the user may need to specify -CC/CFLAGS as explained below. +--with-sysroot=DIR Search for dependent libraries within DIR (which + may be useful in cross-compilation). If you use + this option, you need to have Libtool 2.4+ on + the target system. See Libtool 2.4+'s NEWS file. + Technical information can be found at [1]. + +[1] http://permalink.gmane.org/gmane.comp.gnu.libtool.patches/10111 + +Note: By default, the configure script tries to set CC / CFLAGS to GMP's +ones from gmp.h (__GMP_CC / __GMP_CFLAGS) in order to ensure that MPFR is +built with the same ABI as GMP. The reason is that when GMP is built, it +may set CC / CFLAGS to select an ABI that is not the default one in order +to have a better performance. The -pedantic option in GMP's CFLAGS, when +present (which is the case by default), is removed, because the MPFR +build system uses some C extensions (when this script detects that they +are supported) and -pedantic yields too many useless warnings. However, +this setting from GMP is not guaranteed to work as the configure script +does some compiler tests earlier, and a conflict may arise. Also, the +values obtained from GMP may be incorrect for the MPFR build if GMP has +been built on a different machine; in such a case, the user may need to +specify CC / CFLAGS, as explained below. + +Moreover, even without --with-gmp-build and --enable-gmp-internals, +MPFR might use some GMP internals by mistake. This would be a bug, +which should be reported to the MPFR developers. -Run "./configure --help" to see the other options (autoconf default options). +Run "./configure --help" to see the other options (default options +from Autoconf and Automake). If 'gmp.h' and 'libgmp' do not match @@ -336,9 +367,9 @@ Several documents may help you to solve the problem: * this INSTALL file, in particular information given below; * the FAQ (either the FAQ.html file distributed with MPFR, or the - on-line version , which may be more + on-line version , which may be more up-to-date); - * the MPFR web page for this version , + * the MPFR web page for this version , which lists bugs found in this version and provides some patches. If the "configure" fails, please check that the C compiler and its @@ -379,7 +410,7 @@ MPFR tests no longer fail, this was probably due to a compiler bug, though we cannot exclude a bug in MPFR. You may want to contact us (see below), possibly after looking at: - http://www.loria.fr/~zimmerma/software/compilerbugs.html + https://members.loria.fr/PZimmermann/software/compilerbugs.html On some platforms, try with "gmake" (GNU make) instead of "make". Problems have been reported with the Tru64 make. @@ -441,6 +472,23 @@ setenv LIBRARY_PATH "/usr/local/lib:/other/path/lib" setenv LD_LIBRARY_PATH "$LIBRARY_PATH" +If almost all the tests fail and the messages in the test-suite.log file +(or in the output, when running individual tests from the command line) +start with a line of the form: + + Incorrect MPFR version! (xxx header vs yyy library) + +then this means that an installed MPFR version is tested instead of the +one that has just been built. This is probably not a bug in MPFR, but a +problem caused by the user or system configuration (particular options, +environment variables, etc.) or a bug in the toolchain. In particular, +if LD_LIBRARY_PATH overrides the run path (set up by libtool) and an +installed ABI-compatible version of MPFR is in a directory listed in +the LD_LIBRARY_PATH search path, then this will break. An example with +GNU ld: + + https://sourceware.org/bugzilla/show_bug.cgi?id=21476 + If you can't solve your problem, you should contact us via the MPFR mailing-list , indicating the machine and operating system used (uname -a), the compiler and version used (gcc -v if you use gcc), @@ -450,10 +498,6 @@ "make check" failed. Please send us also the log of the "configure" (config.log). -Note that even if you can build MPFR with a C++ compiler, you can't run -the test suite: C and C++ are not the same language! You should use a C -compiler instead. - Notes about ABI =============== @@ -509,6 +553,19 @@ line: AR="ar -X64" NM="nm -B -X64". +Notes on Solaris +================ + +Do not put a -R option in the LD_OPTIONS environment variable, at least +if the directory can contain an MPFR library. Otherwise this MPFR +library may be chosen for the tests (make check) instead of the one that has +just been built, in which case, either you will get errors due to unmatched +versions or this problem may remain undetected. The reason is that this +option will appear before the -R options added by libtool, such as the one +to the src/.libs directory containing the MPFR library that has just been +built, and will have the precedence. + + MPFR for use with Windows Applications ====================================== @@ -523,8 +580,22 @@ which is simpler and less demanding than Cygwin. Contrary to Cygwin, it also provides native Windows code. + If you also use MSYS, you should use "make" for MSYS instead of + the "make" utility from MinGW-W64 or from GCC, which causes the + following error: + + libtool: warning: libobj name 'extract.Tpo -c -o extract.lo extract.lo' + may not contain shell special characters. + rm: unknown option -- c + + References about this issue and solution: + https://sourceforge.net/p/msys2/tickets/223/ + https://sympa.inria.fr/sympa/arc/mpfr/2016-07/msg00009.html + 2 - If you just want to make a binary with gcc, there is nothing to do: - GMP, MPFR and the program compile exactly as under Linux. + GMP, MPFR and the program compile exactly as under Linux. (It is + recommended to pass --build=xxx-yyy-mingw64 to the GMP configure command, + or --build=xxx with xxx containing mingw.) 3 - To avoid using the Microsoft runtime (which might not be conform to ISO C), you can use the MinGW runtime package (which is an integral part of MinGW). @@ -533,9 +604,27 @@ '-ansi', '-posix' or '-D__USE_MINGW_ANSI_STDIO'. In order to have the MPFR formatted output functions based on ISO-compliant printf(), you need to compile GMP (not MPFR) with CC="gcc -D__USE_MINGW_ANSI_STDIO" - (since the standard printf modifiers %Ld and %td are passed to GMP). - Building MPFR with -D__USE_MINGW_ANSI_STDIO is useless except for some - error messages in the test suite. + (since the standard printf modifiers %e, %Ld and %td are passed to GMP). + Not doing so may result in failures of some of the printf-related tests. + For instance, the following error on some Windows machine has been + reported: + + https://sympa.inria.fr/sympa/arc/mpfr/2016-02/msg00053.html + + Error in mpfr_vsprintf (s, "%e", ...); + expected: "-1.250000e+000" + got: "-1.250000e+00" + FAIL tsprintf.exe (exit status: 1) + + The cause is that here the C functions vsnprintf and vsprintf used + internally in GMP do not produce the same output: + + https://sympa.inria.fr/sympa/arc/mpfr/2016-03/msg00045.html + https://sympa.inria.fr/sympa/arc/mpfr/2016-03/msg00051.html + https://sympa.inria.fr/sympa/arc/mpfr/2016-03/msg00053.html + + Building MPFR with -D__USE_MINGW_ANSI_STDIO is currently useless except + for some error messages in the test suite. b. Using Cygwin =============== diff -Nru mpfr4-3.1.4/install-sh mpfr4-4.0.2/install-sh --- mpfr4-3.1.4/install-sh 2016-03-06 11:33:18.000000000 +0000 +++ mpfr4-4.0.2/install-sh 2019-01-31 20:43:20.000000000 +0000 @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2014-09-12.12; # UTC +scriptversion=2018-03-11.20; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -271,15 +271,18 @@ fi dst=$dst_arg - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. + # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst - dst=$dstdir/`basename "$src"` + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac dstdir_status=0 else dstdir=`dirname "$dst"` @@ -288,6 +291,11 @@ fi fi + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + obsolete_mkdir_used=false if test $dstdir_status != 0; then @@ -324,14 +332,16 @@ # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) - # $RANDOM is not portable (e.g. dash); use it when possible to - # lower collision chance + # Note that $RANDOM variable is not portable (e.g. dash); Use it + # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 - # As "mkdir -p" follows symlinks and we work in /tmp possibly; so - # create the $tmpdir first (and fail if unsuccessful) to make sure - # that nobody tries to guess the $tmpdir name. + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p' feature. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 @@ -434,8 +444,8 @@ else # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 @@ -500,9 +510,9 @@ done # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff -Nru mpfr4-3.1.4/ltmain.sh mpfr4-4.0.2/ltmain.sh --- mpfr4-3.1.4/ltmain.sh 2016-03-06 11:33:16.000000000 +0000 +++ mpfr4-4.0.2/ltmain.sh 2019-01-31 20:43:15.000000000 +0000 @@ -31,7 +31,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.6 Debian-2.4.6-0.1+local1" +VERSION="2.4.6 Debian-2.4.6-9+local1" package_revision=2.4.6 @@ -1370,7 +1370,7 @@ #! /bin/sh # Set a version string for this script. -scriptversion=2014-01-07.03; # UTC +scriptversion=2015-10-07.11; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 @@ -1530,6 +1530,8 @@ { $debug_cmd + _G_rc_run_hooks=false + case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; @@ -1538,16 +1540,16 @@ eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do - eval $_G_hook '"$@"' - - # store returned options list back into positional - # parameters for next 'cmd' execution. - eval _G_hook_result=\$${_G_hook}_result - eval set dummy "$_G_hook_result"; shift + if eval $_G_hook '"$@"'; then + # store returned options list back into positional + # parameters for next 'cmd' execution. + eval _G_hook_result=\$${_G_hook}_result + eval set dummy "$_G_hook_result"; shift + _G_rc_run_hooks=: + fi done - func_quote_for_eval ${1+"$@"} - func_run_hooks_result=$func_quote_for_eval_result + $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result } @@ -1557,10 +1559,16 @@ ## --------------- ## # In order to add your own option parsing hooks, you must accept the -# full positional parameter list in your hook function, remove any -# options that you action, and then pass back the remaining unprocessed +# full positional parameter list in your hook function, you may remove/edit +# any options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for -# 'eval'. Like this: +# 'eval'. In this case you also must return $EXIT_SUCCESS to let the +# hook's caller know that it should pay attention to +# '_result'. Returning $EXIT_FAILURE signalizes that +# arguments are left untouched by the hook and therefore caller will ignore the +# result variable. +# +# Like this: # # my_options_prep () # { @@ -1570,9 +1578,11 @@ # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' -# -# func_quote_for_eval ${1+"$@"} -# my_options_prep_result=$func_quote_for_eval_result +# # No change in '$@' (ignored completely by this hook). There is +# # no need to do the equivalent (but slower) action: +# # func_quote_for_eval ${1+"$@"} +# # my_options_prep_result=$func_quote_for_eval_result +# false # } # func_add_hook func_options_prep my_options_prep # @@ -1581,25 +1591,37 @@ # { # $debug_cmd # +# args_changed=false +# # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in -# --silent|-s) opt_silent=: ;; +# --silent|-s) opt_silent=: +# args_changed=: +# ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift +# args_changed=: # ;; -# *) set dummy "$_G_opt" "$*"; shift; break ;; +# *) # Make sure the first unrecognised option "$_G_opt" +# # is added back to "$@", we could need that later +# # if $args_changed is true. +# set dummy "$_G_opt" ${1+"$@"}; shift; break ;; # esac # done # -# func_quote_for_eval ${1+"$@"} -# my_silent_option_result=$func_quote_for_eval_result +# if $args_changed; then +# func_quote_for_eval ${1+"$@"} +# my_silent_option_result=$func_quote_for_eval_result +# fi +# +# $args_changed # } # func_add_hook func_parse_options my_silent_option # @@ -1611,16 +1633,32 @@ # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # -# func_quote_for_eval ${1+"$@"} -# my_option_validation_result=$func_quote_for_eval_result +# false # } # func_add_hook func_validate_options my_option_validation # -# You'll alse need to manually amend $usage_message to reflect the extra +# You'll also need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. +# func_options_finish [ARG]... +# ---------------------------- +# Finishing the option parse loop (call 'func_options' hooks ATM). +func_options_finish () +{ + $debug_cmd + + _G_func_options_finish_exit=false + if func_run_hooks func_options ${1+"$@"}; then + func_options_finish_result=$func_run_hooks_result + _G_func_options_finish_exit=: + fi + + $_G_func_options_finish_exit +} + + # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the @@ -1630,17 +1668,28 @@ { $debug_cmd - func_options_prep ${1+"$@"} - eval func_parse_options \ - ${func_options_prep_result+"$func_options_prep_result"} - eval func_validate_options \ - ${func_parse_options_result+"$func_parse_options_result"} + _G_rc_options=false - eval func_run_hooks func_options \ - ${func_validate_options_result+"$func_validate_options_result"} + for my_func in options_prep parse_options validate_options options_finish + do + if eval func_$my_func '${1+"$@"}'; then + eval _G_res_var='$'"func_${my_func}_result" + eval set dummy "$_G_res_var" ; shift + _G_rc_options=: + fi + done - # save modified positional parameters for caller - func_options_result=$func_run_hooks_result + # Save modified positional parameters for caller. As a top-level + # options-parser function we always need to set the 'func_options_result' + # variable (regardless the $_G_rc_options value). + if $_G_rc_options; then + func_options_result=$_G_res_var + else + func_quote_for_eval ${1+"$@"} + func_options_result=$func_quote_for_eval_result + fi + + $_G_rc_options } @@ -1649,9 +1698,9 @@ # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and -# needs to propogate that back to rest of this script, then the complete +# needs to propagate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before -# returning. +# returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned). func_hookable func_options_prep func_options_prep () { @@ -1661,10 +1710,14 @@ opt_verbose=false opt_warning_types= - func_run_hooks func_options_prep ${1+"$@"} + _G_rc_options_prep=false + if func_run_hooks func_options_prep ${1+"$@"}; then + _G_rc_options_prep=: + # save modified positional parameters for caller + func_options_prep_result=$func_run_hooks_result + fi - # save modified positional parameters for caller - func_options_prep_result=$func_run_hooks_result + $_G_rc_options_prep } @@ -1678,18 +1731,20 @@ func_parse_options_result= + _G_rc_parse_options=false # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. - func_run_hooks func_parse_options ${1+"$@"} - - # Adjust func_parse_options positional parameters to match - eval set dummy "$func_run_hooks_result"; shift + if func_run_hooks func_parse_options ${1+"$@"}; then + eval set dummy "$func_run_hooks_result"; shift + _G_rc_parse_options=: + fi # Break out of the loop if we already parsed every option. test $# -gt 0 || break + _G_match_parse_options=: _G_opt=$1 shift case $_G_opt in @@ -1704,7 +1759,10 @@ ;; --warnings|--warning|-W) - test $# = 0 && func_missing_arg $_G_opt && break + if test $# = 0 && func_missing_arg $_G_opt; then + _G_rc_parse_options=: + break + fi case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above @@ -1757,15 +1815,25 @@ shift ;; - --) break ;; + --) _G_rc_parse_options=: ; break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; - *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + *) set dummy "$_G_opt" ${1+"$@"}; shift + _G_match_parse_options=false + break + ;; esac + + $_G_match_parse_options && _G_rc_parse_options=: done - # save modified positional parameters for caller - func_quote_for_eval ${1+"$@"} - func_parse_options_result=$func_quote_for_eval_result + + if $_G_rc_parse_options; then + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + func_parse_options_result=$func_quote_for_eval_result + fi + + $_G_rc_parse_options } @@ -1778,16 +1846,21 @@ { $debug_cmd + _G_rc_validate_options=false + # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" - func_run_hooks func_validate_options ${1+"$@"} + if func_run_hooks func_validate_options ${1+"$@"}; then + # save modified positional parameters for caller + func_validate_options_result=$func_run_hooks_result + _G_rc_validate_options=: + fi # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE - # save modified positional parameters for caller - func_validate_options_result=$func_run_hooks_result + $_G_rc_validate_options } @@ -2068,7 +2141,7 @@ compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) - version: $progname (GNU libtool) 2.4.6 + version: $progname $scriptversion Debian-2.4.6-9+local1 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` @@ -2270,6 +2343,8 @@ nonopt= preserve_args= + _G_rc_lt_options_prep=: + # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) @@ -2293,11 +2368,18 @@ uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; + *) + _G_rc_lt_options_prep=false + ;; esac - # Pass back the list of options. - func_quote_for_eval ${1+"$@"} - libtool_options_prep_result=$func_quote_for_eval_result + if $_G_rc_lt_options_prep; then + # Pass back the list of options. + func_quote_for_eval ${1+"$@"} + libtool_options_prep_result=$func_quote_for_eval_result + fi + + $_G_rc_lt_options_prep } func_add_hook func_options_prep libtool_options_prep @@ -2309,9 +2391,12 @@ { $debug_cmd + _G_rc_lt_parse_options=false + # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do + _G_match_lt_parse_options=: _G_opt=$1 shift case $_G_opt in @@ -2386,15 +2471,22 @@ func_append preserve_args " $_G_opt" ;; - # An option not handled by this hook function: - *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + # An option not handled by this hook function: + *) set dummy "$_G_opt" ${1+"$@"} ; shift + _G_match_lt_parse_options=false + break + ;; esac + $_G_match_lt_parse_options && _G_rc_lt_parse_options=: done + if $_G_rc_lt_parse_options; then + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + libtool_parse_options_result=$func_quote_for_eval_result + fi - # save modified positional parameters for caller - func_quote_for_eval ${1+"$@"} - libtool_parse_options_result=$func_quote_for_eval_result + $_G_rc_lt_parse_options } func_add_hook func_parse_options libtool_parse_options @@ -7275,10 +7367,11 @@ # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang # -fsanitize=* Clang/GCC memory and address sanitizer + # -fuse-ld=* Linker select flags for GCC -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ - -specs=*|-fsanitize=*) + -specs=*|-fsanitize=*|-fuse-ld=*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" diff -Nru mpfr4-3.1.4/m4/libtool.m4 mpfr4-4.0.2/m4/libtool.m4 --- mpfr4-3.1.4/m4/libtool.m4 2016-03-06 11:33:16.000000000 +0000 +++ mpfr4-4.0.2/m4/libtool.m4 2019-01-31 20:43:15.000000000 +0000 @@ -728,7 +728,6 @@ cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. @@ -4064,7 +4063,8 @@ if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD + if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -6441,7 +6441,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else GXX=no @@ -6816,7 +6816,7 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then @@ -6881,7 +6881,7 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then @@ -7220,7 +7220,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # FIXME: insert proper C++ library support @@ -7304,7 +7304,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. @@ -7315,7 +7315,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' diff -Nru mpfr4-3.1.4/m4/size_max.m4 mpfr4-4.0.2/m4/size_max.m4 --- mpfr4-3.1.4/m4/size_max.m4 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/m4/size_max.m4 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -# size_max.m4 serial 6 -dnl Copyright (C) 2003, 2005-2006, 2010, 2012 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. -dnl Change by Vincent Lefevre: added for consistency with MPFR -dnl Update with autoupdate. - -AC_DEFUN([gl_SIZE_MAX], -[ - AC_CHECK_HEADERS(stdint.h) - dnl First test whether the system already has SIZE_MAX. - AC_MSG_CHECKING([for SIZE_MAX]) - AC_CACHE_VAL([gl_cv_size_max], [ - gl_cv_size_max= - AC_EGREP_CPP([Found it], [ -#include -#ifdef HAVE_INTTYPES_H -# include -#endif -#if HAVE_STDINT_H -# include -#endif -#ifdef SIZE_MAX -Found it -#endif -], gl_cv_size_max=yes) - if test -z "$gl_cv_size_max"; then - dnl Define it ourselves. Here we assume that the type 'size_t' is not wider - dnl than the type 'unsigned long'. Try hard to find a definition that can - dnl be used in a preprocessor #if, i.e. doesn't contain a cast. - AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1], - [#include -#include ], size_t_bits_minus_1=) - AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)], - [#include ], fits_in_uint=) - if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then - if test $fits_in_uint = 1; then - dnl Even though SIZE_MAX fits in an unsigned int, it must be of type - dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include - extern size_t foo; - extern unsigned long foo; - ]], [[]])], fits_in_uint=0) - fi - dnl We cannot use 'expr' to simplify this expression, because 'expr' - dnl works only with 'long' integers in the host environment, while we - dnl might be cross-compiling from a 32-bit platform to a 64-bit platform. - if test $fits_in_uint = 1; then - gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" - else - gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" - fi - else - dnl Shouldn't happen, but who knows... - gl_cv_size_max='((size_t)~(size_t)0)' - fi - fi - ]) - AC_MSG_RESULT([$gl_cv_size_max]) - if test "$gl_cv_size_max" != yes; then - AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max], - [Define as the maximum value of type 'size_t', if the system doesn't define it.]) - fi -]) - -dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. -dnl Remove this when we can assume autoconf >= 2.61. -m4_ifdef([AC_COMPUTE_INT], [], [ - AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) -]) diff -Nru mpfr4-3.1.4/Makefile.am mpfr4-4.0.2/Makefile.am --- mpfr4-3.1.4/Makefile.am 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/Makefile.am 2019-01-01 21:02:47.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright 2000-2016 Free Software Foundation, Inc. +# Copyright 2000-2019 Free Software Foundation, Inc. # This Makefile.am is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -18,17 +18,23 @@ # old Automake version. ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = doc src tests tune +SUBDIRS = doc src tests tune tools/bench + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = mpfr.pc nobase_dist_doc_DATA = AUTHORS BUGS COPYING COPYING.LESSER NEWS TODO \ examples/ReadMe examples/divworst.c examples/rndo-add.c examples/sample.c \ - examples/version.c + examples/version.c examples/can_round.c -EXTRA_DIST = PATCHES VERSION \ - tools/ck-copyright-notice tools/ck-news tools/ck-version-info \ - tools/get_patches.sh \ +EXTRA_DIST = PATCHES VERSION doc/README.dev doc/check-typography \ + tools/ck-clz_tab tools/ck-copyright-notice tools/ck-news \ + tools/ck-version-info tools/get_patches.sh \ $(DATAFILES) +bench: + cd tools/bench && $(MAKE) $(AM_MAKEFLAGS) bench + # Various checks for "make dist". # * Check consistency concerning -version-info. Moreover if the VERSION # file doesn't end with "-dev", check that the -version-info value is @@ -39,3 +45,18 @@ cd $(srcdir) && tools/ck-version-info cd $(srcdir) && tools/ck-copyright-notice cd $(srcdir) && tools/ck-news + cd $(srcdir) && tools/ck-clz_tab + cd $(srcdir)/doc && ./check-typography + +# Check that MPFR does not use GMP internal symbols. Of course, do not run +# this rule if you use --with-gmp-build or --enable-gmp-internals. +# This test does nothing if no libmpfr.so is generated. +check-gmp-symbols: + cd src && $(MAKE) check-gmp-symbols + +# Check that MPFR does not define symbols with a GMP reserved prefix. +# This test does nothing if no libmpfr.so is generated. +check-exported-symbols: + cd src && $(MAKE) check-exported-symbols + +.PHONY: check-gmp-symbols check-exported-symbols diff -Nru mpfr4-3.1.4/Makefile.in mpfr4-4.0.2/Makefile.in --- mpfr4-3.1.4/Makefile.in 2016-03-06 11:33:18.000000000 +0000 +++ mpfr4-4.0.2/Makefile.in 2019-01-31 20:43:20.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,7 +14,7 @@ @SET_MAKE@ -# Copyright 2000-2016 Free Software Foundation, Inc. +# Copyright 2000-2019 Free Software Foundation, Inc. # This Makefile.am is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -103,8 +103,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ @@ -113,7 +112,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = +CONFIG_CLEAN_FILES = mpfr.pc CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) @@ -169,8 +168,8 @@ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } -am__installdirs = "$(DESTDIR)$(docdir)" -DATA = $(nobase_dist_doc_DATA) +am__installdirs = "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgconfigdir)" +DATA = $(nobase_dist_doc_DATA) $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ @@ -178,7 +177,7 @@ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - cscope distdir dist dist-all distcheck + cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is @@ -200,9 +199,10 @@ CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) -am__DIST_COMMON = $(srcdir)/Makefile.in AUTHORS COPYING COPYING.LESSER \ - ChangeLog INSTALL NEWS README TODO ar-lib compile config.guess \ - config.sub install-sh ltmain.sh missing +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/mpfr.pc.in AUTHORS \ + COPYING COPYING.LESSER ChangeLog INSTALL NEWS README TODO \ + ar-lib compile config.guess config.sub install-sh ltmain.sh \ + missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -296,6 +296,7 @@ MKDIR_P = @MKDIR_P@ MPFR_LDFLAGS = @MPFR_LDFLAGS@ MPFR_LIBM = @MPFR_LIBM@ +MPFR_LIBQUADMATH = @MPFR_LIBQUADMATH@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -310,6 +311,9 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -329,6 +333,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -378,14 +383,16 @@ # libtoolize and in case some developer needs to switch back to an # old Automake version. ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = doc src tests tune +SUBDIRS = doc src tests tune tools/bench +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = mpfr.pc nobase_dist_doc_DATA = AUTHORS BUGS COPYING COPYING.LESSER NEWS TODO \ examples/ReadMe examples/divworst.c examples/rndo-add.c examples/sample.c \ - examples/version.c + examples/version.c examples/can_round.c -EXTRA_DIST = PATCHES VERSION \ - tools/ck-copyright-notice tools/ck-news tools/ck-version-info \ - tools/get_patches.sh \ +EXTRA_DIST = PATCHES VERSION doc/README.dev doc/check-typography \ + tools/ck-clz_tab tools/ck-copyright-notice tools/ck-news \ + tools/ck-version-info tools/get_patches.sh \ $(DATAFILES) all: all-recursive @@ -412,8 +419,8 @@ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -424,6 +431,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): +mpfr.pc: $(top_builddir)/config.status $(srcdir)/mpfr.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo @@ -457,6 +466,27 @@ @list='$(nobase_dist_doc_DATA)'; test -n "$(docdir)" || list=; \ $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. @@ -564,7 +594,10 @@ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -632,7 +665,7 @@ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 @@ -656,7 +689,7 @@ @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip @@ -673,7 +706,7 @@ distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ @@ -683,7 +716,7 @@ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac @@ -757,7 +790,7 @@ all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: - for dir in "$(DESTDIR)$(docdir)"; do \ + for dir in "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive @@ -812,7 +845,7 @@ info-am: -install-data-am: install-nobase_dist_docDATA +install-data-am: install-nobase_dist_docDATA install-pkgconfigDATA install-dvi: install-dvi-recursive @@ -858,7 +891,7 @@ ps-am: -uninstall-am: uninstall-nobase_dist_docDATA +uninstall-am: uninstall-nobase_dist_docDATA uninstall-pkgconfigDATA .MAKE: $(am__recursive_targets) install-am install-strip @@ -873,16 +906,20 @@ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-nobase_dist_docDATA \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am tags tags-am uninstall uninstall-am \ - uninstall-nobase_dist_docDATA + install-pdf install-pdf-am install-pkgconfigDATA install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-nobase_dist_docDATA \ + uninstall-pkgconfigDATA .PRECIOUS: Makefile +bench: + cd tools/bench && $(MAKE) $(AM_MAKEFLAGS) bench + # Various checks for "make dist". # * Check consistency concerning -version-info. Moreover if the VERSION # file doesn't end with "-dev", check that the -version-info value is @@ -893,6 +930,21 @@ cd $(srcdir) && tools/ck-version-info cd $(srcdir) && tools/ck-copyright-notice cd $(srcdir) && tools/ck-news + cd $(srcdir) && tools/ck-clz_tab + cd $(srcdir)/doc && ./check-typography + +# Check that MPFR does not use GMP internal symbols. Of course, do not run +# this rule if you use --with-gmp-build or --enable-gmp-internals. +# This test does nothing if no libmpfr.so is generated. +check-gmp-symbols: + cd src && $(MAKE) check-gmp-symbols + +# Check that MPFR does not define symbols with a GMP reserved prefix. +# This test does nothing if no libmpfr.so is generated. +check-exported-symbols: + cd src && $(MAKE) check-exported-symbols + +.PHONY: check-gmp-symbols check-exported-symbols # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru mpfr4-3.1.4/missing mpfr4-4.0.2/missing --- mpfr4-3.1.4/missing 2016-03-06 11:33:18.000000000 +0000 +++ mpfr4-4.0.2/missing 2019-01-31 20:43:20.000000000 +0000 @@ -1,9 +1,9 @@ #! /bin/sh # Common wrapper for a few potentially missing GNU programs. -scriptversion=2013-10-28.13; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -101,9 +101,9 @@ exit $st fi -perl_URL=http://www.perl.org/ -flex_URL=http://flex.sourceforge.net/ -gnu_software_URL=http://www.gnu.org/software +perl_URL=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://www.gnu.org/software program_details () { @@ -207,9 +207,9 @@ exit $st # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff -Nru mpfr4-3.1.4/mpfr.pc.in mpfr4-4.0.2/mpfr.pc.in --- mpfr4-3.1.4/mpfr.pc.in 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/mpfr.pc.in 2018-05-31 14:41:37.000000000 +0000 @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: mpfr +URL: https://www.mpfr.org/ +Description: C library for multiple-precision floating-point computations +Version: @PACKAGE_VERSION@ +Libs: -L${libdir} -lmpfr -lgmp +Cflags: -I${includedir} diff -Nru mpfr4-3.1.4/NEWS mpfr4-4.0.2/NEWS --- mpfr4-3.1.4/NEWS 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/NEWS 2019-01-31 20:33:50.000000000 +0000 @@ -1,4 +1,4 @@ -Copyright 2000-2016 Free Software Foundation, Inc. +Copyright 2000-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -15,32 +15,139 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. ############################################################################## -Changes from version 3.1.3 to version 3.1.4: -- Improved MPFR manual. -- Bug fixes (see and ChangeLog file). -- MinGW (MS Windows): Added support for thread-safe DLL (shared library). +Changes from version 4.0.1 to version 4.0.2: +- Corrected minimal GMP version in the INSTALL file and the MPFR manual. +- Option -pedantic is now always removed from __GMP_CFLAGS (see INSTALL). +- Shared caches: cleanup; really detect lock failures (abort in this case). +- Improved MPFR manual. In particular, corrected/completed the + mpfr_get_str description in order to follow the historical behavior + and GMP's mpf_get_str function. +- Bug fixes (see ChangeLog file). -Changes from version 3.1.2 to version 3.1.3: -- Better support for Automake 1.13+ (now used to generate the tarball). +Changes from version 4.0.0 to version 4.0.1: - Improved MPFR manual. -- Bug fixes (see and ChangeLog file). - -Changes from version 3.1.1 to version 3.1.2: -- Bug fixes (see or ChangeLog file). -- Updated examples to the MPFR 3.x API. -- Note: The official tarballs for MPFR up to 3.1.1 were affected by a - vulnerability for "make distcheck" due to a bug in old GNU Automake - versions: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-3386 - -Changes from version 3.1.0 to version 3.1.1: +- Improved __GMP_CC and __GMP_CFLAGS retrieval (in particular for MS Windows). +- Fixed a build failure on some platforms when --with-gmp-build is used. +- Bug fixes (see ChangeLog file), in particular in mpfr_div_ui, which + could yield an incorrectly rounded result to nearest when using + different precisions; this bug had been present since the introduction + of mpfr_div_ui, and in MPFR 4.0.0, it was affecting mpfr_div too. +- New: optional "make check-exported-symbols", mainly for the MPFR developers + and binary distributions, to check that MPFR does not define symbols with a + GMP reserved prefix (experimental). + +Changes from versions 3.1.* to version 4.0.0: +- The "dinde aux marrons" release. +- MPFR now depends on GMP 5.0+ instead of 4.1+. +- API change: + Applications that call GMP's mp_set_memory_functions function to change + the allocators must first call the new function mpfr_mp_memory_cleanup + in all threads where MPFR is potentially used; this new function is + currently equivalent to mpfr_free_cache. + The reason is that the way memory allocation is done by MPFR has changed + (again), so that the current GMP allocators are used (since for some + applications, the old allocators may become invalid). + Note: Freeing the caches like this might have a performance impact on some + particular applications; if this is an issue, this could be handled for a + future MPFR version. +- Mini-gmp support via the --enable-mini-gmp configure option (experimental). +- The minimum precision MPFR_PREC_MIN is now 1, with rounding defined as + in the errata of IEEE 754-2008 and in the following IEEE 754 revision + (ties rounded away from zero). +- Shared caches for multithreaded applications. + New function mpfr_free_cache2. +- Partial support of MPFR_RNDF (faithful rounding). +- New functions: mpfr_fpif_export and mpfr_fpif_import to export and import + numbers in a floating-point interchange format, independent both on the + number of bits per word and on the endianness. +- New function mpfr_fmodquo to return the low bits of the quotient + corresponding to mpfr_fmod. +- New functions mpfr_flags_clear, mpfr_flags_set, mpfr_flags_test, + mpfr_flags_save and mpfr_flags_restore to operate on groups of flags. +- New functions mpfr_set_float128 and mpfr_get_float128 to convert from/to + the __float128 type (requires --enable-float128 and compiler support). +- New functions mpfr_buildopt_float128_p and mpfr_buildopt_sharedcache_p. +- New functions mpfr_rint_roundeven and mpfr_roundeven, completing the + other similar round-to-integer functions for rounding to nearest with + the even-rounding rule. +- New macro mpfr_round_nearest_away to add partial emulation of the + rounding to nearest-away (as defined in IEEE 754-2008). +- New functions mpfr_nrandom and mpfr_erandom to generate random numbers + following normal and exponential distributions respectively. +- New functions mpfr_fmma and mpfr_fmms to compute a*b+c*d and a*b-c*d. +- New function mpfr_rootn_ui, similar to mpfr_root, but agreeing with the + rootn function of the IEEE 754-2008 standard. +- New functions mpfr_log_ui to compute the logarithm of an integer, + mpfr_gamma_inc for the incomplete Gamma function. +- New function mpfr_beta for the Beta function (incomplete, experimental). +- New function mpfr_get_q to convert a floating-point number into rational. +- The mpfr_dump function is now described in the manual; its output format + has slightly changed. +- The mpfr_eint function now returns the value of the E1/eint1 function + for negative argument. +- The behavior of the mpfr_set_exp function changed, as it could easily + yield undefined behavior in some cases (this modifies both the API and + the ABI). +- In function mpfr_urandom, the next random state no longer depends on the + current exponent range and the rounding mode. The exceptions due to the + rounding of the random number are now correctly generated, following the + uniform distribution. +- Functions mpfr_grandom and mpfr_root are deprecated and will be removed + in a future release. +- Complete rewrite of function mpfr_sum, which now works in all cases (the + old one could take all the memory and/or crash with inputs of different + magnitudes in case of huge cancellation or table maker's dilemma). The + sign of an exact zero result is now specified, and the return value is + now the usual ternary value. Note that the position of "const" in the + mpfr_sum prototype has been fixed (the manual was correct); user code + should not be affected. +- Old, deprecated macros mpfr_add_one_ulp and mpfr_sub_one_ulp removed. + The mpfr_next* functions should be used instead. +- Internally, improved caching: a minimum of 10% increase of the precision + is guaranteed to avoid too many recomputations. +- Added internal small-precision mpz_t pool, which aims to avoid the + overhead of memory allocation, in particular. + New function mpfr_free_pool. +- Added configure option --enable-assert=none to avoid checking any assertion. +- The --enable-decimal-float configure option no longer requires + --with-gmp-build, and support for decimal floats is now automatically + detected by default (similarly for support for __float128). +- Updated tuning parameters. +- Better support for Automake 1.13+ (now used to generate the tarball). +- Dropped K&R C compatibility. - Improved MPFR manual. -- Test coverage: 96.5% lines of code. -- Bug fixes (see or ChangeLog file). +- New MPFRbench program (see the tools/bench directory). +- Major speedup in mpfr_add, mpfr_sub, mpfr_mul, mpfr_div and mpfr_sqrt when + all operands have the same precision and this precision is less than twice + the number of bits per word, e.g., less than 128 on a 64-bit computer. +- Speedup by a factor of almost 2 in the double <--> mpfr conversions + (mpfr_set_d and mpfr_get_d). +- Speedup in mpfr_log1p and mpfr_atanh for small arguments. +- Speedup in the mpfr_const_euler function (contributed by Fredrik Johansson), + in the computation of Bernoulli numbers (used in mpfr_gamma, mpfr_li2, + mpfr_digamma, mpfr_lngamma and mpfr_lgamma), in mpfr_div, in mpfr_fma + and mpfr_fms. +- Test coverage: 96.3% lines of code. +- Bug fixes. In particular: a speed improvement when the --enable-assert + or --enable-assert=full configure option is used with GCC; mpfr_get_str + now sets the NaN flag on NaN input and the inexact flag when the conversion + is inexact. For a full list, see http://www.mpfr.org/mpfr-3.1.6/#fixed + and the same section for any previous 3.1.x version (follow the links + in the "Changes..." sections). +- Microsoft Windows: Added support for thread-safe DLL (shared library). + Tested with MinGW, ICC and MSVC. +- Limited pkg-config support. +- Autotools: Under Linux, make sure that the old dtags (when supported) + are used if LD_LIBRARY_PATH is defined; otherwise "make check" would + check an installed, compatible MPFR library found in LD_LIBRARY_PATH + instead of the one that has been built with "make". +- New: optional "make check-gmp-symbols", mainly for binary distributions, + to check that MPFR does not use GMP internal symbols (experimental). Changes from versions 3.0.* to version 3.1.0: - The "canard à l'orange" release. @@ -55,7 +162,7 @@ - The mpfr_urandom and mpfr_urandomb functions now return identical values on processors with different word size (assuming the same random seed, and since the GMP random generator does not depend itself on the word size, - cf http://gmplib.org/list-archives/gmp-devel/2010-September/001642.html). + cf https://gmplib.org/list-archives/gmp-devel/2010-September/001642.html). - The mpfr_add_one_ulp and mpfr_sub_one_ulp macros (which are obsolete and no more documented) will be removed in a future release. - Speed improvement for the mpfr_sqr and mpfr_div functions using Mulders' diff -Nru mpfr4-3.1.4/README mpfr4-4.0.2/README --- mpfr4-3.1.4/README 2016-03-06 11:33:02.000000000 +0000 +++ mpfr4-4.0.2/README 2019-01-07 13:53:20.000000000 +0000 @@ -1,4 +1,4 @@ -Copyright 2000-2016 Free Software Foundation, Inc. +Copyright 2000-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. ############################################################################## @@ -41,12 +41,13 @@ config.* - auxiliary installation files configure* - configuration files depcomp - auxiliary installation file -doc/ - directory containing the documentation (manual, FAQ) +doc/ - directory containing documentation (manual, FAQ, etc.) examples/ - directory containing examples install-sh - installation file ltmain.sh - auxiliary installation file m4/ - directory containing additional configuration files missing - auxiliary installation file +mpfr.pc.in - auxiliary pkg-config file src/ - directory containing the MPFR source test-driver - auxiliary installation file tests/ - directory containing the testsuite (for "make check") @@ -85,5 +86,5 @@ but interesting general information can be found there); * http://subversion.apache.org/faq.html (the Subversion FAQ). -Subversion users should read the file "doc/README.dev" (provided via -SVN only). +Subversion users should read the file "doc/README.dev" (in the +source tree). diff -Nru mpfr4-3.1.4/src/abort_prec_max.c mpfr4-4.0.2/src/abort_prec_max.c --- mpfr4-3.1.4/src/abort_prec_max.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/abort_prec_max.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_abort_prec_max -- Abort due to maximal precision overflow. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,14 +17,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include - #include "mpfr-impl.h" -void mpfr_abort_prec_max (void) +MPFR_COLD_FUNCTION_ATTR MPFR_NORETURN void +mpfr_abort_prec_max (void) { fprintf (stderr, "MPFR: Maximal precision overflow\n"); abort (); diff -Nru mpfr4-3.1.4/src/acos.c mpfr4-4.0.2/src/acos.c --- mpfr4-3.1.4/src/acos.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/acos.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_acos -- arc-cosinus of a floating-point number -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -75,7 +75,7 @@ } else { - if (MPFR_IS_POS_SIGN (sign)) /* acos(+1) = 0 */ + if (MPFR_IS_POS_SIGN (sign)) /* acos(+1) = +0 */ return mpfr_set_ui (acos, 0, rnd_mode); else /* acos(-1) = Pi */ return mpfr_const_pi (acos, rnd_mode); diff -Nru mpfr4-3.1.4/src/acosh.c mpfr4-4.0.2/src/acosh.c --- mpfr4-3.1.4/src/acosh.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/acosh.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_acosh -- inverse hyperbolic cosine -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -62,7 +62,7 @@ } else if (MPFR_UNLIKELY (comp == 0)) { - MPFR_SET_ZERO (y); /* acosh(1) = 0 */ + MPFR_SET_ZERO (y); /* acosh(1) = +0 */ MPFR_SET_POS (y); MPFR_RET (0); } diff -Nru mpfr4-3.1.4/src/add1.c mpfr4-4.0.2/src/add1.c --- mpfr4-3.1.4/src/add1.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/add1.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_add1 -- internal function to perform a "real" addition -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,32 +17,44 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" -/* compute sign(b) * (|b| + |c|), assuming b and c have same sign, - and are not NaN, Inf, nor zero. */ -int +/* compute sign(b) * (|b| + |c|), assuming that b and c + are not NaN, Inf, nor zero. Assumes EXP(b) >= EXP(c). +*/ +MPFR_HOT_FUNCTION_ATTR int mpfr_add1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) { mp_limb_t *ap, *bp, *cp; mpfr_prec_t aq, bq, cq, aq2; mp_size_t an, bn, cn; - mpfr_exp_t difw, exp; + mpfr_exp_t difw, exp, diff_exp; int sh, rb, fb, inex; - mpfr_uexp_t diff_exp; MPFR_TMP_DECL(marker); - MPFR_ASSERTD(MPFR_IS_PURE_FP(b)); - MPFR_ASSERTD(MPFR_IS_PURE_FP(c)); + MPFR_ASSERTD (MPFR_IS_PURE_UBF (b)); + MPFR_ASSERTD (MPFR_IS_PURE_UBF (c)); + MPFR_ASSERTD (! MPFR_UBF_EXP_LESS_P (b, c)); + + if (MPFR_UNLIKELY (MPFR_IS_UBF (b))) + { + exp = mpfr_ubf_zexp2exp (MPFR_ZEXP (b)); + if (exp > __gmpfr_emax) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN (b));; + } + else + exp = MPFR_GET_EXP (b); + + MPFR_ASSERTD (exp <= __gmpfr_emax); MPFR_TMP_MARK(marker); - aq = MPFR_PREC(a); - bq = MPFR_PREC(b); - cq = MPFR_PREC(c); + aq = MPFR_GET_PREC (a); + bq = MPFR_GET_PREC (b); + cq = MPFR_GET_PREC (c); an = MPFR_PREC2LIMBS (aq); /* number of limbs of a */ aq2 = (mpfr_prec_t) an * GMP_NUMB_BITS; @@ -62,19 +74,24 @@ if (ap == cp) { cp = bp; } } - else if (MPFR_UNLIKELY(ap == cp)) + else if (ap == cp) { cp = MPFR_TMP_LIMBS_ALLOC (cn); MPN_COPY(cp, ap, cn); } - exp = MPFR_GET_EXP (b); MPFR_SET_SAME_SIGN(a, b); MPFR_UPDATE2_RND_MODE(rnd_mode, MPFR_SIGN(b)); - /* now rnd_mode is either MPFR_RNDN, MPFR_RNDZ or MPFR_RNDA */ - /* Note: exponents can be negative, but the unsigned subtraction is - a modular subtraction, so that one gets the correct result. */ - diff_exp = (mpfr_uexp_t) exp - MPFR_GET_EXP(c); + /* now rnd_mode is either MPFR_RNDN, MPFR_RNDZ, MPFR_RNDA or MPFR_RNDF. */ + if (MPFR_UNLIKELY (MPFR_IS_UBF (c))) + { + MPFR_STAT_STATIC_ASSERT (MPFR_EXP_MAX > MPFR_PREC_MAX); + diff_exp = mpfr_ubf_diff_exp (b, c); + } + else + diff_exp = exp - MPFR_GET_EXP (c); + + MPFR_ASSERTD (diff_exp >= 0); /* * 1. Compute the significant part A', the non-significant bits of A @@ -153,7 +170,7 @@ MPN_COPY(a2p - difn, cp + (cn - difn), difn); /* add b to a */ - cc = MPFR_UNLIKELY(an > bn) + cc = an > bn ? mpn_add_n(ap + (an - bn), ap + (an - bn), bp, bn) : mpn_add_n(ap, ap, bp + (bn - an), an); @@ -185,7 +202,7 @@ } /* cc */ } /* aq2 > diff_exp */ - /* non-significant bits of a */ + /* zero the non-significant bits of a */ if (MPFR_LIKELY(rb < 0 && sh)) { mp_limb_t mask, bb; @@ -207,7 +224,11 @@ } } - /* determine rounding and sticky bits (and possible carry) */ + /* Determine rounding and sticky bits (and possible carry). + In faithful rounding, we may stop two bits after ulp(a): + the approximation is regarded as the number formed by a, + the rounding bit rb and an additional bit fb; and the + corresponding error is < 1/2 ulp of the unrounded result. */ difw = (mpfr_exp_t) an - (mpfr_exp_t) (diff_exp / GMP_NUMB_BITS); /* difw is the number of limbs from b (regarded as having an infinite @@ -234,12 +255,13 @@ MPFR_ASSERTD(fb != 0); if (fb > 0) { - if (bb != MP_LIMB_T_MAX) - { - fb = 1; /* c hasn't been taken into account - ==> sticky bit != 0 */ - goto rounding; - } + /* Note: Here, we can round to nearest, but the loop may still + be necessary to determine whether there is a carry from c, + which will have an effect on the ternary value. However, in + faithful rounding, we do not have to determine the ternary + value, so that we can end the loop here. */ + if (bb != MPFR_LIMB_MAX || rnd_mode == MPFR_RNDF) + goto rounding; } else /* fb not initialized yet */ { @@ -249,7 +271,7 @@ bb |= MPFR_LIMB_HIGHBIT; } fb = 1; - if (bb != MP_LIMB_T_MAX) + if (bb != MPFR_LIMB_MAX) goto rounding; } @@ -318,10 +340,16 @@ } fb = bb != 0; - if (fb && bb != MP_LIMB_T_MAX) + if (fb && bb != MPFR_LIMB_MAX) goto rounding; } /* fb < 0 */ + /* At least two bits after ulp(a) have been read, which is + sufficient for faithful rounding, as we do not need to + determine on which side of a breakpoint the result is. */ + if (rnd_mode == MPFR_RNDF) + goto rounding; + while (bk > 0) { mp_limb_t bb, cc; @@ -368,7 +396,7 @@ fb = 1; goto rounding; } - if (fb && bb != MP_LIMB_T_MAX) + if (fb && bb != MPFR_LIMB_MAX) goto rounding; } /* while */ @@ -406,7 +434,7 @@ } fb = bb != 0; } /* fb < 0 */ - if (fb) + if (fb || rnd_mode == MPFR_RNDF) goto rounding; while (bk) { @@ -458,6 +486,11 @@ rb = cc >> (GMP_NUMB_BITS - 1); cc &= ~MPFR_LIMB_HIGHBIT; } + if (cc == 0 && rnd_mode == MPFR_RNDF) + { + fb = 0; + goto rounding; + } while (cc == 0) { if (ck == 0) @@ -473,8 +506,8 @@ } /* fb != 1 */ rounding: - /* rnd_mode should be one of MPFR_RNDN, MPFR_RNDZ or MPFR_RNDA */ - if (MPFR_LIKELY(rnd_mode == MPFR_RNDN)) + /* rnd_mode should be one of MPFR_RNDN, MPFR_RNDF, MPFR_RNDZ or MPFR_RNDA */ + if (MPFR_LIKELY(rnd_mode == MPFR_RNDN || rnd_mode == MPFR_RNDF)) { if (fb == 0) { @@ -530,6 +563,15 @@ } set_exponent: + if (MPFR_UNLIKELY (exp < __gmpfr_emin)) /* possible if b and c are UBF's */ + { + if (rnd_mode == MPFR_RNDN && + (exp < __gmpfr_emin - 1 || + (inex >= 0 && mpfr_powerof2_raw (a)))) + rnd_mode = MPFR_RNDZ; + inex = mpfr_underflow (a, rnd_mode, MPFR_SIGN(a)); + goto end_of_add; + } MPFR_SET_EXP (a, exp); end_of_add: diff -Nru mpfr4-3.1.4/src/add1sp.c mpfr4-4.0.2/src/add1sp.c --- mpfr4-3.1.4/src/add1sp.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/add1sp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_add1sp -- internal function to perform a "real" addition All the op must have the same precision -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,22 +18,27 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* Check if we have to check the result of mpfr_add1sp with mpfr_add1 */ -#ifdef MPFR_WANT_ASSERT -# if MPFR_WANT_ASSERT >= 2 +#if MPFR_WANT_ASSERT >= 2 -int mpfr_add1sp2 (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); +int mpfr_add1sp_ref (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); int mpfr_add1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) { - mpfr_t tmpa, tmpb, tmpc; + mpfr_t tmpa, tmpb, tmpc, tmpd; + mpfr_flags_t old_flags, flags, flags2; int inexb, inexc, inexact, inexact2; + if (rnd_mode == MPFR_RNDF) + return mpfr_add1sp_ref (a, b, c, rnd_mode); + + old_flags = __gmpfr_flags; + mpfr_init2 (tmpa, MPFR_PREC (a)); mpfr_init2 (tmpb, MPFR_PREC (b)); mpfr_init2 (tmpc, MPFR_PREC (c)); @@ -44,10 +49,26 @@ inexc = mpfr_set (tmpc, c, MPFR_RNDN); MPFR_ASSERTN (inexc == 0); - inexact2 = mpfr_add1 (tmpa, tmpb, tmpc, rnd_mode); - inexact = mpfr_add1sp2 (a, b, c, rnd_mode); + MPFR_ASSERTN (__gmpfr_flags == old_flags); + + if (MPFR_GET_EXP (tmpb) < MPFR_GET_EXP (tmpc)) + { + /* The sign for the result will be taken from the second argument + (= first input value, which is tmpb). */ + MPFR_ALIAS (tmpd, tmpc, MPFR_SIGN (tmpb), MPFR_EXP (tmpc)); + inexact2 = mpfr_add1 (tmpa, tmpd, tmpb, rnd_mode); + } + else + { + inexact2 = mpfr_add1 (tmpa, tmpb, tmpc, rnd_mode); + } + flags2 = __gmpfr_flags; + + __gmpfr_flags = old_flags; + inexact = mpfr_add1sp_ref (a, b, c, rnd_mode); + flags = __gmpfr_flags; - if (mpfr_cmp (tmpa, a) || inexact != inexact2) + if (! mpfr_equal_p (tmpa, a) || inexact != inexact2 || flags != flags2) { fprintf (stderr, "add1 & add1sp return different values for %s\n" "Prec_a = %lu, Prec_b = %lu, Prec_c = %lu\nB = ", @@ -55,37 +76,549 @@ (unsigned long) MPFR_PREC (a), (unsigned long) MPFR_PREC (b), (unsigned long) MPFR_PREC (c)); - mpfr_fprint_binary (stderr, tmpb); - fprintf (stderr, "\nC = "); - mpfr_fprint_binary (stderr, tmpc); - fprintf (stderr, "\n\nadd1 : "); - mpfr_fprint_binary (stderr, tmpa); - fprintf (stderr, "\nadd1sp: "); - mpfr_fprint_binary (stderr, a); - fprintf (stderr, "\nInexact sp = %d | Inexact = %d\n", - inexact, inexact2); + mpfr_fdump (stderr, tmpb); + fprintf (stderr, "C = "); + mpfr_fdump (stderr, tmpc); + fprintf (stderr, "\nadd1 : "); + mpfr_fdump (stderr, tmpa); + fprintf (stderr, "add1sp: "); + mpfr_fdump (stderr, a); + fprintf (stderr, "Inexact sp = %d | Inexact = %d\n" + "Flags sp = %u | Flags = %u\n", + inexact, inexact2, flags, flags2); MPFR_ASSERTN (0); } mpfr_clears (tmpa, tmpb, tmpc, (mpfr_ptr) 0); return inexact; } -# define mpfr_add1sp mpfr_add1sp2 -# endif -#endif +# define mpfr_add1sp mpfr_add1sp_ref +#endif /* MPFR_WANT_ASSERT >= 2 */ -/* Debugging support */ -#ifdef DEBUG -# undef DEBUG -# define DEBUG(x) (x) -#else -# define DEBUG(x) /**/ -#endif +#if !defined(MPFR_GENERIC_ABI) + +/* same as mpfr_add1sp, but for p < GMP_NUMB_BITS */ +static int +mpfr_add1sp1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode, + mpfr_prec_t p) +{ + mpfr_exp_t bx = MPFR_GET_EXP (b); + mpfr_exp_t cx = MPFR_GET_EXP (c); + mp_limb_t *ap = MPFR_MANT(a); + mp_limb_t *bp = MPFR_MANT(b); + mp_limb_t *cp = MPFR_MANT(c); + mpfr_prec_t sh = GMP_NUMB_BITS - p; + mp_limb_t rb; /* round bit */ + mp_limb_t sb; /* sticky bit */ + mp_limb_t a0; /* to store the result */ + mp_limb_t mask; + mpfr_uexp_t d; + + MPFR_ASSERTD(p < GMP_NUMB_BITS); -/* compute sign(b) * (|b| + |c|) + if (bx == cx) + { + /* The following line is probably better than + a0 = MPFR_LIMB_HIGHBIT | ((bp[0] + cp[0]) >> 1); + as it has less dependency and doesn't need a long constant on some + processors. On ARM, it can also probably benefit from shift-and-op + in a better way. Timings cannot be conclusive. */ + a0 = (bp[0] >> 1) + (cp[0] >> 1); + bx ++; + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + ap[0] = a0 ^ rb; + sb = 0; /* since b + c fits on p+1 bits, the sticky bit is zero */ + } + else if (bx > cx) + { + BGreater1: + d = (mpfr_uexp_t) bx - cx; + mask = MPFR_LIMB_MASK(sh); + /* TODO: Should the case d < sh be removed, i.e. seen as a particular + case of d < GMP_NUMB_BITS? This case would do a bit more operations + but a test would be removed, avoiding pipeline stall issues. */ + if (d < sh) + { + /* we can shift c by d bits to the right without losing any bit, + moreover we can shift one more if there is an exponent increase */ + a0 = bp[0] + (cp[0] >> d); + if (a0 < bp[0]) /* carry */ + { + MPFR_ASSERTD ((a0 & 1) == 0); + a0 = MPFR_LIMB_HIGHBIT | (a0 >> 1); + bx ++; + } + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb = (a0 & mask) ^ rb; + ap[0] = a0 & ~mask; + } + else if (d < GMP_NUMB_BITS) /* sh <= d < GMP_NUMB_BITS */ + { + sb = cp[0] << (GMP_NUMB_BITS - d); /* bits from cp[-1] after shift */ + a0 = bp[0] + (cp[0] >> d); + if (a0 < bp[0]) /* carry */ + { + sb |= a0 & 1; + a0 = MPFR_LIMB_HIGHBIT | (a0 >> 1); + bx ++; + } + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (a0 & mask) ^ rb; + ap[0] = a0 & ~mask; + } + else /* d >= GMP_NUMB_BITS */ + { + ap[0] = bp[0]; + rb = 0; /* since p < GMP_NUMB_BITS */ + sb = 1; /* since c <> 0 */ + } + } + else /* bx < cx: swap b and c */ + { + mpfr_exp_t tx; + mp_limb_t *tp; + tx = bx; bx = cx; cx = tx; + tp = bp; bp = cp; cp = tp; + goto BGreater1; + } + + /* Note: we could keep the output significand in a0 for the rounding, + and only store it in ap[0] at the very end, but this seems slower + on average (but better for the worst case). */ + + /* now perform rounding */ + if (MPFR_UNLIKELY(bx > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); + + MPFR_SET_EXP (a, bx); + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + MPFR_RET(0); + else if (rnd_mode == MPFR_RNDN) + { + /* the condition below should be rb == 0 || (rb != 0 && ...), but this + is equivalent to rb == 0 || (...) */ + if (rb == 0 || (sb == 0 && (ap[0] & (MPFR_LIMB_ONE << sh)) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(a))) + { + truncate: + MPFR_RET(-MPFR_SIGN(a)); + } + else /* round away from zero */ + { + add_one_ulp: + ap[0] += MPFR_LIMB_ONE << sh; + if (MPFR_UNLIKELY(ap[0] == 0)) + { + ap[0] = MPFR_LIMB_HIGHBIT; + /* no need to have MPFR_LIKELY here, since we are in a rare branch */ + if (bx + 1 <= __gmpfr_emax) + MPFR_SET_EXP (a, bx + 1); + else /* overflow */ + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); + } + MPFR_RET(MPFR_SIGN(a)); + } +} + +/* same as mpfr_add1sp, but for p = GMP_NUMB_BITS */ +static int +mpfr_add1sp1n (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) +{ + mpfr_exp_t bx = MPFR_GET_EXP (b); + mpfr_exp_t cx = MPFR_GET_EXP (c); + mp_limb_t *ap = MPFR_MANT(a); + mp_limb_t *bp = MPFR_MANT(b); + mp_limb_t *cp = MPFR_MANT(c); + mp_limb_t rb; /* round bit */ + mp_limb_t sb; /* sticky bit */ + mp_limb_t a0; /* to store the result */ + mpfr_uexp_t d; + + MPFR_ASSERTD(MPFR_PREC (a) == GMP_NUMB_BITS); + MPFR_ASSERTD(MPFR_PREC (b) == GMP_NUMB_BITS); + MPFR_ASSERTD(MPFR_PREC (c) == GMP_NUMB_BITS); + + if (bx == cx) + { + a0 = bp[0] + cp[0]; + rb = a0 & MPFR_LIMB_ONE; + ap[0] = MPFR_LIMB_HIGHBIT | (a0 >> 1); + bx ++; + sb = 0; /* since b + c fits on p+1 bits, the sticky bit is zero */ + } + else if (bx > cx) + { + BGreater1: + d = (mpfr_uexp_t) bx - cx; + if (d < GMP_NUMB_BITS) /* 1 <= d < GMP_NUMB_BITS */ + { + a0 = bp[0] + (cp[0] >> d); + sb = cp[0] << (GMP_NUMB_BITS - d); /* bits from cp[-1] after shift */ + if (a0 < bp[0]) /* carry */ + { + ap[0] = MPFR_LIMB_HIGHBIT | (a0 >> 1); + rb = a0 & 1; + bx ++; + } + else /* no carry */ + { + ap[0] = a0; + rb = sb & MPFR_LIMB_HIGHBIT; + sb &= ~MPFR_LIMB_HIGHBIT; + } + } + else /* d >= GMP_NUMB_BITS */ + { + sb = d != GMP_NUMB_BITS || cp[0] != MPFR_LIMB_HIGHBIT; + ap[0] = bp[0]; + rb = d == GMP_NUMB_BITS; + } + } + else /* bx < cx: swap b and c */ + { + mpfr_exp_t tx; + mp_limb_t *tp; + tx = bx; bx = cx; cx = tx; + tp = bp; bp = cp; cp = tp; + goto BGreater1; + } + + /* Note: we could keep the output significand in a0 for the rounding, + and only store it in ap[0] at the very end, but this seems slower + on average (but better for the worst case). */ + + /* now perform rounding */ + if (MPFR_UNLIKELY(bx > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); + + MPFR_SET_EXP (a, bx); + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + MPFR_RET(0); + else if (rnd_mode == MPFR_RNDN) + { + /* the condition below should be rb == 0 || (rb != 0 && ...), but this + is equivalent to rb == 0 || (...) */ + if (rb == 0 || (sb == 0 && (ap[0] & MPFR_LIMB_ONE) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(a))) + { + truncate: + MPFR_RET(-MPFR_SIGN(a)); + } + else /* round away from zero */ + { + add_one_ulp: + ap[0] += MPFR_LIMB_ONE; + if (MPFR_UNLIKELY(ap[0] == 0)) + { + ap[0] = MPFR_LIMB_HIGHBIT; + /* no need to have MPFR_LIKELY here, since we are in a rare branch */ + if (bx + 1 <= __gmpfr_emax) + MPFR_SET_EXP (a, bx + 1); + else /* overflow */ + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); + } + MPFR_RET(MPFR_SIGN(a)); + } +} + +/* same as mpfr_add1sp, but for GMP_NUMB_BITS < p < 2*GMP_NUMB_BITS */ +static int +mpfr_add1sp2 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode, + mpfr_prec_t p) +{ + mpfr_exp_t bx = MPFR_GET_EXP (b); + mpfr_exp_t cx = MPFR_GET_EXP (c); + mp_limb_t *ap = MPFR_MANT(a); + mp_limb_t *bp = MPFR_MANT(b); + mp_limb_t *cp = MPFR_MANT(c); + mpfr_prec_t sh = 2*GMP_NUMB_BITS - p; + mp_limb_t rb; /* round bit */ + mp_limb_t sb; /* sticky bit */ + mp_limb_t a1, a0; + mp_limb_t mask; + mpfr_uexp_t d; + + MPFR_ASSERTD(GMP_NUMB_BITS < p && p < 2 * GMP_NUMB_BITS); + + if (bx == cx) + { + /* since bp[1], cp[1] >= MPFR_LIMB_HIGHBIT, a carry always occurs */ + a0 = bp[0] + cp[0]; + a1 = bp[1] + cp[1] + (a0 < bp[0]); + a0 = (a0 >> 1) | (a1 << (GMP_NUMB_BITS - 1)); + bx ++; + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + ap[1] = MPFR_LIMB_HIGHBIT | (a1 >> 1); + ap[0] = a0 ^ rb; + sb = 0; /* since b + c fits on p+1 bits, the sticky bit is zero */ + } + else if (bx > cx) + { + BGreater2: + d = (mpfr_uexp_t) bx - cx; + mask = MPFR_LIMB_MASK(sh); + if (d < GMP_NUMB_BITS) /* 0 < d < GMP_NUMB_BITS */ + { + sb = cp[0] << (GMP_NUMB_BITS - d); /* bits from cp[-1] after shift */ + a0 = bp[0] + ((cp[1] << (GMP_NUMB_BITS - d)) | (cp[0] >> d)); + a1 = bp[1] + (cp[1] >> d) + (a0 < bp[0]); + if (a1 < bp[1]) /* carry in high word */ + { + exponent_shift: + sb |= a0 & 1; + /* shift a by 1 */ + a0 = (a1 << (GMP_NUMB_BITS - 1)) | (a0 >> 1); + ap[1] = MPFR_LIMB_HIGHBIT | (a1 >> 1); + bx ++; + } + else + ap[1] = a1; + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (a0 & mask) ^ rb; + ap[0] = a0 & ~mask; + } + else if (d < 2*GMP_NUMB_BITS) /* GMP_NUMB_BITS <= d < 2*GMP_NUMB_BITS */ + { + sb = (d == GMP_NUMB_BITS) ? cp[0] + : cp[0] | (cp[1] << (2*GMP_NUMB_BITS-d)); + a0 = bp[0] + (cp[1] >> (d - GMP_NUMB_BITS)); + a1 = bp[1] + (a0 < bp[0]); + if (a1 == 0) + goto exponent_shift; + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (a0 & mask) ^ rb; + ap[0] = a0 & ~mask; + ap[1] = a1; + } + else /* d >= 2*GMP_NUMB_BITS */ + { + ap[0] = bp[0]; + ap[1] = bp[1]; + rb = 0; /* since p < 2*GMP_NUMB_BITS */ + sb = 1; /* since c <> 0 */ + } + } + else /* bx < cx: swap b and c */ + { + mpfr_exp_t tx; + mp_limb_t *tp; + tx = bx; bx = cx; cx = tx; + tp = bp; bp = cp; cp = tp; + goto BGreater2; + } + + /* now perform rounding */ + if (MPFR_UNLIKELY(bx > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); + + MPFR_SET_EXP (a, bx); + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + MPFR_RET(0); + else if (rnd_mode == MPFR_RNDN) + { + if (rb == 0 || (sb == 0 && (ap[0] & (MPFR_LIMB_ONE << sh)) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(a))) + { + truncate: + MPFR_RET(-MPFR_SIGN(a)); + } + else /* round away from zero */ + { + add_one_ulp: + ap[0] += MPFR_LIMB_ONE << sh; + ap[1] += (ap[0] == 0); + if (MPFR_UNLIKELY(ap[1] == 0)) + { + ap[1] = MPFR_LIMB_HIGHBIT; + /* no need to have MPFR_LIKELY here, since we are in a rare branch */ + if (bx + 1 <= __gmpfr_emax) + MPFR_SET_EXP (a, bx + 1); + else /* overflow */ + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); + } + MPFR_RET(MPFR_SIGN(a)); + } +} + +/* same as mpfr_add1sp, but for 2*GMP_NUMB_BITS < p < 3*GMP_NUMB_BITS */ +static int +mpfr_add1sp3 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode, + mpfr_prec_t p) +{ + mpfr_exp_t bx = MPFR_GET_EXP (b); + mpfr_exp_t cx = MPFR_GET_EXP (c); + mp_limb_t *ap = MPFR_MANT(a); + mp_limb_t *bp = MPFR_MANT(b); + mp_limb_t *cp = MPFR_MANT(c); + mpfr_prec_t sh = 3*GMP_NUMB_BITS - p; + mp_limb_t rb; /* round bit */ + mp_limb_t sb; /* sticky bit */ + mp_limb_t a2, a1, a0; + mp_limb_t mask; + mpfr_uexp_t d; + + MPFR_ASSERTD(2 * GMP_NUMB_BITS < p && p < 3 * GMP_NUMB_BITS); + + if (bx == cx) + { + /* since bp[2], cp[2] >= MPFR_LIMB_HIGHBIT, a carry always occurs */ + a0 = bp[0] + cp[0]; + a1 = bp[1] + cp[1] + (a0 < bp[0]); + a2 = bp[2] + cp[2] + (a1 < bp[1] || (a1 == bp[1] && a0 < bp[0])); + /* since p < 3 * GMP_NUMB_BITS, we lose no bit in a0 >> 1 */ + a0 = (a1 << (GMP_NUMB_BITS - 1)) | (a0 >> 1); + bx ++; + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + ap[2] = MPFR_LIMB_HIGHBIT | (a2 >> 1); + ap[1] = (a2 << (GMP_NUMB_BITS - 1)) | (a1 >> 1); + ap[0] = a0 ^ rb; + sb = 0; /* since b + c fits on p+1 bits, the sticky bit is zero */ + } + else if (bx > cx) + { + BGreater2: + d = (mpfr_uexp_t) bx - cx; + mask = MPFR_LIMB_MASK(sh); + if (d < GMP_NUMB_BITS) /* 0 < d < GMP_NUMB_BITS */ + { + mp_limb_t cy; + sb = cp[0] << (GMP_NUMB_BITS - d); /* bits from cp[-1] after shift */ + a0 = bp[0] + ((cp[1] << (GMP_NUMB_BITS - d)) | (cp[0] >> d)); + a1 = bp[1] + ((cp[2] << (GMP_NUMB_BITS - d)) | (cp[1] >> d)) + + (a0 < bp[0]); + cy = a1 < bp[1] || (a1 == bp[1] && a0 < bp[0]); /* carry in a1 */ + a2 = bp[2] + (cp[2] >> d) + cy; + if (a2 < bp[2] || (a2 == bp[2] && cy)) /* carry in high word */ + { + exponent_shift: + sb |= a0 & 1; + /* shift a by 1 */ + a0 = (a1 << (GMP_NUMB_BITS - 1)) | (a0 >> 1); + ap[1] = (a2 << (GMP_NUMB_BITS - 1)) | (a1 >> 1); + ap[2] = MPFR_LIMB_HIGHBIT | (a2 >> 1); + bx ++; + } + else + { + ap[1] = a1; + ap[2] = a2; + } + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (a0 & mask) ^ rb; + ap[0] = a0 & ~mask; + } + else if (d < 2*GMP_NUMB_BITS) /* GMP_NUMB_BITS <= d < 2*GMP_NUMB_BITS */ + { + mp_limb_t c0shifted; + sb = (d == GMP_NUMB_BITS) ? cp[0] + : (cp[1] << (2*GMP_NUMB_BITS - d)) | cp[0]; + c0shifted = (d == GMP_NUMB_BITS) ? cp[1] + : (cp[2] << (2*GMP_NUMB_BITS-d)) | (cp[1] >> (d - GMP_NUMB_BITS)); + a0 = bp[0] + c0shifted; + a1 = bp[1] + (cp[2] >> (d - GMP_NUMB_BITS)) + (a0 < bp[0]); + /* if a1 < bp[1], there was a carry in the above addition, + or when a1 = bp[1] and one of the added terms is nonzero + (the sum of cp[2] >> (d - GMP_NUMB_BITS) and a0 < bp[0] + is at most 2^GMP_NUMB_BITS-d) */ + a2 = bp[2] + ((a1 < bp[1]) || (a1 == bp[1] && a0 < bp[0])); + if (a2 == 0) + goto exponent_shift; + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (a0 & mask) ^ rb; + ap[0] = a0 & ~mask; + ap[1] = a1; + ap[2] = a2; + } + else if (d < 3*GMP_NUMB_BITS) /* 2*GMP_NUMB_BITS<=d<3*GMP_NUMB_BITS */ + { + MPFR_ASSERTD (2*GMP_NUMB_BITS <= d && d < 3*GMP_NUMB_BITS); + sb = (d == 2*GMP_NUMB_BITS ? 0 : cp[2] << (3*GMP_NUMB_BITS - d)) + | cp[1] | cp[0]; + a0 = bp[0] + (cp[2] >> (d - 2*GMP_NUMB_BITS)); + a1 = bp[1] + (a0 < bp[0]); + a2 = bp[2] + (a1 < bp[1]); + if (a2 == 0) + goto exponent_shift; + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (a0 & mask) ^ rb; + ap[0] = a0 & ~mask; + ap[1] = a1; + ap[2] = a2; + } + else /* d >= 2*GMP_NUMB_BITS */ + { + ap[0] = bp[0]; + ap[1] = bp[1]; + ap[2] = bp[2]; + rb = 0; /* since p < 3*GMP_NUMB_BITS */ + sb = 1; /* since c <> 0 */ + } + } + else /* bx < cx: swap b and c */ + { + mpfr_exp_t tx; + mp_limb_t *tp; + tx = bx; bx = cx; cx = tx; + tp = bp; bp = cp; cp = tp; + goto BGreater2; + } + + /* now perform rounding */ + if (MPFR_UNLIKELY(bx > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); + + MPFR_SET_EXP (a, bx); + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + MPFR_RET(0); + else if (rnd_mode == MPFR_RNDN) + { + if (rb == 0 || (sb == 0 && (ap[0] & (MPFR_LIMB_ONE << sh)) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(a))) + { + truncate: + MPFR_RET(-MPFR_SIGN(a)); + } + else /* round away from zero */ + { + add_one_ulp: + ap[0] += MPFR_LIMB_ONE << sh; + ap[1] += (ap[0] == 0); + ap[2] += (ap[1] == 0 && ap[0] == 0); + if (MPFR_UNLIKELY(ap[2] == 0)) + { + ap[2] = MPFR_LIMB_HIGHBIT; + /* no need to have MPFR_LIKELY here, since we are in a rare branch */ + if (bx + 1 <= __gmpfr_emax) + MPFR_SET_EXP (a, bx + 1); + else /* overflow */ + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); + } + MPFR_RET(MPFR_SIGN(a)); + } +} + +#endif /* !defined(MPFR_GENERIC_ABI) */ + +/* compute sign(b) * (|b| + |c|). Returns 0 iff result is exact, a negative value when the result is less than the exact value, a positive value otherwise. */ -int +MPFR_HOT_FUNCTION_ATTR int mpfr_add1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) { mpfr_uexp_t d; @@ -96,6 +629,7 @@ mpfr_exp_t bx; mp_limb_t limb; int inexact; + int neg; MPFR_TMP_DECL(marker); MPFR_TMP_MARK(marker); @@ -103,59 +637,101 @@ MPFR_ASSERTD(MPFR_PREC(a) == MPFR_PREC(b) && MPFR_PREC(b) == MPFR_PREC(c)); MPFR_ASSERTD(MPFR_IS_PURE_FP(b)); MPFR_ASSERTD(MPFR_IS_PURE_FP(c)); - MPFR_ASSERTD(MPFR_GET_EXP(b) >= MPFR_GET_EXP(c)); + + MPFR_SET_SAME_SIGN (a, b); /* Read prec and num of limbs */ - p = MPFR_PREC(b); + p = MPFR_GET_PREC (b); + +#if !defined(MPFR_GENERIC_ABI) + if (p < GMP_NUMB_BITS) + return mpfr_add1sp1 (a, b, c, rnd_mode, p); + + if (GMP_NUMB_BITS < p && p < 2 * GMP_NUMB_BITS) + return mpfr_add1sp2 (a, b, c, rnd_mode, p); + + /* we put this test after the mpfr_add1sp2() call, to avoid slowing down + the more frequent case GMP_NUMB_BITS < p < 2 * GMP_NUMB_BITS */ + if (p == GMP_NUMB_BITS) + return mpfr_add1sp1n (a, b, c, rnd_mode); + + if (2 * GMP_NUMB_BITS < p && p < 3 * GMP_NUMB_BITS) + return mpfr_add1sp3 (a, b, c, rnd_mode, p); +#endif + + /* We need to get the sign before the possible exchange. */ + neg = MPFR_IS_NEG (b); + + bx = MPFR_GET_EXP(b); + if (bx < MPFR_GET_EXP(c)) + { + mpfr_srcptr t = b; + bx = MPFR_GET_EXP(c); + b = c; + c = t; + } + MPFR_ASSERTD(bx >= MPFR_GET_EXP(c)); + n = MPFR_PREC2LIMBS (p); MPFR_UNSIGNED_MINUS_MODULO(sh, p); - bx = MPFR_GET_EXP(b); d = (mpfr_uexp_t) (bx - MPFR_GET_EXP(c)); - DEBUG (printf ("New add1sp with diff=%lu\n", (unsigned long) d)); + /* printf ("New add1sp with diff=%lu\n", (unsigned long) d); */ - if (MPFR_UNLIKELY(d == 0)) + if (d == 0) { /* d==0 */ - DEBUG( mpfr_print_mant_binary("C= ", MPFR_MANT(c), p) ); - DEBUG( mpfr_print_mant_binary("B= ", MPFR_MANT(b), p) ); + /* mpfr_print_mant_binary("C= ", MPFR_MANT(c), p); */ + /* mpfr_print_mant_binary("B= ", MPFR_MANT(b), p); */ bx++; /* exp + 1 */ ap = MPFR_MANT(a); - limb = mpn_add_n(ap, MPFR_MANT(b), MPFR_MANT(c), n); - DEBUG( mpfr_print_mant_binary("A= ", ap, p) ); + limb = mpn_add_n (ap, MPFR_MANT(b), MPFR_MANT(c), n); + /* mpfr_print_mant_binary("A= ", ap, p); */ MPFR_ASSERTD(limb != 0); /* There must be a carry */ limb = ap[0]; /* Get LSB (In fact, LSW) */ - mpn_rshift(ap, ap, n, 1); /* Shift mantissa A */ + mpn_rshift (ap, ap, n, 1); /* Shift mantissa A */ ap[n-1] |= MPFR_LIMB_HIGHBIT; /* Set MSB */ ap[0] &= ~MPFR_LIMB_MASK(sh); /* Clear LSB bit */ - if (MPFR_LIKELY((limb&(MPFR_LIMB_ONE< truncate or add 1 Away: Add 1 */ - if (MPFR_LIKELY(rnd_mode==MPFR_RNDN)) + if (MPFR_LIKELY (rnd_mode == MPFR_RNDN)) { - if (MPFR_LIKELY((ap[0]&(MPFR_LIMB_ONE<= p)) { + /* fast track for RNDF */ + if (MPFR_LIKELY(rnd_mode == MPFR_RNDF)) + goto copy_set_exponent; + if (MPFR_LIKELY (d > p)) { /* d > p : Copy B in A */ /* Away: Add 1 Nearest: Trunc Zero: Trunc */ - if (MPFR_LIKELY (rnd_mode==MPFR_RNDN - || MPFR_IS_LIKE_RNDZ (rnd_mode, MPFR_IS_NEG (b)))) + if (rnd_mode == MPFR_RNDN || MPFR_IS_LIKE_RNDZ (rnd_mode, neg)) { copy_set_exponent: ap = MPFR_MANT (a); @@ -174,34 +750,34 @@ else { /* d==p : Copy B in A */ - /* Away: Add 1 - Nearest: Even Rule if C is a power of 2, else Add 1 - Zero: Trunc */ - if (MPFR_LIKELY(rnd_mode==MPFR_RNDN)) + /* Away: Add 1 + Nearest: Even Rule if C is a power of 2, else Add 1 + Zero: Trunc */ + if (rnd_mode == MPFR_RNDN) { /* Check if C was a power of 2 */ cp = MPFR_MANT(c); - if (MPFR_UNLIKELY(cp[n-1] == MPFR_LIMB_HIGHBIT)) + if (MPFR_UNLIKELY (cp[n-1] == MPFR_LIMB_HIGHBIT)) { mp_size_t k = n-1; - do { + do k--; - } while (k>=0 && cp[k]==0); - if (MPFR_UNLIKELY(k<0)) + while (k >= 0 && cp[k] == 0); + if (MPFR_UNLIKELY (k < 0)) /* Power of 2: Even rule */ - if ((MPFR_MANT (b)[0]&(MPFR_LIMB_ONE< 0: Just copy */ - MPFR_ASSERTD(m!=0); + MPFR_ASSERTD (m != 0); MPN_COPY(cp, MPFR_MANT(c)+m, n-m); MPN_ZERO(cp+n-m, m); } @@ -237,34 +813,44 @@ } } - DEBUG( mpfr_print_mant_binary("Before", MPFR_MANT(c), p) ); - DEBUG( mpfr_print_mant_binary("B= ", MPFR_MANT(b), p) ); - DEBUG( mpfr_print_mant_binary("After ", cp, p) ); + /* mpfr_print_mant_binary("Before", MPFR_MANT(c), p); + mpfr_print_mant_binary("B= ", MPFR_MANT(b), p); + mpfr_print_mant_binary("After ", cp, p); */ - /* Compute bcp=Cp and bcp1=C'p+1 */ - if (MPFR_LIKELY (sh > 0)) + /* fast track for RNDF */ + if (rnd_mode == MPFR_RNDF) + { + /* The bcp and bcp1 values will not matter for MPFR_RNDF, but + let's set them to 0 to avoid undefined behavior. */ + bcp1 = bcp = 0; + goto clean; + } + + /* Compute bcp=Cp and bcp1=C'p+1: bcp is the first neglected bit + (round bit), and bcp1 corresponds to the remaining bits (sticky bit). + */ + if (sh > 0) { /* Try to compute them from C' rather than C */ - bcp = (cp[0] & (MPFR_LIMB_ONE<<(sh-1))) ; - if (MPFR_LIKELY(cp[0]&MPFR_LIMB_MASK(sh-1))) + bcp = (cp[0] & (MPFR_LIMB_ONE<<(sh-1))); + if (MPFR_LIKELY (cp[0] & MPFR_LIMB_MASK (sh - 1))) bcp1 = 1; else { /* We can't compute C'p+1 from C'. Compute it from C */ /* Start from bit x=p-d+sh in mantissa C (+sh since we have already looked sh bits in C'!) */ - mpfr_prec_t x = p-d+sh-1; - if (MPFR_LIKELY(x>p)) + mpfr_prec_t x = p - d + sh - 1; + if (MPFR_LIKELY (x > p)) /* We are already looked at all the bits of c, so C'p+1 = 0*/ bcp1 = 0; else { mp_limb_t *tp = MPFR_MANT(c); - mp_size_t kx = n-1 - (x / GMP_NUMB_BITS); - mpfr_prec_t sx = GMP_NUMB_BITS-1-(x%GMP_NUMB_BITS); - DEBUG (printf ("(First) x=%lu Kx=%ld Sx=%lu\n", - (unsigned long) x, (long) kx, - (unsigned long) sx)); + mp_size_t kx = n - 1 - (x / GMP_NUMB_BITS); + mpfr_prec_t sx = GMP_NUMB_BITS - 1 - (x % GMP_NUMB_BITS); + /* printf ("(First) x=%lu Kx=%ld Sx=%lu\n", + (unsigned long) x, (long) kx, (unsigned long) sx); */ /* Looks at the last bits of limb kx (if sx=0 does nothing)*/ if (tp[kx] & MPFR_LIMB_MASK(sx)) bcp1 = 1; @@ -272,9 +858,9 @@ { /*kx += (sx==0);*/ /*If sx==0, tp[kx] hasn't been checked*/ - do { + do kx--; - } while (kx>=0 && tp[kx]==0); + while (kx >= 0 && tp[kx] == 0); bcp1 = (kx >= 0); } } @@ -285,25 +871,26 @@ /* Compute Cp and C'p+1 from C with sh=0 */ mp_limb_t *tp = MPFR_MANT(c); /* Start from bit x=p-d in mantissa C */ - mpfr_prec_t x = p-d; - mp_size_t kx = n-1 - (x / GMP_NUMB_BITS); - mpfr_prec_t sx = GMP_NUMB_BITS-1-(x%GMP_NUMB_BITS); - MPFR_ASSERTD(p >= d); - bcp = tp[kx] & (MPFR_LIMB_ONE<= d); + bcp = tp[kx] & (MPFR_LIMB_ONE << sx); /* Looks at the last bits of limb kx (If sx=0, does nothing)*/ - if (tp[kx]&MPFR_LIMB_MASK(sx)) + if (tp[kx] & MPFR_LIMB_MASK(sx)) bcp1 = 1; else { - do { + do kx--; - } while (kx>=0 && tp[kx]==0); - bcp1 = (kx>=0); + while (kx >= 0 && tp[kx] == 0); + bcp1 = (kx >= 0); } } - DEBUG (printf("sh=%u Cp=%lu C'p+1=%lu\n", sh, - (unsigned long) bcp, (unsigned long) bcp1)); + /* printf("sh=%u Cp=%lu C'p+1=%lu\n", sh, + (unsigned long) bcp, (unsigned long) bcp1); */ + clean: /* Clean shifted C' */ mask = ~MPFR_LIMB_MASK(sh); cp[0] &= mask; @@ -311,21 +898,21 @@ /* Add the mantissa c from b in a */ ap = MPFR_MANT(a); limb = mpn_add_n (ap, MPFR_MANT(b), cp, n); - DEBUG( mpfr_print_mant_binary("Add= ", ap, p) ); + /* mpfr_print_mant_binary("Add= ", ap, p); */ /* Check for overflow */ if (MPFR_UNLIKELY (limb)) { limb = ap[0] & (MPFR_LIMB_ONE< __gmpfr_emax)) /* Check for overflow */ { - DEBUG( printf("Overflow\n") ); + /* printf("Overflow\n"); */ MPFR_TMP_FREE(marker); - MPFR_SET_SAME_SIGN(a,b); - return mpfr_overflow(a, rnd_mode, MPFR_SIGN(a)); + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); } MPFR_SET_EXP (a, bx); - MPFR_SET_SAME_SIGN(a,b); MPFR_TMP_FREE(marker); MPFR_RET (inexact * MPFR_INT_SIGN (a)); diff -Nru mpfr4-3.1.4/src/add.c mpfr4-4.0.2/src/add.c --- mpfr4-3.1.4/src/add.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/add.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_add -- add two floating-point numbers -Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,12 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" -int +MPFR_HOT_FUNCTION_ATTR int mpfr_add (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) { MPFR_LOG_FUNC @@ -31,7 +31,7 @@ mpfr_get_prec (c), mpfr_log_prec, c, rnd_mode), ("a[%Pu]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a)); - if (MPFR_ARE_SINGULAR(b,c)) + if (MPFR_ARE_SINGULAR_OR_UBF (b, c)) { if (MPFR_IS_NAN(b) || MPFR_IS_NAN(c)) { @@ -59,7 +59,7 @@ MPFR_SET_SAME_SIGN(a, c); MPFR_RET(0); /* exact */ } - /* now either b or c is zero */ + /* now both b and c are finite numbers */ else if (MPFR_IS_ZERO(b)) { if (MPFR_IS_ZERO(c)) @@ -69,18 +69,32 @@ except (-0) + (-0) = -0. */ MPFR_SET_SIGN(a, (rnd_mode != MPFR_RNDD ? - ((MPFR_IS_NEG(b) && MPFR_IS_NEG(c)) ? -1 : 1) : - ((MPFR_IS_POS(b) && MPFR_IS_POS(c)) ? 1 : -1))); + (MPFR_IS_NEG(b) && MPFR_IS_NEG(c) ? + MPFR_SIGN_NEG : MPFR_SIGN_POS) : + (MPFR_IS_POS(b) && MPFR_IS_POS(c) ? + MPFR_SIGN_POS : MPFR_SIGN_NEG))); MPFR_SET_ZERO(a); MPFR_RET(0); /* 0 + 0 is exact */ } return mpfr_set (a, c, rnd_mode); } - else + else if (MPFR_IS_ZERO(c)) { - MPFR_ASSERTD(MPFR_IS_ZERO(c)); return mpfr_set (a, b, rnd_mode); } + else + { + MPFR_ASSERTD (MPFR_IS_PURE_UBF (b)); + MPFR_ASSERTD (MPFR_IS_PURE_UBF (c)); + /* mpfr_sub1sp and mpfr_add1sp are not intended to support UBF, + for which optimization is less important. */ + if (MPFR_SIGN(b) != MPFR_SIGN(c)) + return mpfr_sub1 (a, b, c, rnd_mode); + else if (MPFR_UBF_EXP_LESS_P (b, c)) + return mpfr_add1 (a, c, b, rnd_mode); + else + return mpfr_add1 (a, b, c, rnd_mode); + } } MPFR_ASSERTD (MPFR_IS_PURE_FP (b)); @@ -98,10 +112,7 @@ { /* signs are equal, it's an addition */ if (MPFR_LIKELY(MPFR_PREC(a) == MPFR_PREC(b) && MPFR_PREC(b) == MPFR_PREC(c))) - if (MPFR_GET_EXP(b) < MPFR_GET_EXP(c)) - return mpfr_add1sp(a, c, b, rnd_mode); - else - return mpfr_add1sp(a, b, c, rnd_mode); + return mpfr_add1sp(a, b, c, rnd_mode); else if (MPFR_GET_EXP(b) < MPFR_GET_EXP(c)) return mpfr_add1(a, c, b, rnd_mode); diff -Nru mpfr4-3.1.4/src/add_d.c mpfr4-4.0.2/src/add_d.c --- mpfr4-3.1.4/src/add_d.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/add_d.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_add_d -- add a multiple precision floating-point number to a machine double precision float -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -28,6 +28,7 @@ { int inexact; mpfr_t d; + mp_limb_t tmp_man[MPFR_LIMBS_PER_DOUBLE]; MPFR_SAVE_EXPO_DECL (expo); MPFR_LOG_FUNC @@ -38,15 +39,14 @@ MPFR_SAVE_EXPO_MARK (expo); - mpfr_init2 (d, IEEE_DBL_MANT_DIG); + MPFR_TMP_INIT1(tmp_man, d, IEEE_DBL_MANT_DIG); inexact = mpfr_set_d (d, c, rnd_mode); - MPFR_ASSERTN (inexact == 0); + MPFR_ASSERTD (inexact == 0); - mpfr_clear_flags (); + MPFR_CLEAR_FLAGS (); inexact = mpfr_add (a, b, d, rnd_mode); MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); - mpfr_clear (d); MPFR_SAVE_EXPO_FREE (expo); return mpfr_check_range (a, inexact, rnd_mode); } diff -Nru mpfr4-3.1.4/src/add_ui.c mpfr4-4.0.2/src/add_ui.c --- mpfr4-3.1.4/src/add_ui.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/add_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_add_ui -- add a floating-point number with a machine integer -Copyright 2000-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2000-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" -int +MPFR_HOT_FUNCTION_ATTR int mpfr_add_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mpfr_rnd_t rnd_mode) { MPFR_LOG_FUNC @@ -31,28 +31,51 @@ mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode), ("y[%Pu]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y)); - if (MPFR_LIKELY(u != 0) ) /* if u=0, do nothing */ + /* (unsigned long) 0 is assumed to be a real 0 (unsigned) */ + if (MPFR_UNLIKELY (u == 0)) + return mpfr_set (y, x, rnd_mode); + + /* This block is actually useless, but this is a minor optimization. */ + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) { - mpfr_t uu; - mp_limb_t up[1]; - unsigned long cnt; - int inex; - MPFR_SAVE_EXPO_DECL (expo); - - MPFR_TMP_INIT1 (up, uu, GMP_NUMB_BITS); - MPFR_ASSERTD (u == (mp_limb_t) u); - count_leading_zeros(cnt, (mp_limb_t) u); - up[0] = (mp_limb_t) u << cnt; - - /* Optimization note: Exponent save/restore operations may be - removed if mpfr_add works even when uu is out-of-range. */ - MPFR_SAVE_EXPO_MARK (expo); - MPFR_SET_EXP (uu, GMP_NUMB_BITS - cnt); - inex = mpfr_add(y, x, uu, rnd_mode); - MPFR_SAVE_EXPO_FREE (expo); - return mpfr_check_range(y, inex, rnd_mode); + if (MPFR_IS_NAN (x)) + { + MPFR_SET_NAN (y); + MPFR_RET_NAN; + } + if (MPFR_IS_INF (x)) + { + MPFR_SET_INF (y); + MPFR_SET_SAME_SIGN (y, x); + MPFR_RET (0); /* +/-infinity is exact */ + } + MPFR_ASSERTD (MPFR_IS_ZERO (x) && u != 0); + /* Note: the fact that u != 0 is important due to signed zeros. */ + return mpfr_set_ui (y, u, rnd_mode); } - else - /* (unsigned long) 0 is assumed to be a real 0 (unsigned) */ - return mpfr_set (y, x, rnd_mode); + + /* Main code */ + { + mpfr_t uu; + mp_limb_t up[1]; + int cnt; + int inex; + MPFR_SAVE_EXPO_DECL (expo); + + MPFR_TMP_INIT1 (up, uu, GMP_NUMB_BITS); + MPFR_STAT_STATIC_ASSERT (MPFR_LIMB_MAX >= ULONG_MAX); + /* So, u fits in a mp_limb_t, which justifies the casts below. */ + MPFR_ASSERTD (u != 0); + count_leading_zeros (cnt, (mp_limb_t) u); + up[0] = (mp_limb_t) u << cnt; + + /* Optimization note: Exponent save/restore operations may be + removed if mpfr_add works even when uu is out-of-range. */ + 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 -Nru mpfr4-3.1.4/src/agm.c mpfr4-4.0.2/src/agm.c --- mpfr4-3.1.4/src/agm.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/agm.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_agm -- arithmetic-geometric mean of two floating-point numbers -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -72,7 +72,10 @@ } } else /* a and b are neither NaN nor Inf, and one is zero */ - { /* If a or b is 0, the result is +0 since a sqrt is positive */ + { /* If a or b is 0, the result is +0, in particular because the + result is always >= 0 with our definition (Maple sometimes + chooses a different sign for GaussAGM, but it uses another + definition, with possible negative results). */ MPFR_ASSERTD (MPFR_IS_ZERO (op1) || MPFR_IS_ZERO (op2)); MPFR_SET_POS (r); MPFR_SET_ZERO (r); @@ -201,7 +204,7 @@ goto retry; } - mpfr_clear_flags (); + MPFR_CLEAR_FLAGS (); mpfr_sqrt (u, u, MPFR_RNDN); mpfr_div_2ui (v, v, 1, MPFR_RNDN); @@ -245,7 +248,7 @@ method. */ MPFR_LOG_MSG (("4*eq > p -> underflow\n", 0)); mpfr_clear (w); - mpfr_clear_underflow (); + MPFR_CLEAR_UNDERFLOW (); } /* U(k) increases, so that U.V can overflow (but not underflow). */ MPFR_BLOCK (flags2, mpfr_mul (uf, u, v, MPFR_RNDN);); @@ -261,7 +264,7 @@ MPFR_LOG_MSG (("Overflow in iteration n = %lu, scaleit = %" MPFR_EXP_FSPEC "d (%" MPFR_EXP_FSPEC "d)\n", n, scaleit, scale2)); - mpfr_clear_overflow (); + MPFR_CLEAR_OVERFLOW (); goto retry2; } mpfr_sqrt (u, uf, MPFR_RNDN); diff -Nru mpfr4-3.1.4/src/ai.c mpfr4-4.0.2/src/ai.c --- mpfr4-3.1.4/src/ai.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/ai.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_ai -- Airy function Ai -Copyright 2010-2016 Free Software Foundation, Inc. +Copyright 2010-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -45,7 +45,8 @@ */ -/* Airy function Ai evaluated by the most naive algorithm */ +/* Airy function Ai evaluated by the most naive algorithm. + Assume that x is a finite number. */ static int mpfr_ai1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) { @@ -72,26 +73,13 @@ ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd), ("y[%Pu]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y) ); - /* Special cases */ - if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) - { - if (MPFR_IS_NAN (x)) - { - MPFR_SET_NAN (y); - MPFR_RET_NAN; - } - else if (MPFR_IS_INF (x)) - return mpfr_set_ui (y, 0, rnd); - } - - /* Save current exponents range */ MPFR_SAVE_EXPO_MARK (expo); if (MPFR_UNLIKELY (MPFR_IS_ZERO (x))) { mpfr_t y1, y2; - prec = MPFR_PREC (y) + 3; + prec = MPFR_ADD_PREC (MPFR_PREC (y), 3); mpfr_init2 (y1, prec); mpfr_init2 (y2, prec); MPFR_ZIV_INIT (loop, prec); @@ -133,7 +121,7 @@ /* if x<=0, ????? */ /* We begin with 11 guard bits */ - prec = MPFR_PREC (y)+11; + prec = MPFR_ADD_PREC (MPFR_PREC (y), 11); MPFR_ZIV_INIT (loop, prec); /* The working precision is heuristically chosen in order to obtain */ @@ -178,7 +166,11 @@ assumed_exponent = 10; } - wprec = prec + MPFR_INT_CEIL_LOG2 (prec) + 5 + cond + assumed_exponent; + { + mpfr_prec_t incr = + MPFR_INT_CEIL_LOG2 (prec) + 5 + cond + assumed_exponent; + wprec = MPFR_ADD_PREC (prec, incr); + } mpfr_init (ti); mpfr_init (tip1); @@ -276,8 +268,9 @@ { if (correct_bits < prec) { /* The precision was badly chosen */ - MPFR_LOG_MSG (("Bad assumption on the exponent of Ai(x)", 0)); - MPFR_LOG_MSG ((" (E=%ld)\n", (long) MPFR_GET_EXP (s))); + MPFR_LOG_MSG (("Bad assumption on the exponent of Ai(x)" + " (E=%" MPFR_EXP_FSPEC "d)\n", + (mpfr_eexp_t) MPFR_GET_EXP (s))); wprec = prec + err + 1; } else @@ -311,7 +304,8 @@ } -/* Airy function Ai evaluated by Smith algorithm */ +/* Airy function Ai evaluated by Smith algorithm. + Assume that x is a finite number. */ static int mpfr_ai2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) { @@ -339,18 +333,6 @@ ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd), ("y[%Pu]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y)); - /* Special cases */ - if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) - { - if (MPFR_IS_NAN (x)) - { - MPFR_SET_NAN (y); - MPFR_RET_NAN; - } - else if (MPFR_IS_INF (x)) - return mpfr_set_ui (y, 0, rnd); - } - /* Save current exponents range */ MPFR_SAVE_EXPO_MARK (expo); @@ -407,7 +389,7 @@ L = __gmpfr_isqrt (prec); MPFR_LOG_MSG (("size of blocks L = %lu\n", L)); - z = (mpfr_t *) (*__gmp_allocate_func) ( (L + 1) * sizeof (mpfr_t) ); + z = (mpfr_t *) mpfr_allocate_func ( (L + 1) * sizeof (mpfr_t) ); MPFR_ASSERTN (z != NULL); for (j=0; j<=L; j++) mpfr_init (z[j]); @@ -557,10 +539,10 @@ for (j=0; j<=L; j++) mpfr_clear (z[j]); - (*__gmp_free_func) (z, (L + 1) * sizeof (mpfr_t)); + mpfr_free_func (z, (L + 1) * sizeof (mpfr_t)); L = __gmpfr_isqrt (t); MPFR_LOG_MSG (("size of blocks L = %lu\n", L)); - z = (mpfr_t *) (*__gmp_allocate_func) ( (L + 1) * sizeof (mpfr_t)); + z = (mpfr_t *) mpfr_allocate_func ( (L + 1) * sizeof (mpfr_t)); MPFR_ASSERTN (z != NULL); for (j=0; j<=L; j++) mpfr_init (z[j]); @@ -576,8 +558,9 @@ { if (correctBits < prec) { /* The precision was badly chosen */ - MPFR_LOG_MSG (("Bad assumption on the exponent of Ai (x)", 0)); - MPFR_LOG_MSG ((" (E=%ld)\n", (long) (MPFR_GET_EXP (result)))); + MPFR_LOG_MSG (("Bad assumption on the exponent of Ai(x)" + " (E=%" MPFR_EXP_FSPEC "d)\n", + (mpfr_eexp_t) MPFR_GET_EXP (result))); wprec = prec + err + 1; } else @@ -593,7 +576,6 @@ } /* End of ZIV loop */ MPFR_ZIV_FREE (loop); - MPFR_SAVE_EXPO_FREE (expo); r = mpfr_set (y, result, rnd); @@ -601,7 +583,7 @@ mpfr_clear (tmp2_sp); for (j=0; j<=L; j++) mpfr_clear (z[j]); - (*__gmp_free_func) (z, (L + 1) * sizeof (mpfr_t)); + mpfr_free_func (z, (L + 1) * sizeof (mpfr_t)); mpfr_clear (s); mpfr_clear (u0); mpfr_clear (u1); @@ -609,7 +591,8 @@ mpfr_clear (temp1); mpfr_clear (temp2); - return r; + MPFR_SAVE_EXPO_FREE (expo); + return mpfr_check_range (y, r, rnd); } /* We consider that the boundary between the area where the naive method @@ -636,6 +619,18 @@ int use_ai2; MPFR_SAVE_EXPO_DECL (expo); + /* Special cases */ + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) + { + if (MPFR_IS_NAN (x)) + { + MPFR_SET_NAN (y); + MPFR_RET_NAN; + } + else if (MPFR_IS_INF (x)) + return mpfr_set_ui (y, 0, rnd); + } + /* The exponent range must be large enough for the computation of temp1. */ MPFR_SAVE_EXPO_MARK (expo); diff -Nru mpfr4-3.1.4/src/amd/amdfam10/mparam.h mpfr4-4.0.2/src/amd/amdfam10/mparam.h --- mpfr4-3.1.4/src/amd/amdfam10/mparam.h 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/amd/amdfam10/mparam.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Generated by MPFR's tuneup.c, 2011-07-31, gcc 4.6.1 */ @@ -91,7 +91,7 @@ 824,832,832,832,832,832,832,825,832,832,832,824,832,832,832,828, \ 822,824,831,829,832,827,832,832,832,831,832,829,829,832,824,832, \ 830,832,832,832,832,832,830,832,832,832,832,828,855,832,830,830 \ - + #define MPFR_SQRHIGH_TAB \ -1,0,0,0,-1,-1,-1,-1,-1,-1,7,8,9,8,9,9, \ 11,11,11,13,13,14,15,16,17,17,19,19,16,19,17,19, \ @@ -157,7 +157,7 @@ 696,695,695,696,696,728,696,696,695,696,696,696,696,696,696,696, \ 727,696,696,696,696,695,696,728,727,696,695,727,696,726,727,726, \ 727,728,728,727,694,727,728,728,728,727,727,728,727,728,727,728 \ - + #define MPFR_DIVHIGH_TAB \ 0,1,2,3,4,5,6,7,8,9,10,11,10,13,14,15, \ 14,15,18,19,18,14,15,18,18,18,19,17,18,19,18,19, \ @@ -223,7 +223,7 @@ 560,496,576,512,512,512,512,512,512,576,576,512,512,576,512,512, \ 512,512,576,512,512,512,508,512,576,512,576,576,512,576,592,512, \ 568,512,576,568,576,576,576,512,576,576,592,576,592,512,608,576 \ - + #define MPFR_MUL_THRESHOLD 17 /* limbs */ #define MPFR_SQR_THRESHOLD 19 /* limbs */ #define MPFR_DIV_THRESHOLD 28 /* limbs */ diff -Nru mpfr4-3.1.4/src/amd/athlon/mparam.h mpfr4-4.0.2/src/amd/athlon/mparam.h --- mpfr4-3.1.4/src/amd/athlon/mparam.h 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/amd/athlon/mparam.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_MULHIGH_TAB \ diff -Nru mpfr4-3.1.4/src/amd/k8/mparam.h mpfr4-4.0.2/src/amd/k8/mparam.h --- mpfr4-3.1.4/src/amd/k8/mparam.h 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/amd/k8/mparam.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Generated by MPFR's tuneup.c, 2011-07-31, gcc 4.3.2 */ @@ -91,7 +91,7 @@ 831,832,831,832,832,831,832,832,832,832,832,832,831,832,832,832, \ 831,832,832,832,832,832,831,832,832,832,832,832,831,832,831,832, \ 832,832,831,832,831,832,831,832,832,832,832,832,832,832,831,832 \ - + #define MPFR_SQRHIGH_TAB \ -1,0,0,0,0,-1,-1,-1,-1,-1,7,7,8,9,9,11, \ 11,11,11,11,13,13,15,15,17,17,18,17,17,17,18,20, \ @@ -157,7 +157,7 @@ 727,584,728,632,728,560,727,728,728,560,584,560,560,727,728,728, \ 727,728,728,728,608,728,728,724,728,728,760,727,728,727,728,728, \ 728,759,728,696,728,728,728,728,728,727,759,760,727,760,760,727 \ - + #define MPFR_DIVHIGH_TAB \ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, \ 14,15,18,19,18,14,22,18,18,18,18,20,18,18,20,22, \ @@ -223,7 +223,7 @@ 560,496,512,512,512,496,512,512,512,576,512,512,512,512,512,512, \ 512,512,512,512,560,512,560,512,576,512,576,592,512,560,591,512, \ 592,512,576,512,576,592,592,624,592,576,560,512,592,576,592,592 \ - + #define MPFR_MUL_THRESHOLD 19 /* limbs */ #define MPFR_SQR_THRESHOLD 18 /* limbs */ #define MPFR_DIV_THRESHOLD 34 /* limbs */ diff -Nru mpfr4-3.1.4/src/arm/mparam.h mpfr4-4.0.2/src/arm/mparam.h --- mpfr4-3.1.4/src/arm/mparam.h 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/arm/mparam.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Generated by MPFR's tuneup.c, 2010-10-15, gcc 4.4.4 */ @@ -220,7 +220,7 @@ 528,492,520,516,516,504,525,496,516,520,516,512,520,532,528,516, \ 516,524,512,508,520,528,516,532,532,516,533,516,528,504,528,516, \ 532,576,532,515,516,600,528,517,516,600,600,532,516,600,600,524 \ - + #define MPFR_MUL_THRESHOLD 16 /* limbs */ #define MPFR_SQR_THRESHOLD 31 /* limbs */ #define MPFR_EXP_2_THRESHOLD 469 /* bits */ diff -Nru mpfr4-3.1.4/src/asin.c mpfr4-4.0.2/src/asin.c --- mpfr4-3.1.4/src/asin.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/asin.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_asin -- arc-sinus of a floating-point number -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/asinh.c mpfr4-4.0.2/src/asinh.c --- mpfr4-3.1.4/src/asinh.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/asinh.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_asinh -- inverse hyperbolic sine -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -104,7 +104,7 @@ break; } - /* actualisation of the precision */ + /* actualization of the precision */ MPFR_ZIV_NEXT (loop, Nt); mpfr_set_prec (t, Nt); } diff -Nru mpfr4-3.1.4/src/atan2.c mpfr4-4.0.2/src/atan2.c --- mpfr4-3.1.4/src/atan2.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/atan2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_atan2 -- arc-tan 2 of a floating-point number -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -130,9 +130,8 @@ mpfr_const_pi (tmp2, MPFR_RNDN); mpfr_mul_ui (tmp2, tmp2, 3, MPFR_RNDN); /* Error <= 2 */ mpfr_div_2ui (tmp2, tmp2, 2, MPFR_RNDN); - if (mpfr_round_p (MPFR_MANT (tmp2), MPFR_LIMB_SIZE (tmp2), - MPFR_PREC (tmp2) - 2, - MPFR_PREC (dest) + (rnd_mode == MPFR_RNDN))) + if (MPFR_CAN_ROUND (tmp2, MPFR_PREC (tmp2) - 2, + MPFR_PREC (dest), rnd_mode)) break; MPFR_ZIV_NEXT (loop2, prec2); mpfr_set_prec (tmp2, prec2); @@ -155,11 +154,11 @@ /* When x is a power of two, we call directly atan(y/x) since y/x is exact. */ - if (MPFR_UNLIKELY (MPFR_IS_POWER_OF_2 (x))) + if (MPFR_UNLIKELY (MPFR_IS_POS (x) && mpfr_powerof2_raw (x))) { int r; mpfr_t yoverx; - unsigned int saved_flags = __gmpfr_flags; + mpfr_flags_t saved_flags = __gmpfr_flags; mpfr_init2 (yoverx, MPFR_PREC (y)); if (MPFR_LIKELY (mpfr_div_2si (yoverx, y, MPFR_GET_EXP (x) - 1, diff -Nru mpfr4-3.1.4/src/atan.c mpfr4-4.0.2/src/atan.c --- mpfr4-3.1.4/src/atan.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/atan.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_atan -- arc-tangent of a floating-point number -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,37 +17,120 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" +#if GMP_NUMB_BITS == 64 +/* for each pair (r,p), we store a 192-bit approximation of atan(x)/x for + x=p/2^r, with lowest limb first. + Sage code: + for p in range(1,2^ceil(r/2)): + x=p/2^r + l=floor(2^192*n(atan(x)/x, 300)).digits(2^64) + print ("{0x%x, 0x%x, 0x%x}, /"+"* (%d,%d) *"+"/") % (l[0],l[1],l[2],r,p) +*/ +static const mp_limb_t atan_table[][3] = { + {0x6e141587261cdf00, 0x6fe445ecbc3a8d03, 0xed63382b0dda7b45}, /* (1,1) */ + {0xaa7fa90388b3836b, 0x6dc79ef5f7a217e5, 0xfadbafc96406eb15}, /* (2,1) */ + {0x319c12cf59d4b2dc, 0xcb2792dc0e2e0d51, 0xffaaddb967ef4e36}, /* (4,1) */ + {0x8b3957d95d9ad922, 0xc897989f3e888ef7, 0xfeadd4d5617b6e32}, /* (4,2) */ + {0xc4e6abc8af62e439, 0x4eb9bf602625f0b4, 0xfd0fcdd343cac19b}, /* (4,3) */ + {0x7c18baeb9bc95789, 0xb12afb6b6d4f7e16, 0xffffaaaaddddb94b}, /* (8,1) */ + {0x6856a0171a2f001a, 0x62351fbbe60af47, 0xfffeaaadddd4b968}, /* (8,2) */ + {0x69164c094f49da06, 0xd517294f7373d07a, 0xfffd001032cb1179}, /* (8,3) */ + {0x20ef65c10deef460, 0xe78c564015f76048, 0xfffaaadddb94d5bb}, /* (8,4) */ + {0x3ce233aa002f0344, 0x9dd8ea342a65d4cc, 0xfff7ab27a1f32f95}, /* (8,5) */ + {0xa37f403c7279c5cb, 0x13ab53a1c8db8497, 0xfff40103192ce74d}, /* (8,6) */ + {0xe5a85657103c1aa8, 0xb8409e6c914191d3, 0xffefac8a9c40a26b}, /* (8,7) */ + {0x806d0294c0db8816, 0x779d776dda8c6213, 0xffeaaddd4bb12542}, /* (8,8) */ + {0x5545d1914ef21478, 0x3aea58d6660f5a12, 0xffe5051f0aebf73a}, /* (8,9) */ + {0x6e47a91d015f4133, 0xc085ab6b490b7f02, 0xffdeb2787d4adac1}, /* (8,10) */ + {0x4efc1f931f7ec9b3, 0xb7f43cd16195ef4b, 0xffd7b61702b09aad}, /* (8,11) */ + {0xd27d1dbf55fed60d, 0xd812c11d7d473e5e, 0xffd0102cb3c1bfbe}, /* (8,12) */ + {0xca629e927383fe97, 0x8c61aedf58e42206, 0xffc7c0f05db9d1b6}, /* (8,13) */ + {0x4eff0b53d4e905b7, 0x28ac1e800ca31e9d, 0xffbec89d7dddd7e9}, /* (8,14) */ + {0xb0a7931deec6fe60, 0xb46feea78588554b, 0xffb527743c8cdd8f} /* (8,15) */ + }; + +static void +set_table (mpfr_t y, const mp_limb_t x[3]) +{ + mpfr_prec_t p = MPFR_PREC(y); + mp_size_t n = MPFR_PREC2LIMBS(p); + mpfr_prec_t sh; + mp_limb_t *yp = MPFR_MANT(y); + + MPFR_UNSIGNED_MINUS_MODULO (sh, p); + mpn_copyi (yp, x + 3 - n, n); + yp[0] &= ~MPFR_LIMB_MASK(sh); + MPFR_SET_EXP(y, 0); +} +#endif + /* If x = p/2^r, put in y an approximation of atan(x)/x using 2^m terms for the series expansion, with an error of at most 1 ulp. - Assumes |x| < 1. + Assumes 0 < x < 1, thus 1 <= p < 2^r. + More precisely, p consists of the floor(r/2) bits of the binary expansion + of a number 0 < s < 1: + * the bit of weight 2^-1 is for r=1, thus p <= 1 + * the bit of weight 2^-2 is for r=2, thus p <= 1 + * the two bits of weight 2^-3 and 2^-4 are for r=4, thus p <= 3 + * more generally p < 2^(r/2). If X=x^2, we want 1 - X/3 + X^2/5 - ... + (-1)^k*X^k/(2k+1) + ... - Assume p is non-zero. - When we sum terms up to x^k/(2k+1), the denominator Q[0] is 3*5*7*...*(2k+1) ~ (2k/e)^k. + + The tab[] array should have at least 3*(m+1) entries. */ static void -mpfr_atan_aux (mpfr_ptr y, mpz_ptr p, long r, int m, mpz_t *tab) +mpfr_atan_aux (mpfr_ptr y, mpz_ptr p, unsigned long r, int m, mpz_t *tab) { mpz_t *S, *Q, *ptoj; - unsigned long n, i, k, j, l; + mp_bitcnt_t n, h, j; /* unsigned type, which is >= unsigned long */ mpfr_exp_t diff, expo; - int im, done; - mpfr_prec_t mult, *accu, *log2_nb_terms; + int im, i, k, l, done; + mpfr_prec_t mult; + mpfr_prec_t accu[MPFR_PREC_BITS], log2_nb_terms[MPFR_PREC_BITS]; mpfr_prec_t precy = MPFR_PREC(y); MPFR_ASSERTD(mpz_cmp_ui (p, 0) != 0); + MPFR_ASSERTD (m+1 <= MPFR_PREC_BITS); - accu = (mpfr_prec_t*) (*__gmp_allocate_func) ((2 * m + 2) * sizeof (mpfr_prec_t)); - log2_nb_terms = accu + m + 1; +#if GMP_NUMB_BITS == 64 + /* tabulate values for small precision and small value of r (which are the + most expensive to compute) */ + if (precy <= 192) + { + switch (r) + { + case 1: + /* p has 1 bit: necessarily p=1 */ + MPFR_ASSERTD(mpz_cmp_ui (p, 1) == 0); + set_table (y, atan_table[0]); + return; + case 2: + /* p has 1 bit: necessarily p=1 too */ + MPFR_ASSERTD(mpz_cmp_ui (p, 1) == 0); + set_table (y, atan_table[1]); + return; + case 4: + /* p has at most 2 bits: 1 <= p <= 3 */ + MPFR_ASSERTD(1 <= mpz_get_ui (p) && mpz_get_ui (p) <= 3); + set_table (y, atan_table[1 + mpz_get_ui (p)]); + return; + case 8: + /* p has at most 4 bits: 1 <= p <= 15 */ + MPFR_ASSERTD(1 <= mpz_get_ui (p) && mpz_get_ui (p) <= 15); + set_table (y, atan_table[4 + mpz_get_ui (p)]); + return; + } + } +#endif /* Set Tables */ S = tab; /* S */ @@ -61,9 +144,12 @@ /* Normalize p */ n = mpz_scan1 (p, 0); - mpz_tdiv_q_2exp (p, p, n); /* exact */ - MPFR_ASSERTD (r > n); - r -= n; + if (n > 0) + { + mpz_tdiv_q_2exp (p, p, n); /* exact */ + MPFR_ASSERTD (r > n); + r -= n; + } /* since |p/2^r| < 1, and p is a non-zero integer, necessarily r > 0 */ MPFR_ASSERTD (mpz_sgn (p) > 0); @@ -90,7 +176,8 @@ mpz_mul (ptoj[im], ptoj[im - 1], ptoj[im - 1]); /* main loop */ n = 1UL << m; - /* the ith term being X^i/(2i+1) with X=p/2^r, we can stop when + MPFR_ASSERTN (n != 0); /* no overflow */ + /* the i-th term being X^i/(2i+1) with X=p/2^r, we can stop when p^i/2^(r*i) < 2^(-precy), i.e. r*i > precy + log2(p^i) */ for (i = k = done = 0; (i < n) && (done == 0); i += 2, k ++) { @@ -115,7 +202,6 @@ log2_nb_terms[k-1] = l + 1; /* now S[k-1]/Q[k-1] corresponds to 2^(l+1) terms */ MPFR_MPZ_SIZEINBASE2(mult, ptoj[l+1]); - /* FIXME: precompute bits(ptoj[l+1]) outside the loop? */ mult = (r << (l + 1)) - mult - 1; accu[k-1] = (k == 1) ? mult : accu[k-2] + mult; if (accu[k-1] > precy) @@ -123,11 +209,14 @@ } } } - else /* special case p=1: the ith term being X^i/(2i+1) with X=1/2^r, + else /* special case p=1: the i-th term being X^i/(2i+1) with X=1/2^r, we can stop when r*i > precy i.e. i > precy/r */ { n = 1UL << m; - for (i = k = 0; (i < n) && (i <= precy / r); i += 2, k ++) + if (precy / r <= n) + n = (precy / r) + 1; + MPFR_ASSERTN (n != 0); /* no overflow */ + for (i = k = 0; i < n; i += 2, k ++) { mpz_set_ui (Q[k + 1], 2 * i + 3); mpz_mul_2exp (S[k], Q[k+1], r); @@ -148,22 +237,20 @@ } /* we need to combine S[0]/Q[0]...S[k-1]/Q[k-1] */ - l = 0; /* number of terms accumulated in S[k]/Q[k] */ + h = 0; /* number of terms accumulated in S[k]/Q[k] */ while (k > 1) { k --; /* combine S[k-1]/Q[k-1] and S[k]/Q[k] */ - j = log2_nb_terms[k-1]; mpz_mul (S[k], S[k], Q[k-1]); if (mpz_cmp_ui (p, 1) != 0) - mpz_mul (S[k], S[k], ptoj[j]); + mpz_mul (S[k], S[k], ptoj[log2_nb_terms[k-1]]); mpz_mul (S[k-1], S[k-1], Q[k]); - l += 1 << log2_nb_terms[k]; - mpz_mul_2exp (S[k-1], S[k-1], r * l); + h += (mp_bitcnt_t) 1 << log2_nb_terms[k]; + mpz_mul_2exp (S[k-1], S[k-1], r * h); mpz_add (S[k-1], S[k-1], S[k]); mpz_mul (Q[k-1], Q[k-1], Q[k]); } - (*__gmp_free_func) (accu, (2 * m + 2) * sizeof (mpfr_prec_t)); MPFR_MPZ_SIZEINBASE2 (diff, S[0]); diff -= 2 * precy; @@ -183,7 +270,9 @@ mpz_tdiv_q (S[0], S[0], Q[0]); mpfr_set_z (y, S[0], MPFR_RNDD); - MPFR_SET_EXP (y, MPFR_EXP(y) + expo - r * (i - 1)); + /* TODO: Check/prove that the following expression doesn't overflow. */ + expo = MPFR_GET_EXP (y) + expo - r * (i - 1); + MPFR_SET_EXP (y, expo); } int @@ -191,11 +280,11 @@ { mpfr_t xp, arctgt, sk, tmp, tmp2; mpz_t ukz; - mpz_t *tabz; + mpz_t tabz[3*(MPFR_PREC_BITS+1)]; mpfr_exp_t exptol; mpfr_prec_t prec, realprec, est_lost, lost; unsigned long twopoweri, log2p, red; - int comparaison, inexact; + int comparison, inexact; int i, n0, oldn0; MPFR_GROUP_DECL (group); MPFR_SAVE_EXPO_DECL (expo); @@ -250,8 +339,8 @@ MPFR_SAVE_EXPO_MARK (expo); /* Other simple case arctan(-+1)=-+pi/4 */ - comparaison = mpfr_cmp_ui (xp, 1); - if (MPFR_UNLIKELY (comparaison == 0)) + comparison = mpfr_cmp_ui (xp, 1); + if (MPFR_UNLIKELY (comparison == 0)) { int neg = MPFR_IS_NEG (x); inexact = mpfr_const_pi (atan, MPFR_IS_POS (x) ? rnd_mode @@ -270,10 +359,9 @@ prec = realprec + GMP_NUMB_BITS; /* Initialisation */ - mpz_init (ukz); + mpz_init2 (ukz, prec); /* ukz will need 'prec' bits below */ MPFR_GROUP_INIT_4 (group, prec, sk, tmp, tmp2, arctgt); oldn0 = 0; - tabz = (mpz_t *) 0; MPFR_ZIV_INIT (loop, prec); for (;;) @@ -301,27 +389,19 @@ /* Initialisation */ MPFR_GROUP_REPREC_4 (group, prec, sk, tmp, tmp2, arctgt); - if (MPFR_LIKELY (oldn0 == 0)) - { - oldn0 = 3 * (n0 + 1); - tabz = (mpz_t *) (*__gmp_allocate_func) (oldn0 * sizeof (mpz_t)); - for (i = 0; i < oldn0; i++) - mpz_init (tabz[i]); - } - else if (MPFR_UNLIKELY (oldn0 < 3 * (n0 + 1))) - { - tabz = (mpz_t *) (*__gmp_reallocate_func) - (tabz, oldn0 * sizeof (mpz_t), 3 * (n0 + 1)*sizeof (mpz_t)); - for (i = oldn0; i < 3 * (n0 + 1); i++) - mpz_init (tabz[i]); - oldn0 = 3 * (n0 + 1); - } + MPFR_ASSERTD (n0 <= MPFR_PREC_BITS); + /* Note: the tabz[] entries are used to get a rational approximation + of atan(x) to precision 'prec', thus allocating them to 'prec' bits + should be good enough. */ + for (i = oldn0; i < 3 * (n0 + 1); i++) + mpz_init2 (tabz[i], prec); + oldn0 = 3 * (n0 + 1); /* The mpfr_ui_div below mustn't underflow. This is guaranteed by MPFR_SAVE_EXPO_MARK, but let's check that for maintainability. */ MPFR_ASSERTD (__gmpfr_emax <= 1 - __gmpfr_emin); - if (comparaison > 0) /* use atan(xp) = Pi/2 - atan(1/xp) */ + if (comparison > 0) /* use atan(xp) = Pi/2 - atan(1/xp) */ mpfr_ui_div (sk, 1, xp, MPFR_RNDN); else mpfr_set (sk, xp, MPFR_RNDN); @@ -334,36 +414,36 @@ for (red = 0; MPFR_GET_EXP(sk) > - (mpfr_exp_t) log2p; red ++) { lost = 9 - 2 * MPFR_EXP(sk); - mpfr_mul (tmp, sk, sk, MPFR_RNDN); + mpfr_sqr (tmp, sk, MPFR_RNDN); mpfr_add_ui (tmp, tmp, 1, MPFR_RNDN); mpfr_sqrt (tmp, tmp, MPFR_RNDN); mpfr_sub_ui (tmp, tmp, 1, MPFR_RNDN); - if (red == 0 && comparaison > 0) + if (red == 0 && comparison > 0) /* use xp = 1/sk */ mpfr_mul (sk, tmp, xp, MPFR_RNDN); else mpfr_div (sk, tmp, sk, MPFR_RNDN); } - /* we started from x0 = 1/|x| if |x| > 1, and |x| otherwise, thus + /* We started from x0 = 1/|x| if |x| > 1, and |x| otherwise, thus we had x0 = min(|x|, 1/|x|) <= 1, and applied 'red' times the - argument reduction x -> (sqrt(1+x^2)-1)/x, which keeps 0 < x < 1, - thus 0 < sk <= 1, and sk=1 can occur only if red=0 */ + argument reduction x -> (sqrt(1+x^2)-1)/x, which keeps 0 < x <= 1 */ - /* If sk=1, then if |x| < 1, we have 1 - 2^(-prec-1) <= |x| < 1, - or if |x| > 1, we have 1 - 2^(-prec-1) <= 1/|x| < 1, thus in all - cases ||x| - 1| <= 2^(-prec), from which it follows - |atan|x| - Pi/4| <= 2^(-prec), given the Taylor expansion - atan(1+x) = Pi/4 + x/2 - x^2/4 + ... - Since Pi/4 = 0.785..., the error is at most one ulp. + /* We first show that if the for-loop is executed at least once, then + sk < 1 after the loop. Indeed for 1/2 <= x <= 1, interval + arithmetic with precision 5 shows that (sqrt(1+x^2)-1)/x, + when evaluated with rounding to nearest, gives a value <= 0.875. + Now assume 2^(-k-1) <= x <= 2^(-k) for k >= 1. + Then o(x^2) <= 2^(-2k), o(1+x^2) <= 1+2^(-2k), + o(sqrt(1+x^2)) <= 1+2^(-2k-1), o(sqrt(1+x^2)-1) <= 2^(-2k-1), + and o((sqrt(1+x^2)-1)/x) <= 2^(-k) <= 1/2. + + Now if sk=1 before the loop, then EXP(sk)=1 and since log2p >= 0, + the loop is performed at least once, thus the case sk=1 cannot + happen below. */ - if (MPFR_UNLIKELY(mpfr_cmp_ui (sk, 1) == 0)) - { - mpfr_const_pi (arctgt, MPFR_RNDN); /* 1/2 ulp extra error */ - mpfr_div_2ui (arctgt, arctgt, 2, MPFR_RNDN); /* exact */ - realprec = prec - 2; - goto can_round; - } + + MPFR_ASSERTD(mpfr_cmp_ui (sk, 1) < 0); /* Assignation */ MPFR_SET_ZERO (arctgt); @@ -408,7 +488,7 @@ /* argument reduction */ mpfr_mul_2exp (arctgt, arctgt, red, MPFR_RNDN); - if (comparaison > 0) + if (comparison > 0) { /* atan(x) = Pi/2-atan(1/x) for x > 0 */ mpfr_const_pi (tmp, MPFR_RNDN); mpfr_div_2ui (tmp, tmp, 1, MPFR_RNDN); @@ -416,7 +496,6 @@ } MPFR_SET_POS (arctgt); - can_round: if (MPFR_LIKELY (MPFR_CAN_ROUND (arctgt, realprec + est_lost - lost, MPFR_PREC (atan), rnd_mode))) break; @@ -429,7 +508,6 @@ for (i = 0 ; i < oldn0 ; i++) mpz_clear (tabz[i]); mpz_clear (ukz); - (*__gmp_free_func) (tabz, oldn0 * sizeof (mpz_t)); MPFR_GROUP_CLEAR (group); MPFR_SAVE_EXPO_FREE (expo); diff -Nru mpfr4-3.1.4/src/atanh.c mpfr4-4.0.2/src/atanh.c --- mpfr4-3.1.4/src/atanh.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/atanh.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_atanh -- Inverse Hyperbolic Tangente -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,17 +17,90 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" - /* The computation of atanh is done by - atanh= 1/2*ln(x+1)-1/2*ln(1-x) */ +/* Put in y an approximation of atanh(x) for x small. + We assume x <= 1/2, in which case: + x <= y ~ atanh(x) = x + x^3/3 + x^5/5 + x^7/7 + ... <= 2*x. + Return k such that the error is bounded by 2^k*ulp(y). +*/ +static int +mpfr_atanh_small (mpfr_ptr y, mpfr_srcptr x) +{ + mpfr_prec_t p = MPFR_PREC(y), err; + mpfr_t x2, t, u; + unsigned long i; + int k; + + MPFR_ASSERTD(MPFR_GET_EXP (x) <= -1); + + /* in the following, theta represents a value with |theta| <= 2^(1-p) + (might be a different value each time) */ + + mpfr_init2 (t, p); + mpfr_init2 (u, p); + mpfr_init2 (x2, p); + mpfr_set (t, x, MPFR_RNDF); /* t = x * (1 + theta) */ + mpfr_set (y, t, MPFR_RNDF); /* exact */ + mpfr_mul (x2, x, x, MPFR_RNDF); /* x2 = x^2 * (1 + theta) */ + for (i = 3; ; i += 2) + { + mpfr_mul (t, t, x2, MPFR_RNDF); /* t = x^i * (1 + theta)^i */ + mpfr_div_ui (u, t, i, MPFR_RNDF); /* u = x^i/i * (1 + theta)^(i+1) */ + if (MPFR_GET_EXP (u) <= MPFR_GET_EXP (y) - p) /* |u| < ulp(y) */ + break; + mpfr_add (y, y, u, MPFR_RNDF); /* error <= ulp(y) */ + } + /* We assume |(1 + theta)^(i+1)| <= 2. + The neglected part is at most |u| + |u|/4 + |u|/16 + ... <= 4/3*|u|, + which has to be multiplied by |(1 + theta)^(i+1)| <= 2, thus at most + 3 ulp(y). + The rounding error on y is bounded by: + * for the (i-3)/2 add/sub, each error is bounded by ulp(y_i), + where y_i is the current value of y, which is bounded by ulp(y) + for y the final value (since it increases in absolute value), + this yields (i-3)/2*ulp(y) + * from Lemma 3.1 from [Higham02] (see algorithms.tex), + the relative error on u at step i is bounded by: + (i+1)*epsilon/(1-(i+1)*epsilon) where epsilon = 2^(1-p). + If (i+1)*epsilon <= 1/2, then the relative error on u at + step i is bounded by 2*(i+1)*epsilon, and since |u| <= 1/2^(i+1) + at step i, this gives an absolute error bound of; + 2*epsilon*x*(4/2^4 + 6/2^6 + 8/2^8 + ...) = 2*2^(1-p)*x*(7/18) = + 14/9*2^(-p)*x <= 2*ulp(x). + + If (i+1)*epsilon <= 1/2, then the relative error on u at step i + is bounded by (i+1)*epsilon/(1-(i+1)*epsilon) <= 1, thus it follows + |(1 + theta)^(i+1)| <= 2. + + Finally the total error is bounded by 3*ulp(y) + (i-3)/2*ulp(y) +2*ulp(x). + Since x <= 2*y, we have ulp(x) <= 2*ulp(y), thus the error is bounded by: + (i+7)/2*ulp(y). + */ + err = (i + 8) / 2; /* ceil((i+7)/2) */ + k = __gmpfr_int_ceil_log2 (err); + MPFR_ASSERTN(k + 2 < p); + /* if k + 2 < p, since k = ceil(log2(err)), we have err <= 2^k <= 2^(p-3), + thus i+7 <= 2*err <= 2^(p-2), thus (i+7)*epsilon <= 1/2, which implies + our assumption (i+1)*epsilon <= 1/2. */ + mpfr_clear (t); + mpfr_clear (u); + mpfr_clear (x2); + return k; +} + +/* The computation of atanh is done by: + atanh = ln((1+x)/(1-x)) / 2 + except when x is very small, in which case atanh = x + tiny error, + and when x is small, where we use directly the Taylor expansion. +*/ int -mpfr_atanh (mpfr_ptr y, mpfr_srcptr xt , mpfr_rnd_t rnd_mode) +mpfr_atanh (mpfr_ptr y, mpfr_srcptr xt, mpfr_rnd_t rnd_mode) { int inexact; mpfr_t x, t, te; @@ -67,7 +140,7 @@ { MPFR_SET_INF (y); MPFR_SET_SAME_SIGN (y, xt); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); MPFR_RET (0); } MPFR_SET_NAN (y); @@ -85,29 +158,42 @@ MPFR_TMP_INIT_ABS (x, xt); Ny = MPFR_PREC (y); Nt = MAX (Nx, Ny); - /* the optimal number of bits : see algorithms.ps */ Nt = Nt + MPFR_INT_CEIL_LOG2 (Nt) + 4; - /* initialise of intermediary variable */ + /* initialize of intermediary variable */ mpfr_init2 (t, Nt); mpfr_init2 (te, Nt); - /* First computation of cosh */ MPFR_ZIV_INIT (loop, Nt); for (;;) { + int k; + + /* small case: assuming the AGM algorithm used by mpfr_log uses + log2(p) steps for a precision of p bits, we try the special + variant whenever EXP(x) <= -p/log2(p). */ + k = 1 + __gmpfr_int_ceil_log2 (Ny); /* the +1 avoids a division by 0 + when Ny=1 */ + if (MPFR_GET_EXP (x) <= - 1 - (mpfr_exp_t) (Ny / k)) + /* this implies EXP(x) <= -1 thus x < 1/2 */ + { + err = Nt - mpfr_atanh_small (t, x); + goto round; + } + /* compute atanh */ - mpfr_ui_sub (te, 1, x, MPFR_RNDU); /* (1-xt)*/ - mpfr_add_ui (t, x, 1, MPFR_RNDD); /* (xt+1)*/ - mpfr_div (t, t, te, MPFR_RNDN); /* (1+xt)/(1-xt)*/ - mpfr_log (t, t, MPFR_RNDN); /* ln((1+xt)/(1-xt))*/ - mpfr_div_2ui (t, t, 1, MPFR_RNDN); /* (1/2)*ln((1+xt)/(1-xt))*/ + mpfr_ui_sub (te, 1, x, MPFR_RNDU); /* (1-x) with x = |xt| */ + mpfr_add_ui (t, x, 1, MPFR_RNDD); /* (1+x) */ + mpfr_div (t, t, te, MPFR_RNDN); /* (1+x)/(1-x) */ + mpfr_log (t, t, MPFR_RNDN); /* ln((1+x)/(1-x)) */ + mpfr_div_2ui (t, t, 1, MPFR_RNDN); /* ln((1+x)/(1-x)) / 2 */ /* error estimate: see algorithms.tex */ /* FIXME: this does not correspond to the value in algorithms.tex!!! */ - /* err=Nt-__gmpfr_ceil_log2(1+5*pow(2,1-MPFR_EXP(t)));*/ + /* err = Nt - __gmpfr_ceil_log2(1+5*pow(2,1-MPFR_EXP(t))); */ err = Nt - (MAX (4 - MPFR_GET_EXP (t), 0) + 1); + round: if (MPFR_LIKELY (MPFR_IS_ZERO (t) || MPFR_CAN_ROUND (t, err, Ny, rnd_mode))) break; @@ -121,10 +207,9 @@ inexact = mpfr_set4 (y, t, rnd_mode, MPFR_SIGN (xt)); - mpfr_clear(t); - mpfr_clear(te); + mpfr_clear (t); + mpfr_clear (te); MPFR_SAVE_EXPO_FREE (expo); return mpfr_check_range (y, inexact, rnd_mode); } - diff -Nru mpfr4-3.1.4/src/bernoulli.c mpfr4-4.0.2/src/bernoulli.c --- mpfr4-3.1.4/src/bernoulli.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/bernoulli.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* bernoulli -- internal function to compute Bernoulli numbers. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,64 +17,239 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" -/* assuming b[0]...b[2(n-1)] are computed, computes and stores B[2n]*(2n+1)! +/* assume p >= 5 and is odd */ +static int +is_prime (unsigned long p) +{ + unsigned long q; + + MPFR_ASSERTD (p >= 5 && (p & 1) != 0); + for (q = 3; q * q <= p; q += 2) + if ((p % q) == 0) + return 0; + return 1; +} - t/(exp(t)-1) = sum(B[j]*t^j/j!, j=0..infinity) - thus t = (exp(t)-1) * sum(B[j]*t^j/j!, n=0..infinity). - Taking the coefficient of degree n+1 > 1, we get: - 0 = sum(1/(n+1-k)!*B[k]/k!, k=0..n) - which gives: - B[n] = -sum(binomial(n+1,k)*B[k], k=0..n-1)/(n+1). - - Let C[n] = B[n]*(n+1)!. - Then C[n] = -sum(binomial(n+1,k)*C[k]*n!/(k+1)!, k=0..n-1), - which proves that the C[n] are integers. -*/ -mpz_t* +/* Computes and stores B[2n]*(2n+1)! in b[n] + using Von Staudt–Clausen theorem, which says that the denominator of B[n] + divides the product of all primes p such that p-1 divides n. + Since B[n] = zeta(n) * 2*n!/(2pi)^n, we compute an approximation of + d * zeta(n) * 2*n!/(2pi)^n and round it to the nearest integer. */ +static void mpfr_bernoulli_internal (mpz_t *b, unsigned long n) { + unsigned long p, err, zn; + mpz_t s, t, u, den; + mpz_ptr num; + mpfr_t y, z; + int ok; + /* Prec[n/2] is minimal precision so that result is correct for B[n] */ + mpfr_prec_t prec; + mpfr_prec_t Prec[] = {0, 5, 5, 6, 6, 9, 16, 10, 19, 23, 25, 27, 35, 31, + 42, 51, 51, 50, 73, 60, 76, 79, 83, 87, 101, 97, + 108, 113, 119, 125, 149, 133, 146}; + + mpz_init (b[n]); + if (n == 0) { - b = (mpz_t *) (*__gmp_allocate_func) (sizeof (mpz_t)); - mpz_init_set_ui (b[0], 1); + mpz_set_ui (b[0], 1); + return; } + + /* compute denominator */ + num = b[n]; + n = 2 * n; + mpz_init_set_ui (den, 6); + for (p = 5; p <= n+1; p += 2) + { + if ((n % (p-1)) == 0 && is_prime (p)) + mpz_mul_ui (den, den, p); + } + if (n <= 64) + prec = Prec[n >> 1]; else { - mpz_t t; - unsigned long k; + /* evaluate the needed precision: zeta(n)*2*den*n!/(2*pi)^n <= + 3.3*den*(n/e/2/pi)^n*sqrt(2*pi*n) */ + prec = __gmpfr_ceil_log2 (7.0 * (double) n); /* bound 2*pi by 7 */ + prec = (prec + 1) >> 1; /* sqrt(2*pi*n) <= 2^prec */ + mpfr_init2 (z, 53); + mpfr_set_ui_2exp (z, 251469612, -32, MPFR_RNDU); /* 1/e/2/pi <= z */ + mpfr_mul_ui (z, z, n, MPFR_RNDU); + mpfr_log2 (z, z, MPFR_RNDU); + mpfr_mul_ui (z, z, n, MPFR_RNDU); + p = mpfr_get_ui (z, MPFR_RNDU); /* (n/e/2/pi)^n <= 2^p */ + mpfr_clear (z); + /* the +14 term ensures no rounding failure up to n=10000 */ + prec += p + mpz_sizeinbase (den, 2) + 14; + } + + try_again: + mpz_init (s); + mpz_init (t); + mpz_init (u); + mpz_set_ui (u, 1); + mpz_mul_2exp (u, u, prec); /* u = 2^prec */ + mpz_ui_pow_ui (t, 3, n); + mpz_fdiv_q (s, u, t); /* multiply all terms by 2^prec */ + /* we compute a lower bound of the series, thus the final result cannot + be too large */ + for (p = 4; mpz_cmp_ui (t, 0) > 0; p++) + { + mpz_ui_pow_ui (t, p, n); + mpz_fdiv_q (t, u, t); + /* 2^prec/p^n-1 < t <= 2^prec/p^n */ + mpz_add (s, s, t); + } + /* sum(2^prec/q^n-1, q=3..p) < t <= sum(2^prec/q^n, q=3..p) + thus the error on the truncated series is at most p-2. + The neglected part of the series is R = sum(1/x^n, x=p+1..infinity) + with int(1/x^n, x=p+1..infinity) <= R <= int(1/x^n, x=p..infinity) + thus 1/(n-1)/(p+1)^(n-1) <= R <= 1/(n-1)/p^(n-1). The difference between + the lower and upper bound is bounded by p^(-n), which is bounded by + 2^(-prec) since t=0 in the above loop */ + mpz_ui_pow_ui (t, p, n - 1); + mpz_mul_ui (t, t, n - 1); + mpz_cdiv_q (t, u, t); + mpz_add (s, s, t); + /* now 2^prec * (zeta(n)-1-1/2^n) - p < s <= 2^prec * (zeta(n)-1-1/2^n) */ + /* add 1 which is 2^prec */ + mpz_add (s, s, u); + /* add 1/2^n which is 2^(prec-n) */ + mpz_cdiv_q_2exp (u, u, n); + mpz_add (s, s, u); + /* now 2^prec * zeta(n) - p < s <= 2^prec * zeta(n) */ + /* multiply by n! */ + mpz_fac_ui (t, n); + mpz_mul (s, s, t); + /* multiply by 2*den */ + mpz_mul (s, s, den); + mpz_mul_2exp (s, s, 1); + /* now convert to mpfr */ + mpfr_init2 (z, prec); + mpfr_set_z (z, s, MPFR_RNDZ); + /* now (2^prec * zeta(n) - p) * 2*den*n! - ulp(z) < z <= + 2^prec * zeta(n) * 2*den*n!. + Since z <= 2^prec * zeta(n) * 2*den*n!, + ulp(z) <= 2*zeta(n) * 2*den*n!, thus + (2^prec * zeta(n)-(p+1)) * 2*den*n! < z <= 2^prec * zeta(n) * 2*den*n! */ + mpfr_div_2exp (z, z, prec, MPFR_RNDZ); + /* now (zeta(n) - (p+1)/2^prec) * 2*den*n! < z <= zeta(n) * 2*den*n! */ + /* divide by (2pi)^n */ + mpfr_init2 (y, prec); + mpfr_const_pi (y, MPFR_RNDU); + /* pi <= y <= pi * (1 + 2^(1-prec)) */ + mpfr_mul_2exp (y, y, 1, MPFR_RNDU); + /* 2pi <= y <= 2pi * (1 + 2^(1-prec)) */ + mpfr_pow_ui (y, y, n, MPFR_RNDU); + /* (2pi)^n <= y <= (2pi)^n * (1 + 2^(1-prec))^(n+1) */ + mpfr_div (z, z, y, MPFR_RNDZ); + /* now (zeta(n) - (p+1)/2^prec) * 2*den*n! / (2pi)^n / (1+2^(1-prec))^(n+1) + <= z <= zeta(n) * 2*den*n! / (2pi)^n, and since zeta(n) >= 1: + den * B[n] * (1 - (p+1)/2^prec) / (1+2^(1-prec))^(n+1) + <= z <= den * B[n] + Since 1 / (1+2^(1-prec))^(n+1) >= (1 - 2^(1-prec))^(n+1) >= + 1 - (n+1) * 2^(1-prec): + den * B[n] / (2pi)^n * (1 - (p+1)/2^prec) * (1-(n+1)*2^(1-prec)) + <= z <= den * B[n] thus + den * B[n] * (1 - (2n+p+3)/2^prec) <= z <= den * B[n] */ + + /* the error is bounded by 2^(EXP(z)-prec) * (2n+p+3) */ + for (err = 0, p = 2 * n + p + 3; p > 1; err++, p = (p + 1) >> 1); + zn = MPFR_LIMB_SIZE(z) * GMP_NUMB_BITS; /* total number of bits of z */ + if (err >= prec) + ok = 0; + else + { + err = prec - err; + /* now the absolute error is bounded by 2^(EXP(z) - err): + den * B[n] - 2^(EXP(z) - err) <= z <= den * B[n] + thus if subtracting 2^(EXP(z) - err) does not change the rounding + (up) we are ok */ + err = mpn_scan1 (MPFR_MANT(z), zn - err); + /* weight of this 1 bit is 2^(EXP(z) - zn + err) */ + ok = MPFR_EXP(z) < zn - err; + } + mpfr_get_z (num, z, MPFR_RNDU); + if ((n & 2) == 0) + mpz_neg (num, num); + + /* multiply by (n+1)! */ + mpz_mul_ui (t, t, n + 1); + mpz_divexact (t, t, den); /* t was still n! */ + mpz_mul (num, num, t); + mpz_set_ui (den, 1); + + mpfr_clear (y); + mpfr_clear (z); + mpz_clear (s); + mpz_clear (t); + mpz_clear (u); + + if (!ok) + { + prec += prec / 10; + goto try_again; + } + + mpz_clear (den); +} - b = (mpz_t *) (*__gmp_reallocate_func) - (b, n * sizeof (mpz_t), (n + 1) * sizeof (mpz_t)); - mpz_init (b[n]); - /* b[n] = -sum(binomial(2n+1,2k)*C[k]*(2n)!/(2k+1)!, k=0..n-1) */ - mpz_init_set_ui (t, 2 * n + 1); - mpz_mul_ui (t, t, 2 * n - 1); - mpz_mul_ui (t, t, 2 * n); - mpz_mul_ui (t, t, n); - mpz_fdiv_q_ui (t, t, 3); /* exact: t=binomial(2*n+1,2*k)*(2*n)!/(2*k+1)! - for k=n-1 */ - mpz_mul (b[n], t, b[n-1]); - for (k = n - 1; k-- > 0;) +static MPFR_THREAD_ATTR mpz_t *bernoulli_table = NULL; +static MPFR_THREAD_ATTR unsigned long bernoulli_size = 0; +static MPFR_THREAD_ATTR unsigned long bernoulli_alloc = 0; + +mpz_srcptr +mpfr_bernoulli_cache (unsigned long n) +{ + unsigned long i; + + if (n >= bernoulli_size) + { + if (bernoulli_alloc == 0) + { + bernoulli_alloc = MAX(16, n + n/4); + bernoulli_table = (mpz_t *) + mpfr_allocate_func (bernoulli_alloc * sizeof (mpz_t)); + bernoulli_size = 0; + } + else if (n >= bernoulli_alloc) + { + bernoulli_table = (mpz_t *) mpfr_reallocate_func + (bernoulli_table, bernoulli_alloc * sizeof (mpz_t), + (n + n/4) * sizeof (mpz_t)); + bernoulli_alloc = n + n/4; + } + MPFR_ASSERTD (bernoulli_alloc > n); + MPFR_ASSERTD (bernoulli_size >= 0); + for (i = bernoulli_size; i <= n; i++) + mpfr_bernoulli_internal (bernoulli_table, i); + bernoulli_size = n+1; + } + MPFR_ASSERTD (bernoulli_size > n); + return bernoulli_table[n]; +} + +void +mpfr_bernoulli_freecache (void) +{ + unsigned long i; + + if (bernoulli_table != NULL) + { + for (i = 0; i < bernoulli_size; i++) { - mpz_mul_ui (t, t, 2 * k + 1); - mpz_mul_ui (t, t, 2 * k + 2); - mpz_mul_ui (t, t, 2 * k + 2); - mpz_mul_ui (t, t, 2 * k + 3); - mpz_fdiv_q_ui (t, t, 2 * (n - k) + 1); - mpz_fdiv_q_ui (t, t, 2 * (n - k)); - mpz_addmul (b[n], t, b[k]); + mpz_clear (bernoulli_table[i]); } - /* take into account C[1] */ - mpz_mul_ui (t, t, 2 * n + 1); - mpz_fdiv_q_2exp (t, t, 1); - mpz_sub (b[n], b[n], t); - mpz_neg (b[n], b[n]); - mpz_clear (t); + mpfr_free_func (bernoulli_table, bernoulli_alloc * sizeof (mpz_t)); + bernoulli_table = NULL; + bernoulli_alloc = 0; + bernoulli_size = 0; } - return b; } diff -Nru mpfr4-3.1.4/src/beta.c mpfr4-4.0.2/src/beta.c --- mpfr4-3.1.4/src/beta.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/beta.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,345 @@ +/* mpfr_beta -- beta function + +Copyright 2017-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define MPFR_NEED_LONGLONG_H /* for MPFR_INT_CEIL_LOG2 */ +#include "mpfr-impl.h" + +/* use formula (6.2.2) from Abramowitz & Stegun: + beta(z,w) = gamma(z)*gamma(w)/gamma(z+w) */ +int +mpfr_beta (mpfr_ptr r, mpfr_srcptr z, mpfr_srcptr w, mpfr_rnd_t rnd_mode) +{ + mpfr_exp_t emin, emax; + mpfr_uexp_t pmin; + mpfr_prec_t prec; + mpfr_t z_plus_w, tmp, tmp2; + int inex, w_integer; + MPFR_GROUP_DECL (group); + MPFR_ZIV_DECL (loop); + MPFR_SAVE_EXPO_DECL (expo); + + if (mpfr_less_p (z, w)) + return mpfr_beta (r, w, z, rnd_mode); + + /* Now, either z and w are unordered (at least one is a NaN), or z >= w. */ + + if (MPFR_ARE_SINGULAR (z, w)) + { + /* if z or w is NaN, return NaN */ + if (MPFR_IS_NAN (z) || MPFR_IS_NAN (w)) + { + MPFR_SET_NAN (r); + MPFR_RET_NAN; + } + else if (MPFR_IS_INF (z) || MPFR_IS_INF (w)) + { + /* Since we have z >= w: + if z = +Inf and w > 0, then r = +0 (including w = +Inf); + if z = +Inf and w = 0, then r = NaN + [beta(z,1/log(z)) tends to +Inf whereas + beta(z,1/log(log(z))) tends to +0] + if z = +Inf and w < 0: + if w is an integer or -Inf: r = NaN + if -2k-1 < w < -2k: r = -Inf + if -2k-2 < w < -2k-1: r = +Inf + if w = -Inf and z is finite and not an integer: + beta(z,t) for t going to -Inf oscillates between positive and + negative values, with poles around integer values of t, thus + beta(z,w) gives NaN; + if w = -Inf and z is an integer: + beta(z,w) gives +0 for z even > 0, -0 for z odd > 0, + NaN for z <= 0; + if z = -Inf (then w = -Inf too): r = NaN */ + if (MPFR_IS_INF (z) && MPFR_IS_POS(z)) /* z = +Inf */ + { + if (mpfr_cmp_ui (w, 0) > 0) + { + MPFR_SET_ZERO(r); + MPFR_SET_POS(r); + MPFR_RET(0); + } + else if (MPFR_IS_ZERO(w) || MPFR_IS_INF(w) || mpfr_integer_p (w)) + { + MPFR_SET_NAN(r); + MPFR_RET_NAN; + } + else + { + long q; + mpfr_t t; + + MPFR_SAVE_EXPO_MARK (expo); + mpfr_init2 (t, MPFR_PREC_MIN); + mpfr_set_ui (t, 1, MPFR_RNDN); + mpfr_fmodquo (t, &q, w, t, MPFR_RNDD); + mpfr_clear (t); + MPFR_SAVE_EXPO_FREE (expo); + /* q contains the low bits of trunc(w) where trunc() rounds + towards zero, thus if q is odd, then -2k-2 < w < -2k-1 */ + MPFR_SET_INF(r); + if ((unsigned long) q & 1) + MPFR_SET_NEG(r); + else + MPFR_SET_POS(r); + MPFR_RET(0); + } + } + else if (MPFR_IS_INF(w)) /* w = -Inf */ + { + if (mpfr_cmp_ui (z, 0) <= 0 || !mpfr_integer_p (z)) + { + MPFR_SET_NAN(r); + MPFR_RET_NAN; + } + else + { + MPFR_SET_ZERO(r); + if (mpfr_odd_p (z)) + MPFR_SET_NEG(r); + else + MPFR_SET_POS(r); + MPFR_RET(0); + } + } + } + else /* z or w is 0 */ + { + /* If x is not a nonpositive integer, Gamma(x) is regular, so that + when y -> 0 with either y >= 0 or y <= 0, + Beta(x,y) ~ Gamma(x) * Gamma(y) / Gamma(x) = Gamma(y) + Gamma(y) tends to an infinity of the same sign as y. + Thus Beta(x,y) should be an infinity of the same sign as y. + */ + if (mpfr_cmp_ui (z, 0) != 0) /* then w is +0 or -0 and z > 0 */ + { + /* beta(z,+0) = +Inf, beta(z,-0) = -Inf (see above) */ + MPFR_SET_INF(r); + MPFR_SET_SAME_SIGN(r,w); + MPFR_SET_DIVBY0 (); + MPFR_RET(0); + } + else if (mpfr_cmp_ui (w, 0) != 0) /* then z is +0 or -0 and w < 0 */ + { + if (mpfr_integer_p (w)) + { + /* For small u > 0, Beta(2u,w+u) and Beta(2u,w-u) have + opposite signs, so that they tend to infinities of + opposite signs when u -> 0. Thus the result is NaN. */ + MPFR_SET_NAN(r); + MPFR_RET_NAN; + } + else + { + /* beta(+0,w) = +Inf, beta(-0,w) = -Inf (see above) */ + MPFR_SET_INF(r); + MPFR_SET_SAME_SIGN(r,z); + MPFR_SET_DIVBY0 (); + MPFR_RET(0); + } + } + else /* w = z = 0: + beta(+0,+0) = +Inf + beta(-0,-0) = -Inf + beta(+0,-0) = NaN */ + { + if (MPFR_SIGN(z) == MPFR_SIGN(w)) + { + MPFR_SET_INF(r); + MPFR_SET_SAME_SIGN(r,z); + MPFR_SET_DIVBY0 (); + MPFR_RET(0); + } + else + { + MPFR_SET_NAN(r); + MPFR_RET_NAN; + } + } + } + } + + /* special case when w is a negative integer */ + w_integer = mpfr_integer_p (w); + if (w_integer && MPFR_IS_NEG(w)) + { + /* if z < 0 or z+w > 0, or z is not an integer, return NaN */ + if (MPFR_IS_NEG(z) || mpfr_cmpabs (z, w) > 0 || !mpfr_integer_p (z)) + { + MPFR_SET_NAN(r); + MPFR_RET_NAN; + } + /* If z+w = 0, the result is 1/z. */ + if (mpfr_cmpabs (z, w) == 0) + return mpfr_ui_div (r, 1, z, rnd_mode); + /* Now z is an integer and z+w <= 0: return (-1)^z*beta(z,1-w-z). + Since z and w are of opposite signs, |z+w| <= max(|z|,|w|). */ + emax = MAX (MPFR_EXP(z), MPFR_EXP(w)); + mpfr_init2 (z_plus_w, (mpfr_prec_t) emax); + inex = mpfr_add (z_plus_w, z, w, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + inex = mpfr_ui_sub (z_plus_w, 1, z_plus_w, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + if (mpfr_odd_p (z)) + { + inex = -mpfr_beta (r, z, z_plus_w, MPFR_INVERT_RND (rnd_mode)); + MPFR_CHANGE_SIGN(r); + } + else + inex = mpfr_beta (r, z, z_plus_w, rnd_mode); + mpfr_clear (z_plus_w); + return inex; + } + + /* special case when z is a negative integer: here w < z and w is not an + integer */ + if (mpfr_integer_p (z) && MPFR_IS_NEG(z)) + { + MPFR_SET_NAN(r); + MPFR_RET_NAN; + } + + MPFR_SAVE_EXPO_MARK (expo); + + /* compute the smallest precision such that z + w is exact */ + emax = MAX (MPFR_EXP(z), MPFR_EXP(w)); + emin = MIN (MPFR_EXP(z) - MPFR_PREC(z), MPFR_EXP(w) - MPFR_PREC(w)); + MPFR_ASSERTD (emax >= emin); + /* Thus the math value of emax - emin is representable in mpfr_uexp_t. */ + pmin = (mpfr_uexp_t) emax - emin; + /* If z and w have same sign, their sum can have exponent emax + 1. */ + pmin += 1; + if (pmin > MPFR_PREC_MAX) /* FIXME: check if result can differ from NaN. */ + { + MPFR_SAVE_EXPO_FREE (expo); + MPFR_SET_NAN(r); + MPFR_RET_NAN; + } + MPFR_ASSERTN (pmin <= MPFR_PREC_MAX); /* detect integer overflow */ + mpfr_init2 (z_plus_w, (mpfr_prec_t) pmin); + inex = mpfr_add (z_plus_w, z, w, MPFR_RNDN); + /* if z+w overflows with rounding to nearest, then w must be larger than + 1/2*ulp(z), thus we have an underflow. */ + if (MPFR_IS_INF(z_plus_w)) + { + mpfr_clear (z_plus_w); + MPFR_SAVE_EXPO_FREE (expo); + return mpfr_underflow (r, rnd_mode, 1); + } + MPFR_ASSERTN(inex == 0); + + /* If z+w is 0 or a negative integer, return +0 when w (and thus z) is not + an integer. Indeed, gamma(z) and gamma(w) are regular numbers, and + gamma(z+w) is Inf, thus 1/gamma(z+w) is zero. Unless there is a rule + to choose the sign of 0, we choose +0. */ + if (mpfr_cmp_ui (z_plus_w, 0) <= 0 && !w_integer + && mpfr_integer_p (z_plus_w)) + { + mpfr_clear (z_plus_w); + MPFR_SAVE_EXPO_FREE (expo); + MPFR_SET_ZERO(r); + MPFR_SET_POS(r); + MPFR_RET(0); + } + + prec = MPFR_PREC(r); + prec += MPFR_INT_CEIL_LOG2 (prec); + MPFR_GROUP_INIT_2 (group, prec, tmp, tmp2); + MPFR_ZIV_INIT (loop, prec); + for (;;) + { + unsigned int inex2; /* unsigned due to bitwise operations */ + + MPFR_GROUP_REPREC_2 (group, prec, tmp, tmp2); + inex2 = mpfr_gamma (tmp, z, MPFR_RNDN); + /* tmp = gamma(z) * (1 + theta) with |theta| <= 2^-prec */ + inex2 |= mpfr_gamma (tmp2, w, MPFR_RNDN); + /* tmp2 = gamma(w) * (1 + theta2) with |theta2| <= 2^-prec */ + inex2 |= mpfr_mul (tmp, tmp, tmp2, MPFR_RNDN); + /* tmp = gamma(z)*gamma(w) * (1 + theta3)^3 with |theta3| <= 2^-prec */ + inex2 |= mpfr_gamma (tmp2, z_plus_w, MPFR_RNDN); + /* tmp2 = gamma(z+w) * (1 + theta4) with |theta4| <= 2^-prec */ + inex2 |= mpfr_div (tmp, tmp, tmp2, MPFR_RNDN); + /* tmp = gamma(z)*gamma(w)/gamma(z+w) * (1 + theta5)^5 + with |theta5| <= 2^-prec. For prec >= 3, we have + |(1 + theta5)^5 - 1| <= 7 * 2^(-prec), thus the error is bounded + by 7 ulps */ + + if (MPFR_IS_NAN(tmp)) /* FIXME: most probably gamma(z)*gamma(w) = +-Inf, + and gamma(z+w) = +-Inf, can we do better? */ + { + mpfr_clear (z_plus_w); + MPFR_ZIV_FREE (loop); + MPFR_GROUP_CLEAR (group); + MPFR_SAVE_EXPO_FREE (expo); + MPFR_SET_NAN(r); + MPFR_RET_NAN; + } + + MPFR_ASSERTN(mpfr_regular_p (tmp)); + + /* if inex2 = 0, then tmp is exactly beta(z,w) */ + if (inex2 == 0 || + MPFR_LIKELY (MPFR_CAN_ROUND (tmp, prec - 3, MPFR_PREC(r), rnd_mode))) + break; + + /* beta(1,+/-2^(-k)) = +/-2^k is exact, and cannot be detected above + since gamma(+/-2^(-k)) is not exact */ + if (mpfr_cmp_ui (z, 1) == 0) + { + mpfr_exp_t expw = mpfr_get_exp (w); + if (mpfr_cmp_ui_2exp (w, 1, expw - 1) == 0) + { + /* since z >= w, this will only match w <= 1 */ + mpfr_set_ui_2exp (tmp, 1, 1 - expw, MPFR_RNDN); + break; + } + else if (mpfr_cmp_si_2exp (w, -1, expw - 1) == 0) + { + mpfr_set_si_2exp (tmp, -1, 1 - expw, MPFR_RNDN); + break; + } + } + + /* beta(2^k,1) = 1/2^k for k > 0 (k <= 0 was already tested above) */ + if (mpfr_cmp_ui (w, 1) == 0 && + mpfr_cmp_ui_2exp (z, 1, MPFR_EXP(z) - 1) == 0) + { + mpfr_set_ui_2exp (tmp, 1, 1 - MPFR_EXP(z), MPFR_RNDN); + break; + } + + /* beta(2,-0.5) = -4 */ + if (mpfr_cmp_ui (z, 2) == 0 && mpfr_cmp_si_2exp (w, -1, -1) == 0) + { + mpfr_set_si_2exp (tmp, -1, 2, MPFR_RNDN); + break; + } + + MPFR_ZIV_NEXT (loop, prec); + } + MPFR_ZIV_FREE (loop); + inex = mpfr_set (r, tmp, rnd_mode); + MPFR_GROUP_CLEAR (group); + mpfr_clear (z_plus_w); + MPFR_SAVE_EXPO_FREE (expo); + return mpfr_check_range (r, inex, rnd_mode); +} diff -Nru mpfr4-3.1.4/src/buildopt.c mpfr4-4.0.2/src/buildopt.c --- mpfr4-3.1.4/src/buildopt.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/buildopt.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* buildopt.c -- functions giving information about options used during the mpfr library compilation -Copyright 2009-2016 Free Software Foundation, Inc. +Copyright 2009-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -34,6 +34,16 @@ } int +mpfr_buildopt_float128_p (void) +{ +#ifdef MPFR_WANT_FLOAT128 + return 1; +#else + return 0; +#endif +} + +int mpfr_buildopt_decimal_p (void) { #ifdef MPFR_WANT_DECIMAL_FLOATS @@ -53,11 +63,18 @@ #endif } -const char *mpfr_buildopt_tune_case (void) +int +mpfr_buildopt_sharedcache_p (void) { -#ifdef MPFR_TUNE_CASE - return MPFR_TUNE_CASE; +#ifdef MPFR_WANT_SHARED_CACHE + return 1; #else - return "Generic thresholds"; + return 0; #endif } + +const char *mpfr_buildopt_tune_case (void) +{ + /* MPFR_TUNE_CASE is always defined (can be "default"). */ + return MPFR_TUNE_CASE; +} diff -Nru mpfr4-3.1.4/src/cache.c mpfr4-4.0.2/src/cache.c --- mpfr4-3.1.4/src/cache.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/cache.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_cache -- cache interface for multiple-precision constants in MPFR. -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -37,37 +37,76 @@ void mpfr_clear_cache (mpfr_cache_t cache) { - if (MPFR_PREC (cache->x) != 0) - mpfr_clear (cache->x); - MPFR_PREC (cache->x) = 0; + if (MPFR_UNLIKELY (MPFR_PREC (cache->x) != 0)) + { + /* Get the cache in read-write mode */ + MPFR_LOCK_WRITE(cache->lock); + + if (MPFR_LIKELY (MPFR_PREC (cache->x) != 0)) + { + mpfr_clear (cache->x); + MPFR_PREC (cache->x) = 0; + } + + /* Free the cache in read-write mode */ + MPFR_UNLOCK_WRITE(cache->lock); + } } int mpfr_cache (mpfr_ptr dest, mpfr_cache_t cache, mpfr_rnd_t rnd) { mpfr_prec_t prec = MPFR_PREC (dest); - mpfr_prec_t pold = MPFR_PREC (cache->x); + mpfr_prec_t pold; int inexact, sign; MPFR_SAVE_EXPO_DECL (expo); + /* Call the initialisation function of the cache if it's needed */ + MPFR_DEFERRED_INIT_CALL(cache); + MPFR_SAVE_EXPO_MARK (expo); + /* Get the cache in read-only mode */ + MPFR_LOCK_READ(cache->lock); + /* Read the precision within the cache */ + pold = MPFR_PREC (cache->x); if (MPFR_UNLIKELY (prec > pold)) { - /* No previous result in the cache or the precision of the - previous result is not sufficient. */ - - if (MPFR_UNLIKELY (pold == 0)) /* No previous result. */ - mpfr_init2 (cache->x, prec); + /* Free the cache in read-only mode */ + /* And get the cache in read-write mode */ + MPFR_LOCK_READ2WRITE(cache->lock); + + /* Retest the precision once we get the lock. + If there is no lock, there is no harm in this code */ + pold = MPFR_PREC (cache->x); + if (MPFR_LIKELY (prec > pold)) + { + /* No previous result in the cache or the precision of the previous + result is not sufficient. We increase the cache size by at least + 10% to avoid invalidating the cache many times if one performs + several computations with small increase of precision. */ + if (MPFR_UNLIKELY (pold == 0)) /* No previous result. */ + mpfr_init2 (cache->x, prec); /* as pold = prec below */ + else + pold += pold / 10; + + /* Update the cache. */ + if (pold < prec) + pold = prec; + + /* no need to keep the previous value */ + mpfr_set_prec (cache->x, pold); + cache->inexact = (*cache->func) (cache->x, MPFR_RNDN); + } - /* Update the cache. */ - pold = prec; - /* no need to keep the previous value */ - mpfr_set_prec (cache->x, pold); - cache->inexact = (*cache->func) (cache->x, MPFR_RNDN); + /* Free the cache in read-write mode */ + /* Get the cache in read-only mode */ + MPFR_LOCK_WRITE2READ(cache->lock); } /* now pold >= prec is the precision of cache->x */ + MPFR_ASSERTD (pold >= prec); + MPFR_ASSERTD (MPFR_PREC (cache->x) == pold); /* First, check if the cache has the exact value (unlikely). Else the exact value is between (assuming x=cache->x > 0): @@ -78,7 +117,7 @@ /* we assume all cached constants are positive */ MPFR_ASSERTN (MPFR_IS_POS (cache->x)); /* TODO... */ sign = MPFR_SIGN (cache->x); - MPFR_SET_EXP (dest, MPFR_GET_EXP (cache->x)); + MPFR_EXP (dest) = MPFR_GET_EXP (cache->x); MPFR_SET_SIGN (dest, sign); /* round cache->x from precision pold down to precision prec */ @@ -105,6 +144,8 @@ mpfr_overflow (dest, rnd, sign); ); + /* Rather a likely, this is a 100% success rate for + all constants of MPFR */ if (MPFR_LIKELY (cache->inexact != 0)) { switch (rnd) @@ -141,5 +182,9 @@ } MPFR_SAVE_EXPO_FREE (expo); + + /* Free the cache in read-only mode */ + MPFR_UNLOCK_READ(cache->lock); + return mpfr_check_range (dest, inexact, rnd); } diff -Nru mpfr4-3.1.4/src/cbrt.c mpfr4-4.0.2/src/cbrt.c --- mpfr4-3.1.4/src/cbrt.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/cbrt.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_cbrt -- cube root function. -Copyright 2002-2016 Free Software Foundation, Inc. +Copyright 2002-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H diff -Nru mpfr4-3.1.4/src/check.c mpfr4-4.0.2/src/check.c --- mpfr4-3.1.4/src/check.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/check.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_check -- Check if a floating-point number has not been corrupted. -Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2003-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,14 +17,18 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" /* - * Check if x is a valid mpfr_t initializes by mpfr_init + * Check if x is a valid mpfr_t initialized by mpfr_init * Returns 0 if isn't valid + * + * Note: Due to the MPFR_GET_ALLOC_SIZE test, this function must not + * be called on statically allocated numbers (only used inside MPFR). + * Anyway, this test should not be useful on such numbers. */ int mpfr_check (mpfr_srcptr x) @@ -32,49 +36,46 @@ mp_size_t s, i; mp_limb_t tmp; volatile mp_limb_t *xm; + mpfr_prec_t prec; int rw; - /* Check Sign */ - if (MPFR_SIGN(x) != MPFR_SIGN_POS && MPFR_SIGN(x) != MPFR_SIGN_NEG) + /* Check sign */ + if (MPFR_SIGN(x) != MPFR_SIGN_POS && + MPFR_SIGN(x) != MPFR_SIGN_NEG) return 0; - /* Check Precision */ - if ( (MPFR_PREC(x) < MPFR_PREC_MIN) || (MPFR_PREC(x) > MPFR_PREC_MAX)) + /* Check precision */ + prec = MPFR_PREC(x); + if (! MPFR_PREC_COND (prec)) return 0; - /* Check Mantissa */ + /* Check mantissa */ xm = MPFR_MANT(x); - if (!xm) + if (xm == NULL) return 0; /* Check size of mantissa */ s = MPFR_GET_ALLOC_SIZE(x); - if (s<=0 || s > MP_SIZE_T_MAX || - MPFR_PREC(x) > ((mpfr_prec_t)s*GMP_NUMB_BITS)) + if (s <= 0 || s > MP_SIZE_T_MAX || + prec > (mpfr_prec_t) s * GMP_NUMB_BITS) return 0; - /* Acces all the mp_limb of the mantissa: may do a seg fault */ - for(i = 0 ; i < s ; i++) + /* Access all the mp_limb of the mantissa: may do a seg fault */ + for (i = 0 ; i < s ; i++) tmp = xm[i]; - /* Check if it isn't singular*/ - if (! MPFR_IS_SINGULAR (x)) + /* Check singular numbers (do not use MPFR_IS_PURE_FP() in order to avoid + any assertion checking, as this function mpfr_check() does something + similar by returning a Boolean instead of doing an abort if the format + is incorrect). */ + if (MPFR_IS_SINGULAR (x)) + return MPFR_IS_ZERO(x) || MPFR_IS_NAN(x) || MPFR_IS_INF(x); + /* Check the most significant limb (its MSB must be 1) */ + if (! MPFR_IS_NORMALIZED (x)) + return 0; + /* Check the least significant limb (the trailing bits must be 0) */ + rw = prec % GMP_NUMB_BITS; + if (rw != 0) { - /* Check first mp_limb of mantissa (Must start with a 1 bit) */ - if ( ((xm[MPFR_LIMB_SIZE(x)-1])>>(GMP_NUMB_BITS-1)) == 0) - return 0; - /* Check last mp_limb of mantissa */ - rw = (MPFR_PREC(x) % GMP_NUMB_BITS); - if (rw != 0) - { - tmp = MPFR_LIMB_MASK (GMP_NUMB_BITS - rw); - if ((xm[0] & tmp) != 0) - return 0; - } - /* Check exponent range */ - if ((MPFR_EXP (x) < __gmpfr_emin) || (MPFR_EXP (x) > __gmpfr_emax)) + tmp = MPFR_LIMB_MASK (GMP_NUMB_BITS - rw); + if ((xm[0] & tmp) != 0) return 0; } - else - { - /* Singular value is zero, inf or nan */ - MPFR_ASSERTD(MPFR_IS_ZERO(x) || MPFR_IS_NAN(x) || MPFR_IS_INF(x)); - } - return 1; + /* Check exponent range */ + return MPFR_EXP_IN_RANGE (MPFR_EXP (x)); } - diff -Nru mpfr4-3.1.4/src/clear.c mpfr4-4.0.2/src/clear.c --- mpfr4-3.1.4/src/clear.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/clear.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_clear -- free the memory space allocated for a floating-point number -Copyright 1999-2001, 2004-2016 Free Software Foundation, Inc. +Copyright 1999-2001, 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,15 +17,15 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" -void +MPFR_HOT_FUNCTION_ATTR void mpfr_clear (mpfr_ptr m) { - (*__gmp_free_func) (MPFR_GET_REAL_PTR (m), + mpfr_free_func (MPFR_GET_REAL_PTR (m), MPFR_MALLOC_SIZE (MPFR_GET_ALLOC_SIZE (m))); MPFR_MANT (m) = (mp_limb_t *) 0; } diff -Nru mpfr4-3.1.4/src/clears.c mpfr4-4.0.2/src/clears.c --- mpfr4-3.1.4/src/clears.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/clears.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_clears -- free the memory space allocated for several floating-point numbers -Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2003-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,12 +18,12 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -#undef HAVE_STDARG -#include "config.h" /* for a build within gmp */ +# undef HAVE_STDARG +# include "config.h" #endif #if HAVE_STDARG diff -Nru mpfr4-3.1.4/src/cmp2.c mpfr4-4.0.2/src/cmp2.c --- mpfr4-3.1.4/src/cmp2.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/cmp2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_cmp2 -- exponent shift when subtracting two numbers. -Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ @@ -38,6 +38,7 @@ { mp_limb_t *bp, *cp, bb, cc = 0, lastc = 0, dif, high_dif = 0; mp_size_t bn, cn; + mpfr_exp_t sdiff_exp; mpfr_uexp_t diff_exp; mpfr_prec_t res = 0; int sign; @@ -48,13 +49,21 @@ /* the cases b=0 or c=0 are also treated apart in agm and sub (which calls sub1) */ - MPFR_ASSERTD (MPFR_IS_PURE_FP(b)); - MPFR_ASSERTD (MPFR_IS_PURE_FP(c)); + MPFR_ASSERTD (MPFR_IS_PURE_UBF (b)); + MPFR_ASSERTD (MPFR_IS_PURE_UBF (c)); - if (MPFR_GET_EXP (b) >= MPFR_GET_EXP (c)) + sdiff_exp = MPFR_UNLIKELY (MPFR_IS_UBF (b) || MPFR_IS_UBF (c)) ? + mpfr_ubf_diff_exp (b, c) : MPFR_GET_EXP (b) - MPFR_GET_EXP (c); + + /* The returned result is restricted to [MPFR_EXP_MIN,MPFR_EXP_MAX], + which is the range of the mpfr_exp_t type. But under the condition + below, the value of cancel will not be affected. */ + MPFR_STAT_STATIC_ASSERT (MPFR_EXP_MAX > MPFR_PREC_MAX); + + if (sdiff_exp >= 0) { sign = 1; - diff_exp = (mpfr_uexp_t) MPFR_GET_EXP (b) - MPFR_GET_EXP (c); + diff_exp = sdiff_exp; bp = MPFR_MANT(b); cp = MPFR_MANT(c); @@ -62,7 +71,7 @@ bn = (MPFR_PREC(b) - 1) / GMP_NUMB_BITS; cn = (MPFR_PREC(c) - 1) / GMP_NUMB_BITS; /* # of limbs of c minus 1 */ - if (MPFR_UNLIKELY( diff_exp == 0 )) + if (diff_exp == 0) { while (bn >= 0 && cn >= 0 && bp[bn] == cp[cn]) { @@ -73,30 +82,32 @@ if (MPFR_UNLIKELY (bn < 0)) { - if (MPFR_LIKELY (cn < 0)) /* b = c */ + if (MPFR_LIKELY (cn < 0)) /* |b| = |c| */ return 0; + /* b has been read entirely, but not c. Replace b by c for the + symmetric case below (only the sign differs if not 0). */ bp = cp; bn = cn; - cn = -1; + cn = -1; /* to enter the following "if" */ sign = -1; } if (MPFR_UNLIKELY (cn < 0)) /* c discards exactly the upper part of b */ { - unsigned int z; + int z; MPFR_ASSERTD (bn >= 0); while (bp[bn] == 0) { - if (--bn < 0) /* b = c */ + if (--bn < 0) /* |b| = |c| */ return 0; res += GMP_NUMB_BITS; } - count_leading_zeros(z, bp[bn]); /* bp[bn] <> 0 */ + count_leading_zeros (z, bp[bn]); /* bp[bn] <> 0 */ *cancel = res + z; return sign; } @@ -118,7 +129,7 @@ else /* MPFR_EXP(b) < MPFR_EXP(c) */ { sign = -1; - diff_exp = (mpfr_uexp_t) MPFR_GET_EXP (c) - MPFR_GET_EXP (b); + diff_exp = - (mpfr_uexp_t) sdiff_exp; bp = MPFR_MANT(c); cp = MPFR_MANT(b); @@ -136,7 +147,7 @@ if (MPFR_LIKELY (diff_exp < GMP_NUMB_BITS)) { cc = cp[cn] >> diff_exp; - /* warning: a shift by GMP_NUMB_BITS may give wrong results */ + /* warning: a shift by GMP_NUMB_BITS is not allowed by ISO C */ if (diff_exp) lastc = cp[cn] << (GMP_NUMB_BITS - diff_exp); cn--; @@ -152,6 +163,7 @@ while (MPFR_UNLIKELY ((cn >= 0 || lastc != 0) && (high_dif == 0) && (dif == 1))) { /* dif=1 implies diff_exp = 0 or 1 */ + MPFR_ASSERTD (diff_exp <= 1); bb = (bn >= 0) ? bp[bn] : 0; cc = lastc; if (cn >= 0) @@ -160,8 +172,9 @@ { cc += cp[cn]; } - else /* diff_exp = 1 */ + else { + MPFR_ASSERTD (diff_exp == 1); cc += cp[cn] >> 1; lastc = cp[cn] << (GMP_NUMB_BITS - 1); } @@ -188,9 +201,9 @@ } else /* high_dif == 0 */ { - unsigned int z; + int z; - count_leading_zeros(z, dif); /* dif > 1 here */ + count_leading_zeros (z, dif); /* dif > 1 here */ res += z; if (MPFR_LIKELY(dif != (MPFR_LIMB_ONE << (GMP_NUMB_BITS - z - 1)))) { /* dif is not a power of two */ @@ -200,7 +213,7 @@ } /* now result is res + (low(b) < low(c)) */ - while (MPFR_UNLIKELY (bn >= 0 && (cn >= 0 || lastc != 0))) + while (bn >= 0 && (cn >= 0 || lastc != 0)) { if (diff_exp >= GMP_NUMB_BITS) diff_exp -= GMP_NUMB_BITS; diff -Nru mpfr4-3.1.4/src/cmp_abs.c mpfr4-4.0.2/src/cmp_abs.c --- mpfr4-3.1.4/src/cmp_abs.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/cmp_abs.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_cmpabs -- compare the absolute values of two FP numbers -Copyright 1999, 2001-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -36,7 +36,7 @@ { if (MPFR_IS_NAN (b) || MPFR_IS_NAN (c)) { - MPFR_SET_ERANGE (); + MPFR_SET_ERANGEFLAG (); return 0; } else if (MPFR_IS_INF (b)) diff -Nru mpfr4-3.1.4/src/cmp.c mpfr4-4.0.2/src/cmp.c --- mpfr4-3.1.4/src/cmp.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/cmp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_cmp -- compare two floating-point numbers -Copyright 1999, 2001, 2003-2016 Free Software Foundation, Inc. +Copyright 1999, 2001, 2003-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -28,7 +28,7 @@ returns 0 and sets erange flag if b and/or c is NaN. */ -int +MPFR_HOT_FUNCTION_ATTR int mpfr_cmp3 (mpfr_srcptr b, mpfr_srcptr c, int s) { mpfr_exp_t be, ce; @@ -41,7 +41,7 @@ { if (MPFR_IS_NAN (b) || MPFR_IS_NAN (c)) { - MPFR_SET_ERANGE (); + MPFR_SET_ERANGEFLAG (); return 0; } else if (MPFR_IS_INF(b)) @@ -73,8 +73,8 @@ /* both signs and exponents are equal */ - bn = (MPFR_PREC(b)-1)/GMP_NUMB_BITS; - cn = (MPFR_PREC(c)-1)/GMP_NUMB_BITS; + bn = MPFR_LAST_LIMB (b); + cn = MPFR_LAST_LIMB (c); bp = MPFR_MANT(b); cp = MPFR_MANT(c); diff -Nru mpfr4-3.1.4/src/cmp_d.c mpfr4-4.0.2/src/cmp_d.c --- mpfr4-3.1.4/src/cmp_d.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/cmp_d.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_cmp_d -- compare a floating-point number with a double -Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2003-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -27,19 +27,19 @@ { mpfr_t tmp; int res; + mp_limb_t tmp_man[MPFR_LIMBS_PER_DOUBLE]; MPFR_SAVE_EXPO_DECL (expo); MPFR_SAVE_EXPO_MARK (expo); - mpfr_init2 (tmp, IEEE_DBL_MANT_DIG); + MPFR_TMP_INIT1(tmp_man, tmp, IEEE_DBL_MANT_DIG); res = mpfr_set_d (tmp, d, MPFR_RNDN); MPFR_ASSERTD (res == 0); - mpfr_clear_flags (); + MPFR_CLEAR_FLAGS (); res = mpfr_cmp (b, tmp); MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); - mpfr_clear (tmp); MPFR_SAVE_EXPO_FREE (expo); return res; } diff -Nru mpfr4-3.1.4/src/cmp_ld.c mpfr4-4.0.2/src/cmp_ld.c --- mpfr4-3.1.4/src/cmp_ld.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/cmp_ld.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_cmp_d -- compare a floating-point number with a long double -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,9 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include /* needed so that MPFR_LDBL_MANT_DIG is correctly defined */ + #include "mpfr-impl.h" int @@ -33,9 +35,17 @@ mpfr_init2 (tmp, MPFR_LDBL_MANT_DIG); res = mpfr_set_ld (tmp, d, MPFR_RNDN); + if (res != 0) /* can happen when "long double" is double-double */ + { + /* since the smallest value is 2^(-1074) and the largest is + < 2^1024, every double-double is exactly representable with + 1024 + 1074 bits */ + mpfr_set_prec (tmp, 1024 + 1074); + res = mpfr_set_ld (tmp, d, MPFR_RNDN); + } MPFR_ASSERTD (res == 0); - mpfr_clear_flags (); + MPFR_CLEAR_FLAGS (); res = mpfr_cmp (b, tmp); MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); diff -Nru mpfr4-3.1.4/src/cmp_si.c mpfr4-4.0.2/src/cmp_si.c --- mpfr4-3.1.4/src/cmp_si.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/cmp_si.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_cmp_si_2exp -- compare a floating-point number with a signed machine integer multiplied by a power of 2 -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -43,7 +43,7 @@ else if (MPFR_IS_ZERO(b)) return i != 0 ? -si : 0; /* NAN */ - MPFR_SET_ERANGE (); + MPFR_SET_ERANGEFLAG (); return 0; } else if (MPFR_SIGN(b) != si || i == 0) diff -Nru mpfr4-3.1.4/src/cmp_ui.c mpfr4-4.0.2/src/cmp_ui.c --- mpfr4-3.1.4/src/cmp_ui.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/cmp_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_cmp_ui_2exp -- compare a floating-point number with an unsigned machine integer multiplied by a power of 2 -Copyright 1999, 2001-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -37,7 +37,7 @@ { if (MPFR_IS_NAN (b)) { - MPFR_SET_ERANGE (); + MPFR_SET_ERANGEFLAG (); return 0; } else if (MPFR_IS_INF(b)) diff -Nru mpfr4-3.1.4/src/comparisons.c mpfr4-4.0.2/src/comparisons.c --- mpfr4-3.1.4/src/comparisons.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/comparisons.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* comparison predicates -Copyright 2002-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2002-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/constant.c mpfr4-4.0.2/src/constant.c --- mpfr4-3.1.4/src/constant.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/constant.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* MPFR internal constant FP numbers -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -26,3 +26,40 @@ const mpfr_t __gmpfr_one = {{2, MPFR_SIGN_POS, 1, (mp_limb_t*)__gmpfr_limb1}}; const mpfr_t __gmpfr_two = {{2, MPFR_SIGN_POS, 2, (mp_limb_t*)__gmpfr_limb1}}; const mpfr_t __gmpfr_four ={{2, MPFR_SIGN_POS, 3, (mp_limb_t*)__gmpfr_limb1}}; +const mpfr_t __gmpfr_mone ={{2, MPFR_SIGN_NEG, 1, (mp_limb_t*)__gmpfr_limb1}}; + +#if 0 +#elif GMP_NUMB_BITS == 16 +static const mp_limb_t mpfr_l2_dd__tab[] = { 0x79ab, 0xd1cf, 0x17f7, 0xb172 }; +#elif GMP_NUMB_BITS == 32 +static const mp_limb_t mpfr_l2_dd__tab[] = { 0xd1cf79ab, 0xb17217f7}; +#elif GMP_NUMB_BITS == 64 +static const mp_limb_t mpfr_l2_dd__tab[] = { 0xb17217f7d1cf79ab }; +#elif GMP_NUMB_BITS == 96 +static const mp_limb_t mpfr_l2_dd__tab[] = { 0xb17217f7d1cf79ab00000000 }; +#elif GMP_NUMB_BITS == 128 +static const mp_limb_t mpfr_l2_dd__tab[] = { 0xb17217f7d1cf79ab0000000000000000 }; +#elif GMP_NUMB_BITS == 256 +static const mp_limb_t mpfr_l2_dd__tab[] = { 0xb17217f7d1cf79ab000000000000000000000000000000000000000000000000 }; +#endif + +const mpfr_t __gmpfr_const_log2_RNDD = + {{64, MPFR_SIGN_POS, 0, (mp_limb_t*)mpfr_l2_dd__tab}}; + +#if 0 +#elif GMP_NUMB_BITS == 16 +static const mp_limb_t mpfr_l2_du__tab[] = { 0x79ac, 0xd1cf, 0x17f7, 0xb172 }; +#elif GMP_NUMB_BITS == 32 +static const mp_limb_t mpfr_l2_du__tab[] = { 0xd1cf79ac, 0xb17217f7}; +#elif GMP_NUMB_BITS == 64 +static const mp_limb_t mpfr_l2_du__tab[] = { 0xb17217f7d1cf79ac }; +#elif GMP_NUMB_BITS == 96 +static const mp_limb_t mpfr_l2_du__tab[] = { 0xb17217f7d1cf79ac00000000 }; +#elif GMP_NUMB_BITS == 128 +static const mp_limb_t mpfr_l2_du__tab[] = { 0xb17217f7d1cf79ac0000000000000000 }; +#elif GMP_NUMB_BITS == 256 +static const mp_limb_t mpfr_l2_du__tab[] = { 0xb17217f7d1cf79ac000000000000000000000000000000000000000000000000 }; +#endif + +const mpfr_t __gmpfr_const_log2_RNDU = + {{64, MPFR_SIGN_POS, 0, (mp_limb_t*)mpfr_l2_du__tab}}; diff -Nru mpfr4-3.1.4/src/const_catalan.c mpfr4-4.0.2/src/const_catalan.c --- mpfr4-3.1.4/src/const_catalan.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/const_catalan.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_const_catalan -- compute Catalan's constant. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,22 +17,14 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* Declare the cache */ -MPFR_DECL_INIT_CACHE(__gmpfr_cache_const_catalan, mpfr_const_catalan_internal); - -#ifdef MPFR_WIN_THREAD_SAFE_DLL -mpfr_cache_t * -__gmpfr_cache_const_catalan_f() -{ - return &__gmpfr_cache_const_catalan; -} -#endif +MPFR_DECL_INIT_CACHE (__gmpfr_cache_const_catalan, mpfr_const_catalan_internal) /* Set User Interface */ #undef mpfr_const_catalan diff -Nru mpfr4-3.1.4/src/const_euler.c mpfr4-4.0.2/src/const_euler.c --- mpfr4-3.1.4/src/const_euler.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/const_euler.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_const_euler -- Euler's constant -Copyright 2001-2016 Free Software Foundation, Inc. -Contributed by the AriC and Caramba projects, INRIA. +Copyright 2001-2019 Free Software Foundation, Inc. +Contributed by Fredrik Johansson. This file is part of the GNU MPFR Library. @@ -17,22 +17,17 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* The approximation error bound uses Theorem 1 and Remark 2 in + http://arxiv.org/pdf/1312.0039v1.pdf */ + #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* Declare the cache */ -MPFR_DECL_INIT_CACHE(__gmpfr_cache_const_euler, mpfr_const_euler_internal); - -#ifdef MPFR_WIN_THREAD_SAFE_DLL -mpfr_cache_t * -__gmpfr_cache_const_euler_f() -{ - return &__gmpfr_cache_const_euler; -} -#endif +MPFR_DECL_INIT_CACHE (__gmpfr_cache_const_euler, mpfr_const_euler_internal) /* Set User Interface */ #undef mpfr_const_euler @@ -42,188 +37,240 @@ } -static void mpfr_const_euler_S2 (mpfr_ptr, unsigned long); -static void mpfr_const_euler_R (mpfr_ptr, unsigned long); - -int -mpfr_const_euler_internal (mpfr_t x, mpfr_rnd_t rnd) +typedef struct { - mpfr_prec_t prec = MPFR_PREC(x), m, log2m; - mpfr_t y, z; - unsigned long n; - int inexact; - MPFR_ZIV_DECL (loop); + mpz_t P; + mpz_t Q; + mpz_t T; + mpz_t C; + mpz_t D; + mpz_t V; +} mpfr_const_euler_bs_struct; - log2m = MPFR_INT_CEIL_LOG2 (prec); - m = prec + 2 * log2m + 23; +typedef mpfr_const_euler_bs_struct mpfr_const_euler_bs_t[1]; - mpfr_init2 (y, m); - mpfr_init2 (z, m); +static void +mpfr_const_euler_bs_init (mpfr_const_euler_bs_t s) +{ + mpz_init (s->P); + mpz_init (s->Q); + mpz_init (s->T); + mpz_init (s->C); + mpz_init (s->D); + mpz_init (s->V); +} - MPFR_ZIV_INIT (loop, m); - for (;;) +static void +mpfr_const_euler_bs_clear (mpfr_const_euler_bs_t s) +{ + mpz_clear (s->P); + mpz_clear (s->Q); + mpz_clear (s->T); + mpz_clear (s->C); + mpz_clear (s->D); + mpz_clear (s->V); +} + +static void +mpfr_const_euler_bs_1 (mpfr_const_euler_bs_t s, + unsigned long n1, unsigned long n2, unsigned long N, + int cont) +{ + if (n2 - n1 == 1) { - mpfr_exp_t exp_S, err; - /* since prec >= 1, we have m >= 24 here, which ensures n >= 9 below */ - n = 1 + (unsigned long) ((double) m * LOG2 / 2.0); - MPFR_ASSERTD (n >= 9); - mpfr_const_euler_S2 (y, n); /* error <= 3 ulps */ - exp_S = MPFR_EXP(y); - mpfr_set_ui (z, n, MPFR_RNDN); - mpfr_log (z, z, MPFR_RNDD); /* error <= 1 ulp */ - mpfr_sub (y, y, z, MPFR_RNDN); /* S'(n) - log(n) */ - /* the error is less than 1/2 + 3*2^(exp_S-EXP(y)) + 2^(EXP(z)-EXP(y)) - <= 1/2 + 2^(exp_S+2-EXP(y)) + 2^(EXP(z)-EXP(y)) - <= 1/2 + 2^(1+MAX(exp_S+2,EXP(z))-EXP(y)) */ - err = 1 + MAX(exp_S + 2, MPFR_EXP(z)) - MPFR_EXP(y); - err = (err >= -1) ? err + 1 : 0; /* error <= 2^err ulp(y) */ - exp_S = MPFR_EXP(y); - mpfr_const_euler_R (z, n); /* err <= ulp(1/2) = 2^(-m) */ - mpfr_sub (y, y, z, MPFR_RNDN); - /* err <= 1/2 ulp(y) + 2^(-m) + 2^(err + exp_S - EXP(y)) ulp(y). - Since the result is between 0.5 and 1, ulp(y) = 2^(-m). - So we get 3/2*ulp(y) + 2^(err + exp_S - EXP(y)) ulp(y). - 3/2 + 2^e <= 2^(e+1) for e>=1, and <= 2^2 otherwise */ - err = err + exp_S - MPFR_EXP(y); - err = (err >= 1) ? err + 1 : 2; - if (MPFR_LIKELY (MPFR_CAN_ROUND (y, m - err, prec, rnd))) - break; - MPFR_ZIV_NEXT (loop, m); - mpfr_set_prec (y, m); - mpfr_set_prec (z, m); + mpz_set_ui (s->P, N); + mpz_mul (s->P, s->P, s->P); + mpz_set_ui (s->Q, n1 + 1); + mpz_mul (s->Q, s->Q, s->Q); + mpz_set_ui (s->C, 1); + mpz_set_ui (s->D, n1 + 1); + mpz_set (s->T, s->P); + mpz_set (s->V, s->P); } - MPFR_ZIV_FREE (loop); - - inexact = mpfr_set (x, y, rnd); - - mpfr_clear (y); - mpfr_clear (z); - - return inexact; /* always inexact */ + else + { + mpfr_const_euler_bs_t L, R; + mpz_t t, u, v; + unsigned long m = (n1 + n2) / 2; + + mpfr_const_euler_bs_init (L); + mpfr_const_euler_bs_init (R); + mpfr_const_euler_bs_1 (L, n1, m, N, 1); + mpfr_const_euler_bs_1 (R, m, n2, N, 1); + + mpz_init (t); + mpz_init (u); + mpz_init (v); + + if (cont) + mpz_mul (s->P, L->P, R->P); + + mpz_mul (s->Q, L->Q, R->Q); + mpz_mul (s->D, L->D, R->D); + + /* T = LP RT + RQ LT*/ + mpz_mul (t, L->P, R->T); + mpz_mul (v, R->Q, L->T); + mpz_add (s->T, t, v); + + /* C = LC RD + RC LD */ + if (cont) + { + mpz_mul (s->C, L->C, R->D); + mpz_addmul (s->C, R->C, L->D); + } + + /* V = RD (RQ LV + LC LP RT) + LD LP RV */ + mpz_mul (u, L->P, R->V); + mpz_mul (u, u, L->D); + mpz_mul (v, R->Q, L->V); + mpz_addmul (v, t, L->C); + mpz_mul (v, v, R->D); + mpz_add (s->V, u, v); + + mpfr_const_euler_bs_clear (L); + mpfr_const_euler_bs_clear (R); + mpz_clear (t); + mpz_clear (u); + mpz_clear (v); + } } static void -mpfr_const_euler_S2_aux (mpz_t P, mpz_t Q, mpz_t T, unsigned long n, - unsigned long a, unsigned long b, int need_P) +mpfr_const_euler_bs_2 (mpz_t P, mpz_t Q, mpz_t T, + unsigned long n1, unsigned long n2, unsigned long N, + int cont) { - if (a + 1 == b) + if (n2 - n1 == 1) { - mpz_set_ui (P, n); - if (a > 1) - mpz_mul_si (P, P, 1 - (long) a); + if (n1 == 0) + { + mpz_set_ui (P, 1); + mpz_set_ui (Q, 4 * N); + } + else + { + mpz_set_ui (P, 2 * n1 - 1); + mpz_pow_ui (P, P, 3); + mpz_set_ui (Q, 32 * n1); + mpz_mul_ui (Q, Q, N); + mpz_mul_ui (Q, Q, N); + } mpz_set (T, P); - mpz_set_ui (Q, a); - mpz_mul_ui (Q, Q, a); } else { - unsigned long c = (a + b) / 2; mpz_t P2, Q2, T2; - mpfr_const_euler_S2_aux (P, Q, T, n, a, c, 1); + unsigned long m = (n1 + n2) / 2; + mpz_init (P2); mpz_init (Q2); mpz_init (T2); - mpfr_const_euler_S2_aux (P2, Q2, T2, n, c, b, 1); + mpfr_const_euler_bs_2 (P, Q, T, n1, m, N, 1); + mpfr_const_euler_bs_2 (P2, Q2, T2, m, n2, N, 1); mpz_mul (T, T, Q2); mpz_mul (T2, T2, P); mpz_add (T, T, T2); - if (need_P) + if (cont) mpz_mul (P, P, P2); mpz_mul (Q, Q, Q2); mpz_clear (P2); mpz_clear (Q2); mpz_clear (T2); - /* divide by 2 if possible */ - { - unsigned long v2; - v2 = mpz_scan1 (P, 0); - c = mpz_scan1 (Q, 0); - if (c < v2) - v2 = c; - c = mpz_scan1 (T, 0); - if (c < v2) - v2 = c; - if (v2) - { - mpz_tdiv_q_2exp (P, P, v2); - mpz_tdiv_q_2exp (Q, Q, v2); - mpz_tdiv_q_2exp (T, T, v2); - } - } } } -/* computes S(n) = sum(n^k*(-1)^(k-1)/k!/k, k=1..ceil(4.319136566 * n)) - using binary splitting. - We have S(n) = sum(f(k), k=1..N) with N=ceil(4.319136566 * n) - and f(k) = n^k*(-1)*(k-1)/k!/k, - thus f(k)/f(k-1) = -n*(k-1)/k^2 -*/ -static void -mpfr_const_euler_S2 (mpfr_t x, unsigned long n) -{ - mpz_t P, Q, T; - unsigned long N = (unsigned long) (ALPHA * (double) n + 1.0); - mpz_init (P); - mpz_init (Q); - mpz_init (T); - mpfr_const_euler_S2_aux (P, Q, T, n, 1, N + 1, 0); - mpfr_set_z (x, T, MPFR_RNDN); - mpfr_div_z (x, x, Q, MPFR_RNDN); - mpz_clear (P); - mpz_clear (Q); - mpz_clear (T); -} - -/* computes R(n) = exp(-n)/n * sum(k!/(-n)^k, k=0..n-2) - with error at most 4*ulp(x). Assumes n>=2. - Since x <= exp(-n)/n <= 1/8, then 4*ulp(x) <= ulp(1). -*/ -static void -mpfr_const_euler_R (mpfr_t x, unsigned long n) +int +mpfr_const_euler_internal (mpfr_t x, mpfr_rnd_t rnd) { - unsigned long k, m; - mpz_t a, s; + mpfr_const_euler_bs_t sum; + mpz_t t, u, v; + unsigned long n, N; + mpfr_prec_t prec, wp, magn; mpfr_t y; + int inexact; + MPFR_ZIV_DECL (loop); - MPFR_ASSERTN (n >= 2); /* ensures sum(k!/(-n)^k, k=0..n-2) >= 2/3 */ - - /* as we multiply the sum by exp(-n), we need only PREC(x) - n/LOG2 bits */ - m = MPFR_PREC(x) - (unsigned long) ((double) n / LOG2); + prec = mpfr_get_prec (x); + wp = prec + 24; - mpz_init_set_ui (a, 1); - mpz_mul_2exp (a, a, m); - mpz_init_set (s, a); + mpfr_init2 (y, wp); + mpfr_const_euler_bs_init (sum); + mpz_init (t); + mpz_init (u); + mpz_init (v); - for (k = 1; k <= n; k++) + MPFR_ZIV_INIT (loop, wp); + for (;;) { - mpz_mul_ui (a, a, k); - mpz_fdiv_q_ui (a, a, n); - /* the error e(k) on a is e(k) <= 1 + k/n*e(k-1) with e(0)=0, - i.e. e(k) <= k */ - if (k % 2) - mpz_sub (s, s, a); - else - mpz_add (s, s, a); + /* The approximation error is bounded by 24 exp(-8n) when + n > 1, which is smaller than 2^-wp if + n > (wp + log_2(24)) * (log(2)/8). + Note log2(24) < 5 and log(2)/8 < 866434 / 10000000. */ + mpz_set_ui (t, wp + 5); + mpz_mul_ui (t, t, 866434); + mpz_cdiv_q_ui (t, t, 10000000); + n = mpz_get_ui (t); + + /* It is sufficient to take N >= alpha*n + 1 + where alpha = 3/LambertW(3/e) = 4.970625759544... */ + mpz_set_ui (t, n); + mpz_mul_ui (t, t, 4970626); + mpz_cdiv_q_ui (t, t, 1000000); + mpz_add_ui (t, t, 1); + N = mpz_get_ui (t); + + /* V / ((T + Q) * D) = S / I + where S = sum_{k=0}^{N-1} H_k n^(2k) / (k!)^2, + I = sum_{k=0}^{N-1} n^(2k) / (k!)^2 */ + mpfr_const_euler_bs_1 (sum, 0, N, n, 0); + mpz_add (sum->T, sum->T, sum->Q); + mpz_mul (t, sum->T, sum->D); + mpz_mul_2exp (u, sum->V, wp); + mpz_tdiv_q (v, u, t); + /* v * 2^-wp = S/I with error < 1 */ + + /* C / (D * V) = U where + U = (1/(4n)) sum_{k=0}^{2n-1} [(2k)!]^3 / ((k!)^4 8^(2k) (2n)^(2k)) */ + mpfr_const_euler_bs_2 (sum->C, sum->D, sum->V, 0, 2*n, n, 0); + mpz_mul (t, sum->Q, sum->Q); + mpz_mul (t, t, sum->V); + mpz_mul (u, sum->T, sum->T); + mpz_mul (u, u, sum->D); + mpz_mul_2exp (t, t, wp); + mpz_tdiv_q (t, t, u); + /* t * 2^-wp = U/I^2 with error < 1 */ + + /* gamma = S/I - U/I^2 - log(n) with error at most 2^-wp */ + mpz_sub (v, v, t); + /* v * 2^-wp now equals gamma + log(n) with error at most 3*2^-wp */ + + /* log(n) < 2^ceil(log2(n)) */ + magn = MPFR_INT_CEIL_LOG2(n); + mpfr_set_prec (y, wp + magn); + mpfr_set_ui (y, n, MPFR_RNDZ); /* exact */ + mpfr_log (y, y, MPFR_RNDZ); /* error < 2^-wp */ + + mpfr_mul_2exp (y, y, wp, MPFR_RNDZ); + mpfr_z_sub (y, v, y, MPFR_RNDZ); + mpfr_div_2exp (y, y, wp, MPFR_RNDZ); + /* rounding error from the last subtraction < 2^-wp */ + /* so y = gamma with error < 5*2^-wp */ + + if (MPFR_LIKELY (MPFR_CAN_ROUND (y, wp - 3, prec, rnd))) + break; + + MPFR_ZIV_NEXT (loop, wp); } - /* the error on s is at most 1+2+...+n = n*(n+1)/2 */ - mpz_fdiv_q_ui (s, s, n); /* err <= 1 + (n+1)/2 */ - MPFR_ASSERTN (MPFR_PREC(x) >= mpz_sizeinbase(s, 2)); - mpfr_set_z (x, s, MPFR_RNDD); /* exact */ - mpfr_div_2ui (x, x, m, MPFR_RNDD); - /* now x = 1/n * sum(k!/(-n)^k, k=0..n-2) <= 1/n */ - /* err(x) <= (n+1)/2^m <= (n+1)*exp(n)/2^PREC(x) */ - - mpfr_init2 (y, m); - mpfr_set_si (y, -(long)n, MPFR_RNDD); /* assumed exact */ - mpfr_exp (y, y, MPFR_RNDD); /* err <= ulp(y) <= exp(-n)*2^(1-m) */ - mpfr_mul (x, x, y, MPFR_RNDD); - /* err <= ulp(x) + (n + 1 + 2/n) / 2^prec(x) - <= ulp(x) + (n + 1 + 2/n) ulp(x)/x since x*2^(-prec(x)) < ulp(x) - <= ulp(x) + (n + 1 + 2/n) 3/(2n) ulp(x) since x >= 2/3*n for n >= 2 - <= 4 * ulp(x) for n >= 2 */ + + MPFR_ZIV_FREE (loop); + inexact = mpfr_set (x, y, rnd); + mpfr_clear (y); + mpz_clear (t); + mpz_clear (u); + mpz_clear (v); + mpfr_const_euler_bs_clear (sum); - mpz_clear (a); - mpz_clear (s); + return inexact; /* always inexact */ } diff -Nru mpfr4-3.1.4/src/const_log2.c mpfr4-4.0.2/src/const_log2.c --- mpfr4-3.1.4/src/const_log2.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/const_log2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_const_log2 -- compute natural logarithm of 2 -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -25,21 +25,11 @@ /* Declare the cache */ #ifndef MPFR_USE_LOGGING -MPFR_DECL_INIT_CACHE(__gmpfr_cache_const_log2, mpfr_const_log2_internal); +MPFR_DECL_INIT_CACHE (__gmpfr_cache_const_log2, mpfr_const_log2_internal) #else -MPFR_DECL_INIT_CACHE(__gmpfr_normal_log2, mpfr_const_log2_internal); -MPFR_DECL_INIT_CACHE(__gmpfr_logging_log2, mpfr_const_log2_internal); -MPFR_THREAD_ATTR mpfr_cache_ptr __gmpfr_cache_const_log2 = __gmpfr_normal_log2; -#endif - -#ifdef MPFR_WIN_THREAD_SAFE_DLL -# ifndef MPFR_USE_LOGGING -mpfr_cache_t * __gmpfr_cache_const_log2_f() { return &__gmpfr_cache_const_log2; } -# else -mpfr_cache_t * __gmpfr_normal_log2_f() { return &__gmpfr_normal_log2; } -mpfr_cache_t * __gmpfr_logging_log2_f() { return &__gmpfr_logging_log2; } -mpfr_cache_ptr * __gmpfr_cache_const_log2_f() { return &__gmpfr_cache_const_log2; } -# endif +MPFR_DECL_INIT_CACHE (__gmpfr_normal_log2, mpfr_const_log2_internal) +MPFR_DECL_INIT_CACHE (__gmpfr_logging_log2, mpfr_const_log2_internal) +MPFR_THREAD_VAR (mpfr_cache_ptr, __gmpfr_cache_const_log2, __gmpfr_normal_log2) #endif /* Set User interface */ @@ -127,33 +117,23 @@ mpz_t *T, *P, *Q; mpfr_t t, q; int inexact; - int ok = 1; /* ensures that the 1st try will give correct rounding */ unsigned long lgN, i; - MPFR_ZIV_DECL (loop); + MPFR_GROUP_DECL(group); + MPFR_TMP_DECL(marker); + MPFR_ZIV_DECL(loop); MPFR_LOG_FUNC ( ("rnd_mode=%d", rnd_mode), ("x[%Pu]=%.*Rg inex=%d", mpfr_get_prec(x), mpfr_log_prec, x, inexact)); - mpfr_init2 (t, MPFR_PREC_MIN); - mpfr_init2 (q, MPFR_PREC_MIN); - - if (n < 1253) - w = n + 10; /* ensures correct rounding for the four rounding modes, + if (n < 1069) + w = n + 9; /* ensures correct rounding for the four rounding modes, together with N = w / 3 + 1 (see below). */ - else if (n < 2571) - w = n + 11; /* idem */ - else if (n < 3983) - w = n + 12; - else if (n < 4854) - w = n + 13; - else if (n < 26248) - w = n + 14; else - { - w = n + 15; - ok = 0; - } + w = n + 10; /* idem at least for prec < 300000 */ + + MPFR_TMP_MARK(marker); + MPFR_GROUP_INIT_2(group, w, t, q); MPFR_ZIV_INIT (loop, w); for (;;) @@ -166,7 +146,7 @@ MPFR_ASSERTD(w >= 3 && N >= 2); lgN = MPFR_INT_CEIL_LOG2 (N) + 1; - T = (mpz_t *) (*__gmp_allocate_func) (3 * lgN * sizeof (mpz_t)); + T = (mpz_t *) MPFR_TMP_ALLOC (3 * lgN * sizeof (mpz_t)); P = T + lgN; Q = T + 2*lgN; for (i = 0; i < lgN; i++) @@ -178,9 +158,6 @@ S (T, P, Q, 0, N, 0); - mpfr_set_prec (t, w); - mpfr_set_prec (q, w); - mpfr_set_z (t, T[0], MPFR_RNDN); mpfr_set_z (q, Q[0], MPFR_RNDN); mpfr_div (t, t, q, MPFR_RNDN); @@ -191,20 +168,21 @@ mpz_clear (P[i]); mpz_clear (Q[i]); } - (*__gmp_free_func) (T, 3 * lgN * sizeof (mpz_t)); - if (MPFR_LIKELY (ok != 0 - || mpfr_can_round (t, w - 2, MPFR_RNDN, rnd_mode, n))) + /* for prec < 300000 and all rounding modes we checked by exhaustive + search that the rounding is correct */ + if (MPFR_LIKELY (n < 300000 || MPFR_CAN_ROUND (t, w - 2, n, rnd_mode))) break; MPFR_ZIV_NEXT (loop, w); + MPFR_GROUP_REPREC_2(group, w, t, q); } MPFR_ZIV_FREE (loop); inexact = mpfr_set (x, t, rnd_mode); - mpfr_clear (t); - mpfr_clear (q); + MPFR_GROUP_CLEAR(group); + MPFR_TMP_FREE(marker); return inexact; } diff -Nru mpfr4-3.1.4/src/const_pi.c mpfr4-4.0.2/src/const_pi.c --- mpfr4-3.1.4/src/const_pi.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/const_pi.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_const_pi -- compute Pi -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,28 +17,18 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" /* Declare the cache */ #ifndef MPFR_USE_LOGGING -MPFR_DECL_INIT_CACHE(__gmpfr_cache_const_pi, mpfr_const_pi_internal); +MPFR_DECL_INIT_CACHE (__gmpfr_cache_const_pi, mpfr_const_pi_internal) #else -MPFR_DECL_INIT_CACHE(__gmpfr_normal_pi, mpfr_const_pi_internal); -MPFR_DECL_INIT_CACHE(__gmpfr_logging_pi, mpfr_const_pi_internal); -MPFR_THREAD_ATTR mpfr_cache_ptr __gmpfr_cache_const_pi = __gmpfr_normal_pi; -#endif - -#ifdef MPFR_WIN_THREAD_SAFE_DLL -# ifndef MPFR_USE_LOGGING -mpfr_cache_t * __gmpfr_cache_const_pi_f() { return &__gmpfr_cache_const_pi; } -# else -mpfr_cache_t * __gmpfr_normal_pi_f() { return &__gmpfr_normal_pi; } -mpfr_cache_t * __gmpfr_logging_pi_f() { return &__gmpfr_logging_pi; } -mpfr_cache_ptr * __gmpfr_cache_const_pi_f() { return &__gmpfr_cache_const_pi; } -# endif +MPFR_DECL_INIT_CACHE (__gmpfr_normal_pi, mpfr_const_pi_internal) +MPFR_DECL_INIT_CACHE (__gmpfr_logging_pi, mpfr_const_pi_internal) +MPFR_THREAD_VAR (mpfr_cache_ptr, __gmpfr_cache_const_pi, __gmpfr_normal_pi) #endif /* Set User Interface */ @@ -54,6 +44,7 @@ { mpfr_t a, A, B, D, S; mpfr_prec_t px, p, cancel, k, kmax; + MPFR_GROUP_DECL (group); MPFR_ZIV_DECL (loop); int inex; @@ -68,11 +59,7 @@ p = px + 3 * kmax + 14; /* guarantees no recomputation for px <= 10000 */ - mpfr_init2 (a, p); - mpfr_init2 (A, p); - mpfr_init2 (B, p); - mpfr_init2 (D, p); - mpfr_init2 (S, p); + MPFR_GROUP_INIT_5 (group, p, a, A, B, D, S); MPFR_ZIV_INIT (loop, p); for (;;) { @@ -97,13 +84,13 @@ mpfr_sub (Bp, Ap, S, MPFR_RNDN); /* -1/4 <= Bp <= 3/4 */ mpfr_mul_2ui (Bp, Bp, 1, MPFR_RNDN); /* -1/2 <= Bp <= 3/2 */ mpfr_sub (S, Ap, Bp, MPFR_RNDN); - MPFR_ASSERTN (mpfr_cmp_ui (S, 1) < 0); - cancel = mpfr_cmp_ui (S, 0) ? (mpfr_uexp_t) -mpfr_get_exp(S) : p; + MPFR_ASSERTD (mpfr_cmp_ui (S, 1) < 0); + cancel = MPFR_NOTZERO (S) ? (mpfr_uexp_t) -mpfr_get_exp(S) : p; /* MPFR_ASSERTN (cancel >= px || cancel >= 9 * (1 << k) - 4); */ mpfr_mul_2ui (S, S, k, MPFR_RNDN); mpfr_sub (D, D, S, MPFR_RNDN); /* stop when |A_k - B_k| <= 2^(k-p) i.e. cancel >= p-k */ - if (cancel + k >= p) + if (cancel >= p - k) break; } #undef b @@ -119,20 +106,12 @@ p += kmax; MPFR_ZIV_NEXT (loop, p); - mpfr_set_prec (a, p); - mpfr_set_prec (A, p); - mpfr_set_prec (B, p); - mpfr_set_prec (D, p); - mpfr_set_prec (S, p); + MPFR_GROUP_REPREC_5 (group, p, a, A, B, D, S); } MPFR_ZIV_FREE (loop); inex = mpfr_set (x, A, rnd_mode); - mpfr_clear (a); - mpfr_clear (A); - mpfr_clear (B); - mpfr_clear (D); - mpfr_clear (S); + MPFR_GROUP_CLEAR (group); return inex; } diff -Nru mpfr4-3.1.4/src/copysign.c mpfr4-4.0.2/src/copysign.c --- mpfr4-3.1.4/src/copysign.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/copysign.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_copysign -- Produce a value with the magnitude of x and sign bit of y -Copyright 2001-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2001-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/cos.c mpfr4-4.0.2/src/cos.c --- mpfr4-3.1.4/src/cos.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/cos.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_cos -- cosine of a floating-point number -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -49,7 +49,7 @@ /* compute minimal i such that i*(i+1) does not fit in an unsigned long, assuming that there are no padding bits. */ - maxi = 1UL << (CHAR_BIT * sizeof(unsigned long) / 2); + maxi = 1UL << (sizeof(unsigned long) * CHAR_BIT / 2); if (maxi * (maxi / 2) == 0) /* test checked at compile time */ { /* can occur only when there are padding bits. */ @@ -174,7 +174,7 @@ } K0 = __gmpfr_isqrt (precy / 3); - m = precy + 2 * MPFR_INT_CEIL_LOG2 (precy) + 2 * K0; + m = precy + 2 * MPFR_INT_CEIL_LOG2 (precy) + 2 * K0 + 4; if (expx >= 3) { @@ -245,7 +245,7 @@ l = 2 * l + 1; if (reduce) l += (K == 0) ? 4 : 1; - k = MPFR_INT_CEIL_LOG2 (l) + 2*K; + k = MPFR_INT_CEIL_LOG2 (l) + 2 * K; /* now the error is bounded by 2^(k-m) = 2^(EXP(s)-err) */ exps = MPFR_GET_EXP (s); diff -Nru mpfr4-3.1.4/src/cosh.c mpfr4-4.0.2/src/cosh.c --- mpfr4-3.1.4/src/cosh.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/cosh.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_cosh -- hyperbolic cosine -Copyright 2001-2002, 2004-2016 Free Software Foundation, Inc. +Copyright 2001-2002, 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -82,7 +82,7 @@ /* The optimal number of bits : see algorithms.tex */ Nt = Ny + 3 + MPFR_INT_CEIL_LOG2 (Ny); - /* initialise of intermediary variables */ + /* initialize of intermediary variables */ MPFR_GROUP_INIT_2 (group, Nt, t, te); /* First computation of cosh */ diff -Nru mpfr4-3.1.4/src/cot.c mpfr4-4.0.2/src/cot.c --- mpfr4-3.1.4/src/cot.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/cot.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_cot - cotangent function. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* the cotangent is defined by cot(x) = 1/tan(x) = cos(x)/sin(x). @@ -32,7 +32,7 @@ #define ACTION_NAN(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1) #define ACTION_INF(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1) #define ACTION_ZERO(y,x) do { MPFR_SET_SAME_SIGN(y,x); MPFR_SET_INF(y); \ - mpfr_set_divby0 (); MPFR_RET(0); } while (1) + MPFR_SET_DIVBY0 (); MPFR_RET(0); } while (1) /* (This analysis is adapted from that for mpfr_coth.) Near x=0, cot(x) = 1/x - x/3 + ..., more precisely we have @@ -54,7 +54,7 @@ { \ int two2emin; \ int signx = MPFR_SIGN(x); \ - MPFR_ASSERTN (MPFR_EMIN_MIN + MPFR_EMAX_MAX == 0); \ + MPFR_STAT_STATIC_ASSERT (MPFR_EMIN_MIN + MPFR_EMAX_MAX == 0); \ if ((two2emin = mpfr_get_exp (x) == __gmpfr_emin + 1 && \ mpfr_powerof2_raw (x))) \ { \ diff -Nru mpfr4-3.1.4/src/coth.c mpfr4-4.0.2/src/coth.c --- mpfr4-3.1.4/src/coth.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/coth.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_coth - Hyperbolic cotangent function. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* the hyperbolic cotangent is defined by coth(x) = 1/tanh(x) @@ -33,7 +33,7 @@ #define ACTION_NAN(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1) #define ACTION_INF(y) return mpfr_set_si (y, MPFR_IS_POS(x) ? 1 : -1, rnd_mode) #define ACTION_ZERO(y,x) do { MPFR_SET_SAME_SIGN(y,x); MPFR_SET_INF(y); \ - mpfr_set_divby0 (); MPFR_RET(0); } while (1) + MPFR_SET_DIVBY0 (); MPFR_RET(0); } while (1) /* We know |coth(x)| > 1, thus if the approximation z is such that 1 <= z <= 1 + 2^(-p) where p is the target precision, then the @@ -42,10 +42,10 @@ if (MPFR_GET_EXP(z) == 1) /* 1 <= |z| < 2 */ \ { \ /* the following is exact by Sterbenz theorem */ \ - mpfr_sub_si (z, z, MPFR_SIGN(z) > 0 ? 1 : -1, MPFR_RNDN); \ + mpfr_sub_si (z, z, MPFR_SIGN (z), MPFR_RNDN); \ if (MPFR_IS_ZERO(z) || MPFR_GET_EXP(z) <= - (mpfr_exp_t) precy) \ { \ - mpfr_add_si (z, z, MPFR_SIGN(z) > 0 ? 1 : -1, MPFR_RNDN); \ + mpfr_add_si (z, z, MPFR_SIGN (z), MPFR_RNDN); \ break; \ } \ } diff -Nru mpfr4-3.1.4/src/csc.c mpfr4-4.0.2/src/csc.c --- mpfr4-3.1.4/src/csc.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/csc.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_csc - cosecant function. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* the cosecant is defined by csc(x) = 1/sin(x). @@ -32,7 +32,7 @@ #define ACTION_NAN(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1) #define ACTION_INF(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1) #define ACTION_ZERO(y,x) do { MPFR_SET_SAME_SIGN(y,x); MPFR_SET_INF(y); \ - mpfr_set_divby0 (); MPFR_RET(0); } while (1) + MPFR_SET_DIVBY0 (); MPFR_RET(0); } while (1) /* near x=0, we have csc(x) = 1/x + x/6 + ..., more precisely we have |csc(x) - 1/x| <= 0.2 for |x| <= 1. The analysis is similar to that for gamma(x) near x=0 (see gamma.c), except here the error term has the same diff -Nru mpfr4-3.1.4/src/csch.c mpfr4-4.0.2/src/csch.c --- mpfr4-3.1.4/src/csch.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/csch.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_csch - Hyperbolic cosecant function. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* the hyperbolic cosecant is defined by csch(x) = 1/sinh(x). @@ -34,7 +34,7 @@ #define ACTION_INF(y) do { MPFR_SET_SAME_SIGN(y,x); MPFR_SET_ZERO (y); \ MPFR_RET(0); } while (1) #define ACTION_ZERO(y,x) do { MPFR_SET_SAME_SIGN(y,x); MPFR_SET_INF(y); \ - mpfr_set_divby0 (); MPFR_RET(0); } while (1) + MPFR_SET_DIVBY0 (); MPFR_RET(0); } while (1) /* (This analysis is adapted from that for mpfr_csc.) Near x=0, we have csch(x) = 1/x - x/6 + ..., more precisely we have diff -Nru mpfr4-3.1.4/src/d_div.c mpfr4-4.0.2/src/d_div.c --- mpfr4-3.1.4/src/d_div.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/d_div.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_d_div -- divide a machine double precision float by a multiple precision floating-point number -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -28,6 +28,7 @@ { int inexact; mpfr_t d; + mp_limb_t tmp_man[MPFR_LIMBS_PER_DOUBLE]; MPFR_SAVE_EXPO_DECL (expo); MPFR_LOG_FUNC ( @@ -36,15 +37,14 @@ MPFR_SAVE_EXPO_MARK (expo); - mpfr_init2 (d, IEEE_DBL_MANT_DIG); + MPFR_TMP_INIT1(tmp_man, d, IEEE_DBL_MANT_DIG); inexact = mpfr_set_d (d, b, rnd_mode); - MPFR_ASSERTN (inexact == 0); + MPFR_ASSERTD (inexact == 0); - mpfr_clear_flags (); + MPFR_CLEAR_FLAGS (); inexact = mpfr_div (a, d, c, rnd_mode); MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); - mpfr_clear(d); MPFR_SAVE_EXPO_FREE (expo); return mpfr_check_range (a, inexact, rnd_mode); } diff -Nru mpfr4-3.1.4/src/digamma.c mpfr4-4.0.2/src/digamma.c --- mpfr4-3.1.4/src/digamma.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/digamma.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_digamma -- digamma function of a floating-point number -Copyright 2009-2016 Free Software Foundation, Inc. +Copyright 2009-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -34,8 +34,7 @@ mpfr_prec_t p = MPFR_PREC (s); mpfr_t t, u, invxx; mpfr_exp_t e, exps, f, expu; - mpz_t *INITIALIZED(B); /* variable B declared as initialized */ - unsigned long n0, n; /* number of allocated B[] */ + unsigned long n; MPFR_ASSERTN(MPFR_IS_POS(x) && (MPFR_EXP(x) >= 2)); @@ -59,12 +58,9 @@ /* in the following we note err=xxx when the ratio between the approximation and the exact result can be written (1 + theta)^xxx for |theta| <= 2^(-p), following Higham's method */ - B = mpfr_bernoulli_internal ((mpz_t *) 0, 0); mpfr_set_ui (t, 1, MPFR_RNDN); /* err = 0 */ for (n = 1;; n++) { - /* compute next Bernoulli number */ - B = mpfr_bernoulli_internal (B, n); /* The main term is Bernoulli[2n]/(2n)/x^(2n) = B[n]/(2n+1)!(2n)/x^(2n) = B[n]*t[n]/(2n) where t[n]/t[n-1] = 1/(2n)/(2n+1)/x^2. */ mpfr_mul (t, t, invxx, MPFR_RNDU); /* err = err + 3 */ @@ -72,7 +68,7 @@ mpfr_div_ui (t, t, 2 * n + 1, MPFR_RNDU); /* err = err + 1 */ /* we thus have err = 5n here */ mpfr_div_ui (u, t, 2 * n, MPFR_RNDU); /* err = 5n+1 */ - mpfr_mul_z (u, u, B[n], MPFR_RNDU); /* err = 5n+2, and the + mpfr_mul_z (u, u, mpfr_bernoulli_cache(n), MPFR_RNDU);/* err = 5n+2, and the absolute error is bounded by 10n+4 ulp(u) [Rule 11] */ /* if the terms 'u' are decreasing by a factor two at least, @@ -92,14 +88,9 @@ f = (1 + f) / 2; expu ++; } - e += f; /* total rouding error coming from 'u' term */ + e += f; /* total rounding error coming from 'u' term */ } - n0 = ++n; - while (n--) - mpz_clear (B[n]); - (*__gmp_free_func) (B, n0 * sizeof (mpz_t)); - mpfr_clear (t); mpfr_clear (u); mpfr_clear (invxx); @@ -126,6 +117,10 @@ int inex; MPFR_ZIV_DECL (loop); + MPFR_LOG_FUNC + (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode), + ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inex)); + /* we want that 1-x is exact with precision q: if 0 < x < 1/2, then q = PREC(x)-EXP(x) is ok, otherwise if -1 <= x < 0, q = PREC(x)-EXP(x) is ok, otherwise for x < -1, PREC(x) is ok if EXP(x) <= PREC(x), @@ -137,7 +132,8 @@ else q = MPFR_EXP(x); mpfr_init2 (u, q); - MPFR_ASSERTN(mpfr_ui_sub (u, 1, x, MPFR_RNDN) == 0); + MPFR_DBGRES(inex = mpfr_ui_sub (u, 1, x, MPFR_RNDN)); + MPFR_ASSERTN(inex == 0); /* if x is half an integer, cot(Pi*x) = 0, thus Digamma(x) = Digamma(1-x) */ mpfr_mul_2exp (u, u, 1, MPFR_RNDN); @@ -208,11 +204,31 @@ unsigned long j = 0, min; MPFR_ZIV_DECL (loop); + MPFR_LOG_FUNC + (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode), + ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inex)); + /* compute a precision q such that x+1 is exact */ if (MPFR_PREC(x) < MPFR_EXP(x)) q = MPFR_EXP(x); else q = MPFR_PREC(x) + 1; + + /* for very large x, use |digamma(x) - log(x)| < 1/x < 2^(1-EXP(x)) */ + if (MPFR_PREC(y) + 10 < MPFR_EXP(x)) + { + /* this ensures EXP(x) >= 3, thus x >= 4, thus log(x) > 1 */ + mpfr_init2 (t, MPFR_PREC(y) + 10); + mpfr_log (t, x, MPFR_RNDZ); + if (MPFR_CAN_ROUND (t, MPFR_PREC(y) + 10, MPFR_PREC(y), rnd_mode)) + { + inex = mpfr_set (y, t, rnd_mode); + mpfr_clear (t); + return inex; + } + mpfr_clear (t); + } + mpfr_init2 (x_plus_j, q); mpfr_init2 (t, p); @@ -285,7 +301,6 @@ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode), ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inex)); - if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x))) { if (MPFR_IS_NAN(x)) @@ -312,7 +327,7 @@ /* the following works also in case of overlap */ MPFR_SET_INF(y); MPFR_SET_OPPOSITE_SIGN(y, x); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); MPFR_RET(0); } } diff -Nru mpfr4-3.1.4/src/dim.c mpfr4-4.0.2/src/dim.c --- mpfr4-3.1.4/src/dim.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/dim.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_dim -- positive difference -Copyright 2001-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2001-2002, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/div_2exp.c mpfr4-4.0.2/src/div_2exp.c --- mpfr4-3.1.4/src/div_2exp.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/div_2exp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_div_2exp -- divide a floating-point number by a power of two -Copyright 1999, 2001, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999, 2001, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/div_2si.c mpfr4-4.0.2/src/div_2si.c --- mpfr4-3.1.4/src/div_2si.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/div_2si.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_div_2si -- divide a floating-point number by a power of two -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,12 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" -int +MPFR_HOT_FUNCTION_ATTR int mpfr_div_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd_mode) { int inexact; diff -Nru mpfr4-3.1.4/src/div_2ui.c mpfr4-4.0.2/src/div_2ui.c --- mpfr4-3.1.4/src/div_2ui.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/div_2ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_div_2ui -- divide a floating-point number by a power of two -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/div.c mpfr4-4.0.2/src/div.c --- mpfr4-3.1.4/src/div.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/div.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_div -- divide two floating-point numbers -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,37 +17,646 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* References: [1] Short Division of Long Integers, David Harvey and Paul Zimmermann, Proceedings of the 20th Symposium on Computer Arithmetic (ARITH-20), July 25-27, 2011, pages 7-14. + [2] Improved Division by Invariant Integers, Niels Möller and Torbjörn Granlund, + IEEE Transactions on Computers, volume 60, number 2, pages 165-175, 2011. */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" -#ifdef DEBUG2 -#define mpfr_mpn_print(ap,n) mpfr_mpn_print3 (ap,n,MPFR_LIMB_ZERO) +#if !defined(MPFR_GENERIC_ABI) + +#if GMP_NUMB_BITS == 64 + +#include "invert_limb.h" + +/* Given u = u1*B+u0 < v = v1*B+v0 with v normalized (high bit of v1 set), + put in q = Q1*B+Q0 an approximation of floor(u*B^2/v), with: + B = 2^GMP_NUMB_BITS and q <= floor(u*B^2/v) <= q + 21. + Note: this function requires __gmpfr_invert_limb_approx (from invert_limb.h) + which is only provided so far for 64-bit limb. + Note: __gmpfr_invert_limb_approx can be replaced by __gmpfr_invert_limb, + in that case the bound 21 reduces to 16. */ static void -mpfr_mpn_print3 (mpfr_limb_ptr ap, mp_size_t n, mp_limb_t cy) +mpfr_div2_approx (mpfr_limb_ptr Q1, mpfr_limb_ptr Q0, + mp_limb_t u1, mp_limb_t u0, + mp_limb_t v1, mp_limb_t v0) +{ + mp_limb_t inv, q1, q0, r1, r0, cy, xx, yy; + + /* first compute an approximation of q1, using a lower approximation of + B^2/(v1+1) - B */ + if (MPFR_UNLIKELY(v1 == MPFR_LIMB_MAX)) + inv = MPFR_LIMB_ZERO; + else + __gmpfr_invert_limb_approx (inv, v1 + 1); + /* now inv <= B^2/(v1+1) - B */ + umul_ppmm (q1, q0, u1, inv); + q1 += u1; + /* now q1 <= u1*B/(v1+1) < (u1*B+u0)*B/(v1*B+v0) */ + + /* compute q1*(v1*B+v0) into r1:r0:yy and subtract from u1:u0:0 */ + umul_ppmm (r1, r0, q1, v1); + umul_ppmm (xx, yy, q1, v0); + + ADD_LIMB (r0, xx, cy); + r1 += cy; + + /* we ignore yy below, but first increment r0, to ensure we get a lower + approximation of the remainder */ + r0 += yy != 0; + r1 += r0 == 0 && yy != 0; + r0 = u0 - r0; + r1 = u1 - r1 - (r0 > u0); + + /* r1:r0 should be nonnegative */ + MPFR_ASSERTD((r1 & MPFR_LIMB_HIGHBIT) == 0); + + /* the second quotient limb is approximated by (r1*B^2+r0*B) / v1, + and since (B+inv)/B approximates B/v1, this is in turn approximated + by (r1*B+r0)*(B+inv)/B = r1*B*r1*inv+r0+(r0*inv/B) */ + + q0 = r0; + q1 += r1; + /* add floor(r0*inv/B) to q0 */ + umul_ppmm (xx, yy, r0, inv); + ADD_LIMB (q0, xx, cy); + q1 += cy; + MPFR_ASSERTD (r1 <= 4); + /* TODO: use value coverage on r1 to check that the 5 cases are tested. */ + while (r1) /* the number of loops is at most 4 */ + { + /* add inv to q0 */ + ADD_LIMB (q0, inv, cy); + q1 += cy; + r1 --; + } + + *Q1 = q1; + *Q0 = q0; +} + +#endif /* GMP_NUMB_BITS == 64 */ + +/* Special code for PREC(q) = PREC(u) = PREC(v) = p < GMP_NUMB_BITS */ +static int +mpfr_div_1 (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mpfr_rnd_t rnd_mode) +{ + mpfr_prec_t p = MPFR_GET_PREC(q); + mpfr_limb_ptr qp = MPFR_MANT(q); + mpfr_exp_t qx = MPFR_GET_EXP(u) - MPFR_GET_EXP(v); + mpfr_prec_t sh = GMP_NUMB_BITS - p; + mp_limb_t u0 = MPFR_MANT(u)[0]; + mp_limb_t v0 = MPFR_MANT(v)[0]; + mp_limb_t q0, rb, sb, mask = MPFR_LIMB_MASK(sh); + int extra; + + if ((extra = (u0 >= v0))) + u0 -= v0; + +#if GMP_NUMB_BITS == 64 /* __gmpfr_invert_limb_approx only exists for 64-bit */ + /* First try with an approximate quotient. + FIXME: for p<=62 we have sh-1<2 and will never be able to round correctly. + Even for p=61 we have sh-1=2 and we can round correctly only when the two + last bist of q0 are 01, which happens with probability 25% only. */ + { + mp_limb_t inv; + __gmpfr_invert_limb_approx (inv, v0); + umul_ppmm (rb, sb, u0, inv); + } + rb += u0; + q0 = rb >> extra; + /* rb does not exceed the true quotient floor(u0*2^GMP_NUMB_BITS/v0), + with error at most 2, which means the rational quotient q satisfies + rb <= q < rb + 3. We can round correctly except when the last sh-1 bits + of q0 are 000..000 or 111..111 or 111..110. */ + if (MPFR_LIKELY(((q0 + 2) & (mask >> 1)) > 2)) + { + rb = q0 & (MPFR_LIMB_ONE << (sh - 1)); + sb = 1; /* result cannot be exact in this case */ + } + else /* the true quotient is rb, rb+1 or rb+2 */ + { + mp_limb_t h, l; + q0 = rb; + umul_ppmm (h, l, q0, v0); + MPFR_ASSERTD(h < u0 || (h == u0 && l == MPFR_LIMB_ZERO)); + /* subtract {h,l} from {u0,0} */ + sub_ddmmss (h, l, u0, 0, h, l); + /* the remainder {h, l} should be < v0 */ + /* This while loop is executed at most two times, but does not seem + slower than two consecutive identical if-statements. */ + while (h || l >= v0) + { + q0 ++; + h -= (l < v0); + l -= v0; + } + MPFR_ASSERTD(h == 0 && l < v0); + sb = l | (q0 & extra); + q0 >>= extra; + rb = q0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= q0 & (mask >> 1); + } +#else + udiv_qrnnd (q0, sb, u0, 0, v0); + sb |= q0 & extra; + q0 >>= extra; + rb = q0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= q0 & (mask >> 1); +#endif + + qp[0] = (MPFR_LIMB_HIGHBIT | q0) & ~mask; + qx += extra; + MPFR_SIGN(q) = MPFR_MULT_SIGN (MPFR_SIGN (u), MPFR_SIGN (v)); + + /* rounding */ + if (MPFR_UNLIKELY(qx > __gmpfr_emax)) + return mpfr_overflow (q, rnd_mode, MPFR_SIGN(q)); + + /* Warning: underflow should be checked *after* rounding, thus when rounding + away and when q > 0.111...111*2^(emin-1), or when rounding to nearest and + q >= 0.111...111[1]*2^(emin-1), there is no underflow. */ + if (MPFR_UNLIKELY(qx < __gmpfr_emin)) + { + /* Note: the case 0.111...111*2^(emin-1) < q < 2^(emin-1) is not possible + here since (up to exponent) this would imply 1 - 2^(-p) < u/v < 1, + thus v - 2^(-p)*v < u < v, and since we can assume 1/2 <= v < 1, it + would imply v - 2^(-p) = v - ulp(v) < u < v, which has no solution. */ + + /* For RNDN, mpfr_underflow always rounds away, thus for |q|<=2^(emin-2) + we have to change to RNDZ. This corresponds to: + (a) either qx < emin - 1 + (b) or qx = emin - 1 and qp[0] = 1000....000 and rb = sb = 0. + Note: in case (b), it suffices to check whether sb = 0, since rb = 1 + and sb = 0 is not possible (the exact quotient would have p+1 bits, + thus u would need at least p+1 bits). */ + if (rnd_mode == MPFR_RNDN && + (qx < __gmpfr_emin - 1 || (qp[0] == MPFR_LIMB_HIGHBIT && sb == 0))) + rnd_mode = MPFR_RNDZ; + return mpfr_underflow (q, rnd_mode, MPFR_SIGN(q)); + } + + MPFR_EXP (q) = qx; /* Don't use MPFR_SET_EXP since qx might be < __gmpfr_emin + in the cases "goto rounding" above. */ + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + { + MPFR_ASSERTD(qx >= __gmpfr_emin); + MPFR_RET (0); + } + else if (rnd_mode == MPFR_RNDN) + { + /* It is not possible to have rb <> 0 and sb = 0 here, since it would + mean a n-bit by n-bit division gives an exact (n+1)-bit number. + And since the case rb = sb = 0 was already dealt with, we cannot + have sb = 0. Thus we cannot be in the middle of two numbers. */ + MPFR_ASSERTD(sb != 0); + if (rb == 0) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(q))) + { + truncate: + MPFR_ASSERTD(qx >= __gmpfr_emin); + MPFR_RET(-MPFR_SIGN(q)); + } + else /* round away from zero */ + { + add_one_ulp: + qp[0] += MPFR_LIMB_ONE << sh; + if (qp[0] == 0) + { + qp[0] = MPFR_LIMB_HIGHBIT; + if (MPFR_UNLIKELY(qx + 1 > __gmpfr_emax)) + return mpfr_overflow (q, rnd_mode, MPFR_SIGN(q)); + MPFR_ASSERTD(qx + 1 <= __gmpfr_emax); + MPFR_ASSERTD(qx + 1 >= __gmpfr_emin); + MPFR_SET_EXP (q, qx + 1); + } + MPFR_RET(MPFR_SIGN(q)); + } +} + +/* Special code for PREC(q) = GMP_NUMB_BITS, + with PREC(u), PREC(v) <= GMP_NUMB_BITS. */ +static int +mpfr_div_1n (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mpfr_rnd_t rnd_mode) { - mp_size_t i; - for (i = 0; i < n; i++) - printf ("+%lu*2^%lu", (unsigned long) ap[i], (unsigned long) - (GMP_NUMB_BITS * i)); - if (cy) - printf ("+2^%lu", (unsigned long) (GMP_NUMB_BITS * n)); - printf ("\n"); + mpfr_limb_ptr qp = MPFR_MANT(q); + mpfr_exp_t qx = MPFR_GET_EXP(u) - MPFR_GET_EXP(v); + mp_limb_t u0 = MPFR_MANT(u)[0]; + mp_limb_t v0 = MPFR_MANT(v)[0]; + mp_limb_t q0, rb, sb, l; + int extra; + + MPFR_ASSERTD(MPFR_PREC(q) == GMP_NUMB_BITS); + MPFR_ASSERTD(MPFR_PREC(u) <= GMP_NUMB_BITS); + MPFR_ASSERTD(MPFR_PREC(v) <= GMP_NUMB_BITS); + + if ((extra = (u0 >= v0))) + u0 -= v0; + +#if GMP_NUMB_BITS == 64 /* __gmpfr_invert_limb_approx only exists for 64-bit */ + { + mp_limb_t inv, h; + + /* First compute an approximate quotient. */ + __gmpfr_invert_limb_approx (inv, v0); + umul_ppmm (rb, sb, u0, inv); + q0 = u0 + rb; + /* rb does not exceed the true quotient floor(u0*2^GMP_NUMB_BITS/v0), + with error at most 2, which means the rational quotient q satisfies + rb <= q < rb + 3, thus the true quotient is rb, rb+1 or rb+2 */ + umul_ppmm (h, l, q0, v0); + MPFR_ASSERTD(h < u0 || (h == u0 && l == MPFR_LIMB_ZERO)); + /* subtract {h,l} from {u0,0} */ + sub_ddmmss (h, l, u0, 0, h, l); + /* the remainder {h, l} should be < v0 */ + /* This while loop is executed at most two times, but does not seem + slower than two consecutive identical if-statements. */ + while (h || l >= v0) + { + q0 ++; + h -= (l < v0); + l -= v0; + } + MPFR_ASSERTD(h == 0 && l < v0); + } +#else + udiv_qrnnd (q0, l, u0, 0, v0); +#endif + + /* now (u0 - extra*v0) * 2^GMP_NUMB_BITS = q0*v0 + l with 0 <= l < v0 */ + + /* If extra=0, the quotient is q0, the round bit is 1 if l >= v0/2, + and sb are the remaining bits from l. + If extra=1, the quotient is MPFR_LIMB_HIGHBIT + (q0 >> 1), the round bit + is the least significant bit of q0, and sb is l. */ + + if (extra == 0) + { + qp[0] = q0; + /* If "l + l < l", then there is a carry in l + l, thus 2*l > v0. + Otherwise if there is no carry, we check whether 2*l >= v0. */ + rb = (l + l < l) || (l + l >= v0); + sb = (rb) ? l + l - v0 : l; + } + else + { + qp[0] = MPFR_LIMB_HIGHBIT | (q0 >> 1); + rb = q0 & MPFR_LIMB_ONE; + sb = l; + qx ++; + } + + MPFR_SIGN(q) = MPFR_MULT_SIGN (MPFR_SIGN (u), MPFR_SIGN (v)); + + /* rounding */ + if (MPFR_UNLIKELY(qx > __gmpfr_emax)) + return mpfr_overflow (q, rnd_mode, MPFR_SIGN(q)); + + /* Warning: underflow should be checked *after* rounding, thus when rounding + away and when q > 0.111...111*2^(emin-1), or when rounding to nearest and + q >= 0.111...111[1]*2^(emin-1), there is no underflow. */ + if (MPFR_UNLIKELY(qx < __gmpfr_emin)) + { + /* Note: the case 0.111...111*2^(emin-1) < q < 2^(emin-1) is not possible + here since (up to exponent) this would imply 1 - 2^(-p) < u/v < 1, + thus v - 2^(-p)*v < u < v, and since we can assume 1/2 <= v < 1, it + would imply v - 2^(-p) = v - ulp(v) < u < v, which has no solution. */ + + /* For RNDN, mpfr_underflow always rounds away, thus for |q|<=2^(emin-2) + we have to change to RNDZ. This corresponds to: + (a) either qx < emin - 1 + (b) or qx = emin - 1 and qp[0] = 1000....000 and rb = sb = 0. + Note: in case (b), it suffices to check whether sb = 0, since rb = 1 + and sb = 0 is not possible (the exact quotient would have p+1 bits, + thus u would need at least p+1 bits). */ + if (rnd_mode == MPFR_RNDN && + (qx < __gmpfr_emin - 1 || (qp[0] == MPFR_LIMB_HIGHBIT && sb == 0))) + rnd_mode = MPFR_RNDZ; + return mpfr_underflow (q, rnd_mode, MPFR_SIGN(q)); + } + + MPFR_EXP (q) = qx; /* Don't use MPFR_SET_EXP since qx might be < __gmpfr_emin + in the cases "goto rounding" above. */ + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + { + MPFR_ASSERTD(qx >= __gmpfr_emin); + MPFR_RET (0); + } + else if (rnd_mode == MPFR_RNDN) + { + /* It is not possible to have rb <> 0 and sb = 0 here, since it would + mean a n-bit by n-bit division gives an exact (n+1)-bit number. + And since the case rb = sb = 0 was already dealt with, we cannot + have sb = 0. Thus we cannot be in the middle of two numbers. */ + MPFR_ASSERTD(sb != 0); + if (rb == 0) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(q))) + { + truncate: + MPFR_ASSERTD(qx >= __gmpfr_emin); + MPFR_RET(-MPFR_SIGN(q)); + } + else /* round away from zero */ + { + add_one_ulp: + qp[0] += MPFR_LIMB_ONE; + if (qp[0] == 0) + { + qp[0] = MPFR_LIMB_HIGHBIT; + if (MPFR_UNLIKELY(qx + 1 > __gmpfr_emax)) + return mpfr_overflow (q, rnd_mode, MPFR_SIGN(q)); + MPFR_ASSERTD(qx + 1 <= __gmpfr_emax); + MPFR_ASSERTD(qx + 1 >= __gmpfr_emin); + MPFR_SET_EXP (q, qx + 1); + } + MPFR_RET(MPFR_SIGN(q)); + } } + +/* Special code for GMP_NUMB_BITS < PREC(q) < 2*GMP_NUMB_BITS and + PREC(u) = PREC(v) = PREC(q) */ +static int +mpfr_div_2 (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mpfr_rnd_t rnd_mode) +{ + mpfr_prec_t p = MPFR_GET_PREC(q); + mpfr_limb_ptr qp = MPFR_MANT(q); + mpfr_exp_t qx = MPFR_GET_EXP(u) - MPFR_GET_EXP(v); + mpfr_prec_t sh = 2*GMP_NUMB_BITS - p; + mp_limb_t h, rb, sb, mask = MPFR_LIMB_MASK(sh); + mp_limb_t v1 = MPFR_MANT(v)[1], v0 = MPFR_MANT(v)[0]; + mp_limb_t q1, q0, r3, r2, r1, r0, l, t; + int extra; + + r3 = MPFR_MANT(u)[1]; + r2 = MPFR_MANT(u)[0]; + extra = r3 > v1 || (r3 == v1 && r2 >= v0); + if (extra) + sub_ddmmss (r3, r2, r3, r2, v1, v0); + + MPFR_ASSERTD(r3 < v1 || (r3 == v1 && r2 < v0)); + +#if GMP_NUMB_BITS == 64 + mpfr_div2_approx (&q1, &q0, r3, r2, v1, v0); + /* we know q1*B+q0 is smaller or equal to the exact quotient, with + difference at most 21 */ + if (MPFR_LIKELY(((q0 + 21) & (mask >> 1)) > 21)) + sb = 1; /* result is not exact when we can round with an approximation */ + else + { + /* we know q1:q0 is a good-enough approximation, use it! */ + mp_limb_t s0, s1, s2, h, l; + + /* Since we know the difference should be at most 21*(v1:v0) after the + subtraction below, thus at most 21*2^128, it suffices to compute the + lower 3 limbs of (q1:q0) * (v1:v0). */ + umul_ppmm (s1, s0, q0, v0); + umul_ppmm (s2, l, q0, v1); + s1 += l; + s2 += (s1 < l); + umul_ppmm (h, l, q1, v0); + s1 += l; + s2 += h + (s1 < l); + s2 += q1 * v1; + /* Subtract s2:s1:s0 from r2:0:0, with result in s2:s1:s0. */ + s2 = r2 - s2; + /* now negate s1:s0 */ + s0 = -s0; + s1 = -s1 - (s0 != 0); + /* there is a borrow in s2 when s0 and s1 are not both zero */ + s2 -= (s1 != 0 || s0 != 0); + while (s2 > 0 || (s1 > v1) || (s1 == v1 && s0 >= v0)) + { + /* add 1 to q1:q0 */ + q0 ++; + q1 += (q0 == 0); + /* subtract v1:v0 to s2:s1:s0 */ + s2 -= (s1 < v1) || (s1 == v1 && s0 < v0); + sub_ddmmss (s1, s0, s1, s0, v1, v0); + } + sb = s1 | s0; + } + goto round_div2; +#endif + + /* now r3:r2 < v1:v0 */ + if (MPFR_UNLIKELY(r3 == v1)) /* can occur in some rare cases */ + { + /* This can only occur in case extra=0, since otherwise we would have + u_old >= u_new + v >= B^2/2 + B^2/2 = B^2. In this case we have + r3 = u1 and r2 = u0, thus the remainder u*B-q1*v is + v1*B^2+u0*B-(B-1)*(v1*B+v0) = (u0-v0+v1)*B+v0. + Warning: in this case q1 = B-1 can be too large, for example with + u = B^2/2 and v = B^2/2 + B - 1, then u*B-(B-1)*u = -1/2*B^2+2*B-1. */ + MPFR_ASSERTD(extra == 0); + q1 = MPFR_LIMB_MAX; + r1 = v0; + t = v0 - r2; /* t > 0 since r3:r2 < v1:v0 */ + r2 = v1 - t; + if (t > v1) /* q1 = B-1 is too large, we need q1 = B-2, which is ok + since u*B - q1*v >= v1*B^2-(B-2)*(v1*B+B-1) = + -B^2 + 2*B*v1 + 3*B - 2 >= 0 since v1>=B/2 and B>=2 */ + { + q1 --; + /* add v to r2:r1 */ + r1 += v0; + r2 += v1 + (r1 < v0); + } + } + else + { + /* divide r3:r2 by v1: requires r3 < v1 */ + udiv_qrnnd (q1, r2, r3, r2, v1); + /* u-extra*v = q1 * v1 + r2 */ + + /* now subtract q1*v0 to r2:0 */ + umul_ppmm (h, l, q1, v0); + t = r2; /* save old value of r2 */ + r1 = -l; + r2 -= h + (l != 0); + /* Note: h + (l != 0) < 2^GMP_NUMB_BITS. */ + + /* we have r2:r1 = oldr2:0 - q1*v0 mod 2^(2*GMP_NUMB_BITS) + thus (u-extra*v)*B = q1 * v + r2:r1 mod 2^(2*GMP_NUMB_BITS) */ + + /* this while loop should be run at most twice */ + while (r2 > t) /* borrow when subtracting h + (l != 0), q1 too large */ + { + q1 --; + /* add v1:v0 to r2:r1 */ + t = r2; + r1 += v0; + r2 += v1 + (r1 < v0); + /* note: since 2^(GMP_NUMB_BITS-1) <= v1 + (r1 < v0) + <= 2^GMP_NUMB_BITS, it suffices to check if r2 <= t to see + if there was a carry or not. */ + } + } + + /* now (u-extra*v)*B = q1 * v + r2:r1 with 0 <= r2:r1 < v */ + + MPFR_ASSERTD(r2 < v1 || (r2 == v1 && r1 < v0)); + + if (MPFR_UNLIKELY(r2 == v1)) + { + q0 = MPFR_LIMB_MAX; + /* r2:r1:0 - q0*(v1:v0) = v1:r1:0 - (B-1)*(v1:v0) + = r1:0 - v0:0 + v1:v0 */ + r0 = v0; + t = v0 - r1; /* t > 0 since r2:r1 < v1:v0 */ + r1 = v1 - t; + if (t > v1) + { + q0 --; + /* add v to r1:r0 */ + r0 += v0; + r1 += v1 + (r0 < v0); + } + } + else + { + /* divide r2:r1 by v1: requires r2 < v1 */ + udiv_qrnnd (q0, r1, r2, r1, v1); + + /* r2:r1 = q0*v1 + r1 */ + + /* subtract q0*v0 to r1:0 */ + umul_ppmm (h, l, q0, v0); + t = r1; + r0 = -l; + r1 -= h + (l != 0); + + /* this while loop should be run at most twice */ + while (r1 > t) /* borrow when subtracting h + (l != 0), + q0 was too large */ + { + q0 --; + /* add v1:v0 to r1:r0 */ + t = r1; + r0 += v0; + r1 += v1 + (r0 < v0); + /* note: since 2^(GMP_NUMB_BITS-1) <= v1 + (r0 < v0) + <= 2^GMP_NUMB_BITS, it suffices to check if r1 <= t to see + if there was a carry or not. */ + } + } + + MPFR_ASSERTD(r1 < v1 || (r1 == v1 && r0 < v0)); + + /* now (u-extra*v)*B^2 = (q1:q0) * v + r1:r0 */ + + sb = r1 | r0; + + /* here, q1:q0 should be an approximation of the quotient (or the exact + quotient), and sb the sticky bit */ + +#if GMP_NUMB_BITS == 64 + round_div2: #endif + if (extra) + { + qx ++; + sb |= q0 & 1; + q0 = (q1 << (GMP_NUMB_BITS - 1)) | (q0 >> 1); + q1 = MPFR_LIMB_HIGHBIT | (q1 >> 1); + } + rb = q0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (q0 & mask) ^ rb; + qp[1] = q1; + qp[0] = q0 & ~mask; + + MPFR_SIGN(q) = MPFR_MULT_SIGN (MPFR_SIGN (u), MPFR_SIGN (v)); + + /* rounding */ + if (qx > __gmpfr_emax) + return mpfr_overflow (q, rnd_mode, MPFR_SIGN(q)); + + /* Warning: underflow should be checked *after* rounding, thus when rounding + away and when q > 0.111...111*2^(emin-1), or when rounding to nearest and + q >= 0.111...111[1]*2^(emin-1), there is no underflow. */ + if (qx < __gmpfr_emin) + { + /* Note: the case 0.111...111*2^(emin-1) < q < 2^(emin-1) is not possible + here since (up to exponent) this would imply 1 - 2^(-p) < u/v < 1, + thus v - 2^(-p)*v < u < v, and since we can assume 1/2 <= v < 1, it + would imply v - 2^(-p) = v - ulp(v) < u < v, which has no solution. */ + + /* For RNDN, mpfr_underflow always rounds away, thus for |q|<=2^(emin-2) + we have to change to RNDZ. This corresponds to: + (a) either qx < emin - 1 + (b) or qx = emin - 1 and qp[1] = 100....000, qp[0] = 0 and rb = sb = 0. + Note: in case (b), it suffices to check whether sb = 0, since rb = 1 + and sb = 0 is not possible (the exact quotient would have p+1 bits, thus + u would need at least p+1 bits). */ + if (rnd_mode == MPFR_RNDN && + (qx < __gmpfr_emin - 1 || + (qp[1] == MPFR_LIMB_HIGHBIT && qp[0] == MPFR_LIMB_ZERO && sb == 0))) + rnd_mode = MPFR_RNDZ; + return mpfr_underflow (q, rnd_mode, MPFR_SIGN(q)); + } + + MPFR_EXP (q) = qx; /* Don't use MPFR_SET_EXP since qx might be < __gmpfr_emin + in the cases "goto rounding" above. */ + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + { + MPFR_ASSERTD(qx >= __gmpfr_emin); + MPFR_RET (0); + } + else if (rnd_mode == MPFR_RNDN) + { + /* See the comment in mpfr_div_1. */ + MPFR_ASSERTD(sb != 0); + if (rb == 0) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(q))) + { + truncate: + MPFR_ASSERTD(qx >= __gmpfr_emin); + MPFR_RET(-MPFR_SIGN(q)); + } + else /* round away from zero */ + { + add_one_ulp: + qp[0] += MPFR_LIMB_ONE << sh; + qp[1] += (qp[0] == 0); + if (qp[1] == 0) + { + qp[1] = MPFR_LIMB_HIGHBIT; + if (MPFR_UNLIKELY(qx + 1 > __gmpfr_emax)) + return mpfr_overflow (q, rnd_mode, MPFR_SIGN(q)); + MPFR_ASSERTD(qx + 1 <= __gmpfr_emax); + MPFR_ASSERTD(qx + 1 >= __gmpfr_emin); + MPFR_SET_EXP (q, qx + 1); + } + MPFR_RET(MPFR_SIGN(q)); + } +} + +#endif /* !defined(MPFR_GENERIC_ABI) */ /* check if {ap, an} is zero */ static int mpfr_mpn_cmpzero (mpfr_limb_ptr ap, mp_size_t an) { + MPFR_ASSERTD (an >= 0); while (an > 0) if (MPFR_LIKELY(ap[--an] != MPFR_LIMB_ZERO)) return 1; @@ -66,6 +675,10 @@ mp_size_t k; mp_limb_t bb; + MPFR_ASSERTD (an >= 0); + MPFR_ASSERTD (bn >= 0); + MPFR_ASSERTD (extra == 0 || extra == 1); + if (an >= bn) { k = an - bn; @@ -122,6 +735,8 @@ mp_limb_t bb, rp; MPFR_ASSERTD (cy <= 1); + MPFR_ASSERTD (n >= 0); + while (n--) { bb = (extra) ? ((bp[1] << (GMP_NUMB_BITS-1)) | (bp[0] >> 1)) : bp[0]; @@ -136,27 +751,130 @@ return cy; } -int +/* For large precision, mpz_tdiv_q (which computes only quotient) + is faster than mpn_divrem (which computes also the remainder). + Unfortunately as of GMP 6.0.0 the corresponding mpn_div_q function + is not in the public interface, thus we call mpz_tdiv_q. + + If this function succeeds in computing the correct rounding, return 1, + and put the ternary value in inex. + + Otherwise return 0 (and inex is undefined). +*/ +static int +mpfr_div_with_mpz_tdiv_q (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, + mpfr_rnd_t rnd_mode, int *inex) +{ + mpz_t qm, um, vm; + mpfr_exp_t ue, ve; + mpfr_prec_t qp = MPFR_PREC(q), wp = qp + GMP_NUMB_BITS; + mp_size_t up, vp, k; + int ok; + + mpz_init (qm); + mpz_init (um); + mpz_init (vm); + + ue = mpfr_get_z_2exp (um, u); /* u = um * 2^ue */ + ve = mpfr_get_z_2exp (vm, v); /* v = vm * 2^ve */ + + vp = mpz_sizeinbase (vm, 2); + if (vp > wp) + { + k = vp - wp; /* truncate k bits of vm */ + mpz_tdiv_q_2exp (vm, vm, k); + ve += k; + vp -= k; + } + + /* we want about qp + GMP_NUMB_BITS bits of the quotient, thus um should + have qp + GMP_NUMB_BITS more bits than vm */ + + up = mpz_sizeinbase (um, 2); + if (up > vp + wp) + { + k = up - (vp + wp); /* truncate k bits of um */ + mpz_tdiv_q_2exp (um, um, k); + ue += k; + up -= k; + } + else if (up < vp + wp) /* we need more bits */ + { + k = (vp + wp) - up; + mpz_mul_2exp (um, um, k); + ue -= k; + up += k; + } + + /* now um has exactly wp more bits than vp */ + mpz_tdiv_q (qm, um, vm); + /* qm has either wp or wp+1 bits, and we have: + (a) um = u/2^ue*(1-tu) with tu=0 if no truncation of um, + and 0 <= tu < 2^(1-wp) otherwise; + (b) vm = v/2^ve*(1-tv) with tv=0 if no truncation of vm, + and 0 <= tv < 2^(1-wp) otherwise; + (c) um/vm - 1 < qm <= um/vm, thus qm = um/vm*(1-tq) with + 0 <= tw < 2^(1-wp) since um/vm >= 2^(wp-1) + Altogether we have: + q = u/v*2^(ve-ue)*(1-tu)/(1-tv)*(1-tq) + Thus: + u/v*2^(ve-ue)*(1-2^(2-wp)) < q < u/v*2^(ve-ue)*(1+2^(2-wp)). + If q has wp bits, the error is less than 2^(wp-1)*2^(2-wp) <= 2. + If q has wp+1 bits, the error is less than 2^wp*2^(2-wp) <= 4. + */ + + k = mpz_sizeinbase (qm, 2) - wp; /* 0 or 1 */ + /* Assume qm has wp bits (i.e. k=0) and a directed rounding: if the first + set bit after position 1 has position less than GMP_NUMB_BITS, then + subtracting 2 to qm will not change the bits beyond the GMP_NUMB_BITS + low ones, thus we get correct rounding. + For k=1, we need to start at position 2, and the first set bit has to be + in posiiton less than GMP_NUMB_BITS+1. + For rounding to nearest, the first set bit has to be in position less + than GMP_NUMB_BITS-1 for k=0 (or less than GMP_NUMB_BITS for k=1). + */ + if (mpz_scan1 (qm, k + 1) < GMP_NUMB_BITS + k - (rnd_mode == MPFR_RNDN) && + mpz_scan0 (qm, k + 1) < GMP_NUMB_BITS + k - (rnd_mode == MPFR_RNDN)) + { + MPFR_SAVE_EXPO_DECL (expo); + ok = 1; + MPFR_SAVE_EXPO_MARK (expo); + *inex = mpfr_set_z (q, qm, rnd_mode); + MPFR_SAVE_EXPO_FREE (expo); + /* if we got an underflow or overflow, the result is not valid */ + if (MPFR_IS_SINGULAR(q) || MPFR_EXP(q) == MPFR_EXT_EMIN || + MPFR_EXP(q) == MPFR_EXT_EMAX) + ok = 0; + MPFR_EXP(q) += ue - ve; + *inex = mpfr_check_range (q, *inex, rnd_mode); + } + else + ok = 0; + + mpz_clear (qm); + mpz_clear (um); + mpz_clear (vm); + + return ok; +} + +MPFR_HOT_FUNCTION_ATTR int mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mpfr_rnd_t rnd_mode) { - mp_size_t q0size = MPFR_LIMB_SIZE(q); /* number of limbs of destination */ - mp_size_t usize = MPFR_LIMB_SIZE(u); - mp_size_t vsize = MPFR_LIMB_SIZE(v); + mp_size_t q0size, usize, vsize; mp_size_t qsize; /* number of limbs wanted for the computed quotient */ mp_size_t qqsize; mp_size_t k; - mpfr_limb_ptr q0p = MPFR_MANT(q), qp; - mpfr_limb_ptr up = MPFR_MANT(u); - mpfr_limb_ptr vp = MPFR_MANT(v); + mpfr_limb_ptr q0p, qp; + mpfr_limb_ptr up, vp; mpfr_limb_ptr ap; mpfr_limb_ptr bp; mp_limb_t qh; - mp_limb_t sticky_u = MPFR_LIMB_ZERO; + mp_limb_t sticky_u, sticky_v; mp_limb_t low_u; - mp_limb_t sticky_v = MPFR_LIMB_ZERO; mp_limb_t sticky; mp_limb_t sticky3; - mp_limb_t round_bit = MPFR_LIMB_ZERO; + mp_limb_t round_bit; mpfr_exp_t qexp; int sign_quotient; int extra_bit; @@ -215,7 +933,7 @@ { MPFR_ASSERTD (! MPFR_IS_INF (u)); MPFR_SET_INF(q); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); MPFR_RET(0); } } @@ -227,12 +945,72 @@ } } + /* When MPFR_GENERIC_ABI is defined, we don't use special code. */ +#if !defined(MPFR_GENERIC_ABI) + if (MPFR_GET_PREC(u) == MPFR_GET_PREC(q) && + MPFR_GET_PREC(v) == MPFR_GET_PREC(q)) + { + if (MPFR_GET_PREC(q) < GMP_NUMB_BITS) + return mpfr_div_1 (q, u, v, rnd_mode); + + if (GMP_NUMB_BITS < MPFR_GET_PREC(q) && + MPFR_GET_PREC(q) < 2 * GMP_NUMB_BITS) + return mpfr_div_2 (q, u, v, rnd_mode); + + if (MPFR_GET_PREC(q) == GMP_NUMB_BITS) + return mpfr_div_1n (q, u, v, rnd_mode); + } +#endif /* !defined(MPFR_GENERIC_ABI) */ + + usize = MPFR_LIMB_SIZE(u); + vsize = MPFR_LIMB_SIZE(v); + q0size = MPFR_LIMB_SIZE(q); /* number of limbs of destination */ + q0p = MPFR_MANT(q); + up = MPFR_MANT(u); + vp = MPFR_MANT(v); + sticky_u = MPFR_LIMB_ZERO; + sticky_v = MPFR_LIMB_ZERO; + round_bit = MPFR_LIMB_ZERO; + /************************************************************************** * * * End of the part concerning special values. * * * **************************************************************************/ + /* when the divisor has one limb, we can use mpfr_div_ui, which should be + faster, assuming there is no intermediate overflow or underflow. + The divisor interpreted as an integer satisfies + 2^(GMP_NUMB_BITS-1) <= vm < 2^GMP_NUMB_BITS, thus the quotient + satisfies 2^(EXP(u)-1-GMP_NUMB_BITS) < u/vm < 2^(EXP(u)-GMP_NUMB_BITS+1) + and its exponent is either EXP(u)-GMP_NUMB_BITS or one more. */ + if (vsize <= 1 && __gmpfr_emin <= MPFR_EXP(u) - GMP_NUMB_BITS + && MPFR_EXP(u) - GMP_NUMB_BITS + 1 <= __gmpfr_emax + && vp[0] <= ULONG_MAX) + { + mpfr_exp_t exp_v = MPFR_EXP(v); /* save it in case q=v */ + if (MPFR_IS_POS (v)) + inex = mpfr_div_ui (q, u, vp[0], rnd_mode); + else + { + inex = -mpfr_div_ui (q, u, vp[0], MPFR_INVERT_RND(rnd_mode)); + MPFR_CHANGE_SIGN(q); + } + /* q did not under/overflow */ + MPFR_EXP(q) -= exp_v; + /* The following test is needed, otherwise the next addition + on the exponent may overflow, e.g. when dividing the + largest finite MPFR number by the smallest positive one. */ + if (MPFR_UNLIKELY (MPFR_EXP(q) > __gmpfr_emax - GMP_NUMB_BITS)) + return mpfr_overflow (q, rnd_mode, MPFR_SIGN(q)); + MPFR_EXP(q) += GMP_NUMB_BITS; + return mpfr_check_range (q, inex, rnd_mode); + } + + /* for large precisions, try using truncated division first */ + if (q0size >= 32 && mpfr_div_with_mpz_tdiv_q (q, u, v, rnd_mode, &inex)) + return inex; + MPFR_TMP_MARK(marker); /* set sign */ @@ -252,19 +1030,14 @@ l = vsize - 1; while (k != 0 && l != 0 && up[--k] == vp[--l]); /* now k=0 or l=0 or up[k] != vp[l] */ - if (up[k] > vp[l]) - extra_bit = 1; - else if (up[k] < vp[l]) - extra_bit = 0; + if (up[k] != vp[l]) + extra_bit = (up[k] > vp[l]); /* now up[k] = vp[l], thus either k=0 or l=0 */ else if (l == 0) /* no more divisor limb */ extra_bit = 1; else /* k=0: no more dividend limb */ extra_bit = mpfr_mpn_cmpzero (vp, l) == 0; } -#ifdef DEBUG - printf ("extra_bit=%d\n", extra_bit); -#endif /* set exponent */ qexp = MPFR_GET_EXP (u) - MPFR_GET_EXP (v) + extra_bit; @@ -338,6 +1111,9 @@ round_bit = (qp[1] >> (sh - 1)) & 1; else round_bit = qp[0] >> (GMP_NUMB_BITS - 1); + /* TODO: add value coverage tests in tdiv to check that + we reach this part with different values of qh and + round_bit (4 cases). */ if (round_bit == 0) { inex = -1; @@ -346,10 +1122,9 @@ else /* round_bit = 1 */ goto add_one_ulp; } - else if (like_rndz == 0) /* round away */ + else if (! like_rndz) /* round away */ goto add_one_ulp; - /* else round to zero: nothing to do */ - else + else /* round to zero: nothing to do */ { inex = -1; goto truncate; @@ -433,10 +1208,6 @@ /* if Mulders' short division failed, we revert to division with remainder */ qh = mpn_divrem (qp, 0, ap + k, qqsize - k, bp, qsize - k); /* warning: qh may be 1 if u1 == v1, but u < v */ -#ifdef DEBUG2 - printf ("q="); mpfr_mpn_print (qp, qsize); - printf ("r="); mpfr_mpn_print (ap, qsize); -#endif k = qsize; sticky_u = sticky_u || mpfr_mpn_cmpzero (ap, k); @@ -464,20 +1235,12 @@ including the round bit, and 1 <= sh2 <= GMP_NUMB_BITS is the number of bits in sticky3 */ inex = (sticky != MPFR_LIMB_ZERO) || (sticky3 != MPFR_LIMB_ZERO); -#ifdef DEBUG - printf ("sticky=%lu sticky3=%lu inex=%d\n", - (unsigned long) sticky, (unsigned long) sticky3, inex); -#endif /* to round, we distinguish two cases: (a) vsize <= qsize: we used the full divisor (b) vsize > qsize: the divisor was truncated */ -#ifdef DEBUG - printf ("vsize=%lu qsize=%lu\n", - (unsigned long) vsize, (unsigned long) qsize); -#endif if (MPFR_LIKELY(vsize <= qsize)) /* use the full divisor */ { if (MPFR_LIKELY(rnd_mode == MPFR_RNDN)) @@ -510,10 +1273,6 @@ { round_bit = sticky3 & (MPFR_LIMB_ONE << (sh2 - 1)); sticky3 = sticky3 ^ round_bit; -#ifdef DEBUG - printf ("rb=%lu sb=%lu\n", - (unsigned long) round_bit, (unsigned long) sticky3); -#endif } if (sticky3 != MPFR_LIMB_ZERO && sticky3 != MPFR_LIMB_ONE) { @@ -540,7 +1299,7 @@ if (qh) qh2 = mpn_add_n (sp + qsize, sp + qsize, vp, k); else - qh2 = (mp_limb_t) 0; + qh2 = MPFR_LIMB_ZERO; qp[0] ^= sticky3orig; /* restore truncated quotient */ /* compare qh2 + {sp, k + qsize} to {ap, qsize} + low(u) */ @@ -551,9 +1310,6 @@ mpfr_mpn_cmp_aux (sp, k, up, usize - qqsize, extra_bit) : mpfr_mpn_cmpzero (sp, k); } -#ifdef DEBUG - printf ("cmp(q*v0,r+u0)=%d\n", cmp_s_r); -#endif /* now cmp_s_r > 0 if {sp, vsize} > {ap, qsize} + low(u) cmp_s_r = 0 if {sp, vsize} = {ap, qsize} + low(u) cmp_s_r < 0 if {sp, vsize} < {ap, qsize} + low(u) */ @@ -611,9 +1367,6 @@ cmp_s_r = 1; /* since in fact we subtracted less than 1 */ } -#ifdef DEBUG - printf ("cmp(q*v0-(r+u0),v)=%d\n", cmp_s_r); -#endif if (cmp_s_r <= 0) /* q1-1 <= u/v < q1 */ { if (sticky3 == MPFR_LIMB_ONE) diff -Nru mpfr4-3.1.4/src/div_d.c mpfr4-4.0.2/src/div_d.c --- mpfr4-3.1.4/src/div_d.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/div_d.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_div_d -- divide a multiple precision floating-point number by a machine double precision float -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -28,6 +28,7 @@ { int inexact; mpfr_t d; + mp_limb_t tmp_man[MPFR_LIMBS_PER_DOUBLE]; MPFR_SAVE_EXPO_DECL (expo); MPFR_LOG_FUNC ( @@ -37,15 +38,14 @@ MPFR_SAVE_EXPO_MARK (expo); - mpfr_init2 (d, IEEE_DBL_MANT_DIG); + MPFR_TMP_INIT1(tmp_man, d, IEEE_DBL_MANT_DIG); inexact = mpfr_set_d (d, c, rnd_mode); - MPFR_ASSERTN (inexact == 0); + MPFR_ASSERTD (inexact == 0); - mpfr_clear_flags (); + MPFR_CLEAR_FLAGS (); inexact = mpfr_div (a, b, d, rnd_mode); MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); - mpfr_clear(d); MPFR_SAVE_EXPO_FREE (expo); return mpfr_check_range (a, inexact, rnd_mode); } diff -Nru mpfr4-3.1.4/src/div_ui.c mpfr4-4.0.2/src/div_ui.c --- mpfr4-3.1.4/src/div_ui.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/div_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ -/* mpfr_div_{ui,si} -- divide a floating-point number by a machine integer +/* mpfr_div_ui -- divide a floating-point number by a machine integer -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,22 +17,29 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" +#ifdef MPFR_COV_CHECK +int __gmpfr_cov_div_ui_sb[10][2] = { 0 }; +#endif + /* returns 0 if result exact, non-zero otherwise */ -int -mpfr_div_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mpfr_rnd_t rnd_mode) +#undef mpfr_div_ui +MPFR_HOT_FUNCTION_ATTR int +mpfr_div_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, + mpfr_rnd_t rnd_mode) { - long i; int sh; - mp_size_t xn, yn, dif; + mp_size_t i, xn, yn, dif; mp_limb_t *xp, *yp, *tmp, c, d; mpfr_exp_t exp; - int inexact, middle = 1, nexttoinf; + int inexact; + mp_limb_t rb; /* round bit */ + mp_limb_t sb; /* sticky bit */ MPFR_TMP_DECL(marker); MPFR_LOG_FUNC @@ -56,10 +63,10 @@ } else { - MPFR_ASSERTD (MPFR_IS_ZERO(x)); + MPFR_ASSERTD (MPFR_IS_ZERO (x)); if (u == 0) /* 0/0 is NaN */ { - MPFR_SET_NAN(y); + MPFR_SET_NAN (y); MPFR_RET_NAN; } else @@ -74,10 +81,10 @@ { if (u < 1) { - /* x/0 is Inf since x != 0*/ + /* x/0 is Inf since x != 0 */ MPFR_SET_INF (y); MPFR_SET_SAME_SIGN (y, x); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); MPFR_RET (0); } else /* y = x/1 = x */ @@ -89,6 +96,7 @@ MPFR_SET_SAME_SIGN (y, x); MPFR_TMP_MARK (marker); + xn = MPFR_LIMB_SIZE (x); yn = MPFR_LIMB_SIZE (y); @@ -98,109 +106,151 @@ dif = yn + 1 - xn; - /* we need to store yn+1 = xn + dif limbs of the quotient */ - /* don't use tmp=yp since the mpn_lshift call below requires yp >= tmp+1 */ + /* we need to store yn + 1 = xn + dif limbs of the quotient */ tmp = MPFR_TMP_LIMBS_ALLOC (yn + 1); - c = (mp_limb_t) u; - MPFR_ASSERTN (u == c); - if (dif >= 0) - c = mpn_divrem_1 (tmp, dif, xp, xn, c); /* used all the dividend */ - else /* dif < 0 i.e. xn > yn, don't use the (-dif) low limbs from x */ - c = mpn_divrem_1 (tmp, 0, xp - dif, yn + 1, c); - - inexact = (c != 0); - - /* First pass in estimating next bit of the quotient, in case of RNDN * - * In case we just have the right number of bits (postpone this ?), * - * we need to check whether the remainder is more or less than half * - * the divisor. The test must be performed with a subtraction, so as * - * to prevent carries. */ + /* Notation: {p, n} denotes the integer formed by the n limbs + from p[0] to p[n-1]. Let B = 2^GMP_NUMB_BITS. + One has: 0 <= {p, n} < B^n. */ - if (MPFR_LIKELY (rnd_mode == MPFR_RNDN)) + MPFR_STAT_STATIC_ASSERT (MPFR_LIMB_MAX >= ULONG_MAX); + if (dif >= 0) { - if (c < (mp_limb_t) u - c) /* We have u > c */ - middle = -1; - else if (c > (mp_limb_t) u - c) - middle = 1; - else - middle = 0; /* exactly in the middle */ + c = mpn_divrem_1 (tmp, dif, xp, xn, u); /* used all the dividend */ + /* {xp, xn} = ({tmp, xn+dif} * u + c) * B^(-dif) + = ({tmp, yn+1} * u + c) * B^(-dif) */ + } + else /* dif < 0, i.e. xn > yn+1; ignore the (-dif) low limbs from x */ + { + c = mpn_divrem_1 (tmp, 0, xp - dif, yn + 1, u); + /* {xp-dif, yn+1} = {tmp, yn+1} * u + c + thus + {xp, xn} = {xp, -dif} + {xp-dif, yn+1} * B^(-dif) + = {xp, -dif} + ({tmp, yn+1} * u + c) * B^(-dif) */ } - /* If we believe that we are right in the middle or exact, we should check - that we did not neglect any word of x (division large / 1 -> small). */ + /* Let r = {xp, -dif} / B^(-dif) if dif < 0, r = 0 otherwise; 0 <= r < 1. + Then {xp, xn} = ({tmp, yn+1} * u + c + r) * B^(-dif). + x / u = ({xp, xn} / u) * B^(-xn) * 2^exp + = ({tmp, yn+1} + (c + r) / u) * B^(-(yn+1)) * 2^exp + where 0 <= (c + r) / u < 1. */ - for (i=0; ((inexact == 0) || (middle == 0)) && (i < -dif); i++) + for (sb = 0, i = 0; sb == 0 && i < -dif; i++) if (xp[i]) - inexact = middle = 1; /* larger than middle */ + sb = 1; + /* sb != 0 iff r != 0 */ /* - If the high limb of the result is 0 (xp[xn-1] < u), remove it. + If the highest limb of the result is 0 (xp[xn-1] < u), remove it. Otherwise, compute the left shift to be performed to normalize. In the latter case, we discard some low bits computed. They contain information useful for the rounding, hence the updating of middle and inexact. */ + MPFR_UNSIGNED_MINUS_MODULO (sh, MPFR_PREC (y)); + /* sh: number of the trailing bits of y */ + if (tmp[yn] == 0) { MPN_COPY(yp, tmp, yn); exp -= GMP_NUMB_BITS; + if (sh == 0) /* round bit is 1 iff (c + r) / u >= 1/2 */ + { + /* In this case tmp[yn]=0 and sh=0, the round bit is not in + {tmp,yn+1}. It is 1 iff 2*(c+r) - u >= 0. This means that in + some cases, we should look at the most significant bit of r. */ + if (c >= u - c) /* i.e. 2c >= u: round bit is always 1 */ + { + rb = 1; + /* The sticky bit is 1 unless 2c-u = 0 and r = 0. */ + sb |= 2 * c - u; + MPFR_COV_SET (div_ui_sb[0][!!sb]); + } + else /* 2*c < u */ + { + /* The round bit is 1 iff r >= 1/2 and 2*(c+1/2) = u. */ + rb = (c == u/2) && (dif < 0) && (xp[-dif-1] & MPFR_LIMB_HIGHBIT); + /* If rb is set, we need to recompute sb, since it might have + taken into account the msb of xp[-dif-1]. */ + if (rb) + { + sb = xp[-dif-1] << 1; /* discard the most significant bit */ + for (i = 0; sb == 0 && i < -dif-1; i++) + if (xp[i]) + sb = 1; + /* The dif < -1 case with sb = 0, i.e. [2][0], will + ensure that the body of the loop is covered. */ + MPFR_COV_SET (div_ui_sb[1 + (dif < -1)][!!sb]); + } + else + { + sb |= c; + MPFR_COV_SET (div_ui_sb[3][!!sb]); + } + } + } + else + { + /* round bit is in tmp[0] */ + rb = tmp[0] & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (tmp[0] & MPFR_LIMB_MASK(sh - 1)) | c; + MPFR_COV_SET (div_ui_sb[4+!!rb][!!sb]); + } } - else + else /* tmp[yn] != 0 */ { int shlz; + mp_limb_t w; + MPFR_ASSERTD (tmp[yn] != 0); count_leading_zeros (shlz, tmp[yn]); - /* shift left to normalize */ - if (MPFR_LIKELY (shlz != 0)) - { - mp_limb_t w = tmp[0] << shlz; - - mpn_lshift (yp, tmp + 1, yn, shlz); - yp[0] += tmp[0] >> (GMP_NUMB_BITS - shlz); + MPFR_ASSERTD (u >= 2); /* see special cases at the beginning */ + MPFR_ASSERTD (shlz > 0); /* since u >= 2 */ - if (w > (MPFR_LIMB_ONE << (GMP_NUMB_BITS - 1))) - { middle = 1; } - else if (w < (MPFR_LIMB_ONE << (GMP_NUMB_BITS - 1))) - { middle = -1; } - else - { middle = (c != 0); } + /* shift left to normalize */ + w = tmp[0] << shlz; + mpn_lshift (yp, tmp + 1, yn, shlz); + yp[0] |= tmp[0] >> (GMP_NUMB_BITS - shlz); + /* now {yp, yn} is the approximate quotient, w is the next limb */ - inexact = inexact || (w != 0); - exp -= shlz; + if (sh == 0) /* round bit is upper bit from w */ + { + rb = w & MPFR_LIMB_HIGHBIT; + sb |= (w - rb) | c; + MPFR_COV_SET (div_ui_sb[6+!!rb][!!sb]); } else - { /* this happens only if u == 1 and xp[xn-1] >= - 1<<(GMP_NUMB_BITS-1). It might be better to handle the - u == 1 case separately? - */ - - MPN_COPY (yp, tmp + 1, yn); + { + rb = yp[0] & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (yp[0] & MPFR_LIMB_MASK(sh - 1)) | w | c; + MPFR_COV_SET (div_ui_sb[8+!!rb][!!sb]); } - } - MPFR_UNSIGNED_MINUS_MODULO (sh, MPFR_PREC (y)); - /* it remains sh bits in less significant limb of y */ + exp -= shlz; + } - d = *yp & MPFR_LIMB_MASK (sh); - *yp ^= d; /* set to zero lowest sh bits */ + d = yp[0] & MPFR_LIMB_MASK (sh); + yp[0] ^= d; /* clear the lowest sh bits */ MPFR_TMP_FREE (marker); - if (exp < __gmpfr_emin - 1) + if (MPFR_UNLIKELY (exp < __gmpfr_emin - 1)) return mpfr_underflow (y, rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode, MPFR_SIGN (y)); - if (MPFR_UNLIKELY (d == 0 && inexact == 0)) - nexttoinf = 0; /* result is exact */ + if (MPFR_UNLIKELY (rb == 0 && sb == 0)) + inexact = 0; /* result is exact */ else { + int nexttoinf; + MPFR_UPDATE2_RND_MODE(rnd_mode, MPFR_SIGN (y)); switch (rnd_mode) { case MPFR_RNDZ: + case MPFR_RNDF: inexact = - MPFR_INT_SIGN (y); /* result is inexact */ nexttoinf = 0; break; @@ -213,26 +263,19 @@ default: /* should be MPFR_RNDN */ MPFR_ASSERTD (rnd_mode == MPFR_RNDN); /* We have one more significant bit in yn. */ - if (sh && d < (MPFR_LIMB_ONE << (sh - 1))) + if (rb == 0) { inexact = - MPFR_INT_SIGN (y); nexttoinf = 0; } - else if (sh && d > (MPFR_LIMB_ONE << (sh - 1))) + else if (sb != 0) /* necessarily rb != 0 */ { inexact = MPFR_INT_SIGN (y); nexttoinf = 1; } - else /* sh = 0 or d = 1 << (sh-1) */ + else /* middle case */ { - /* The first case is "false" even rounding (significant bits - indicate even rounding, but the result is inexact, so up) ; - The second case is the case where middle should be used to - decide the direction of rounding (no further bit computed) ; - The third is the true even rounding. - */ - if ((sh && inexact) || (!sh && middle > 0) || - (!inexact && *yp & (MPFR_LIMB_ONE << sh))) + if (yp[0] & (MPFR_LIMB_ONE << sh)) { inexact = MPFR_INT_SIGN (y); nexttoinf = 1; @@ -244,13 +287,12 @@ } } } - } - - if (nexttoinf && - MPFR_UNLIKELY (mpn_add_1 (yp, yp, yn, MPFR_LIMB_ONE << sh))) - { - exp++; - yp[yn-1] = MPFR_LIMB_HIGHBIT; + if (nexttoinf && + MPFR_UNLIKELY (mpn_add_1 (yp, yp, yn, MPFR_LIMB_ONE << sh))) + { + exp++; + yp[yn-1] = MPFR_LIMB_HIGHBIT; + } } /* Set the exponent. Warning! One may still have an underflow. */ @@ -258,25 +300,3 @@ return mpfr_check_range (y, inexact, rnd_mode); } - -int -mpfr_div_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode) -{ - int res; - - MPFR_LOG_FUNC - (("x[%Pu]=%.*Rg u=%ld rnd=%d", - mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode), - ("y[%Pu]=%.*Rg inexact=%d", - mpfr_get_prec(y), mpfr_log_prec, y, res)); - - if (u >= 0) - res = mpfr_div_ui (y, x, u, rnd_mode); - else - { - res = - mpfr_div_ui (y, x, - (unsigned long) u, - MPFR_INVERT_RND (rnd_mode)); - MPFR_CHANGE_SIGN (y); - } - return res; -} diff -Nru mpfr4-3.1.4/src/d_sub.c mpfr4-4.0.2/src/d_sub.c --- mpfr4-3.1.4/src/d_sub.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/d_sub.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_d_sub -- subtract a multiple precision floating-point number from a machine double precision float -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -28,6 +28,7 @@ { int inexact; mpfr_t d; + mp_limb_t tmp_man[MPFR_LIMBS_PER_DOUBLE]; MPFR_SAVE_EXPO_DECL (expo); MPFR_LOG_FUNC ( @@ -36,15 +37,14 @@ MPFR_SAVE_EXPO_MARK (expo); - mpfr_init2 (d, IEEE_DBL_MANT_DIG); + MPFR_TMP_INIT1(tmp_man, d, IEEE_DBL_MANT_DIG); inexact = mpfr_set_d (d, b, rnd_mode); - MPFR_ASSERTN (inexact == 0); + MPFR_ASSERTD (inexact == 0); - mpfr_clear_flags (); + MPFR_CLEAR_FLAGS (); inexact = mpfr_sub (a, d, c, rnd_mode); MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); - mpfr_clear(d); MPFR_SAVE_EXPO_FREE (expo); return mpfr_check_range (a, inexact, rnd_mode); } diff -Nru mpfr4-3.1.4/src/dump.c mpfr4-4.0.2/src/dump.c --- mpfr4-3.1.4/src/dump.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/dump.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ -/* mpfr_dump -- Dump a float to stdout. +/* mpfr_dump, mpfr_fdump -- dump a float (for the tests and debugging purpose) -Copyright 1999, 2001, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,14 +17,116 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" +/* mpfr_dump is mainly for debugging purpose. It outputs a MPFR number + * in some unspecified format, then a newline character. This function + * is part of the API, but the output format may change without breaking + * the ABI. + * + * Since this is for debugging, it can detect invalid data (or UBF), and + * in such a case, it outputs information between exclamation marks: + * - 'N': the number is not normalized (MSB = 0); + * - 'T': there are non-zero trailing bits (output in square brackets); + * - 'U': this is a UBF number (internal use only); + * - '<': the exponent is < the current emin; + * - '>': the exponent is > the current emax. + * + * The format may depend on MPFR_* environment variables. For instance, + * in the future, some environment variables could specify prefix and + * suffix strings to colorize parts of the output that correspond to + * invalid data. + */ + +void +mpfr_fdump (FILE *stream, mpfr_srcptr x) +{ + if (MPFR_IS_NEG (x)) + fprintf (stream, "-"); + + if (MPFR_IS_NAN (x)) + fprintf (stream, "@NaN@"); + else if (MPFR_IS_INF (x)) + fprintf (stream, "@Inf@"); + else if (MPFR_IS_ZERO (x)) + fprintf (stream, "0"); + else + { + mp_limb_t *mx; + mpfr_prec_t px; + mp_size_t n; + char invalid[4]; + int first = 1, i = 0; + + mx = MPFR_MANT (x); + px = MPFR_PREC (x); + + fprintf (stream, "0."); + for (n = (px - 1) / GMP_NUMB_BITS; n >= 0; n--) + { + mp_limb_t wd, t; + + wd = mx[n]; + if (first) + { + if (! MPFR_LIMB_MSB (wd)) + invalid[i++] = 'N'; + first = 0; + } + for (t = MPFR_LIMB_HIGHBIT; t != 0; t >>= 1) + { + putc ((wd & t) == 0 ? '0' : '1', stream); + if (--px == 0) + { + MPFR_ASSERTD (n == 0); + if (t != 0 && (wd & (t - 1)) != 0) + { + putc ('[', stream); + invalid[i++] = 'T'; + } + else + break; /* the trailing bits (all 0's) are not output */ + } + } + } + if (px < 0) /* there are non-zero trailing bits */ + putc (']', stream); + + if (MPFR_IS_UBF (x)) + { +#ifndef MPFR_USE_MINI_GMP + gmp_fprintf (stream, "E%Zd", MPFR_ZEXP (x)); +#else /* mini-gmp has no gmp_fprintf */ + fprintf (stream, "E"); + mpz_out_str (stream, 10, MPFR_ZEXP (x)); +#endif + invalid[i++] = 'U'; + } + else + { + mpfr_exp_t e = MPFR_EXP (x); + + fprintf (stream, "E%" MPFR_EXP_FSPEC "d", (mpfr_eexp_t) e); + if (e < __gmpfr_emin) + invalid[i++] = '<'; + else if (e > __gmpfr_emax) + invalid[i++] = '>'; + } + + if (i != 0) + { + invalid[i] = '\0'; + fprintf (stream, "!!!%s!!!", invalid); + } + } + putc ('\n', stream); +} + void -mpfr_dump (mpfr_srcptr u) +mpfr_dump (mpfr_srcptr x) { - mpfr_print_binary(u); - putchar('\n'); + mpfr_fdump (stdout, x); } diff -Nru mpfr4-3.1.4/src/eint.c mpfr4-4.0.2/src/eint.c --- mpfr4-3.1.4/src/eint.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/eint.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_eint, mpfr_eint1 -- the exponential integral -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -30,8 +30,10 @@ eint (x) is undefined for x < 0. */ -/* compute in y an approximation of sum(x^k/k/k!, k=1..infinity), - and return e such that the absolute error is bound by 2^e ulp(y) */ +/* Compute in y an approximation of sum(x^k/k/k!, k=1..infinity), + and return e such that the absolute error is bound by 2^e ulp(y). + Return PREC(y) when the truncated series does not converge. +*/ static mpfr_exp_t mpfr_eint_aux (mpfr_t y, mpfr_srcptr x) { @@ -44,7 +46,7 @@ MPFR_GROUP_DECL (group); /* for |x| <= 1, we have S := sum(x^k/k/k!, k=1..infinity) = x + R(x) - where |R(x)| <= (x/2)^2/(1-x/2) <= 2*(x/2)^2 + where |R(x)| <= (x/2)^2/(1-|x|/2) <= 2*(x/2)^2 thus |R(x)/x| <= |x|/2 thus if |x| <= 2^(-PREC(y)) we have |S - o(x)| <= ulp(y) */ @@ -75,16 +77,19 @@ mpz_set_ui (t, 1); mpz_mul_2exp (t, t, w); mpfr_set_ui (eps, 0, MPFR_RNDN); /* eps[0] = 0 */ - mpfr_set_ui (errs, 0, MPFR_RNDN); + mpfr_set_ui (errs, 0, MPFR_RNDN); /* maximal error on s */ for (k = 1;; k++) { - /* let eps[k] be the absolute error on t[k]: + /* let t[k] = x^k/k/k!, and eps[k] be the absolute error on t[k]: since t[k] = trunc(t[k-1]*m*2^e/k), we have - eps[k+1] <= 1 + eps[k-1]*m*2^e/k + t[k-1]*m*2^(1-w)*2^e/k - = 1 + (eps[k-1] + t[k-1]*2^(1-w))*m*2^e/k - = 1 + (eps[k-1]*2^(w-1) + t[k-1])*2^(1-w)*m*2^e/k */ + eps[k+1] <= 1 + eps[k-1]*|m|*2^e/k + |t[k-1]|*|m|*2^(1-w)*2^e/k + = 1 + (eps[k-1] + |t[k-1]|*2^(1-w))*|m|*2^e/k + = 1 + (eps[k-1]*2^(w-1) + |t[k-1]|)*2^(1-w)*|m|*2^e/k */ mpfr_mul_2ui (eps, eps, w - 1, MPFR_RNDU); - mpfr_add_z (eps, eps, t, MPFR_RNDU); + if (mpz_sgn (t) >= 0) + mpfr_add_z (eps, eps, t, MPFR_RNDU); + else + mpfr_sub_z (eps, eps, t, MPFR_RNDU); MPFR_MPZ_SIZEINBASE2 (sizeinbase, m); mpfr_mul_2si (eps, eps, sizeinbase - (w - 1) + e, MPFR_RNDU); mpfr_div_ui (eps, eps, k, MPFR_RNDU); @@ -145,7 +150,7 @@ /* Return in y an approximation of Ei(x) using the asymptotic expansion: Ei(x) = exp(x)/x * (1 + 1/x + 2/x^2 + ... + k!/x^k + ...) - Assumes x >= PREC(y) * log(2). + Assumes |x| >= PREC(y) * log(2). Returns the error bound in terms of ulp(y). */ static mpfr_exp_t @@ -190,11 +195,13 @@ return err_exp; } +/* mpfr_eint returns Ei(x) for x >= 0, + and -E1(-x) for x < 0, following http://dlmf.nist.gov/6.2 */ int mpfr_eint (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) { int inex; - mpfr_t tmp, ump; + mpfr_t tmp, ump, x_abs; mpfr_exp_t err, te; mpfr_prec_t prec; MPFR_SAVE_EXPO_DECL (expo); @@ -206,80 +213,104 @@ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) { - /* eint(NaN) = eint(-Inf) = NaN */ - if (MPFR_IS_NAN (x) || (MPFR_IS_INF (x) && MPFR_IS_NEG(x))) + if (MPFR_IS_NAN (x)) { MPFR_SET_NAN (y); MPFR_RET_NAN; } - /* eint(+inf) = +inf */ else if (MPFR_IS_INF (x)) { - MPFR_SET_INF(y); - MPFR_SET_POS(y); + /* eint(+inf) = +inf and eint(-inf) = -0 */ + if (MPFR_IS_POS (x)) + { + MPFR_SET_INF(y); + MPFR_SET_POS(y); + } + else + { + MPFR_SET_ZERO(y); + MPFR_SET_NEG(y); + } MPFR_RET(0); } else /* eint(+/-0) = -Inf */ { MPFR_SET_INF(y); MPFR_SET_NEG(y); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); MPFR_RET(0); } } - /* eint(x) = NaN for x < 0 */ - if (MPFR_IS_NEG(x)) - { - MPFR_SET_NAN (y); - MPFR_RET_NAN; - } + MPFR_TMP_INIT_ABS (x_abs, x); MPFR_SAVE_EXPO_MARK (expo); + /* Init stuff */ + prec = MPFR_PREC (y) + 2 * MPFR_INT_CEIL_LOG2 (MPFR_PREC (y)) + 6; + mpfr_init2 (tmp, 64); + mpfr_init2 (ump, 64); + /* Since eint(x) >= exp(x)/x, we have log2(eint(x)) >= (x-log(x))/log(2). Let's compute k <= (x-log(x))/log(2) in a low precision. If k >= emax, then log2(eint(x)) >= emax, and eint(x) >= 2^emax, i.e. it overflows. */ - mpfr_init2 (tmp, 64); - mpfr_init2 (ump, 64); - mpfr_log (tmp, x, MPFR_RNDU); - mpfr_sub (ump, x, tmp, MPFR_RNDD); - mpfr_const_log2 (tmp, MPFR_RNDU); - mpfr_div (ump, ump, tmp, MPFR_RNDD); - /* FIXME: We really need mpfr_set_exp_t and mpfr_cmpfr_exp_t functions. */ - MPFR_ASSERTN (MPFR_EMAX_MAX <= LONG_MAX); - if (mpfr_cmp_ui (ump, __gmpfr_emax) >= 0) - { - mpfr_clear (tmp); - mpfr_clear (ump); - MPFR_SAVE_EXPO_FREE (expo); - return mpfr_overflow (y, rnd, 1); + if (MPFR_IS_POS(x)) + { + mpfr_log (tmp, x, MPFR_RNDU); + mpfr_sub (ump, x, tmp, MPFR_RNDD); + mpfr_div (ump, ump, __gmpfr_const_log2_RNDU, MPFR_RNDD); + /* FIXME: We really need a mpfr_cmp_exp_t function. */ + MPFR_ASSERTN (MPFR_EMAX_MAX <= LONG_MAX); + if (mpfr_cmp_ui (ump, __gmpfr_emax) >= 0) + { + mpfr_clear (tmp); + mpfr_clear (ump); + MPFR_SAVE_EXPO_FREE (expo); + return mpfr_overflow (y, rnd, 1); + } } - /* Init stuff */ - prec = MPFR_PREC (y) + 2 * MPFR_INT_CEIL_LOG2 (MPFR_PREC (y)) + 6; + /* Since E1(x) <= exp(-x) for x >= 1, we have log2(E1(x)) <= -x/log(2). + Let's compute k >= -x/log(2) in a low precision. If k < emin + then log2(E1(x)) <= emin-1, and E1(x) <= 2^(emin-1): it underflows. */ + if (MPFR_IS_NEG(x) && MPFR_GET_EXP(x) >= 1) + { + mpfr_div (ump, x, __gmpfr_const_log2_RNDD, MPFR_RNDU); + MPFR_ASSERTN (MPFR_EMIN_MIN >= LONG_MIN); + if (mpfr_cmp_si (ump, __gmpfr_emin) < 0) + { + mpfr_clear (tmp); + mpfr_clear (ump); + MPFR_SAVE_EXPO_FREE (expo); + return mpfr_underflow (y, rnd, -1); + } + } - /* eint() has a root 0.37250741078136663446..., so if x is near, - already take more bits */ - /* FIXME: do not use native floating-point here. */ - if (MPFR_GET_EXP(x) == -1) /* 1/4 <= x < 1/2 */ - { - double d; - d = mpfr_get_d (x, MPFR_RNDN) - 0.37250741078136663; - d = (d == 0.0) ? -53 : __gmpfr_ceil_log2 (d); - prec += -d; + /* eint() has a root 0.37250741078136663446..., + so if x is near, already take more bits */ + if (MPFR_IS_POS(x) && MPFR_GET_EXP(x) == -1) /* 1/4 <= x < 1/2 */ + { + mpfr_t y; + mpfr_init2 (y, 32); + /* 1599907147/2^32 is a 32-bit approximation of 0.37250741078136663446 */ + mpfr_set_ui_2exp (y, 1599907147UL, -32, MPFR_RNDN); + mpfr_sub (y, x, y, MPFR_RNDN); + prec += (mpfr_zero_p (y)) ? 32 + : mpfr_get_exp (y) < 0 ? -mpfr_get_exp (y) : 0; + mpfr_clear (y); } mpfr_set_prec (tmp, prec); mpfr_set_prec (ump, prec); - MPFR_ZIV_INIT (loop, prec); /* Initialize the ZivLoop controler */ - for (;;) /* Infinite loop */ + MPFR_ZIV_INIT (loop, prec); /* Initialize the ZivLoop controller */ + for (;;) /* Infinite loop */ { - /* We need that the smallest value of k!/x^k is smaller than 2^(-p). - The minimum is obtained for x=k, and it is smaller than e*sqrt(x)/e^x - for x>=1. */ - if (MPFR_GET_EXP (x) > 0 && mpfr_cmp_d (x, ((double) prec + + /* For the asymptotic expansion to work, we need that the smallest + value of k!/|x|^k is smaller than 2^(-p). The minimum is obtained for + x=k, and it is smaller than e*sqrt(x)/e^x for x>=1. */ + if (MPFR_GET_EXP (x) > 0 && + mpfr_cmp_d (x_abs, ((double) prec + 0.5 * (double) MPFR_GET_EXP (x)) * LOG2 + 1.0) > 0) err = mpfr_eint_asympt (tmp, x); else @@ -288,20 +319,27 @@ te = MPFR_GET_EXP(tmp); mpfr_const_euler (ump, MPFR_RNDN); /* 0.577 -> EXP(ump)=0 */ mpfr_add (tmp, tmp, ump, MPFR_RNDN); - /* error <= 1/2 + 1/2*2^(EXP(ump)-EXP(tmp)) + 2^(te-EXP(tmp)+err) + /* If tmp <> 0: + error <= 1/2 + 1/2*2^(EXP(ump)-EXP(tmp)) + 2^(te-EXP(tmp)+err) <= 1/2 + 2^(MAX(EXP(ump), te+err+1) - EXP(tmp)) - <= 2^(MAX(0, 1 + MAX(EXP(ump), te+err+1) - EXP(tmp))) */ - err = MAX(1, te + err + 2) - MPFR_GET_EXP(tmp); + <= 2^(MAX(0, 1 + MAX(EXP(ump), te+err+1) - EXP(tmp))). + If tmp = 0 we can use the same bound, replacing + EXP(tmp) by EXP(ump). */ + err = MAX(1, te + err + 2); + te = MPFR_IS_ZERO(tmp) ? MPFR_GET_EXP(ump) : MPFR_GET_EXP(tmp); + err = err - te; err = MAX(0, err); - te = MPFR_GET_EXP(tmp); - mpfr_log (ump, x, MPFR_RNDN); + mpfr_log (ump, x_abs, MPFR_RNDN); mpfr_add (tmp, tmp, ump, MPFR_RNDN); /* same formula as above, except now EXP(ump) is not 0 */ err += te + 1; if (MPFR_LIKELY (!MPFR_IS_ZERO (ump))) err = MAX (MPFR_GET_EXP (ump), err); - err = MAX(0, err - MPFR_GET_EXP (tmp)); + /* if tmp is zero, we surely cannot round correctly */ + err = (MPFR_IS_ZERO(tmp)) ? prec : MAX(0, err - MPFR_GET_EXP (tmp)); } + /* Note: we assume here that MPFR_CAN_ROUND returns the same result + for rnd and MPFR_INVERT_RND(rnd) */ if (MPFR_LIKELY (MPFR_CAN_ROUND (tmp, prec - err, MPFR_PREC (y), rnd))) break; MPFR_ZIV_NEXT (loop, prec); /* Increase used precision */ @@ -310,7 +348,8 @@ } MPFR_ZIV_FREE (loop); /* Free the ZivLoop Controller */ - inex = mpfr_set (y, tmp, rnd); /* Set y to the computed value */ + /* Set y to the computed value */ + inex = mpfr_set (y, tmp, rnd); mpfr_clear (tmp); mpfr_clear (ump); diff -Nru mpfr4-3.1.4/src/eq.c mpfr4-4.0.2/src/eq.c --- mpfr4-3.1.4/src/eq.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/eq.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_eq -- Compare two floats up to a specified bit #. -Copyright 1999, 2001, 2003-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999, 2001, 2003-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff -Nru mpfr4-3.1.4/src/erandom.c mpfr4-4.0.2/src/erandom.c --- mpfr4-3.1.4/src/erandom.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/erandom.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,105 @@ +/* mpfr_erandom (rop, state, rnd_mode) -- Generate an exponential deviate with + mean 1 and round it to the precision of rop according to the given rounding + mode. + +Copyright 2013-2019 Free Software Foundation, Inc. +Contributed by Charles Karney , SRI International. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* + * Sampling from the exponential distribution with unit mean using the method + * given in John von Neumann, Various techniques used in connection with random + * digits, in A. S. Householder, G. E. Forsythe, and H. H. Germond, editors, + * "Monte Carlo Method", number 12 in Applied Mathematics Series, pp. 36-38 + * (NBS, Washington, DC, 1951), Proceedings of a symposium held June 29-July 1, + * 1949, in Los Angeles. + * + * A modification to this algorithm is given in: + * Charles F. F. Karney, + * "Sampling exactly from the normal distribution", + * ACM Trans. Math. Software 42(1), 3:1-14 (Jan. 2016). + * https://dx.doi.org/10.1145/2710016 + * http://arxiv.org/abs/1303.6257 + * Although this improves the bit efficiency, in practice, it results in + * a slightly slower algorithm for MPFR. So here the original von Neumann + * algorithm is used. + * + * There are a few "weasel words" regarding the accuracy of this + * implementation. The algorithm produces exactly rounded exponential deviates + * provided that gmp's random number engine delivers truly random bits. If it + * did, the algorithm would be perfect; however, this implementation would have + * problems, e.g., in that the integer part of the exponential deviate is + * represented by an unsigned long, whereas in reality the integer part in + * unbounded. In this implementation, asserts catch overflow in the integer + * part and similar (very, very) unlikely events. In reality, of course, gmp's + * random number engine has a finite internal state (19937 bits in the case of + * the MT19937 method). This means that these unlikely events in fact won't + * occur. If the asserts are triggered, then this is an indication that the + * random number engine is defective. (Even if a hardware random number + * generator were used, the most likely explanation for the triggering of the + * asserts would be that the hardware generator was broken.) + */ + +#include "random_deviate.h" + +/* true with prob exp(-x) */ +static int +E (mpfr_random_deviate_t x, gmp_randstate_t r, + mpfr_random_deviate_t p, mpfr_random_deviate_t q) +{ + /* p and q are temporaries */ + mpfr_random_deviate_reset (p); + if (!mpfr_random_deviate_less (p, x, r)) + return 1; + for (;;) + { + mpfr_random_deviate_reset (q); + if (!mpfr_random_deviate_less (q, p, r)) + return 0; + mpfr_random_deviate_reset (p); + if (!mpfr_random_deviate_less (p, q, r)) + return 1; + } +} + +/* return an exponential random deviate with mean 1 as a MPFR */ +int +mpfr_erandom (mpfr_t z, gmp_randstate_t r, mpfr_rnd_t rnd) +{ + mpfr_random_deviate_t x, p, q; + int inex; + unsigned long k = 0; + + mpfr_random_deviate_init (x); + mpfr_random_deviate_init (p); + mpfr_random_deviate_init (q); + while (!E(x, r, p, q)) + { + ++k; + /* Catch k wrapping around to 0; for a 32-bit unsigned long, the + * probability of this is exp(-2^32)). */ + MPFR_ASSERTN (k != 0UL); + mpfr_random_deviate_reset (x); + } + mpfr_random_deviate_clear (q); + mpfr_random_deviate_clear (p); + inex = mpfr_random_deviate_value (0, k, x, z, r, rnd); + mpfr_random_deviate_clear (x); + return inex; +} diff -Nru mpfr4-3.1.4/src/erf.c mpfr4-4.0.2/src/erf.c --- mpfr4-3.1.4/src/erf.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/erf.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_erf -- error function of a floating-point number -Copyright 2001, 2003-2016 Free Software Foundation, Inc. +Copyright 2001, 2003-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,20 +17,19 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" -#define EXP1 2.71828182845904523536 /* exp(1) */ - static int mpfr_erf_0 (mpfr_ptr, mpfr_srcptr, double, mpfr_rnd_t); int mpfr_erf (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) { mpfr_t xf; + mp_limb_t xf_limb[(53 - 1) / GMP_NUMB_BITS + 1]; int inex, large; MPFR_SAVE_EXPO_DECL (expo); @@ -110,13 +109,11 @@ the error term x^2/3 is not that small. */ } - mpfr_init2 (xf, 53); - mpfr_const_log2 (xf, MPFR_RNDU); - mpfr_div (xf, x, xf, MPFR_RNDZ); /* round to zero ensures we get a lower - bound of |x/log(2)| */ + MPFR_TMP_INIT1(xf_limb, xf, 53); + mpfr_div (xf, x, __gmpfr_const_log2_RNDU, MPFR_RNDZ); /* round to zero + ensures we get a lower bound of |x/log(2)| */ mpfr_mul (xf, xf, x, MPFR_RNDZ); large = mpfr_cmp_ui (xf, MPFR_PREC (y) + 1) > 0; - mpfr_clear (xf); /* when x goes to infinity, we have erf(x) = 1 - 1/sqrt(Pi)/exp(x^2)/x + ... and |erf(x) - 1| <= exp(-x^2) is true for any x >= 0, thus if @@ -157,15 +154,21 @@ static double mul_2exp (double x, mpfr_exp_t e) { - if (e > 0) + /* Most of the times, the argument is negative */ + if (MPFR_UNLIKELY (e > 0)) { while (e--) x *= 2.0; } else { + while (e <= -16) + { + x *= (1.0 / 65536.0); + e += 16; + } while (e++) - x /= 2.0; + x *= 0.5; } return x; @@ -183,11 +186,10 @@ { mpfr_prec_t n, m; mpfr_exp_t nuk, sigmak; - double tauk; mpfr_t y, s, t, u; unsigned int k; - int log2tauk; int inex; + MPFR_GROUP_DECL (group); MPFR_ZIV_DECL (loop); n = MPFR_PREC (res); /* target precision */ @@ -195,18 +197,19 @@ /* initial working precision */ m = n + (mpfr_prec_t) (xf2 / LOG2) + 8 + MPFR_INT_CEIL_LOG2 (n); - mpfr_init2 (y, m); - mpfr_init2 (s, m); - mpfr_init2 (t, m); - mpfr_init2 (u, m); + MPFR_GROUP_INIT_4(group, m, y, s, t, u); MPFR_ZIV_INIT (loop, m); for (;;) { + mpfr_t tauk; + mpfr_exp_t log2tauk; + mpfr_mul (y, x, x, MPFR_RNDU); /* err <= 1 ulp */ mpfr_set_ui (s, 1, MPFR_RNDN); mpfr_set_ui (t, 1, MPFR_RNDN); - tauk = 0.0; + mpfr_init2 (tauk, 53); + mpfr_set_ui (tauk, 0, MPFR_RNDU); for (k = 1; ; k++) { @@ -221,12 +224,13 @@ sigmak -= MPFR_GET_EXP(s); nuk = MPFR_GET_EXP(u) - MPFR_GET_EXP(s); - if ((nuk < - (mpfr_exp_t) m) && ((double) k >= xf2)) + if ((nuk < - (mpfr_exp_t) m) && (k >= xf2)) break; /* tauk <- 1/2 + tauk * 2^sigmak + (1+8k)*2^nuk */ - tauk = 0.5 + mul_2exp (tauk, sigmak) - + mul_2exp (1.0 + 8.0 * (double) k, nuk); + mpfr_mul_2si (tauk, tauk, sigmak, MPFR_RNDU); + mpfr_add_d (tauk, tauk, 0.5 + mul_2exp (1.0 + 8.0 * (double) k, nuk), + MPFR_RNDU); } mpfr_mul (s, x, s, MPFR_RNDU); @@ -235,28 +239,27 @@ mpfr_const_pi (t, MPFR_RNDZ); mpfr_sqrt (t, t, MPFR_RNDZ); mpfr_div (s, s, t, MPFR_RNDN); - tauk = 4.0 * tauk + 11.0; /* final ulp-error on s */ - log2tauk = __gmpfr_ceil_log2 (tauk); + /* tauk = 4 * tauk + 11: final ulp-error on s */ + mpfr_mul_2ui (tauk, tauk, 2, MPFR_RNDU); + mpfr_add_ui (tauk, tauk, 11, MPFR_RNDU); + /* In practice, one should not get an infinity, as it would require + a huge precision and a lot of time, but just in case... */ + MPFR_ASSERTN (!MPFR_IS_INF (tauk)); + log2tauk = MPFR_GET_EXP (tauk); + mpfr_clear (tauk); if (MPFR_LIKELY (MPFR_CAN_ROUND (s, m - log2tauk, n, rnd_mode))) break; /* Actualisation of the precision */ MPFR_ZIV_NEXT (loop, m); - mpfr_set_prec (y, m); - mpfr_set_prec (s, m); - mpfr_set_prec (t, m); - mpfr_set_prec (u, m); - + MPFR_GROUP_REPREC_4 (group, m, y, s, t, u); } MPFR_ZIV_FREE (loop); inex = mpfr_set (res, s, rnd_mode); - mpfr_clear (y); - mpfr_clear (t); - mpfr_clear (u); - mpfr_clear (s); + MPFR_GROUP_CLEAR (group); return inex; } diff -Nru mpfr4-3.1.4/src/erfc.c mpfr4-4.0.2/src/erfc.c --- mpfr4-3.1.4/src/erfc.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/erfc.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_erfc -- The Complementary Error Function of a floating-point number -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -149,7 +149,7 @@ return mpfr_set_ui (y, 1, rnd); } - if (MPFR_SIGN (x) > 0) + if (MPFR_IS_POS (x)) { /* by default, emin = 1-2^30, thus the smallest representable number is 1/2*2^emin = 2^(-2^30): @@ -160,7 +160,7 @@ mpfr_cmp_ui (x, 1787897414) >= 0) { /* May be incorrect if MPFR_EMAX_MAX >= 2^62. */ - MPFR_ASSERTN ((MPFR_EMAX_MAX >> 31) >> 31 == 0); + MPFR_STAT_STATIC_ASSERT ((MPFR_EMAX_MAX >> 31) >> 31 == 0); return mpfr_underflow (y, (rnd == MPFR_RNDN) ? MPFR_RNDZ : rnd, 1); } } @@ -168,7 +168,7 @@ /* Init stuff */ MPFR_SAVE_EXPO_MARK (expo); - if (MPFR_SIGN (x) < 0) + if (MPFR_IS_NEG (x)) { mpfr_exp_t e = MPFR_EXP(x); /* For x < 0 going to -infinity, erfc(x) tends to 2 by below. @@ -185,7 +185,7 @@ { near_two: mpfr_set_ui (y, 2, MPFR_RNDN); - mpfr_set_inexflag (); + MPFR_SET_INEXFLAG (); if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD) { mpfr_nextbelow (y); @@ -220,7 +220,7 @@ /* erfc(x) ~ 1, with error < 2^(EXP(x)+1) */ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, __gmpfr_one, - MPFR_GET_EXP (x) - 1, - 0, MPFR_SIGN(x) < 0, + 0, MPFR_IS_NEG (x), rnd, inex = _inexact; goto end); prec = MPFR_PREC (y) + MPFR_INT_CEIL_LOG2 (MPFR_PREC (y)) + 3; @@ -229,12 +229,12 @@ mpfr_init2 (tmp, prec); - MPFR_ZIV_INIT (loop, prec); /* Initialize the ZivLoop controler */ + MPFR_ZIV_INIT (loop, prec); /* Initialize the ZivLoop controller */ for (;;) /* Infinite loop */ { /* use asymptotic formula only whenever x^2 >= p*log(2), otherwise it will not converge */ - if (MPFR_SIGN (x) > 0 && + if (MPFR_IS_POS (x) && 2 * MPFR_GET_EXP (x) - 2 >= MPFR_INT_CEIL_LOG2 (prec)) /* we have x^2 >= p in that case */ { diff -Nru mpfr4-3.1.4/src/exceptions.c mpfr4-4.0.2/src/exceptions.c --- mpfr4-3.1.4/src/exceptions.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/exceptions.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ -/* Exception flags and utilities. +/* Exception flags and utilities. Constructors and destructors (debug). -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,25 +17,18 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" -MPFR_THREAD_ATTR unsigned int __gmpfr_flags = 0; - -MPFR_THREAD_ATTR mpfr_exp_t __gmpfr_emin = MPFR_EMIN_DEFAULT; -MPFR_THREAD_ATTR mpfr_exp_t __gmpfr_emax = MPFR_EMAX_DEFAULT; - -#ifdef MPFR_WIN_THREAD_SAFE_DLL -unsigned int * __gmpfr_flags_f() { return &__gmpfr_flags; } -mpfr_exp_t * __gmpfr_emin_f() { return &__gmpfr_emin; } -mpfr_exp_t * __gmpfr_emax_f() { return &__gmpfr_emax; } -#endif +MPFR_THREAD_VAR (mpfr_flags_t, __gmpfr_flags, 0) +MPFR_THREAD_VAR (mpfr_exp_t, __gmpfr_emin, MPFR_EMIN_DEFAULT) +MPFR_THREAD_VAR (mpfr_exp_t, __gmpfr_emax, MPFR_EMAX_DEFAULT) #undef mpfr_get_emin -mpfr_exp_t +MPFR_COLD_FUNCTION_ATTR mpfr_exp_t mpfr_get_emin (void) { return __gmpfr_emin; @@ -46,7 +39,7 @@ int mpfr_set_emin (mpfr_exp_t exponent) { - if (exponent >= MPFR_EMIN_MIN && exponent <= MPFR_EMIN_MAX) + if (MPFR_LIKELY (exponent >= MPFR_EMIN_MIN && exponent <= MPFR_EMIN_MAX)) { __gmpfr_emin = exponent; return 0; @@ -57,13 +50,13 @@ } } -mpfr_exp_t +MPFR_COLD_FUNCTION_ATTR mpfr_exp_t mpfr_get_emin_min (void) { return MPFR_EMIN_MIN; } -mpfr_exp_t +MPFR_COLD_FUNCTION_ATTR mpfr_exp_t mpfr_get_emin_max (void) { return MPFR_EMIN_MAX; @@ -71,7 +64,7 @@ #undef mpfr_get_emax -mpfr_exp_t +MPFR_COLD_FUNCTION_ATTR mpfr_exp_t mpfr_get_emax (void) { return __gmpfr_emax; @@ -82,7 +75,7 @@ int mpfr_set_emax (mpfr_exp_t exponent) { - if (exponent >= MPFR_EMAX_MIN && exponent <= MPFR_EMAX_MAX) + if (MPFR_LIKELY (exponent >= MPFR_EMAX_MIN && exponent <= MPFR_EMAX_MAX)) { __gmpfr_emax = exponent; return 0; @@ -93,18 +86,62 @@ } } -mpfr_exp_t +MPFR_COLD_FUNCTION_ATTR mpfr_exp_t mpfr_get_emax_min (void) { return MPFR_EMAX_MIN; } -mpfr_exp_t + +MPFR_COLD_FUNCTION_ATTR mpfr_exp_t mpfr_get_emax_max (void) { return MPFR_EMAX_MAX; } +#undef mpfr_flags_clear + +MPFR_COLD_FUNCTION_ATTR void +mpfr_flags_clear (mpfr_flags_t mask) +{ + __gmpfr_flags &= MPFR_FLAGS_ALL ^ mask; +} + +#undef mpfr_flags_set + +MPFR_COLD_FUNCTION_ATTR void +mpfr_flags_set (mpfr_flags_t mask) +{ + __gmpfr_flags |= mask; +} + +#undef mpfr_flags_test + +MPFR_COLD_FUNCTION_ATTR mpfr_flags_t +mpfr_flags_test (mpfr_flags_t mask) +{ + return __gmpfr_flags & mask; +} + +#undef mpfr_flags_save + +MPFR_COLD_FUNCTION_ATTR mpfr_flags_t +mpfr_flags_save (void) +{ + return __gmpfr_flags; +} + +#undef mpfr_flags_restore + +MPFR_COLD_FUNCTION_ATTR void +mpfr_flags_restore (mpfr_flags_t flags, mpfr_flags_t mask) +{ + __gmpfr_flags = + (__gmpfr_flags & (MPFR_FLAGS_ALL ^ mask)) | + (flags & mask); +} + + #undef mpfr_clear_flags void @@ -115,7 +152,7 @@ #undef mpfr_clear_underflow -void +MPFR_COLD_FUNCTION_ATTR void mpfr_clear_underflow (void) { __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_UNDERFLOW; @@ -123,7 +160,7 @@ #undef mpfr_clear_overflow -void +MPFR_COLD_FUNCTION_ATTR void mpfr_clear_overflow (void) { __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_OVERFLOW; @@ -131,7 +168,7 @@ #undef mpfr_clear_divby0 -void +MPFR_COLD_FUNCTION_ATTR void mpfr_clear_divby0 (void) { __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_DIVBY0; @@ -139,7 +176,7 @@ #undef mpfr_clear_nanflag -void +MPFR_COLD_FUNCTION_ATTR void mpfr_clear_nanflag (void) { __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_NAN; @@ -147,7 +184,7 @@ #undef mpfr_clear_inexflag -void +MPFR_COLD_FUNCTION_ATTR void mpfr_clear_inexflag (void) { __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_INEXACT; @@ -155,7 +192,7 @@ #undef mpfr_clear_erangeflag -void +MPFR_COLD_FUNCTION_ATTR void mpfr_clear_erangeflag (void) { __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_ERANGE; @@ -163,7 +200,7 @@ #undef mpfr_set_underflow -void +MPFR_COLD_FUNCTION_ATTR void mpfr_set_underflow (void) { __gmpfr_flags |= MPFR_FLAGS_UNDERFLOW; @@ -171,7 +208,7 @@ #undef mpfr_set_overflow -void +MPFR_COLD_FUNCTION_ATTR void mpfr_set_overflow (void) { __gmpfr_flags |= MPFR_FLAGS_OVERFLOW; @@ -179,7 +216,7 @@ #undef mpfr_set_divby0 -void +MPFR_COLD_FUNCTION_ATTR void mpfr_set_divby0 (void) { __gmpfr_flags |= MPFR_FLAGS_DIVBY0; @@ -187,7 +224,7 @@ #undef mpfr_set_nanflag -void +MPFR_COLD_FUNCTION_ATTR void mpfr_set_nanflag (void) { __gmpfr_flags |= MPFR_FLAGS_NAN; @@ -195,7 +232,7 @@ #undef mpfr_set_inexflag -void +MPFR_COLD_FUNCTION_ATTR void mpfr_set_inexflag (void) { __gmpfr_flags |= MPFR_FLAGS_INEXACT; @@ -203,7 +240,7 @@ #undef mpfr_set_erangeflag -void +MPFR_COLD_FUNCTION_ATTR void mpfr_set_erangeflag (void) { __gmpfr_flags |= MPFR_FLAGS_ERANGE; @@ -212,13 +249,18 @@ #undef mpfr_check_range +/* Note: It is possible that for pure FP numbers, EXP(x) < MPFR_EMIN_MIN, + but the caller must make sure that the difference remains small enough + to avoid reaching the special exponent values. */ int mpfr_check_range (mpfr_ptr x, int t, mpfr_rnd_t rnd_mode) { - if (MPFR_LIKELY( MPFR_IS_PURE_FP(x)) ) + if (MPFR_LIKELY (! MPFR_IS_SINGULAR (x))) { /* x is a non-zero FP */ mpfr_exp_t exp = MPFR_EXP (x); /* Do not use MPFR_GET_EXP */ - if (MPFR_UNLIKELY( exp < __gmpfr_emin) ) + + MPFR_ASSERTD (MPFR_IS_NORMALIZED (x)); + if (MPFR_UNLIKELY (exp < __gmpfr_emin)) { /* The following test is necessary because in the rounding to the * nearest mode, mpfr_underflow always rounds away from 0. In @@ -232,9 +274,9 @@ (mpfr_powerof2_raw(x) && (MPFR_IS_NEG(x) ? t <= 0 : t >= 0)))) rnd_mode = MPFR_RNDZ; - return mpfr_underflow(x, rnd_mode, MPFR_SIGN(x)); + return mpfr_underflow (x, rnd_mode, MPFR_SIGN(x)); } - if (MPFR_UNLIKELY( exp > __gmpfr_emax) ) + if (MPFR_UNLIKELY (exp > __gmpfr_emax)) return mpfr_overflow (x, rnd_mode, MPFR_SIGN(x)); } else if (MPFR_UNLIKELY (t != 0 && MPFR_IS_INF (x))) @@ -265,66 +307,82 @@ MPFR_RET (t); /* propagate inexact ternary value, unlike most functions */ } + #undef mpfr_underflow_p -int +MPFR_COLD_FUNCTION_ATTR int mpfr_underflow_p (void) { + MPFR_STAT_STATIC_ASSERT (MPFR_FLAGS_UNDERFLOW <= INT_MAX); return __gmpfr_flags & MPFR_FLAGS_UNDERFLOW; } #undef mpfr_overflow_p -int +MPFR_COLD_FUNCTION_ATTR int mpfr_overflow_p (void) { + MPFR_STAT_STATIC_ASSERT (MPFR_FLAGS_OVERFLOW <= INT_MAX); return __gmpfr_flags & MPFR_FLAGS_OVERFLOW; } #undef mpfr_divby0_p -int +MPFR_COLD_FUNCTION_ATTR int mpfr_divby0_p (void) { + MPFR_STAT_STATIC_ASSERT (MPFR_FLAGS_DIVBY0 <= INT_MAX); return __gmpfr_flags & MPFR_FLAGS_DIVBY0; } #undef mpfr_nanflag_p -int +MPFR_COLD_FUNCTION_ATTR int mpfr_nanflag_p (void) { + MPFR_STAT_STATIC_ASSERT (MPFR_FLAGS_NAN <= INT_MAX); return __gmpfr_flags & MPFR_FLAGS_NAN; } #undef mpfr_inexflag_p -int +MPFR_COLD_FUNCTION_ATTR int mpfr_inexflag_p (void) { + MPFR_STAT_STATIC_ASSERT (MPFR_FLAGS_INEXACT <= INT_MAX); return __gmpfr_flags & MPFR_FLAGS_INEXACT; } #undef mpfr_erangeflag_p -int +MPFR_COLD_FUNCTION_ATTR int mpfr_erangeflag_p (void) { + MPFR_STAT_STATIC_ASSERT (MPFR_FLAGS_ERANGE <= INT_MAX); return __gmpfr_flags & MPFR_FLAGS_ERANGE; } + /* #undef mpfr_underflow */ /* Note: In the rounding to the nearest mode, mpfr_underflow always rounds away from 0. In this rounding mode, you must call mpfr_underflow with rnd_mode = MPFR_RNDZ if the exact result - is <= 2^(emin-2) in absolute value. */ + is <= 2^(emin-2) in absolute value. + We chose the default to round away from zero instead of toward zero + because rounding away from zero (MPFR_RNDA) wasn't supported at that + time (r1910), so that the caller had no way to change rnd_mode to + this mode. */ -int +MPFR_COLD_FUNCTION_ATTR int mpfr_underflow (mpfr_ptr x, mpfr_rnd_t rnd_mode, int sign) { int inex; + MPFR_LOG_FUNC + (("rnd=%d sign=%d", rnd_mode, sign), + ("x[%Pu]=%.*Rg", mpfr_get_prec (x), mpfr_log_prec, x)); + MPFR_ASSERT_SIGN (sign); if (MPFR_IS_LIKE_RNDZ(rnd_mode, sign < 0)) @@ -344,12 +402,17 @@ /* #undef mpfr_overflow */ -int +MPFR_COLD_FUNCTION_ATTR int mpfr_overflow (mpfr_ptr x, mpfr_rnd_t rnd_mode, int sign) { int inex; - MPFR_ASSERT_SIGN(sign); + MPFR_LOG_FUNC + (("rnd=%d sign=%d", rnd_mode, sign), + ("x[%Pu]=%.*Rg", mpfr_get_prec (x), mpfr_log_prec, x)); + + MPFR_ASSERT_SIGN (sign); + if (MPFR_IS_LIKE_RNDZ(rnd_mode, sign < 0)) { mpfr_setmax (x, __gmpfr_emax); @@ -360,7 +423,50 @@ MPFR_SET_INF(x); inex = 1; } - MPFR_SET_SIGN(x,sign); + MPFR_SET_SIGN(x, sign); __gmpfr_flags |= MPFR_FLAGS_INEXACT | MPFR_FLAGS_OVERFLOW; return sign > 0 ? inex : -inex; } + +/**************************************************************************/ + +/* Code related to constructors and destructors (for debugging) should + be put here. The reason is that such code must be in an object file + that will be kept by the linker for symbol resolution, and symbols + __gmpfr_emin and __gmpfr_emax from this file will be used by every + program calling a MPFR math function (where rounding is involved). */ + +#if defined MPFR_DEBUG_PREDICTION + +/* Print prediction statistics at the end of a program. + * + * Code to debug branch prediction, based on Ulrich Drepper's paper + * "What Every Programmer Should Know About Memory": + * http://people.freebsd.org/~lstewart/articles/cpumemory.pdf + */ + +extern long int __start_predict_data; +extern long int __stop_predict_data; +extern long int __start_predict_line; +extern const char *__start_predict_file; + +static void __attribute__ ((destructor)) +predprint (void) +{ + long int *s = &__start_predict_data; + long int *e = &__stop_predict_data; + long int *sl = &__start_predict_line; + const char **sf = &__start_predict_file; + + while (s < e) + { + printf("%s:%ld: incorrect=%ld, correct=%ld%s\n", + *sf, *sl, s[0], s[1], + s[0] > s[1] ? " <==== WARNING" : ""); + ++sl; + ++sf; + s += 2; + } +} + +#endif diff -Nru mpfr4-3.1.4/src/exp10.c mpfr4-4.0.2/src/exp10.c --- mpfr4-3.1.4/src/exp10.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/exp10.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_exp10 -- power of 10 function 10^y -Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2003-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/exp_2.c mpfr4-4.0.2/src/exp_2.c --- mpfr4-3.1.4/src/exp_2.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/exp_2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_exp_2 -- exponential of a floating-point number using algorithms in O(n^(1/2)*M(n)) and O(n^(1/3)*M(n)) -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,10 +18,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* #define DEBUG */ #define MPFR_NEED_LONGLONG_H /* for count_leading_zeros */ #include "mpfr-impl.h" @@ -44,13 +43,12 @@ MPFR_MPZ_SIZEINBASE2 (k, z); MPFR_ASSERTD (k == (mpfr_uexp_t) k); - if (q < 0 || (mpfr_uexp_t) k > (mpfr_uexp_t) q) + if (MPFR_LIKELY(q < 0 || (mpfr_uexp_t) k > (mpfr_uexp_t) q)) { mpz_fdiv_q_2exp (rop, z, (unsigned long) ((mpfr_uexp_t) k - q)); return (mpfr_exp_t) k - q; } - if (MPFR_UNLIKELY(rop != z)) - mpz_set (rop, z); + mpz_set (rop, z); return 0; } @@ -61,7 +59,7 @@ static mpfr_exp_t mpz_normalize2 (mpz_t rop, mpz_t z, mpfr_exp_t expz, mpfr_exp_t target) { - if (target > expz) + if (MPFR_LIKELY(target > expz)) mpz_fdiv_q_2exp (rop, z, target - expz); else mpz_mul_2exp (rop, z, expz - target); @@ -83,8 +81,9 @@ mpfr_exp_t exps, expx; mpfr_prec_t q, precy; int inexact; - mpfr_t r, s; + mpfr_t s, r; mpz_t ss; + MPFR_GROUP_DECL(group); MPFR_ZIV_DECL (loop); MPFR_LOG_FUNC @@ -95,20 +94,47 @@ expx = MPFR_GET_EXP (x); precy = MPFR_PREC(y); - /* Warning: we cannot use the 'double' type here, since on 64-bit machines + /* First perform argument reduction: if x' = x - n*log(2) we have + exp(x) = exp(x)*2^n. We should take n near from x/log(2) but it does not + need to be exact. + Warning: we cannot use the 'double' type here, since on 64-bit machines x may be as large as 2^62*log(2) without overflow, and then x/log(2) is about 2^62: not every integer of that size can be represented as a 'double', thus the argument reduction would fail. */ - if (expx <= -2) + if (MPFR_UNLIKELY(expx <= -2)) /* |x| <= 0.25, thus n = round(x/log(2)) = 0 */ n = 0; else { - mpfr_init2 (r, sizeof (long) * CHAR_BIT); - mpfr_const_log2 (r, MPFR_RNDZ); - mpfr_div (r, x, r, MPFR_RNDN); + mp_limb_t r_limb[(sizeof (long) -1) / sizeof(mp_limb_t) + 1]; + /* Note: we use precision sizeof (long) * CHAR_BIT - 1 here since it is + more efficient that full limb precision. */ + MPFR_TMP_INIT1(r_limb, r, sizeof (long) * CHAR_BIT - 1); + mpfr_div (r, x, __gmpfr_const_log2_RNDD, MPFR_RNDN); +#ifdef MPFR_LONG_WITHIN_LIMB + /* The following code assume an unsigned long can fit in a mp_limb_t */ + { + mp_limb_t a; + mpfr_exp_t exp; + MPFR_STAT_STATIC_ASSERT (MPFR_LIMB_MAX >= ULONG_MAX); + /* Read the long directly (faster than using mpfr_get_si + since it fits, it is not singular, it can't be zero + and there is no conversion to do) */ + MPFR_ASSERTD (MPFR_NOTZERO (r)); + exp = MPFR_GET_EXP (r); + MPFR_ASSERTD (exp <= GMP_NUMB_BITS); + if (exp >= 1) + { + a = MPFR_MANT(r)[0] >> (GMP_NUMB_BITS - exp); + n = MPFR_IS_POS (r) ? a : a <= LONG_MAX ? - (long) a : LONG_MIN; + } + else + n = 0; + } +#else + /* Use generic way to get the long */ n = mpfr_get_si (r, MPFR_RNDN); - mpfr_clear (r); +#endif } /* we have |x| <= (|n|+1)*log(2) */ MPFR_LOG_MSG (("d(x)=%1.30e n=%ld\n", mpfr_get_d1(x), n)); @@ -118,7 +144,8 @@ error_r = 0; else { - count_leading_zeros (error_r, (mp_limb_t) SAFE_ABS (unsigned long, n) + 1); + count_leading_zeros (error_r, + (mp_limb_t) SAFE_ABS (unsigned long, n) + 1); error_r = GMP_NUMB_BITS - error_r; /* we have |x| <= 2^error_r * log(2) */ } @@ -126,21 +153,21 @@ /* for the O(n^(1/2)*M(n)) method, the Taylor series computation of n/K terms costs about n/(2K) multiplications when computed in fixed point */ - K = (precy < MPFR_EXP_2_THRESHOLD) ? __gmpfr_isqrt ((precy + 1) / 2) + K = (precy < MPFR_EXP_2_THRESHOLD) ? __gmpfr_isqrt ((precy + 1) / 2) + 3 : __gmpfr_cuberoot (4*precy); l = (precy - 1) / K + 1; err = K + MPFR_INT_CEIL_LOG2 (2 * l + 18); /* add K extra bits, i.e. failure probability <= 1/2^K = O(1/precy) */ - q = precy + err + K + 8; + q = precy + err + K + 10; /* if |x| >> 1, take into account the cancelled bits */ if (expx > 0) q += expx; - /* Note: due to the mpfr_prec_round below, it is not possible to use - the MPFR_GROUP_* macros here. */ - - mpfr_init2 (r, q + error_r); - mpfr_init2 (s, q + error_r); + /* Even with to the mpfr_prec_round below, it is possible to use + the MPFR_GROUP_* macros here because mpfr_prec_round is only + called in a special case. */ + MPFR_GROUP_INIT_2(group, q + error_r, r, s); + mpz_init (ss); /* the algorithm consists in computing an upper bound of exp(x) using a precision of q bits, and see if we can round to MPFR_PREC(y) taking @@ -171,27 +198,31 @@ mpfr_sub (r, x, r, MPFR_RNDU); - if (MPFR_IS_PURE_FP (r)) - { - while (MPFR_IS_NEG (r)) - { /* initial approximation n was too large */ - n--; - mpfr_add (r, r, s, MPFR_RNDU); - } + while (MPFR_IS_PURE_FP(r) && MPFR_IS_NEG (r)) + { /* initial approximation n was too large */ + n--; + mpfr_add (r, r, s, MPFR_RNDU); + } + /* if r is 0, we cannot round correctly */ + if (MPFR_LIKELY(MPFR_IS_PURE_FP (r))) + { /* since there was a cancellation in x - n*log(2), the low error_r bits from r are zero and thus non significant, thus we can reduce the working precision */ - if (error_r > 0) - mpfr_prec_round (r, q, MPFR_RNDU); + if (MPFR_LIKELY(error_r > 0)) + { + MPFR_ASSERTD( MPFR_PREC(r) > q); + /* since MPFR_PREC(r) > q, there is no reallocation to do, + and it is safe to use it with MPFR_GROUP functions */ + mpfr_prec_round (r, q, MPFR_RNDU); + } /* the error on r is at most 3 ulps (3 ulps if error_r = 0, and 1 + 3/2 if error_r > 0) */ MPFR_LOG_VAR (r); MPFR_ASSERTD (MPFR_IS_POS (r)); mpfr_div_2ui (r, r, K, MPFR_RNDU); /* r = (x-n*log(2))/2^K, exact */ - mpz_init (ss); - exps = mpfr_get_z_2exp (ss, s); /* s <- 1 + r/1! + r^2/2! + ... + r^l/l! */ MPFR_ASSERTD (MPFR_IS_PURE_FP (r) && MPFR_EXP (r) < 0); l = (precy < MPFR_EXP_2_THRESHOLD) @@ -207,10 +238,7 @@ exps *= 2; exps += mpz_normalize (ss, ss, q); } - mpfr_set_z (s, ss, MPFR_RNDN); - - MPFR_SET_EXP(s, MPFR_GET_EXP (s) + exps); - mpz_clear (ss); + mpfr_set_z_2exp (s, ss, exps, MPFR_RNDN); /* error is at most 2^K*l, plus 2 to take into account of the error of 3 ulps on r */ @@ -222,20 +250,17 @@ if (MPFR_LIKELY (MPFR_CAN_ROUND (s, q - err, precy, rnd_mode))) { - mpfr_clear_flags (); + MPFR_CLEAR_FLAGS (); inexact = mpfr_mul_2si (y, s, n, rnd_mode); break; } } - MPFR_ZIV_NEXT (loop, q); - mpfr_set_prec (r, q + error_r); - mpfr_set_prec (s, q + error_r); + MPFR_GROUP_REPREC_2(group, q+error_r, r, s); } MPFR_ZIV_FREE (loop); - - mpfr_clear (r); - mpfr_clear (s); + mpz_clear (ss); + MPFR_GROUP_CLEAR (group); return inexact; } @@ -246,10 +271,6 @@ The absolute error on s is less than 3*l*(l+1)*2^(-q). Version using fixed-point arithmetic with mpz instead of mpfr for internal computations. - NOTE[VL]: the following sentence seems to be obsolete since MY_INIT_MPZ - is no longer used (r6919); qn was the number of limbs of q. - s must have at least qn+1 limbs (qn should be enough, but currently fails - since mpz_mul_2exp(s, s, q-1) reallocates qn+1 limbs) */ static unsigned long mpfr_exp2_aux (mpz_t s, mpfr_srcptr r, mpfr_prec_t q, mpfr_exp_t *exps) @@ -259,38 +280,52 @@ mpz_t t, rr; mp_size_t sbit, tbit; - MPFR_ASSERTN (MPFR_IS_PURE_FP (r)); + MPFR_ASSERTD (MPFR_IS_PURE_FP (r)); expt = 0; *exps = 1 - (mpfr_exp_t) q; /* s = 2^(q-1) */ mpz_init (t); mpz_init (rr); - mpz_set_ui(t, 1); - mpz_set_ui(s, 1); - mpz_mul_2exp(s, s, q-1); - expr = mpfr_get_z_2exp(rr, r); /* no error here */ + mpz_set_ui (t, 1); + mpz_set_ui (s, 1); + mpz_mul_2exp (s, s, q-1); + expr = mpfr_get_z_2exp (rr, r); /* no error here */ l = 0; - for (;;) { - l++; - mpz_mul(t, t, rr); - expt += expr; - MPFR_MPZ_SIZEINBASE2 (sbit, s); - MPFR_MPZ_SIZEINBASE2 (tbit, t); - dif = *exps + sbit - expt - tbit; - /* truncates the bits of t which are < ulp(s) = 2^(1-q) */ - expt += mpz_normalize(t, t, (mpfr_exp_t) q-dif); /* error at most 2^(1-q) */ - mpz_fdiv_q_ui (t, t, l); /* error at most 2^(1-q) */ - /* the error wrt t^l/l! is here at most 3*l*ulp(s) */ - MPFR_ASSERTD (expt == *exps); - if (mpz_sgn (t) == 0) - break; - mpz_add(s, s, t); /* no error here: exact */ - /* ensures rr has the same size as t: after several shifts, the error - on rr is still at most ulp(t)=ulp(s) */ - MPFR_MPZ_SIZEINBASE2 (tbit, t); - expr += mpz_normalize(rr, rr, tbit); - } + for (;;) + { + l++; + mpz_mul(t, t, rr); + expt += expr; + MPFR_MPZ_SIZEINBASE2 (sbit, s); + MPFR_MPZ_SIZEINBASE2 (tbit, t); + dif = *exps + sbit - expt - tbit; + /* truncates the bits of t which are < ulp(s) = 2^(1-q) */ + expt += mpz_normalize (t, t, (mpfr_exp_t) q - dif); + /* error at most 2^(1-q) */ + if (l > 1) + { + /* GMP doesn't optimize the case of power of 2 */ + if (IS_POW2(l)) + { + int bits = MPFR_INT_CEIL_LOG2(l); + mpz_fdiv_q_2exp (t, t, bits); /* error at most 2^(1-q) */ + } + else + { + mpz_fdiv_q_ui (t, t, l); /* error at most 2^(1-q) */ + } + /* the error wrt t^l/l! is here at most 3*l*ulp(s) */ + MPFR_ASSERTD (expt == *exps); + } + if (mpz_sgn (t) == 0) + break; + mpz_add (s, s, t); /* no error here: exact */ + /* ensures rr has the same size as t: after several shifts, the error + on rr is still at most ulp(t)=ulp(s) */ + MPFR_MPZ_SIZEINBASE2 (tbit, t); + expr += mpz_normalize (rr, rr, tbit); + } mpz_clear (t); mpz_clear (rr); diff -Nru mpfr4-3.1.4/src/exp2.c mpfr4-4.0.2/src/exp2.c --- mpfr4-3.1.4/src/exp2.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/exp2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_exp2 -- power of 2 function 2^y -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -29,7 +29,7 @@ int mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) { - int inexact; + int inexact, inex2; long xint; mpfr_t xfrac; MPFR_SAVE_EXPO_DECL (expo); @@ -62,24 +62,22 @@ } } - /* since the smallest representable non-zero float is 1/2*2^__gmpfr_emin, - if x < __gmpfr_emin - 1, the result is either 1/2*2^__gmpfr_emin or 0 */ - MPFR_ASSERTN (MPFR_EMIN_MIN >= LONG_MIN + 2); - if (MPFR_UNLIKELY (mpfr_cmp_si (x, __gmpfr_emin - 1) < 0)) - { - mpfr_rnd_t rnd2 = rnd_mode; - /* in round to nearest mode, round to zero when x <= __gmpfr_emin-2 */ - if (rnd_mode == MPFR_RNDN && - mpfr_cmp_si_2exp (x, __gmpfr_emin - 2, 0) <= 0) - rnd2 = MPFR_RNDZ; - return mpfr_underflow (y, rnd2, 1); - } + /* Since the smallest representable non-zero float is 1/2 * 2^emin, + if x <= emin - 2, the result is either 1/2 * 2^emin or 0. + Warning, for emin - 2 < x < emin - 1, we cannot conclude, since 2^x + might round to 2^(emin - 1) for rounding away or to nearest, and there + might be no underflow, since we consider underflow "after rounding". */ + + MPFR_STAT_STATIC_ASSERT (MPFR_EMIN_MIN >= LONG_MIN + 2); + if (MPFR_UNLIKELY (mpfr_cmp_si (x, __gmpfr_emin - 2) <= 0)) + return mpfr_underflow (y, rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode, 1); - MPFR_ASSERTN (MPFR_EMAX_MAX <= LONG_MAX); + MPFR_STAT_STATIC_ASSERT (MPFR_EMAX_MAX <= LONG_MAX); if (MPFR_UNLIKELY (mpfr_cmp_si (x, __gmpfr_emax) >= 0)) return mpfr_overflow (y, rnd_mode, 1); - /* We now know that emin - 1 <= x < emax. */ + /* We now know that emin - 2 < x < emax. Note that an underflow or + overflow is still possible (we have eliminated only easy cases). */ MPFR_SAVE_EXPO_MARK (expo); @@ -87,14 +85,17 @@ |2^x - 1| <= x < 2^EXP(x). If x > 0 we must round away from 0 (dir=1); if x < 0 we must round toward 0 (dir=0). */ MPFR_SMALL_INPUT_AFTER_SAVE_EXPO (y, __gmpfr_one, - MPFR_GET_EXP (x), 0, - MPFR_SIGN(x) > 0, rnd_mode, expo, {}); + MPFR_IS_POS (x), rnd_mode, expo, {}); xint = mpfr_get_si (x, MPFR_RNDZ); mpfr_init2 (xfrac, MPFR_PREC (x)); - mpfr_sub_si (xfrac, x, xint, MPFR_RNDN); /* exact */ + MPFR_DBGRES (inexact = mpfr_sub_si (xfrac, x, xint, MPFR_RNDN)); + MPFR_ASSERTD (inexact == 0); if (MPFR_IS_ZERO (xfrac)) { + /* Here, emin - 1 <= x <= emax - 1, so that an underflow or overflow + will not be possible. */ mpfr_set_ui (y, 1, MPFR_RNDN); inexact = 0; } @@ -113,7 +114,7 @@ /* the optimal number of bits : see algorithms.tex */ Nt = Ny + 5 + MPFR_INT_CEIL_LOG2 (Ny); - /* initialise of intermediary variable */ + /* initialize of intermediary variable */ mpfr_init2 (t, Nt); /* First computation */ @@ -141,11 +142,27 @@ } mpfr_clear (xfrac); - mpfr_clear_flags (); - mpfr_mul_2si (y, y, xint, MPFR_RNDN); /* exact or overflow */ - /* Note: We can have an overflow only when t was rounded up to 2. */ - MPFR_ASSERTD (MPFR_IS_PURE_FP (y) || inexact > 0); - MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); + + if (MPFR_UNLIKELY (rnd_mode == MPFR_RNDN && xint == __gmpfr_emin - 1 && + MPFR_GET_EXP (y) == 0 && mpfr_powerof2_raw (y))) + { + /* y was rounded down to 1/2 and the rounded value with an unbounded + exponent range would be 2^(emin-2), i.e. the midpoint between 0 + and the smallest positive FP number. This is a double rounding + problem: we should not round to 0, but to (1/2) * 2^emin. */ + MPFR_SET_EXP (y, __gmpfr_emin); + inexact = 1; + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_UNDERFLOW); + } + else + { + MPFR_CLEAR_FLAGS (); + inex2 = mpfr_mul_2si (y, y, xint, rnd_mode); + if (inex2 != 0) /* underflow or overflow */ + inexact = inex2; + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); + } + MPFR_SAVE_EXPO_FREE (expo); return mpfr_check_range (y, inexact, rnd_mode); } diff -Nru mpfr4-3.1.4/src/exp3.c mpfr4-4.0.2/src/exp3.c --- mpfr4-3.1.4/src/exp3.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/exp3.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_exp -- exponential of a floating-point number -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H /* for MPFR_MPZ_SIZEINBASE2 */ @@ -42,7 +42,7 @@ mpfr_exp_rational (mpfr_ptr y, mpz_ptr p, long r, int m, mpz_t *Q, mpfr_prec_t *mult) { - unsigned long n, i, j; + mp_bitcnt_t n, h, i, j; /* unsigned type, which is >= unsigned long */ mpz_t *S, *ptoj; mpfr_prec_t *log2_nb_terms; mpfr_exp_t diff, expo; @@ -58,8 +58,9 @@ /* Normalize p */ MPFR_ASSERTD (mpz_cmp_ui (p, 0) != 0); n = mpz_scan1 (p, 0); /* number of trailing zeros in p */ + MPFR_ASSERTN (n <= LONG_MAX); /* This is a limitation. */ mpz_tdiv_q_2exp (p, p, n); - r -= n; /* since |p/2^r| < 1 and p >= 1, r >= 1 */ + r -= (long) n; /* since |p/2^r| < 1 and p >= 1, r >= 1 */ /* Set initial var */ mpz_set (ptoj[0], p); @@ -75,6 +76,7 @@ /* Main Loop */ n = 1UL << m; + MPFR_ASSERTN (n != 0); /* no overflow */ for (i = 1; (prec_i_have < precy) && (i < n); i++) { /* invariant: Q[0]*Q[1]*...*Q[k] equals i! */ @@ -112,14 +114,14 @@ /* accumulate all products in S[0] and Q[0]. Warning: contrary to above, here we do not have log2_nb_terms[k-1] = log2_nb_terms[k]+1. */ - l = 0; /* number of accumulated terms in the right part S[k]/Q[k] */ + h = 0; /* number of accumulated terms in the right part S[k]/Q[k] */ while (k > 0) { j = log2_nb_terms[k-1]; mpz_mul (S[k], S[k], ptoj[j]); mpz_mul (S[k-1], S[k-1], Q[k]); - l += 1 << log2_nb_terms[k]; - mpz_mul_2exp (S[k-1], S[k-1], r * l); + h += (mp_bitcnt_t) 1 << log2_nb_terms[k]; + mpz_mul_2exp (S[k-1], S[k-1], r * h); mpz_add (S[k-1], S[k-1], S[k]); mpz_mul (Q[k-1], Q[k-1], Q[k]); k--; @@ -144,7 +146,9 @@ mpz_tdiv_q (S[0], S[0], Q[0]); mpfr_set_z (y, S[0], MPFR_RNDD); - MPFR_SET_EXP (y, MPFR_GET_EXP (y) + expo - r * (i - 1) ); + /* TODO: Check/prove that the following expression doesn't overflow. */ + expo = MPFR_GET_EXP (y) + expo - r * (i - 1); + MPFR_SET_EXP (y, expo); } #define shift (GMP_NUMB_BITS/2) @@ -215,10 +219,10 @@ twopoweri = GMP_NUMB_BITS; /* Allocate tables */ - P = (mpz_t*) (*__gmp_allocate_func) (3*(k+2)*sizeof(mpz_t)); + P = (mpz_t*) mpfr_allocate_func (3*(k+2)*sizeof(mpz_t)); for (i = 0; i < 3*(k+2); i++) mpz_init (P[i]); - mult = (mpfr_prec_t*) (*__gmp_allocate_func) (2*(k+2)*sizeof(mpfr_prec_t)); + mult = (mpfr_prec_t*) mpfr_allocate_func (2*(k+2)*sizeof(mpfr_prec_t)); /* Particular case for i==0 */ mpfr_extract (uk, x_copy, 0); @@ -245,8 +249,8 @@ /* Clear tables */ for (i = 0; i < 3*(k+2); i++) mpz_clear (P[i]); - (*__gmp_free_func) (P, 3*(k+2)*sizeof(mpz_t)); - (*__gmp_free_func) (mult, 2*(k+2)*sizeof(mpfr_prec_t)); + mpfr_free_func (P, 3*(k+2)*sizeof(mpz_t)); + mpfr_free_func (mult, 2*(k+2)*sizeof(mpfr_prec_t)); if (shift_x > 0) { @@ -283,8 +287,8 @@ } } - if (mpfr_can_round (shift_x > 0 ? t : tmp, realprec, MPFR_RNDN, MPFR_RNDZ, - MPFR_PREC(y) + (rnd_mode == MPFR_RNDN))) + if (MPFR_CAN_ROUND (shift_x > 0 ? t : tmp, realprec, + MPFR_PREC(y), rnd_mode)) { inexact = mpfr_set (y, shift_x > 0 ? t : tmp, rnd_mode); if (MPFR_UNLIKELY (scaled && MPFR_IS_PURE_FP (y))) diff -Nru mpfr4-3.1.4/src/exp.c mpfr4-4.0.2/src/exp.c --- mpfr4-3.1.4/src/exp.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/exp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_exp -- exponential of a floating-point number -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,20 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" -/* #define DEBUG */ +/* Cache for emin and emax bounds. + Contrary to other caches, it uses a fixed size for the mantissa, + so there is no dynamic allocation, and no need to free them. */ +static MPFR_THREAD_ATTR mpfr_exp_t previous_emin; +static MPFR_THREAD_ATTR mp_limb_t bound_emin_limb[(32 - 1) / GMP_NUMB_BITS + 1]; +static MPFR_THREAD_ATTR mpfr_t bound_emin; +static MPFR_THREAD_ATTR mpfr_exp_t previous_emax; +static MPFR_THREAD_ATTR mp_limb_t bound_emax_limb[(32 - 1) / GMP_NUMB_BITS + 1]; +static MPFR_THREAD_ATTR mpfr_t bound_emax; int mpfr_exp (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) @@ -61,81 +69,96 @@ } /* First, let's detect most overflow and underflow cases. */ - { - mpfr_t e, bound; + /* emax bound is cached. Check if the value in cache is ok */ + if (MPFR_UNLIKELY (mpfr_get_emax() != previous_emax)) + { + /* Recompute the emax bound */ + mp_limb_t e_limb[MPFR_EXP_LIMB_SIZE]; + mpfr_t e; + + /* We extend the exponent range and save the flags. */ + MPFR_SAVE_EXPO_MARK (expo); + + MPFR_TMP_INIT1(e_limb, e, sizeof (mpfr_exp_t) * CHAR_BIT); + MPFR_TMP_INIT1(bound_emax_limb, bound_emax, 32); + + inexact = mpfr_set_exp_t (e, expo.saved_emax, MPFR_RNDN); + MPFR_ASSERTD (inexact == 0); + mpfr_mul (bound_emax, expo.saved_emax < 0 ? + __gmpfr_const_log2_RNDD : __gmpfr_const_log2_RNDU, + e, MPFR_RNDU); + previous_emax = expo.saved_emax; + MPFR_SAVE_EXPO_FREE (expo); + } + + /* mpfr_cmp works even in reduced emin,emax range */ + if (MPFR_UNLIKELY (mpfr_cmp (x, bound_emax) >= 0)) + { + /* x > log(2^emax), thus exp(x) > 2^emax */ + return mpfr_overflow (y, rnd_mode, 1); + } + + /* emin bound is cached. Check if the value in cache is ok */ + if (MPFR_UNLIKELY (mpfr_get_emin() != previous_emin)) + { + mp_limb_t e_limb[MPFR_EXP_LIMB_SIZE]; + mpfr_t e; - /* We must extended the exponent range and save the flags now. */ - MPFR_SAVE_EXPO_MARK (expo); + /* We extend the exponent range and save the flags. */ + MPFR_SAVE_EXPO_MARK (expo); - mpfr_init2 (e, sizeof (mpfr_exp_t) * CHAR_BIT); - mpfr_init2 (bound, 32); + /* avoid using a full limb since arithmetic might be slower */ + MPFR_TMP_INIT1(e_limb, e, sizeof (mpfr_exp_t) * CHAR_BIT - 1); + MPFR_TMP_INIT1(bound_emin_limb, bound_emin, 32); + + inexact = mpfr_set_exp_t (e, expo.saved_emin, MPFR_RNDN); + MPFR_ASSERTD (inexact == 0); + inexact = mpfr_sub_ui (e, e, 2, MPFR_RNDN); + MPFR_ASSERTD (inexact == 0); + mpfr_const_log2 (bound_emin, expo.saved_emin < 0 ? MPFR_RNDU : MPFR_RNDD); + mpfr_mul (bound_emin, bound_emin, e, MPFR_RNDD); + previous_emin = expo.saved_emin; + MPFR_SAVE_EXPO_FREE (expo); + } - inexact = mpfr_set_exp_t (e, expo.saved_emax, MPFR_RNDN); - MPFR_ASSERTD (inexact == 0); - mpfr_const_log2 (bound, expo.saved_emax < 0 ? MPFR_RNDD : MPFR_RNDU); - mpfr_mul (bound, bound, e, MPFR_RNDU); - if (MPFR_UNLIKELY (mpfr_cmp (x, bound) >= 0)) - { - /* x > log(2^emax), thus exp(x) > 2^emax */ - mpfr_clears (e, bound, (mpfr_ptr) 0); - MPFR_SAVE_EXPO_FREE (expo); - return mpfr_overflow (y, rnd_mode, 1); - } - - inexact = mpfr_set_exp_t (e, expo.saved_emin, MPFR_RNDN); - MPFR_ASSERTD (inexact == 0); - inexact = mpfr_sub_ui (e, e, 2, MPFR_RNDN); - MPFR_ASSERTD (inexact == 0); - mpfr_const_log2 (bound, expo.saved_emin < 0 ? MPFR_RNDU : MPFR_RNDD); - mpfr_mul (bound, bound, e, MPFR_RNDD); - if (MPFR_UNLIKELY (mpfr_cmp (x, bound) <= 0)) - { - /* x < log(2^(emin - 2)), thus exp(x) < 2^(emin - 2) */ - mpfr_clears (e, bound, (mpfr_ptr) 0); - MPFR_SAVE_EXPO_FREE (expo); - return mpfr_underflow (y, rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode, - 1); - } - - /* Other overflow/underflow cases must be detected - by the generic routines. */ - mpfr_clears (e, bound, (mpfr_ptr) 0); - MPFR_SAVE_EXPO_FREE (expo); - } + if (MPFR_UNLIKELY (mpfr_cmp (x, bound_emin) <= 0)) + { + /* x < log(2^(emin - 2)), thus exp(x) < 2^(emin - 2) */ + return mpfr_underflow (y, rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode, + 1); + } expx = MPFR_GET_EXP (x); precy = MPFR_PREC (y); - /* if x < 2^(-precy), then exp(x) i.e. gives 1 +/- 1 ulp(1) */ + /* if x < 2^(-precy), then exp(x) gives 1 +/- 1 ulp(1) */ if (MPFR_UNLIKELY (expx < 0 && (mpfr_uexp_t) (-expx) > precy)) { mpfr_exp_t emin = __gmpfr_emin; mpfr_exp_t emax = __gmpfr_emax; int signx = MPFR_SIGN (x); + /* Make sure that the exponent range is large enough: + * [0,2] is sufficient in all precisions. + */ + __gmpfr_emin = 0; + __gmpfr_emax = 2; + MPFR_SET_POS (y); if (MPFR_IS_NEG_SIGN (signx) && (rnd_mode == MPFR_RNDD || rnd_mode == MPFR_RNDZ)) { - __gmpfr_emin = 0; - __gmpfr_emax = 0; mpfr_setmax (y, 0); /* y = 1 - epsilon */ inexact = -1; } else { - __gmpfr_emin = 1; - __gmpfr_emax = 1; mpfr_setmin (y, 1); /* y = 1 */ if (MPFR_IS_POS_SIGN (signx) && (rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDA)) { - mp_size_t yn; - int sh; - - yn = MPFR_LIMB_SIZE (y); - sh = (mpfr_prec_t) yn * GMP_NUMB_BITS - MPFR_PREC(y); - MPFR_MANT(y)[0] += MPFR_LIMB_ONE << sh; + /* Warning: should work for precision 1 bit too! */ + mpfr_nextabove (y); inexact = 1; } else diff -Nru mpfr4-3.1.4/src/expm1.c mpfr4-4.0.2/src/expm1.c --- mpfr4-3.1.4/src/expm1.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/expm1.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_expm1 -- Compute exp(x)-1 -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -82,14 +82,12 @@ if (MPFR_IS_NEG (x) && ex > 5) /* x <= -32 */ { - mpfr_t minus_one, t; + mp_limb_t t_limb[(64 - 1) / GMP_NUMB_BITS + 1]; + mpfr_t t; mpfr_exp_t err; - mpfr_init2 (minus_one, 2); - mpfr_init2 (t, 64); - mpfr_set_si (minus_one, -1, MPFR_RNDN); - mpfr_const_log2 (t, MPFR_RNDU); /* round upward since x is negative */ - mpfr_div (t, x, t, MPFR_RNDU); /* > x / ln(2) */ + MPFR_TMP_INIT1(t_limb, t, 64); + mpfr_div (t, x, __gmpfr_const_log2_RNDU, MPFR_RNDU); /* > x / ln(2) */ err = mpfr_cmp_si (t, MPFR_EMIN_MIN >= -LONG_MAX ? MPFR_EMIN_MIN : -LONG_MAX) <= 0 ? - (MPFR_EMIN_MIN >= -LONG_MAX ? MPFR_EMIN_MIN : -LONG_MAX) : @@ -97,10 +95,8 @@ /* exp(x) = 2^(x/ln(2)) <= 2^max(MPFR_EMIN_MIN,-LONG_MAX,ceil(x/ln(2)+epsilon)) with epsilon > 0 */ - mpfr_clear (t); - MPFR_SMALL_INPUT_AFTER_SAVE_EXPO (y, minus_one, err, 0, 0, rnd_mode, - expo, { mpfr_clear (minus_one); }); - mpfr_clear (minus_one); + MPFR_SMALL_INPUT_AFTER_SAVE_EXPO (y, __gmpfr_mone, err, 0, 0, + rnd_mode, expo, {}); } /* General case */ diff -Nru mpfr4-3.1.4/src/extract.c mpfr4-4.0.2/src/extract.c --- mpfr4-3.1.4/src/extract.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/extract.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_extract -- bit-extraction function for the binary splitting algorithm -Copyright 2000-2002, 2004-2016 Free Software Foundation, Inc. +Copyright 2000-2002, 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -37,19 +37,21 @@ unsigned long two_i_2 = i ? two_i / 2 : 1; mp_size_t size_p = MPFR_LIMB_SIZE (p); + MPFR_ASSERTN (two_i != 0 && two_i_2 <= INT_MAX); /* overflow check */ + /* as 0 <= |p| < 1, we don't have to care with infinities, NaN, ... */ MPFR_ASSERTD (!MPFR_IS_SINGULAR (p)); - _mpz_realloc (y, two_i_2); - if ((mpfr_uexp_t) size_p < two_i) + mpz_realloc2 (y, (mp_bitcnt_t) two_i_2 * GMP_NUMB_BITS); + if (size_p < two_i) { MPN_ZERO (PTR(y), two_i_2); - if ((mpfr_uexp_t) size_p >= two_i_2) - MPN_COPY (PTR(y) + two_i - size_p, MPFR_MANT(p), size_p - two_i_2); + if (size_p >= two_i_2) + MPN_COPY (PTR(y) + (two_i - size_p), MPFR_MANT(p), size_p - two_i_2); } else MPN_COPY (PTR(y), MPFR_MANT(p) + size_p - two_i, two_i_2); MPN_NORMALIZE (PTR(y), two_i_2); - SIZ(y) = (MPFR_IS_NEG (p)) ? -two_i_2 : two_i_2; + SIZ(y) = MPFR_IS_NEG (p) ? - (int) two_i_2 : (int) two_i_2; } diff -Nru mpfr4-3.1.4/src/factorial.c mpfr4-4.0.2/src/factorial.c --- mpfr4-3.1.4/src/factorial.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/factorial.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ -/* mpfr_fac_ui -- factorial of a non-negative integer +/* mpfr_fac_ui -- factorial of a nonnegative integer -Copyright 2001, 2004-2016 Free Software Foundation, Inc. +Copyright 2001, 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -57,7 +57,7 @@ /* compute the size of intermediary variable */ Nt = Ny + 2 * MPFR_INT_CEIL_LOG2 (x) + 7; - mpfr_init2 (t, Nt); /* initialise of intermediary variable */ + mpfr_init2 (t, Nt); /* initialize of intermediary variable */ rnd = MPFR_RNDZ; MPFR_ZIV_INIT (loop, Nt); @@ -76,8 +76,7 @@ err = Nt - 1 - MPFR_INT_CEIL_LOG2 (Nt); - round = !inexact || mpfr_can_round (t, err, rnd, MPFR_RNDZ, - Ny + (rnd_mode == MPFR_RNDN)); + round = !inexact || MPFR_CAN_ROUND (t, err, Ny, rnd_mode); if (MPFR_LIKELY (round)) { diff -Nru mpfr4-3.1.4/src/fits_intmax.c mpfr4-4.0.2/src/fits_intmax.c --- mpfr4-3.1.4/src/fits_intmax.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/fits_intmax.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_fits_intmax_p -- test whether an mpfr fits an intmax_t. -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -# include "config.h" /* for a build within gmp */ +# include "config.h" #endif #include "mpfr-intmax.h" @@ -29,11 +29,11 @@ #ifdef _MPFR_H_HAVE_INTMAX_T -/* We can't use fits_s.h <= mpfr_cmp_ui */ +/* We can't use fits_s.h as it uses mpfr_cmp_si */ int mpfr_fits_intmax_p (mpfr_srcptr f, mpfr_rnd_t rnd) { - unsigned int saved_flags; + mpfr_flags_t saved_flags; mpfr_exp_t e; int prec; mpfr_t x, y; @@ -88,7 +88,9 @@ /* hard case: first round to prec bits, then check */ saved_flags = __gmpfr_flags; mpfr_init2 (x, prec); - mpfr_set (x, f, rnd); + /* for RNDF, it is necessary and sufficient to check it fits when rounding + away from zero */ + mpfr_set (x, f, (rnd == MPFR_RNDF) ? MPFR_RNDA : rnd); if (neg) { diff -Nru mpfr4-3.1.4/src/fits_s.h mpfr4-4.0.2/src/fits_s.h --- mpfr4-3.1.4/src/fits_s.h 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/fits_s.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_fits_*_p -- test whether an mpfr fits a C signed type. -Copyright 2003-2016 Free Software Foundation, Inc. +Copyright 2003-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -29,7 +29,7 @@ int FUNCTION (mpfr_srcptr f, mpfr_rnd_t rnd) { - unsigned int saved_flags; + mpfr_flags_t saved_flags; mpfr_exp_t e; int prec; mpfr_t x; @@ -84,7 +84,8 @@ /* hard case: first round to prec bits, then check */ saved_flags = __gmpfr_flags; mpfr_init2 (x, prec); - mpfr_set (x, f, rnd); + /* for RNDF, it suffices to check it fits when rounded away from zero */ + mpfr_set (x, f, (rnd == MPFR_RNDF) ? MPFR_RNDA : rnd); /* Warning! Due to the rounding, x can be an infinity. Here we use the fact that singular numbers have a special exponent field, thus well-defined and different from e, in which case this means diff -Nru mpfr4-3.1.4/src/fits_sint.c mpfr4-4.0.2/src/fits_sint.c --- mpfr4-3.1.4/src/fits_sint.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/fits_sint.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_fits_sint_p -- test whether an mpfr fits an int. -Copyright 2003, 2006-2016 Free Software Foundation, Inc. +Copyright 2003, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define FUNCTION mpfr_fits_sint_p diff -Nru mpfr4-3.1.4/src/fits_slong.c mpfr4-4.0.2/src/fits_slong.c --- mpfr4-3.1.4/src/fits_slong.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/fits_slong.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_fits_slong_p -- test whether an mpfr fits a long. -Copyright 2003, 2006-2016 Free Software Foundation, Inc. +Copyright 2003, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define FUNCTION mpfr_fits_slong_p diff -Nru mpfr4-3.1.4/src/fits_sshort.c mpfr4-4.0.2/src/fits_sshort.c --- mpfr4-3.1.4/src/fits_sshort.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/fits_sshort.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_fits_sshort_p -- test whether an mpfr fits a short. -Copyright 2003, 2006-2016 Free Software Foundation, Inc. +Copyright 2003, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define FUNCTION mpfr_fits_sshort_p diff -Nru mpfr4-3.1.4/src/fits_u.h mpfr4-4.0.2/src/fits_u.h --- mpfr4-3.1.4/src/fits_u.h 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/fits_u.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_fits_*_p -- test whether an mpfr fits a C unsigned type. -Copyright 2003-2016 Free Software Foundation, Inc. +Copyright 2003-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -25,7 +25,7 @@ int FUNCTION (mpfr_srcptr f, mpfr_rnd_t rnd) { - unsigned int saved_flags; + mpfr_flags_t saved_flags; mpfr_exp_t e; int prec; TYPE s; @@ -65,7 +65,8 @@ /* hard case: first round to prec bits, then check */ saved_flags = __gmpfr_flags; mpfr_init2 (x, prec); - mpfr_set (x, f, rnd); + /* For MPFR_RNDF, if f > 0 fits with RNDU, it will also fit with RNDD. */ + mpfr_set (x, f, (rnd != MPFR_RNDF) ? rnd : MPFR_RNDU); /* Warning! Due to the rounding, x can be an infinity. Here we use the fact that singular numbers have a special exponent field, thus well-defined and different from e, in which case this means diff -Nru mpfr4-3.1.4/src/fits_uint.c mpfr4-4.0.2/src/fits_uint.c --- mpfr4-3.1.4/src/fits_uint.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/fits_uint.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_fits_uint_p -- test whether an mpfr fits an unsigned int. -Copyright 2003, 2006-2016 Free Software Foundation, Inc. +Copyright 2003, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define FUNCTION mpfr_fits_uint_p diff -Nru mpfr4-3.1.4/src/fits_uintmax.c mpfr4-4.0.2/src/fits_uintmax.c --- mpfr4-3.1.4/src/fits_uintmax.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/fits_uintmax.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_fits_uintmax_p -- test whether an mpfr fits an uintmax_t. -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -# include "config.h" /* for a build within gmp */ +# include "config.h" #endif #include "mpfr-intmax.h" diff -Nru mpfr4-3.1.4/src/fits_ulong.c mpfr4-4.0.2/src/fits_ulong.c --- mpfr4-3.1.4/src/fits_ulong.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/fits_ulong.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_fits_ulong_p -- test whether an mpfr fits an unsigned long. -Copyright 2003, 2006-2016 Free Software Foundation, Inc. +Copyright 2003, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define FUNCTION mpfr_fits_ulong_p diff -Nru mpfr4-3.1.4/src/fits_ushort.c mpfr4-4.0.2/src/fits_ushort.c --- mpfr4-3.1.4/src/fits_ushort.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/fits_ushort.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_fits_ushort_p -- test whether an mpfr fits an unsigned short. -Copyright 2003, 2006-2016 Free Software Foundation, Inc. +Copyright 2003, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define FUNCTION mpfr_fits_ushort_p diff -Nru mpfr4-3.1.4/src/fma.c mpfr4-4.0.2/src/fma.c --- mpfr4-3.1.4/src/fma.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/fma.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_fma -- Floating multiply-add -Copyright 2001-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2001-2002, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,21 +17,93 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* The fused-multiply-add (fma) of x, y and z is defined by: fma(x,y,z)= x*y + z */ +/* this function deals with all cases where inputs are singular, i.e., + either NaN, Inf or zero */ +static int +mpfr_fma_singular (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z, + mpfr_rnd_t rnd_mode) +{ + if (MPFR_IS_NAN(x) || MPFR_IS_NAN(y) || MPFR_IS_NAN(z)) + { + MPFR_SET_NAN(s); + MPFR_RET_NAN; + } + /* now neither x, y or z is NaN */ + else if (MPFR_IS_INF(x) || MPFR_IS_INF(y)) + { + /* cases Inf*0+z, 0*Inf+z, Inf-Inf */ + if ((MPFR_IS_ZERO(y)) || + (MPFR_IS_ZERO(x)) || + (MPFR_IS_INF(z) && + ((MPFR_MULT_SIGN(MPFR_SIGN(x), MPFR_SIGN(y))) != MPFR_SIGN(z)))) + { + MPFR_SET_NAN(s); + MPFR_RET_NAN; + } + else if (MPFR_IS_INF(z)) /* case Inf-Inf already checked above */ + { + MPFR_SET_INF(s); + MPFR_SET_SAME_SIGN(s, z); + MPFR_RET(0); + } + else /* z is finite */ + { + MPFR_SET_INF(s); + MPFR_SET_SIGN(s, MPFR_MULT_SIGN(MPFR_SIGN(x) , MPFR_SIGN(y))); + MPFR_RET(0); + } + } + /* now x and y are finite */ + else if (MPFR_IS_INF(z)) + { + MPFR_SET_INF(s); + MPFR_SET_SAME_SIGN(s, z); + MPFR_RET(0); + } + else if (MPFR_IS_ZERO(x) || MPFR_IS_ZERO(y)) + { + if (MPFR_IS_ZERO(z)) + { + int sign_p; + sign_p = MPFR_MULT_SIGN( MPFR_SIGN(x) , MPFR_SIGN(y) ); + MPFR_SET_SIGN(s, (rnd_mode != MPFR_RNDD ? + (MPFR_IS_NEG_SIGN(sign_p) && MPFR_IS_NEG(z) ? + MPFR_SIGN_NEG : MPFR_SIGN_POS) : + (MPFR_IS_POS_SIGN(sign_p) && MPFR_IS_POS(z) ? + MPFR_SIGN_POS : MPFR_SIGN_NEG))); + MPFR_SET_ZERO(s); + MPFR_RET(0); + } + else + return mpfr_set (s, z, rnd_mode); + } + else /* necessarily z is zero here */ + { + MPFR_ASSERTD(MPFR_IS_ZERO(z)); + return mpfr_mul (s, x, y, rnd_mode); + } +} + +/* s <- x*y + z */ int mpfr_fma (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z, mpfr_rnd_t rnd_mode) { int inexact; mpfr_t u; + mp_size_t n; + mpfr_exp_t e; + mpfr_prec_t precx, precy; MPFR_SAVE_EXPO_DECL (expo); MPFR_GROUP_DECL(group); @@ -44,75 +116,103 @@ mpfr_get_prec (s), mpfr_log_prec, s, inexact)); /* particular cases */ - if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(x) || - MPFR_IS_SINGULAR(y) || + if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(x) || MPFR_IS_SINGULAR(y) || MPFR_IS_SINGULAR(z) )) + return mpfr_fma_singular (s, x, y, z, rnd_mode); + + e = MPFR_GET_EXP (x) + MPFR_GET_EXP (y); + + precx = MPFR_PREC (x); + precy = MPFR_PREC (y); + + /* First deal with special case where prec(x) = prec(y) and x*y does + not overflow nor underflow. Do it only for small sizes since for large + sizes x*y is faster using Mulders' algorithm (as a rule of thumb, + we assume mpn_mul_n is faster up to 4*MPFR_MUL_THRESHOLD). + Since |EXP(x)|, |EXP(y)| < 2^(k-2) on a k-bit computer, + |EXP(x)+EXP(y)| < 2^(k-1), thus cannot overflow nor underflow. */ + if (precx == precy && e <= __gmpfr_emax && e > __gmpfr_emin) { - if (MPFR_IS_NAN(x) || MPFR_IS_NAN(y) || MPFR_IS_NAN(z)) - { - MPFR_SET_NAN(s); - MPFR_RET_NAN; - } - /* now neither x, y or z is NaN */ - else if (MPFR_IS_INF(x) || MPFR_IS_INF(y)) + if (precx < GMP_NUMB_BITS && + MPFR_PREC(z) == precx && + MPFR_PREC(s) == precx) { - /* cases Inf*0+z, 0*Inf+z, Inf-Inf */ - if ((MPFR_IS_ZERO(y)) || - (MPFR_IS_ZERO(x)) || - (MPFR_IS_INF(z) && - ((MPFR_MULT_SIGN(MPFR_SIGN(x), MPFR_SIGN(y))) != MPFR_SIGN(z)))) - { - MPFR_SET_NAN(s); - MPFR_RET_NAN; - } - else if (MPFR_IS_INF(z)) /* case Inf-Inf already checked above */ + mp_limb_t umant[2], zmant[2]; + mpfr_t zz; + int inex; + + umul_ppmm (umant[1], umant[0], MPFR_MANT(x)[0], MPFR_MANT(y)[0]); + MPFR_PREC(u) = MPFR_PREC(zz) = 2 * precx; + MPFR_MANT(u) = umant; + MPFR_MANT(zz) = zmant; + MPFR_SIGN(u) = MPFR_MULT_SIGN( MPFR_SIGN(x) , MPFR_SIGN(y) ); + MPFR_SIGN(zz) = MPFR_SIGN(z); + MPFR_EXP(zz) = MPFR_EXP(z); + if (MPFR_PREC(zz) <= GMP_NUMB_BITS) /* zz fits in one limb */ { - MPFR_SET_INF(s); - MPFR_SET_SAME_SIGN(s, z); - MPFR_RET(0); + if ((umant[1] & MPFR_LIMB_HIGHBIT) == 0) + { + umant[0] = umant[1] << 1; + MPFR_EXP(u) = e - 1; + } + else + { + umant[0] = umant[1]; + MPFR_EXP(u) = e; + } + zmant[0] = MPFR_MANT(z)[0]; } - else /* z is finite */ + else { - MPFR_SET_INF(s); - MPFR_SET_SIGN(s, MPFR_MULT_SIGN(MPFR_SIGN(x) , MPFR_SIGN(y))); - MPFR_RET(0); + zmant[1] = MPFR_MANT(z)[0]; + zmant[0] = MPFR_LIMB_ZERO; + if ((umant[1] & MPFR_LIMB_HIGHBIT) == 0) + { + umant[1] = (umant[1] << 1) | + (umant[0] >> (GMP_NUMB_BITS - 1)); + umant[0] = umant[0] << 1; + MPFR_EXP(u) = e - 1; + } + else + MPFR_EXP(u) = e; } + inex = mpfr_add (u, u, zz, rnd_mode); + /* mpfr_set_1_2 requires PREC(u) = 2*PREC(s), + thus we need PREC(s) = PREC(x) = PREC(y) = PREC(z) */ + return mpfr_set_1_2 (s, u, rnd_mode, inex); } - /* now x and y are finite */ - else if (MPFR_IS_INF(z)) + else if ((n = MPFR_LIMB_SIZE(x)) <= 4 * MPFR_MUL_THRESHOLD) { - MPFR_SET_INF(s); - MPFR_SET_SAME_SIGN(s, z); - MPFR_RET(0); - } - else if (MPFR_IS_ZERO(x) || MPFR_IS_ZERO(y)) - { - if (MPFR_IS_ZERO(z)) + mpfr_limb_ptr up; + mp_size_t un = n + n; + MPFR_TMP_DECL(marker); + + MPFR_TMP_MARK(marker); + MPFR_TMP_INIT (up, u, un * GMP_NUMB_BITS, un); + up = MPFR_MANT(u); + /* multiply x*y exactly into u */ + mpn_mul_n (up, MPFR_MANT(x), MPFR_MANT(y), n); + if (MPFR_LIMB_MSB (up[un - 1]) == 0) { - int sign_p; - sign_p = MPFR_MULT_SIGN( MPFR_SIGN(x) , MPFR_SIGN(y) ); - MPFR_SET_SIGN(s,(rnd_mode != MPFR_RNDD ? - ((MPFR_IS_NEG_SIGN(sign_p) && MPFR_IS_NEG(z)) - ? -1 : 1) : - ((MPFR_IS_POS_SIGN(sign_p) && MPFR_IS_POS(z)) - ? 1 : -1))); - MPFR_SET_ZERO(s); - MPFR_RET(0); + mpn_lshift (up, up, un, 1); + MPFR_EXP(u) = e - 1; } else - return mpfr_set (s, z, rnd_mode); - } - else /* necessarily z is zero here */ - { - MPFR_ASSERTD(MPFR_IS_ZERO(z)); - return mpfr_mul (s, x, y, rnd_mode); + MPFR_EXP(u) = e; + MPFR_SIGN(u) = MPFR_MULT_SIGN( MPFR_SIGN(x) , MPFR_SIGN(y) ); + /* The above code does not generate any exception. + The exceptions will come only from mpfr_add. */ + inexact = mpfr_add (s, u, z, rnd_mode); + MPFR_TMP_FREE(marker); + return inexact; } } /* If we take prec(u) >= prec(x) + prec(y), the product u <- x*y is exact, except in case of overflow or underflow. */ + MPFR_ASSERTN (precx + precy <= MPFR_PREC_MAX); + MPFR_GROUP_INIT_1 (group, precx + precy, u); MPFR_SAVE_EXPO_MARK (expo); - MPFR_GROUP_INIT_1 (group, MPFR_PREC(x) + MPFR_PREC(y), u); if (MPFR_UNLIKELY (mpfr_mul (u, x, y, MPFR_RNDN))) { @@ -125,195 +225,73 @@ if (MPFR_IS_INF (u)) /* overflow */ { + int sign_u = MPFR_SIGN (u); + MPFR_LOG_MSG (("Overflow on x*y\n", 0)); + MPFR_GROUP_CLEAR (group); /* we no longer need u */ /* Let's eliminate the obvious case where x*y and z have the same sign. No possible cancellation -> real overflow. Also, we know that |z| < 2^emax. If E(x) + E(y) >= emax+3, - then |x*y| >= 2^(emax+1), and |x*y + z| >= 2^emax. This case + then |x*y| >= 2^(emax+1), and |x*y + z| > 2^emax. This case is also an overflow. */ - if (MPFR_SIGN (u) == MPFR_SIGN (z) || - MPFR_GET_EXP (x) + MPFR_GET_EXP (y) >= __gmpfr_emax + 3) + if (sign_u == MPFR_SIGN (z) || e >= __gmpfr_emax + 3) { - MPFR_GROUP_CLEAR (group); MPFR_SAVE_EXPO_FREE (expo); - return mpfr_overflow (s, rnd_mode, MPFR_SIGN (z)); + return mpfr_overflow (s, rnd_mode, sign_u); } - - /* E(x) + E(y) <= emax+2, therefore |x*y| < 2^(emax+2), and - (x/4)*y does not overflow (let's recall that the result - is exact with an unbounded exponent range). It does not - underflow either, because x*y overflows and the exponent - range is large enough. */ - inexact = mpfr_div_2ui (u, x, 2, MPFR_RNDN); - MPFR_ASSERTN (inexact == 0); - inexact = mpfr_mul (u, u, y, MPFR_RNDN); - MPFR_ASSERTN (inexact == 0); - - /* Now, we need to add z/4... But it may underflow! */ - { - mpfr_t zo4; - mpfr_srcptr zz; - MPFR_BLOCK_DECL (flags); - - if (MPFR_GET_EXP (u) > MPFR_GET_EXP (z) && - MPFR_GET_EXP (u) - MPFR_GET_EXP (z) > MPFR_PREC (u)) - { - /* |z| < ulp(u)/2, therefore one can use z instead of z/4. */ - zz = z; - } - else - { - mpfr_init2 (zo4, MPFR_PREC (z)); - if (mpfr_div_2ui (zo4, z, 2, MPFR_RNDZ)) - { - /* The division by 4 underflowed! */ - MPFR_ASSERTN (0); /* TODO... */ - } - zz = zo4; - } - - /* Let's recall that u = x*y/4 and zz = z/4 (or z if the - following addition would give the same result). */ - MPFR_BLOCK (flags, inexact = mpfr_add (s, u, zz, rnd_mode)); - /* u and zz have different signs, so that an overflow - is not possible. But an underflow is theoretically - possible! */ - if (MPFR_UNDERFLOW (flags)) - { - MPFR_ASSERTN (zz != z); - MPFR_ASSERTN (0); /* TODO... */ - mpfr_clears (zo4, u, (mpfr_ptr) 0); - } - else - { - int inex2; - - if (zz != z) - mpfr_clear (zo4); - MPFR_GROUP_CLEAR (group); - MPFR_ASSERTN (! MPFR_OVERFLOW (flags)); - inex2 = mpfr_mul_2ui (s, s, 2, rnd_mode); - if (inex2) /* overflow */ - { - inexact = inex2; - MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); - } - goto end; - } - } } - else /* underflow: one has |xy| < 2^(emin-1). */ + else /* underflow: one has |x*y| < 2^(emin-1). */ { - unsigned long scale = 0; - mpfr_t scaled_z; - mpfr_srcptr new_z; - mpfr_exp_t diffexp; - mpfr_prec_t pzs; - int xy_underflows; - MPFR_LOG_MSG (("Underflow on x*y\n", 0)); - /* Let's scale z so that ulp(z) > 2^emin and ulp(s) > 2^emin - (the + 1 on MPFR_PREC (s) is necessary because the exponent - of the result can be EXP(z) - 1). */ - diffexp = MPFR_GET_EXP (z) - __gmpfr_emin; - pzs = MAX (MPFR_PREC (z), MPFR_PREC (s) + 1); - MPFR_LOG_MSG (("diffexp=%" MPFR_EXP_FSPEC "d pzs=%Pd\n", - diffexp, pzs)); - if (diffexp <= pzs) + /* Easy cases: when 2^(emin-1) <= 1/2 * min(ulp(z),ulp(s)), + one can replace x*y by sign(x*y) * 2^(emin-1). Note that + this is even true in case of equality for MPFR_RNDN thanks + to the even-rounding rule. + The + 1 on MPFR_PREC (s) is necessary because the exponent + of the result can be EXP(z) - 1. */ + if (MPFR_GET_EXP (z) - __gmpfr_emin >= + MAX (MPFR_PREC (z), MPFR_PREC (s) + 1)) { - mpfr_uexp_t uscale; - mpfr_t scaled_v; - MPFR_BLOCK_DECL (flags); - - uscale = (mpfr_uexp_t) pzs - diffexp + 1; - MPFR_ASSERTN (uscale > 0); - MPFR_ASSERTN (uscale <= ULONG_MAX); - scale = uscale; - mpfr_init2 (scaled_z, MPFR_PREC (z)); - inexact = mpfr_mul_2ui (scaled_z, z, scale, MPFR_RNDN); - MPFR_ASSERTN (inexact == 0); /* TODO: overflow case */ - new_z = scaled_z; - /* Now we need to recompute u = xy * 2^scale. */ - MPFR_BLOCK (flags, - if (MPFR_GET_EXP (x) < MPFR_GET_EXP (y)) - { - mpfr_init2 (scaled_v, MPFR_PREC (x)); - mpfr_mul_2ui (scaled_v, x, scale, MPFR_RNDN); - mpfr_mul (u, scaled_v, y, MPFR_RNDN); - } - else - { - mpfr_init2 (scaled_v, MPFR_PREC (y)); - mpfr_mul_2ui (scaled_v, y, scale, MPFR_RNDN); - mpfr_mul (u, x, scaled_v, MPFR_RNDN); - }); - mpfr_clear (scaled_v); - MPFR_ASSERTN (! MPFR_OVERFLOW (flags)); - xy_underflows = MPFR_UNDERFLOW (flags); - } - else - { - new_z = z; - xy_underflows = 1; - } - - MPFR_LOG_MSG (("scale=%lu xy_underflows=%d\n", - scale, xy_underflows)); - - if (xy_underflows) - { - /* Let's replace xy by sign(xy) * 2^(emin-1). */ MPFR_PREC (u) = MPFR_PREC_MIN; mpfr_setmin (u, __gmpfr_emin); MPFR_SET_SIGN (u, MPFR_MULT_SIGN (MPFR_SIGN (x), MPFR_SIGN (y))); + mpfr_clear_flags (); + goto add; } - { - MPFR_BLOCK_DECL (flags); - - MPFR_BLOCK (flags, inexact = mpfr_add (s, u, new_z, rnd_mode)); - MPFR_LOG_MSG (("inexact=%d\n", inexact)); - MPFR_GROUP_CLEAR (group); - if (scale != 0) - { - int inex2; - - mpfr_clear (scaled_z); - /* Here an overflow is theoretically possible, in which case - the result may be wrong, hence the assert. An underflow - is not possible, but let's check that anyway. */ - MPFR_ASSERTN (! MPFR_OVERFLOW (flags)); /* TODO... */ - MPFR_ASSERTN (! MPFR_UNDERFLOW (flags)); /* not possible */ - if (rnd_mode == MPFR_RNDN && - MPFR_GET_EXP (s) == __gmpfr_emin - 1 + scale && - mpfr_powerof2_raw (s)) - { - MPFR_LOG_MSG (("Double rounding\n", 0)); - rnd_mode = (MPFR_IS_NEG (s) ? inexact <= 0 : inexact >= 0) - ? MPFR_RNDZ : MPFR_RNDA; - } - inex2 = mpfr_div_2ui (s, s, scale, rnd_mode); - MPFR_LOG_MSG (("inex2=%d\n", inex2)); - if (inex2) /* underflow */ - inexact = inex2; - } - } - - /* FIXME/TODO: I'm not sure that the following is correct. - Check for possible spurious exceptions due to intermediate - computations. */ - MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); - goto end; + MPFR_GROUP_CLEAR (group); /* we no longer need u */ } + + /* Let's use UBF to resolve the overflow/underflow issues. */ + { + mpfr_ubf_t uu; + mp_size_t un; + mpfr_limb_ptr up; + MPFR_TMP_DECL(marker); + + MPFR_LOG_MSG (("Use UBF\n", 0)); + + MPFR_TMP_MARK (marker); + un = MPFR_LIMB_SIZE (x) + MPFR_LIMB_SIZE (y); + MPFR_TMP_INIT (up, uu, (mpfr_prec_t) un * GMP_NUMB_BITS, un); + mpfr_ubf_mul_exact (uu, x, y); + mpfr_clear_flags (); + inexact = mpfr_add (s, (mpfr_srcptr) uu, z, rnd_mode); + MPFR_UBF_CLEAR_EXP (uu); + MPFR_TMP_FREE (marker); + } + } + else + { + add: + inexact = mpfr_add (s, u, z, rnd_mode); + MPFR_GROUP_CLEAR (group); } - inexact = mpfr_add (s, u, z, rnd_mode); - MPFR_GROUP_CLEAR (group); MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); - end: MPFR_SAVE_EXPO_FREE (expo); return mpfr_check_range (s, inexact, rnd_mode); } diff -Nru mpfr4-3.1.4/src/fmma.c mpfr4-4.0.2/src/fmma.c --- mpfr4-3.1.4/src/fmma.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/fmma.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,91 @@ +/* mpfr_fmma, mpfr_fmms -- Compute a*b +/- c*d + +Copyright 2014-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-impl.h" + +static int +mpfr_fmma_aux (mpfr_ptr z, mpfr_srcptr a, mpfr_srcptr b, mpfr_srcptr c, + mpfr_srcptr d, mpfr_rnd_t rnd, int neg) +{ + mpfr_ubf_t u, v; + mpfr_t zz; + mpfr_prec_t prec_z = MPFR_PREC(z); + mp_size_t un, vn; + mpfr_limb_ptr up, vp, zp; + int inex; + MPFR_TMP_DECL(marker); + + MPFR_LOG_FUNC + (("a[%Pu]=%.*Rg b[%Pu]=%.*Rg c[%Pu]=%.*Rg d[%Pu]=%.*Rg rnd=%d neg=%d", + mpfr_get_prec (a), mpfr_log_prec, a, + mpfr_get_prec (b), mpfr_log_prec, b, + mpfr_get_prec (c), mpfr_log_prec, c, + mpfr_get_prec (d), mpfr_log_prec, d, rnd, neg), + ("z[%Pu]=%.*Rg inex=%d", + mpfr_get_prec (z), mpfr_log_prec, z, inex)); + + MPFR_TMP_MARK (marker); + + un = MPFR_LIMB_SIZE (a) + MPFR_LIMB_SIZE (b); + vn = MPFR_LIMB_SIZE (c) + MPFR_LIMB_SIZE (d); + MPFR_TMP_INIT (up, u, (mpfr_prec_t) un * GMP_NUMB_BITS, un); + MPFR_TMP_INIT (vp, v, (mpfr_prec_t) vn * GMP_NUMB_BITS, vn); + + mpfr_ubf_mul_exact (u, a, b); + mpfr_ubf_mul_exact (v, c, d); + if (neg) + MPFR_CHANGE_SIGN (v); + if (prec_z == MPFR_PREC(a) && prec_z == MPFR_PREC(b) && + prec_z == MPFR_PREC(c) && prec_z == MPFR_PREC(d) && + un == MPFR_PREC2LIMBS(2 * prec_z)) + { + MPFR_TMP_INIT (zp, zz, 2 * prec_z, un); + MPFR_PREC(u) = MPFR_PREC(v) = 2 * prec_z; + inex = mpfr_add (zz, (mpfr_srcptr) u, (mpfr_srcptr) v, rnd); + inex = mpfr_set_1_2 (z, zz, rnd, inex); + } + else + inex = mpfr_add (z, (mpfr_srcptr) u, (mpfr_srcptr) v, rnd); + + MPFR_UBF_CLEAR_EXP (u); + MPFR_UBF_CLEAR_EXP (v); + + MPFR_TMP_FREE (marker); + + return inex; +} + +/* z <- a*b + c*d */ +int +mpfr_fmma (mpfr_ptr z, mpfr_srcptr a, mpfr_srcptr b, mpfr_srcptr c, + mpfr_srcptr d, mpfr_rnd_t rnd) +{ + return mpfr_fmma_aux (z, a, b, c, d, rnd, 0); +} + +/* z <- a*b - c*d */ +int +mpfr_fmms (mpfr_ptr z, mpfr_srcptr a, mpfr_srcptr b, mpfr_srcptr c, + mpfr_srcptr d, mpfr_rnd_t rnd) +{ + return mpfr_fmma_aux (z, a, b, c, d, rnd, 1); +} diff -Nru mpfr4-3.1.4/src/fms.c mpfr4-4.0.2/src/fms.c --- mpfr4-3.1.4/src/fms.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/fms.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_fms -- Floating multiply-subtract -Copyright 2001-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2001-2002, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,288 +17,22 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" /* The fused-multiply-subtract (fms) of x, y and z is defined by: fms(x,y,z)= x*y - z - Note: this is neither in IEEE754R, nor in LIA-2, but both the + Note: this is neither in IEEE 754-2008, nor in LIA-2, but both the PowerPC and the Itanium define fms as x*y - z. */ - int mpfr_fms (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z, mpfr_rnd_t rnd_mode) { - int inexact; - mpfr_t u; - MPFR_SAVE_EXPO_DECL (expo); - MPFR_GROUP_DECL(group); - - MPFR_LOG_FUNC - (("x[%Pu]=%.*Rg y[%Pu]=%.*Rg z[%Pu]=%.*Rg rnd=%d", - mpfr_get_prec (x), mpfr_log_prec, x, - mpfr_get_prec (y), mpfr_log_prec, y, - mpfr_get_prec (z), mpfr_log_prec, z, rnd_mode), - ("s[%Pu]=%.*Rg inexact=%d", - mpfr_get_prec (s), mpfr_log_prec, s, inexact)); - - /* particular cases */ - if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(x) || - MPFR_IS_SINGULAR(y) || - MPFR_IS_SINGULAR(z) )) - { - if (MPFR_IS_NAN(x) || MPFR_IS_NAN(y) || MPFR_IS_NAN(z)) - { - MPFR_SET_NAN(s); - MPFR_RET_NAN; - } - /* now neither x, y or z is NaN */ - else if (MPFR_IS_INF(x) || MPFR_IS_INF(y)) - { - /* cases Inf*0-z, 0*Inf-z, Inf-Inf */ - if ((MPFR_IS_ZERO(y)) || - (MPFR_IS_ZERO(x)) || - (MPFR_IS_INF(z) && - ((MPFR_MULT_SIGN(MPFR_SIGN(x), MPFR_SIGN(y))) == MPFR_SIGN(z)))) - { - MPFR_SET_NAN(s); - MPFR_RET_NAN; - } - else if (MPFR_IS_INF(z)) /* case Inf-Inf already checked above */ - { - MPFR_SET_INF(s); - MPFR_SET_OPPOSITE_SIGN(s, z); - MPFR_RET(0); - } - else /* z is finite */ - { - MPFR_SET_INF(s); - MPFR_SET_SIGN(s, MPFR_MULT_SIGN(MPFR_SIGN(x) , MPFR_SIGN(y))); - MPFR_RET(0); - } - } - /* now x and y are finite */ - else if (MPFR_IS_INF(z)) - { - MPFR_SET_INF(s); - MPFR_SET_OPPOSITE_SIGN(s, z); - MPFR_RET(0); - } - else if (MPFR_IS_ZERO(x) || MPFR_IS_ZERO(y)) - { - if (MPFR_IS_ZERO(z)) - { - int sign_p; - sign_p = MPFR_MULT_SIGN( MPFR_SIGN(x) , MPFR_SIGN(y) ); - MPFR_SET_SIGN(s,(rnd_mode != MPFR_RNDD ? - ((MPFR_IS_NEG_SIGN(sign_p) && MPFR_IS_POS(z)) - ? -1 : 1) : - ((MPFR_IS_POS_SIGN(sign_p) && MPFR_IS_NEG(z)) - ? 1 : -1))); - MPFR_SET_ZERO(s); - MPFR_RET(0); - } - else - return mpfr_neg (s, z, rnd_mode); - } - else /* necessarily z is zero here */ - { - MPFR_ASSERTD(MPFR_IS_ZERO(z)); - return mpfr_mul (s, x, y, rnd_mode); - } - } - - /* If we take prec(u) >= prec(x) + prec(y), the product u <- x*y - is exact, except in case of overflow or underflow. */ - MPFR_SAVE_EXPO_MARK (expo); - MPFR_GROUP_INIT_1 (group, MPFR_PREC(x) + MPFR_PREC(y), u); - - if (MPFR_UNLIKELY (mpfr_mul (u, x, y, MPFR_RNDN))) - { - /* overflow or underflow - this case is regarded as rare, thus - does not need to be very efficient (even if some tests below - could have been done earlier). - It is an overflow iff u is an infinity (since MPFR_RNDN was used). - Alternatively, we could test the overflow flag, but in this case, - mpfr_clear_flags would have been necessary. */ - if (MPFR_IS_INF (u)) /* overflow */ - { - /* Let's eliminate the obvious case where x*y and z have the - same sign. No possible cancellation -> real overflow. - Also, we know that |z| < 2^emax. If E(x) + E(y) >= emax+3, - then |x*y| >= 2^(emax+1), and |x*y - z| >= 2^emax. This case - is also an overflow. */ - if (MPFR_SIGN (u) != MPFR_SIGN (z) || - MPFR_GET_EXP (x) + MPFR_GET_EXP (y) >= __gmpfr_emax + 3) - { - MPFR_GROUP_CLEAR (group); - MPFR_SAVE_EXPO_FREE (expo); - return mpfr_overflow (s, rnd_mode, - MPFR_SIGN (z)); - } - - /* E(x) + E(y) <= emax+2, therefore |x*y| < 2^(emax+2), and - (x/4)*y does not overflow (let's recall that the result - is exact with an unbounded exponent range). It does not - underflow either, because x*y overflows and the exponent - range is large enough. */ - inexact = mpfr_div_2ui (u, x, 2, MPFR_RNDN); - MPFR_ASSERTN (inexact == 0); - inexact = mpfr_mul (u, u, y, MPFR_RNDN); - MPFR_ASSERTN (inexact == 0); - - /* Now, we need to subtract z/4... But it may underflow! */ - { - mpfr_t zo4; - mpfr_srcptr zz; - MPFR_BLOCK_DECL (flags); - - if (MPFR_GET_EXP (u) > MPFR_GET_EXP (z) && - MPFR_GET_EXP (u) - MPFR_GET_EXP (z) > MPFR_PREC (u)) - { - /* |z| < ulp(u)/2, therefore one can use z instead of z/4. */ - zz = z; - } - else - { - mpfr_init2 (zo4, MPFR_PREC (z)); - if (mpfr_div_2ui (zo4, z, 2, MPFR_RNDZ)) - { - /* The division by 4 underflowed! */ - MPFR_ASSERTN (0); /* TODO... */ - } - zz = zo4; - } - - /* Let's recall that u = x*y/4 and zz = z/4 (or z if the - following subtraction would give the same result). */ - MPFR_BLOCK (flags, inexact = mpfr_sub (s, u, zz, rnd_mode)); - /* u and zz have the same sign, so that an overflow - is not possible. But an underflow is theoretically - possible! */ - if (MPFR_UNDERFLOW (flags)) - { - MPFR_ASSERTN (zz != z); - MPFR_ASSERTN (0); /* TODO... */ - mpfr_clears (zo4, u, (mpfr_ptr) 0); - } - else - { - int inex2; - - if (zz != z) - mpfr_clear (zo4); - MPFR_GROUP_CLEAR (group); - MPFR_ASSERTN (! MPFR_OVERFLOW (flags)); - inex2 = mpfr_mul_2ui (s, s, 2, rnd_mode); - if (inex2) /* overflow */ - { - inexact = inex2; - MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); - } - goto end; - } - } - } - else /* underflow: one has |xy| < 2^(emin-1). */ - { - unsigned long scale = 0; - mpfr_t scaled_z; - mpfr_srcptr new_z; - mpfr_exp_t diffexp; - mpfr_prec_t pzs; - int xy_underflows; - - /* Let's scale z so that ulp(z) > 2^emin and ulp(s) > 2^emin - (the + 1 on MPFR_PREC (s) is necessary because the exponent - of the result can be EXP(z) - 1). */ - diffexp = MPFR_GET_EXP (z) - __gmpfr_emin; - pzs = MAX (MPFR_PREC (z), MPFR_PREC (s) + 1); - if (diffexp <= pzs) - { - mpfr_uexp_t uscale; - mpfr_t scaled_v; - MPFR_BLOCK_DECL (flags); - - uscale = (mpfr_uexp_t) pzs - diffexp + 1; - MPFR_ASSERTN (uscale > 0); - MPFR_ASSERTN (uscale <= ULONG_MAX); - scale = uscale; - mpfr_init2 (scaled_z, MPFR_PREC (z)); - inexact = mpfr_mul_2ui (scaled_z, z, scale, MPFR_RNDN); - MPFR_ASSERTN (inexact == 0); /* TODO: overflow case */ - new_z = scaled_z; - /* Now we need to recompute u = xy * 2^scale. */ - MPFR_BLOCK (flags, - if (MPFR_GET_EXP (x) < MPFR_GET_EXP (y)) - { - mpfr_init2 (scaled_v, MPFR_PREC (x)); - mpfr_mul_2ui (scaled_v, x, scale, MPFR_RNDN); - mpfr_mul (u, scaled_v, y, MPFR_RNDN); - } - else - { - mpfr_init2 (scaled_v, MPFR_PREC (y)); - mpfr_mul_2ui (scaled_v, y, scale, MPFR_RNDN); - mpfr_mul (u, x, scaled_v, MPFR_RNDN); - }); - mpfr_clear (scaled_v); - MPFR_ASSERTN (! MPFR_OVERFLOW (flags)); - xy_underflows = MPFR_UNDERFLOW (flags); - } - else - { - new_z = z; - xy_underflows = 1; - } - - if (xy_underflows) - { - /* Let's replace xy by sign(xy) * 2^(emin-1). */ - MPFR_PREC (u) = MPFR_PREC_MIN; - mpfr_setmin (u, __gmpfr_emin); - MPFR_SET_SIGN (u, MPFR_MULT_SIGN (MPFR_SIGN (x), - MPFR_SIGN (y))); - } - - { - MPFR_BLOCK_DECL (flags); - - MPFR_BLOCK (flags, inexact = mpfr_sub (s, u, new_z, rnd_mode)); - MPFR_GROUP_CLEAR (group); - if (scale != 0) - { - int inex2; - - mpfr_clear (scaled_z); - /* Here an overflow is theoretically possible, in which case - the result may be wrong, hence the assert. An underflow - is not possible, but let's check that anyway. */ - MPFR_ASSERTN (! MPFR_OVERFLOW (flags)); /* TODO... */ - MPFR_ASSERTN (! MPFR_UNDERFLOW (flags)); /* not possible */ - inex2 = mpfr_div_2ui (s, s, scale, MPFR_RNDN); - /* FIXME: this seems incorrect. MPFR_RNDN -> rnd_mode? - Also, handle the double rounding case: - s / 2^scale = 2^(emin - 2) in MPFR_RNDN. */ - if (inex2) /* underflow */ - inexact = inex2; - } - } - - /* FIXME/TODO: I'm not sure that the following is correct. - Check for possible spurious exceptions due to intermediate - computations. */ - MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); - goto end; - } - } + mpfr_t minus_z; - inexact = mpfr_sub (s, u, z, rnd_mode); - MPFR_GROUP_CLEAR (group); - MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); - end: - MPFR_SAVE_EXPO_FREE (expo); - return mpfr_check_range (s, inexact, rnd_mode); + MPFR_ALIAS (minus_z, z, -MPFR_SIGN(z), MPFR_EXP(z)); + return mpfr_fma (s, x, y, minus_z, rnd_mode); } diff -Nru mpfr4-3.1.4/src/fpif.c mpfr4-4.0.2/src/fpif.c --- mpfr4-3.1.4/src/fpif.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/fpif.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,651 @@ +/* mpfr_fpif -- Binary export & import of MPFR numbers + (floating-point interchange format) + +Copyright 2012-2019 Free Software Foundation, Inc. +Contributed by Olivier Demengeon. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-impl.h" + +#if !defined (HAVE_BIG_ENDIAN) && !defined (HAVE_LITTLE_ENDIAN) +#error "Endianness is unknown. Not supported yet." +#endif + +/* The format is described as follows. Any multi-byte number is encoded + in little endian. + + 1. We first store the precision p (this format is able to represent + any precision from 1 to 2^64 + 248). + Let B be the first byte (0 <= B <= 255). + * If B >= 8, the precision p is B-7. + Here, the condition is equivalent to 1 <= p <= 248. + * If B <= 7, the next B+1 bytes contain p-249. + Here, the condition is equivalent to 249 <= p <= 2^64 + 248. + We will use the following macros: + * MPFR_MAX_PRECSIZE = 7 + * MPFR_MAX_EMBEDDED_PRECISION = 255 - 7 = 248 + + 2. Then we store the sign bit and exponent related information + (possibly a special value). We first have byte A = [seeeeeee], + where s is the sign bit and E = [eeeeeee] such that: + * If 0 <= E <= 94, then the exponent e is E-47 (-47 <= e <= 47). + * If 95 <= E <= 110, the exponent is stored in the next E-94 bytes + (1 to 16 bytes) in sign + absolute value representation. + * If 111 <= E <= 118, the exponent size S is stored in the next + E-110 bytes (1 to 8), then the exponent itself is stored in the + next S bytes. [Not implemented yet] + * If 119 <= E <= 127, we have a special value: + E = 119 (MPFR_KIND_ZERO) for a signed zero; + E = 120 (MPFR_KIND_INF) for a signed infinity; + E = 121 (MPFR_KIND_NAN) for NaN. + + 3. Then we store the significand (for regular values). + + The sign bit is preserved by the import/export functions, even for NaN. + + Note: When a size is stored, it must be minimal, i.e. a number cannot + start with a null byte. Otherwise the import may fail. +*/ + +#define MPFR_MAX_PRECSIZE 7 +#define MPFR_MAX_EMBEDDED_PRECISION (255 - MPFR_MAX_PRECSIZE) + +#define MPFR_KIND_ZERO 119 +#define MPFR_KIND_INF 120 +#define MPFR_KIND_NAN 121 +#define MPFR_MAX_EMBEDDED_EXPONENT 47 +#define MPFR_EXTERNAL_EXPONENT 94 + +/* Begin: Low level helper functions */ + +/* storage must have an unsigned type */ +#define COUNT_NB_BYTE(storage, size) \ + do \ + { \ + (storage) >>= 8; \ + (size)++; \ + } \ + while ((storage) != 0) + +#define ALLOC_RESULT(buffer, buffer_size, wanted_size) \ + do \ + { \ + if ((buffer) == NULL || *(buffer_size) < (wanted_size)) \ + { \ + (buffer) = (unsigned char *) mpfr_reallocate_func \ + ((buffer), *(buffer_size), (wanted_size)); \ + if ((buffer) == NULL) \ + { \ + *(buffer_size) = 0; \ + return NULL; \ + } \ + } \ + *(buffer_size) = (wanted_size); \ + } \ + while (0) + +/* + * size in byte of a MPFR number in a binary object of a variable size + */ +#define MAX_VARIABLE_STORAGE(exponent_size, precision) \ + ((size_t)(((precision) >> 3) + (exponent_size) + \ + ((precision) > 248 ? sizeof(mpfr_prec_t) : 0) + 3)) + +/* copy in result[] the values in data[] with a different endianness, + where data_size might be smaller than data_max_size, so that we only + copy data_size bytes from the end of data[]. */ +static void +#if defined (HAVE_BIG_ENDIAN) +putLittleEndianData (unsigned char *result, unsigned char *data, + size_t data_max_size, size_t data_size) +#elif defined (HAVE_LITTLE_ENDIAN) +putBigEndianData (unsigned char *result, unsigned char *data, + size_t data_max_size, size_t data_size) +#endif +{ + size_t j; + + MPFR_ASSERTD (data_size <= data_max_size); + for (j = 0; j < data_size; j++) + result[j] = data[data_max_size - j - 1]; +} + +/* copy in result[] the values in data[] with the same endianness */ +static void +#if defined (HAVE_BIG_ENDIAN) +putBigEndianData (unsigned char *result, unsigned char *data, + size_t data_max_size, size_t data_size) +#elif defined (HAVE_LITTLE_ENDIAN) +putLittleEndianData (unsigned char *result, unsigned char *data, + size_t data_max_size, size_t data_size) +#endif +{ + MPFR_ASSERTD (data_size <= data_max_size); + memcpy (result, data, data_size); +} + +/* copy in result[] the values in data[] with a different endianness; + the data are written at the end of the result[] buffer (if + data_size < data_max_size, the first bytes of result[] are + left untouched). */ +static void +#if defined (HAVE_BIG_ENDIAN) +getLittleEndianData (unsigned char *result, unsigned char *data, + size_t data_max_size, size_t data_size) +#elif defined (HAVE_LITTLE_ENDIAN) +getBigEndianData (unsigned char *result, unsigned char *data, + size_t data_max_size, size_t data_size) +#endif +{ + size_t j; + + MPFR_ASSERTD (data_size <= data_max_size); + for (j = 0; j < data_size; j++) + result[data_max_size - j - 1] = data[j]; +} + +/* copy in result[] the values in data[] with the same endianness */ +static void +#if defined (HAVE_BIG_ENDIAN) +getBigEndianData (unsigned char *result, unsigned char *data, + size_t data_max_size, size_t data_size) +#elif defined (HAVE_LITTLE_ENDIAN) +getLittleEndianData (unsigned char *result, unsigned char *data, + size_t data_max_size, size_t data_size) +#endif +{ + MPFR_ASSERTD (data_size <= data_max_size); + memcpy (result, data, data_size); +} + +/* End: Low level helper functions */ + +/* Internal Function */ +/* + * buffer : OUT : store the precision in binary format, can be null + * (may be reallocated if too small) + * buffer_size : IN/OUT : size of the buffer => size used in the buffer + * precision : IN : precision to store + * return pointer to a buffer storing the precision in binary format + */ +static unsigned char * +mpfr_fpif_store_precision (unsigned char *buffer, size_t *buffer_size, + mpfr_prec_t precision) +{ + unsigned char *result; + size_t size_precision; + + MPFR_ASSERTD (precision >= 1); + size_precision = 0; + + if (precision > MPFR_MAX_EMBEDDED_PRECISION) + { + mpfr_uprec_t copy_precision; + + copy_precision = precision - (MPFR_MAX_EMBEDDED_PRECISION + 1); + COUNT_NB_BYTE(copy_precision, size_precision); + } + + result = buffer; + ALLOC_RESULT(result, buffer_size, size_precision + 1); + + if (precision > MPFR_MAX_EMBEDDED_PRECISION) + { + result[0] = size_precision - 1; + precision -= (MPFR_MAX_EMBEDDED_PRECISION + 1); + putLittleEndianData (result + 1, (unsigned char *) &precision, + sizeof(mpfr_prec_t), size_precision); + } + else + result[0] = precision + MPFR_MAX_PRECSIZE; + + return result; +} + +#define BUFFER_SIZE 8 + +/* + * fh : IN : file handler + * return the precision stored in the binary buffer, 0 in case of error + */ +static mpfr_prec_t +mpfr_fpif_read_precision_from_file (FILE *fh) +{ + mpfr_prec_t precision; + size_t precision_size; + unsigned char buffer[BUFFER_SIZE]; + + if (fh == NULL) + return 0; + + if (fread (buffer, 1, 1, fh) != 1) + return 0; + + precision_size = buffer[0]; + if (precision_size > MPFR_MAX_PRECSIZE) + return precision_size - MPFR_MAX_PRECSIZE; + + precision_size++; + MPFR_ASSERTD (precision_size <= BUFFER_SIZE); + + /* Read the precision in little-endian format. */ + if (fread (buffer, precision_size, 1, fh) != 1) + return 0; + + while (precision_size > sizeof(mpfr_prec_t)) + { + if (buffer[precision_size-1] != 0) + return 0; /* the read precision doesn't fit in a mpfr_prec_t */ + precision_size--; + } + + if (precision_size == sizeof(mpfr_prec_t) && + buffer[precision_size-1] >= 0x80) + return 0; /* the read precision doesn't fit in a mpfr_prec_t */ + + precision = 0; /* to pad with 0's if data_size < data_max_size */ + + /* On big-endian machines, the data must be copied at the end of the + precision object in the memory; thus data_max_size (3rd argument) + must be sizeof(mpfr_prec_t). */ + getLittleEndianData ((unsigned char *) &precision, buffer, + sizeof(mpfr_prec_t), precision_size); + + return precision + (MPFR_MAX_EMBEDDED_PRECISION + 1); +} + +/* + * buffer : OUT : store the kind of the MPFR number x, its sign, the size of + * its exponent and its exponent value in a binary format, + * can be null (may be reallocated if too small) + * buffer_size : IN/OUT : size of the buffer => size used in the buffer + * x : IN : MPFR number + * return pointer to a buffer storing the kind of the MPFR number x, its sign, + * the size of its exponent and its exponent value in a binary format, + */ +/* TODO + * Exponents that use more than 16 bytes are not managed (not an issue + * until one has integer types larger than 128 bits). + */ +static unsigned char* +mpfr_fpif_store_exponent (unsigned char *buffer, size_t *buffer_size, mpfr_t x) +{ + unsigned char *result; + mpfr_uexp_t uexp; + size_t exponent_size; + + exponent_size = 0; + + if (MPFR_IS_PURE_FP (x)) + { + mpfr_exp_t exponent = MPFR_GET_EXP (x); + + if (exponent > MPFR_MAX_EMBEDDED_EXPONENT || + exponent < -MPFR_MAX_EMBEDDED_EXPONENT) + { + mpfr_uexp_t copy_exponent, exp_sign_bit; + + uexp = SAFE_ABS (mpfr_uexp_t, exponent) + - MPFR_MAX_EMBEDDED_EXPONENT; + + /* Shift uexp to take the sign bit of the exponent into account. + Because of constraints on the valid exponents, this cannot + overflow (check with an MPFR_ASSERTD). */ + copy_exponent = uexp << 1; + MPFR_ASSERTD (copy_exponent > uexp); + COUNT_NB_BYTE(copy_exponent, exponent_size); + MPFR_ASSERTN (exponent_size <= 16); /* see TODO */ + + /* Sign bit of the exponent. */ + exp_sign_bit = (mpfr_uexp_t) 1 << (8 * exponent_size - 1); + MPFR_ASSERTD (uexp < exp_sign_bit); + if (exponent < 0) + uexp |= exp_sign_bit; + } + else + uexp = exponent + MPFR_MAX_EMBEDDED_EXPONENT; + } + + result = buffer; + ALLOC_RESULT(result, buffer_size, exponent_size + 1); + + if (MPFR_IS_PURE_FP (x)) + { + if (exponent_size == 0) + result[0] = uexp; + else + { + result[0] = MPFR_EXTERNAL_EXPONENT + exponent_size; + + putLittleEndianData (result + 1, (unsigned char *) &uexp, + sizeof(mpfr_exp_t), exponent_size); + } + } + else if (MPFR_IS_ZERO (x)) + result[0] = MPFR_KIND_ZERO; + else if (MPFR_IS_INF (x)) + result[0] = MPFR_KIND_INF; + else + { + MPFR_ASSERTD (MPFR_IS_NAN (x)); + result[0] = MPFR_KIND_NAN; + } + + /* Set the sign, even for NaN. */ + if (MPFR_IS_NEG (x)) + result[0] |= 0x80; + + return result; +} + +/* + * x : OUT : MPFR number extracted from the binary buffer + * fh : IN : file handler + * return 0 if successful + */ +/* TODO + * Exponents that use more than 16 bytes are not managed (this is not + * an issue if the data were written by MPFR with mpfr_exp_t not larger + * than 128 bits). + */ +static int +mpfr_fpif_read_exponent_from_file (mpfr_t x, FILE * fh) +{ + mpfr_exp_t exponent; + mpfr_uexp_t uexp; + size_t exponent_size; + int sign; + unsigned char buffer[sizeof(mpfr_exp_t)]; + + if (fh == NULL) + return 1; + + if (fread (buffer, 1, 1, fh) != 1) + return 1; + + /* sign value that can be used with MPFR_SET_SIGN, + mpfr_set_zero and mpfr_set_inf */ + sign = (buffer[0] & 0x80) ? MPFR_SIGN_NEG : MPFR_SIGN_POS; + /* Set the sign, even for NaN. */ + MPFR_SET_SIGN (x, sign); + + exponent = buffer[0] & 0x7F; + exponent_size = 1; + + if (exponent > MPFR_EXTERNAL_EXPONENT && exponent < MPFR_KIND_ZERO) + { + mpfr_uexp_t exp_sign_bit; + + exponent_size = exponent - MPFR_EXTERNAL_EXPONENT; + + /* A failure is acceptable when the exponent starts with leading zeros, + even if it would fit in mpfr_exp_t (see format description). */ + if (MPFR_UNLIKELY (exponent_size > 16 /* see TODO */ || + exponent_size > sizeof(mpfr_exp_t))) + return 1; + + if (MPFR_UNLIKELY (fread (buffer, exponent_size, 1, fh) != 1)) + return 1; + + uexp = 0; + getLittleEndianData ((unsigned char *) &uexp, buffer, + sizeof(mpfr_exp_t), exponent_size); + + /* Sign bit of the exponent. */ + exp_sign_bit = uexp & ((mpfr_uexp_t) 1 << (8 * exponent_size - 1)); + + uexp &= ~exp_sign_bit; + uexp += MPFR_MAX_EMBEDDED_EXPONENT; + if (MPFR_UNLIKELY (uexp > MPFR_EMAX_MAX && uexp > -MPFR_EMIN_MIN)) + return 1; + + exponent = exp_sign_bit ? - (mpfr_exp_t) uexp : (mpfr_exp_t) uexp; + if (MPFR_UNLIKELY (! MPFR_EXP_IN_RANGE (exponent))) + return 1; + MPFR_SET_EXP (x, exponent); + + exponent_size++; + } + else if (exponent == MPFR_KIND_ZERO) + MPFR_SET_ZERO (x); + else if (exponent == MPFR_KIND_INF) + MPFR_SET_INF (x); + else if (exponent == MPFR_KIND_NAN) + MPFR_SET_NAN (x); + else if (exponent <= MPFR_EXTERNAL_EXPONENT) + { + exponent -= MPFR_MAX_EMBEDDED_EXPONENT; + if (MPFR_UNLIKELY (! MPFR_EXP_IN_RANGE (exponent))) + return 1; + MPFR_SET_EXP (x, exponent); + } + else + return 1; + + return 0; +} + +/* + * buffer : OUT : store the limb of the MPFR number x in a binary format, + * can be null (may be reallocated if too small) + * buffer_size : IN/OUT : size of the buffer => size used in the buffer + * x : IN : MPFR number + * return pointer to a buffer storing the limb of the MPFR number x in a binary + * format + */ +static unsigned char* +mpfr_fpif_store_limbs (unsigned char *buffer, size_t *buffer_size, mpfr_t x) +{ + unsigned char *result; + mpfr_prec_t precision; + size_t nb_byte; + size_t nb_limb, mp_bytes_per_limb; + size_t nb_partial_byte; + size_t i, j; + + precision = mpfr_get_prec (x); + nb_byte = (precision + 7) >> 3; + mp_bytes_per_limb = mp_bits_per_limb >> 3; + nb_partial_byte = nb_byte % mp_bytes_per_limb; + nb_limb = (nb_byte + mp_bytes_per_limb - 1) / mp_bytes_per_limb; + + result = buffer; + ALLOC_RESULT(result, buffer_size, nb_byte); + + putBigEndianData (result, (unsigned char*) MPFR_MANT(x), + sizeof(mp_limb_t), nb_partial_byte); + for (i = nb_partial_byte, j = (nb_partial_byte == 0) ? 0 : 1; j < nb_limb; + i += mp_bytes_per_limb, j++) + putLittleEndianData (result + i, (unsigned char*) (MPFR_MANT(x) + j), + sizeof(mp_limb_t), sizeof(mp_limb_t)); + + return result; +} + +/* + * x : OUT : MPFR number extracted from the binary buffer, should have the same + * precision than the number in the binary format + * buffer : IN : limb of the MPFR number x in a binary format, + * buffer_size : IN/OUT : size of the buffer => size used in the buffer + * return 0 if successful + */ +static int +mpfr_fpif_read_limbs (mpfr_t x, unsigned char *buffer, size_t *buffer_size) +{ + mpfr_prec_t precision; + size_t nb_byte; + size_t mp_bytes_per_limb; + size_t nb_partial_byte; + size_t i, j; + + precision = mpfr_get_prec (x); + nb_byte = (precision + 7) >> 3; + mp_bytes_per_limb = mp_bits_per_limb >> 3; + nb_partial_byte = nb_byte % mp_bytes_per_limb; + + if ((buffer == NULL) || (*buffer_size < nb_byte)) + { + *buffer_size = 0; + return 1; + } + *buffer_size = nb_byte; + + if (nb_partial_byte > 0) + { + memset (MPFR_MANT(x), 0, sizeof(mp_limb_t)); + getBigEndianData ((unsigned char*) MPFR_MANT(x), buffer, + sizeof(mp_limb_t), nb_partial_byte); + } + for (i = nb_partial_byte, j = (nb_partial_byte == 0) ? 0 : 1; i < nb_byte; + i += mp_bytes_per_limb, j++) + getLittleEndianData ((unsigned char*) (MPFR_MANT(x) + j), buffer + i, + sizeof(mp_limb_t), sizeof(mp_limb_t)); + + return 0; +} + +/* External Function */ +/* + * fh : IN : file handler + * x : IN : MPFR number to put in the file + * return 0 if successful + */ +int +mpfr_fpif_export (FILE *fh, mpfr_t x) +{ + int status; + unsigned char *buf; + unsigned char *bufResult; + size_t used_size, buf_size; + + if (fh == NULL) + return -1; + + buf_size = MAX_VARIABLE_STORAGE(sizeof(mpfr_exp_t), mpfr_get_prec (x)); + buf = (unsigned char*) mpfr_allocate_func (buf_size); + if (buf == NULL) + return -1; + + used_size = buf_size; + buf = mpfr_fpif_store_precision (buf, &used_size, mpfr_get_prec (x)); + used_size > buf_size ? buf_size = used_size : 0; + status = fwrite (buf, used_size, 1, fh); + if (status != 1) + { + mpfr_free_func (buf, buf_size); + return -1; + } + used_size = buf_size; + bufResult = mpfr_fpif_store_exponent (buf, &used_size, x); + if (bufResult == NULL) + { + mpfr_free_func (buf, buf_size); + return -1; + } + buf = bufResult; + used_size > buf_size ? buf_size = used_size : 0; + status = fwrite (buf, used_size, 1, fh); + if (status != 1) + { + mpfr_free_func (buf, buf_size); + return -1; + } + + if (mpfr_regular_p (x)) + { + used_size = buf_size; + buf = mpfr_fpif_store_limbs (buf, &used_size, x); + used_size > buf_size ? buf_size = used_size : 0; + status = fwrite (buf, used_size, 1, fh); + if (status != 1) + { + mpfr_free_func (buf, buf_size); + return -1; + } + } + + mpfr_free_func (buf, buf_size); + return 0; +} + +/* + * x : IN/OUT : MPFR number extracted from the file, its precision is reset to + * be able to hold the number + * fh : IN : file handler + * Return 0 if the import was successful. + */ +int +mpfr_fpif_import (mpfr_t x, FILE *fh) +{ + int status; + mpfr_prec_t precision; + unsigned char *buffer; + size_t used_size; + + precision = mpfr_fpif_read_precision_from_file (fh); + if (precision == 0) /* precision = 0 means an error */ + return -1; + if (precision > MPFR_PREC_MAX) + return -1; + MPFR_STAT_STATIC_ASSERT (MPFR_PREC_MIN == 1); /* as specified */ + mpfr_set_prec (x, precision); + + status = mpfr_fpif_read_exponent_from_file (x, fh); + if (status != 0) + { + mpfr_set_nan (x); + return -1; + } + + /* Warning! The significand of x is not set yet. Thus use MPFR_IS_SINGULAR + for the test. */ + if (!MPFR_IS_SINGULAR (x)) + { + /* For portability, we need to consider bytes with only 8 significant + bits in the interchange format. That's OK because CHAR_BIT >= 8. + But the implementation is currently not clear when CHAR_BIT > 8. + This may have never been tested. For safety, require CHAR_BIT == 8, + and test/adapt the code if this ever fails. */ + MPFR_STAT_STATIC_ASSERT (CHAR_BIT == 8); + MPFR_STAT_STATIC_ASSERT ((MPFR_PREC_MAX + 7) >> 3 <= (size_t) -1); + used_size = (precision + 7) >> 3; /* ceil(precision/8) */ + buffer = (unsigned char*) mpfr_allocate_func (used_size); + if (buffer == NULL) + { + mpfr_set_nan (x); + return -1; + } + status = fread (buffer, used_size, 1, fh); + if (status != 1) + { + mpfr_free_func (buffer, used_size); + mpfr_set_nan (x); + return -1; + } + status = mpfr_fpif_read_limbs (x, buffer, &used_size); + mpfr_free_func (buffer, used_size); + if (status != 0) + { + mpfr_set_nan (x); + return -1; + } + } + + return 0; +} diff -Nru mpfr4-3.1.4/src/frac.c mpfr4-4.0.2/src/frac.c --- mpfr4-3.1.4/src/frac.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/frac.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_frac -- Fractional part of a floating-point number. -Copyright 2002-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2002-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ @@ -108,9 +108,9 @@ t0 = tn - un; tp = MPFR_MANT(t); if (sh == 0) - MPN_COPY_DECR(tp + t0, up, un + 1); + mpn_copyd (tp + t0, up, un + 1); else /* warning: un may be 0 here */ - tp[tn] = k | ((un) ? mpn_lshift (tp + t0, up, un, sh) : (mp_limb_t) 0); + tp[tn] = k | ((un) ? mpn_lshift (tp + t0, up, un, sh) : MPFR_LIMB_ZERO); if (t0 > 0) MPN_ZERO(tp, t0); diff -Nru mpfr4-3.1.4/src/free_cache.c mpfr4-4.0.2/src/free_cache.c --- mpfr4-3.1.4/src/free_cache.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/free_cache.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ -/* mpfr_free_cache - Free the cache used by MPFR for internal consts. +/* mpfr_free_cache... - Free cache/pool memory used by MPFR. -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,32 +17,14 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" -#if 0 +/* Theses caches may be global to all threads or local to the current one. */ static void -free_l2b (void) -{ - int i, b; - - for (b = 2; b <= BASE_MAX; b++) - for (i = 0; i < 2; i++) - { - mpfr_ptr p = __gmpfr_l2b[b-2][i]; - if (p != NULL) - { - mpfr_clear (p); - (*__gmp_free_func) (p, sizeof (mpfr_t)); - } - } -} -#endif - -void -mpfr_free_cache (void) +mpfr_free_const_caches (void) { #ifndef MPFR_USE_LOGGING mpfr_clear_cache (__gmpfr_cache_const_pi); @@ -55,5 +37,56 @@ #endif mpfr_clear_cache (__gmpfr_cache_const_euler); mpfr_clear_cache (__gmpfr_cache_const_catalan); - /* free_l2b (); */ +} + +/* Theses caches/pools are always local to a thread. */ +static void +mpfr_free_local_cache (void) +{ + /* Before freeing the mpz_t pool, we need to free any cache of + mpz_t numbers, since freeing such a cache may add entries to + the mpz_t pool. */ + mpfr_bernoulli_freecache (); + mpfr_free_pool (); +} + +void +mpfr_free_cache (void) +{ + mpfr_free_local_cache (); + mpfr_free_const_caches (); +} + +void +mpfr_free_cache2 (mpfr_free_cache_t way) +{ + if ((unsigned int) way & MPFR_FREE_LOCAL_CACHE) + { + mpfr_free_local_cache (); +#if !defined(MPFR_WANT_SHARED_CACHE) + mpfr_free_const_caches (); +#endif + } + if ((unsigned int) way & MPFR_FREE_GLOBAL_CACHE) + { +#if defined(MPFR_WANT_SHARED_CACHE) + mpfr_free_const_caches (); +#endif + } +} + +/* Function an application should call before mp_set_memory_functions(). + This is currently equivalent to freeing the caches (and pools) since + they are allocated with GMP's current allocator. But this might change + in the future to avoid the drawback of having to free the caches just + because the allocators are changed: the caches could optionally be + allocated with malloc(). + This function returns 0 in case of success, non-zero in case of error. + Errors are currently not possible. But let's avoid a prototype change + in the future, in case errors would be possible. */ +int +mpfr_mp_memory_cleanup (void) +{ + mpfr_free_cache (); + return 0; } diff -Nru mpfr4-3.1.4/src/frexp.c mpfr4-4.0.2/src/frexp.c --- mpfr4-3.1.4/src/frexp.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/frexp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_frexp -- convert to integral and fractional parts -Copyright 2011-2016 Free Software Foundation, Inc. +Copyright 2011-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -26,7 +26,7 @@ mpfr_frexp (mpfr_exp_t *exp, mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) { int inex; - unsigned int saved_flags = __gmpfr_flags; + mpfr_flags_t saved_flags = __gmpfr_flags; MPFR_BLOCK_DECL (flags); MPFR_LOG_FUNC diff -Nru mpfr4-3.1.4/src/gamma.c mpfr4-4.0.2/src/gamma.c --- mpfr4-3.1.4/src/gamma.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/gamma.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_gamma -- gamma function -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -27,7 +27,8 @@ #include "lngamma.c" #undef IS_GAMMA -/* return a sufficient precision such that 2-x is exact, assuming x < 0 */ +/* return a sufficient precision such that 2-x is exact, assuming x < 0 + and x is not an integer */ static mpfr_prec_t mpfr_gamma_2_minus_x_exact (mpfr_srcptr x) { @@ -38,13 +39,16 @@ carry can occur, or ULP(y) > 2, and we need w >= EXP(y)-1: (a) if EXP(y) <= 1, w = PREC(y) + 2 - EXP(y) (b) if EXP(y) > 1 and EXP(y)-PREC(y) <= 1, w = PREC(y) + 1 - (c) if EXP(y) > 1 and EXP(y)-PREC(y) > 1, w = EXP(y) - 1 */ + (c) if EXP(y) > 1 and EXP(y)-PREC(y) > 1, w = EXP(y) - 1. + + Note: case (c) cannot happen in practice since this would imply that + y is integer, thus x is negative integer */ return (MPFR_GET_EXP(x) <= 1) ? MPFR_PREC(x) + 2 - MPFR_GET_EXP(x) - : ((MPFR_GET_EXP(x) <= MPFR_PREC(x) + 1) ? MPFR_PREC(x) + 1 - : MPFR_GET_EXP(x) - 1); + : MPFR_PREC(x) + 1; } -/* return a sufficient precision such that 1-x is exact, assuming x < 1 */ +/* return a sufficient precision such that 1-x is exact, assuming x < 1 + and x is not an integer */ static mpfr_prec_t mpfr_gamma_1_minus_x_exact (mpfr_srcptr x) { @@ -52,10 +56,9 @@ return MPFR_PREC(x) - MPFR_GET_EXP(x); else if (MPFR_GET_EXP(x) <= 0) return MPFR_PREC(x) + 1 - MPFR_GET_EXP(x); - else if (MPFR_PREC(x) >= MPFR_GET_EXP(x)) + else /* necessarily MPFR_PREC(x) > MPFR_GET_EXP(x) since otherwise + x would be an integer */ return MPFR_PREC(x) + 1; - else - return MPFR_GET_EXP(x); } /* returns a lower bound of the number of significant bits of n! @@ -72,6 +75,8 @@ unsigned long r, k; MPFR_SAVE_EXPO_DECL (expo); + MPFR_ASSERTD (n >= 1); + MPFR_SAVE_EXPO_MARK (expo); mpfr_init2 (x, 38); mpfr_init2 (y, 38); @@ -84,9 +89,14 @@ mpfr_sqrt (y, y, MPFR_RNDZ); mpfr_mul (x, x, y, MPFR_RNDZ); mpfr_log2 (x, x, MPFR_RNDZ); - r = mpfr_get_ui (x, MPFR_RNDU); + r = mpfr_get_ui (x, MPFR_RNDU); /* lower bound on ceil(x) */ for (k = 2; k <= n; k *= 2) - r -= n / k; + { + /* Note: the approximation is accurate enough so that the + subtractions do not wrap. */ + MPFR_ASSERTD (r >= n / k); + r -= n / k; + } mpfr_clear (x); mpfr_clear (y); MPFR_SAVE_EXPO_FREE (expo); @@ -143,19 +153,30 @@ MPFR_ASSERTD(MPFR_IS_ZERO(x)); MPFR_SET_INF(gamma); MPFR_SET_SAME_SIGN(gamma, x); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); MPFR_RET (0); /* exact */ } } - /* Check for tiny arguments, where gamma(x) ~ 1/x - euler + .... + /* Check for tiny arguments, where gamma(x) ~ 1/x - euler + ... can be + approximated by 1/x, with some error term ~= - euler. + We need to make sure that there are no breakpoints (discontinuity + points of the rounding function) between gamma(x) and 1/x (included), + where the possible breakpoints (for all rounding modes) are the numbers + that fit on PREC(gamma)+1 bits. There will be a special case when |x| + is a power of two, since such values are breakpoints. We will choose n + minimum such that x fits on n bits and the breakpoints fit on n+1 bits, + thus + n = MAX(MPFR_PREC(x), MPFR_PREC(gamma)). We know from "Bound on Runs of Zeros and Ones for Algebraic Functions", Proceedings of Arith15, T. Lang and J.-M. Muller, 2001, that the maximal - number of consecutive zeroes or ones after the round bit is n-1 for an - input of n bits. But we need a more precise lower bound. Assume x has - n bits, and 1/x is near a floating-point number y of n+1 bits. We can - write x = X*2^e, y = Y/2^f with X, Y integers of n and n+1 bits. - Thus X*Y^2^(e-f) is near from 1, i.e., X*Y is near from 2^(f-e). + number of consecutive zeroes or ones after the round bit for 1/x is n-1 + for an input x of n bits [this is an actually much older result!]. + But we need a more precise lower bound. Assume that 1/x is near a + breakpoint y. From the definition of n, the input x fits on n bits + and the breakpoint y fits on of n+1 bits. We can write x = X*2^e, + y = Y/2^f with X, Y integers of n and n+1 bits respectively. + Thus X*Y^2^(e-f) is near 1, i.e., X*Y is near the integer 2^(f-e). Two cases can happen: (i) either X*Y is exactly 2^(f-e), but this can happen only if X and Y are themselves powers of two, i.e., x is a power of two; @@ -163,13 +184,21 @@ |xy-1| >= 2^(e-f), or |y-1/x| >= 2^(e-f)/x = 2^(-f)/X >= 2^(-f-n). Since ufp(y) = 2^(n-f) [ufp = unit in first place], this means that the distance |y-1/x| >= 2^(-2n) ufp(y). - Now assuming |gamma(x)-1/x| <= 1, which is true for x <= 1, - if 2^(-2n) ufp(y) >= 2, the error is at most 2^(-2n-1) ufp(y), - and round(1/x) with precision >= 2n+2 gives the correct result. - If x < 2^E, then y > 2^(-E), thus ufp(y) > 2^(-E-1). - A sufficient condition is thus EXP(x) + 2 <= -2 MAX(PREC(x),PREC(Y)). + Now, assuming |gamma(x)-1/x| < 1, which is true for 0 < x <= 1, + if 2^(-2n) ufp(y) >= 1, then gamma(x) and 1/x round in the same + way, so that rounding 1/x gives the correct result and correct + (nonzero) ternary value. + If x < 2^E, then y >= 2^(-E), thus ufp(y) >= 2^(-E). + A sufficient condition is thus EXP(x) <= -2n, where + n = MAX(MPFR_PREC(x), MPFR_PREC(gamma)). */ - if (MPFR_GET_EXP (x) + 2 + /* TODO: The above proof uses the same precision for input and output. + Without this assumption, one might obtain a bound like + PREC(x) + PREC(y) instead of 2 MAX(PREC(x),PREC(y)). */ + /* TODO: Handle the very small arguments that do not satisfy the condition, + by using the approximation 1/x - euler and a Ziv loop. Otherwise, after + some tests, even Gamma(1+x)/x would be faster than the generic code. */ + if (MPFR_GET_EXP (x) <= -2 * (mpfr_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(gamma))) { int sign = MPFR_SIGN (x); /* retrieve sign before possible override */ @@ -187,7 +216,7 @@ mpfr_powerof2_raw (x); MPFR_BLOCK (flags, inex = mpfr_ui_div (gamma, 1, x, rnd_mode)); - if (inex == 0) /* x is a power of two */ + if (inex == 0) /* |x| is a power of two */ { /* return RND(1/x - euler) = RND(+/- 2^k - eps) with eps > 0 */ if (rnd_mode == MPFR_RNDN || MPFR_IS_LIKE_RNDU (rnd_mode, sign)) @@ -239,6 +268,7 @@ unsigned long int u; mpfr_prec_t p = MPFR_PREC(gamma); u = mpfr_get_ui (x, MPFR_RNDN); + MPFR_ASSERTD (u >= 2); if (u < 44787929UL && bits_fac (u - 1) <= p + (rnd_mode == MPFR_RNDN)) /* bits_fac: lower bound on the number of bits of m, where gamma(x) = (u-1)! = m*2^e with m odd. */ @@ -256,26 +286,31 @@ >= 2 * (x/e)^x / x for x >= 1 */ if (compared > 0) { - mpfr_t yp; + mpfr_t yp, zp; mpfr_exp_t expxp; MPFR_BLOCK_DECL (flags); + MPFR_GROUP_DECL (group); + /* quick test for the default exponent range */ + if (mpfr_get_emax () >= 1073741823UL && MPFR_GET_EXP(x) <= 25) + { + MPFR_SAVE_EXPO_FREE (expo); + return mpfr_gamma_aux (gamma, x, rnd_mode); + } + + MPFR_GROUP_INIT_3 (group, 53, xp, yp, zp); /* 1/e rounded down to 53 bits */ -#define EXPM1_STR "0.010111100010110101011000110110001011001110111100111" - mpfr_init2 (xp, 53); - mpfr_init2 (yp, 53); - mpfr_set_str_binary (xp, EXPM1_STR); - mpfr_mul (xp, x, xp, MPFR_RNDZ); + mpfr_set_str_binary (zp, + "0.010111100010110101011000110110001011001110111100111"); + mpfr_mul (xp, x, zp, MPFR_RNDZ); mpfr_sub_ui (yp, x, 2, MPFR_RNDZ); mpfr_pow (xp, xp, yp, MPFR_RNDZ); /* (x/e)^(x-2) */ - mpfr_set_str_binary (yp, EXPM1_STR); - mpfr_mul (xp, xp, yp, MPFR_RNDZ); /* x^(x-2) / e^(x-1) */ - mpfr_mul (xp, xp, yp, MPFR_RNDZ); /* x^(x-2) / e^x */ + mpfr_mul (xp, xp, zp, MPFR_RNDZ); /* x^(x-2) / e^(x-1) */ + mpfr_mul (xp, xp, zp, MPFR_RNDZ); /* x^(x-2) / e^x */ mpfr_mul (xp, xp, x, MPFR_RNDZ); /* lower bound on x^(x-1) / e^x */ MPFR_BLOCK (flags, mpfr_mul_2ui (xp, xp, 1, MPFR_RNDZ)); expxp = MPFR_GET_EXP (xp); - mpfr_clear (xp); - mpfr_clear (yp); + MPFR_GROUP_CLEAR (group); MPFR_SAVE_EXPO_FREE (expo); return MPFR_OVERFLOW (flags) || expxp > __gmpfr_emax ? mpfr_overflow (gamma, rnd_mode, 1) : @@ -316,8 +351,8 @@ w += 17; /* to get tmp2 small enough */ mpfr_set_prec (tmp, w); mpfr_set_prec (tmp2, w); - ck = mpfr_ui_sub (tmp, 2, x, MPFR_RNDN); - MPFR_ASSERTD (ck == 0); (void) ck; /* use ck to avoid a warning */ + MPFR_DBGRES (ck = mpfr_ui_sub (tmp, 2, x, MPFR_RNDN)); + MPFR_ASSERTD (ck == 0); /* tmp = 2-x exactly */ mpfr_const_pi (tmp2, MPFR_RNDN); mpfr_mul (tmp2, tmp2, tmp, MPFR_RNDN); /* Pi*(2-x) */ mpfr_sin (tmp, tmp2, MPFR_RNDN); /* sin(Pi*(2-x)) */ diff -Nru mpfr4-3.1.4/src/gamma_inc.c mpfr4-4.0.2/src/gamma_inc.c --- mpfr4-3.1.4/src/gamma_inc.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/gamma_inc.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,504 @@ +/* mpfr_gamma_inc -- incomplete gamma function + +Copyright 2016-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define MPFR_NEED_LONGLONG_H +#include "mpfr-impl.h" + +/* The incomplete gamma function is defined for x >= 0 and a not a negative + integer by: + + gamma_inc(a,x) := Gamma(a,x) = int(t^(a-1) * exp(-t), t=x..infinity) + + = Gamma(a) - gamma(a,x) with: + + gamma(a,x) = int(t^(a-1) * exp(-t), t=0..x). + + The function gamma(a,x) satisfies the Taylor expansions (we use the second + one in the code below): + + gamma(a,x) = x^a * sum((-x)^k/k!/(a+k), k=0..infinity) + + gamma(a,x) = x^a * exp(-x) * sum(x^k/(a*(a+1)*...*(a+k)), k=0..infinity) +*/ + +static int +mpfr_gamma_inc_negint (mpfr_ptr y, mpfr_srcptr a, mpfr_srcptr x, mpfr_rnd_t r); + +int +mpfr_gamma_inc (mpfr_ptr y, mpfr_srcptr a, mpfr_srcptr x, mpfr_rnd_t rnd) +{ + mpfr_prec_t w; + mpfr_t s, t, u; + int inex; + unsigned long k; + mpfr_exp_t e0, e1, e2, err; + MPFR_GROUP_DECL(group); + MPFR_ZIV_DECL(loop); + MPFR_SAVE_EXPO_DECL (expo); + + if (MPFR_ARE_SINGULAR (a, x)) + { + /* if a or x is NaN, return NaN */ + if (MPFR_IS_NAN (a) || MPFR_IS_NAN (x)) + { + MPFR_SET_NAN (y); + MPFR_RET_NAN; + } + + /* Note: for x < 0, gamma_inc (a, x) is a complex number */ + + if (MPFR_IS_INF (a) || MPFR_IS_INF (x)) + { + if (MPFR_IS_INF (a) && MPFR_IS_INF (x)) + { + if ((MPFR_IS_POS (a) && MPFR_IS_POS (x)) || MPFR_IS_NEG (x)) + { + /* (a) gamma_inc(+Inf,+Inf) = NaN because + gamma_inc(x,x) tends to +Inf but + gamma_inc(x,x^2) tends to +0. + (b) gamma_inc(+/-Inf,-Inf) = NaN, for example + gamma_inc (a, -a) is a complex number + for a not an integer */ + MPFR_SET_NAN (y); + MPFR_RET_NAN; + } + else + { + /* gamma_inc(-Inf,+Inf) = +0 */ + MPFR_SET_ZERO (y); + MPFR_SET_POS (y); + MPFR_RET (0); /* exact */ + } + } + else /* only one of a, x is infinite */ + { + if (MPFR_IS_INF (a)) + { + MPFR_ASSERTD (MPFR_IS_INF (a) && MPFR_IS_FP (x)); + if (MPFR_IS_POS (a)) + { + /* gamma_inc(+Inf, x) = +Inf */ + MPFR_SET_INF (y); + MPFR_SET_POS (y); + MPFR_RET (0); /* exact */ + } + else /* a = -Inf */ + { + /* gamma_inc(-Inf, x) = NaN for x < 0 + +Inf for 0 <= x < 1 + +0 for 1 <= x */ + if (mpfr_cmp_ui (x, 0) < 0) + { + MPFR_SET_NAN (y); + MPFR_RET_NAN; + } + else if (mpfr_cmp_ui (x, 1) < 0) + { + MPFR_SET_INF (y); + MPFR_SET_POS (y); + MPFR_RET (0); /* exact */ + } + else + { + MPFR_SET_ZERO (y); + MPFR_SET_POS (y); + MPFR_RET (0); /* exact */ + } + } + } + else + { + MPFR_ASSERTD (MPFR_IS_FP (a) && MPFR_IS_INF (x)); + if (MPFR_IS_POS (x)) + { + /* x is +Inf: integral tends to zero */ + MPFR_SET_ZERO (y); + MPFR_SET_POS (y); + MPFR_RET (0); /* exact */ + } + else /* NaN for x < 0 */ + { + MPFR_SET_NAN (y); + MPFR_RET_NAN; + } + } + } + } + + if (MPFR_IS_ZERO (a) || MPFR_IS_ZERO (x)) + { + if (MPFR_IS_ZERO (a)) + { + if (mpfr_cmp_ui (x, 0) < 0) + { + /* gamma_inc(a,x) = NaN for x < 0 */ + MPFR_SET_NAN (y); + MPFR_RET_NAN; + } + else if (MPFR_IS_ZERO (x)) + /* gamma_inc(a,0) = gamma(a) */ + return mpfr_gamma (y, a, rnd); /* a=+0->+Inf, a=-0->-Inf */ + else + { + /* gamma_inc (0, x) = int (exp(-t), t=x..infinity) = E1(x) */ + mpfr_t minus_x; + MPFR_TMP_INIT_NEG(minus_x, x); + /* mpfr_eint(x) for x < 0 returns -E1(-x) */ + inex = mpfr_eint (y, minus_x, MPFR_INVERT_RND(rnd)); + MPFR_CHANGE_SIGN(y); + return -inex; + } + } + else /* x = 0: gamma_inc(a,0) = gamma(a) */ + return mpfr_gamma (y, a, rnd); + } + } + + /* for x < 0 return NaN */ + if (MPFR_SIGN(x) < 0) + { + MPFR_SET_NAN (y); + MPFR_RET_NAN; + } + + if (mpfr_integer_p (a) && MPFR_SIGN(a) < 0) + return mpfr_gamma_inc_negint (y, a, x, rnd); + + MPFR_SAVE_EXPO_MARK (expo); + + w = MPFR_PREC(y) + 13; /* working precision */ + + MPFR_GROUP_INIT_2(group, w, s, t); + mpfr_init2 (u, 2); /* u is special (see below) */ + MPFR_ZIV_INIT (loop, w); + for (;;) + { + mpfr_exp_t expu, precu, exps; + mpfr_t s_abs; + mpfr_exp_t decay = 0; + MPFR_BLOCK_DECL (flags); + + /* Note: in the error analysis below, theta represents any value of + absolute value less than 2^(-w) where w is the working precision (two + instances of theta may represent different values), cf Higham's book. + */ + + /* to ensure that u = a + k is exact, we have three cases: + (1) EXP(a) <= 0, then we need PREC(u) >= 1 - EXP(a) + PREC(a) + (2) EXP(a) - PREC(a) <= 0 < E(a), then PREC(u) >= PREC(a) + (3) 0 < EXP(a) - PREC(a), then PREC(u) >= EXP(a) */ + precu = MPFR_GET_EXP(a) <= 0 ? + MPFR_ADD_PREC (MPFR_PREC(a), 1 - MPFR_EXP(a)) + : (MPFR_EXP(a) <= MPFR_PREC(a)) ? MPFR_PREC(a) : MPFR_EXP(a); + MPFR_ASSERTD (precu + 1 <= MPFR_PREC_MAX); + mpfr_set_prec (u, precu + 1); + expu = (MPFR_EXP(a) > 0) ? MPFR_EXP(a) : 1; + + /* estimate Taylor series */ + mpfr_ui_div (t, 1, a, MPFR_RNDA); /* t = 1/a * (1 + theta) */ + mpfr_set (s, t, MPFR_RNDA); /* s = 1/a * (1 + theta) */ + if (MPFR_IS_NEG(a)) + { + mpfr_init2 (s_abs, 32); + mpfr_abs (s_abs, s, MPFR_RNDU); + } + for (k = 1;; k++) + { + mpfr_mul (t, t, x, MPFR_RNDU); /* t = x^k/(a * ... * (a+k-1)) + * (1 + theta)^(2k) */ + inex = mpfr_add_ui (u, a, k, MPFR_RNDZ); /* u = a+k exactly */ + MPFR_ASSERTD(inex == 0); + mpfr_div (t, t, u, MPFR_RNDA); /* t = x^k/(a * ... * (a+k)) + * (1 + theta)^(2k+1) */ + mpfr_add (s, s, t, MPFR_RNDZ); + /* when s is zero, we consider ulp(s) = ulp(t) */ + exps = (MPFR_IS_ZERO(s)) ? MPFR_GET_EXP(t) : MPFR_GET_EXP(s); + if (MPFR_IS_NEG(a)) + { + if (MPFR_IS_POS(t)) + mpfr_add (s_abs, s_abs, t, MPFR_RNDU); + else + mpfr_sub (s_abs, s_abs, t, MPFR_RNDU); + } + /* we stop when |t| < ulp(s), u > 0 and |x/u| < 1/2, which ensures + that the tail is at most 2*ulp(s) */ + MPFR_ASSERTD (MPFR_NOTZERO(t)); + if (MPFR_GET_EXP(t) + w <= exps && MPFR_IS_POS(u) && + MPFR_GET_EXP(x) + 1 < MPFR_GET_EXP(u)) + break; + + /* if there was an exponent shift in u, increase the precision of + u so that mpfr_add_ui (u, a, k) remains exact */ + if (MPFR_EXP(u) > expu) /* exponent shift in u */ + { + MPFR_ASSERTD(MPFR_EXP(u) == expu + 1); + expu = MPFR_EXP(u); + mpfr_set_prec (u, mpfr_get_prec (u) + 1); + } + } + if (MPFR_IS_NEG(a)) + { + decay = MPFR_GET_EXP(s_abs) - MPFR_GET_EXP(s); + mpfr_clear (s_abs); + } + /* For a > 0, since all terms are positive, we have + s = S * (1 + theta)^(2k+3) with S being the infinite Taylor series. + For a < 0, the error is bounded by that on the sum s_abs of absolute + values of the terms, i.e., S_abs * [(1 + theta)^(2k+3) - 1]. Thus we + can simply use the same error analysis as for a > 0, adding an error + corresponding to the decay of exponent between s_abs and s. */ + + /* multiply by exp(-x) */ + mpfr_exp (t, x, MPFR_RNDZ); /* t = exp(x) * (1+theta) */ + mpfr_div (s, s, t, MPFR_RNDZ); /* s = * (1+theta)^(2k+5) */ + + /* multiply by x^a */ + mpfr_pow (t, x, a, MPFR_RNDZ); /* t = x^a * (1+theta) */ + mpfr_mul (s, s, t, MPFR_RNDZ); /* s = Gamma(a,x) * (1+theta)^(2k+7) */ + + /* Since |theta| < 2^(-w) using the Taylor expansion of log(1+x) + we have log(1+theta) = theta1 with |theta1| < 1.16*2^(-w) for w >= 2, + thus (1+theta)^(2k+7) = exp((2k+7)*theta1). + Assuming 2k+7 = t*2^w for |t| < 0.5, we have + |(2k+7)*theta1| = |t*2^w*theta1| < 0.58. + For |u| < 0.58 we have |exp(u)-1| < 1.36*|u| + thus |(1+theta)^(2k+7) - 1| < 1.36*0.58*(2k+7)/2^w < 0.79*(2k+7)/2^w. + Since one ulp is at worst a relative error of 2^(1-w), + the error on s is at most 2^(decay+1)*(2k+7) ulps. */ + + /* subtract from gamma(a) */ + MPFR_BLOCK (flags, mpfr_gamma (t, a, MPFR_RNDZ)); + MPFR_ASSERTN (!MPFR_OVERFLOW (flags)); /* FIXME: support overflow */ + /* t = gamma(a) * (1+theta) */ + e0 = MPFR_GET_EXP (t); + e1 = (MPFR_IS_ZERO(s)) ? __gmpfr_emin : MPFR_GET_EXP (s); + mpfr_sub (s, t, s, MPFR_RNDZ); + /* if s is zero, we can assume ulp(s) = ulp(t), but anyway we won't + be able to round */ + e2 = (MPFR_IS_ZERO(s)) ? e0 : MPFR_GET_EXP (s); + /* the final error is at most 1 ulp (for the final subtraction) + + 2^(e0-e2) ulps # for the error in t + + 2^(decay+1)*(2k+7) ulps * 2^(e1-e2) # for the error in gamma(a,x) */ + + e1 += decay + 1 + MPFR_INT_CEIL_LOG2 (2*k+7); + /* Now the error is <= 1 + 2^(e0-e2) + 2^(e1-e2). + Since the formula is symmetric in e0 and e1, we can assume without + loss of generality e0 >= e1, then: + if e0 = e1: err <= 1 + 2*2^(e0-e2) <= 2^(e0-e2+2) + if e0 > e1: err <= 1 + 1.5*2^(e0-e2) + <= 2^(e0-e2+1) if e0 > e2 + <= 2^2 otherwise */ + if (e0 == e1) + { + /* Check that e0 - e2 + 2 <= MPFR_EXP_MAX */ + MPFR_ASSERTD (e2 >= 2 || e0 <= (MPFR_EXP_MAX - 2) + e2); + /* Check that e0 - e2 + 2 >= MPFR_EXP_MIN */ + MPFR_ASSERTD (e2 <= 2 || e0 >= MPFR_EXP_MIN + (e2 - 2)); + err = e0 - e2 + 2; + } + else + { + e0 = (e0 > e1) ? e0 : e1; /* max(e0,e1) */ + MPFR_ASSERTD (e0 <= e2 || e2 >= 1 || e0 <= (MPFR_EXP_MAX - 1) + e2); + err = (e0 > e2) ? e0 - e2 + 1 : 2; + } + + if (MPFR_LIKELY (MPFR_CAN_ROUND (s, w - err, MPFR_PREC(y), rnd))) + break; + + MPFR_ZIV_NEXT (loop, w); + MPFR_GROUP_REPREC_2(group, w, s, t); + } + MPFR_ZIV_FREE (loop); + mpfr_clear (u); + + inex = mpfr_set (y, s, rnd); + MPFR_GROUP_CLEAR(group); + + MPFR_SAVE_EXPO_FREE (expo); + return mpfr_check_range (y, inex, rnd); +} + +/* For a negative integer, we have (formula 6.5.19): + + gamma(-n,x) = (-1)^n/n! [E_1(x) - exp(-x) sum((-1)^j*j!/x^(j+1), j=0..n-1)] + + See also http://arxiv.org/pdf/1407.0349v1.pdf. + + Assumes 'a' is a negative integer. +*/ +static int +mpfr_gamma_inc_negint (mpfr_ptr y, mpfr_srcptr a, mpfr_srcptr x, + mpfr_rnd_t rnd) +{ + mpfr_t s, t, abs_a, neg_x; + unsigned long j; + mpfr_prec_t w; + int inex; + mpfr_exp_t exp_s, new_exp_s, exp_t, err_s, logj; + MPFR_GROUP_DECL(group); + MPFR_ZIV_DECL(loop); + MPFR_SAVE_EXPO_DECL (expo); + + MPFR_ASSERTD(mpfr_integer_p (a)); + MPFR_ASSERTD(mpfr_cmp_ui (a, 0) < 0); + + MPFR_TMP_INIT_ABS(abs_a, a); + + /* below, theta represents any value such that |theta| <= 2^(-w) */ + + w = MPFR_PREC(y) + 10; /* initial working precision */ + + MPFR_SAVE_EXPO_MARK (expo); + MPFR_GROUP_INIT_2(group, w, s, t); + MPFR_ZIV_INIT (loop, w); + for (;;) + { + /* we require |a| <= 2^(w-3) for the error analysis below */ + if (MPFR_GET_EXP(a) + 3 > w) + w = MPFR_GET_EXP(a) + 3; + + mpfr_ui_div (t, 1, x, MPFR_RNDN); /* t = 1/x * (1 + theta) */ + mpfr_set (s, t, MPFR_RNDN); + MPFR_ASSERTD (MPFR_NOTZERO(s)); + exp_t = exp_s = MPFR_GET_EXP(s); /* max. exponent of s/t during loop */ + new_exp_s = exp_s; + + for (j = 1; mpfr_cmp_ui (abs_a, j) > 0; j++) + { + /* invariant: t = (-1)^(j-1)*(j-1)!/x^j * (1 + theta)^(2j-1) */ + mpfr_mul_ui (t, t, j, MPFR_RNDN); + mpfr_neg (t, t, MPFR_RNDN); /* exact */ + mpfr_div (t, t, x, MPFR_RNDN); + /* now t = (-1)^j*j!/x^(j+1) * (1 + theta)^(2j+1). + We have (1 + theta)^(2j+1) = exp((2j+1)*log(1+theta)). + For |u| <= 1/2, we have |log(1+u)| <= 1.4 |u| thus: + |(1+theta)^(2j+1)-1| <= max |exp(1.4*(2j+1)*u)-1| for |u|<=2^(-w). + Now for |v| <= 1/2 we have |exp(v)-1| <= 0.7*|v| thus: + |(1+theta)^(2j+1) - 1| <= 2*(2j+1)*2^(-w) + as long as 1.4*(2j+1)*2^(-w) <= 1/2, which is true when j<2^(w-3). + Since j < |a| it suffices that |a| <= 2^(w-3). + In that case the rel. error on t is bounded by 2*(2j+1)*2^(-w), + thus the error in ulps is bounded by 2*(2j+1) ulp(t). */ + if (MPFR_IS_ZERO(t)) /* underflow on t */ + break; + if (MPFR_GET_EXP(t) > exp_t) + exp_t = MPFR_GET_EXP(t); + mpfr_add (s, s, t, MPFR_RNDN); + /* if s is zero, we can assume its ulp is that of t */ + new_exp_s = (MPFR_IS_ZERO(s)) ? MPFR_GET_EXP(t) : MPFR_GET_EXP(s); + if (new_exp_s > exp_s) + exp_s = new_exp_s; + } + + /* the error on s is bounded by (j-1) * 2^(exp_s - EXP(s)) * 1/2 + for the mpfr_add roundings, plus + sum(2*(2i+1), i=1..j-1) * 2^(exp_t - EXP(s)) for the error on t. + The latter sum is (2*j^2-2) * 2^(exp_t - EXP(s)). */ + + logj = MPFR_INT_CEIL_LOG2(j); + exp_s += logj - 1; + exp_t += 1 + 2 * logj; + + /* now the error on s is bounded by 2^(exp_s-EXP(s))+2^(exp_t-EXP(s)) */ + + exp_s = (exp_s >= exp_t) ? exp_s + 1 : exp_t + 1; + err_s = exp_s - new_exp_s; + + /* now the error on the sum S := sum((-1)^j*j!/x^(j+1), j=0..n-1) + is bounded by 2^err_s ulp(s) */ + + MPFR_TMP_INIT_NEG(neg_x, x); + + mpfr_exp (t, neg_x, MPFR_RNDN); /* t = exp(-x) * (1 + theta) */ + mpfr_mul (s, s, t, MPFR_RNDN); + if (MPFR_IS_ZERO(s)) + { + MPFR_ASSERTD (MPFR_NOTZERO(t)); + new_exp_s += MPFR_GET_EXP(t); + } + /* s = exp(-x) * (S +/- 2^err_s ulp(S)) * (1 + theta)^2. + = exp(-x) * (S +/- 2^err_s ulp(S)) * (1 +/- 3 ulp(1)) + The error on s is bounded by: + exp(-x) * [2^err_s*ulp(S) + S*3*ulp(1) + 2^err_s*ulp(S)*3*ulp(1)] + <= ulp(s) * [2^(err_s+1) + 6 + 1] + <= ulp(s) * 2^(err_s+2) as long as err_s >= 2. */ + + err_s = (err_s >= 2) ? err_s + 2 : 4; + /* now the error on s is bounded by 2^err_s ulp(s) */ + + mpfr_eint (t, neg_x, MPFR_RNDN); /* t = -E1(-x) * (1 + theta) */ + mpfr_neg (t, t, MPFR_RNDN); /* exact */ + + exp_s = (MPFR_IS_ZERO(s)) ? new_exp_s : MPFR_GET_EXP(s); + MPFR_ASSERTD (MPFR_NOTZERO(t)); + exp_t = MPFR_GET_EXP(t); + mpfr_sub (s, t, s, MPFR_RNDN); /* E_1(x) - exp(-x) * S */ + if (MPFR_IS_ZERO(s)) /* cancellation: increase working precision */ + goto next_w; + + /* err(s) <= 1/2 * ulp(s) [mpfr_sub] + + 2^err_s * 2^(exp_s-EXP(s)) * ulp(s) [previous error on s] + + 1/2 * 2^(exp_t-EXP(s)) * ulp(s) [error on t] */ + + exp_s += err_s; + exp_t -= 1; + exp_s = (exp_s >= exp_t) ? exp_s + 1 : exp_t + 1; + MPFR_ASSERTD (MPFR_NOTZERO(s)); + err_s = exp_s - MPFR_GET_EXP(s); + /* err(s) <= 1/2 * ulp(s) + 2^err_s * ulp(s) */ + + /* divide by n! */ + mpfr_gamma (t, abs_a, MPFR_RNDN); /* t = (n-1)! * (1 + theta) */ + mpfr_mul (t, t, abs_a, MPFR_RNDN); /* t = n! * (1 + theta)^2 */ + mpfr_div (s, s, t, MPFR_RNDN); + /* since (1 + theta)^2 converts to an error of at most 3 ulps + for w >= 2, the final error is at most: + 2 * (1/2 + 2^err_s) * ulp(s) [error on previous s] + + 2 * 3 * ulp(s) [error on t] + + 1 * ulp(s) [product of errors] + = ulp(s) * (2^(err_s+1) + 8) */ + err_s = (err_s >= 2) ? err_s + 1 : 4; + + /* the final error is bounded by 2^err_s * ulp(s) */ + + /* Is there a better way to compute (-1)^n? */ + mpfr_set_si (t, -1, MPFR_RNDN); + mpfr_pow (t, t, abs_a, MPFR_RNDN); + if (MPFR_IS_NEG(t)) + mpfr_neg (s, s, MPFR_RNDN); + + if (MPFR_LIKELY (MPFR_CAN_ROUND (s, w - err_s, MPFR_PREC(y), rnd))) + break; + + next_w: + MPFR_ZIV_NEXT (loop, w); + MPFR_GROUP_REPREC_2(group, w, s, t); + } + MPFR_ZIV_FREE (loop); + + inex = mpfr_set (y, s, rnd); + MPFR_GROUP_CLEAR(group); + + MPFR_SAVE_EXPO_FREE (expo); + return mpfr_check_range (y, inex, rnd); +} diff -Nru mpfr4-3.1.4/src/gammaonethird.c mpfr4-4.0.2/src/gammaonethird.c --- mpfr4-3.1.4/src/gammaonethird.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/gammaonethird.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Functions for evaluating Gamma(1/3) and Gamma(2/3). Used by mpfr_ai. -Copyright 2010-2016 Free Software Foundation, Inc. +Copyright 2010-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H diff -Nru mpfr4-3.1.4/src/generic/coverage/mparam.h mpfr4-4.0.2/src/generic/coverage/mparam.h --- mpfr4-3.1.4/src/generic/coverage/mparam.h 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/generic/coverage/mparam.h 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,225 @@ +/* Various Thresholds of MPFR, not exported. -*- mode: C -*- + +Copyright 2005-2019 Free Software Foundation, Inc. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* mparam tuned for coverage test */ + +#define MPFR_MULHIGH_TAB \ + -1,0,-1,-1,-1,-1,-1,-1,0,0,0,0,8,9,10,11, \ + 10,11,12,13,0,13,14,13,14,15,16,17,16,16,18,19, \ + 19,19,20,19,28,28,28,28,28,28,28,28,28,28,28,30, \ + 32,32,32,32,34,34,36,34,36,36,36,36,36,40,38,38, \ + 40,38,40,40,56,56,56,56,56,56,56,56,56,56,56,56, \ + 56,56,56,56,56,56,56,56,60,56,60,64,64,64,56,56, \ + 56,64,64,56,60,64,60,64,64,64,64,68,68,64,68,84, \ + 84,86,84,84,87,84,87,84,87,84,84,84,84,84,84,84, \ + 87,87,86,87,87,87,92,93,92,93,93,93,93,99,96,93, \ + 99,99,99,99,99,98,99,99,102,99,105,104,105,105,108,108, \ + 110,108,108,111,114,114,116,117,117, \ + 117,117,117,124,124,124,124, \ + 124,124,124,132,132,132,132,124,132,\ + 132,132,132,132,132,132,132, \ + 140,140,140,140,123,140,124,124,124,\ + 124,132,128,132,132,132,132, \ + 132,132,132,132,132,132,140,140,132,140,140,140,140,140,148,147, \ + 140,148,148,147,148,148,148,156,148,156,156,156,156,156,156,155, \ + 156,160,156,156,164,164,164,156,164,164,164,164,164,164,164,164, \ + 164,217,220,220,220,220,220,220,220,220,220,220,220,220,220,220, \ + 220,220,220,220,220,220,220,220,220,220,224,220,220,220,220,220, \ + 220,220,220,220,220,220,220,220,220,224,220,220,220,224,220,220, \ + 220,220,220,224,224,224,224,236,220,236,235,236,235,235,234,236, \ + 236,235,236,236,235,236,236,236,236,236,236,252,236,251,236,251, \ + 252,252,252,252,236,235,252,252,252,252,252,251,268,252,252,252, \ + 268,251,268,268,252,252,268,268,268,268,267,268,268,268,267,268, \ + 268,252,268,268,268,267,268,268,268,252,268,252,252,252,251,268, \ + 252,268,252,268,268,268,268,268,267,268,268,268,268,268,268,268, \ + 268,268,268,268,268,268,332,332,330,268,332,332,332,332,330,331, \ + 332,332,332,332,344,331,344,344,344,344,344,332,342,332,344,332, \ + 332,332,344,332,344,344,342,344,344,342,344,344,344,344,344,342, \ + 344,344,344,344,344,344,344,368,344,342,344,344,368,344,344,344, \ + 344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344, \ + 344,344,368,344,344,368,344,363,368,367,368,368,368,368,368,366, \ + 366,368,368,368,368,368,368,368,368,368,368,368,368,368,380,368, \ + 368,368,368,368,368,392,392,392,392,392,392,392,392,392,392,392, \ + 392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392, \ + 392,391,392,392,392,392,392,416,392,416,416,416,416,412,416,392, \ + 416,416,416,416,416,416,416,416,416,416,416,428,416,416,416,428, \ + 416,440,416,480,480,480,480,480,480,480,504,503,504,504,504,504, \ + 504,504,504,503,504,504,504,504,504,504,504,504,504,503,504,504, \ + 480,504,504,504,504,504,504,480,504,488,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,536,536,536,536,536,536,536, \ + 536,536,536,536,535,536,536,536,536,536,536,536,536,535,536,536, \ + 536,536,536,535,536,535,536,536,536,536,536,536,536,536,536,536, \ + 536,568,536,536,536,536,536,536,568,536,535,536,536,536,536,536, \ + 536,536,536,568,568,568,568,568,568,568,568,568,568,568,568,568, \ + 568,568,568,568,568,568,568,568,568,664,664,664,664,664,664,664, \ + 664,663,664,664,664,664,664,664,664,664,664,663,664,664,664,663, \ + 664,663,664,664,664,664,664,664,664,663,664,664,664,663,664,664, \ + 664,664,664,664,664,664,664,664,664,664,664,664,664,664,664,664, \ + 664,664,664,663,664,664,664,664,664,664,664,663,664,664,664,664, \ + 664,688,664,664,688,688,664,664,688,664,664,664,664,664,664,664, \ + 664,680,688,688,688,688,688,688,688,688,688,688,688,688,688,688, \ + 688,688,712,712,688,688,688,712,712,711,712,712,736,728,736,728, \ + 728,728,736,728,736,736,736,736,728,736,736,736,728,736,736,736, \ + 735,736,736,736,736,736,736,736,736,736,736,736,736,728,736,736, \ + 728,736,736,736,736,735,736,736,735,736,736,736,736,735,736,736, \ + 736,728,736,736,736,736,736,736,736,736,736,736,736,736,736,784, \ + 736,784,783,736,784,735,784,735,784,735,736,736,736,736,736,736, \ + 736,736,784,735,736,784,736,784,784,736,736,736,736,784,784,784, \ + 784,784,784,783,784,784,784,736,784,784,784,784,784,784,784,784, \ + 784,784,784,784,783,784,784,784,784,784,784,784,784,784,784,784, \ + 784,784,784,784,784,784,784,784,784,784,784,784,784,784,784,783, \ + 736,784,784,784,784,784,783,784,784,831,784,832,832,832,832,832 \ + +#define MPFR_SQRHIGH_TAB \ + -1,0,0,0,-1,-1,-1,-1,-1,7,7,7,8,9,10,11, \ + 11,11,11,11,12,13,13,15,15,15,15,15,17,17,19,19, \ + 19,19,19,19,20,20,23,21,23,23,24,23,27,25,26,27, \ + 26,27,27,34,34,34,34,34,34,34,34,34,34,38,34,38, \ + 38,38,38,40,40,42,42,44,42,42,46,42,42,46,46,42, \ + 42,42,44,44,46,46,46,46,46,46,50,50,50,50,50,50, \ + 54,54,54,56,54,56,58,58,68,68,68,68,68,68,68,68, \ + 68,68,68,72,68,68,68,68,68,68,72,72,76,76,76,76, \ + 76,76,76,76,84,84,84,84,76,84,84,84,84,84,88,92, \ + 84,84,92,92,84,76,92,88,80,80,80,80,84,84,84,84, \ + 84,88,84,84,84,92,92,92,92,88,92,96,92,96,92,96, \ + 92,96,100,104,100,100,96,100,100,100,108,104,117,104,117,108, \ + 117,117,117,123,122,122,120,117,122,117,122,123,122,123,122,123, \ + 126,123,126,129,126,129,135,123,132,135,132,135,134,135,134,135, \ + 138,129,132,123,144,144,134,135,140,129,146,135,132,147,146,147, \ + 146,135,138,147,138,135,140,141,144,147,146,147,146,147,150,152, \ + 152,153,152,153,156,153,138,135,140,141,138,144,146,147,147,147, \ + 147,146,146,146,150,150,150,147,147,159,156,159,158,156,153,159, \ + 159,159,159,158,201,201,201,201,170,201,170,201,171,201,168,201, \ + 200,201,201,201,201,200,201,201,200,201,201,201,201,200,201,201, \ + 201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201, \ + 201,201,201,201,201,201,201,201,201,213,201,212,213,225,213,225, \ + 225,225,225,225,225,225,225,225,225,224,225,225,225,225,224,225, \ + 225,225,225,225,225,225,225,225,225,225,225,225,237,225,237,225, \ + 249,249,249,249,249,249,249,249,249,249,248,249,249,249,261,249, \ + 261,249,261,261,261,249,249,261,260,261,248,261,261,273,248,249, \ + 249,261,261,249,249,273,249,248,249,249,249,273,261,273,273,249, \ + 273,249,273,272,273,273,261,273,273,273,273,273,273,261,273,273, \ + 273,273,273,276,285,273,273,273,273,273,273,273,273,261,285,285, \ + 285,285,273,261,261,285,273,297,285,273,273,273,272,273,273,273, \ + 273,273,273,273,273,273,273,276,273,273,273,273,285,273,273,285, \ + 351,351,351,351,351,351,297,351,351,366,351,351,351,297,366,366, \ + 351,351,351,351,366,363,351,362,364,366,366,366,364,351,351,351, \ + 351,351,366,366,351,366,366,366,366,366,363,366,360,363,366,366, \ + 366,363,366,366,366,366,366,366,366,351,366,366,351,351,351,384, \ + 366,366,366,366,366,384,366,366,363,364,366,363,366,366,366,363, \ + 366,366,366,366,366,366,366,366,366,365,366,366,366,384,366,366, \ + 384,366,384,366,366,366,384,366,366,366,366,366,366,384,366,402, \ + 393,384,366,402,402,402,384,402,402,402,384,401,402,402,351,402, \ + 351,351,402,402,402,351,402,402,366,363,365,366,366,363,366,366, \ + 365,360,366,366,366,351,366,363,365,363,366,366,366,366,363,365, \ + 366,366,366,366,366,366,366,366,366,366,366,363,366,366,366,363, \ + 365,366,402,402,366,402,384,384,381,402,384,384,384,384,384,384, \ + 402,384,387,384,402,401,402,391,402,393,399,402,402,402,401,399, \ + 401,402,402,402,402,402,402,402,402,402,402,402,402,402,399,402, \ + 401,402,402,402,402,402,402,402,402,438,402,438,438,437,402,437, \ + 438,437,438,438,438,441,438,438,438,438,438,438,438,438,437,438, \ + 438,438,456,435,437,437,438,438,438,435,438,437,438,456,456,438, \ + 455,456,456,456,474,456,474,456,456,474,456,456,512,456,512,512, \ + 512,512,512,512,512,512,512,474,512,512,512,512,512,512,512,512, \ + 512,512,512,512,512,512,512,512,512,512,512,512,512,512,512,512, \ + 512,512,512,512,512,512,512,536,512,512,536,522,512,536,536,512, \ + 512,512,512,536,536,524,536,531,536,536,536,536,536,536,536,536, \ + 535,512,536,534,512,536,512,536,536,535,536,536,535,534,534,536, \ + 536,536,536,535,536,535,534,536,536,536,536,536,536,534,536,536, \ + 536,536,536,536,536,560,560,535,536,560,536,535,584,536,536,572, \ + 583,584,584,584,536,572,560,584,584,584,584,584,583,584,584,584, \ + 584,583,584,570,584,584,572,584,584,584,584,584,584,583,584,584, \ + 584,584,584,560,584,584,584,584,584,584,584,584,584,584,584,584, \ + 584,584,584,584,584,632,696,632,584,582,696,696,696,696,584,696, \ + 694,696,695,696,695,696,694,695,695,696,696,696,695,696,696,695, \ + 696,696,695,696,696,696,696,696,695,695,696,695,696,695,696,695, \ + 696,695,696,695,696,695,696,695,696,696,696,696,696,695,696,696, \ + 695,696,696,696,696,696,696,696,696,696,696,696,696,696,696,696 \ + +#define MPFR_DIVHIGH_TAB \ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /*0-15*/ \ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /*16-31*/ \ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /*32-47*/ \ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /*48-63*/ \ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,0, /*64-79*/ \ + 0,0,0,0,0,0,0,0,0,0,0,0,0,56,56,56, /*80-95*/ \ + 56,56,60,58,59,56,59,59,56,59,60,58,56,64,60,60, /*96-111*/ \ + 63,64,64,60,63,60,64,64,64,66,67,66,68,66,72,66, /*112-127*/ \ + 67,67,71,68,68,71,71,70,76,74,74,76,76,72,75,80, /*128-143*/ \ + 76,76,76,76,78,76,79,77,80,78,79,80,82,80,83,83, /*144-159*/ \ + 83,85,86,91,85,88,87,85,87,90,112,91,112,89,112,112, /*160-175*/ \ + 112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, /*176-191*/ \ + 112,112,118,112,112,112,112,112,112,112,120,120,112,112,112,120, /*192-207*/ \ + 112,112,112,112,112,120,112,119,112,112,114,112,124,120,120,116, /*208-223*/ \ + 120,118,123,128,124,120,120,123,120,128,128,120,128,134,128,127, /*224-239*/ \ + 126,128,136,134,136,128,126,127,136,128,134,136,136,128,136,132, /*240-255*/ \ + 136,136,134,132,136,136,135,136,136,134,136,136,136,140,144,142, /*256-271*/ \ + 143,144,144,143,144,143,150,144,144,143,144,144,156,144,152,151, /*272-287*/ \ + 166,149,152,152,156,152,168,160,152,168,168,168,152,160,168,168, /*288-303*/ \ + 168,172,166,168,168,180,166,166,165,165,168,168,168,164,174,167, /*304-319*/ \ + 168,166,174,168,168,168,174,176,180,172,174,182,180,172,184,178, /*320-335*/ \ + 184,183,184,186,182,182,183,185,174,224,176,224,224,224,196,191, /*336-351*/ \ + 192,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, /*352-367*/ \ + 224,224,224,224,224,224,224,224,224,224,228,224,224,224,233,224, /*368-383*/ \ + 224,224,224,240,224,232,224,224,224,224,224,224,224,224,224,224, /*384-399*/ \ + 224,224,224,224,228,224,224,224,224,224,224,224,224,225,224,224, /*400-415*/ \ + 224,224,224,224,224,224,224,224,233,232,224,240,224,240,224,223, /*416-431*/ \ + 224,224,224,224,224,232,224,232,228,233,224,224,228,240,230,240, /*432-447*/ \ + 240,240,242,239,240,247,240,239,248,240,239,242,256,232,256,254, /*448-463*/ \ + 256,256,256,256,256,256,256,256,256,240,264,256,264,264,256,263, /*464-479*/ \ + 272,272,256,248,254,272,256,256,254,256,256,255,254,272,272,256, /*480-495*/ \ + 256,272,264,256,255,271,272,264,256,272,272,272,272,256,272,272, /*496-511*/ \ + 278,280,272,272,280,287,280,280,287,280,270,272,272,264,272,272, /*512-527*/ \ + 271,269,270,280,272,272,271,272,272,270,272,272,272,272,288,273, /*528-543*/ \ + 278,276,288,286,280,288,287,285,280,286,288,280,280,288,288,296, /*544-559*/ \ + 288,288,288,289,288,288,287,287,288,296,288,288,296,302,312,294, /*560-575*/ \ + 310,304,303,304,304,312,303,320,304,300,312,296,305,310,304,304, /*576-591*/ \ + 304,302,303,312,302,304,304,304,302,336,304,304,328,311,312,328, /*592-607*/ \ + 310,312,316,336,336,320,312,320,336,320,319,336,336,328,328,325, /*608-623*/ \ + 320,328,328,336,320,336,320,324,336,348,320,336,343,320,336,336, /*624-639*/ \ + 336,334,335,344,341,328,342,336,328,335,336,336,336,336,335,336, /*640-655*/ \ + 336,343,336,344,336,336,348,360,344,359,344,360,360,360,344,348, /*656-671*/ \ + 344,347,348,360,348,360,360,360,360,367,368,368,448,360,448,372, /*672-687*/ \ + 360,360,448,368,448,448,448,448,448,448,448,448,448,448,448,448, /*688-703*/ \ + 448,448,448,448,448,448,448,448,448,448,448,448,448,448,448,448, /*704-719*/ \ + 448,448,448,448,448,448,448,448,448,448,448,448,448,448,448,448, /*720-735*/ \ + 448,448,448,448,448,448,448,448,448,448,448,448,448,448,448,448, /*736-751*/ \ + 448,448,448,448,448,448,448,448,448,448,448,448,448,448,448,448, /*752-767*/ \ + 448,448,448,448,448,448,448,448,448,448,448,448,448,467,448,468, /*768-783*/ \ + 448,468,448,466,448,464,468,448,464,464,448,448,448,448,464,448, /*784-799*/ \ + 480,448,448,448,448,448,448,448,448,448,448,448,448,448,448,448, /*800-815*/ \ + 448,448,448,448,448,448,448,448,448,448,480,448,448,448,447,448, /*816-831*/ \ + 448,448,448,464,448,448,448,448,448,448,448,448,448,447,448,448, /*832-847*/ \ + 448,448,448,448,447,448,448,448,448,456,448,448,448,456,448,448, /*848-863*/ \ + 448,448,448,448,448,448,448,448,448,448,464,464,448,467,448,448, /*864-879*/ \ + 448,448,448,464,448,447,468,464,448,464,464,448,448,468,472,472, /*880-895*/ \ + 466,462,464,469,468,464,463,480,472,479,496,480,472,512,472,479, /*896-911*/ \ + 512,464,495,512,496,495,480,496,488,472,492,512,512,480,512,479, /*912-927*/ \ + 512,480,504,480,480,496,512,480,472,480,512,496,480,512,536,496, /*928-943*/ \ + 512,512,512,512,496,512,512,515,496,480,512,496,512,480,510,543, /*944-959*/ \ + 512,496,512,496,528,528,496,512,512,528,527,496,512,508,512,528, /*960-975*/ \ + 512,512,512,512,512,512,512,512,528,528,512,512,512,512,528,528, /*976-991*/ \ + 512,528,526,527,528,511,508,511,512,512,528,527,528,528,510,512, /*992-1007*/ \ + 528,544,544,536,536,520,511,536,536,543,512,528,544,512,542,543 /*1008-1023*/ \ + + diff -Nru mpfr4-3.1.4/src/generic/mparam.h mpfr4-4.0.2/src/generic/mparam.h --- mpfr4-3.1.4/src/generic/mparam.h 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/generic/mparam.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef MPFR_MULHIGH_TAB diff -Nru mpfr4-3.1.4/src/gen_inverse.h mpfr4-4.0.2/src/gen_inverse.h --- mpfr4-3.1.4/src/gen_inverse.h 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/gen_inverse.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* generic inverse of a function. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H diff -Nru mpfr4-3.1.4/src/get_d64.c mpfr4-4.0.2/src/get_d64.c --- mpfr4-3.1.4/src/get_d64.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/get_d64.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,11 +1,11 @@ /* mpfr_get_decimal64 -- convert a multiple precision floating-point number - to a IEEE 754r decimal64 float + to an IEEE 754-2008 decimal64 float -See http://gcc.gnu.org/ml/gcc/2006-06/msg00691.html, -http://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html, +See https://gcc.gnu.org/ml/gcc/2006-06/msg00691.html, +https://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html, and TR 24732 . -Copyright 2006-2016 Free Software Foundation, Inc. +Copyright 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -22,22 +22,26 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include /* for strtol */ #include "mpfr-impl.h" #define ISDIGIT(c) ('0' <= c && c <= '9') #ifdef MPFR_WANT_DECIMAL_FLOATS +#if _MPFR_IEEE_FLOATS +#else +#include "ieee_floats.h" +#endif + #ifndef DEC64_MAX # define DEC64_MAX 9.999999999999999E384dd #endif #ifdef DPD_FORMAT -static int T[1000] = { +static const int T[1000] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 85, 86, 87, 88, @@ -110,25 +114,33 @@ static _Decimal64 get_decimal64_nan (void) { - union ieee_double_extract x; +#if _MPFR_IEEE_FLOATS + union mpfr_ieee_double_extract x; union ieee_double_decimal64 y; x.s.exp = 1984; /* G[0]..G[4] = 11111: quiet NaN */ y.d = x.d; return y.d64; +#else + return (_Decimal64) MPFR_DBL_NAN; +#endif } /* construct the decimal64 Inf with given sign */ static _Decimal64 get_decimal64_inf (int negative) { - union ieee_double_extract x; +#if _MPFR_IEEE_FLOATS + union mpfr_ieee_double_extract x; union ieee_double_decimal64 y; x.s.sig = (negative) ? 1 : 0; x.s.exp = 1920; /* G[0]..G[4] = 11110: Inf */ y.d = x.d; return y.d64; +#else + return (_Decimal64) (negative ? MPFR_DBL_INFM : MPFR_DBL_INFP); +#endif } /* construct the decimal64 zero with given sign */ @@ -164,6 +176,7 @@ (b2) or -398 <= e <= 369 with m integer, |m| < 10^16. Assumes s is neither NaN nor +Inf nor -Inf. */ +#if _MPFR_IEEE_FLOATS static _Decimal64 string_to_Decimal64 (char *s) { @@ -171,7 +184,7 @@ char m[17]; long n = 0; /* mantissa length */ char *endptr[1]; - union ieee_double_extract x; + union mpfr_ieee_double_extract x; union ieee_double_decimal64 y; #ifdef DPD_FORMAT unsigned int G, d1, d2, d3, d4, d5; @@ -284,6 +297,199 @@ y.d = x.d; return y.d64; } +#else +/* portable version */ +static _Decimal64 +string_to_Decimal64 (char *s) +{ + long int exp = 0; + char m[17]; + long n = 0; /* mantissa length */ + char *endptr[1]; + _Decimal64 x = 0.0; + int sign = 0; +#ifdef DPD_FORMAT + unsigned int G, d1, d2, d3, d4, d5; +#endif + + /* read sign */ + if (*s == '-') + { + sign = 1; + s ++; + } + /* read mantissa */ + while (ISDIGIT (*s)) + m[n++] = *s++; + exp = n; + if (*s == '.') + { + s ++; + while (ISDIGIT (*s)) + m[n++] = *s++; + } + /* we have exp digits before decimal point, and a total of n digits */ + exp -= n; /* we will consider an integer mantissa */ + MPFR_ASSERTN(n <= 16); + if (*s == 'E' || *s == 'e') + exp += strtol (s + 1, endptr, 10); + else + *endptr = s; + MPFR_ASSERTN(**endptr == '\0'); + MPFR_ASSERTN(-398 <= exp && exp <= (long) (385 - n)); + while (n < 16) + { + m[n++] = '0'; + exp --; + } + /* now n=16 and -398 <= exp <= 369 */ + m[n] = '\0'; + + /* the number to convert is m[] * 10^exp where the mantissa is a 16-digit + integer */ + + /* compute biased exponent */ + exp += 398; + + MPFR_ASSERTN(exp >= -15); + if (exp < 0) + { + int i; + n = -exp; + /* check the last n digits of the mantissa are zero */ + for (i = 1; i <= n; i++) + MPFR_ASSERTN(m[16 - n] == '0'); + /* shift the first (16-n) digits to the right */ + for (i = 16 - n - 1; i >= 0; i--) + m[i + n] = m[i]; + /* zero the first n digits */ + for (i = 0; i < n; i ++) + m[i] = '0'; + exp = 0; + } + + /* the number to convert is m[] * 10^(exp-398) */ + exp -= 398; + + for (n = 0; n < 16; n++) + x = (_Decimal64) 10.0 * x + (_Decimal64) (m[n] - '0'); + + /* multiply by 10^exp */ + if (exp > 0) + { + _Decimal64 ten16 = (double) 1e16; /* 10^16 is exactly representable + in binary64 */ + _Decimal64 ten32 = ten16 * ten16; + _Decimal64 ten64 = ten32 * ten32; + _Decimal64 ten128 = ten64 * ten64; + _Decimal64 ten256 = ten128 * ten128; + if (exp >= 256) + { + x *= ten256; + exp -= 256; + } + if (exp >= 128) + { + x *= ten128; + exp -= 128; + } + if (exp >= 64) + { + x *= ten64; + exp -= 64; + } + if (exp >= 32) + { + x *= ten32; + exp -= 32; + } + if (exp >= 16) + { + x *= (_Decimal64) 10000000000000000.0; + exp -= 16; + } + if (exp >= 8) + { + x *= (_Decimal64) 100000000.0; + exp -= 8; + } + if (exp >= 4) + { + x *= (_Decimal64) 10000.0; + exp -= 4; + } + if (exp >= 2) + { + x *= (_Decimal64) 100.0; + exp -= 2; + } + if (exp >= 1) + { + x *= (_Decimal64) 10.0; + exp -= 1; + } + } + else if (exp < 0) + { + _Decimal64 ten16 = (double) 1e16; /* 10^16 is exactly representable + in binary64 */ + _Decimal64 ten32 = ten16 * ten16; + _Decimal64 ten64 = ten32 * ten32; + _Decimal64 ten128 = ten64 * ten64; + _Decimal64 ten256 = ten128 * ten128; + if (exp <= -256) + { + x /= ten256; + exp += 256; + } + if (exp <= -128) + { + x /= ten128; + exp += 128; + } + if (exp <= -64) + { + x /= ten64; + exp += 64; + } + if (exp <= -32) + { + x /= ten32; + exp += 32; + } + if (exp <= -16) + { + x /= (_Decimal64) 10000000000000000.0; + exp += 16; + } + if (exp <= -8) + { + x /= (_Decimal64) 100000000.0; + exp += 8; + } + if (exp <= -4) + { + x /= (_Decimal64) 10000.0; + exp += 4; + } + if (exp <= -2) + { + x /= (_Decimal64) 100.0; + exp += 2; + } + if (exp <= -1) + { + x /= (_Decimal64) 10.0; + exp += 1; + } + } + + if (sign) + x = -x; + + return x; +} +#endif _Decimal64 mpfr_get_decimal64 (mpfr_srcptr src, mpfr_rnd_t rnd_mode) diff -Nru mpfr4-3.1.4/src/get_d.c mpfr4-4.0.2/src/get_d.c --- mpfr4-3.1.4/src/get_d.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/get_d.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_get_d, mpfr_get_d_2exp -- convert a multiple precision floating-point number to a machine double precision float -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include @@ -151,8 +151,7 @@ return negative ? DBL_NEG_ZERO : 0.0; } - tmp[0] = *src; /* Hack copy mpfr_t */ - MPFR_SET_EXP (tmp, 0); + MPFR_ALIAS (tmp, src, MPFR_SIGN (src), 0); ret = mpfr_get_d (tmp, rnd_mode); if (MPFR_IS_PURE_FP(src)) diff -Nru mpfr4-3.1.4/src/get_exp.c mpfr4-4.0.2/src/get_exp.c --- mpfr4-3.1.4/src/get_exp.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/get_exp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_get_exp - get the exponent of a floating-point number -Copyright 2002-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2002-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/get_f.c mpfr4-4.0.2/src/get_f.c --- mpfr4-3.1.4/src/get_f.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/get_f.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_get_f -- convert a MPFR number to a GNU MPF number -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +#define MPFR_NEED_MPF_INTERNALS #include "mpfr-impl.h" +#ifndef MPFR_USE_MINI_GMP /* Since MPFR-3.0, return the usual inexact value. The erange flag is set if an error occurred in the conversion (y is NaN, +Inf, or -Inf that have no equivalent in mpf) @@ -44,7 +46,7 @@ } else if (MPFR_IS_NAN (y)) { - MPFR_SET_ERANGE (); + MPFR_SET_ERANGEFLAG (); return 0; } else /* y is plus infinity (resp. minus infinity), set x to the maximum @@ -53,7 +55,7 @@ int i; mp_limb_t *xp; - MPFR_SET_ERANGE (); + MPFR_SET_ERANGEFLAG (); /* To this day, [mp_exp_t] and mp_size_t are #defined as the same type */ @@ -63,7 +65,7 @@ SIZ (x) = sx; xp = PTR (x); for (i = 0; i < sx; i++) - xp[i] = MP_LIMB_T_MAX; + xp[i] = MPFR_LIMB_MAX; if (MPFR_IS_POS (y)) return -1; @@ -146,3 +148,4 @@ return inex; } +#endif diff -Nru mpfr4-3.1.4/src/get_float128.c mpfr4-4.0.2/src/get_float128.c --- mpfr4-3.1.4/src/get_float128.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/get_float128.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,129 @@ +/* mpfr_get_float128 -- convert a multiple precision floating-point + number to a __float128 number + +Copyright 2012-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-impl.h" + +#ifdef MPFR_WANT_FLOAT128 + +/* generic code */ +__float128 +mpfr_get_float128 (mpfr_srcptr x, mpfr_rnd_t rnd_mode) +{ + + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) + return (__float128) mpfr_get_d (x, rnd_mode); + else /* now x is a normal non-zero number */ + { + __float128 r; /* result */ + __float128 m; + mpfr_exp_t e; /* exponent of x (before rounding) */ + mpfr_exp_t sh; /* exponent shift, so that x/2^sh is in the double range */ + const int emin = -16381; + const int esub = emin - IEEE_FLOAT128_MANT_DIG; + int sign; + + sign = MPFR_SIGN (x); + e = MPFR_GET_EXP (x); + + if (MPFR_UNLIKELY (e <= esub)) + { + if (MPFR_IS_LIKE_RNDZ (rnd_mode, sign < 0) || + (rnd_mode == MPFR_RNDN && (e < esub || mpfr_powerof2_raw (x)))) + return sign < 0 ? -0.0 : 0.0; + r = 1.0; + sh = esub; + } + else + { + mpfr_t y; + mp_limb_t *yp; + int prec, i; /* small enough to fit in an int */ + MPFR_SAVE_EXPO_DECL (expo); + + MPFR_SAVE_EXPO_MARK (expo); + + /* First round x to the target __float128 precision, taking the + reduced precision of the subnormals into account, so that all + subsequent operations are exact (this avoids double rounding + problems). */ + prec = e < emin ? e - esub : IEEE_FLOAT128_MANT_DIG; + MPFR_ASSERTD (prec >= MPFR_PREC_MIN); + mpfr_init2 (y, prec); + + mpfr_set (y, x, rnd_mode); + sh = MPFR_GET_EXP (y); + MPFR_SET_EXP (y, 0); + MPFR_SET_POS (y); + yp = MPFR_MANT (y); + + r = 0.0; + for (i = 0; i < MPFR_LIMB_SIZE (y); i++) + { + /* Note: MPFR_LIMB_MAX is avoided below as it might not + always work if GMP_NUMB_BITS > IEEE_FLOAT128_MANT_DIG. + MPFR_LIMB_HIGHBIT has the advantage to fit on 1 bit. */ + r += yp[i]; + r *= 1 / (2 * (__float128) MPFR_LIMB_HIGHBIT); + } + + mpfr_clear (y); + + MPFR_SAVE_EXPO_FREE (expo); + } + + /* we now have to multiply r by 2^sh */ + MPFR_ASSERTD (r > 0); + if (sh != 0) + { + /* An overflow may occur (example: 0.5*2^1024) */ + while (r < 1.0) + { + r += r; + sh--; + } + + if (sh > 0) + m = 2.0; + else + { + m = 0.5; + sh = -sh; + } + + for (;;) + { + if (sh % 2) + r = r * m; + sh >>= 1; + if (sh == 0) + break; + m = m * m; + } + } + if (sign < 0) + r = -r; + return r; + } +} + +#endif /* MPFR_WANT_FLOAT128 */ diff -Nru mpfr4-3.1.4/src/get_flt.c mpfr4-4.0.2/src/get_flt.c --- mpfr4-3.1.4/src/get_flt.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/get_flt.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_get_flt -- convert a mpfr_t to a machine single precision float -Copyright 2009-2016 Free Software Foundation, Inc. +Copyright 2009-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include /* for FLT_MIN */ @@ -50,7 +50,10 @@ rnd_mode = negative ? MPFR_RNDD : MPFR_RNDU; /* FIXME: The code below assumes the IEEE-754 binary32 format - with subnormal support. */ + with subnormal support. Fix it by converting to double, then + to float, and in case of binary radix (for which we want + correct rounding), handle double-rounding issues somewhere + in the code? */ /* the smallest positive normal float number is 2^(-126) = 0.5*2^(-125), and the smallest positive subnormal number is 2^(-149) = 0.5*2^(-148) */ @@ -117,7 +120,7 @@ if (negative) dd = -dd; - /* convert (exacly) to float */ + /* convert (exactly) to float */ d = (float) dd; } diff -Nru mpfr4-3.1.4/src/get_ld.c mpfr4-4.0.2/src/get_ld.c --- mpfr4-3.1.4/src/get_ld.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/get_ld.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_get_ld, mpfr_get_ld_2exp -- convert a multiple precision floating-point number to a machine long double -Copyright 2002-2016 Free Software Foundation, Inc. +Copyright 2002-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,97 +18,31 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include /* needed so that MPFR_LDBL_MANT_DIG is correctly defined */ #include "mpfr-impl.h" -#ifndef HAVE_LDOUBLE_IEEE_EXT_LITTLE +#if defined(HAVE_LDOUBLE_IS_DOUBLE) +/* special code when "long double" is the same format as "double" */ long double mpfr_get_ld (mpfr_srcptr x, mpfr_rnd_t rnd_mode) { - - if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) - return (long double) mpfr_get_d (x, rnd_mode); - else /* now x is a normal non-zero number */ - { - long double r; /* result */ - long double m; - double s; /* part of result */ - mpfr_exp_t sh; /* exponent shift, so that x/2^sh is in the double range */ - mpfr_t y, z; - int sign; - - /* first round x to the target long double precision, so that - all subsequent operations are exact (this avoids double rounding - problems) */ - mpfr_init2 (y, MPFR_LDBL_MANT_DIG); - mpfr_init2 (z, MPFR_LDBL_MANT_DIG); - /* Note about the precision of z: even though IEEE_DBL_MANT_DIG is - sufficient, z has been set to the same precision as y so that - the mpfr_sub below calls mpfr_sub1sp, which is faster than the - generic subtraction, even in this particular case (from tests - done by Patrick Pelissier on a 64-bit Core2 Duo against r7285). - But here there is an important cancellation in the subtraction. - TODO: get more information about what has been tested. */ - - mpfr_set (y, x, rnd_mode); - sh = MPFR_GET_EXP (y); - sign = MPFR_SIGN (y); - MPFR_SET_EXP (y, 0); - MPFR_SET_POS (y); - - r = 0.0; - do { - s = mpfr_get_d (y, MPFR_RNDN); /* high part of y */ - r += (long double) s; - mpfr_set_d (z, s, MPFR_RNDN); /* exact */ - mpfr_sub (y, y, z, MPFR_RNDN); /* exact */ - } while (!MPFR_IS_ZERO (y)); - - mpfr_clear (z); - mpfr_clear (y); - - /* we now have to multiply back by 2^sh */ - MPFR_ASSERTD (r > 0); - if (sh != 0) - { - /* An overflow may occurs (example: 0.5*2^1024) */ - while (r < 1.0) - { - r += r; - sh--; - } - - if (sh > 0) - m = 2.0; - else - { - m = 0.5; - sh = -sh; - } - - for (;;) - { - if (sh % 2) - r = r * m; - sh >>= 1; - if (sh == 0) - break; - m = m * m; - } - } - if (sign < 0) - r = -r; - return r; - } + return (long double) mpfr_get_d (x, rnd_mode); } -#else +#elif defined(HAVE_LDOUBLE_IEEE_EXT_LITTLE) +/* Note: The code will return a result with a 64-bit precision, even + if the rounding precision is only 53 bits like on FreeBSD and + NetBSD 6- (or with GCC's -mpc64 option to simulate this on other + platforms). This is consistent with how strtold behaves in these + cases, for instance. */ + +/* special code for IEEE 754 little-endian extended format */ long double mpfr_get_ld (mpfr_srcptr x, mpfr_rnd_t rnd_mode) { @@ -122,7 +56,7 @@ mpfr_init2 (tmp, MPFR_LDBL_MANT_DIG); inex = mpfr_set (tmp, x, rnd_mode); - mpfr_set_emin (-16382-63); + mpfr_set_emin (-16381-63); /* emin=-16444, see below */ mpfr_set_emax (16384); mpfr_subnormalize (tmp, mpfr_check_range (tmp, inex, rnd_mode), rnd_mode); mpfr_prec_round (tmp, 64, MPFR_RNDZ); /* exact */ @@ -135,10 +69,12 @@ tmpmant = MPFR_MANT (tmp); e = MPFR_GET_EXP (tmp); - /* the smallest normal number is 2^(-16382), which is 0.5*2^(-16381) - in MPFR, thus any exponent <= -16382 corresponds to a subnormal - number */ + /* The smallest positive normal number is 2^(-16382), which is + 0.5*2^(-16381) in MPFR, thus any exponent <= -16382 corresponds to a + subnormal number. The smallest positive subnormal number is 2^(-16445) + which is 0.5*2^(-16444) in MPFR thus 0 <= denorm <= 63. */ denorm = MPFR_UNLIKELY (e <= -16382) ? - e - 16382 + 1 : 0; + MPFR_ASSERTD (0 <= denorm && denorm < 64); #if GMP_NUMB_BITS >= 64 ld.s.manl = (tmpmant[0] >> denorm); ld.s.manh = (tmpmant[0] >> denorm) >> 32; @@ -153,7 +89,7 @@ ld.s.manl = (tmpmant[0] >> denorm) | (tmpmant[1] << (32 - denorm)); ld.s.manh = tmpmant[1] >> denorm; } - else /* 32 <= denorm <= 64 */ + else /* 32 <= denorm < 64 */ { ld.s.manl = tmpmant[1] >> (denorm - 32); ld.s.manh = 0; @@ -177,6 +113,128 @@ return ld.ld; } +#else + +/* generic code */ +long double +mpfr_get_ld (mpfr_srcptr x, mpfr_rnd_t rnd_mode) +{ + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) + return (long double) mpfr_get_d (x, rnd_mode); + else /* now x is a normal non-zero number */ + { + long double r; /* result */ + double s; /* part of result */ + MPFR_SAVE_EXPO_DECL (expo); + + MPFR_SAVE_EXPO_MARK (expo); + +#if defined(HAVE_LDOUBLE_MAYBE_DOUBLE_DOUBLE) + if (MPFR_LDBL_MANT_DIG == 106) + { + /* Assume double-double format (as found with the PowerPC ABI). + The generic code below isn't used because numbers with + precision > 106 would not be supported. */ + s = mpfr_get_d (x, MPFR_RNDN); /* high part of x */ + /* Let's first consider special cases separately. The test for + infinity is really needed to avoid a NaN result. The test + for NaN is mainly for optimization. The test for 0 is useful + to get the correct sign (assuming mpfr_get_d supports signed + zeros on the implementation). */ + if (s == 0 || DOUBLE_ISNAN (s) || DOUBLE_ISINF (s)) + r = (long double) s; + else + { + mpfr_t y, z; + + mpfr_init2 (y, mpfr_get_prec (x)); + mpfr_init2 (z, IEEE_DBL_MANT_DIG); /* keep the precision small */ + mpfr_set_d (z, s, MPFR_RNDN); /* exact */ + mpfr_sub (y, x, z, MPFR_RNDN); /* exact */ + /* Add the second part of y (in the correct rounding mode). */ + r = (long double) s + (long double) mpfr_get_d (y, rnd_mode); + mpfr_clear (z); + mpfr_clear (y); + } + } + else +#endif + { + long double m; + mpfr_exp_t sh; /* exponent shift -> x/2^sh is in the double range */ + mpfr_t y, z; + int sign; + + /* First round x to the target long double precision, so that + all subsequent operations are exact (this avoids double rounding + problems). However if the format contains numbers that have more + precision, MPFR won't be able to generate such numbers. */ + mpfr_init2 (y, MPFR_LDBL_MANT_DIG); + mpfr_init2 (z, MPFR_LDBL_MANT_DIG); + /* Note about the precision of z: even though IEEE_DBL_MANT_DIG is + sufficient, z has been set to the same precision as y so that + the mpfr_sub below calls mpfr_sub1sp, which is faster than the + generic subtraction, even in this particular case (from tests + done by Patrick Pelissier on a 64-bit Core2 Duo against r7285). + But here there is an important cancellation in the subtraction. + TODO: get more information about what has been tested. */ + + mpfr_set (y, x, rnd_mode); + sh = MPFR_GET_EXP (y); + sign = MPFR_SIGN (y); + MPFR_SET_EXP (y, 0); + MPFR_SET_POS (y); + + r = 0.0; + do + { + s = mpfr_get_d (y, MPFR_RNDN); /* high part of y */ + r += (long double) s; + mpfr_set_d (z, s, MPFR_RNDN); /* exact */ + mpfr_sub (y, y, z, MPFR_RNDN); /* exact */ + } + while (!MPFR_IS_ZERO (y)); + + mpfr_clear (z); + mpfr_clear (y); + + /* we now have to multiply back by 2^sh */ + MPFR_ASSERTD (r > 0); + if (sh != 0) + { + /* An overflow may occur (example: 0.5*2^1024) */ + while (r < 1.0) + { + r += r; + sh--; + } + + if (sh > 0) + m = 2.0; + else + { + m = 0.5; + sh = -sh; + } + + for (;;) + { + if (sh % 2) + r = r * m; + sh >>= 1; + if (sh == 0) + break; + m = m * m; + } + } + if (sign < 0) + r = -r; + } + MPFR_SAVE_EXPO_FREE (expo); + return r; + } +} + #endif /* contributed by Damien Stehle */ @@ -190,8 +248,7 @@ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (src))) return (long double) mpfr_get_d_2exp (expptr, src, rnd_mode); - tmp[0] = *src; /* Hack copy mpfr_t */ - MPFR_SET_EXP (tmp, 0); + MPFR_ALIAS (tmp, src, MPFR_SIGN (src), 0); ret = mpfr_get_ld (tmp, rnd_mode); if (MPFR_IS_PURE_FP(src)) diff -Nru mpfr4-3.1.4/src/get_patches.c mpfr4-4.0.2/src/get_patches.c --- mpfr4-3.1.4/src/get_patches.c 2016-03-06 11:33:32.000000000 +0000 +++ mpfr4-4.0.2/src/get_patches.c 2019-01-31 20:43:30.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_get_patches -- Patches that have been applied -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/get_q.c mpfr4-4.0.2/src/get_q.c --- mpfr4-3.1.4/src/get_q.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/get_q.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,63 @@ +/* mpfr_get_q -- get a multiple-precision rational from + a floating-point number + +Copyright 2004, 2006-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-impl.h" + +#ifndef MPFR_USE_MINI_GMP +/* part of the code was copied from get_z.c */ +void +mpfr_get_q (mpq_ptr q, mpfr_srcptr f) +{ + mpfr_exp_t exp; + mpz_ptr u = mpq_numref (q); + mpz_ptr v = mpq_denref (q); + + /* v is set to 1 and will not be changed directly. + This ensures that q will be canonical. */ + mpz_set_ui (v, 1); + + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f))) + { + if (MPFR_UNLIKELY (MPFR_NOTZERO (f))) + MPFR_SET_ERANGEFLAG (); + mpz_set_ui (u, 0); + /* The ternary value is 0 even for infinity. Giving the rounding + direction in this case would not make much sense anyway, and + the direction would not necessarily match rnd. */ + } + else + { + exp = mpfr_get_z_2exp (u, f); + if (exp >= 0) + { + MPFR_ASSERTN (exp <= (mp_bitcnt_t) -1); + mpz_mul_2exp (u, u, exp); + } + else /* exp < 0 */ + { + MPFR_ASSERTN (-exp <= (mp_bitcnt_t) -1); + mpq_div_2exp (q, q, -exp); + } + } +} +#endif diff -Nru mpfr4-3.1.4/src/get_si.c mpfr4-4.0.2/src/get_si.c --- mpfr4-3.1.4/src/get_si.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/get_si.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_get_si -- convert a floating-point number to a signed long. -Copyright 2003-2016 Free Software Foundation, Inc. +Copyright 2003-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -28,10 +28,11 @@ mpfr_prec_t prec; long s; mpfr_t x; + MPFR_SAVE_EXPO_DECL (expo); if (MPFR_UNLIKELY (!mpfr_fits_slong_p (f, rnd))) { - MPFR_SET_ERANGE (); + MPFR_SET_ERANGEFLAG (); return MPFR_IS_NAN (f) ? 0 : MPFR_IS_NEG (f) ? LONG_MIN : LONG_MAX; } @@ -39,14 +40,22 @@ if (MPFR_IS_ZERO (f)) return (long) 0; - /* determine prec of long */ - for (s = LONG_MIN, prec = 0; s != 0; s /= 2, prec++) + /* Determine the precision of long. |LONG_MIN| may have one more bit + as an integer, but in this case, this is a power of 2, thus fits + in a precision-prec floating-point number. */ + for (s = LONG_MAX, prec = 0; s != 0; s /= 2, prec++) { } + MPFR_SAVE_EXPO_MARK (expo); + /* first round to prec bits */ mpfr_init2 (x, prec); mpfr_rint (x, f, rnd); + /* The flags from mpfr_rint are the wanted ones. In particular, + it sets the inexact flag when necessary. */ + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); + /* warning: if x=0, taking its exponent is illegal */ if (MPFR_UNLIKELY (MPFR_IS_ZERO(x))) s = 0; @@ -60,10 +69,12 @@ exp = MPFR_GET_EXP (x); /* since |x| >= 1, exp >= 1 */ n = MPFR_LIMB_SIZE(x); a = MPFR_MANT(x)[n - 1] >> (GMP_NUMB_BITS - exp); - s = MPFR_SIGN(f) > 0 ? a : a <= LONG_MAX ? - (long) a : LONG_MIN; + s = MPFR_IS_POS (f) ? a : a <= LONG_MAX ? - (long) a : LONG_MIN; } mpfr_clear (x); + MPFR_SAVE_EXPO_FREE (expo); + return s; } diff -Nru mpfr4-3.1.4/src/get_sj.c mpfr4-4.0.2/src/get_sj.c --- mpfr4-3.1.4/src/get_sj.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/get_sj.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_get_sj -- convert a MPFR number to a huge machine signed integer -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -# include "config.h" /* for a build within gmp */ +# include "config.h" #endif #include "mpfr-intmax.h" @@ -35,10 +35,11 @@ intmax_t r; mpfr_prec_t prec; mpfr_t x; + MPFR_SAVE_EXPO_DECL (expo); if (MPFR_UNLIKELY (!mpfr_fits_intmax_p (f, rnd))) { - MPFR_SET_ERANGE (); + MPFR_SET_ERANGEFLAG (); return MPFR_IS_NAN (f) ? 0 : MPFR_IS_NEG (f) ? MPFR_INTMAX_MIN : MPFR_INTMAX_MAX; } @@ -46,20 +47,24 @@ if (MPFR_IS_ZERO (f)) return (intmax_t) 0; - /* determine the precision of intmax_t */ - for (r = MPFR_INTMAX_MIN, prec = 0; r != 0; r /= 2, prec++) + /* Determine the precision of intmax_t. |INTMAX_MIN| may have one + more bit as an integer, but in this case, this is a power of 2, + thus fits in a precision-prec floating-point number. */ + for (r = MPFR_INTMAX_MAX, prec = 0; r != 0; r /= 2, prec++) { } - /* Note: though INTMAX_MAX would have been sufficient for the conversion, - we chose INTMAX_MIN so that INTMAX_MIN - 1 is always representable in - precision prec; this is useful to detect overflows in MPFR_RNDZ (will - be needed later). */ - /* Now, r = 0. */ + MPFR_ASSERTD (r == 0); + + MPFR_SAVE_EXPO_MARK (expo); mpfr_init2 (x, prec); mpfr_rint (x, f, rnd); MPFR_ASSERTN (MPFR_IS_FP (x)); + /* The flags from mpfr_rint are the wanted ones. In particular, + it sets the inexact flag when necessary. */ + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); + if (MPFR_NOTZERO (x)) { mp_limb_t *xp; @@ -67,15 +72,15 @@ xp = MPFR_MANT (x); sh = MPFR_GET_EXP (x); - MPFR_ASSERTN ((mpfr_prec_t) sh <= prec); + MPFR_ASSERTN ((mpfr_prec_t) sh <= prec + 1); if (MPFR_INTMAX_MIN + MPFR_INTMAX_MAX != 0 - && MPFR_UNLIKELY ((mpfr_prec_t) sh == prec)) + && MPFR_UNLIKELY ((mpfr_prec_t) sh > prec)) { /* 2's complement and x <= INTMAX_MIN: in the case mp_limb_t has the same size as intmax_t, we cannot use the code in the for loop since the operations would be performed in unsigned arithmetic. */ - MPFR_ASSERTN (MPFR_IS_NEG (x) && (mpfr_powerof2_raw (x))); + MPFR_ASSERTN (MPFR_IS_NEG (x) && mpfr_powerof2_raw (x)); r = MPFR_INTMAX_MIN; } else if (MPFR_IS_POS (x)) @@ -85,7 +90,7 @@ (even though xp[n] == 0 in such a case). This can happen if sizeof(mp_limb_t) < sizeof(intmax_t) and |x| is small enough because of the trailing bits due to its normalization. */ - for (n = MPFR_LIMB_SIZE (x) - 1; n >= 0 && sh >= 0; n--) + for (n = MPFR_LIMB_SIZE (x) - 1; n >= 0 && sh > 0; n--) { sh -= GMP_NUMB_BITS; /* Note the concerning the casts below: @@ -95,7 +100,7 @@ for the case sizeof(intmax_t) == sizeof(mp_limb_t), as mp_limb_t is unsigned, therefore not representable as an intmax_t when the MSB is 1 (this is the case here). */ - MPFR_ASSERTD (sh < GMP_NUMB_BITS && -sh < GMP_NUMB_BITS); + MPFR_ASSERTD (-sh < GMP_NUMB_BITS); r += (sh >= 0 ? (intmax_t) xp[n] << sh : (intmax_t) (xp[n] >> (-sh))); @@ -104,10 +109,10 @@ else { /* See the comments for the case x positive. */ - for (n = MPFR_LIMB_SIZE (x) - 1; n >= 0 && sh >= 0; n--) + for (n = MPFR_LIMB_SIZE (x) - 1; n >= 0 && sh > 0; n--) { sh -= GMP_NUMB_BITS; - MPFR_ASSERTD (sh < GMP_NUMB_BITS && -sh < GMP_NUMB_BITS); + MPFR_ASSERTD (-sh < GMP_NUMB_BITS); r -= (sh >= 0 ? (intmax_t) xp[n] << sh : (intmax_t) (xp[n] >> (-sh))); @@ -117,6 +122,8 @@ mpfr_clear (x); + MPFR_SAVE_EXPO_FREE (expo); + return r; } diff -Nru mpfr4-3.1.4/src/get_str.c mpfr4-4.0.2/src/get_str.c --- mpfr4-3.1.4/src/get_str.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/get_str.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_get_str -- output a floating-point number to a string -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,10 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H +#include "mpfr-intmax.h" #include "mpfr-impl.h" static int mpfr_get_str_aux (char *const, mpfr_exp_t *const, mp_limb_t *const, @@ -47,15 +48,19 @@ #define MPFR_ROUND_FAILED 3 -/* Input: an approximation r*2^f of a real Y, with |r*2^f-Y| <= 2^(e+f). - Returns if possible in the string s the mantissa corresponding to - the integer nearest to Y, within the direction rnd, and returns the - exponent in exp. +/* Input: an approximation r*2^f to a real Y, with |r*2^f - Y| <= 2^(e+f). + + If rounding is possible, returns: + - in s: a string representing the significand corresponding to + the integer nearest to Y, within the direction rnd; + - in exp: the exponent. + n is the number of limbs of r. - e represents the maximal error in the approximation of Y - (e < 0 iff the approximation is exact, i.e., r*2^f = Y). - b is the wanted base (2 <= b <= 62). - m is the number of wanted digits in the mantissa. + e represents the maximal error in the approximation to Y (see above), + (e < 0 means that the approximation is known to be exact, i.e., + r*2^f = Y). + b is the wanted base (2 <= b <= 62 or -36 <= b <= -2). + m is the number of wanted digits in the significand. rnd is the rounding mode. It is assumed that b^(m-1) <= Y < b^(m+1), thus the returned value satisfies b^(m-1) <= rnd(Y) < b^(m+1). @@ -77,6 +82,7 @@ mpfr_rnd_t rnd) { const char *num_to_text; + int b0 = b; /* initial base (might be negative) */ int dir; /* direction of the rounded result */ mp_limb_t ret = 0; /* possible carry in addition */ mp_size_t i0, j0; /* number of limbs and bits of Y */ @@ -95,7 +101,8 @@ MPFR_TMP_MARK(marker); - num_to_text = b < 37 ? num_to_text36 : num_to_text62; + num_to_text = (2 <= b0 && b0 <= 36) ? num_to_text36 : num_to_text62; + b = (b0 > 0) ? b0 : -b0; /* R = 2^f sum r[i]K^(i) r[i] = (r_(i,k-1)...r_(i,0))_2 @@ -103,7 +110,7 @@ the bits from R are referenced by pairs (i,j) */ /* check if is possible to round r with rnd mode - where |r*2^f-Y| <= 2^(e+f) + where |r*2^f - Y| <= 2^(e+f) the exponent of R is: f + n*GMP_NUMB_BITS we must have e + f == f + n*GMP_NUMB_BITS - err err = n*GMP_NUMB_BITS - e @@ -111,8 +118,8 @@ to determine the nearest integer, we thus need a precision of n * GMP_NUMB_BITS + f */ - if (exact || mpfr_can_round_raw (r, n, (mp_size_t) 1, - n * GMP_NUMB_BITS - e, MPFR_RNDN, rnd, n * GMP_NUMB_BITS + f)) + if (exact || mpfr_round_p (r, n, n * GMP_NUMB_BITS - e, + n * GMP_NUMB_BITS + f + (rnd == MPFR_RNDN))) { /* compute the nearest integer to R */ @@ -124,9 +131,6 @@ n * GMP_NUMB_BITS + f, rnd, &dir); MPFR_ASSERTD(dir != MPFR_ROUND_FAILED); - /* warning: mpfr_round_raw_generic returns MPFR_EVEN_INEX (2) or - -MPFR_EVEN_INEX (-2) in case of even rounding */ - if (ret) /* Y is a power of 2 */ { if (j0) @@ -145,7 +149,7 @@ /* now the rounded value Y is in {r+i0, n-i0} */ - /* convert r+i0 into base b */ + /* convert r+i0 into base b: we use b0 which might be in -36..-2 */ str1 = (unsigned char*) MPFR_TMP_ALLOC (m + 3); /* need one extra character for mpn_get_str */ size_s1 = mpn_get_str (str1, b, r + i0, n - i0); @@ -240,17 +244,21 @@ /*************************************************************************** * __gmpfr_l2b[b-2][0] is a 23-bit upper approximation to log(b)/log(2), * - * __gmpfr_l2b[b-2][1] is a 76-bit upper approximation to log(2)/log(b). * + * __gmpfr_l2b[b-2][1] is a 77-bit upper approximation to log(2)/log(b). * * The following code is generated by tests/tl2b (with an argument). * ***************************************************************************/ +#ifndef UINT64_C +# define UINT64_C(c) c +#endif + #if 0 #elif GMP_NUMB_BITS == 16 const mp_limb_t mpfr_l2b_2_0__tab[] = { 0x0000, 0x8000 }; #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_2_0__tab[] = { 0x80000000 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_2_0__tab[] = { 0x8000000000000000 }; +const mp_limb_t mpfr_l2b_2_0__tab[] = { UINT64_C(0x8000000000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_2_0__tab[] = { 0x800000000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -265,7 +273,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_2_1__tab[] = { 0x00000000, 0x00000000, 0x80000000 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_2_1__tab[] = { 0x0000000000000000, 0x8000000000000000 }; +const mp_limb_t mpfr_l2b_2_1__tab[] = { UINT64_C(0x0000000000000000), UINT64_C(0x8000000000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_2_1__tab[] = { 0x800000000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -280,7 +288,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_3_0__tab[] = { 0xcae00e00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_3_0__tab[] = { 0xcae00e0000000000 }; +const mp_limb_t mpfr_l2b_3_0__tab[] = { UINT64_C(0xcae00e0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_3_0__tab[] = { 0xcae00e000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -295,7 +303,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_3_1__tab[] = { 0x04480000, 0xa9a9e94e, 0xa1849cc1 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_3_1__tab[] = { 0x0448000000000000, 0xa1849cc1a9a9e94e }; +const mp_limb_t mpfr_l2b_3_1__tab[] = { UINT64_C(0x0448000000000000), UINT64_C(0xa1849cc1a9a9e94e) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_3_1__tab[] = { 0xa1849cc1a9a9e94e04480000 }; #elif GMP_NUMB_BITS == 128 @@ -310,7 +318,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_4_0__tab[] = { 0x80000000 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_4_0__tab[] = { 0x8000000000000000 }; +const mp_limb_t mpfr_l2b_4_0__tab[] = { UINT64_C(0x8000000000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_4_0__tab[] = { 0x800000000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -325,7 +333,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_4_1__tab[] = { 0x00000000, 0x00000000, 0x80000000 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_4_1__tab[] = { 0x0000000000000000, 0x8000000000000000 }; +const mp_limb_t mpfr_l2b_4_1__tab[] = { UINT64_C(0x0000000000000000), UINT64_C(0x8000000000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_4_1__tab[] = { 0x800000000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -340,7 +348,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_5_0__tab[] = { 0x949a7a00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_5_0__tab[] = { 0x949a7a0000000000 }; +const mp_limb_t mpfr_l2b_5_0__tab[] = { UINT64_C(0x949a7a0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_5_0__tab[] = { 0x949a7a000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -355,7 +363,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_5_1__tab[] = { 0x67b80000, 0x287b9728, 0xdc81a348 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_5_1__tab[] = { 0x67b8000000000000, 0xdc81a348287b9728 }; +const mp_limb_t mpfr_l2b_5_1__tab[] = { UINT64_C(0x67b8000000000000), UINT64_C(0xdc81a348287b9728) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_5_1__tab[] = { 0xdc81a348287b972867b80000 }; #elif GMP_NUMB_BITS == 128 @@ -370,7 +378,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_6_0__tab[] = { 0xa5700800 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_6_0__tab[] = { 0xa570080000000000 }; +const mp_limb_t mpfr_l2b_6_0__tab[] = { UINT64_C(0xa570080000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_6_0__tab[] = { 0xa57008000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -385,7 +393,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_6_1__tab[] = { 0xff100000, 0xe054f9e9, 0xc6119236 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_6_1__tab[] = { 0xff10000000000000, 0xc6119236e054f9e9 }; +const mp_limb_t mpfr_l2b_6_1__tab[] = { UINT64_C(0xff10000000000000), UINT64_C(0xc6119236e054f9e9) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_6_1__tab[] = { 0xc6119236e054f9e9ff100000 }; #elif GMP_NUMB_BITS == 128 @@ -400,7 +408,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_7_0__tab[] = { 0xb3abb400 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_7_0__tab[] = { 0xb3abb40000000000 }; +const mp_limb_t mpfr_l2b_7_0__tab[] = { UINT64_C(0xb3abb40000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_7_0__tab[] = { 0xb3abb4000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -415,7 +423,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_7_1__tab[] = { 0x37b80000, 0x754da711, 0xb660c9d6 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_7_1__tab[] = { 0x37b8000000000000, 0xb660c9d6754da711 }; +const mp_limb_t mpfr_l2b_7_1__tab[] = { UINT64_C(0x37b8000000000000), UINT64_C(0xb660c9d6754da711) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_7_1__tab[] = { 0xb660c9d6754da71137b80000 }; #elif GMP_NUMB_BITS == 128 @@ -430,7 +438,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_8_0__tab[] = { 0xc0000000 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_8_0__tab[] = { 0xc000000000000000 }; +const mp_limb_t mpfr_l2b_8_0__tab[] = { UINT64_C(0xc000000000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_8_0__tab[] = { 0xc00000000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -445,7 +453,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_8_1__tab[] = { 0xaab00000, 0xaaaaaaaa, 0xaaaaaaaa }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_8_1__tab[] = { 0xaab0000000000000, 0xaaaaaaaaaaaaaaaa }; +const mp_limb_t mpfr_l2b_8_1__tab[] = { UINT64_C(0xaab0000000000000), UINT64_C(0xaaaaaaaaaaaaaaaa) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_8_1__tab[] = { 0xaaaaaaaaaaaaaaaaaab00000 }; #elif GMP_NUMB_BITS == 128 @@ -460,7 +468,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_9_0__tab[] = { 0xcae00e00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_9_0__tab[] = { 0xcae00e0000000000 }; +const mp_limb_t mpfr_l2b_9_0__tab[] = { UINT64_C(0xcae00e0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_9_0__tab[] = { 0xcae00e000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -475,7 +483,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_9_1__tab[] = { 0x04480000, 0xa9a9e94e, 0xa1849cc1 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_9_1__tab[] = { 0x0448000000000000, 0xa1849cc1a9a9e94e }; +const mp_limb_t mpfr_l2b_9_1__tab[] = { UINT64_C(0x0448000000000000), UINT64_C(0xa1849cc1a9a9e94e) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_9_1__tab[] = { 0xa1849cc1a9a9e94e04480000 }; #elif GMP_NUMB_BITS == 128 @@ -490,7 +498,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_10_0__tab[] = { 0xd49a7a00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_10_0__tab[] = { 0xd49a7a0000000000 }; +const mp_limb_t mpfr_l2b_10_0__tab[] = { UINT64_C(0xd49a7a0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_10_0__tab[] = { 0xd49a7a000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -505,7 +513,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_10_1__tab[] = { 0x8f900000, 0xfbcff798, 0x9a209a84 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_10_1__tab[] = { 0x8f90000000000000, 0x9a209a84fbcff798 }; +const mp_limb_t mpfr_l2b_10_1__tab[] = { UINT64_C(0x8f90000000000000), UINT64_C(0x9a209a84fbcff798) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_10_1__tab[] = { 0x9a209a84fbcff7988f900000 }; #elif GMP_NUMB_BITS == 128 @@ -520,7 +528,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_11_0__tab[] = { 0xdd675400 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_11_0__tab[] = { 0xdd67540000000000 }; +const mp_limb_t mpfr_l2b_11_0__tab[] = { UINT64_C(0xdd67540000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_11_0__tab[] = { 0xdd6754000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -535,7 +543,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_11_1__tab[] = { 0xe1700000, 0xeb229d10, 0x94004e0e }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_11_1__tab[] = { 0xe170000000000000, 0x94004e0eeb229d10 }; +const mp_limb_t mpfr_l2b_11_1__tab[] = { UINT64_C(0xe170000000000000), UINT64_C(0x94004e0eeb229d10) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_11_1__tab[] = { 0x94004e0eeb229d10e1700000 }; #elif GMP_NUMB_BITS == 128 @@ -550,7 +558,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_12_0__tab[] = { 0xe5700800 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_12_0__tab[] = { 0xe570080000000000 }; +const mp_limb_t mpfr_l2b_12_0__tab[] = { UINT64_C(0xe570080000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_12_0__tab[] = { 0xe57008000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -565,7 +573,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_12_1__tab[] = { 0xfe280000, 0x0b031c24, 0x8ed19c1a }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_12_1__tab[] = { 0xfe28000000000000, 0x8ed19c1a0b031c24 }; +const mp_limb_t mpfr_l2b_12_1__tab[] = { UINT64_C(0xfe28000000000000), UINT64_C(0x8ed19c1a0b031c24) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_12_1__tab[] = { 0x8ed19c1a0b031c24fe280000 }; #elif GMP_NUMB_BITS == 128 @@ -580,7 +588,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_13_0__tab[] = { 0xecd40200 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_13_0__tab[] = { 0xecd4020000000000 }; +const mp_limb_t mpfr_l2b_13_0__tab[] = { UINT64_C(0xecd4020000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_13_0__tab[] = { 0xecd402000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -595,7 +603,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_13_1__tab[] = { 0x57f80000, 0xcb20f7b4, 0x8a5ca7c6 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_13_1__tab[] = { 0x57f8000000000000, 0x8a5ca7c6cb20f7b4 }; +const mp_limb_t mpfr_l2b_13_1__tab[] = { UINT64_C(0x57f8000000000000), UINT64_C(0x8a5ca7c6cb20f7b4) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_13_1__tab[] = { 0x8a5ca7c6cb20f7b457f80000 }; #elif GMP_NUMB_BITS == 128 @@ -610,7 +618,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_14_0__tab[] = { 0xf3abb400 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_14_0__tab[] = { 0xf3abb40000000000 }; +const mp_limb_t mpfr_l2b_14_0__tab[] = { UINT64_C(0xf3abb40000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_14_0__tab[] = { 0xf3abb4000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -625,7 +633,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_14_1__tab[] = { 0x85a80000, 0x96b55cab, 0x8679fff6 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_14_1__tab[] = { 0x85a8000000000000, 0x8679fff696b55cab }; +const mp_limb_t mpfr_l2b_14_1__tab[] = { UINT64_C(0x85a8000000000000), UINT64_C(0x8679fff696b55cab) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_14_1__tab[] = { 0x8679fff696b55cab85a80000 }; #elif GMP_NUMB_BITS == 128 @@ -640,7 +648,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_15_0__tab[] = { 0xfa0a8000 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_15_0__tab[] = { 0xfa0a800000000000 }; +const mp_limb_t mpfr_l2b_15_0__tab[] = { UINT64_C(0xfa0a800000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_15_0__tab[] = { 0xfa0a80000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -655,7 +663,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_15_1__tab[] = { 0x6f800000, 0x69f0a6aa, 0x830cee23 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_15_1__tab[] = { 0x6f80000000000000, 0x830cee2369f0a6aa }; +const mp_limb_t mpfr_l2b_15_1__tab[] = { UINT64_C(0x6f80000000000000), UINT64_C(0x830cee2369f0a6aa) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_15_1__tab[] = { 0x830cee2369f0a6aa6f800000 }; #elif GMP_NUMB_BITS == 128 @@ -670,7 +678,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_16_0__tab[] = { 0x80000000 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_16_0__tab[] = { 0x8000000000000000 }; +const mp_limb_t mpfr_l2b_16_0__tab[] = { UINT64_C(0x8000000000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_16_0__tab[] = { 0x800000000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -685,7 +693,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_16_1__tab[] = { 0x00000000, 0x00000000, 0x80000000 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_16_1__tab[] = { 0x0000000000000000, 0x8000000000000000 }; +const mp_limb_t mpfr_l2b_16_1__tab[] = { UINT64_C(0x0000000000000000), UINT64_C(0x8000000000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_16_1__tab[] = { 0x800000000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -700,7 +708,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_17_0__tab[] = { 0x82cc8000 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_17_0__tab[] = { 0x82cc800000000000 }; +const mp_limb_t mpfr_l2b_17_0__tab[] = { UINT64_C(0x82cc800000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_17_0__tab[] = { 0x82cc80000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -715,7 +723,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_17_1__tab[] = { 0x87200000, 0x62c4259b, 0xfa85abf5 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_17_1__tab[] = { 0x8720000000000000, 0xfa85abf562c4259b }; +const mp_limb_t mpfr_l2b_17_1__tab[] = { UINT64_C(0x8720000000000000), UINT64_C(0xfa85abf562c4259b) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_17_1__tab[] = { 0xfa85abf562c4259b87200000 }; #elif GMP_NUMB_BITS == 128 @@ -730,7 +738,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_18_0__tab[] = { 0x85700800 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_18_0__tab[] = { 0x8570080000000000 }; +const mp_limb_t mpfr_l2b_18_0__tab[] = { UINT64_C(0x8570080000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_18_0__tab[] = { 0x857008000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -745,7 +753,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_18_1__tab[] = { 0x36980000, 0x55371378, 0xf5916634 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_18_1__tab[] = { 0x3698000000000000, 0xf591663455371378 }; +const mp_limb_t mpfr_l2b_18_1__tab[] = { UINT64_C(0x3698000000000000), UINT64_C(0xf591663455371378) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_18_1__tab[] = { 0xf59166345537137836980000 }; #elif GMP_NUMB_BITS == 128 @@ -760,7 +768,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_19_0__tab[] = { 0x87ef0600 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_19_0__tab[] = { 0x87ef060000000000 }; +const mp_limb_t mpfr_l2b_19_0__tab[] = { UINT64_C(0x87ef060000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_19_0__tab[] = { 0x87ef06000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -775,7 +783,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_19_1__tab[] = { 0x0db80000, 0x62ed558c, 0xf10f08c0 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_19_1__tab[] = { 0x0db8000000000000, 0xf10f08c062ed558c }; +const mp_limb_t mpfr_l2b_19_1__tab[] = { UINT64_C(0x0db8000000000000), UINT64_C(0xf10f08c062ed558c) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_19_1__tab[] = { 0xf10f08c062ed558c0db80000 }; #elif GMP_NUMB_BITS == 128 @@ -790,7 +798,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_20_0__tab[] = { 0x8a4d3e00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_20_0__tab[] = { 0x8a4d3e0000000000 }; +const mp_limb_t mpfr_l2b_20_0__tab[] = { UINT64_C(0x8a4d3e0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_20_0__tab[] = { 0x8a4d3e000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -805,7 +813,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_20_1__tab[] = { 0x0b400000, 0x1cc1a71c, 0xecee690a }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_20_1__tab[] = { 0x0b40000000000000, 0xecee690a1cc1a71c }; +const mp_limb_t mpfr_l2b_20_1__tab[] = { UINT64_C(0x0b40000000000000), UINT64_C(0xecee690a1cc1a71c) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_20_1__tab[] = { 0xecee690a1cc1a71c0b400000 }; #elif GMP_NUMB_BITS == 128 @@ -820,7 +828,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_21_0__tab[] = { 0x8c8dde00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_21_0__tab[] = { 0x8c8dde0000000000 }; +const mp_limb_t mpfr_l2b_21_0__tab[] = { UINT64_C(0x8c8dde0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_21_0__tab[] = { 0x8c8dde000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -835,7 +843,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_21_1__tab[] = { 0x41080000, 0xb3d06b26, 0xe92263c1 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_21_1__tab[] = { 0x4108000000000000, 0xe92263c1b3d06b26 }; +const mp_limb_t mpfr_l2b_21_1__tab[] = { UINT64_C(0x4108000000000000), UINT64_C(0xe92263c1b3d06b26) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_21_1__tab[] = { 0xe92263c1b3d06b2641080000 }; #elif GMP_NUMB_BITS == 128 @@ -850,7 +858,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_22_0__tab[] = { 0x8eb3aa00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_22_0__tab[] = { 0x8eb3aa0000000000 }; +const mp_limb_t mpfr_l2b_22_0__tab[] = { UINT64_C(0x8eb3aa0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_22_0__tab[] = { 0x8eb3aa000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -865,7 +873,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_22_1__tab[] = { 0xdbe80000, 0x60b9f061, 0xe5a02c4d }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_22_1__tab[] = { 0xdbe8000000000000, 0xe5a02c4d60b9f061 }; +const mp_limb_t mpfr_l2b_22_1__tab[] = { UINT64_C(0xdbe8000000000000), UINT64_C(0xe5a02c4d60b9f061) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_22_1__tab[] = { 0xe5a02c4d60b9f061dbe80000 }; #elif GMP_NUMB_BITS == 128 @@ -880,7 +888,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_23_0__tab[] = { 0x90c10600 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_23_0__tab[] = { 0x90c1060000000000 }; +const mp_limb_t mpfr_l2b_23_0__tab[] = { UINT64_C(0x90c1060000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_23_0__tab[] = { 0x90c106000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -895,7 +903,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_23_1__tab[] = { 0xc3e00000, 0x46b9586a, 0xe25ecadd }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_23_1__tab[] = { 0xc3e0000000000000, 0xe25ecadd46b9586a }; +const mp_limb_t mpfr_l2b_23_1__tab[] = { UINT64_C(0xc3e0000000000000), UINT64_C(0xe25ecadd46b9586a) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_23_1__tab[] = { 0xe25ecadd46b9586ac3e00000 }; #elif GMP_NUMB_BITS == 128 @@ -910,7 +918,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_24_0__tab[] = { 0x92b80400 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_24_0__tab[] = { 0x92b8040000000000 }; +const mp_limb_t mpfr_l2b_24_0__tab[] = { UINT64_C(0x92b8040000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_24_0__tab[] = { 0x92b804000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -925,7 +933,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_24_1__tab[] = { 0x36680000, 0xc7c67263, 0xdf56bb44 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_24_1__tab[] = { 0x3668000000000000, 0xdf56bb44c7c67263 }; +const mp_limb_t mpfr_l2b_24_1__tab[] = { UINT64_C(0x3668000000000000), UINT64_C(0xdf56bb44c7c67263) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_24_1__tab[] = { 0xdf56bb44c7c6726336680000 }; #elif GMP_NUMB_BITS == 128 @@ -940,7 +948,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_25_0__tab[] = { 0x949a7a00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_25_0__tab[] = { 0x949a7a0000000000 }; +const mp_limb_t mpfr_l2b_25_0__tab[] = { UINT64_C(0x949a7a0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_25_0__tab[] = { 0x949a7a000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -955,7 +963,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_25_1__tab[] = { 0x67b80000, 0x287b9728, 0xdc81a348 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_25_1__tab[] = { 0x67b8000000000000, 0xdc81a348287b9728 }; +const mp_limb_t mpfr_l2b_25_1__tab[] = { UINT64_C(0x67b8000000000000), UINT64_C(0xdc81a348287b9728) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_25_1__tab[] = { 0xdc81a348287b972867b80000 }; #elif GMP_NUMB_BITS == 128 @@ -970,7 +978,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_26_0__tab[] = { 0x966a0200 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_26_0__tab[] = { 0x966a020000000000 }; +const mp_limb_t mpfr_l2b_26_0__tab[] = { UINT64_C(0x966a020000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_26_0__tab[] = { 0x966a02000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -985,7 +993,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_26_1__tab[] = { 0x64580000, 0x758378a4, 0xd9da19f9 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_26_1__tab[] = { 0x6458000000000000, 0xd9da19f9758378a4 }; +const mp_limb_t mpfr_l2b_26_1__tab[] = { UINT64_C(0x6458000000000000), UINT64_C(0xd9da19f9758378a4) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_26_1__tab[] = { 0xd9da19f9758378a464580000 }; #elif GMP_NUMB_BITS == 128 @@ -1000,7 +1008,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_27_0__tab[] = { 0x98280a00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_27_0__tab[] = { 0x98280a0000000000 }; +const mp_limb_t mpfr_l2b_27_0__tab[] = { UINT64_C(0x98280a0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_27_0__tab[] = { 0x98280a000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1015,7 +1023,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_27_1__tab[] = { 0x5b080000, 0xe237e1bd, 0xd75b7bac }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_27_1__tab[] = { 0x5b08000000000000, 0xd75b7bace237e1bd }; +const mp_limb_t mpfr_l2b_27_1__tab[] = { UINT64_C(0x5b08000000000000), UINT64_C(0xd75b7bace237e1bd) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_27_1__tab[] = { 0xd75b7bace237e1bd5b080000 }; #elif GMP_NUMB_BITS == 128 @@ -1030,7 +1038,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_28_0__tab[] = { 0x99d5da00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_28_0__tab[] = { 0x99d5da0000000000 }; +const mp_limb_t mpfr_l2b_28_0__tab[] = { UINT64_C(0x99d5da0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_28_0__tab[] = { 0x99d5da000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1045,7 +1053,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_28_1__tab[] = { 0xdeb80000, 0x71dfe8b8, 0xd501c758 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_28_1__tab[] = { 0xdeb8000000000000, 0xd501c75871dfe8b8 }; +const mp_limb_t mpfr_l2b_28_1__tab[] = { UINT64_C(0xdeb8000000000000), UINT64_C(0xd501c75871dfe8b8) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_28_1__tab[] = { 0xd501c75871dfe8b8deb80000 }; #elif GMP_NUMB_BITS == 128 @@ -1060,7 +1068,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_29_0__tab[] = { 0x9b749600 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_29_0__tab[] = { 0x9b74960000000000 }; +const mp_limb_t mpfr_l2b_29_0__tab[] = { UINT64_C(0x9b74960000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_29_0__tab[] = { 0x9b7496000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1075,7 +1083,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_29_1__tab[] = { 0xccc80000, 0x9c6c62b3, 0xd2c98315 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_29_1__tab[] = { 0xccc8000000000000, 0xd2c983159c6c62b3 }; +const mp_limb_t mpfr_l2b_29_1__tab[] = { UINT64_C(0xccc8000000000000), UINT64_C(0xd2c983159c6c62b3) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_29_1__tab[] = { 0xd2c983159c6c62b3ccc80000 }; #elif GMP_NUMB_BITS == 128 @@ -1090,7 +1098,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_30_0__tab[] = { 0x9d054000 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_30_0__tab[] = { 0x9d05400000000000 }; +const mp_limb_t mpfr_l2b_30_0__tab[] = { UINT64_C(0x9d05400000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_30_0__tab[] = { 0x9d0540000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1105,7 +1113,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_30_1__tab[] = { 0x35880000, 0x5cad1732, 0xd0afa619 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_30_1__tab[] = { 0x3588000000000000, 0xd0afa6195cad1732 }; +const mp_limb_t mpfr_l2b_30_1__tab[] = { UINT64_C(0x3588000000000000), UINT64_C(0xd0afa6195cad1732) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_30_1__tab[] = { 0xd0afa6195cad173235880000 }; #elif GMP_NUMB_BITS == 128 @@ -1120,7 +1128,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_31_0__tab[] = { 0x9e88c800 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_31_0__tab[] = { 0x9e88c80000000000 }; +const mp_limb_t mpfr_l2b_31_0__tab[] = { UINT64_C(0x9e88c80000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_31_0__tab[] = { 0x9e88c8000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1135,7 +1143,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_31_1__tab[] = { 0xd5780000, 0x63eef7ca, 0xceb186e6 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_31_1__tab[] = { 0xd578000000000000, 0xceb186e663eef7ca }; +const mp_limb_t mpfr_l2b_31_1__tab[] = { UINT64_C(0xd578000000000000), UINT64_C(0xceb186e663eef7ca) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_31_1__tab[] = { 0xceb186e663eef7cad5780000 }; #elif GMP_NUMB_BITS == 128 @@ -1150,7 +1158,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_32_0__tab[] = { 0xa0000000 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_32_0__tab[] = { 0xa000000000000000 }; +const mp_limb_t mpfr_l2b_32_0__tab[] = { UINT64_C(0xa000000000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_32_0__tab[] = { 0xa00000000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1165,7 +1173,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_32_1__tab[] = { 0xccd00000, 0xcccccccc, 0xcccccccc }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_32_1__tab[] = { 0xccd0000000000000, 0xcccccccccccccccc }; +const mp_limb_t mpfr_l2b_32_1__tab[] = { UINT64_C(0xccd0000000000000), UINT64_C(0xcccccccccccccccc) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_32_1__tab[] = { 0xccccccccccccccccccd00000 }; #elif GMP_NUMB_BITS == 128 @@ -1180,7 +1188,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_33_0__tab[] = { 0xa16bae00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_33_0__tab[] = { 0xa16bae0000000000 }; +const mp_limb_t mpfr_l2b_33_0__tab[] = { UINT64_C(0xa16bae0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_33_0__tab[] = { 0xa16bae000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1195,7 +1203,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_33_1__tab[] = { 0x08880000, 0x5304a187, 0xcaff6404 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_33_1__tab[] = { 0x0888000000000000, 0xcaff64045304a187 }; +const mp_limb_t mpfr_l2b_33_1__tab[] = { UINT64_C(0x0888000000000000), UINT64_C(0xcaff64045304a187) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_33_1__tab[] = { 0xcaff64045304a18708880000 }; #elif GMP_NUMB_BITS == 128 @@ -1210,7 +1218,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_34_0__tab[] = { 0xa2cc8000 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_34_0__tab[] = { 0xa2cc800000000000 }; +const mp_limb_t mpfr_l2b_34_0__tab[] = { UINT64_C(0xa2cc800000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_34_0__tab[] = { 0xa2cc80000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1225,7 +1233,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_34_1__tab[] = { 0xfb500000, 0x5a7917ca, 0xc94773d8 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_34_1__tab[] = { 0xfb50000000000000, 0xc94773d85a7917ca }; +const mp_limb_t mpfr_l2b_34_1__tab[] = { UINT64_C(0xfb50000000000000), UINT64_C(0xc94773d85a7917ca) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_34_1__tab[] = { 0xc94773d85a7917cafb500000 }; #elif GMP_NUMB_BITS == 128 @@ -1240,7 +1248,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_35_0__tab[] = { 0xa4231800 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_35_0__tab[] = { 0xa423180000000000 }; +const mp_limb_t mpfr_l2b_35_0__tab[] = { UINT64_C(0xa423180000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_35_0__tab[] = { 0xa42318000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1255,7 +1263,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_35_1__tab[] = { 0x69600000, 0x603718c2, 0xc7a3567c }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_35_1__tab[] = { 0x6960000000000000, 0xc7a3567c603718c2 }; +const mp_limb_t mpfr_l2b_35_1__tab[] = { UINT64_C(0x6960000000000000), UINT64_C(0xc7a3567c603718c2) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_35_1__tab[] = { 0xc7a3567c603718c269600000 }; #elif GMP_NUMB_BITS == 128 @@ -1270,7 +1278,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_36_0__tab[] = { 0xa5700800 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_36_0__tab[] = { 0xa570080000000000 }; +const mp_limb_t mpfr_l2b_36_0__tab[] = { UINT64_C(0xa570080000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_36_0__tab[] = { 0xa57008000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1285,7 +1293,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_36_1__tab[] = { 0xff100000, 0xe054f9e9, 0xc6119236 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_36_1__tab[] = { 0xff10000000000000, 0xc6119236e054f9e9 }; +const mp_limb_t mpfr_l2b_36_1__tab[] = { UINT64_C(0xff10000000000000), UINT64_C(0xc6119236e054f9e9) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_36_1__tab[] = { 0xc6119236e054f9e9ff100000 }; #elif GMP_NUMB_BITS == 128 @@ -1300,7 +1308,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_37_0__tab[] = { 0xa6b3d800 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_37_0__tab[] = { 0xa6b3d80000000000 }; +const mp_limb_t mpfr_l2b_37_0__tab[] = { UINT64_C(0xa6b3d80000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_37_0__tab[] = { 0xa6b3d8000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1315,7 +1323,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_37_1__tab[] = { 0x16180000, 0x70d76b36, 0xc490d3a2 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_37_1__tab[] = { 0x1618000000000000, 0xc490d3a270d76b36 }; +const mp_limb_t mpfr_l2b_37_1__tab[] = { UINT64_C(0x1618000000000000), UINT64_C(0xc490d3a270d76b36) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_37_1__tab[] = { 0xc490d3a270d76b3616180000 }; #elif GMP_NUMB_BITS == 128 @@ -1330,7 +1338,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_38_0__tab[] = { 0xa7ef0600 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_38_0__tab[] = { 0xa7ef060000000000 }; +const mp_limb_t mpfr_l2b_38_0__tab[] = { UINT64_C(0xa7ef060000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_38_0__tab[] = { 0xa7ef06000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1345,7 +1353,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_38_1__tab[] = { 0xa3e00000, 0x51829505, 0xc31fe8d2 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_38_1__tab[] = { 0xa3e0000000000000, 0xc31fe8d251829505 }; +const mp_limb_t mpfr_l2b_38_1__tab[] = { UINT64_C(0xa3e0000000000000), UINT64_C(0xc31fe8d251829505) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_38_1__tab[] = { 0xc31fe8d251829505a3e00000 }; #elif GMP_NUMB_BITS == 128 @@ -1360,7 +1368,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_39_0__tab[] = { 0xa9220400 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_39_0__tab[] = { 0xa922040000000000 }; +const mp_limb_t mpfr_l2b_39_0__tab[] = { UINT64_C(0xa922040000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_39_0__tab[] = { 0xa92204000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1375,7 +1383,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_39_1__tab[] = { 0xfcf80000, 0x10caf1b5, 0xc1bdbd32 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_39_1__tab[] = { 0xfcf8000000000000, 0xc1bdbd3210caf1b5 }; +const mp_limb_t mpfr_l2b_39_1__tab[] = { UINT64_C(0xfcf8000000000000), UINT64_C(0xc1bdbd3210caf1b5) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_39_1__tab[] = { 0xc1bdbd3210caf1b5fcf80000 }; #elif GMP_NUMB_BITS == 128 @@ -1390,7 +1398,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_40_0__tab[] = { 0xaa4d3e00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_40_0__tab[] = { 0xaa4d3e0000000000 }; +const mp_limb_t mpfr_l2b_40_0__tab[] = { UINT64_C(0xaa4d3e0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_40_0__tab[] = { 0xaa4d3e000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1405,7 +1413,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_40_1__tab[] = { 0xdce80000, 0xeff74948, 0xc06955ff }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_40_1__tab[] = { 0xdce8000000000000, 0xc06955ffeff74948 }; +const mp_limb_t mpfr_l2b_40_1__tab[] = { UINT64_C(0xdce8000000000000), UINT64_C(0xc06955ffeff74948) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_40_1__tab[] = { 0xc06955ffeff74948dce80000 }; #elif GMP_NUMB_BITS == 128 @@ -1420,7 +1428,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_41_0__tab[] = { 0xab711200 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_41_0__tab[] = { 0xab71120000000000 }; +const mp_limb_t mpfr_l2b_41_0__tab[] = { UINT64_C(0xab71120000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_41_0__tab[] = { 0xab7112000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1435,7 +1443,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_41_1__tab[] = { 0xdc280000, 0xf6957cef, 0xbf21cf47 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_41_1__tab[] = { 0xdc28000000000000, 0xbf21cf47f6957cef }; +const mp_limb_t mpfr_l2b_41_1__tab[] = { UINT64_C(0xdc28000000000000), UINT64_C(0xbf21cf47f6957cef) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_41_1__tab[] = { 0xbf21cf47f6957cefdc280000 }; #elif GMP_NUMB_BITS == 128 @@ -1450,7 +1458,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_42_0__tab[] = { 0xac8dde00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_42_0__tab[] = { 0xac8dde0000000000 }; +const mp_limb_t mpfr_l2b_42_0__tab[] = { UINT64_C(0xac8dde0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_42_0__tab[] = { 0xac8dde000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1465,7 +1473,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_42_1__tab[] = { 0xba100000, 0x939b7125, 0xbde6594a }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_42_1__tab[] = { 0xba10000000000000, 0xbde6594a939b7125 }; +const mp_limb_t mpfr_l2b_42_1__tab[] = { UINT64_C(0xba10000000000000), UINT64_C(0xbde6594a939b7125) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_42_1__tab[] = { 0xbde6594a939b7125ba100000 }; #elif GMP_NUMB_BITS == 128 @@ -1480,7 +1488,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_43_0__tab[] = { 0xada3f600 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_43_0__tab[] = { 0xada3f60000000000 }; +const mp_limb_t mpfr_l2b_43_0__tab[] = { UINT64_C(0xada3f60000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_43_0__tab[] = { 0xada3f6000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1495,7 +1503,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_43_1__tab[] = { 0x95600000, 0x91182ab5, 0xbcb6363d }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_43_1__tab[] = { 0x9560000000000000, 0xbcb6363d91182ab5 }; +const mp_limb_t mpfr_l2b_43_1__tab[] = { UINT64_C(0x9560000000000000), UINT64_C(0xbcb6363d91182ab5) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_43_1__tab[] = { 0xbcb6363d91182ab595600000 }; #elif GMP_NUMB_BITS == 128 @@ -1510,7 +1518,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_44_0__tab[] = { 0xaeb3aa00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_44_0__tab[] = { 0xaeb3aa0000000000 }; +const mp_limb_t mpfr_l2b_44_0__tab[] = { UINT64_C(0xaeb3aa0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_44_0__tab[] = { 0xaeb3aa000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1525,7 +1533,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_44_1__tab[] = { 0x15900000, 0x3a3d4e90, 0xbb90b859 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_44_1__tab[] = { 0x1590000000000000, 0xbb90b8593a3d4e90 }; +const mp_limb_t mpfr_l2b_44_1__tab[] = { UINT64_C(0x1590000000000000), UINT64_C(0xbb90b8593a3d4e90) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_44_1__tab[] = { 0xbb90b8593a3d4e9015900000 }; #elif GMP_NUMB_BITS == 128 @@ -1540,7 +1548,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_45_0__tab[] = { 0xafbd4400 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_45_0__tab[] = { 0xafbd440000000000 }; +const mp_limb_t mpfr_l2b_45_0__tab[] = { UINT64_C(0xafbd440000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_45_0__tab[] = { 0xafbd44000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1555,7 +1563,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_45_1__tab[] = { 0x1e780000, 0x101076f5, 0xba754026 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_45_1__tab[] = { 0x1e78000000000000, 0xba754026101076f5 }; +const mp_limb_t mpfr_l2b_45_1__tab[] = { UINT64_C(0x1e78000000000000), UINT64_C(0xba754026101076f5) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_45_1__tab[] = { 0xba754026101076f51e780000 }; #elif GMP_NUMB_BITS == 128 @@ -1570,7 +1578,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_46_0__tab[] = { 0xb0c10600 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_46_0__tab[] = { 0xb0c1060000000000 }; +const mp_limb_t mpfr_l2b_46_0__tab[] = { UINT64_C(0xb0c1060000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_46_0__tab[] = { 0xb0c106000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1585,7 +1593,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_46_1__tab[] = { 0xb6700000, 0x69aa0512, 0xb9633b01 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_46_1__tab[] = { 0xb670000000000000, 0xb9633b0169aa0512 }; +const mp_limb_t mpfr_l2b_46_1__tab[] = { UINT64_C(0xb670000000000000), UINT64_C(0xb9633b0169aa0512) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_46_1__tab[] = { 0xb9633b0169aa0512b6700000 }; #elif GMP_NUMB_BITS == 128 @@ -1600,7 +1608,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_47_0__tab[] = { 0xb1bf3200 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_47_0__tab[] = { 0xb1bf320000000000 }; +const mp_limb_t mpfr_l2b_47_0__tab[] = { UINT64_C(0xb1bf320000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_47_0__tab[] = { 0xb1bf32000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1615,7 +1623,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_47_1__tab[] = { 0x51180000, 0xfbe44133, 0xb85a21d0 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_47_1__tab[] = { 0x5118000000000000, 0xb85a21d0fbe44133 }; +const mp_limb_t mpfr_l2b_47_1__tab[] = { UINT64_C(0x5118000000000000), UINT64_C(0xb85a21d0fbe44133) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_47_1__tab[] = { 0xb85a21d0fbe4413351180000 }; #elif GMP_NUMB_BITS == 128 @@ -1630,7 +1638,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_48_0__tab[] = { 0xb2b80400 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_48_0__tab[] = { 0xb2b8040000000000 }; +const mp_limb_t mpfr_l2b_48_0__tab[] = { UINT64_C(0xb2b8040000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_48_0__tab[] = { 0xb2b804000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1645,7 +1653,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_48_1__tab[] = { 0x04900000, 0x960d663d, 0xb75977de }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_48_1__tab[] = { 0x0490000000000000, 0xb75977de960d663d }; +const mp_limb_t mpfr_l2b_48_1__tab[] = { UINT64_C(0x0490000000000000), UINT64_C(0xb75977de960d663d) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_48_1__tab[] = { 0xb75977de960d663d04900000 }; #elif GMP_NUMB_BITS == 128 @@ -1660,7 +1668,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_49_0__tab[] = { 0xb3abb400 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_49_0__tab[] = { 0xb3abb40000000000 }; +const mp_limb_t mpfr_l2b_49_0__tab[] = { UINT64_C(0xb3abb40000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_49_0__tab[] = { 0xb3abb4000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1675,7 +1683,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_49_1__tab[] = { 0x37b80000, 0x754da711, 0xb660c9d6 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_49_1__tab[] = { 0x37b8000000000000, 0xb660c9d6754da711 }; +const mp_limb_t mpfr_l2b_49_1__tab[] = { UINT64_C(0x37b8000000000000), UINT64_C(0xb660c9d6754da711) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_49_1__tab[] = { 0xb660c9d6754da71137b80000 }; #elif GMP_NUMB_BITS == 128 @@ -1690,7 +1698,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_50_0__tab[] = { 0xb49a7a00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_50_0__tab[] = { 0xb49a7a0000000000 }; +const mp_limb_t mpfr_l2b_50_0__tab[] = { UINT64_C(0xb49a7a0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_50_0__tab[] = { 0xb49a7a000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1705,7 +1713,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_50_1__tab[] = { 0x27f00000, 0x7344e532, 0xb56face3 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_50_1__tab[] = { 0x27f0000000000000, 0xb56face37344e532 }; +const mp_limb_t mpfr_l2b_50_1__tab[] = { UINT64_C(0x27f0000000000000), UINT64_C(0xb56face37344e532) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_50_1__tab[] = { 0xb56face37344e53227f00000 }; #elif GMP_NUMB_BITS == 128 @@ -1720,7 +1728,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_51_0__tab[] = { 0xb5848400 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_51_0__tab[] = { 0xb584840000000000 }; +const mp_limb_t mpfr_l2b_51_0__tab[] = { UINT64_C(0xb584840000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_51_0__tab[] = { 0xb58484000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1735,7 +1743,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_51_1__tab[] = { 0x40000000, 0x0f8ae9a9, 0xb485bde5 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_51_1__tab[] = { 0x4000000000000000, 0xb485bde50f8ae9a9 }; +const mp_limb_t mpfr_l2b_51_1__tab[] = { UINT64_C(0x4000000000000000), UINT64_C(0xb485bde50f8ae9a9) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_51_1__tab[] = { 0xb485bde50f8ae9a940000000 }; #elif GMP_NUMB_BITS == 128 @@ -1750,7 +1758,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_52_0__tab[] = { 0xb66a0200 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_52_0__tab[] = { 0xb66a020000000000 }; +const mp_limb_t mpfr_l2b_52_0__tab[] = { UINT64_C(0xb66a020000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_52_0__tab[] = { 0xb66a02000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1765,7 +1773,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_52_1__tab[] = { 0x46080000, 0xeecffcb3, 0xb3a2a0bb }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_52_1__tab[] = { 0x4608000000000000, 0xb3a2a0bbeecffcb3 }; +const mp_limb_t mpfr_l2b_52_1__tab[] = { UINT64_C(0x4608000000000000), UINT64_C(0xb3a2a0bbeecffcb3) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_52_1__tab[] = { 0xb3a2a0bbeecffcb346080000 }; #elif GMP_NUMB_BITS == 128 @@ -1780,7 +1788,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_53_0__tab[] = { 0xb74b2000 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_53_0__tab[] = { 0xb74b200000000000 }; +const mp_limb_t mpfr_l2b_53_0__tab[] = { UINT64_C(0xb74b200000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_53_0__tab[] = { 0xb74b20000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1795,7 +1803,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_53_1__tab[] = { 0xa3600000, 0xeb5f8ccb, 0xb2c5ffa9 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_53_1__tab[] = { 0xa360000000000000, 0xb2c5ffa9eb5f8ccb }; +const mp_limb_t mpfr_l2b_53_1__tab[] = { UINT64_C(0xa360000000000000), UINT64_C(0xb2c5ffa9eb5f8ccb) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_53_1__tab[] = { 0xb2c5ffa9eb5f8ccba3600000 }; #elif GMP_NUMB_BITS == 128 @@ -1810,7 +1818,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_54_0__tab[] = { 0xb8280a00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_54_0__tab[] = { 0xb8280a0000000000 }; +const mp_limb_t mpfr_l2b_54_0__tab[] = { UINT64_C(0xb8280a0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_54_0__tab[] = { 0xb8280a000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1825,7 +1833,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_54_1__tab[] = { 0xf3680000, 0x3e86e940, 0xb1ef8ac3 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_54_1__tab[] = { 0xf368000000000000, 0xb1ef8ac33e86e940 }; +const mp_limb_t mpfr_l2b_54_1__tab[] = { UINT64_C(0xf368000000000000), UINT64_C(0xb1ef8ac33e86e940) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_54_1__tab[] = { 0xb1ef8ac33e86e940f3680000 }; #elif GMP_NUMB_BITS == 128 @@ -1840,7 +1848,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_55_0__tab[] = { 0xb900e800 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_55_0__tab[] = { 0xb900e80000000000 }; +const mp_limb_t mpfr_l2b_55_0__tab[] = { UINT64_C(0xb900e80000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_55_0__tab[] = { 0xb900e8000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1855,7 +1863,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_55_1__tab[] = { 0x7a400000, 0xa4b5d18e, 0xb11ef76e }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_55_1__tab[] = { 0x7a40000000000000, 0xb11ef76ea4b5d18e }; +const mp_limb_t mpfr_l2b_55_1__tab[] = { UINT64_C(0x7a40000000000000), UINT64_C(0xb11ef76ea4b5d18e) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_55_1__tab[] = { 0xb11ef76ea4b5d18e7a400000 }; #elif GMP_NUMB_BITS == 128 @@ -1870,7 +1878,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_56_0__tab[] = { 0xb9d5da00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_56_0__tab[] = { 0xb9d5da0000000000 }; +const mp_limb_t mpfr_l2b_56_0__tab[] = { UINT64_C(0xb9d5da0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_56_0__tab[] = { 0xb9d5da000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1885,7 +1893,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_56_1__tab[] = { 0xe8180000, 0xaa2c4c7b, 0xb053fff2 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_56_1__tab[] = { 0xe818000000000000, 0xb053fff2aa2c4c7b }; +const mp_limb_t mpfr_l2b_56_1__tab[] = { UINT64_C(0xe818000000000000), UINT64_C(0xb053fff2aa2c4c7b) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_56_1__tab[] = { 0xb053fff2aa2c4c7be8180000 }; #elif GMP_NUMB_BITS == 128 @@ -1900,7 +1908,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_57_0__tab[] = { 0xbaa70a00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_57_0__tab[] = { 0xbaa70a0000000000 }; +const mp_limb_t mpfr_l2b_57_0__tab[] = { UINT64_C(0xbaa70a0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_57_0__tab[] = { 0xbaa70a000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1915,7 +1923,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_57_1__tab[] = { 0xefb00000, 0x8e2f814f, 0xaf8e630e }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_57_1__tab[] = { 0xefb0000000000000, 0xaf8e630e8e2f814f }; +const mp_limb_t mpfr_l2b_57_1__tab[] = { UINT64_C(0xefb0000000000000), UINT64_C(0xaf8e630e8e2f814f) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_57_1__tab[] = { 0xaf8e630e8e2f814fefb00000 }; #elif GMP_NUMB_BITS == 128 @@ -1930,7 +1938,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_58_0__tab[] = { 0xbb749600 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_58_0__tab[] = { 0xbb74960000000000 }; +const mp_limb_t mpfr_l2b_58_0__tab[] = { UINT64_C(0xbb74960000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_58_0__tab[] = { 0xbb7496000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1945,7 +1953,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_58_1__tab[] = { 0x5d180000, 0x611441a1, 0xaecde39d }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_58_1__tab[] = { 0x5d18000000000000, 0xaecde39d611441a1 }; +const mp_limb_t mpfr_l2b_58_1__tab[] = { UINT64_C(0x5d18000000000000), UINT64_C(0xaecde39d611441a1) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_58_1__tab[] = { 0xaecde39d611441a15d180000 }; #elif GMP_NUMB_BITS == 128 @@ -1960,7 +1968,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_59_0__tab[] = { 0xbc3e9e00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_59_0__tab[] = { 0xbc3e9e0000000000 }; +const mp_limb_t mpfr_l2b_59_0__tab[] = { UINT64_C(0xbc3e9e0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_59_0__tab[] = { 0xbc3e9e000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -1975,7 +1983,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_59_1__tab[] = { 0xd0000000, 0x2f9797df, 0xae124842 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_59_1__tab[] = { 0xd000000000000000, 0xae1248422f9797df }; +const mp_limb_t mpfr_l2b_59_1__tab[] = { UINT64_C(0xd000000000000000), UINT64_C(0xae1248422f9797df) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_59_1__tab[] = { 0xae1248422f9797dfd0000000 }; #elif GMP_NUMB_BITS == 128 @@ -1990,7 +1998,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_60_0__tab[] = { 0xbd054000 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_60_0__tab[] = { 0xbd05400000000000 }; +const mp_limb_t mpfr_l2b_60_0__tab[] = { UINT64_C(0xbd05400000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_60_0__tab[] = { 0xbd0540000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -2005,7 +2013,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_60_1__tab[] = { 0xfe580000, 0x3555206d, 0xad5b5b1c }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_60_1__tab[] = { 0xfe58000000000000, 0xad5b5b1c3555206d }; +const mp_limb_t mpfr_l2b_60_1__tab[] = { UINT64_C(0xfe58000000000000), UINT64_C(0xad5b5b1c3555206d) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_60_1__tab[] = { 0xad5b5b1c3555206dfe580000 }; #elif GMP_NUMB_BITS == 128 @@ -2020,7 +2028,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_61_0__tab[] = { 0xbdc89a00 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_61_0__tab[] = { 0xbdc89a0000000000 }; +const mp_limb_t mpfr_l2b_61_0__tab[] = { UINT64_C(0xbdc89a0000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_61_0__tab[] = { 0xbdc89a000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -2035,7 +2043,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_61_1__tab[] = { 0x4df80000, 0x31cb7757, 0xaca8e982 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_61_1__tab[] = { 0x4df8000000000000, 0xaca8e98231cb7757 }; +const mp_limb_t mpfr_l2b_61_1__tab[] = { UINT64_C(0x4df8000000000000), UINT64_C(0xaca8e98231cb7757) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_61_1__tab[] = { 0xaca8e98231cb77574df80000 }; #elif GMP_NUMB_BITS == 128 @@ -2050,7 +2058,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_62_0__tab[] = { 0xbe88c800 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_62_0__tab[] = { 0xbe88c80000000000 }; +const mp_limb_t mpfr_l2b_62_0__tab[] = { UINT64_C(0xbe88c80000000000) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_62_0__tab[] = { 0xbe88c8000000000000000000 }; #elif GMP_NUMB_BITS == 128 @@ -2065,7 +2073,7 @@ #elif GMP_NUMB_BITS == 32 const mp_limb_t mpfr_l2b_62_1__tab[] = { 0x74f80000, 0x1831f905, 0xabfac3c4 }; #elif GMP_NUMB_BITS == 64 -const mp_limb_t mpfr_l2b_62_1__tab[] = { 0x74f8000000000000, 0xabfac3c41831f905 }; +const mp_limb_t mpfr_l2b_62_1__tab[] = { UINT64_C(0x74f8000000000000), UINT64_C(0xabfac3c41831f905) }; #elif GMP_NUMB_BITS == 96 const mp_limb_t mpfr_l2b_62_1__tab[] = { 0xabfac3c41831f90574f80000 }; #elif GMP_NUMB_BITS == 128 @@ -2202,7 +2210,7 @@ /* returns ceil(e * log2(b)^((-1)^i)), or ... + 1. For i=0, uses a 23-bit upper approximation to log(beta)/log(2). - For i=1, uses a 76-bit upper approximation to log(2)/log(beta). + For i=1, uses a 77-bit upper approximation to log(2)/log(beta). Note: this function should be called only in the extended exponent range. */ mpfr_exp_t @@ -2211,20 +2219,21 @@ mpfr_srcptr p; mpfr_t t; mpfr_exp_t r; + mp_limb_t tmpmant[MPFR_EXP_LIMB_SIZE]; p = &__gmpfr_l2b[beta-2][i]; - mpfr_init2 (t, sizeof (mpfr_exp_t) * CHAR_BIT); + MPFR_TMP_INIT1(tmpmant, t, sizeof (mpfr_exp_t) * CHAR_BIT - 1); mpfr_set_exp_t (t, e, MPFR_RNDU); mpfr_mul (t, t, p, MPFR_RNDU); r = mpfr_get_exp_t (t, MPFR_RNDU); - mpfr_clear (t); return r; } /* prints the mantissa of x in the string s, and writes the corresponding exponent in e. x is rounded with direction rnd, m is the number of digits of the mantissa, - b is the given base (2 <= b <= 62). + |b| is the given base (2 <= b <= 62 or -36 <= b <= -2). + This follows GMP's mpf_get_str specification. Return value: if s=NULL, allocates a string to store the mantissa, with @@ -2232,10 +2241,11 @@ (thus m+1 or m+2 characters). Important: when you call this function with s=NULL, don't forget to free - the memory space allocated, with free(s, strlen(s)). + the memory space allocated, with mpfr_free_str. */ char* -mpfr_get_str (char *s, mpfr_exp_t *e, int b, size_t m, mpfr_srcptr x, mpfr_rnd_t rnd) +mpfr_get_str (char *s, mpfr_exp_t *e, int b, size_t m, mpfr_srcptr x, + mpfr_rnd_t rnd) { const char *num_to_text; int exact; /* exact result */ @@ -2251,35 +2261,53 @@ size_t n, i; char *s0; int neg; - int ret; /* return value of mpfr_get_str_aux */ + int ret; /* return value of mpfr_get_str_aux */ + int b0 = b; /* initial base argument, might be negative */ MPFR_ZIV_DECL (loop); MPFR_SAVE_EXPO_DECL (expo); - MPFR_TMP_DECL(marker); + MPFR_TMP_DECL (marker); /* if exact = 1 then err is undefined */ /* otherwise err is such that |x*b^(m-g)-a*2^exp_a| < 2^(err+exp_a) */ - /* is the base valid? */ - if (b < 2 || b > 62) + MPFR_LOG_FUNC + (("b=%d m=%zu x[%Pu]=%.*Rg rnd=%d", + b, m, mpfr_get_prec (x), mpfr_log_prec, x, rnd), + ("flags=%lx", (unsigned long) __gmpfr_flags)); + + /* Is the base argument valid? Valid values are -36 to -2 and 2 to 62. */ + if (b < -36 || (-2 < b && b < 2) || 62 < b) return NULL; - num_to_text = b < 37 ? num_to_text36 : num_to_text62; + num_to_text = (2 <= b && b <= 36) ? num_to_text36 : num_to_text62; + + b = (b > 0) ? b : -b; + + /* now b is positive */ + + /* map RNDF to RNDN, to avoid problems with specification of mpfr_can_round + or mpfr_can_round_raw */ + if (rnd == MPFR_RNDF) + rnd = MPFR_RNDN; if (MPFR_UNLIKELY (MPFR_IS_NAN (x))) { if (s == NULL) - s = (char *) (*__gmp_allocate_func) (6); + s = (char *) mpfr_allocate_func (6); strcpy (s, "@NaN@"); + MPFR_LOG_MSG (("%s\n", s)); + __gmpfr_flags |= MPFR_FLAGS_NAN; return s; } - neg = MPFR_SIGN(x) < 0; /* 0 if positive, 1 if negative */ + neg = MPFR_IS_NEG (x); /* 0 if positive, 1 if negative */ if (MPFR_UNLIKELY (MPFR_IS_INF (x))) { if (s == NULL) - s = (char *) (*__gmp_allocate_func) (neg + 6); + s = (char *) mpfr_allocate_func (neg + 6); strcpy (s, (neg) ? "-@Inf@" : "@Inf@"); + MPFR_LOG_MSG (("%s\n", s)); return s; } @@ -2298,22 +2326,23 @@ */ m = 1 + mpfr_ceil_mul (IS_POW2(b) ? MPFR_PREC(x) - 1 : MPFR_PREC(x), b, 1); - if (m < 2) - m = 2; } - /* the code below for non-power-of-two bases works for m=1 */ - MPFR_ASSERTN (m >= 2 || (IS_POW2(b) == 0 && m >= 1)); + MPFR_LOG_MSG (("m=%zu\n", m)); + + /* The code below works for m=1, both for power-of-two and non-power-of-two + bases; this is important for the internal use of mpfr_get_str. */ /* x is a floating-point number */ - if (MPFR_IS_ZERO(x)) + if (s == NULL) + s = (char *) mpfr_allocate_func (neg + m + 1); + s0 = s; + if (neg) + *s++ = '-'; + + if (MPFR_IS_ZERO (x)) { - if (s == NULL) - s = (char*) (*__gmp_allocate_func) (neg + m + 1); - s0 = s; - if (neg) - *s++ = '-'; memset (s, '0', m); s[m] = '\0'; *e = 0; /* a bit like frexp() in ISO C99 */ @@ -2321,15 +2350,9 @@ return s0; /* strlen(s0) = neg + m */ } - if (s == NULL) - s = (char*) (*__gmp_allocate_func) (neg + m + 1); - s0 = s; - if (neg) - *s++ = '-'; + xp = MPFR_MANT (x); - xp = MPFR_MANT(x); - - if (IS_POW2(b)) + if (IS_POW2 (b)) { int pow2; mpfr_exp_t f, r; @@ -2351,6 +2374,8 @@ /* the first digit will contain only r bits */ prec = (m - 1) * pow2 + r; /* total number of bits */ + /* if m=1 then 1 <= prec <= pow2, and since prec=1 is now valid in MPFR, + the power-of-two code also works for m=1 */ n = MPFR_PREC2LIMBS (prec); MPFR_TMP_MARK (marker); @@ -2384,22 +2409,24 @@ n --; } - mpn_get_str ((unsigned char*) s, b, x1, n); - for (i=0; i 0 */ if (neg) - rnd = MPFR_INVERT_RND(rnd); + rnd = MPFR_INVERT_RND (rnd); g = mpfr_ceil_mul (MPFR_GET_EXP (x) - 1, b, 1); exact = 1; @@ -2412,7 +2439,7 @@ MPFR_ZIV_INIT (loop, prec); for (;;) { - MPFR_TMP_MARK(marker); + MPFR_TMP_MARK (marker); exact = 1; @@ -2425,7 +2452,7 @@ nx = MPFR_LIMB_SIZE (x); if ((mpfr_exp_t) m == g) /* final exponent is 0, no multiplication or - division to perform */ + division to perform */ { if (nx > n) exact = mpn_scan1 (xp, 0) >= (nx - n) * GMP_NUMB_BITS; @@ -2515,41 +2542,48 @@ /* check if rounding is possible */ if (exact) err = -1; - ret = mpfr_get_str_aux (s, e, a, n, exp_a, err, b, m, rnd); + + ret = mpfr_get_str_aux (s, e, a, n, exp_a, err, b0, m, rnd); + + MPFR_TMP_FREE (marker); + if (ret == MPFR_ROUND_FAILED) { /* too large error: increment the working precision */ MPFR_ZIV_NEXT (loop, prec); } - else if (ret == -MPFR_ROUND_FAILED) + else if (ret == - MPFR_ROUND_FAILED) { /* too many digits in mantissa: exp = |m-g| */ if ((mpfr_exp_t) m > g) /* exp = m - g, multiply by b^exp */ { - g++; + g ++; exp --; } else /* exp = g - m, divide by b^exp */ { - g++; + g ++; exp ++; } } else - break; - - MPFR_TMP_FREE(marker); + { + if (ret != 0) + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_INEXACT); + break; + } } MPFR_ZIV_FREE (loop); *e += g; - MPFR_TMP_FREE(marker); + MPFR_LOG_MSG (("e=%" MPFR_EXP_FSPEC "d\n", (mpfr_eexp_t) *e)); + MPFR_SAVE_EXPO_FREE (expo); return s0; } void mpfr_free_str (char *str) { - (*__gmp_free_func) (str, strlen (str) + 1); + mpfr_free_func (str, strlen (str) + 1); } diff -Nru mpfr4-3.1.4/src/get_ui.c mpfr4-4.0.2/src/get_ui.c --- mpfr4-3.1.4/src/get_ui.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/get_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_get_ui -- convert a floating-point number to an unsigned long. -Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2003-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -30,10 +30,11 @@ mpfr_t x; mp_size_t n; mpfr_exp_t exp; + MPFR_SAVE_EXPO_DECL (expo); if (MPFR_UNLIKELY (!mpfr_fits_ulong_p (f, rnd))) { - MPFR_SET_ERANGE (); + MPFR_SET_ERANGEFLAG (); return MPFR_IS_NAN (f) || MPFR_IS_NEG (f) ? (unsigned long) 0 : ULONG_MAX; } @@ -44,10 +45,16 @@ for (s = ULONG_MAX, prec = 0; s != 0; s /= 2, prec ++) { } + MPFR_SAVE_EXPO_MARK (expo); + /* first round to prec bits */ mpfr_init2 (x, prec); mpfr_rint (x, f, rnd); + /* The flags from mpfr_rint are the wanted ones. In particular, + it sets the inexact flag when necessary. */ + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); + /* warning: if x=0, taking its exponent is illegal */ if (MPFR_IS_ZERO(x)) s = 0; @@ -61,5 +68,7 @@ mpfr_clear (x); + MPFR_SAVE_EXPO_FREE (expo); + return s; } diff -Nru mpfr4-3.1.4/src/get_uj.c mpfr4-4.0.2/src/get_uj.c --- mpfr4-3.1.4/src/get_uj.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/get_uj.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_get_uj -- convert a MPFR number to a huge machine unsigned integer -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -# include "config.h" /* for a build within gmp */ +# include "config.h" #endif #include "mpfr-intmax.h" @@ -35,10 +35,11 @@ uintmax_t r; mpfr_prec_t prec; mpfr_t x; + MPFR_SAVE_EXPO_DECL (expo); if (MPFR_UNLIKELY (!mpfr_fits_uintmax_p (f, rnd))) { - MPFR_SET_ERANGE (); + MPFR_SET_ERANGEFLAG (); return MPFR_IS_NAN (f) || MPFR_IS_NEG (f) ? (uintmax_t) 0 : MPFR_UINTMAX_MAX; } @@ -50,12 +51,18 @@ for (r = MPFR_UINTMAX_MAX, prec = 0; r != 0; r /= 2, prec++) { } - /* Now, r = 0. */ + MPFR_ASSERTD (r == 0); + + MPFR_SAVE_EXPO_MARK (expo); mpfr_init2 (x, prec); mpfr_rint (x, f, rnd); MPFR_ASSERTN (MPFR_IS_FP (x)); + /* The flags from mpfr_rint are the wanted ones. In particular, + it sets the inexact flag when necessary. */ + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); + if (MPFR_NOTZERO (x)) { mp_limb_t *xp; @@ -76,6 +83,8 @@ mpfr_clear (x); + MPFR_SAVE_EXPO_FREE (expo); + return r; } diff -Nru mpfr4-3.1.4/src/get_z.c mpfr4-4.0.2/src/get_z.c --- mpfr4-3.1.4/src/get_z.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/get_z.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_get_z -- get a multiple-precision integer from a floating-point number -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -29,11 +29,12 @@ int inex; mpfr_t r; mpfr_exp_t exp; + MPFR_SAVE_EXPO_DECL (expo); if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f))) { if (MPFR_UNLIKELY (MPFR_NOTZERO (f))) - MPFR_SET_ERANGE (); + MPFR_SET_ERANGEFLAG (); mpz_set_ui (z, 0); /* The ternary value is 0 even for infinity. Giving the rounding direction in this case would not make much sense anyway, and @@ -41,6 +42,8 @@ return 0; } + MPFR_SAVE_EXPO_MARK (expo); + exp = MPFR_GET_EXP (f); /* if exp <= 0, then |f|<1, thus |o(f)|<=1 */ MPFR_ASSERTN (exp < 0 || exp <= MPFR_PREC_MAX); @@ -50,6 +53,11 @@ MPFR_ASSERTN (inex != 1 && inex != -1); /* integral part of f is representable in r */ MPFR_ASSERTN (MPFR_IS_FP (r)); + + /* The flags from mpfr_rint are the wanted ones. In particular, + it sets the inexact flag when necessary. */ + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); + exp = mpfr_get_z_2exp (z, r); if (exp >= 0) mpz_mul_2exp (z, z, exp); @@ -57,5 +65,7 @@ mpz_fdiv_q_2exp (z, z, -exp); mpfr_clear (r); + MPFR_SAVE_EXPO_FREE (expo); + return inex; } diff -Nru mpfr4-3.1.4/src/get_z_exp.c mpfr4-4.0.2/src/get_z_exp.c --- mpfr4-3.1.4/src/get_z_exp.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/get_z_exp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_get_z_2exp -- get a multiple-precision integer and an exponent from a floating-point number -Copyright 2000-2016 Free Software Foundation, Inc. +Copyright 2000-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -48,16 +48,19 @@ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f))) { if (MPFR_UNLIKELY (MPFR_NOTZERO (f))) - MPFR_SET_ERANGE (); + MPFR_SET_ERANGEFLAG (); mpz_set_ui (z, 0); return __gmpfr_emin; } fn = MPFR_LIMB_SIZE(f); + /* FIXME: temporary assert for security. Too large values should + probably be handled like infinities. */ + MPFR_ASSERTN (fn <= INT_MAX); /* due to SIZ(z) being an int */ + /* check whether allocated space for z is enough */ - if (MPFR_UNLIKELY (ALLOC (z) < fn)) - MPZ_REALLOC (z, fn); + mpz_realloc2 (z, (mp_bitcnt_t) fn * GMP_NUMB_BITS); MPFR_UNSIGNED_MINUS_MODULO (sh, MPFR_PREC (f)); if (MPFR_LIKELY (sh)) @@ -71,7 +74,7 @@ < (mpfr_uexp_t) MPFR_PREC (f))) { /* The exponent isn't representable in an mpfr_exp_t. */ - MPFR_SET_ERANGE (); + MPFR_SET_ERANGEFLAG (); return MPFR_EXP_MIN; } diff -Nru mpfr4-3.1.4/src/gmp_op.c mpfr4-4.0.2/src/gmp_op.c --- mpfr4-3.1.4/src/gmp_op.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/gmp_op.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Implementations of operations between mpfr and mpz/mpq data -Copyright 2001, 2003-2016 Free Software Foundation, Inc. +Copyright 2001, 2003-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,17 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" +/* TODO: for functions with mpz_srcptr, check whether mpz_fits_slong_p + is really useful in all cases. For instance, concerning the addition, + one now has mpz_t -> long -> unsigned long -> mpfr_t then mpfr_add + instead of mpz_t -> mpfr_t then mpfr_add. */ + /* Init and set a mpfr_t with enough precision to store a mpz. This function should be called in the extended exponent range. */ static void @@ -83,21 +88,26 @@ int mpfr_mul_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mpfr_rnd_t r) { - return foo (y, x, z, r, mpfr_mul); + if (mpz_fits_slong_p (z)) + return mpfr_mul_si (y, x, mpz_get_si (z), r); + else + return foo (y, x, z, r, mpfr_mul); } int mpfr_div_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mpfr_rnd_t r) { - return foo (y, x, z, r, mpfr_div); + if (mpz_fits_slong_p (z)) + return mpfr_div_si (y, x, mpz_get_si (z), r); + else + return foo (y, x, z, r, mpfr_div); } int mpfr_add_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mpfr_rnd_t r) { - /* Mpz 0 is unsigned */ - if (MPFR_UNLIKELY (mpz_sgn (z) == 0)) - return mpfr_set (y, x, r); + if (mpz_fits_slong_p (z)) + return mpfr_add_si (y, x, mpz_get_si (z), r); else return foo (y, x, z, r, mpfr_add); } @@ -105,9 +115,8 @@ int mpfr_sub_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mpfr_rnd_t r) { - /* Mpz 0 is unsigned */ - if (MPFR_UNLIKELY (mpz_sgn (z) == 0)) - return mpfr_set (y, x, r); + if (mpz_fits_slong_p (z)) + return mpfr_sub_si (y, x, mpz_get_si (z), r); else return foo (y, x, z, r, mpfr_sub); } @@ -115,9 +124,8 @@ int mpfr_z_sub (mpfr_ptr y, mpz_srcptr x, mpfr_srcptr z, mpfr_rnd_t r) { - /* Mpz 0 is unsigned */ - if (MPFR_UNLIKELY (mpz_sgn (x) == 0)) - return mpfr_neg (y, z, r); + if (mpz_fits_slong_p (x)) + return mpfr_si_sub (y, mpz_get_si (x), z, r); else return foo2 (y, x, z, r, mpfr_sub); } @@ -128,11 +136,14 @@ mpfr_t t; int res; mpfr_prec_t p; - unsigned int flags; + mpfr_flags_t flags; if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) return mpfr_cmp_si (x, mpz_sgn (z)); + if (mpz_fits_slong_p (z)) + return mpfr_cmp_si (x, mpz_get_si (z)); + if (mpz_size (z) <= 1) p = GMP_NUMB_BITS; else @@ -153,6 +164,7 @@ return res; } +#ifndef MPFR_USE_MINI_GMP /* Compute y = RND(x*n/d), where n and d are mpz integers. An integer 0 is assumed to have a positive sign. This function is used by mpfr_mul_q and mpfr_div_q. @@ -220,7 +232,8 @@ MPFR_ASSERTN (!MPFR_BLOCK_EXCEP)); MPFR_EXP (y) += ex; /* Detect highly unlikely, not supported corner cases... */ - MPFR_ASSERTN (MPFR_EXP (y) >= __gmpfr_emin && MPFR_IS_PURE_FP (y)); + MPFR_ASSERTN (MPFR_EXP (y) >= __gmpfr_emin); + MPFR_ASSERTN (! MPFR_IS_SINGULAR (y)); /* The potential overflow will be detected by mpfr_check_range. */ } else @@ -439,11 +452,15 @@ mpfr_prec_t p; MPFR_SAVE_EXPO_DECL (expo); - if (MPFR_UNLIKELY (mpq_denref (q) == 0)) + if (MPFR_UNLIKELY (mpz_sgn (mpq_denref (q)) == 0)) { /* q is an infinity or NaN */ - mpfr_init2 (t, 2); + mpfr_flags_t old_flags; + + mpfr_init2 (t, MPFR_PREC_MIN); + old_flags = __gmpfr_flags; mpfr_set_q (t, q, MPFR_RNDN); + __gmpfr_flags = old_flags; res = mpfr_cmp (x, t); mpfr_clear (t); return res; @@ -465,7 +482,9 @@ MPFR_SAVE_EXPO_FREE (expo); return res; } +#endif +#ifndef MPFR_USE_MINI_GMP int mpfr_cmp_f (mpfr_srcptr x, mpf_srcptr z) { @@ -478,7 +497,7 @@ MPFR_SAVE_EXPO_MARK (expo); - mpfr_init2 (t, MPFR_PREC_MIN + ABS(SIZ(z)) * GMP_NUMB_BITS ); + mpfr_init2 (t, MPFR_PREC_MIN + ABSIZ(z) * GMP_NUMB_BITS); res = mpfr_set_f (t, z, MPFR_RNDN); MPFR_ASSERTD (res == 0); res = mpfr_cmp (x, t); @@ -487,3 +506,4 @@ MPFR_SAVE_EXPO_FREE (expo); return res; } +#endif diff -Nru mpfr4-3.1.4/src/grandom.c mpfr4-4.0.2/src/grandom.c --- mpfr4-3.1.4/src/grandom.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/grandom.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,9 +1,9 @@ /* mpfr_grandom (rop1, rop2, state, rnd_mode) -- Generate up to two - pseudorandom real numbers according to a standard normal gaussian + pseudorandom real numbers according to a standard normal Gaussian distribution and round it to the precision of rop1, rop2 according to the given rounding mode. -Copyright 2011-2016 Free Software Foundation, Inc. +Copyright 2011-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -20,7 +20,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff -Nru mpfr4-3.1.4/src/hppa/mparam.h mpfr4-4.0.2/src/hppa/mparam.h --- mpfr4-3.1.4/src/hppa/mparam.h 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/hppa/mparam.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Generated by MPFR's tuneup.c, 2011-07-31, gcc 4.3.2 */ @@ -88,7 +88,7 @@ 832,832,832,832,832,832,832,831,832,831,832,831,832,831,832,831, \ 832,831,832,832,832,831,832,831,832,831,832,831,832,831,832,831, \ 832,832,832,831,832,832,832,832,832,831,832,832,832,832,832,832 \ - + #define MPFR_SQRHIGH_TAB \ -1,0,0,0,0,0,0,0,0,0,0,7,0,8,9,9, \ 10,10,11,11,12,13,14,13,14,15,16,15,16,17,18,17, \ @@ -154,7 +154,7 @@ 592,591,592,591,592,615,616,519,520,615,520,519,520,615,616,615, \ 616,615,528,615,616,615,528,527,528,615,528,623,624,623,536,552, \ 552,551,552,551,552,551,552,551,552,551,552,551,552,551,552,551 \ - + #define MPFR_DIVHIGH_TAB \ 0,1,2,3,4,5,6,7,6,7,10,11,10,11,12,13, \ 10,11,11,11,12,12,14,15,14,14,16,16,16,16,18,17, \ @@ -220,7 +220,7 @@ 512,508,512,508,512,512,512,512,512,512,512,512,512,512,512,512, \ 512,512,512,512,512,512,512,512,512,564,562,564,560,512,564,564, \ 562,564,560,564,564,564,560,564,564,564,564,564,564,564,564,562 \ - + #define MPFR_MUL_THRESHOLD 6 /* limbs */ #define MPFR_SQR_THRESHOLD 8 /* limbs */ #define MPFR_DIV_THRESHOLD 23 /* limbs */ diff -Nru mpfr4-3.1.4/src/hypot.c mpfr4-4.0.2/src/hypot.c --- mpfr4-3.1.4/src/hypot.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/hypot.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_hypot -- Euclidean distance -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -98,7 +98,13 @@ /* If z > abs(x), then it was already rounded up; otherwise z = abs(x), and we need to add one ulp due to y. */ if (mpfr_abs (z, x, rnd_mode) == 0) - mpfr_nexttoinf (z); + { + mpfr_nexttoinf (z); + /* since mpfr_nexttoinf does not set the overflow flag, + we have to check manually for overflow */ + if (MPFR_UNLIKELY (MPFR_IS_INF (z))) + MPFR_SET_OVERFLOW (); + } MPFR_RET (1); } else /* MPFR_RNDZ, MPFR_RNDD, MPFR_RNDN */ @@ -111,7 +117,7 @@ else { MPFR_SET_EXP (z, Ex); - MPFR_SET_SIGN (z, 1); + MPFR_SET_SIGN (z, MPFR_SIGN_POS); MPFR_RNDRAW_GEN (inexact, z, MPFR_MANT (x), N, rnd_mode, 1, goto addoneulp, if (MPFR_UNLIKELY (++ MPFR_EXP (z) > @@ -139,11 +145,29 @@ MPFR_SAVE_EXPO_MARK (expo); - /* Scale x and y to avoid overflow/underflow in x^2 and overflow in y^2 - (as |x| >= |y|). The scaling of y can underflow only when the target - precision is huge, otherwise the case would already have been handled - by the diff_exp > threshold code. */ - sh = mpfr_get_emax () / 2 - Ex - 1; + /* Scale x and y to avoid any overflow and underflow in x^2 + (as |x| >= |y|), and to limit underflow cases for y or y^2. + We have: x = Mx * 2^Ex with 1/2 <= |Mx| < 1, and we choose: + sh = floor((Emax - 1) / 2) - Ex. + Thus (x * 2^sh)^2 = Mx^2 * 2^(2*floor((Emax-1)/2)), which has an + exponent of at most Emax - 1. Therefore (x * 2^sh)^2 + (y * 2^sh)^2 + will have an exponent of at most Emax, even after rounding as we + round toward zero. Using a larger sh wouldn't guarantee an absence + of overflow. Note that the scaling of y can underflow only when the + target precision is huge, otherwise the case would already have been + handled by the diff_exp > threshold code. + FIXME: Friedland in "Algorithm 312: Absolute Value and Square Root of a + Complex Number" (Communications of the ACM, 1967) avoids overflow by + computing |x|*sqrt(1+(y/x)^2) if |x| >= |y|, and |y|*sqrt(1+(x/y)^2) + otherwise. + [VL] This trick (which is a scaling by a non-power of 2, thus doesn't + really bring new behavior w.r.t. overflow/underflow exceptions) may be + useful for hardware floating-point formats because a whole power-of-2 + scaling code is likely to take more time than the additional division, + but in the context of multiple-precision, I doubt that it is a good + idea. Ideally scaling by a power of 2 could be done in a constant time, + e.g. with MPFR_ALIAS; but one needs to be very careful... */ + sh = (mpfr_get_emax () - 1) / 2 - Ex; MPFR_ZIV_INIT (loop, Nt); for (;;) @@ -170,7 +194,7 @@ MPFR_ZIV_FREE (loop); MPFR_BLOCK (flags, inexact = mpfr_div_2si (z, t, sh, rnd_mode)); - MPFR_ASSERTD (exact == 0 || inexact != 0); + MPFR_ASSERTD (exact == 0 || inexact != 0 || rnd_mode == MPFR_RNDF); mpfr_clear (t); mpfr_clear (ti); @@ -187,7 +211,7 @@ MPFR_SAVE_EXPO_FREE (expo); if (MPFR_OVERFLOW (flags)) - mpfr_set_overflow (); + MPFR_SET_OVERFLOW (); /* hypot(x,y) >= |x|, thus underflow is not possible. */ return mpfr_check_range (z, inexact, rnd_mode); diff -Nru mpfr4-3.1.4/src/ia64/mparam.h mpfr4-4.0.2/src/ia64/mparam.h --- mpfr4-3.1.4/src/ia64/mparam.h 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/ia64/mparam.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Generated by MPFR's tuneup.c, 2011-07-31, gcc 4.4.5 */ @@ -88,7 +88,7 @@ 784,784,784,784,784,783,784,831,784,784,784,784,784,784,784,831, \ 832,784,832,831,784,831,832,831,832,784,784,831,832,783,784,831, \ 832,784,832,831,832,784,856,856,856,856,856,856,856,856,856,856 \ - + #define MPFR_SQRHIGH_TAB \ -1,0,0,0,0,0,-1,-1,-1,6,-1,8,8,8,10,10, \ 10,12,11,11,12,12,14,14,14,14,16,15,16,16,18,19, \ @@ -154,7 +154,7 @@ 616,616,600,600,616,616,600,600,600,616,600,599,600,600,600,599, \ 600,616,616,599,616,616,616,599,616,616,616,599,616,616,600,599, \ 616,616,600,616,616,616,632,648,664,648,616,648,600,600,632,664 \ - + #define MPFR_DIVHIGH_TAB \ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,13, \ 16,17,18,19,18,21,22,23,22,25,17,17,20,23,25,22, \ @@ -220,7 +220,7 @@ 560,528,576,512,528,513,512,528,528,576,576,496,528,576,576,511, \ 512,504,576,576,560,512,576,504,576,576,576,576,564,576,564,576, \ 576,562,576,576,576,576,576,560,576,576,564,528,532,576,576,576 \ - + #define MPFR_MUL_THRESHOLD 26 /* limbs */ #define MPFR_SQR_THRESHOLD 19 /* limbs */ #define MPFR_DIV_THRESHOLD 44 /* limbs */ diff -Nru mpfr4-3.1.4/src/ieee_floats.h mpfr4-4.0.2/src/ieee_floats.h --- mpfr4-3.1.4/src/ieee_floats.h 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/ieee_floats.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* auxiliary data to generate special IEEE floats (NaN, +Inf, -Inf) -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* "double" NaN and infinities are written as explicit bytes to be sure of @@ -28,7 +28,7 @@ on alphaev56-unknown-freebsd4.3 the NaN must be 8-bytes, since that compiler+system was seen incorrectly converting from a "float" NaN. */ -#if _GMP_IEEE_FLOATS +#if _MPFR_IEEE_FLOATS /* The "d" field guarantees alignment to a suitable boundary for a double. Could use a union instead, if we checked the compiler supports union @@ -40,41 +40,38 @@ #define MPFR_DBL_INFP (dbl_infp.d) #define MPFR_DBL_INFM (dbl_infm.d) -#define MPFR_DBL_NAN (dbl_nan.d) +#define MPFR_DBL_NAN DBL_NAN -/* Warning! dbl_nan.d is not consistently the same NaN on all the - processors: it can be either a qNaN (quiet) or sNaN (signaling). - Processors are known to differ... */ +/* For NaN, we use DBL_NAN since the memory representation of a NaN depends + on the processor: a fixed memory representation could yield either a + quiet NaN (qNaN) or a signaling NaN (sNaN). For instance, HP PA-RISC + is known to do the opposite way of the usual choice recommended in + IEEE 754-2008; see: + http://grouper.ieee.org/groups/1788/email/msg03272.html + + Moreover, the right choice is to generate a qNaN in particular because + signaling NaNs are not supported by all compilers (note that the support + must be in the compiler used to build the user-end application because + this is where the sNaN will be obtained). */ -#if HAVE_DOUBLE_IEEE_LITTLE_ENDIAN +#ifdef HAVE_DOUBLE_IEEE_LITTLE_ENDIAN static const union dbl_bytes dbl_infp = { { 0, 0, 0, 0, 0, 0, 0xF0, 0x7F } }; static const union dbl_bytes dbl_infm = { { 0, 0, 0, 0, 0, 0, 0xF0, 0xFF } }; -static const union dbl_bytes dbl_nan = - { { 0, 0, 0, 0, 0, 0, 0xF8, 0x7F } }; #endif -#if HAVE_DOUBLE_IEEE_LITTLE_SWAPPED -static const union dbl_bytes dbl_infp = - { { 0, 0, 0xF0, 0x7F, 0, 0, 0, 0 } }; -static const union dbl_bytes dbl_infm = - { { 0, 0, 0xF0, 0xFF, 0, 0, 0, 0 } }; -static const union dbl_bytes dbl_nan = - { { 0, 0, 0xF8, 0x7F, 0, 0, 0, 0 } }; -#endif -#if HAVE_DOUBLE_IEEE_BIG_ENDIAN + +#ifdef HAVE_DOUBLE_IEEE_BIG_ENDIAN static const union dbl_bytes dbl_infp = { { 0x7F, 0xF0, 0, 0, 0, 0, 0, 0 } }; static const union dbl_bytes dbl_infm = { { 0xFF, 0xF0, 0, 0, 0, 0, 0, 0 } }; -static const union dbl_bytes dbl_nan = - { { 0x7F, 0xF8, 0, 0, 0, 0, 0, 0 } }; #endif -#else /* _GMP_IEEE_FLOATS */ +#else /* _MPFR_IEEE_FLOATS */ #define MPFR_DBL_INFP DBL_POS_INF #define MPFR_DBL_INFM DBL_NEG_INF #define MPFR_DBL_NAN DBL_NAN -#endif /* _GMP_IEEE_FLOATS */ +#endif /* _MPFR_IEEE_FLOATS */ diff -Nru mpfr4-3.1.4/src/init2.c mpfr4-4.0.2/src/init2.c --- mpfr4-3.1.4/src/init2.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/init2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_init2 -- initialize a floating-point number with given precision -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,42 +17,42 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" -void +MPFR_HOT_FUNCTION_ATTR void mpfr_init2 (mpfr_ptr x, mpfr_prec_t p) { mp_size_t xsize; - mpfr_limb_ptr tmp; + mpfr_size_limb_t *tmp; /* Check if we can represent the number of limbs * associated to the maximum of mpfr_prec_t*/ - MPFR_ASSERTN( MP_SIZE_T_MAX >= (MPFR_PREC_MAX/MPFR_BYTES_PER_MP_LIMB) ); + MPFR_STAT_STATIC_ASSERT( MP_SIZE_T_MAX >= (MPFR_PREC_MAX/MPFR_BYTES_PER_MP_LIMB) ); /* Check for correct GMP_NUMB_BITS and MPFR_BYTES_PER_MP_LIMB */ - MPFR_ASSERTN( GMP_NUMB_BITS == MPFR_BYTES_PER_MP_LIMB * CHAR_BIT - && sizeof(mp_limb_t) == MPFR_BYTES_PER_MP_LIMB ); - + MPFR_STAT_STATIC_ASSERT( GMP_NUMB_BITS == MPFR_BYTES_PER_MP_LIMB * CHAR_BIT + && sizeof(mp_limb_t) == MPFR_BYTES_PER_MP_LIMB ); + /* Check for mp_bits_per_limb (a global variable inside GMP library) */ MPFR_ASSERTN (mp_bits_per_limb == GMP_NUMB_BITS); /* Check for correct EXP NAN, ZERO & INF in both mpfr.h and mpfr-impl.h */ - MPFR_ASSERTN( __MPFR_EXP_NAN == MPFR_EXP_NAN ); - MPFR_ASSERTN( __MPFR_EXP_ZERO == MPFR_EXP_ZERO ); - MPFR_ASSERTN( __MPFR_EXP_INF == MPFR_EXP_INF ); + MPFR_STAT_STATIC_ASSERT( __MPFR_EXP_NAN == MPFR_EXP_NAN ); + MPFR_STAT_STATIC_ASSERT( __MPFR_EXP_ZERO == MPFR_EXP_ZERO ); + MPFR_STAT_STATIC_ASSERT( __MPFR_EXP_INF == MPFR_EXP_INF ); - MPFR_ASSERTN( MPFR_EMAX_MAX <= (MPFR_EXP_MAX >> 1) ); - MPFR_ASSERTN( MPFR_EMIN_MIN >= -(MPFR_EXP_MAX >> 1) ); + MPFR_STAT_STATIC_ASSERT( MPFR_EMAX_MAX <= (MPFR_EXP_MAX >> 1) ); + MPFR_STAT_STATIC_ASSERT( MPFR_EMIN_MIN >= -(MPFR_EXP_MAX >> 1) ); /* p=1 is not allowed since the rounding to nearest even rule requires at - least two bits of mantissa: the neighbours of 3/2 are 1*2^0 and 1*2^1, + least two bits of mantissa: the neighbors of 3/2 are 1*2^0 and 1*2^1, which both have an odd mantissa */ - MPFR_ASSERTN(p >= MPFR_PREC_MIN && p <= MPFR_PREC_MAX); + MPFR_ASSERTN (MPFR_PREC_COND (p)); xsize = MPFR_PREC2LIMBS (p); - tmp = (mpfr_limb_ptr) (*__gmp_allocate_func)(MPFR_MALLOC_SIZE(xsize)); + tmp = (mpfr_size_limb_t *) mpfr_allocate_func(MPFR_MALLOC_SIZE(xsize)); MPFR_PREC(x) = p; /* Set prec */ MPFR_EXP (x) = MPFR_EXP_INVALID; /* make sure that the exp field has a @@ -62,8 +62,3 @@ MPFR_SET_ALLOC_SIZE(x, xsize); /* Fix alloc size of Mantissa */ MPFR_SET_NAN(x); /* initializes to NaN */ } - -#ifdef MPFR_USE_OWN_MPFR_TMP_ALLOC -static unsigned char mpfr_stack_tab[8000000]; -unsigned char *mpfr_stack = mpfr_stack_tab; -#endif diff -Nru mpfr4-3.1.4/src/init.c mpfr4-4.0.2/src/init.c --- mpfr4-3.1.4/src/init.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/init.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_init -- initialize a floating-point number -Copyright 1999, 2001-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2002, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/inits2.c mpfr4-4.0.2/src/inits2.c --- mpfr4-3.1.4/src/inits2.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/inits2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_inits2 -- initialize several floating-point numbers with given precision -Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2003-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,12 +18,12 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -#undef HAVE_STDARG -#include "config.h" /* for a build within gmp */ +# undef HAVE_STDARG +# include "config.h" #endif #if HAVE_STDARG diff -Nru mpfr4-3.1.4/src/inits.c mpfr4-4.0.2/src/inits.c --- mpfr4-3.1.4/src/inits.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/inits.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_inits -- initialize several floating-point numbers -Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2003-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,12 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -#undef HAVE_STDARG -#include "config.h" /* for a build within gmp */ +# undef HAVE_STDARG +# include "config.h" #endif #if HAVE_STDARG diff -Nru mpfr4-3.1.4/src/inp_str.c mpfr4-4.0.2/src/inp_str.c --- mpfr4-3.1.4/src/inp_str.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/inp_str.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_inp_str -- input a number in base BASE from stdio stream STREAM and store the result in ROP -Copyright 1999, 2001-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2002, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include @@ -37,11 +37,8 @@ int retval; size_t nread; - if (stream == NULL) - stream = stdin; - alloc_size = 100; - str = (unsigned char *) (*__gmp_allocate_func) (alloc_size); + str = (unsigned char *) mpfr_allocate_func (alloc_size); str_size = 0; nread = 0; @@ -62,7 +59,7 @@ size_t old_alloc_size = alloc_size; alloc_size = alloc_size * 3 / 2; str = (unsigned char *) - (*__gmp_reallocate_func) (str, old_alloc_size, alloc_size); + mpfr_reallocate_func (str, old_alloc_size, alloc_size); } if (c == EOF || isspace (c)) break; @@ -80,7 +77,7 @@ str[str_size] = '\0'; retval = mpfr_set_str (rop, (char *) str, base, rnd_mode); - (*__gmp_free_func) (str, alloc_size); + mpfr_free_func (str, alloc_size); if (retval == -1) return 0; /* error */ diff -Nru mpfr4-3.1.4/src/int_ceil_log2.c mpfr4-4.0.2/src/int_ceil_log2.c --- mpfr4-3.1.4/src/int_ceil_log2.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/int_ceil_log2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* __gmpfr_int_ceil_log2 -- Integer ceil of log2(x) -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H /* for count_leading_zeros */ diff -Nru mpfr4-3.1.4/src/invert_limb.h mpfr4-4.0.2/src/invert_limb.h --- mpfr4-3.1.4/src/invert_limb.h 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/invert_limb.h 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,233 @@ +/* __gmpfr_invert_limb -- implement GMP's invert_limb (which is not in GMP API) + +Copyright 2016-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define MPFR_NEED_LONGLONG_H +#include "mpfr-impl.h" + +/* for now, we only provide __gmpfr_invert_limb for 64-bit limb */ +#if GMP_NUMB_BITS == 64 + +/* umul_hi(h, x, y) puts in h the high part of x*y */ +#ifdef HAVE_MULX_U64 +#include +#define umul_hi(h, x, y) _mulx_u64 (x, y, (unsigned long long *) &h) +#else +#define umul_hi(h, x, y) \ + do { \ + mp_limb_t _l; \ + umul_ppmm (h, _l, x, y); \ + } while (0) +#endif + +/* for 256 <= d9 < 512, invert_limb_table[d9-256] = floor((2^19-3*2^8)/d9)*2^11 */ +static const mp_limb_t invert_limb_table[256] = + { 2045<<11, 2037<<11, 2029<<11, 2021<<11, 2013<<11, 2005<<11, 1998<<11, 1990<<11, + 1983<<11, 1975<<11, 1968<<11, 1960<<11, 1953<<11, 1946<<11, 1938<<11, 1931<<11, + 1924<<11, 1917<<11, 1910<<11, 1903<<11, 1896<<11, 1889<<11, 1883<<11, 1876<<11, + 1869<<11, 1863<<11, 1856<<11, 1849<<11, 1843<<11, 1836<<11, 1830<<11, 1824<<11, + 1817<<11, 1811<<11, 1805<<11, 1799<<11, 1792<<11, 1786<<11, 1780<<11, 1774<<11, + 1768<<11, 1762<<11, 1756<<11, 1750<<11, 1745<<11, 1739<<11, 1733<<11, 1727<<11, + 1722<<11, 1716<<11, 1710<<11, 1705<<11, 1699<<11, 1694<<11, 1688<<11, 1683<<11, + 1677<<11, 1672<<11, 1667<<11, 1661<<11, 1656<<11, 1651<<11, 1646<<11, 1641<<11, + 1636<<11, 1630<<11, 1625<<11, 1620<<11, 1615<<11, 1610<<11, 1605<<11, 1600<<11, + 1596<<11, 1591<<11, 1586<<11, 1581<<11, 1576<<11, 1572<<11, 1567<<11, 1562<<11, + 1558<<11, 1553<<11, 1548<<11, 1544<<11, 1539<<11, 1535<<11, 1530<<11, 1526<<11, + 1521<<11, 1517<<11, 1513<<11, 1508<<11, 1504<<11, 1500<<11, 1495<<11, 1491<<11, + 1487<<11, 1483<<11, 1478<<11, 1474<<11, 1470<<11, 1466<<11, 1462<<11, 1458<<11, + 1454<<11, 1450<<11, 1446<<11, 1442<<11, 1438<<11, 1434<<11, 1430<<11, 1426<<11, + 1422<<11, 1418<<11, 1414<<11, 1411<<11, 1407<<11, 1403<<11, 1399<<11, 1396<<11, + 1392<<11, 1388<<11, 1384<<11, 1381<<11, 1377<<11, 1374<<11, 1370<<11, 1366<<11, + 1363<<11, 1359<<11, 1356<<11, 1352<<11, 1349<<11, 1345<<11, 1342<<11, 1338<<11, + 1335<<11, 1332<<11, 1328<<11, 1325<<11, 1322<<11, 1318<<11, 1315<<11, 1312<<11, + 1308<<11, 1305<<11, 1302<<11, 1299<<11, 1295<<11, 1292<<11, 1289<<11, 1286<<11, + 1283<<11, 1280<<11, 1276<<11, 1273<<11, 1270<<11, 1267<<11, 1264<<11, 1261<<11, + 1258<<11, 1255<<11, 1252<<11, 1249<<11, 1246<<11, 1243<<11, 1240<<11, 1237<<11, + 1234<<11, 1231<<11, 1228<<11, 1226<<11, 1223<<11, 1220<<11, 1217<<11, 1214<<11, + 1211<<11, 1209<<11, 1206<<11, 1203<<11, 1200<<11, 1197<<11, 1195<<11, 1192<<11, + 1189<<11, 1187<<11, 1184<<11, 1181<<11, 1179<<11, 1176<<11, 1173<<11, 1171<<11, + 1168<<11, 1165<<11, 1163<<11, 1160<<11, 1158<<11, 1155<<11, 1153<<11, 1150<<11, + 1148<<11, 1145<<11, 1143<<11, 1140<<11, 1138<<11, 1135<<11, 1133<<11, 1130<<11, + 1128<<11, 1125<<11, 1123<<11, 1121<<11, 1118<<11, 1116<<11, 1113<<11, 1111<<11, + 1109<<11, 1106<<11, 1104<<11, 1102<<11, 1099<<11, 1097<<11, 1095<<11, 1092<<11, + 1090<<11, 1088<<11, 1086<<11, 1083<<11, 1081<<11, 1079<<11, 1077<<11, 1074<<11, + 1072<<11, 1070<<11, 1068<<11, 1066<<11, 1064<<11, 1061<<11, 1059<<11, 1057<<11, + 1055<<11, 1053<<11, 1051<<11, 1049<<11, 1047<<11, 1044<<11, 1042<<11, 1040<<11, + 1038<<11, 1036<<11, 1034<<11, 1032<<11, 1030<<11, 1028<<11, 1026<<11, 1024<<11 }; + +/* for 256 <= d9 < 512, invert_limb_table2[d9-256] = floor((2^19-3*2^8)/d9)^2 */ +static const mp_limb_t invert_limb_table2[256] = + { 4182025, 4149369, 4116841, 4084441, 4052169, 4020025, 3992004, 3960100, 3932289, + 3900625, 3873024, 3841600, 3814209, 3786916, 3755844, 3728761, 3701776, 3674889, + 3648100, 3621409, 3594816, 3568321, 3545689, 3519376, 3493161, 3470769, 3444736, + 3418801, 3396649, 3370896, 3348900, 3326976, 3301489, 3279721, 3258025, 3236401, + 3211264, 3189796, 3168400, 3147076, 3125824, 3104644, 3083536, 3062500, 3045025, + 3024121, 3003289, 2982529, 2965284, 2944656, 2924100, 2907025, 2886601, 2869636, + 2849344, 2832489, 2812329, 2795584, 2778889, 2758921, 2742336, 2725801, 2709316, + 2692881, 2676496, 2656900, 2640625, 2624400, 2608225, 2592100, 2576025, 2560000, + 2547216, 2531281, 2515396, 2499561, 2483776, 2471184, 2455489, 2439844, 2427364, + 2411809, 2396304, 2383936, 2368521, 2356225, 2340900, 2328676, 2313441, 2301289, + 2289169, 2274064, 2262016, 2250000, 2235025, 2223081, 2211169, 2199289, 2184484, + 2172676, 2160900, 2149156, 2137444, 2125764, 2114116, 2102500, 2090916, 2079364, + 2067844, 2056356, 2044900, 2033476, 2022084, 2010724, 1999396, 1990921, 1979649, + 1968409, 1957201, 1948816, 1937664, 1926544, 1915456, 1907161, 1896129, 1887876, + 1876900, 1865956, 1857769, 1846881, 1838736, 1827904, 1819801, 1809025, 1800964, + 1790244, 1782225, 1774224, 1763584, 1755625, 1747684, 1737124, 1729225, 1721344, + 1710864, 1703025, 1695204, 1687401, 1677025, 1669264, 1661521, 1653796, 1646089, + 1638400, 1628176, 1620529, 1612900, 1605289, 1597696, 1590121, 1582564, 1575025, + 1567504, 1560001, 1552516, 1545049, 1537600, 1530169, 1522756, 1515361, 1507984, + 1503076, 1495729, 1488400, 1481089, 1473796, 1466521, 1461681, 1454436, 1447209, + 1440000, 1432809, 1428025, 1420864, 1413721, 1408969, 1401856, 1394761, 1390041, + 1382976, 1375929, 1371241, 1364224, 1357225, 1352569, 1345600, 1340964, 1334025, + 1329409, 1322500, 1317904, 1311025, 1306449, 1299600, 1295044, 1288225, 1283689, + 1276900, 1272384, 1265625, 1261129, 1256641, 1249924, 1245456, 1238769, 1234321, + 1229881, 1223236, 1218816, 1214404, 1207801, 1203409, 1199025, 1192464, 1188100, + 1183744, 1179396, 1172889, 1168561, 1164241, 1159929, 1153476, 1149184, 1144900, + 1140624, 1136356, 1132096, 1125721, 1121481, 1117249, 1113025, 1108809, 1104601, + 1100401, 1096209, 1089936, 1085764, 1081600, 1077444, 1073296, 1069156, 1065024, + 1060900, 1056784, 1052676, 1048576 }; + +/* Implements Algorithm 2 from "Improved Division by Invariant Integers", + Niels Möller and Torbjörn Granlund, IEEE Transactions on Computers, + volume 60, number 2, pages 165-175, 2011. */ +#define __gmpfr_invert_limb(r, d) \ + do { \ + mp_limb_t _d, _d0, _i, _d40, _d63, _v0, _v1, _v2, _e, _v3, _h, _l; \ + _d = (d); \ + _i = (_d >> 55) - 256; /* i = d9 - 256 */ \ + _v0 = invert_limb_table[_i]; \ + _d40 = (_d >> 24) + 1; \ + _v1 = _v0 - ((invert_limb_table2[_i] * _d40) >> 40) - 1; \ + _v2 = (_v1 << 13) + \ + ((_v1 * ((MPFR_LIMB_ONE << 60) - _v1 * _d40)) >> 47); \ + _d0 = _d & 1; \ + _d63 = ((_d - 1) >> 1) + 1; \ + _e = - _v2 * _d63 + ((_v2 & -_d0) >> 1); \ + umul_hi (_h, _v2, _e); \ + _v3 = (_v2 << 31) + (_h >> 1); \ + umul_ppmm (_h, _l, _v3, _d); \ + /* v3 is too small iff (h+d)*2^64+l+d < 2^128 */ \ + add_ssaaaa(_h, _l, _h, _l, _d, _d); \ + MPFR_ASSERTD(_h == MPFR_LIMB_ZERO || -_h == MPFR_LIMB_ONE); \ + (r) = _v3 - _h; \ + } while (0) + +/* same algorithm, but return the value v3, which is such that + v3 <= invert_limb (d) <= v3 + 1 */ +#define __gmpfr_invert_limb_approx(r, d) \ + do { \ + mp_limb_t _d, _d0, _i, _d40, _d63, _v0, _v1, _v2, _e, _h; \ + _d = (d); \ + _i = (_d >> 55) - 256; /* i = d9 - 256 */ \ + _v0 = invert_limb_table[_i]; \ + _d40 = (_d >> 24) + 1; \ + _v1 = _v0 - ((invert_limb_table2[_i] * _d40) >> 40) - 1; \ + _v2 = (_v1 << 13) + \ + ((_v1 * ((MPFR_LIMB_ONE << 60) - _v1 * _d40)) >> 47); \ + _d0 = _d & 1; \ + _d63 = ((_d - 1) >> 1) + 1; \ + _e = - _v2 * _d63 + ((_v2 & -_d0) >> 1); \ + umul_hi (_h, _v2, _e); \ + (r) = (_v2 << 31) + (_h >> 1); \ + } while (0) + +#elif GMP_NUMB_BITS == 32 + +/* for 512 <= d10 < 1024, l[d10-512] = floor((2^24-2^14+2^9)/d10) */ +static const mp_limb_t invert_limb_table[512] = + { 32737, 32673, 32609, 32546, 32483, 32420, 32357, 32295, 32233, 32171, + 32109, 32048, 31987, 31926, 31865, 31805, 31744, 31684, 31625, 31565, + 31506, 31447, 31388, 31329, 31271, 31212, 31154, 31097, 31039, 30982, + 30924, 30868, 30811, 30754, 30698, 30642, 30586, 30530, 30475, 30419, + 30364, 30309, 30255, 30200, 30146, 30092, 30038, 29984, 29930, 29877, + 29824, 29771, 29718, 29666, 29613, 29561, 29509, 29457, 29405, 29354, + 29303, 29251, 29200, 29150, 29099, 29049, 28998, 28948, 28898, 28849, + 28799, 28750, 28700, 28651, 28602, 28554, 28505, 28457, 28409, 28360, + 28313, 28265, 28217, 28170, 28123, 28075, 28029, 27982, 27935, 27889, + 27842, 27796, 27750, 27704, 27658, 27613, 27568, 27522, 27477, 27432, + 27387, 27343, 27298, 27254, 27209, 27165, 27121, 27078, 27034, 26990, + 26947, 26904, 26861, 26818, 26775, 26732, 26690, 26647, 26605, 26563, + 26521, 26479, 26437, 26395, 26354, 26312, 26271, 26230, 26189, 26148, + 26108, 26067, 26026, 25986, 25946, 25906, 25866, 25826, 25786, 25747, + 25707, 25668, 25628, 25589, 25550, 25511, 25473, 25434, 25395, 25357, + 25319, 25281, 25242, 25205, 25167, 25129, 25091, 25054, 25016, 24979, + 24942, 24905, 24868, 24831, 24794, 24758, 24721, 24685, 24649, 24612, + 24576, 24540, 24504, 24469, 24433, 24397, 24362, 24327, 24291, 24256, + 24221, 24186, 24151, 24117, 24082, 24047, 24013, 23979, 23944, 23910, + 23876, 23842, 23808, 23774, 23741, 23707, 23674, 23640, 23607, 23574, + 23541, 23508, 23475, 23442, 23409, 23377, 23344, 23312, 23279, 23247, + 23215, 23183, 23151, 23119, 23087, 23055, 23023, 22992, 22960, 22929, + 22898, 22866, 22835, 22804, 22773, 22742, 22711, 22681, 22650, 22619, + 22589, 22559, 22528, 22498, 22468, 22438, 22408, 22378, 22348, 22318, + 22289, 22259, 22229, 22200, 22171, 22141, 22112, 22083, 22054, 22025, + 21996, 21967, 21938, 21910, 21881, 21853, 21824, 21796, 21767, 21739, + 21711, 21683, 21655, 21627, 21599, 21571, 21544, 21516, 21488, 21461, + 21433, 21406, 21379, 21352, 21324, 21297, 21270, 21243, 21216, 21190, + 21163, 21136, 21110, 21083, 21056, 21030, 21004, 20977, 20951, 20925, + 20899, 20873, 20847, 20821, 20795, 20769, 20744, 20718, 20693, 20667, + 20642, 20616, 20591, 20566, 20540, 20515, 20490, 20465, 20440, 20415, + 20390, 20366, 20341, 20316, 20292, 20267, 20243, 20218, 20194, 20170, + 20145, 20121, 20097, 20073, 20049, 20025, 20001, 19977, 19953, 19930, + 19906, 19882, 19859, 19835, 19812, 19789, 19765, 19742, 19719, 19696, + 19672, 19649, 19626, 19603, 19581, 19558, 19535, 19512, 19489, 19467, + 19444, 19422, 19399, 19377, 19354, 19332, 19310, 19288, 19265, 19243, + 19221, 19199, 19177, 19155, 19133, 19112, 19090, 19068, 19046, 19025, + 19003, 18982, 18960, 18939, 18917, 18896, 18875, 18854, 18832, 18811, + 18790, 18769, 18748, 18727, 18706, 18686, 18665, 18644, 18623, 18603, + 18582, 18561, 18541, 18520, 18500, 18479, 18459, 18439, 18419, 18398, + 18378, 18358, 18338, 18318, 18298, 18278, 18258, 18238, 18218, 18199, + 18179, 18159, 18139, 18120, 18100, 18081, 18061, 18042, 18022, 18003, + 17984, 17964, 17945, 17926, 17907, 17888, 17869, 17850, 17831, 17812, + 17793, 17774, 17755, 17736, 17718, 17699, 17680, 17662, 17643, 17624, + 17606, 17587, 17569, 17551, 17532, 17514, 17496, 17477, 17459, 17441, + 17423, 17405, 17387, 17369, 17351, 17333, 17315, 17297, 17279, 17261, + 17244, 17226, 17208, 17191, 17173, 17155, 17138, 17120, 17103, 17085, + 17068, 17051, 17033, 17016, 16999, 16982, 16964, 16947, 16930, 16913, + 16896, 16879, 16862, 16845, 16828, 16811, 16794, 16778, 16761, 16744, + 16727, 16711, 16694, 16677, 16661, 16644, 16628, 16611, 16595, 16578, + 16562, 16546, 16529, 16513, 16497, 16481, 16464, 16448, 16432, 16416, + 16400, 16384 }; + +/* Implements Algorithm 3 from "Improved Division by Invariant Integers", + Niels Möller and Torbjörn Granlund, IEEE Transactions on Computers, + volume 60, number 2, pages 165-175, 2011. */ +#define __gmpfr_invert_limb(r, d) \ + do { \ + mp_limb_t _d, _d0, _d10, _d21, _d31, _v0, _v1, _v2, _e, _h, _l; \ + _d = (d); \ + _d0 = _d & 1; \ + _d10 = _d >> 22; \ + _d21 = (_d >> 11) + 1; \ + _d31 = ((_d - 1) >> 1) + 1; \ + _v0 = invert_limb_table[_d10 - 512]; \ + umul_ppmm (_h, _l, _v0 * _v0, _d21); \ + _v1 = (_v0 << 4) - _h - 1; \ + _e = - _v1 * _d31 + ((_v1 & - _d0) >> 1); \ + umul_ppmm (_h, _l, _v1, _e); \ + _v2 = (_v1 << 15) + (_h >> 1); \ + umul_ppmm (_h, _l, _v2, _d); \ + /* v2 is too small iff (h+d)*2^32+l+d < 2^64 */ \ + add_ssaaaa(_h, _l, _h, _l, _d, _d); \ + MPFR_ASSERTD(_h == MPFR_LIMB_ZERO || -_h == MPFR_LIMB_ONE); \ + (r) = _v2 - _h; \ + } while (0) + +#endif /* GMP_NUMB_BITS == 64 or 32 */ diff -Nru mpfr4-3.1.4/src/invsqrt_limb.h mpfr4-4.0.2/src/invsqrt_limb.h --- mpfr4-3.1.4/src/invsqrt_limb.h 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/invsqrt_limb.h 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,365 @@ +/* __gmpfr_invsqrt_limb_approx -- reciprocal approximate square root of a limb + +Copyright 2017-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define MPFR_NEED_LONGLONG_H +#include "mpfr-impl.h" + +/* for now, we only provide __gmpfr_invert_limb for 64-bit limb */ +#if GMP_NUMB_BITS == 64 + +/* For 257 <= d10 <= 1024, T[d10-257] = floor(sqrt(2^30/d10)). + Sage code: + T = [floor(sqrt(2^30/d10)) for d10 in [257..1024]] */ +static const mp_limb_t T[768] = + { 2044, 2040, 2036, 2032, 2028, 2024, 2020, 2016, 2012, 2009, 2005, + 2001, 1997, 1994, 1990, 1986, 1983, 1979, 1975, 1972, 1968, 1965, 1961, + 1958, 1954, 1951, 1947, 1944, 1941, 1937, 1934, 1930, 1927, 1924, 1920, + 1917, 1914, 1911, 1907, 1904, 1901, 1898, 1895, 1891, 1888, 1885, 1882, + 1879, 1876, 1873, 1870, 1867, 1864, 1861, 1858, 1855, 1852, 1849, 1846, + 1843, 1840, 1837, 1834, 1831, 1828, 1826, 1823, 1820, 1817, 1814, 1812, + 1809, 1806, 1803, 1801, 1798, 1795, 1792, 1790, 1787, 1784, 1782, 1779, + 1777, 1774, 1771, 1769, 1766, 1764, 1761, 1759, 1756, 1754, 1751, 1749, + 1746, 1744, 1741, 1739, 1736, 1734, 1731, 1729, 1727, 1724, 1722, 1719, + 1717, 1715, 1712, 1710, 1708, 1705, 1703, 1701, 1698, 1696, 1694, 1692, + 1689, 1687, 1685, 1683, 1680, 1678, 1676, 1674, 1672, 1670, 1667, 1665, + 1663, 1661, 1659, 1657, 1655, 1652, 1650, 1648, 1646, 1644, 1642, 1640, + 1638, 1636, 1634, 1632, 1630, 1628, 1626, 1624, 1622, 1620, 1618, 1616, + 1614, 1612, 1610, 1608, 1606, 1604, 1602, 1600, 1598, 1597, 1595, 1593, + 1591, 1589, 1587, 1585, 1583, 1582, 1580, 1578, 1576, 1574, 1572, 1571, + 1569, 1567, 1565, 1563, 1562, 1560, 1558, 1556, 1555, 1553, 1551, 1549, + 1548, 1546, 1544, 1542, 1541, 1539, 1537, 1536, 1534, 1532, 1531, 1529, + 1527, 1526, 1524, 1522, 1521, 1519, 1517, 1516, 1514, 1513, 1511, 1509, + 1508, 1506, 1505, 1503, 1501, 1500, 1498, 1497, 1495, 1494, 1492, 1490, + 1489, 1487, 1486, 1484, 1483, 1481, 1480, 1478, 1477, 1475, 1474, 1472, + 1471, 1469, 1468, 1466, 1465, 1463, 1462, 1461, 1459, 1458, 1456, 1455, + 1453, 1452, 1450, 1449, 1448, 1446, 1445, 1443, 1442, 1441, 1439, 1438, + 1436, 1435, 1434, 1432, 1431, 1430, 1428, 1427, 1426, 1424, 1423, 1422, + 1420, 1419, 1418, 1416, 1415, 1414, 1412, 1411, 1410, 1408, 1407, 1406, + 1404, 1403, 1402, 1401, 1399, 1398, 1397, 1395, 1394, 1393, 1392, 1390, + 1389, 1388, 1387, 1385, 1384, 1383, 1382, 1381, 1379, 1378, 1377, 1376, + 1374, 1373, 1372, 1371, 1370, 1368, 1367, 1366, 1365, 1364, 1362, 1361, + 1360, 1359, 1358, 1357, 1355, 1354, 1353, 1352, 1351, 1350, 1349, 1347, + 1346, 1345, 1344, 1343, 1342, 1341, 1339, 1338, 1337, 1336, 1335, 1334, + 1333, 1332, 1331, 1330, 1328, 1327, 1326, 1325, 1324, 1323, 1322, 1321, + 1320, 1319, 1318, 1317, 1315, 1314, 1313, 1312, 1311, 1310, 1309, 1308, + 1307, 1306, 1305, 1304, 1303, 1302, 1301, 1300, 1299, 1298, 1297, 1296, + 1295, 1294, 1293, 1292, 1291, 1290, 1289, 1288, 1287, 1286, 1285, 1284, + 1283, 1282, 1281, 1280, 1279, 1278, 1277, 1276, 1275, 1274, 1273, 1272, + 1271, 1270, 1269, 1268, 1267, 1266, 1265, 1264, 1264, 1263, 1262, 1261, + 1260, 1259, 1258, 1257, 1256, 1255, 1254, 1253, 1252, 1252, 1251, 1250, + 1249, 1248, 1247, 1246, 1245, 1244, 1243, 1242, 1242, 1241, 1240, 1239, + 1238, 1237, 1236, 1235, 1234, 1234, 1233, 1232, 1231, 1230, 1229, 1228, + 1228, 1227, 1226, 1225, 1224, 1223, 1222, 1222, 1221, 1220, 1219, 1218, + 1217, 1216, 1216, 1215, 1214, 1213, 1212, 1211, 1211, 1210, 1209, 1208, + 1207, 1207, 1206, 1205, 1204, 1203, 1202, 1202, 1201, 1200, 1199, 1198, + 1198, 1197, 1196, 1195, 1194, 1194, 1193, 1192, 1191, 1190, 1190, 1189, + 1188, 1187, 1187, 1186, 1185, 1184, 1183, 1183, 1182, 1181, 1180, 1180, + 1179, 1178, 1177, 1177, 1176, 1175, 1174, 1174, 1173, 1172, 1171, 1171, + 1170, 1169, 1168, 1168, 1167, 1166, 1165, 1165, 1164, 1163, 1162, 1162, + 1161, 1160, 1159, 1159, 1158, 1157, 1157, 1156, 1155, 1154, 1154, 1153, + 1152, 1152, 1151, 1150, 1149, 1149, 1148, 1147, 1147, 1146, 1145, 1145, + 1144, 1143, 1142, 1142, 1141, 1140, 1140, 1139, 1138, 1138, 1137, 1136, + 1136, 1135, 1134, 1133, 1133, 1132, 1131, 1131, 1130, 1129, 1129, 1128, + 1127, 1127, 1126, 1125, 1125, 1124, 1123, 1123, 1122, 1121, 1121, 1120, + 1119, 1119, 1118, 1118, 1117, 1116, 1116, 1115, 1114, 1114, 1113, 1112, + 1112, 1111, 1110, 1110, 1109, 1109, 1108, 1107, 1107, 1106, 1105, 1105, + 1104, 1103, 1103, 1102, 1102, 1101, 1100, 1100, 1099, 1099, 1098, 1097, + 1097, 1096, 1095, 1095, 1094, 1094, 1093, 1092, 1092, 1091, 1091, 1090, + 1089, 1089, 1088, 1088, 1087, 1086, 1086, 1085, 1085, 1084, 1083, 1083, + 1082, 1082, 1081, 1080, 1080, 1079, 1079, 1078, 1077, 1077, 1076, 1076, + 1075, 1075, 1074, 1073, 1073, 1072, 1072, 1071, 1071, 1070, 1069, 1069, + 1068, 1068, 1067, 1067, 1066, 1065, 1065, 1064, 1064, 1063, 1063, 1062, + 1062, 1061, 1060, 1060, 1059, 1059, 1058, 1058, 1057, 1057, 1056, 1055, + 1055, 1054, 1054, 1053, 1053, 1052, 1052, 1051, 1051, 1050, 1049, 1049, + 1048, 1048, 1047, 1047, 1046, 1046, 1045, 1045, 1044, 1044, 1043, 1043, + 1042, 1041, 1041, 1040, 1040, 1039, 1039, 1038, 1038, 1037, 1037, 1036, + 1036, 1035, 1035, 1034, 1034, 1033, 1033, 1032, 1032, 1031, 1031, 1030, + 1030, 1029, 1029, 1028, 1028, 1027, 1027, 1026, 1026, 1025, 1025, 1024, + 1024 }; + +/* table of v0^3 */ +static const mp_limb_t T3[768] = + { 8539701184, 8489664000, 8439822656, 8390176768, 8340725952, + 8291469824, 8242408000, 8193540096, 8144865728, 8108486729, 8060150125, + 8012006001, 7964053973, 7928215784, 7880599000, 7833173256, 7797729087, + 7750636739, 7703734375, 7668682048, 7622111232, 7587307125, 7541066681, + 7506509912, 7460598664, 7426288351, 7380705123, 7346640384, 7312680621, + 7267563953, 7233848504, 7189057000, 7155584983, 7122217024, 7077888000, + 7044762213, 7011739944, 6978821031, 6935089643, 6902411264, 6869835701, + 6837362792, 6804992375, 6761990971, 6729859072, 6697829125, 6665900968, + 6634074439, 6602349376, 6570725617, 6539203000, 6507781363, 6476460544, + 6445240381, 6414120712, 6383101375, 6352182208, 6321363049, 6290643736, + 6260024107, 6229504000, 6199083253, 6168761704, 6138539191, 6108415552, + 6088387976, 6058428767, 6028568000, 5998805513, 5969141144, 5949419328, + 5919918129, 5890514616, 5861208627, 5841725401, 5812581592, 5783534875, + 5754585088, 5735339000, 5706550403, 5677858304, 5658783768, 5630252139, + 5611284433, 5582912824, 5554637011, 5535839609, 5507723096, 5489031744, + 5461074081, 5442488479, 5414689216, 5396209064, 5368567751, 5350192749, + 5322708936, 5304438784, 5277112021, 5258946419, 5231776256, 5213714904, + 5186700891, 5168743489, 5150827583, 5124031424, 5106219048, 5079577959, + 5061868813, 5044200875, 5017776128, 5000211000, 4982686912, 4956477625, + 4939055927, 4921675101, 4895680392, 4878401536, 4861163384, 4843965888, + 4818245769, 4801149703, 4784094125, 4767078987, 4741632000, 4724717752, + 4707843776, 4691010024, 4674216448, 4657463000, 4632407963, 4615754625, + 4599141247, 4582567781, 4566034179, 4549540393, 4533086375, 4508479808, + 4492125000, 4475809792, 4459534136, 4443297984, 4427101288, 4410944000, + 4394826072, 4378747456, 4362708104, 4346707968, 4330747000, 4314825152, + 4298942376, 4283098624, 4267293848, 4251528000, 4235801032, 4220112896, + 4204463544, 4188852928, 4173281000, 4157747712, 4142253016, 4126796864, + 4111379208, 4096000000, 4080659192, 4073003173, 4057719875, 4042474857, + 4027268071, 4012099469, 3996969003, 3981876625, 3966822287, 3959309368, + 3944312000, 3929352552, 3914430976, 3899547224, 3884701248, 3877292411, + 3862503009, 3847751263, 3833037125, 3818360547, 3811036328, 3796416000, + 3781833112, 3767287616, 3760028875, 3745539377, 3731087151, 3716672149, + 3709478592, 3695119336, 3680797184, 3666512088, 3659383421, 3645153819, + 3630961153, 3623878656, 3609741304, 3595640768, 3588604291, 3574558889, + 3560550183, 3553559576, 3539605824, 3525688648, 3518743761, 3504881359, + 3491055413, 3484156096, 3470384744, 3463512697, 3449795831, 3436115229, + 3429288512, 3415662216, 3408862625, 3395290527, 3381754501, 3375000000, + 3361517992, 3354790473, 3341362375, 3334661784, 3321287488, 3307949000, + 3301293169, 3288008303, 3281379256, 3268147904, 3261545587, 3248367641, + 3241792000, 3228667352, 3222118333, 3209046875, 3202524424, 3189506048, + 3183010111, 3170044709, 3163575232, 3150662696, 3144219625, 3131359847, + 3124943128, 3118535181, 3105745579, 3099363912, 3086626816, 3080271375, + 3067586677, 3061257408, 3048625000, 3042321849, 3036027392, 3023464536, + 3017196125, 3004685307, 2998442888, 2992209121, 2979767519, 2973559672, + 2961169856, 2954987875, 2948814504, 2936493568, 2930345991, 2924207000, + 2911954752, 2905841483, 2899736776, 2887553024, 2881473967, 2875403448, + 2863288000, 2857243059, 2851206632, 2839159296, 2833148375, 2827145944, + 2815166528, 2809189531, 2803221000, 2791309312, 2785366143, 2779431416, + 2767587264, 2761677827, 2755776808, 2749884201, 2738124199, 2732256792, + 2726397773, 2714704875, 2708870984, 2703045457, 2697228288, 2685619000, + 2679826869, 2674043072, 2668267603, 2656741625, 2650991104, 2645248887, + 2639514968, 2633789341, 2622362939, 2616662152, 2610969633, 2605285376, + 2593941624, 2588282117, 2582630848, 2576987811, 2571353000, 2560108032, + 2554497863, 2548895896, 2543302125, 2537716544, 2526569928, 2521008881, + 2515456000, 2509911279, 2504374712, 2498846293, 2487813875, 2482309864, + 2476813977, 2471326208, 2465846551, 2460375000, 2454911549, 2444008923, + 2438569736, 2433138625, 2427715584, 2422300607, 2416893688, 2411494821, + 2400721219, 2395346472, 2389979753, 2384621056, 2379270375, 2373927704, + 2368593037, 2363266368, 2357947691, 2352637000, 2342039552, 2336752783, + 2331473976, 2326203125, 2320940224, 2315685267, 2310438248, 2305199161, + 2299968000, 2294744759, 2289529432, 2284322013, 2273930875, 2268747144, + 2263571297, 2258403328, 2253243231, 2248091000, 2242946629, 2237810112, + 2232681443, 2227560616, 2222447625, 2217342464, 2212245127, 2207155608, + 2202073901, 2197000000, 2191933899, 2186875592, 2181825073, 2176782336, + 2171747375, 2166720184, 2161700757, 2156689088, 2151685171, 2146689000, + 2141700569, 2136719872, 2131746903, 2126781656, 2121824125, 2116874304, + 2111932187, 2106997768, 2102071041, 2097152000, 2092240639, 2087336952, + 2082440933, 2077552576, 2072671875, 2067798824, 2062933417, 2058075648, + 2053225511, 2048383000, 2043548109, 2038720832, 2033901163, 2029089096, + 2024284625, 2019487744, 2019487744, 2014698447, 2009916728, 2005142581, + 2000376000, 1995616979, 1990865512, 1986121593, 1981385216, 1976656375, + 1971935064, 1967221277, 1962515008, 1962515008, 1957816251, 1953125000, + 1948441249, 1943764992, 1939096223, 1934434936, 1929781125, 1925134784, + 1920495907, 1915864488, 1915864488, 1911240521, 1906624000, 1902014919, + 1897413272, 1892819053, 1888232256, 1883652875, 1879080904, 1879080904, + 1874516337, 1869959168, 1865409391, 1860867000, 1856331989, 1851804352, + 1851804352, 1847284083, 1842771176, 1838265625, 1833767424, 1829276567, + 1824793048, 1824793048, 1820316861, 1815848000, 1811386459, 1806932232, + 1802485313, 1798045696, 1798045696, 1793613375, 1789188344, 1784770597, + 1780360128, 1775956931, 1775956931, 1771561000, 1767172329, 1762790912, + 1758416743, 1758416743, 1754049816, 1749690125, 1745337664, 1740992427, + 1736654408, 1736654408, 1732323601, 1728000000, 1723683599, 1719374392, + 1719374392, 1715072373, 1710777536, 1706489875, 1702209384, 1702209384, + 1697936057, 1693669888, 1689410871, 1685159000, 1685159000, 1680914269, + 1676676672, 1672446203, 1672446203, 1668222856, 1664006625, 1659797504, + 1655595487, 1655595487, 1651400568, 1647212741, 1643032000, 1643032000, + 1638858339, 1634691752, 1630532233, 1630532233, 1626379776, 1622234375, + 1618096024, 1618096024, 1613964717, 1609840448, 1605723211, 1605723211, + 1601613000, 1597509809, 1593413632, 1593413632, 1589324463, 1585242296, + 1581167125, 1581167125, 1577098944, 1573037747, 1568983528, 1568983528, + 1564936281, 1560896000, 1556862679, 1556862679, 1552836312, 1548816893, + 1548816893, 1544804416, 1540798875, 1536800264, 1536800264, 1532808577, + 1528823808, 1528823808, 1524845951, 1520875000, 1516910949, 1516910949, + 1512953792, 1509003523, 1509003523, 1505060136, 1501123625, 1501123625, + 1497193984, 1493271207, 1489355288, 1489355288, 1485446221, 1481544000, + 1481544000, 1477648619, 1473760072, 1473760072, 1469878353, 1466003456, + 1466003456, 1462135375, 1458274104, 1454419637, 1454419637, 1450571968, + 1446731091, 1446731091, 1442897000, 1439069689, 1439069689, 1435249152, + 1431435383, 1431435383, 1427628376, 1423828125, 1423828125, 1420034624, + 1416247867, 1416247867, 1412467848, 1408694561, 1408694561, 1404928000, + 1401168159, 1401168159, 1397415032, 1397415032, 1393668613, 1389928896, + 1389928896, 1386195875, 1382469544, 1382469544, 1378749897, 1375036928, + 1375036928, 1371330631, 1367631000, 1367631000, 1363938029, 1363938029, + 1360251712, 1356572043, 1356572043, 1352899016, 1349232625, 1349232625, + 1345572864, 1341919727, 1341919727, 1338273208, 1338273208, 1334633301, + 1331000000, 1331000000, 1327373299, 1327373299, 1323753192, 1320139673, + 1320139673, 1316532736, 1312932375, 1312932375, 1309338584, 1309338584, + 1305751357, 1302170688, 1302170688, 1298596571, 1298596571, 1295029000, + 1291467969, 1291467969, 1287913472, 1287913472, 1284365503, 1280824056, + 1280824056, 1277289125, 1277289125, 1273760704, 1270238787, 1270238787, + 1266723368, 1266723368, 1263214441, 1259712000, 1259712000, 1256216039, + 1256216039, 1252726552, 1249243533, 1249243533, 1245766976, 1245766976, + 1242296875, 1242296875, 1238833224, 1235376017, 1235376017, 1231925248, + 1231925248, 1228480911, 1228480911, 1225043000, 1221611509, 1221611509, + 1218186432, 1218186432, 1214767763, 1214767763, 1211355496, 1207949625, + 1207949625, 1204550144, 1204550144, 1201157047, 1201157047, 1197770328, + 1197770328, 1194389981, 1191016000, 1191016000, 1187648379, 1187648379, + 1184287112, 1184287112, 1180932193, 1180932193, 1177583616, 1174241375, + 1174241375, 1170905464, 1170905464, 1167575877, 1167575877, 1164252608, + 1164252608, 1160935651, 1160935651, 1157625000, 1154320649, 1154320649, + 1151022592, 1151022592, 1147730823, 1147730823, 1144445336, 1144445336, + 1141166125, 1141166125, 1137893184, 1137893184, 1134626507, 1134626507, + 1131366088, 1128111921, 1128111921, 1124864000, 1124864000, 1121622319, + 1121622319, 1118386872, 1118386872, 1115157653, 1115157653, 1111934656, + 1111934656, 1108717875, 1108717875, 1105507304, 1105507304, 1102302937, + 1102302937, 1099104768, 1099104768, 1095912791, 1095912791, 1092727000, + 1092727000, 1089547389, 1089547389, 1086373952, 1086373952, 1083206683, + 1083206683, 1080045576, 1080045576, 1076890625, 1076890625, 1073741824, + 1073741824 }; + +/* umul_hi(h, x, y) puts in h the high part of x*y */ +#ifdef HAVE_MULX_U64 +#include +#define umul_hi(h, x, y) _mulx_u64 (x, y, (unsigned long long *) &h) +#else +#define umul_hi(h, x, y) \ + do { \ + mp_limb_t _l; \ + umul_ppmm (h, _l, x, y); \ + } while (0) +#endif + +/* given 2^62 <= d < 2^64, put in r an approximation of + s = floor(2^96/sqrt(r)) - 2^64, with r <= s <= r + 15 */ +#define __gmpfr_invsqrt_limb_approx(r, d) \ + do { \ + mp_limb_t _d, _i, _v0, _e0, _d37, _v1, _e1, _h, _v2, _e2; \ + _d = (d); \ + _i = (_d >> 54) - 256; \ + /* i = d10 - 256 */ \ + _v0 = T[_i]; \ + _d37 = 1 + (_d >> 27); \ + _e0 = T3[_i] * _d37; \ + /* the value (_v0 << 57) - _e0 is less than 2^61 */ \ + _v1 = (_v0 << 11) + (((_v0 << 57) - _e0) >> 47); \ + _e1 = - _v1 * _v1 * _d37; \ + umul_hi (_h, _v1, _e1); \ + /* _h = floor(e_1*v_1/2^64) */ \ + _v2 = (_v1 << 10) + (_h >> 6); \ + umul_hi (_h, _v2 * _v2, _d); \ + /* in _h + 2, one +1 accounts for the lower neglected part of */ \ + /* v2^2*d. the other +1 is to compute ceil((h+1)/2) */ \ + _e2 = (MPFR_LIMB_ONE << 61) - ((_h + 2) >> 1); \ + _h = _v2 * _e2; \ + (r) = (_v2 << 33) + (_h >> 29); \ + } while (0) + +/* given 2^62 <= d < 2^64, return a 32-bit approximation r of + sqrt(2^126/d) */ +#define __gmpfr_invsqrt_halflimb_approx(r, d) \ + do { \ + mp_limb_t _d, _i, _v0, _e0, _d37, _v1, _e1, _h; \ + _d = (d); \ + _i = (_d >> 54) - 256; \ + /* i = d10 - 256 */ \ + _v0 = T[_i]; \ + _d37 = 1 + (_d >> 27); \ + _e0 = T3[_i] * _d37; \ + /* the value (_v0 << 57) - _e0 is less than 2^61 */ \ + _v1 = (_v0 << 11) + (((_v0 << 57) - _e0) >> 47); \ + _e1 = - _v1 * _v1 * _d37; \ + umul_hi (_h, _v1, _e1); \ + /* _h = floor(e_1*v_1/2^64) */ \ + (r) = (_v1 << 10) + (_h >> 6); \ + } while (0) + +/* given 2^62 <= n < 2^64, put in s an approximation of sqrt(2^64*n), + with: s <= floor(sqrt(2^64*u)) <= s + 7 */ +#define __gmpfr_sqrt_limb_approx(s, n) \ + do { \ + mp_limb_t _n, _x, _y, _z, _t; \ + _n = (n); \ + __gmpfr_invsqrt_halflimb_approx (_x, _n); \ + MPFR_ASSERTD(_x < MPFR_LIMB_ONE << 32); \ + /* x has 32 bits, and is near (by below) sqrt(2^126/n) */ \ + _y = (_x * (_n >> 31)) >> 32; \ + MPFR_ASSERTD(_y < MPFR_LIMB_ONE << 32); \ + /* y is near (by below) sqrt(n) */ \ + _z = _n - _y * _y; \ + /* reduce _z so that _z <= 2*_y */ \ + /* the maximal value of _z is 2*(2^32-1) */ \ + while (_z > 2 * ((MPFR_LIMB_ONE << 32) - 1)) \ + { \ + _z -= (_y + _y) + 1; \ + _y ++; \ + } \ + /* now z <= 2*(2^32-1): one reduction is enough */ \ + if (_z > _y + _y) \ + { \ + _z -= (_y + _y) + 1; \ + _y ++; \ + } \ + /* _x * _z should be < 2^64 */ \ + _t = (_x * _z) >> 32; \ + (s) = (_y << 32) + _t; \ + } while (0) + +/* given 2^62 <= u < 2^64, put in s the value floor(sqrt(2^64*u)), + and in rh in rl the remainder: 2^64*u - s^2 = 2^64*rh + rl, with + 2^64*rh + rl <= 2*s, and in invs the approximation of 2^96/sqrt(u) */ +#define __gmpfr_sqrt_limb(s, rh, rl, invs, u) \ + do { \ + mp_limb_t _u, _invs, _r, _h, _l; \ + _u = (u); \ + __gmpfr_invsqrt_limb_approx (_invs, _u); \ + umul_hi (_h, _invs, _u); \ + _r = _h + _u; \ + /* make sure _r has its most significant bit set */ \ + if (MPFR_UNLIKELY(_r < MPFR_LIMB_HIGHBIT)) \ + _r = MPFR_LIMB_HIGHBIT; \ + /* we know _r <= sqrt(2^64*u) <= _r + 16 */ \ + umul_ppmm (_h, _l, _r, _r); \ + sub_ddmmss (_h, _l, _u, 0, _h, _l); \ + /* now h:l <= 30*_r */ \ + MPFR_ASSERTD(_h < 30); \ + if (_h >= 16) \ + { /* subtract 16r+64 to h:l, add 8 to _r */ \ + sub_ddmmss (_h, _l, _h, _l, _r >> 60, _r << 4); \ + sub_ddmmss (_h, _l, _h, _l, 0, 64); \ + _r += 8; \ + } \ + if (_h >= 8) \ + { /* subtract 8r+16 to h:l, add 4 to _r */ \ + sub_ddmmss (_h, _l, _h, _l, _r >> 61, _r << 3); \ + sub_ddmmss (_h, _l, _h, _l, 0, 16); \ + _r += 4; \ + } \ + if (_h >= 4) \ + { /* subtract 4r+4 to h:l, add 2 to _r */ \ + sub_ddmmss (_h, _l, _h, _l, _r >> 62, _r << 2); \ + sub_ddmmss (_h, _l, _h, _l, 0, 4); \ + _r += 2; \ + } \ + while (_h > 1 || ((_h == 1) && (_l > 2 * _r))) \ + { /* subtract 2r+1 to h:l, add 1 to _r */ \ + sub_ddmmss (_h, _l, _h, _l, _r >> 63, (_r << 1) + 1); \ + _r ++; \ + } \ + (s) = _r; \ + (rh) = _h; \ + (rl) = _l; \ + (invs) = _invs; \ + } while (0) + +#endif /* GMP_NUMB_BITS == 64 */ diff -Nru mpfr4-3.1.4/src/isinf.c mpfr4-4.0.2/src/isinf.c --- mpfr4-3.1.4/src/isinf.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/isinf.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_inf_p -- check for infinities -Copyright 2000-2001, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2000-2001, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/isinteger.c mpfr4-4.0.2/src/isinteger.c --- mpfr4-3.1.4/src/isinteger.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/isinteger.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_integer_p -- test if a mpfr variable is integer. -Copyright 2001-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2001-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff -Nru mpfr4-3.1.4/src/isnan.c mpfr4-4.0.2/src/isnan.c --- mpfr4-3.1.4/src/isnan.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/isnan.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_nan_p -- check for NaN -Copyright 2000-2001, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2000-2001, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/isnum.c mpfr4-4.0.2/src/isnum.c --- mpfr4-3.1.4/src/isnum.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/isnum.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_number_p -- check for ordinary numbers -Copyright 2000-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2000-2002, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/isqrt.c mpfr4-4.0.2/src/isqrt.c --- mpfr4-3.1.4/src/isqrt.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/isqrt.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* __gmpfr_isqrt && __gmpfr_cuberoot -- Integer square root and cube root -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/isregular.c mpfr4-4.0.2/src/isregular.c --- mpfr4-3.1.4/src/isregular.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/isregular.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_regular_p -- check for regular number (neither NaN, Inf or zero) -Copyright 2009-2016 Free Software Foundation, Inc. +Copyright 2009-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/iszero.c mpfr4-4.0.2/src/iszero.c --- mpfr4-3.1.4/src/iszero.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/iszero.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_zero_p -- check for zero -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/jn.c mpfr4-4.0.2/src/jn.c --- mpfr4-3.1.4/src/jn.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/jn.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_j0, mpfr_j1, mpfr_jn -- Bessel functions of 1st kind, integer order. http://www.opengroup.org/onlinepubs/009695399/functions/j0.html -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -158,12 +158,12 @@ but in rounding to nearest, res/2 will yield 0 iff |res| is the minimum positive number, so that we just need to test the result of the division and the sign of _inexact. */ - mpfr_clear_flags (); + MPFR_CLEAR_FLAGS (); MPFR_FAST_COMPUTE_IF_SMALL_INPUT (res, z, -2 * MPFR_GET_EXP (z), 3, 0, r, { int inex2 = mpfr_div_2ui (res, res, 1, r); if (MPFR_UNLIKELY (r == MPFR_RNDN && MPFR_IS_ZERO (res)) && - (MPFR_ASSERTN (inex2 != 0), SIGN (_inexact) != MPFR_SIGN (z))) + (MPFR_ASSERTN (inex2 != 0), VSIGN (_inexact) != MPFR_SIGN (z))) { mpfr_nexttoinf (res); inex = - inex2; @@ -197,7 +197,7 @@ { /* the following is an upper 32-bit approximation to exp(1)/2 */ mpfr_set_str_binary (y, "1.0101101111110000101010001011001"); - if (MPFR_SIGN(z) > 0) + if (MPFR_IS_POS (z)) mpfr_mul (y, y, z, MPFR_RNDU); else { @@ -246,10 +246,10 @@ MPFR_BLOCK (flags, { mpfr_pow_ui (t, z, absn, MPFR_RNDN); /* z^|n| */ mpfr_mul (y, z, z, MPFR_RNDN); /* z^2 */ - mpfr_clear_erangeflag (); + MPFR_CLEAR_ERANGEFLAG (); zz = mpfr_get_ui (y, MPFR_RNDU); /* FIXME: The error analysis is incorrect in case of range error. */ - MPFR_ASSERTN (! mpfr_erangeflag_p ()); /* since mpfr_clear_erangeflag */ + MPFR_ASSERTN (! mpfr_erangeflag_p ()); /* since MPFR_CLEAR_ERANGEFLAG */ mpfr_div_2ui (y, y, 2, MPFR_RNDN); /* z^2/4 */ mpfr_fac_ui (s, absn, MPFR_RNDN); /* |n|! */ mpfr_div (t, t, s, MPFR_RNDN); @@ -311,6 +311,11 @@ MPFR_ASSERTN (! exception); exception = 1; } + /* the expected number of lost bits is k0, if err is larger than k0 + most probably there is a cancellation in the series, thus we add + err - k0 bits to prec */ + if (err > k0) + prec = MPFR_ADD_PREC (prec, err - k0); MPFR_ZIV_NEXT (loop, prec); } MPFR_ZIV_FREE (loop); diff -Nru mpfr4-3.1.4/src/jyn_asympt.c mpfr4-4.0.2/src/jyn_asympt.c --- mpfr4-3.1.4/src/jyn_asympt.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/jyn_asympt.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_jn_asympt, mpfr_yn_asympt -- shared code for mpfr_jn and mpfr_yn -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef MPFR_JN @@ -36,6 +36,8 @@ (z can be negative only for jn). Return 0 if the expansion does not converge enough (the value 0 as inexact flag should not happen for normal input). + Note: for MPFR_RNDF, it returns 0 if the expansion failed, and a non-zero + value otherwise (with no other meaning). */ static int FUNCTION (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r) @@ -265,5 +267,7 @@ : mpfr_neg (res, c, r); mpfr_clear (c); - return inex; + /* for RNDF, mpfr_set or mpfr_neg may return 0, but if we return 0, it + would mean the asymptotic expansion failed, thus we return 1 instead */ + return (r != MPFR_RNDF) ? inex : 1; } diff -Nru mpfr4-3.1.4/src/li2.c mpfr4-4.0.2/src/li2.c --- mpfr4-3.1.4/src/li2.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/li2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_li2 -- Dilogarithm. -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -33,18 +33,17 @@ static int li2_series (mpfr_t sum, mpfr_srcptr z, mpfr_rnd_t rnd_mode) { - int i, Bm, Bmax; + int i; mpfr_t s, u, v, w; mpfr_prec_t sump, p; mpfr_exp_t se, err; - mpz_t *B; MPFR_ZIV_DECL (loop); /* The series converges for |z| < 2 pi, but in mpfr_li2 the argument is - reduced so that 0 < z <= log(2). Here is additionnal check that z is - (nearly) correct */ + reduced so that 0 < z <= log(2). Here is an additional check that z + is (nearly) correct. */ MPFR_ASSERTD (MPFR_IS_STRICTPOS (z)); - MPFR_ASSERTD (mpfr_cmp_d (z, 0.6953125) <= 0); + MPFR_ASSERTD (mpfr_cmp_ui_2exp (z, 89, -7) <= 0); /* z <= 0.6953125 */ sump = MPFR_PREC (sum); /* target precision */ p = sump + MPFR_INT_CEIL_LOG2 (sump) + 4; /* the working precision */ @@ -53,9 +52,6 @@ mpfr_init2 (v, p); mpfr_init2 (w, p); - B = mpfr_bernoulli_internal ((mpz_t *) 0, 0); - Bm = Bmax = 1; - MPFR_ZIV_INIT (loop, p); for (;;) { @@ -67,9 +63,6 @@ for (i = 1;; i++) { - if (i >= Bmax) - B = mpfr_bernoulli_internal (B, Bmax++); /* B_2i*(2i+1)!, exact */ - mpfr_mul (v, u, v, MPFR_RNDU); mpfr_div_ui (v, v, 2 * i, MPFR_RNDU); mpfr_div_ui (v, v, 2 * i, MPFR_RNDU); @@ -77,7 +70,7 @@ mpfr_div_ui (v, v, 2 * i + 1, MPFR_RNDU); /* here, v_2i = v_{2i-2} / (2i * (2i+1))^2 */ - mpfr_mul_z (w, v, B[i], MPFR_RNDN); + mpfr_mul_z (w, v, mpfr_bernoulli_cache(i), MPFR_RNDN); /* here, w_2i = v_2i * B_2i * (2i+1)! with error(w_2i) < 2^(5 * i + 8) ulp(w_2i) (see algorithms.tex) */ @@ -107,10 +100,6 @@ MPFR_ZIV_FREE (loop); mpfr_set (sum, s, rnd_mode); - Bm = Bmax; - while (Bm--) - mpz_clear (B[Bm]); - (*__gmp_free_func) (B, Bmax * sizeof (mpz_t)); mpfr_clears (s, u, v, w, (mpfr_ptr) 0); /* Let K be the returned value. @@ -129,7 +118,7 @@ thus |Li2(x) - g(x)| <= 2/x. Assumes x >= 38, which ensures log(x)^2/2 >= 2*Pi^2/3, and g(x) <= -3.3. Return 0 if asymptotic expansion failed (unable to round), otherwise - returns correct ternary value. + returns 1 for RNDF, and correct ternary value otherwise. */ static int mpfr_li2_asympt_pos (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) @@ -161,7 +150,11 @@ bounded by 16 ulp(g). */ if ((MPFR_EXP (x) >= (mpfr_exp_t) w - MPFR_EXP (g)) && MPFR_CAN_ROUND (g, w - 4, MPFR_PREC (y), rnd_mode)) - inex = mpfr_set (y, g, rnd_mode); + { + inex = mpfr_set (y, g, rnd_mode); + if (rnd_mode == MPFR_RNDF) + inex = 1; + } mpfr_clear (g); mpfr_clear (h); @@ -175,7 +168,7 @@ |Li2(x) - g(x)| <= 1/|x|. Assumes x <= -7, which ensures |log(-x)^2/2| >= Pi^2/6, and g(x) <= -3.5. Return 0 if asymptotic expansion failed (unable to round), otherwise - returns correct ternary value. + returns 1 for RNDF, and correct ternary value otherwise. */ static int mpfr_li2_asympt_neg (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) @@ -204,7 +197,11 @@ total error is bounded by 16 ulp(g). */ if ((MPFR_EXP (x) >= (mpfr_exp_t) (w - 2) - MPFR_EXP (g)) && MPFR_CAN_ROUND (g, w - 4, MPFR_PREC (y), rnd_mode)) - inex = mpfr_neg (y, g, rnd_mode); + { + inex = mpfr_neg (y, g, rnd_mode); + if (rnd_mode == MPFR_RNDF) + inex = 1; + } mpfr_clear (g); mpfr_clear (h); @@ -264,7 +261,7 @@ yp = MPFR_PREC (y); m = yp + MPFR_INT_CEIL_LOG2 (yp) + 13; - if (MPFR_LIKELY ((mpfr_cmp_ui (x, 0) > 0) && (mpfr_cmp_d (x, 0.5) <= 0))) + if (MPFR_LIKELY ((mpfr_cmp_ui (x, 0) > 0) && (mpfr_cmp_ui_2exp (x, 1, -1) <= 0))) /* 0 < x <= 1/2: Li2(x) = S(-log(1-x))-log^2(1-x)/4 */ { mpfr_t s, u; diff -Nru mpfr4-3.1.4/src/lngamma.c mpfr4-4.0.2/src/lngamma.c --- mpfr4-3.1.4/src/lngamma.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/lngamma.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_lngamma -- lngamma function -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -33,6 +33,10 @@ static void mpfr_gamma_alpha (mpfr_t s, mpfr_prec_t p) { + MPFR_LOG_FUNC + (("p=%Pu", p), + ("s[%Pu]=%.*Rg", mpfr_get_prec (s), mpfr_log_prec, s)); + if (p <= 100) mpfr_set_ui_2exp (s, 614, -10, MPFR_RNDN); /* about 0.6 */ else if (p <= 500) @@ -72,7 +76,7 @@ /* s1 = RNDD(lngamma(x)), inexact */ if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags1))) { - if (MPFR_SIGN (s1) > 0) + if (MPFR_IS_POS (s1)) { MPFR_SAVE_EXPO_UPDATE_FLAGS (*pexpo, MPFR_FLAGS_OVERFLOW); return mpfr_overflow (y, rnd, sign); @@ -141,6 +145,12 @@ #endif +/* FIXME: There is an internal overflow when z is very large. + Simple overflow detection with possible false negatives? + For the particular cases near the overflow boundary, + scaling by a power of two? +*/ + /* lngamma(x) = log(gamma(x)). We use formula [6.1.40] from Abramowitz&Stegun: lngamma(z) = (z-1/2)*log(z) - z + 1/2*log(2*Pi) @@ -161,17 +171,18 @@ { mpfr_prec_t precy, w; /* working precision */ mpfr_t s, t, u, v, z; - unsigned long m, k, maxm; - mpz_t *INITIALIZED(B); /* variable B declared as initialized */ - int compared; - int inexact = 0; /* 0 means: result y not set yet */ + unsigned long m, k, maxm, l; + int compared, inexact; mpfr_exp_t err_s, err_t; - unsigned long Bm = 0; /* number of allocated B[] */ - unsigned long oldBm; double d; MPFR_SAVE_EXPO_DECL (expo); MPFR_ZIV_DECL (loop); + MPFR_LOG_FUNC + (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (z0), mpfr_log_prec, z0, rnd), + ("y[%Pu]=%.*Rg inexact=%d", + mpfr_get_prec (y), mpfr_log_prec, y, inexact)); + compared = mpfr_cmp_ui (z0, 1); MPFR_SAVE_EXPO_MARK (expo); @@ -183,9 +194,52 @@ return mpfr_set_ui (y, 0, MPFR_RNDN); /* lngamma(1 or 2) = +0 */ } + /* Deal with very large inputs: according to [6.1.42], if we denote + R_n(z) = lngamma(z) - (z-1/2)*log(z) + z - 1/2*log(2*Pi), we have + |R_n(z)| <= B_2/2/z, thus for z >= 2 we have + |lngamma(z) - [z*(log(z) - 1)]| < 1/2*log(z) + 1. */ + if (compared > 0 && MPFR_GET_EXP (z0) >= (mpfr_exp_t) MPFR_PREC(y) + 2) + { + /* Since PREC(y) >= 2, this ensures EXP(z0) >= 4, thus |z0| >= 8, + thus 1/2*log(z0) + 1 < log(z0). + Since the largest possible z is < 2^(2^62) on a 64-bit machine, + the largest value of log(z) is 2^62*log(2.) < 3.2e18 < 2^62, + thus if we use at least 62 bits of precision, then log(t)-1 will + be exact */ + mpfr_init2 (t, MPFR_PREC(y) >= 52 ? MPFR_PREC(y) + 10 : 62); + mpfr_log (t, z0, MPFR_RNDU); /* error < 1 ulp */ + inexact = mpfr_sub_ui (t, t, 1, MPFR_RNDU); /* err < 2 ulps, since the + exponent of t might have + decreased */ + MPFR_ASSERTD(inexact == 0); + mpfr_mul (t, z0, t, MPFR_RNDU); /* err < 1+2*2=5 ulps according to + "Generic error on multiplication" + in algorithms.tex */ + if (MPFR_IS_INF(t)) + { + mpfr_clear (t); + MPFR_SAVE_EXPO_FREE (expo); + inexact = mpfr_overflow (y, rnd, 1); + return inexact; + } + if (MPFR_GET_EXP(t) - MPFR_PREC(t) >= 62) + { + /* then ulp(t) >= 2^62 > log(z0) thus the total error is bounded + by 6 ulp(t) */ + if (MPFR_CAN_ROUND (t, MPFR_PREC(t) - 3, MPFR_PREC(y), rnd)) + { + inexact = mpfr_set (y, t, rnd); + mpfr_clear (t); + MPFR_SAVE_EXPO_FREE (expo); + return mpfr_check_range (y, inexact, rnd); + } + } + mpfr_clear (t); + } + /* Deal here with tiny inputs. We have for -0.3 <= x <= 0.3: - log|x| - gamma*x <= log|gamma(x)| <= - log|x| - gamma*x + x^2 */ - if (MPFR_EXP(z0) <= - (mpfr_exp_t) MPFR_PREC(y)) + if (MPFR_GET_EXP (z0) <= - (mpfr_exp_t) MPFR_PREC(y)) { mpfr_t l, h, g; int ok, inex1, inex2; @@ -250,7 +304,7 @@ which would need precision n. */ MPFR_ZIV_NEXT (loop, prec); } - while (prec <= -MPFR_EXP(z0)); + while (prec <= - MPFR_GET_EXP (z0)); MPFR_ZIV_FREE (loop); } #endif @@ -263,6 +317,8 @@ mpfr_init2 (v, MPFR_PREC_MIN); mpfr_init2 (z, MPFR_PREC_MIN); + inexact = 0; /* 0 means: result y not set yet */ + if (compared < 0) { mpfr_exp_t err_u; @@ -294,7 +350,10 @@ ulp(u)/2 + (2-z0)*max(1,log(2-z0))*2^(1-w) = (1/2 + (2-z0)*max(1,log(2-z0))*2^(1-E(u))) ulp(u) */ d = (double) MPFR_GET_EXP(s) * 0.694; /* upper bound for log(2-z0) */ - err_u = MPFR_GET_EXP(s) + __gmpfr_ceil_log2 (d) + 1 - MPFR_GET_EXP(u); + if (MPFR_IS_ZERO(u)) /* in that case the error on u is zero */ + err_u = 0; + else + err_u = MPFR_GET_EXP(s) + __gmpfr_ceil_log2 (d) + 1 - MPFR_GET_EXP(u); err_u = (err_u >= 0) ? err_u + 1 : 0; /* now the error on u is bounded by 2^err_u ulps */ @@ -341,19 +400,22 @@ } else { - err_s += 1 - MPFR_GET_EXP(v); + /* if v = 0 here, it was 1 before the call to mpfr_log, + thus the error on v was zero */ + if (!MPFR_IS_ZERO(v)) + err_s += 1 - MPFR_GET_EXP(v); err_s = (err_s >= 0) ? err_s + 1 : 0; /* the error on v is bounded by 2^err_s ulps */ err_u += MPFR_GET_EXP(u); /* absolute error on u */ - err_s += MPFR_GET_EXP(v); /* absolute error on v */ + if (!MPFR_IS_ZERO(v)) /* same as above */ + err_s += MPFR_GET_EXP(v); /* absolute error on v */ mpfr_sub (s, v, u, MPFR_RNDN); /* the total error on s is bounded by ulp(s)/2 + 2^(err_u-w) + 2^(err_s-w) <= ulp(s)/2 + 2^(max(err_u,err_s)+1-w) */ err_s = (err_s >= err_u) ? err_s : err_u; err_s += 1 - MPFR_GET_EXP(s); /* error is 2^err_s ulp(s) */ err_s = (err_s >= 0) ? err_s + 1 : 0; - if (mpfr_can_round (s, w - err_s, MPFR_RNDN, MPFR_RNDZ, precy - + (rnd == MPFR_RNDN))) + if (MPFR_CAN_ROUND (s, w - err_s, precy, rnd)) goto end; } MPFR_ZIV_NEXT (loop, w); @@ -379,11 +441,14 @@ and we need k steps of argument reconstruction. Assuming k is large with respect to z0, and k = n, we get 1/(Pi*e)^(2n) ~ 2^(-w), i.e., k ~ w*log(2)/2/log(Pi*e) ~ 0.1616 * w. - However, since the series is more expensive to compute, the optimal - value seems to be k ~ 4.5 * w experimentally. */ + However, since the series is slightly more expensive to compute, + the optimal value seems to be k ~ 0.25 * w experimentally (with + caching of Bernoulli numbers). + For only one computation of gamma with large precision, it is better + to set k to a larger value, say k ~ w. */ mpfr_set_prec (s, 53); mpfr_gamma_alpha (s, w); - mpfr_set_ui_2exp (s, 9, -1, MPFR_RNDU); + mpfr_set_ui_2exp (s, 4, -4, MPFR_RNDU); mpfr_mul_ui (s, s, w, MPFR_RNDU); if (mpfr_cmp (z0, s) < 0) { @@ -431,15 +496,8 @@ mpfr_mul (u, u, u, MPFR_RNDN); /* 1/z^2 * (1+u)^3 */ - if (Bm == 0) - { - B = mpfr_bernoulli_internal ((mpz_t *) 0, 0); - B = mpfr_bernoulli_internal (B, 1); - Bm = 2; - } - /* m <= maxm ensures that 2*m*(2*m+1) <= ULONG_MAX */ - maxm = 1UL << (GMP_NUMB_BITS / 2 - 1); + maxm = 1UL << (sizeof(unsigned long) * CHAR_BIT / 2 - 1); /* s:(1+u)^15, t:(1+u)^2, t <= 3/128 */ @@ -463,12 +521,7 @@ } /* (1+u)^(10m-8) */ /* invariant: t=1/(2m)/(2m-1)/z^(2m-1)/(2m+1)! */ - if (Bm <= m) - { - B = mpfr_bernoulli_internal (B, m); /* B[2m]*(2m+1)!, exact */ - Bm ++; - } - mpfr_mul_z (v, t, B[m], MPFR_RNDN); /* (1+u)^(10m-7) */ + mpfr_mul_z (v, t, mpfr_bernoulli_cache(m), MPFR_RNDN); /* (1+u)^(10m-7) */ MPFR_ASSERTD(MPFR_GET_EXP(v) <= - (2 * m + 3)); mpfr_add (s, s, v, MPFR_RNDN); } @@ -492,22 +545,92 @@ /* add 1/2*log(2*Pi) and subtract log(z0*(z0+1)*...*(z0+k-1)) */ mpfr_const_pi (v, MPFR_RNDN); /* v = Pi*(1+u) */ mpfr_mul_2ui (v, v, 1, MPFR_RNDN); /* v = 2*Pi * (1+u) */ - if (k) - { - unsigned long l; - mpfr_set (t, z0, MPFR_RNDN); /* t = z0*(1+u) */ - for (l = 1; l < k; l++) - { - mpfr_add_ui (u, z0, l, MPFR_RNDN); /* u = (z0+l)*(1+u) */ - mpfr_mul (t, t, u, MPFR_RNDN); /* (1+u)^(2l+1) */ - } - /* now t: (1+u)^(2k-1) */ - /* instead of computing log(sqrt(2*Pi)/t), we compute - 1/2*log(2*Pi/t^2), which trades a square root for a square */ - mpfr_mul (t, t, t, MPFR_RNDN); /* (z0*...*(z0+k-1))^2, (1+u)^(4k-1) */ - mpfr_div (v, v, t, MPFR_RNDN); - /* 2*Pi/(z0*...*(z0+k-1))^2 (1+u)^(4k+1) */ - } + /* k >= 3 */ + mpfr_set (t, z0, MPFR_RNDN); /* t = z0*(1+u) */ + l = 1; + +/* replace #if 1 by #if 0 for the naive argument reconstruction */ +#if 1 + + /* We multiply by (z0+1)*(z0+2)*...*(z0+k-1) by blocks of j consecutive + terms where j ~ sqrt(k). + If we multiply naively by z0+1, then by z0+2, ..., then by z0+j, + the multiplicative term for the rounding error is (1+u)^(2j). + The multiplicative term is not larger when we multiply by + Z[j] + c[j-1]*Z[j-1] + ... + c[2]*Z[2] + c[1]*z0 + c[0] + with c[p] integers, and Z[p] = z0^p * (1+u)^(p-1). + Note that all terms are positive. + Indeed, since c[1] is exact, c[1]*z0 corresponds to (1+u), + then c[1]*z0 + c[0] corresponds to (1+u)^2, + c[2]*Z[2] + c[1]*z0 + c[0] to (1+u)^3, ..., + c[j-1]*Z[j-1] + ... + c[0] to (1+u)^j, + and Z[j] + c[j-1]*Z[j-1] + ... + c[1]*z0 + c[0] to (1+u)^(j+1). + With the accumulation in t, we get (1+u)^(j+2) and j+2 <= 2j. */ + { + unsigned long j, i, p; + mpfr_t *Z; + mpz_t *c; + for (j = 2; (j + 1) * (j + 1) < k; j++); + /* Z[i] stores z0^i for i <= j */ + Z = (mpfr_t *) mpfr_allocate_func ((j + 1) * sizeof (mpfr_t)); + for (i = 2; i <= j; i++) + mpfr_init2 (Z[i], w); + mpfr_sqr (Z[2], z0, MPFR_RNDN); + for (i = 3; i <= j; i++) + if ((i & 1) == 0) + mpfr_sqr (Z[i], Z[i >> 1], MPFR_RNDN); + else + mpfr_mul (Z[i], Z[i-1], z0, MPFR_RNDN); + c = (mpz_t *) mpfr_allocate_func ((j + 1) * sizeof (mpz_t)); + for (i = 0; i <= j; i++) + mpz_init (c[i]); + for (; l + j <= k; l += j) + { + /* c[i] is the coefficient of x^i in (x+l)*...*(x+l+j-1) */ + mpz_set_ui (c[0], 1); + for (i = 0; i < j; i++) + /* multiply (x+l)*(x+l+1)*...*(x+l+i-1) by x+l+i: + (b[i]*x^i + b[i-1]*x^(i-1) + ... + b[0])*(x+l+i) = + b[i]*x^(i+1) + (b[i-1]+(l+i)*b[i])*x^i + ... + + (b[0]+(l+i)*b[1])*x + i*b[0] */ + { + mpz_set (c[i+1], c[i]); /* b[i]*x^(i+1) */ + for (p = i; p > 0; p--) + { + mpz_mul_ui (c[p], c[p], l + i); + mpz_add (c[p], c[p], c[p-1]); /* b[p-1]+(l+i)*b[p] */ + } + mpz_mul_ui (c[0], c[0], l+i); /* i*b[0] */ + } + /* now compute z0^j + c[j-1]*z0^(j-1) + ... + c[1]*z0 + c[0] */ + mpfr_set_z (u, c[0], MPFR_RNDN); + for (i = 0; i < j; i++) + { + mpfr_mul_z (z, (i == 0) ? z0 : Z[i+1], c[i+1], MPFR_RNDN); + mpfr_add (u, u, z, MPFR_RNDN); + } + mpfr_mul (t, t, u, MPFR_RNDN); + } + for (i = 0; i <= j; i++) + mpz_clear (c[i]); + mpfr_free_func (c, (j + 1) * sizeof (mpz_t)); + for (i = 2; i <= j; i++) + mpfr_clear (Z[i]); + mpfr_free_func (Z, (j + 1) * sizeof (mpfr_t)); + } +#endif /* end of fast argument reconstruction */ + + for (; l < k; l++) + { + mpfr_add_ui (u, z0, l, MPFR_RNDN); /* u = (z0+l)*(1+u) */ + mpfr_mul (t, t, u, MPFR_RNDN); /* (1+u)^(2l+1) */ + } + /* now t: (1+u)^(2k-1) */ + /* instead of computing log(sqrt(2*Pi)/t), we compute + 1/2*log(2*Pi/t^2), which trades a square root for a square */ + mpfr_mul (t, t, t, MPFR_RNDN); /* (z0*...*(z0+k-1))^2, (1+u)^(4k-1) */ + mpfr_div (v, v, t, MPFR_RNDN); + /* 2*Pi/(z0*...*(z0+k-1))^2 (1+u)^(4k+1) */ #ifdef IS_GAMMA err_s = MPFR_GET_EXP(s); mpfr_exp (s, s, MPFR_RNDN); @@ -524,7 +647,7 @@ |h| <= (2m+48)*ulp(s), thus exp(s0) = exp(s) * exp(-h). For |h| <= 1/4, we have |exp(h)-1| <= 1.2*|h| thus |exp(s) - exp(s0)| <= 1.2 * exp(s) * (2m+48)* 2^(EXP(s)-w). */ - d = 1.2 * (2.0 * (double) m + 48.0); + /* d = 1.2 * (2.0 * (double) m + 48.0); */ /* the error on s is bounded by d*2^err_s * 2^(-w) */ mpfr_sqrt (t, v, MPFR_RNDN); /* let v0 be the exact value of v. We have v = v0*(1+u)^(4k+1), @@ -533,7 +656,13 @@ /* the error on input s is bounded by (1+u)^(d*2^err_s), and that on t is (1+u)^(2k+3/2), thus the total error is (1+u)^(d*2^err_s+2k+5/2) */ - err_s += __gmpfr_ceil_log2 (d); + /* err_s += __gmpfr_ceil_log2 (d); */ + /* since d = 1.2 * (2m+48), ceil(log2(d)) = 2 + ceil(log2(0.6*m+14.4)) + <= 2 + ceil(log2(0.6*m+15)) */ + { + unsigned long mm = (1 + m / 5) * 3; /* 0.6*m <= mm */ + err_s += 2 + __gmpfr_int_ceil_log2 (mm + 15); + } err_t = __gmpfr_ceil_log2 (2.0 * (double) k + 2.5); err_s = (err_s >= err_t) ? err_s + 1 : err_t + 1; #else @@ -570,10 +699,6 @@ #ifdef IS_GAMMA end0: #endif - oldBm = Bm; - while (Bm--) - mpz_clear (B[Bm]); - (*__gmp_free_func) (B, oldBm * sizeof (mpz_t)); end: if (inexact == 0) @@ -614,7 +739,7 @@ else /* lngamma(+/-Inf) = lngamma(nonpositive integer) = +Inf */ { if (!MPFR_IS_INF (x)) - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); MPFR_SET_INF (y); MPFR_SET_POS (y); MPFR_RET (0); /* exact */ @@ -654,7 +779,7 @@ else { if (MPFR_IS_ZERO (x)) - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); *signp = MPFR_INT_SIGN (x); MPFR_SET_INF (y); MPFR_SET_POS (y); @@ -668,7 +793,7 @@ { MPFR_SET_INF (y); MPFR_SET_POS (y); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); MPFR_RET (0); } @@ -693,6 +818,9 @@ int ok, inex2; mpfr_prec_t w = MPFR_PREC (y) + 14; mpfr_exp_t expl; + MPFR_SAVE_EXPO_DECL (expo); + + MPFR_SAVE_EXPO_MARK (expo); while (1) { @@ -722,13 +850,18 @@ mpfr_clear (l); mpfr_clear (h); if (ok) - return inex; + { + MPFR_SAVE_EXPO_FREE (expo); + return mpfr_check_range (y, inex, rnd); + } /* if ulp(log(-x)) <= |x| there is no reason to loop, since the width of [l, h] will be at least |x| */ - if (expl < MPFR_EXP(x) + (mpfr_exp_t) w) + if (expl < MPFR_EXP (x) + w) break; w += MPFR_INT_CEIL_LOG2(w) + 3; } + + MPFR_SAVE_EXPO_FREE (expo); } } diff -Nru mpfr4-3.1.4/src/log10.c mpfr4-4.0.2/src/log10.c --- mpfr4-3.1.4/src/log10.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/log10.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_log10 -- logarithm in base 10. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -68,7 +68,7 @@ MPFR_ASSERTD (MPFR_IS_ZERO (a)); MPFR_SET_INF (r); MPFR_SET_NEG (r); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); MPFR_RET (0); /* log10(0) is an exact -infinity */ } } @@ -104,7 +104,7 @@ /* the optimal number of bits : see algorithms.tex */ Nt = Ny + 4 + MPFR_INT_CEIL_LOG2 (Ny); - /* initialise of intermediary variables */ + /* initialize of intermediary variables */ mpfr_init2 (t, Nt); mpfr_init2 (tt, Nt); @@ -132,7 +132,7 @@ && mpfr_cmp (a, tt) == 0) break; - /* actualisation of the precision */ + /* actualization of the precision */ MPFR_ZIV_NEXT (loop, Nt); mpfr_set_prec (t, Nt); mpfr_set_prec (tt, Nt); diff -Nru mpfr4-3.1.4/src/log1p.c mpfr4-4.0.2/src/log1p.c --- mpfr4-3.1.4/src/log1p.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/log1p.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_log1p -- Compute log(1+x) -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,14 +17,86 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" - /* The computation of log1p is done by - log1p(x)=log(1+x) */ +/* Put in y an approximation of log(1+x) for x small. + We assume |x| < 1, in which case: + |x/2| <= |log(1+x)| = |x - x^2/2 + x^3/3 - x^4/4 + ...| <= |x|. + Return k such that the error is bounded by 2^k*ulp(y). +*/ +static int +mpfr_log1p_small (mpfr_ptr y, mpfr_srcptr x) +{ + mpfr_prec_t p = MPFR_PREC(y), err; + mpfr_t t, u; + unsigned long i; + int k; + + MPFR_ASSERTD(MPFR_GET_EXP (x) <= 0); /* ensures |x| < 1 */ + + /* in the following, theta represents a value with |theta| <= 2^(1-p) + (might be a different value each time) */ + + mpfr_init2 (t, p); + mpfr_init2 (u, p); + mpfr_set (t, x, MPFR_RNDF); /* t = x * (1 + theta) */ + mpfr_set (y, t, MPFR_RNDF); /* exact */ + for (i = 2; ; i++) + { + mpfr_mul (t, t, x, MPFR_RNDF); /* t = x^i * (1 + theta)^i */ + mpfr_div_ui (u, t, i, MPFR_RNDF); /* u = x^i/i * (1 + theta)^(i+1) */ + if (MPFR_GET_EXP (u) <= MPFR_GET_EXP (y) - p) /* |u| < ulp(y) */ + break; + if (i & 1) + mpfr_add (y, y, u, MPFR_RNDF); /* error <= ulp(y) */ + else + mpfr_sub (y, y, u, MPFR_RNDF); /* error <= ulp(y) */ + } + /* We assume |(1 + theta)^(i+1)| <= 2. + The neglected part is at most |u| + |u|/2 + ... <= 2|u| < 2 ulp(y) + which has to be multiplied by |(1 + theta)^(i+1)| <= 2, thus at most + 4 ulp(y). + The rounding error on y is bounded by: + * for the (i-2) add/sub, each error is bounded by ulp(y), + and since |y| <= |x|, this yields (i-2)*ulp(x) + * from Lemma 3.1 from [Higham02] (see algorithms.tex), + the relative error on u at step i is bounded by: + (i+1)*epsilon/(1-(i+1)*epsilon) where epsilon = 2^(1-p). + If (i+1)*epsilon <= 1/2, then the relative error on u at + step i is bounded by 2*(i+1)*epsilon, and since |u| <= 1/2^(i+1) + at step i, this gives an absolute error bound of; + 2*epsilon*x*(3/2^3 + 4/2^4 + 5/2^5 + ...) <= 2*2^(1-p)*x = + 4*2^(-p)*x <= 4*ulp(x). + + If (i+1)*epsilon <= 1/2, then the relative error on u at step i + is bounded by (i+1)*epsilon/(1-(i+1)*epsilon) <= 1, thus it follows + |(1 + theta)^(i+1)| <= 2. + + Finally the total error is bounded by 4*ulp(y) + (i-2)*ulp(x) + 4*ulp(x) + = 4*ulp(y) + (i+2)*ulp(x). + Since x/2 <= y, we have ulp(x) <= 2*ulp(y), thus the error is bounded by: + (2*i+8)*ulp(y). + */ + err = 2 * i + 8; + k = __gmpfr_int_ceil_log2 (err); + MPFR_ASSERTN(k < p); + /* if k < p, since k = ceil(log2(err)), we have err <= 2^k <= 2^(p-1), + thus i+4 = err/2 <= 2^(p-2), thus (i+4)*epsilon <= 1/2, which implies + our assumption (i+1)*epsilon <= 1/2. */ + mpfr_clear (t); + mpfr_clear (u); + return k; +} + +/* The computation of log1p is done by + log1p(x) = log(1+x) + except when x is very small, in which case log1p(x) = x + tiny error, + or when x is small, where we use directly the Taylor expansion. +*/ int mpfr_log1p (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) @@ -89,7 +161,7 @@ { MPFR_SET_INF (y); MPFR_SET_NEG (y); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); MPFR_RET (0); } MPFR_SET_NAN (y); @@ -117,27 +189,40 @@ if (MPFR_EXP(x) < 0) Nt += -MPFR_EXP(x); - /* initialise of intermediary variable */ + /* initialize of intermediary variable */ mpfr_init2 (t, Nt); /* First computation of log1p */ MPFR_ZIV_INIT (loop, Nt); for (;;) { - /* compute log1p */ - inexact = mpfr_add_ui (t, x, 1, MPFR_RNDN); /* 1+x */ - /* if inexact = 0, then t = x+1, and the result is simply log(t) */ - if (inexact == 0) + int k; + /* small case: assuming the AGM algorithm used by mpfr_log uses + log2(p) steps for a precision of p bits, we try the special + variant whenever EXP(x) <= -p/log2(p). */ + k = 1 + __gmpfr_int_ceil_log2 (Ny); /* the +1 avoids a division by 0 + when Ny=1 */ + if (MPFR_GET_EXP (x) <= - (mpfr_exp_t) (Ny / k)) + /* this implies EXP(x) <= 0 thus x < 1 */ + err = Nt - mpfr_log1p_small (t, x); + else { - inexact = mpfr_log (y, t, rnd_mode); - goto end; + /* compute log1p */ + inexact = mpfr_add_ui (t, x, 1, MPFR_RNDN); /* 1+x */ + /* if inexact = 0, then t = x+1, and the result is simply log(t) */ + if (inexact == 0) + { + inexact = mpfr_log (y, t, rnd_mode); + goto end; + } + mpfr_log (t, t, MPFR_RNDN); /* log(1+x) */ + + /* the error is bounded by (1/2+2^(1-EXP(t))*ulp(t) + (cf algorithms.tex) + if EXP(t)>=2, then error <= ulp(t) + if EXP(t)<=1, then error <= 2^(2-EXP(t))*ulp(t) */ + err = Nt - MAX (0, 2 - MPFR_GET_EXP (t)); } - mpfr_log (t, t, MPFR_RNDN); /* log(1+x) */ - - /* the error is bounded by (1/2+2^(1-EXP(t))*ulp(t) (cf algorithms.tex) - if EXP(t)>=2, then error <= ulp(t) - if EXP(t)<=1, then error <= 2^(2-EXP(t))*ulp(t) */ - err = Nt - MAX (0, 2 - MPFR_GET_EXP (t)); if (MPFR_LIKELY (MPFR_CAN_ROUND (t, err, Ny, rnd_mode))) break; diff -Nru mpfr4-3.1.4/src/log2.c mpfr4-4.0.2/src/log2.c --- mpfr4-3.1.4/src/log2.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/log2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_log2 -- log base 2 -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -66,7 +66,7 @@ MPFR_ASSERTD (MPFR_IS_ZERO (a)); MPFR_SET_INF (r); MPFR_SET_NEG (r); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); MPFR_RET (0); /* log2(0) is an exact -infinity */ } } @@ -106,7 +106,7 @@ /* the optimal number of bits : see algorithms.tex */ Nt = Ny + 3 + MPFR_INT_CEIL_LOG2 (Ny); - /* initialise of intermediary variable */ + /* initialize of intermediary variable */ mpfr_init2 (t, Nt); mpfr_init2 (tt, Nt); @@ -124,7 +124,7 @@ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, err, Ny, rnd_mode))) break; - /* actualisation of the precision */ + /* actualization of the precision */ MPFR_ZIV_NEXT (loop, Nt); mpfr_set_prec (t, Nt); mpfr_set_prec (tt, Nt); diff -Nru mpfr4-3.1.4/src/log.c mpfr4-4.0.2/src/log.c --- mpfr4-3.1.4/src/log.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/log.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_log -- natural logarithm of a floating-point number -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -44,6 +44,7 @@ int inexact; mpfr_prec_t p, q; mpfr_t tmp1, tmp2; + mpfr_exp_t exp_a; MPFR_SAVE_EXPO_DECL (expo); MPFR_ZIV_DECL (loop); MPFR_GROUP_DECL(group); @@ -83,18 +84,22 @@ MPFR_ASSERTD (MPFR_IS_ZERO (a)); MPFR_SET_INF (r); MPFR_SET_NEG (r); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); MPFR_RET (0); /* log(0) is an exact -infinity */ } } + /* If a is negative, the result is NaN */ - else if (MPFR_UNLIKELY (MPFR_IS_NEG (a))) + if (MPFR_UNLIKELY (MPFR_IS_NEG (a))) { MPFR_SET_NAN (r); MPFR_RET_NAN; } - /* If a is 1, the result is 0 */ - else if (MPFR_UNLIKELY (MPFR_GET_EXP (a) == 1 && mpfr_cmp_ui (a, 1) == 0)) + + exp_a = MPFR_GET_EXP (a); + + /* If a is 1, the result is +0 */ + if (MPFR_UNLIKELY (exp_a == 1 && mpfr_cmp_ui (a, 1) == 0)) { MPFR_SET_ZERO (r); MPFR_SET_POS (r); @@ -103,8 +108,8 @@ q = MPFR_PREC (r); - /* use initial precision about q+lg(q)+5 */ - p = q + 5 + 2 * MPFR_INT_CEIL_LOG2 (q); + /* use initial precision about q+2*lg(q)+cte */ + p = q + 2 * MPFR_INT_CEIL_LOG2 (q) + 10; /* % ~(mpfr_prec_t)GMP_NUMB_BITS ; m=q; while (m) { p++; m >>= 1; } */ /* if (MPFR_LIKELY(p % GMP_NUMB_BITS != 0)) @@ -116,13 +121,28 @@ MPFR_ZIV_INIT (loop, p); for (;;) { - long m; + mpfr_exp_t m; mpfr_exp_t cancel; - /* Calculus of m (depends on p) */ - m = (p + 1) / 2 - MPFR_GET_EXP (a) + 1; - + /* Calculus of m (depends on p) + If mpfr_exp_t has N bits, then both (p + 3) / 2 and |exp_a| fit + on N-2 bits, so that there cannot be an overflow. */ + m = (p + 3) / 2 - exp_a; + + /* In standard configuration (_MPFR_EXP_FORMAT <= 3), one has + mpfr_exp_t <= long, so that the following assertion is always + true. */ + MPFR_ASSERTN (m >= LONG_MIN && m <= LONG_MAX); + + /* FIXME: Why 1 ulp and not 1/2 ulp? Ditto with some other ones + below. The error concerning the AGM should be explained since + 4/s is inexact (one needs a bound on its derivative). */ mpfr_mul_2si (tmp2, a, m, MPFR_RNDN); /* s=a*2^m, err<=1 ulp */ + MPFR_ASSERTD (MPFR_EXP (tmp2) >= (p + 3) / 2); + /* [FIXME] and one can have the equality, even if p is even. + This means that if a is a power of 2 and p is even, then + s = (1/2) * 2^((p+2)/2) = 2^(p/2), so that the condition + s > 2^(p/2) from algorithms.tex is not satisfied. */ mpfr_div (tmp1, __gmpfr_four, tmp2, MPFR_RNDN);/* 4/s, err<=2 ulps */ mpfr_agm (tmp2, __gmpfr_one, tmp1, MPFR_RNDN); /* AG(1,4/s),err<=3 ulps */ mpfr_mul_2ui (tmp2, tmp2, 1, MPFR_RNDN); /* 2*AG(1,4/s), err<=3 ulps */ @@ -143,19 +163,19 @@ /* we have 7 ulps of error from the above roundings, 4 ulps from the 4/s^2 second order term, plus the canceled bits */ - if (MPFR_LIKELY (MPFR_CAN_ROUND (tmp1, p-cancel-4, q, rnd_mode))) + if (MPFR_LIKELY (MPFR_CAN_ROUND (tmp1, p - cancel - 4, q, rnd_mode))) break; /* VL: I think it is better to have an increment that it isn't too low; in particular, the increment must be positive even if cancel = 0 (can this occur?). */ - p += cancel >= 8 ? cancel : 8; + p += cancel + MPFR_INT_CEIL_LOG2 (p); } else { /* TODO: find why this case can occur and what is best to do with it. */ - p += 32; + p += MPFR_INT_CEIL_LOG2 (p); } MPFR_ZIV_NEXT (loop, p); diff -Nru mpfr4-3.1.4/src/logging.c mpfr4-4.0.2/src/logging.c --- mpfr4-3.1.4/src/logging.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/logging.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* MPFR Logging functions. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -26,14 +26,15 @@ #ifdef MPFR_USE_LOGGING -/* Can't include them before (in particular, printf.h) */ -#include -#include +/* The header might not be available everywhere (it is standard, + but not even required by freestanding C implementations); thus it isn't + included unconditionally. */ #include /* Define LOGGING variables */ FILE *mpfr_log_file; +int mpfr_log_flush; int mpfr_log_type; int mpfr_log_level; int mpfr_log_current; @@ -78,6 +79,8 @@ mpfr_log_type = MPFR_LOG_INPUT_F|MPFR_LOG_OUTPUT_F|MPFR_LOG_TIME_F |MPFR_LOG_INTERNAL_F|MPFR_LOG_MSG_F|MPFR_LOG_BADCASE_F|MPFR_LOG_STAT_F; + mpfr_log_flush = getenv ("MPFR_LOG_FLUSH") != NULL; + /* Open filename if needed */ var = getenv ("MPFR_LOG_FILE"); if (var == NULL || *var == 0) @@ -92,6 +95,7 @@ } time (&tt); fprintf (mpfr_log_file, "MPFR LOG FILE %s\n", ctime (&tt)); + fflush (mpfr_log_file); /* always done */ } } diff -Nru mpfr4-3.1.4/src/log_ui.c mpfr4-4.0.2/src/log_ui.c --- mpfr4-3.1.4/src/log_ui.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/log_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,234 @@ +/* mpfr_log_ui -- compute natural logarithm of an unsigned long + +Copyright 2014-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define MPFR_NEED_LONGLONG_H +#include "mpfr-impl.h" + +/* FIXME: mpfr_log_ui is much slower than mpfr_log on some values of n, + e.g. about 4 times as slow for n around ULONG_MAX/3 on an + x86_64 Linux machine, for 10^6 bits of precision. The reason is that + for say n=6148914691236517205 and prec=10^6, the value of T computed + has more than 50M bits, which is much more than needed. Indeed the + binary splitting algorithm for series with a finite radius of convergence + gives rationals of size n*log(n) for a target precision n. One might + truncate the rationals inside the algorithm, but then the error analysis + should be redone. */ + +/* Cf http://www.ginac.de/CLN/binsplit.pdf: the Taylor series of log(1+x) + up to order N for x=p/2^k is T/(B*Q). + P[0] <- (-p)^(n2-n1) [with opposite sign when n1=1] + q <- k*(n2-n1) [corresponding to Q[0] = 2^q] + B[0] <- n1 * (n1+1) * ... * (n2-1) + T[0] <- B[0]*Q[0] * S(n1,n2) + where S(n1,n2) = -sum((-x)^(i-n1+1)/i, i=n1..n2-1) + Assumes p is odd or zero, and -1/3 <= x = p/2^k <= 1/3. +*/ +static void +S (mpz_t *P, unsigned long *q, mpz_t *B, mpz_t *T, unsigned long n1, + unsigned long n2, long p, unsigned long k, int need_P) +{ + MPFR_ASSERTD (n1 < n2); + MPFR_ASSERTD (p == 0 || ((unsigned long) p & 1) != 0); + if (n2 == n1 + 1) + { + mpz_set_si (P[0], (n1 == 1) ? p : -p); + *q = k; + mpz_set_ui (B[0], n1); + /* T = B*Q*S where S = P/(B*Q) thus T = P */ + mpz_set (T[0], P[0]); + /* since p is odd (or zero), there is no common factor 2 between + P and Q, or T and B */ + } + else + { + unsigned long m = (n1 / 2) + (n2 / 2) + (n1 & 1UL & n2), q1; + /* m = floor((n1+n2)/2) */ + + MPFR_ASSERTD (n1 < m && m < n2); + S (P, q, B, T, n1, m, p, k, 1); + S (P + 1, &q1, B + 1, T + 1, m, n2, p, k, need_P); + + /* T0 <- T0*B1*Q1 + P0*B0*T1 */ + mpz_mul (T[1], T[1], P[0]); + mpz_mul (T[1], T[1], B[0]); + mpz_mul (T[0], T[0], B[1]); + /* Q[1] = 2^q1 */ + mpz_mul_2exp (T[0], T[0], q1); /* mpz_mul (T[0], T[0], Q[1]) */ + mpz_add (T[0], T[0], T[1]); + if (need_P) + mpz_mul (P[0], P[0], P[1]); + *q += q1; /* mpz_mul (Q[0], Q[0], Q[1]) */ + mpz_mul (B[0], B[0], B[1]); + + /* there should be no common factors 2 between P, Q and T, + since P is odd (or zero) */ + } +} + +int +mpfr_log_ui (mpfr_ptr x, unsigned long n, mpfr_rnd_t rnd_mode) +{ + unsigned long k; + mpfr_prec_t w; /* working precision */ + mpz_t three_n, *P, *B, *T; + mpfr_t t, q; + int inexact; + unsigned long N, lgN, i, kk; + long p; + MPFR_GROUP_DECL(group); + MPFR_TMP_DECL(marker); + MPFR_ZIV_DECL(loop); + MPFR_SAVE_EXPO_DECL (expo); + + if (n <= 2) + { + if (n == 0) + { + MPFR_SET_INF (x); + MPFR_SET_NEG (x); + MPFR_SET_DIVBY0 (); + MPFR_RET (0); /* log(0) is an exact -infinity */ + } + else if (n == 1) + { + MPFR_SET_ZERO (x); + MPFR_SET_POS (x); + MPFR_RET (0); /* only "normal" case where the result is exact */ + } + /* now n=2 */ + return mpfr_const_log2 (x, rnd_mode); + } + + /* here n >= 3 */ + + /* Argument reduction: compute k such that 2/3 <= n/2^k < 4/3, + i.e., 2^(k+1) <= 3n < 2^(k+2). + + FIXME: we could do better by considering n/(2^k*3^i*5^j), + which reduces the maximal distance to 1 from 1/3 to 1/8, + thus needing about 1.89 less terms in the Taylor expansion of + the reduced argument. Then log(2^k*3^i*5^j) can be computed + using a combination of log(16/15), log(25/24) and log(81/80), + see Section 6.5 of "A Fortran Multiple-Precision Arithmetic Package", + Richard P. Brent, ACM Transactions on Mathematical Software, 1978. */ + + mpz_init_set_ui (three_n, n); + mpz_mul_ui (three_n, three_n, 3); + k = mpz_sizeinbase (three_n, 2) - 2; + MPFR_ASSERTD (k >= 2); + mpz_clear (three_n); + + /* The reduced argument is n/2^k - 1 = (n-2^k)/2^k. + Compute p = n-2^k. One has: |p| = |n-2^k| < 2^k/3 < n/2 <= LONG_MAX, + so that p and -p both fit in a long. */ + if (k < sizeof (unsigned long) * CHAR_BIT) + n -= 1UL << k; + /* n is now the value of p mod ULONG_MAX+1 */ + p = n > LONG_MAX ? - (long) - n : (long) n; + + MPFR_TMP_MARK(marker); + w = MPFR_PREC(x) + MPFR_INT_CEIL_LOG2 (MPFR_PREC(x)) + 10; + MPFR_GROUP_INIT_2(group, w, t, q); + MPFR_SAVE_EXPO_MARK (expo); + + kk = k; + if (p != 0) + while ((p % 2) == 0) /* replace p/2^kk by (p/2)/2^(kk-1) */ + { + p /= 2; + kk --; + } + + MPFR_ZIV_INIT (loop, w); + for (;;) + { + mpfr_t tmp; + unsigned int err; + unsigned long q0; + + /* we need at most w/log2(2^kk/|p|) terms for an accuracy of w bits */ + mpfr_init2 (tmp, 32); + mpfr_set_ui (tmp, (p > 0) ? p : -p, MPFR_RNDU); + mpfr_log2 (tmp, tmp, MPFR_RNDU); + mpfr_ui_sub (tmp, kk, tmp, MPFR_RNDD); + MPFR_ASSERTN (w <= ULONG_MAX); + mpfr_ui_div (tmp, w, tmp, MPFR_RNDU); + N = mpfr_get_ui (tmp, MPFR_RNDU); + if (N < 2) + N = 2; + lgN = MPFR_INT_CEIL_LOG2 (N) + 1; + mpfr_clear (tmp); + P = (mpz_t *) MPFR_TMP_ALLOC (3 * lgN * sizeof (mpz_t)); + B = P + lgN; + T = B + lgN; + for (i = 0; i < lgN; i++) + { + mpz_init (P[i]); + mpz_init (B[i]); + mpz_init (T[i]); + } + + S (P, &q0, B, T, 1, N, p, kk, 0); + /* mpz_mul (Q[0], B[0], Q[0]); */ + /* mpz_mul_2exp (B[0], B[0], q0); */ + + mpfr_set_z (t, T[0], MPFR_RNDN); /* t = P[0] * (1 + theta_1) */ + mpfr_set_z (q, B[0], MPFR_RNDN); /* q = B[0] * (1 + theta_2) */ + mpfr_mul_2exp (q, q, q0, MPFR_RNDN); /* B[0]*Q[0] */ + mpfr_div (t, t, q, MPFR_RNDN); /* t = T[0]/(B[0]*Q[0])*(1 + theta_3)^3 + = log(n/2^k) * (1 + theta_4)^4 + for |theta_i| < 2^(-w) */ + + /* argument reconstruction: add k*log(2) */ + mpfr_const_log2 (q, MPFR_RNDN); + mpfr_mul_ui (q, q, k, MPFR_RNDN); + mpfr_add (t, t, q, MPFR_RNDN); + for (i = 0; i < lgN; i++) + { + mpz_clear (P[i]); + mpz_clear (B[i]); + mpz_clear (T[i]); + } + /* The maximal error is 5 ulps for P/Q, since |(1+/-u)^4 - 1| < 5*u + for u < 2^(-12), k ulps for k*log(2), and 1 ulp for the addition, + thus at most k+6 ulps. + Note that there might be some cancellation in the addition: the worst + case is when log(1 + p/2^kk) = log(2/3) ~ -0.405, and with n=3 which + gives k=2, thus we add 2*log(2) = 1.386. Thus in the worst case we + have an exponent decrease of 1, which accounts for +1 in the error. */ + err = MPFR_INT_CEIL_LOG2 (k + 6) + 1; + if (MPFR_LIKELY (MPFR_CAN_ROUND (t, w - err, MPFR_PREC(x), rnd_mode))) + break; + + MPFR_ZIV_NEXT (loop, w); + MPFR_GROUP_REPREC_2(group, w, t, q); + } + MPFR_ZIV_FREE (loop); + + inexact = mpfr_set (x, t, rnd_mode); + + MPFR_GROUP_CLEAR(group); + MPFR_TMP_FREE(marker); + + MPFR_SAVE_EXPO_FREE (expo); + return mpfr_check_range (x, inexact, rnd_mode); +} diff -Nru mpfr4-3.1.4/src/Makefile.am mpfr4-4.0.2/src/Makefile.am --- mpfr4-3.1.4/src/Makefile.am 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/Makefile.am 2019-01-31 15:59:16.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright 2000-2016 Free Software Foundation, Inc. +# Copyright 2000-2019 Free Software Foundation, Inc. # This Makefile.am is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,7 +13,8 @@ x86/mparam.h x86_64/core2/mparam.h x86_64/pentium4/mparam.h \ ia64/mparam.h arm/mparam.h powerpc64/mparam.h sparc64/mparam.h \ generic/mparam.h amd/athlon/mparam.h amd/k8/mparam.h \ - amd/amdfam10/mparam.h powerpc32/mparam.h hppa/mparam.h + amd/amdfam10/mparam.h powerpc32/mparam.h hppa/mparam.h \ + mips/mparam.h generic/coverage/mparam.h include_HEADERS = mpfr.h mpf2mpfr.h @@ -22,8 +23,9 @@ lib_LTLIBRARIES = libmpfr.la -libmpfr_la_SOURCES = mpfr.h mpf2mpfr.h mpfr-gmp.h mpfr-impl.h mpfr-intmax.h \ -mpfr-longlong.h mpfr-thread.h exceptions.c extract.c uceil_exp2.c \ +libmpfr_la_SOURCES = mpfr.h mpf2mpfr.h mpfr-cvers.h mpfr-gmp.h \ +mpfr-impl.h mpfr-intmax.h mpfr-longlong.h mpfr-sassert.h mpfr-thread.h \ +exceptions.c extract.c uceil_exp2.c \ uceil_log2.c ufloor_log2.c add.c add1.c add_ui.c agm.c clear.c cmp.c \ cmp_abs.c cmp_si.c cmp_ui.c comparisons.c div_2exp.c div_2si.c \ div_2ui.c div.c div_ui.c dump.c eq.c exp10.c exp2.c exp3.c exp.c \ @@ -55,7 +57,10 @@ sub_d.c d_sub.c mul_d.c div_d.c d_div.c li2.c rec_sqrt.c min_prec.c \ buildopt.c digamma.c bernoulli.c isregular.c set_flt.c get_flt.c \ scale2.c set_z_exp.c ai.c gammaonethird.c ieee_floats.h \ -grandom.c +grandom.c fpif.c set_float128.c get_float128.c rndna.c nrandom.c \ +random_deviate.h random_deviate.c erandom.c mpfr-mini-gmp.c \ +mpfr-mini-gmp.h fmma.c log_ui.c gamma_inc.c ubf.c invert_limb.h \ +invsqrt_limb.h beta.c odd_p.c get_q.c pool.c libmpfr_la_LIBADD = @LIBOBJS@ @@ -75,7 +80,8 @@ # 2.4.x 3:x:2 # 3.0.x 4:x:0 # 3.1.x 5:x:1 -libmpfr_la_LDFLAGS = $(MPFR_LDFLAGS) $(LIBMPFR_LDFLAGS) -version-info 5:4:1 +# 4.0.x 6:x:0 +libmpfr_la_LDFLAGS = $(MPFR_LDFLAGS) $(LIBMPFR_LDFLAGS) -version-info 6:2:0 # Important note: If for some reason, srcdir is read-only at build time # (and you use objdir != srcdir), then you need to rebuild get_patches.c @@ -91,3 +97,55 @@ # and "make clean" shouldn't remove it, just like it doesn't remove # what has been changed by "patch". #CLEANFILES = get_patches.c + +# For check-gmp-symbols +GMPC = $(top_builddir)/src/gmp.c +GMPI = $(top_builddir)/src/gmp.i + +# For check-gmp-symbols and check-exported-symbols (if the library does +# not have this name, e.g. on some platforms or when the shared library +# is disabled, these rules do nothing). +LIBMPFRSO = $(top_builddir)/src/.libs/libmpfr.so + +# Check that MPFR does not use GMP internal symbols. Of course, do not run +# this rule if you use --with-gmp-build or --enable-gmp-internals. This +# test does nothing if --disable-shared has been used. +# Note: we use a temporary file $(GMPC) instead of "| $(COMPILE) -E -" +# because the latter is not supported by all compilers (at least under +# MS Windows). +check-gmp-symbols: $(LTLIBRARIES) + if [ -f "$(LIBMPFRSO)" ]; then \ + printf "#include <%s.h>\n" stdarg stdio gmp > $(GMPC) && \ + $(COMPILE) -E $(GMPC) > $(GMPI) || exit 1; \ + internals=`$(NM) -u "$(LIBMPFRSO)" | \ + $(SED) -n 's/^ *U \(__gmp.*\)/\1/p' | \ + while read s; \ + do \ + $(GREP) -q "$$s[ (;]" $(GMPI) || echo "$$s"; \ + done`; \ + if [ -n "$$internals" ]; then \ + echo "Internal GMP symbols:" $$internals; \ + exit 1; \ + fi; \ + rm $(GMPC) $(GMPI); \ + fi + +# Check that MPFR does not define symbols with a GMP reserved prefix. +# For instance, with r11968, and +# ./configure --with-gmp-build=... CC=tcc +# the symbol __gmpn_clz_tab is defined, which is wrong. +# Note: the "$(GREP) -v '@plt$$'" below is for tcc. +check-exported-symbols: $(LTLIBRARIES) + if [ -f "$(LIBMPFRSO)" ]; then \ + gsymbols=`$(NM) -gP "$(LIBMPFRSO)" | perl -ne \ + '/^(__gmp[a-z]?_[_0-9A-Za-z]*) +[A-TV-Z]/ and print " $$1"' | \ + { $(GREP) -v '@plt$$' || true ; }`; \ + if [ -n "$$gsymbols" ]; then \ + echo "MPFR defines symbols with a GMP reserved prefix:$$gsymbols"; \ + exit 1; \ + fi; \ + fi + +CLEANFILES = $(GMPC) $(GMPI) + +.PHONY: check-gmp-symbols check-exported-symbols diff -Nru mpfr4-3.1.4/src/Makefile.in mpfr4-4.0.2/src/Makefile.in --- mpfr4-3.1.4/src/Makefile.in 2016-03-06 11:33:18.000000000 +0000 +++ mpfr4-4.0.2/src/Makefile.in 2019-01-31 20:43:20.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,7 +14,7 @@ @SET_MAKE@ -# Copyright 2000-2016 Free Software Foundation, Inc. +# Copyright 2000-2019 Free Software Foundation, Inc. # This Makefile.am is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -104,8 +104,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ @@ -182,7 +181,10 @@ mul_d.lo div_d.lo d_div.lo li2.lo rec_sqrt.lo min_prec.lo \ buildopt.lo digamma.lo bernoulli.lo isregular.lo set_flt.lo \ get_flt.lo scale2.lo set_z_exp.lo ai.lo gammaonethird.lo \ - grandom.lo + grandom.lo fpif.lo set_float128.lo get_float128.lo rndna.lo \ + nrandom.lo random_deviate.lo erandom.lo mpfr-mini-gmp.lo \ + fmma.lo log_ui.lo gamma_inc.lo ubf.lo beta.lo odd_p.lo \ + get_q.lo pool.lo libmpfr_la_OBJECTS = $(am_libmpfr_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -205,7 +207,120 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/abort_prec_max.Plo \ + ./$(DEPDIR)/acos.Plo ./$(DEPDIR)/acosh.Plo ./$(DEPDIR)/add.Plo \ + ./$(DEPDIR)/add1.Plo ./$(DEPDIR)/add1sp.Plo \ + ./$(DEPDIR)/add_d.Plo ./$(DEPDIR)/add_ui.Plo \ + ./$(DEPDIR)/agm.Plo ./$(DEPDIR)/ai.Plo ./$(DEPDIR)/asin.Plo \ + ./$(DEPDIR)/asinh.Plo ./$(DEPDIR)/atan.Plo \ + ./$(DEPDIR)/atan2.Plo ./$(DEPDIR)/atanh.Plo \ + ./$(DEPDIR)/bernoulli.Plo ./$(DEPDIR)/beta.Plo \ + ./$(DEPDIR)/buildopt.Plo ./$(DEPDIR)/cache.Plo \ + ./$(DEPDIR)/cbrt.Plo ./$(DEPDIR)/check.Plo \ + ./$(DEPDIR)/clear.Plo ./$(DEPDIR)/clears.Plo \ + ./$(DEPDIR)/cmp.Plo ./$(DEPDIR)/cmp2.Plo \ + ./$(DEPDIR)/cmp_abs.Plo ./$(DEPDIR)/cmp_d.Plo \ + ./$(DEPDIR)/cmp_ld.Plo ./$(DEPDIR)/cmp_si.Plo \ + ./$(DEPDIR)/cmp_ui.Plo ./$(DEPDIR)/comparisons.Plo \ + ./$(DEPDIR)/const_catalan.Plo ./$(DEPDIR)/const_euler.Plo \ + ./$(DEPDIR)/const_log2.Plo ./$(DEPDIR)/const_pi.Plo \ + ./$(DEPDIR)/constant.Plo ./$(DEPDIR)/copysign.Plo \ + ./$(DEPDIR)/cos.Plo ./$(DEPDIR)/cosh.Plo ./$(DEPDIR)/cot.Plo \ + ./$(DEPDIR)/coth.Plo ./$(DEPDIR)/csc.Plo ./$(DEPDIR)/csch.Plo \ + ./$(DEPDIR)/d_div.Plo ./$(DEPDIR)/d_sub.Plo \ + ./$(DEPDIR)/digamma.Plo ./$(DEPDIR)/dim.Plo \ + ./$(DEPDIR)/div.Plo ./$(DEPDIR)/div_2exp.Plo \ + ./$(DEPDIR)/div_2si.Plo ./$(DEPDIR)/div_2ui.Plo \ + ./$(DEPDIR)/div_d.Plo ./$(DEPDIR)/div_ui.Plo \ + ./$(DEPDIR)/dump.Plo ./$(DEPDIR)/eint.Plo ./$(DEPDIR)/eq.Plo \ + ./$(DEPDIR)/erandom.Plo ./$(DEPDIR)/erf.Plo \ + ./$(DEPDIR)/erfc.Plo ./$(DEPDIR)/exceptions.Plo \ + ./$(DEPDIR)/exp.Plo ./$(DEPDIR)/exp10.Plo ./$(DEPDIR)/exp2.Plo \ + ./$(DEPDIR)/exp3.Plo ./$(DEPDIR)/exp_2.Plo \ + ./$(DEPDIR)/expm1.Plo ./$(DEPDIR)/extract.Plo \ + ./$(DEPDIR)/factorial.Plo ./$(DEPDIR)/fits_intmax.Plo \ + ./$(DEPDIR)/fits_sint.Plo ./$(DEPDIR)/fits_slong.Plo \ + ./$(DEPDIR)/fits_sshort.Plo ./$(DEPDIR)/fits_uint.Plo \ + ./$(DEPDIR)/fits_uintmax.Plo ./$(DEPDIR)/fits_ulong.Plo \ + ./$(DEPDIR)/fits_ushort.Plo ./$(DEPDIR)/fma.Plo \ + ./$(DEPDIR)/fmma.Plo ./$(DEPDIR)/fms.Plo ./$(DEPDIR)/fpif.Plo \ + ./$(DEPDIR)/frac.Plo ./$(DEPDIR)/free_cache.Plo \ + ./$(DEPDIR)/frexp.Plo ./$(DEPDIR)/gamma.Plo \ + ./$(DEPDIR)/gamma_inc.Plo ./$(DEPDIR)/gammaonethird.Plo \ + ./$(DEPDIR)/get_d.Plo ./$(DEPDIR)/get_d64.Plo \ + ./$(DEPDIR)/get_exp.Plo ./$(DEPDIR)/get_f.Plo \ + ./$(DEPDIR)/get_float128.Plo ./$(DEPDIR)/get_flt.Plo \ + ./$(DEPDIR)/get_ld.Plo ./$(DEPDIR)/get_patches.Plo \ + ./$(DEPDIR)/get_q.Plo ./$(DEPDIR)/get_si.Plo \ + ./$(DEPDIR)/get_sj.Plo ./$(DEPDIR)/get_str.Plo \ + ./$(DEPDIR)/get_ui.Plo ./$(DEPDIR)/get_uj.Plo \ + ./$(DEPDIR)/get_z.Plo ./$(DEPDIR)/get_z_exp.Plo \ + ./$(DEPDIR)/gmp_op.Plo ./$(DEPDIR)/grandom.Plo \ + ./$(DEPDIR)/hypot.Plo ./$(DEPDIR)/init.Plo \ + ./$(DEPDIR)/init2.Plo ./$(DEPDIR)/inits.Plo \ + ./$(DEPDIR)/inits2.Plo ./$(DEPDIR)/inp_str.Plo \ + ./$(DEPDIR)/int_ceil_log2.Plo ./$(DEPDIR)/isinf.Plo \ + ./$(DEPDIR)/isinteger.Plo ./$(DEPDIR)/isnan.Plo \ + ./$(DEPDIR)/isnum.Plo ./$(DEPDIR)/isqrt.Plo \ + ./$(DEPDIR)/isregular.Plo ./$(DEPDIR)/iszero.Plo \ + ./$(DEPDIR)/jn.Plo ./$(DEPDIR)/li2.Plo ./$(DEPDIR)/lngamma.Plo \ + ./$(DEPDIR)/log.Plo ./$(DEPDIR)/log10.Plo \ + ./$(DEPDIR)/log1p.Plo ./$(DEPDIR)/log2.Plo \ + ./$(DEPDIR)/log_ui.Plo ./$(DEPDIR)/logging.Plo \ + ./$(DEPDIR)/min_prec.Plo ./$(DEPDIR)/minmax.Plo \ + ./$(DEPDIR)/modf.Plo ./$(DEPDIR)/mp_clz_tab.Plo \ + ./$(DEPDIR)/mpfr-gmp.Plo ./$(DEPDIR)/mpfr-mini-gmp.Plo \ + ./$(DEPDIR)/mpn_exp.Plo ./$(DEPDIR)/mul.Plo \ + ./$(DEPDIR)/mul_2exp.Plo ./$(DEPDIR)/mul_2si.Plo \ + ./$(DEPDIR)/mul_2ui.Plo ./$(DEPDIR)/mul_d.Plo \ + ./$(DEPDIR)/mul_ui.Plo ./$(DEPDIR)/mulders.Plo \ + ./$(DEPDIR)/neg.Plo ./$(DEPDIR)/next.Plo \ + ./$(DEPDIR)/nrandom.Plo ./$(DEPDIR)/odd_p.Plo \ + ./$(DEPDIR)/out_str.Plo ./$(DEPDIR)/pool.Plo \ + ./$(DEPDIR)/pow.Plo ./$(DEPDIR)/pow_si.Plo \ + ./$(DEPDIR)/pow_ui.Plo ./$(DEPDIR)/pow_z.Plo \ + ./$(DEPDIR)/powerof2.Plo ./$(DEPDIR)/print_raw.Plo \ + ./$(DEPDIR)/print_rnd_mode.Plo ./$(DEPDIR)/printf.Plo \ + ./$(DEPDIR)/random_deviate.Plo ./$(DEPDIR)/rec_sqrt.Plo \ + ./$(DEPDIR)/reldiff.Plo ./$(DEPDIR)/rem1.Plo \ + ./$(DEPDIR)/rint.Plo ./$(DEPDIR)/rndna.Plo \ + ./$(DEPDIR)/root.Plo ./$(DEPDIR)/round_near_x.Plo \ + ./$(DEPDIR)/round_p.Plo ./$(DEPDIR)/round_prec.Plo \ + ./$(DEPDIR)/scale2.Plo ./$(DEPDIR)/sec.Plo \ + ./$(DEPDIR)/sech.Plo ./$(DEPDIR)/set.Plo ./$(DEPDIR)/set_d.Plo \ + ./$(DEPDIR)/set_d64.Plo ./$(DEPDIR)/set_dfl_prec.Plo \ + ./$(DEPDIR)/set_exp.Plo ./$(DEPDIR)/set_f.Plo \ + ./$(DEPDIR)/set_float128.Plo ./$(DEPDIR)/set_flt.Plo \ + ./$(DEPDIR)/set_inf.Plo ./$(DEPDIR)/set_ld.Plo \ + ./$(DEPDIR)/set_nan.Plo ./$(DEPDIR)/set_prc_raw.Plo \ + ./$(DEPDIR)/set_prec.Plo ./$(DEPDIR)/set_q.Plo \ + ./$(DEPDIR)/set_rnd.Plo ./$(DEPDIR)/set_si.Plo \ + ./$(DEPDIR)/set_si_2exp.Plo ./$(DEPDIR)/set_sj.Plo \ + ./$(DEPDIR)/set_str.Plo ./$(DEPDIR)/set_str_raw.Plo \ + ./$(DEPDIR)/set_ui.Plo ./$(DEPDIR)/set_ui_2exp.Plo \ + ./$(DEPDIR)/set_uj.Plo ./$(DEPDIR)/set_z.Plo \ + ./$(DEPDIR)/set_z_exp.Plo ./$(DEPDIR)/set_zero.Plo \ + ./$(DEPDIR)/setmax.Plo ./$(DEPDIR)/setmin.Plo \ + ./$(DEPDIR)/setsign.Plo ./$(DEPDIR)/sgn.Plo \ + ./$(DEPDIR)/si_op.Plo ./$(DEPDIR)/signbit.Plo \ + ./$(DEPDIR)/sin.Plo ./$(DEPDIR)/sin_cos.Plo \ + ./$(DEPDIR)/sinh.Plo ./$(DEPDIR)/sinh_cosh.Plo \ + ./$(DEPDIR)/sqr.Plo ./$(DEPDIR)/sqrt.Plo \ + ./$(DEPDIR)/sqrt_ui.Plo ./$(DEPDIR)/stack_interface.Plo \ + ./$(DEPDIR)/strtofr.Plo ./$(DEPDIR)/sub.Plo \ + ./$(DEPDIR)/sub1.Plo ./$(DEPDIR)/sub1sp.Plo \ + ./$(DEPDIR)/sub_d.Plo ./$(DEPDIR)/sub_ui.Plo \ + ./$(DEPDIR)/subnormal.Plo ./$(DEPDIR)/sum.Plo \ + ./$(DEPDIR)/swap.Plo ./$(DEPDIR)/tan.Plo ./$(DEPDIR)/tanh.Plo \ + ./$(DEPDIR)/ubf.Plo ./$(DEPDIR)/uceil_exp2.Plo \ + ./$(DEPDIR)/uceil_log2.Plo ./$(DEPDIR)/ufloor_log2.Plo \ + ./$(DEPDIR)/ui_div.Plo ./$(DEPDIR)/ui_pow.Plo \ + ./$(DEPDIR)/ui_pow_ui.Plo ./$(DEPDIR)/ui_sub.Plo \ + ./$(DEPDIR)/urandom.Plo ./$(DEPDIR)/urandomb.Plo \ + ./$(DEPDIR)/vasprintf.Plo ./$(DEPDIR)/version.Plo \ + ./$(DEPDIR)/volatile.Plo ./$(DEPDIR)/yn.Plo \ + ./$(DEPDIR)/zeta.Plo ./$(DEPDIR)/zeta_ui.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -305,6 +420,7 @@ MKDIR_P = @MKDIR_P@ MPFR_LDFLAGS = @MPFR_LDFLAGS@ MPFR_LIBM = @MPFR_LIBM@ +MPFR_LIBQUADMATH = @MPFR_LIBQUADMATH@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -319,6 +435,9 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -338,6 +457,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -383,13 +503,15 @@ x86/mparam.h x86_64/core2/mparam.h x86_64/pentium4/mparam.h \ ia64/mparam.h arm/mparam.h powerpc64/mparam.h sparc64/mparam.h \ generic/mparam.h amd/athlon/mparam.h amd/k8/mparam.h \ - amd/amdfam10/mparam.h powerpc32/mparam.h hppa/mparam.h + amd/amdfam10/mparam.h powerpc32/mparam.h hppa/mparam.h \ + mips/mparam.h generic/coverage/mparam.h include_HEADERS = mpfr.h mpf2mpfr.h BUILT_SOURCES = mparam.h lib_LTLIBRARIES = libmpfr.la -libmpfr_la_SOURCES = mpfr.h mpf2mpfr.h mpfr-gmp.h mpfr-impl.h mpfr-intmax.h \ -mpfr-longlong.h mpfr-thread.h exceptions.c extract.c uceil_exp2.c \ +libmpfr_la_SOURCES = mpfr.h mpf2mpfr.h mpfr-cvers.h mpfr-gmp.h \ +mpfr-impl.h mpfr-intmax.h mpfr-longlong.h mpfr-sassert.h mpfr-thread.h \ +exceptions.c extract.c uceil_exp2.c \ uceil_log2.c ufloor_log2.c add.c add1.c add_ui.c agm.c clear.c cmp.c \ cmp_abs.c cmp_si.c cmp_ui.c comparisons.c div_2exp.c div_2si.c \ div_2ui.c div.c div_ui.c dump.c eq.c exp10.c exp2.c exp3.c exp.c \ @@ -421,7 +543,10 @@ sub_d.c d_sub.c mul_d.c div_d.c d_div.c li2.c rec_sqrt.c min_prec.c \ buildopt.c digamma.c bernoulli.c isregular.c set_flt.c get_flt.c \ scale2.c set_z_exp.c ai.c gammaonethird.c ieee_floats.h \ -grandom.c +grandom.c fpif.c set_float128.c get_float128.c rndna.c nrandom.c \ +random_deviate.h random_deviate.c erandom.c mpfr-mini-gmp.c \ +mpfr-mini-gmp.h fmma.c log_ui.c gamma_inc.c ubf.c invert_limb.h \ +invsqrt_limb.h beta.c odd_p.c get_q.c pool.c libmpfr_la_LIBADD = @LIBOBJS@ @@ -441,7 +566,25 @@ # 2.4.x 3:x:2 # 3.0.x 4:x:0 # 3.1.x 5:x:1 -libmpfr_la_LDFLAGS = $(MPFR_LDFLAGS) $(LIBMPFR_LDFLAGS) -version-info 5:4:1 +# 4.0.x 6:x:0 +libmpfr_la_LDFLAGS = $(MPFR_LDFLAGS) $(LIBMPFR_LDFLAGS) -version-info 6:2:0 + +# Do not add get_patches.c to CLEANFILES so that this file doesn't +# need to be (re)built as long as no patches are applied. Anyway the +# update of this file should be regarded as part of the patch process, +# and "make clean" shouldn't remove it, just like it doesn't remove +# what has been changed by "patch". +#CLEANFILES = get_patches.c + +# For check-gmp-symbols +GMPC = $(top_builddir)/src/gmp.c +GMPI = $(top_builddir)/src/gmp.i + +# For check-gmp-symbols and check-exported-symbols (if the library does +# not have this name, e.g. on some platforms or when the shared library +# is disabled, these rules do nothing). +LIBMPFRSO = $(top_builddir)/src/.libs/libmpfr.so +CLEANFILES = $(GMPC) $(GMPI) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am @@ -464,8 +607,8 @@ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -523,225 +666,247 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abort_prec_max.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acos.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acosh.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add1.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add1sp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_d.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_ui.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agm.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ai.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asinh.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atan.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atan2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atanh.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bernoulli.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buildopt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cbrt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clear.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clears.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_abs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_d.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_ld.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_si.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_ui.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/comparisons.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/const_catalan.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/const_euler.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/const_log2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/const_pi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/constant.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copysign.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cos.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cosh.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coth.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csch.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_div.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_sub.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/digamma.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dim.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_2exp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_2si.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_2ui.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_d.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_ui.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dump.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eq.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/erf.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/erfc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exceptions.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp10.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp3.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp_2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/expm1.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extract.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/factorial.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_intmax.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_sint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_slong.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_sshort.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_uint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_uintmax.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_ulong.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_ushort.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fma.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fms.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frac.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/free_cache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frexp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gamma.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gammaonethird.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_d.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_d64.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_exp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_f.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_flt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_ld.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_patches.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_si.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_sj.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_str.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_ui.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_uj.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_z.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_z_exp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gmp_op.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grandom.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hypot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inits.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inits2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inp_str.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/int_ceil_log2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isinf.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isinteger.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnan.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnum.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isqrt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isregular.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iszero.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/li2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lngamma.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log10.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log1p.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logging.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/min_prec.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minmax.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modf.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp_clz_tab.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpfr-gmp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpn_exp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_2exp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_2si.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_2ui.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_d.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_ui.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mulders.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/neg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/next.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/out_str.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_si.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_ui.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_z.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powerof2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print_raw.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print_rnd_mode.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rec_sqrt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reldiff.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rem1.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/root.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/round_near_x.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/round_p.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/round_prec.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scale2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sec.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sech.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_d.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_d64.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_dfl_prec.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_exp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_f.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_flt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_inf.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_ld.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_nan.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_prc_raw.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_prec.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_q.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_rnd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_si.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_si_2exp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_sj.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_str.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_str_raw.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_ui.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_ui_2exp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_uj.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_z.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_z_exp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_zero.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setmax.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setmin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setsign.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sgn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/si_op.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signbit.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sin_cos.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sinh.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sinh_cosh.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqrt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqrt_ui.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack_interface.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtofr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub1.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub1sp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub_d.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub_ui.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subnormal.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sum.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swap.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tan.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tanh.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uceil_exp2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uceil_log2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufloor_log2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_div.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_pow.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_pow_ui.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_sub.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urandom.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urandomb.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasprintf.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/volatile.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zeta.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zeta_ui.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abort_prec_max.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acos.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acosh.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add1.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add1sp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_d.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_ui.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agm.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ai.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asin.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asinh.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atan.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atan2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atanh.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bernoulli.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/beta.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buildopt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cbrt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clear.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clears.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_abs.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_d.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_ld.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_si.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_ui.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/comparisons.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/const_catalan.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/const_euler.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/const_log2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/const_pi.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/constant.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copysign.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cos.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cosh.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cot.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coth.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csc.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csch.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_div.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_sub.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/digamma.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dim.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_2exp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_2si.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_2ui.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_d.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_ui.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dump.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eint.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eq.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/erandom.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/erf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/erfc.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exceptions.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp10.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp3.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp_2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/expm1.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extract.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/factorial.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_intmax.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_sint.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_slong.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_sshort.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_uint.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_uintmax.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_ulong.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_ushort.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fma.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fmma.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fms.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fpif.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frac.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/free_cache.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frexp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gamma.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gamma_inc.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gammaonethird.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_d.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_d64.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_exp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_f.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_float128.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_flt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_ld.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_patches.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_q.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_si.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_sj.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_str.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_ui.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_uj.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_z.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_z_exp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gmp_op.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grandom.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hypot.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inits.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inits2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inp_str.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/int_ceil_log2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isinf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isinteger.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnan.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnum.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isqrt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isregular.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iszero.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jn.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/li2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lngamma.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log10.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log1p.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log_ui.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logging.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/min_prec.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minmax.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp_clz_tab.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpfr-gmp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpfr-mini-gmp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpn_exp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_2exp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_2si.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_2ui.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_d.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_ui.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mulders.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/neg.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/next.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nrandom.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/odd_p.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/out_str.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pool.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_si.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_ui.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_z.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powerof2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print_raw.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print_rnd_mode.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/random_deviate.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rec_sqrt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reldiff.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rem1.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rint.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rndna.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/root.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/round_near_x.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/round_p.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/round_prec.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scale2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sec.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sech.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_d.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_d64.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_dfl_prec.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_exp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_f.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_float128.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_flt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_inf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_ld.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_nan.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_prc_raw.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_prec.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_q.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_rnd.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_si.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_si_2exp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_sj.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_str.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_str_raw.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_ui.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_ui_2exp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_uj.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_z.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_z_exp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_zero.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setmax.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setmin.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setsign.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sgn.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/si_op.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signbit.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sin.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sin_cos.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sinh.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sinh_cosh.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqr.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqrt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqrt_ui.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack_interface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtofr.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub1.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub1sp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub_d.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub_ui.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subnormal.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sum.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swap.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tan.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tanh.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ubf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uceil_exp2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uceil_log2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufloor_log2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_div.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_pow.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_pow_ui.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_sub.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urandom.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urandomb.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasprintf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/volatile.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yn.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zeta.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zeta_ui.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -843,7 +1008,10 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -904,6 +1072,7 @@ mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -919,7 +1088,241 @@ mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/abort_prec_max.Plo + -rm -f ./$(DEPDIR)/acos.Plo + -rm -f ./$(DEPDIR)/acosh.Plo + -rm -f ./$(DEPDIR)/add.Plo + -rm -f ./$(DEPDIR)/add1.Plo + -rm -f ./$(DEPDIR)/add1sp.Plo + -rm -f ./$(DEPDIR)/add_d.Plo + -rm -f ./$(DEPDIR)/add_ui.Plo + -rm -f ./$(DEPDIR)/agm.Plo + -rm -f ./$(DEPDIR)/ai.Plo + -rm -f ./$(DEPDIR)/asin.Plo + -rm -f ./$(DEPDIR)/asinh.Plo + -rm -f ./$(DEPDIR)/atan.Plo + -rm -f ./$(DEPDIR)/atan2.Plo + -rm -f ./$(DEPDIR)/atanh.Plo + -rm -f ./$(DEPDIR)/bernoulli.Plo + -rm -f ./$(DEPDIR)/beta.Plo + -rm -f ./$(DEPDIR)/buildopt.Plo + -rm -f ./$(DEPDIR)/cache.Plo + -rm -f ./$(DEPDIR)/cbrt.Plo + -rm -f ./$(DEPDIR)/check.Plo + -rm -f ./$(DEPDIR)/clear.Plo + -rm -f ./$(DEPDIR)/clears.Plo + -rm -f ./$(DEPDIR)/cmp.Plo + -rm -f ./$(DEPDIR)/cmp2.Plo + -rm -f ./$(DEPDIR)/cmp_abs.Plo + -rm -f ./$(DEPDIR)/cmp_d.Plo + -rm -f ./$(DEPDIR)/cmp_ld.Plo + -rm -f ./$(DEPDIR)/cmp_si.Plo + -rm -f ./$(DEPDIR)/cmp_ui.Plo + -rm -f ./$(DEPDIR)/comparisons.Plo + -rm -f ./$(DEPDIR)/const_catalan.Plo + -rm -f ./$(DEPDIR)/const_euler.Plo + -rm -f ./$(DEPDIR)/const_log2.Plo + -rm -f ./$(DEPDIR)/const_pi.Plo + -rm -f ./$(DEPDIR)/constant.Plo + -rm -f ./$(DEPDIR)/copysign.Plo + -rm -f ./$(DEPDIR)/cos.Plo + -rm -f ./$(DEPDIR)/cosh.Plo + -rm -f ./$(DEPDIR)/cot.Plo + -rm -f ./$(DEPDIR)/coth.Plo + -rm -f ./$(DEPDIR)/csc.Plo + -rm -f ./$(DEPDIR)/csch.Plo + -rm -f ./$(DEPDIR)/d_div.Plo + -rm -f ./$(DEPDIR)/d_sub.Plo + -rm -f ./$(DEPDIR)/digamma.Plo + -rm -f ./$(DEPDIR)/dim.Plo + -rm -f ./$(DEPDIR)/div.Plo + -rm -f ./$(DEPDIR)/div_2exp.Plo + -rm -f ./$(DEPDIR)/div_2si.Plo + -rm -f ./$(DEPDIR)/div_2ui.Plo + -rm -f ./$(DEPDIR)/div_d.Plo + -rm -f ./$(DEPDIR)/div_ui.Plo + -rm -f ./$(DEPDIR)/dump.Plo + -rm -f ./$(DEPDIR)/eint.Plo + -rm -f ./$(DEPDIR)/eq.Plo + -rm -f ./$(DEPDIR)/erandom.Plo + -rm -f ./$(DEPDIR)/erf.Plo + -rm -f ./$(DEPDIR)/erfc.Plo + -rm -f ./$(DEPDIR)/exceptions.Plo + -rm -f ./$(DEPDIR)/exp.Plo + -rm -f ./$(DEPDIR)/exp10.Plo + -rm -f ./$(DEPDIR)/exp2.Plo + -rm -f ./$(DEPDIR)/exp3.Plo + -rm -f ./$(DEPDIR)/exp_2.Plo + -rm -f ./$(DEPDIR)/expm1.Plo + -rm -f ./$(DEPDIR)/extract.Plo + -rm -f ./$(DEPDIR)/factorial.Plo + -rm -f ./$(DEPDIR)/fits_intmax.Plo + -rm -f ./$(DEPDIR)/fits_sint.Plo + -rm -f ./$(DEPDIR)/fits_slong.Plo + -rm -f ./$(DEPDIR)/fits_sshort.Plo + -rm -f ./$(DEPDIR)/fits_uint.Plo + -rm -f ./$(DEPDIR)/fits_uintmax.Plo + -rm -f ./$(DEPDIR)/fits_ulong.Plo + -rm -f ./$(DEPDIR)/fits_ushort.Plo + -rm -f ./$(DEPDIR)/fma.Plo + -rm -f ./$(DEPDIR)/fmma.Plo + -rm -f ./$(DEPDIR)/fms.Plo + -rm -f ./$(DEPDIR)/fpif.Plo + -rm -f ./$(DEPDIR)/frac.Plo + -rm -f ./$(DEPDIR)/free_cache.Plo + -rm -f ./$(DEPDIR)/frexp.Plo + -rm -f ./$(DEPDIR)/gamma.Plo + -rm -f ./$(DEPDIR)/gamma_inc.Plo + -rm -f ./$(DEPDIR)/gammaonethird.Plo + -rm -f ./$(DEPDIR)/get_d.Plo + -rm -f ./$(DEPDIR)/get_d64.Plo + -rm -f ./$(DEPDIR)/get_exp.Plo + -rm -f ./$(DEPDIR)/get_f.Plo + -rm -f ./$(DEPDIR)/get_float128.Plo + -rm -f ./$(DEPDIR)/get_flt.Plo + -rm -f ./$(DEPDIR)/get_ld.Plo + -rm -f ./$(DEPDIR)/get_patches.Plo + -rm -f ./$(DEPDIR)/get_q.Plo + -rm -f ./$(DEPDIR)/get_si.Plo + -rm -f ./$(DEPDIR)/get_sj.Plo + -rm -f ./$(DEPDIR)/get_str.Plo + -rm -f ./$(DEPDIR)/get_ui.Plo + -rm -f ./$(DEPDIR)/get_uj.Plo + -rm -f ./$(DEPDIR)/get_z.Plo + -rm -f ./$(DEPDIR)/get_z_exp.Plo + -rm -f ./$(DEPDIR)/gmp_op.Plo + -rm -f ./$(DEPDIR)/grandom.Plo + -rm -f ./$(DEPDIR)/hypot.Plo + -rm -f ./$(DEPDIR)/init.Plo + -rm -f ./$(DEPDIR)/init2.Plo + -rm -f ./$(DEPDIR)/inits.Plo + -rm -f ./$(DEPDIR)/inits2.Plo + -rm -f ./$(DEPDIR)/inp_str.Plo + -rm -f ./$(DEPDIR)/int_ceil_log2.Plo + -rm -f ./$(DEPDIR)/isinf.Plo + -rm -f ./$(DEPDIR)/isinteger.Plo + -rm -f ./$(DEPDIR)/isnan.Plo + -rm -f ./$(DEPDIR)/isnum.Plo + -rm -f ./$(DEPDIR)/isqrt.Plo + -rm -f ./$(DEPDIR)/isregular.Plo + -rm -f ./$(DEPDIR)/iszero.Plo + -rm -f ./$(DEPDIR)/jn.Plo + -rm -f ./$(DEPDIR)/li2.Plo + -rm -f ./$(DEPDIR)/lngamma.Plo + -rm -f ./$(DEPDIR)/log.Plo + -rm -f ./$(DEPDIR)/log10.Plo + -rm -f ./$(DEPDIR)/log1p.Plo + -rm -f ./$(DEPDIR)/log2.Plo + -rm -f ./$(DEPDIR)/log_ui.Plo + -rm -f ./$(DEPDIR)/logging.Plo + -rm -f ./$(DEPDIR)/min_prec.Plo + -rm -f ./$(DEPDIR)/minmax.Plo + -rm -f ./$(DEPDIR)/modf.Plo + -rm -f ./$(DEPDIR)/mp_clz_tab.Plo + -rm -f ./$(DEPDIR)/mpfr-gmp.Plo + -rm -f ./$(DEPDIR)/mpfr-mini-gmp.Plo + -rm -f ./$(DEPDIR)/mpn_exp.Plo + -rm -f ./$(DEPDIR)/mul.Plo + -rm -f ./$(DEPDIR)/mul_2exp.Plo + -rm -f ./$(DEPDIR)/mul_2si.Plo + -rm -f ./$(DEPDIR)/mul_2ui.Plo + -rm -f ./$(DEPDIR)/mul_d.Plo + -rm -f ./$(DEPDIR)/mul_ui.Plo + -rm -f ./$(DEPDIR)/mulders.Plo + -rm -f ./$(DEPDIR)/neg.Plo + -rm -f ./$(DEPDIR)/next.Plo + -rm -f ./$(DEPDIR)/nrandom.Plo + -rm -f ./$(DEPDIR)/odd_p.Plo + -rm -f ./$(DEPDIR)/out_str.Plo + -rm -f ./$(DEPDIR)/pool.Plo + -rm -f ./$(DEPDIR)/pow.Plo + -rm -f ./$(DEPDIR)/pow_si.Plo + -rm -f ./$(DEPDIR)/pow_ui.Plo + -rm -f ./$(DEPDIR)/pow_z.Plo + -rm -f ./$(DEPDIR)/powerof2.Plo + -rm -f ./$(DEPDIR)/print_raw.Plo + -rm -f ./$(DEPDIR)/print_rnd_mode.Plo + -rm -f ./$(DEPDIR)/printf.Plo + -rm -f ./$(DEPDIR)/random_deviate.Plo + -rm -f ./$(DEPDIR)/rec_sqrt.Plo + -rm -f ./$(DEPDIR)/reldiff.Plo + -rm -f ./$(DEPDIR)/rem1.Plo + -rm -f ./$(DEPDIR)/rint.Plo + -rm -f ./$(DEPDIR)/rndna.Plo + -rm -f ./$(DEPDIR)/root.Plo + -rm -f ./$(DEPDIR)/round_near_x.Plo + -rm -f ./$(DEPDIR)/round_p.Plo + -rm -f ./$(DEPDIR)/round_prec.Plo + -rm -f ./$(DEPDIR)/scale2.Plo + -rm -f ./$(DEPDIR)/sec.Plo + -rm -f ./$(DEPDIR)/sech.Plo + -rm -f ./$(DEPDIR)/set.Plo + -rm -f ./$(DEPDIR)/set_d.Plo + -rm -f ./$(DEPDIR)/set_d64.Plo + -rm -f ./$(DEPDIR)/set_dfl_prec.Plo + -rm -f ./$(DEPDIR)/set_exp.Plo + -rm -f ./$(DEPDIR)/set_f.Plo + -rm -f ./$(DEPDIR)/set_float128.Plo + -rm -f ./$(DEPDIR)/set_flt.Plo + -rm -f ./$(DEPDIR)/set_inf.Plo + -rm -f ./$(DEPDIR)/set_ld.Plo + -rm -f ./$(DEPDIR)/set_nan.Plo + -rm -f ./$(DEPDIR)/set_prc_raw.Plo + -rm -f ./$(DEPDIR)/set_prec.Plo + -rm -f ./$(DEPDIR)/set_q.Plo + -rm -f ./$(DEPDIR)/set_rnd.Plo + -rm -f ./$(DEPDIR)/set_si.Plo + -rm -f ./$(DEPDIR)/set_si_2exp.Plo + -rm -f ./$(DEPDIR)/set_sj.Plo + -rm -f ./$(DEPDIR)/set_str.Plo + -rm -f ./$(DEPDIR)/set_str_raw.Plo + -rm -f ./$(DEPDIR)/set_ui.Plo + -rm -f ./$(DEPDIR)/set_ui_2exp.Plo + -rm -f ./$(DEPDIR)/set_uj.Plo + -rm -f ./$(DEPDIR)/set_z.Plo + -rm -f ./$(DEPDIR)/set_z_exp.Plo + -rm -f ./$(DEPDIR)/set_zero.Plo + -rm -f ./$(DEPDIR)/setmax.Plo + -rm -f ./$(DEPDIR)/setmin.Plo + -rm -f ./$(DEPDIR)/setsign.Plo + -rm -f ./$(DEPDIR)/sgn.Plo + -rm -f ./$(DEPDIR)/si_op.Plo + -rm -f ./$(DEPDIR)/signbit.Plo + -rm -f ./$(DEPDIR)/sin.Plo + -rm -f ./$(DEPDIR)/sin_cos.Plo + -rm -f ./$(DEPDIR)/sinh.Plo + -rm -f ./$(DEPDIR)/sinh_cosh.Plo + -rm -f ./$(DEPDIR)/sqr.Plo + -rm -f ./$(DEPDIR)/sqrt.Plo + -rm -f ./$(DEPDIR)/sqrt_ui.Plo + -rm -f ./$(DEPDIR)/stack_interface.Plo + -rm -f ./$(DEPDIR)/strtofr.Plo + -rm -f ./$(DEPDIR)/sub.Plo + -rm -f ./$(DEPDIR)/sub1.Plo + -rm -f ./$(DEPDIR)/sub1sp.Plo + -rm -f ./$(DEPDIR)/sub_d.Plo + -rm -f ./$(DEPDIR)/sub_ui.Plo + -rm -f ./$(DEPDIR)/subnormal.Plo + -rm -f ./$(DEPDIR)/sum.Plo + -rm -f ./$(DEPDIR)/swap.Plo + -rm -f ./$(DEPDIR)/tan.Plo + -rm -f ./$(DEPDIR)/tanh.Plo + -rm -f ./$(DEPDIR)/ubf.Plo + -rm -f ./$(DEPDIR)/uceil_exp2.Plo + -rm -f ./$(DEPDIR)/uceil_log2.Plo + -rm -f ./$(DEPDIR)/ufloor_log2.Plo + -rm -f ./$(DEPDIR)/ui_div.Plo + -rm -f ./$(DEPDIR)/ui_pow.Plo + -rm -f ./$(DEPDIR)/ui_pow_ui.Plo + -rm -f ./$(DEPDIR)/ui_sub.Plo + -rm -f ./$(DEPDIR)/urandom.Plo + -rm -f ./$(DEPDIR)/urandomb.Plo + -rm -f ./$(DEPDIR)/vasprintf.Plo + -rm -f ./$(DEPDIR)/version.Plo + -rm -f ./$(DEPDIR)/volatile.Plo + -rm -f ./$(DEPDIR)/yn.Plo + -rm -f ./$(DEPDIR)/zeta.Plo + -rm -f ./$(DEPDIR)/zeta_ui.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -965,7 +1368,241 @@ installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/abort_prec_max.Plo + -rm -f ./$(DEPDIR)/acos.Plo + -rm -f ./$(DEPDIR)/acosh.Plo + -rm -f ./$(DEPDIR)/add.Plo + -rm -f ./$(DEPDIR)/add1.Plo + -rm -f ./$(DEPDIR)/add1sp.Plo + -rm -f ./$(DEPDIR)/add_d.Plo + -rm -f ./$(DEPDIR)/add_ui.Plo + -rm -f ./$(DEPDIR)/agm.Plo + -rm -f ./$(DEPDIR)/ai.Plo + -rm -f ./$(DEPDIR)/asin.Plo + -rm -f ./$(DEPDIR)/asinh.Plo + -rm -f ./$(DEPDIR)/atan.Plo + -rm -f ./$(DEPDIR)/atan2.Plo + -rm -f ./$(DEPDIR)/atanh.Plo + -rm -f ./$(DEPDIR)/bernoulli.Plo + -rm -f ./$(DEPDIR)/beta.Plo + -rm -f ./$(DEPDIR)/buildopt.Plo + -rm -f ./$(DEPDIR)/cache.Plo + -rm -f ./$(DEPDIR)/cbrt.Plo + -rm -f ./$(DEPDIR)/check.Plo + -rm -f ./$(DEPDIR)/clear.Plo + -rm -f ./$(DEPDIR)/clears.Plo + -rm -f ./$(DEPDIR)/cmp.Plo + -rm -f ./$(DEPDIR)/cmp2.Plo + -rm -f ./$(DEPDIR)/cmp_abs.Plo + -rm -f ./$(DEPDIR)/cmp_d.Plo + -rm -f ./$(DEPDIR)/cmp_ld.Plo + -rm -f ./$(DEPDIR)/cmp_si.Plo + -rm -f ./$(DEPDIR)/cmp_ui.Plo + -rm -f ./$(DEPDIR)/comparisons.Plo + -rm -f ./$(DEPDIR)/const_catalan.Plo + -rm -f ./$(DEPDIR)/const_euler.Plo + -rm -f ./$(DEPDIR)/const_log2.Plo + -rm -f ./$(DEPDIR)/const_pi.Plo + -rm -f ./$(DEPDIR)/constant.Plo + -rm -f ./$(DEPDIR)/copysign.Plo + -rm -f ./$(DEPDIR)/cos.Plo + -rm -f ./$(DEPDIR)/cosh.Plo + -rm -f ./$(DEPDIR)/cot.Plo + -rm -f ./$(DEPDIR)/coth.Plo + -rm -f ./$(DEPDIR)/csc.Plo + -rm -f ./$(DEPDIR)/csch.Plo + -rm -f ./$(DEPDIR)/d_div.Plo + -rm -f ./$(DEPDIR)/d_sub.Plo + -rm -f ./$(DEPDIR)/digamma.Plo + -rm -f ./$(DEPDIR)/dim.Plo + -rm -f ./$(DEPDIR)/div.Plo + -rm -f ./$(DEPDIR)/div_2exp.Plo + -rm -f ./$(DEPDIR)/div_2si.Plo + -rm -f ./$(DEPDIR)/div_2ui.Plo + -rm -f ./$(DEPDIR)/div_d.Plo + -rm -f ./$(DEPDIR)/div_ui.Plo + -rm -f ./$(DEPDIR)/dump.Plo + -rm -f ./$(DEPDIR)/eint.Plo + -rm -f ./$(DEPDIR)/eq.Plo + -rm -f ./$(DEPDIR)/erandom.Plo + -rm -f ./$(DEPDIR)/erf.Plo + -rm -f ./$(DEPDIR)/erfc.Plo + -rm -f ./$(DEPDIR)/exceptions.Plo + -rm -f ./$(DEPDIR)/exp.Plo + -rm -f ./$(DEPDIR)/exp10.Plo + -rm -f ./$(DEPDIR)/exp2.Plo + -rm -f ./$(DEPDIR)/exp3.Plo + -rm -f ./$(DEPDIR)/exp_2.Plo + -rm -f ./$(DEPDIR)/expm1.Plo + -rm -f ./$(DEPDIR)/extract.Plo + -rm -f ./$(DEPDIR)/factorial.Plo + -rm -f ./$(DEPDIR)/fits_intmax.Plo + -rm -f ./$(DEPDIR)/fits_sint.Plo + -rm -f ./$(DEPDIR)/fits_slong.Plo + -rm -f ./$(DEPDIR)/fits_sshort.Plo + -rm -f ./$(DEPDIR)/fits_uint.Plo + -rm -f ./$(DEPDIR)/fits_uintmax.Plo + -rm -f ./$(DEPDIR)/fits_ulong.Plo + -rm -f ./$(DEPDIR)/fits_ushort.Plo + -rm -f ./$(DEPDIR)/fma.Plo + -rm -f ./$(DEPDIR)/fmma.Plo + -rm -f ./$(DEPDIR)/fms.Plo + -rm -f ./$(DEPDIR)/fpif.Plo + -rm -f ./$(DEPDIR)/frac.Plo + -rm -f ./$(DEPDIR)/free_cache.Plo + -rm -f ./$(DEPDIR)/frexp.Plo + -rm -f ./$(DEPDIR)/gamma.Plo + -rm -f ./$(DEPDIR)/gamma_inc.Plo + -rm -f ./$(DEPDIR)/gammaonethird.Plo + -rm -f ./$(DEPDIR)/get_d.Plo + -rm -f ./$(DEPDIR)/get_d64.Plo + -rm -f ./$(DEPDIR)/get_exp.Plo + -rm -f ./$(DEPDIR)/get_f.Plo + -rm -f ./$(DEPDIR)/get_float128.Plo + -rm -f ./$(DEPDIR)/get_flt.Plo + -rm -f ./$(DEPDIR)/get_ld.Plo + -rm -f ./$(DEPDIR)/get_patches.Plo + -rm -f ./$(DEPDIR)/get_q.Plo + -rm -f ./$(DEPDIR)/get_si.Plo + -rm -f ./$(DEPDIR)/get_sj.Plo + -rm -f ./$(DEPDIR)/get_str.Plo + -rm -f ./$(DEPDIR)/get_ui.Plo + -rm -f ./$(DEPDIR)/get_uj.Plo + -rm -f ./$(DEPDIR)/get_z.Plo + -rm -f ./$(DEPDIR)/get_z_exp.Plo + -rm -f ./$(DEPDIR)/gmp_op.Plo + -rm -f ./$(DEPDIR)/grandom.Plo + -rm -f ./$(DEPDIR)/hypot.Plo + -rm -f ./$(DEPDIR)/init.Plo + -rm -f ./$(DEPDIR)/init2.Plo + -rm -f ./$(DEPDIR)/inits.Plo + -rm -f ./$(DEPDIR)/inits2.Plo + -rm -f ./$(DEPDIR)/inp_str.Plo + -rm -f ./$(DEPDIR)/int_ceil_log2.Plo + -rm -f ./$(DEPDIR)/isinf.Plo + -rm -f ./$(DEPDIR)/isinteger.Plo + -rm -f ./$(DEPDIR)/isnan.Plo + -rm -f ./$(DEPDIR)/isnum.Plo + -rm -f ./$(DEPDIR)/isqrt.Plo + -rm -f ./$(DEPDIR)/isregular.Plo + -rm -f ./$(DEPDIR)/iszero.Plo + -rm -f ./$(DEPDIR)/jn.Plo + -rm -f ./$(DEPDIR)/li2.Plo + -rm -f ./$(DEPDIR)/lngamma.Plo + -rm -f ./$(DEPDIR)/log.Plo + -rm -f ./$(DEPDIR)/log10.Plo + -rm -f ./$(DEPDIR)/log1p.Plo + -rm -f ./$(DEPDIR)/log2.Plo + -rm -f ./$(DEPDIR)/log_ui.Plo + -rm -f ./$(DEPDIR)/logging.Plo + -rm -f ./$(DEPDIR)/min_prec.Plo + -rm -f ./$(DEPDIR)/minmax.Plo + -rm -f ./$(DEPDIR)/modf.Plo + -rm -f ./$(DEPDIR)/mp_clz_tab.Plo + -rm -f ./$(DEPDIR)/mpfr-gmp.Plo + -rm -f ./$(DEPDIR)/mpfr-mini-gmp.Plo + -rm -f ./$(DEPDIR)/mpn_exp.Plo + -rm -f ./$(DEPDIR)/mul.Plo + -rm -f ./$(DEPDIR)/mul_2exp.Plo + -rm -f ./$(DEPDIR)/mul_2si.Plo + -rm -f ./$(DEPDIR)/mul_2ui.Plo + -rm -f ./$(DEPDIR)/mul_d.Plo + -rm -f ./$(DEPDIR)/mul_ui.Plo + -rm -f ./$(DEPDIR)/mulders.Plo + -rm -f ./$(DEPDIR)/neg.Plo + -rm -f ./$(DEPDIR)/next.Plo + -rm -f ./$(DEPDIR)/nrandom.Plo + -rm -f ./$(DEPDIR)/odd_p.Plo + -rm -f ./$(DEPDIR)/out_str.Plo + -rm -f ./$(DEPDIR)/pool.Plo + -rm -f ./$(DEPDIR)/pow.Plo + -rm -f ./$(DEPDIR)/pow_si.Plo + -rm -f ./$(DEPDIR)/pow_ui.Plo + -rm -f ./$(DEPDIR)/pow_z.Plo + -rm -f ./$(DEPDIR)/powerof2.Plo + -rm -f ./$(DEPDIR)/print_raw.Plo + -rm -f ./$(DEPDIR)/print_rnd_mode.Plo + -rm -f ./$(DEPDIR)/printf.Plo + -rm -f ./$(DEPDIR)/random_deviate.Plo + -rm -f ./$(DEPDIR)/rec_sqrt.Plo + -rm -f ./$(DEPDIR)/reldiff.Plo + -rm -f ./$(DEPDIR)/rem1.Plo + -rm -f ./$(DEPDIR)/rint.Plo + -rm -f ./$(DEPDIR)/rndna.Plo + -rm -f ./$(DEPDIR)/root.Plo + -rm -f ./$(DEPDIR)/round_near_x.Plo + -rm -f ./$(DEPDIR)/round_p.Plo + -rm -f ./$(DEPDIR)/round_prec.Plo + -rm -f ./$(DEPDIR)/scale2.Plo + -rm -f ./$(DEPDIR)/sec.Plo + -rm -f ./$(DEPDIR)/sech.Plo + -rm -f ./$(DEPDIR)/set.Plo + -rm -f ./$(DEPDIR)/set_d.Plo + -rm -f ./$(DEPDIR)/set_d64.Plo + -rm -f ./$(DEPDIR)/set_dfl_prec.Plo + -rm -f ./$(DEPDIR)/set_exp.Plo + -rm -f ./$(DEPDIR)/set_f.Plo + -rm -f ./$(DEPDIR)/set_float128.Plo + -rm -f ./$(DEPDIR)/set_flt.Plo + -rm -f ./$(DEPDIR)/set_inf.Plo + -rm -f ./$(DEPDIR)/set_ld.Plo + -rm -f ./$(DEPDIR)/set_nan.Plo + -rm -f ./$(DEPDIR)/set_prc_raw.Plo + -rm -f ./$(DEPDIR)/set_prec.Plo + -rm -f ./$(DEPDIR)/set_q.Plo + -rm -f ./$(DEPDIR)/set_rnd.Plo + -rm -f ./$(DEPDIR)/set_si.Plo + -rm -f ./$(DEPDIR)/set_si_2exp.Plo + -rm -f ./$(DEPDIR)/set_sj.Plo + -rm -f ./$(DEPDIR)/set_str.Plo + -rm -f ./$(DEPDIR)/set_str_raw.Plo + -rm -f ./$(DEPDIR)/set_ui.Plo + -rm -f ./$(DEPDIR)/set_ui_2exp.Plo + -rm -f ./$(DEPDIR)/set_uj.Plo + -rm -f ./$(DEPDIR)/set_z.Plo + -rm -f ./$(DEPDIR)/set_z_exp.Plo + -rm -f ./$(DEPDIR)/set_zero.Plo + -rm -f ./$(DEPDIR)/setmax.Plo + -rm -f ./$(DEPDIR)/setmin.Plo + -rm -f ./$(DEPDIR)/setsign.Plo + -rm -f ./$(DEPDIR)/sgn.Plo + -rm -f ./$(DEPDIR)/si_op.Plo + -rm -f ./$(DEPDIR)/signbit.Plo + -rm -f ./$(DEPDIR)/sin.Plo + -rm -f ./$(DEPDIR)/sin_cos.Plo + -rm -f ./$(DEPDIR)/sinh.Plo + -rm -f ./$(DEPDIR)/sinh_cosh.Plo + -rm -f ./$(DEPDIR)/sqr.Plo + -rm -f ./$(DEPDIR)/sqrt.Plo + -rm -f ./$(DEPDIR)/sqrt_ui.Plo + -rm -f ./$(DEPDIR)/stack_interface.Plo + -rm -f ./$(DEPDIR)/strtofr.Plo + -rm -f ./$(DEPDIR)/sub.Plo + -rm -f ./$(DEPDIR)/sub1.Plo + -rm -f ./$(DEPDIR)/sub1sp.Plo + -rm -f ./$(DEPDIR)/sub_d.Plo + -rm -f ./$(DEPDIR)/sub_ui.Plo + -rm -f ./$(DEPDIR)/subnormal.Plo + -rm -f ./$(DEPDIR)/sum.Plo + -rm -f ./$(DEPDIR)/swap.Plo + -rm -f ./$(DEPDIR)/tan.Plo + -rm -f ./$(DEPDIR)/tanh.Plo + -rm -f ./$(DEPDIR)/ubf.Plo + -rm -f ./$(DEPDIR)/uceil_exp2.Plo + -rm -f ./$(DEPDIR)/uceil_log2.Plo + -rm -f ./$(DEPDIR)/ufloor_log2.Plo + -rm -f ./$(DEPDIR)/ui_div.Plo + -rm -f ./$(DEPDIR)/ui_pow.Plo + -rm -f ./$(DEPDIR)/ui_pow_ui.Plo + -rm -f ./$(DEPDIR)/ui_sub.Plo + -rm -f ./$(DEPDIR)/urandom.Plo + -rm -f ./$(DEPDIR)/urandomb.Plo + -rm -f ./$(DEPDIR)/vasprintf.Plo + -rm -f ./$(DEPDIR)/version.Plo + -rm -f ./$(DEPDIR)/volatile.Plo + -rm -f ./$(DEPDIR)/yn.Plo + -rm -f ./$(DEPDIR)/zeta.Plo + -rm -f ./$(DEPDIR)/zeta_ui.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -986,9 +1623,9 @@ .MAKE: all check install install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libLTLIBRARIES clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ @@ -1013,12 +1650,46 @@ $(srcdir)/get_patches.c: $(top_srcdir)/PATCHES $(top_srcdir)/tools/get_patches.sh (cd $(top_srcdir) && ./tools/get_patches.sh) > $@ || rm -f $@ -# Do not add get_patches.c to CLEANFILES so that this file doesn't -# need to be (re)built as long as no patches are applied. Anyway the -# update of this file should be regarded as part of the patch process, -# and "make clean" shouldn't remove it, just like it doesn't remove -# what has been changed by "patch". -#CLEANFILES = get_patches.c +# Check that MPFR does not use GMP internal symbols. Of course, do not run +# this rule if you use --with-gmp-build or --enable-gmp-internals. This +# test does nothing if --disable-shared has been used. +# Note: we use a temporary file $(GMPC) instead of "| $(COMPILE) -E -" +# because the latter is not supported by all compilers (at least under +# MS Windows). +check-gmp-symbols: $(LTLIBRARIES) + if [ -f "$(LIBMPFRSO)" ]; then \ + printf "#include <%s.h>\n" stdarg stdio gmp > $(GMPC) && \ + $(COMPILE) -E $(GMPC) > $(GMPI) || exit 1; \ + internals=`$(NM) -u "$(LIBMPFRSO)" | \ + $(SED) -n 's/^ *U \(__gmp.*\)/\1/p' | \ + while read s; \ + do \ + $(GREP) -q "$$s[ (;]" $(GMPI) || echo "$$s"; \ + done`; \ + if [ -n "$$internals" ]; then \ + echo "Internal GMP symbols:" $$internals; \ + exit 1; \ + fi; \ + rm $(GMPC) $(GMPI); \ + fi + +# Check that MPFR does not define symbols with a GMP reserved prefix. +# For instance, with r11968, and +# ./configure --with-gmp-build=... CC=tcc +# the symbol __gmpn_clz_tab is defined, which is wrong. +# Note: the "$(GREP) -v '@plt$$'" below is for tcc. +check-exported-symbols: $(LTLIBRARIES) + if [ -f "$(LIBMPFRSO)" ]; then \ + gsymbols=`$(NM) -gP "$(LIBMPFRSO)" | perl -ne \ + '/^(__gmp[a-z]?_[_0-9A-Za-z]*) +[A-TV-Z]/ and print " $$1"' | \ + { $(GREP) -v '@plt$$' || true ; }`; \ + if [ -n "$$gsymbols" ]; then \ + echo "MPFR defines symbols with a GMP reserved prefix:$$gsymbols"; \ + exit 1; \ + fi; \ + fi + +.PHONY: check-gmp-symbols check-exported-symbols # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru mpfr4-3.1.4/src/minmax.c mpfr4-4.0.2/src/minmax.c --- mpfr4-3.1.4/src/minmax.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/minmax.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_min -- min and max of x, y -Copyright 2001, 2003-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2001, 2003-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff -Nru mpfr4-3.1.4/src/min_prec.c mpfr4-4.0.2/src/min_prec.c --- mpfr4-3.1.4/src/min_prec.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/min_prec.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_min_prec -- minimal size in bits to hold the mantissa -Copyright 2009-2016 Free Software Foundation, Inc. +Copyright 2009-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/mips/mparam.h mpfr4-4.0.2/src/mips/mparam.h --- mpfr4-3.1.4/src/mips/mparam.h 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/mips/mparam.h 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,234 @@ +/* Various Thresholds of MPFR, not exported. -*- mode: C -*- + +Copyright 2005-2019 Free Software Foundation, Inc. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Generated by MPFR's tuneup.c, 2012-03-05, gcc 4.4.6 + on gcc49.fsffrance.org (Loongson 3A) with GMP 5.0.4 + configured with ac_cv_func_getrusage=no */ + + +#define MPFR_MULHIGH_TAB \ + -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \ + 0,0,0,0,0,0,0,16,16,16,16,16,16,18,18,18, \ + 18,20,20,20,20,22,22,22,24,32,32,32,32,32,32,32, \ + 32,32,32,32,32,36,36,36,36,32,36,36,36,36,36,36, \ + 36,40,40,40,40,40,44,44,44,44,44,44,48,64,64,64, \ + 64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64, \ + 64,64,64,64,64,64,72,72,72,72,64,64,64,64,64,64, \ + 64,64,64,72,72,72,72,93,93,93,93,93,93,93,93,93, \ + 93,93,93,93,93,93,93,93,93,93,93,93,93,93,96,93, \ + 96,93,96,105,105,105,105,105,105,105,105,105,105,105,105,105, \ + 105,105,108,105,117,117,117,117,117,117,117,117,117,117,117,117, \ + 117,117,117,117,117,117,117,117,129,129,129,129,129,129,129,129, \ + 129,129,129,129,129,129,129,129,129,129,141,141,117,117,117,117, \ + 117,117,129,129,128,129,129,129,189,189,189,189,189,189,189,189, \ + 189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189, \ + 189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189, \ + 189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189, \ + 189,189,189,189,189,189,189,188,189,189,192,189,189,189,189,189, \ + 189,189,189,189,189,189,213,213,213,213,213,213,213,213,213,213, \ + 213,213,213,213,213,213,213,212,213,213,213,213,213,213,213,213, \ + 213,213,213,213,213,213,237,237,237,213,213,237,276,237,276,275, \ + 276,276,276,276,276,276,276,276,276,276,276,276,276,276,276,283, \ + 276,276,276,276,276,276,276,276,276,276,276,276,276,276,276,276, \ + 276,275,276,276,276,276,285,283,283,283,285,283,283,285,285,285, \ + 285,285,378,377,378,378,378,378,378,378,378,378,378,378,378,378, \ + 378,377,378,378,378,378,378,378,378,378,378,378,378,378,378,378, \ + 378,378,378,378,378,378,378,378,378,378,378,378,378,378,378,378, \ + 378,378,378,378,378,378,377,378,378,378,378,378,378,378,378,378, \ + 378,378,378,378,378,378,378,378,378,377,378,378,378,378,378,378, \ + 378,378,376,378,378,378,378,378,378,378,378,378,378,378,378,378, \ + 378,378,378,378,378,378,378,378,378,378,378,378,378,378,378,378, \ + 378,378,378,378,378,378,378,378,378,378,378,378,378,378,378,378, \ + 378,378,378,378,378,378,378,378,378,378,378,378,378,378,378,378, \ + 378,378,378,378,504,504,504,503,504,504,504,504,504,503,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 568,504,568,568,568,568,568,568,568,568,568,568,568,568,568,568, \ + 568,568,568,568,568,568,568,568,568,568,568,568,568,568,568,568, \ + 568,568,568,568,568,568,568,568,568,568,568,568,568,568,568,568, \ + 568,568,568,568,568,568,568,568,568,568,568,568,568,568,568,568, \ + 568,568,568,568,568,568,568,568,566,566,568,568,568,568,568,568, \ + 568,632,568,632,632,632,632,632,632,632,632,632,632,632,632,632, \ + 632,632,632,632,632,632,632,632,632,632,632,632,632,632,632,632, \ + 632,632,632,632,632,632,632,632,632,632,736,736,736,735,736,736, \ + 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,735, \ + 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \ + 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \ + 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \ + 736,736,736,736,736,736,736,736,735,736,736,736,736,736,736,736, \ + 736,736,736,736,735,736,736,736,736,736,736,736,736,736,736,736, \ + 736,760,760,760,760,760,760,760,760,760,760,760,760,760,760,760, \ + 760,760,760,760,760,760,760,760,760,760,760,760,760,760,760,760, \ + 760,760,760,760,760,760,832,760,832,832,832,832,832,832,832,832, \ + 832,832,832,831,832,832,832,832,832,832,832,831,832,832,832,832, \ + 832,831,832,832,832,832,831,832,832,832,832,832,832,832,832,832, \ + 832,832,832,832,832,832,832,832,832,832,832,832,832,832,832,832, \ + 832,832,831,832,832,832,832,832,832,832,832,832,832,832,832,832, \ + 832,832,832,832,832,832,832,832,832,832,832,832,832,832,832,832 \ + +#define MPFR_SQRHIGH_TAB \ + -1,0,0,0,0,0,0,0,6,6,7,7,8,8,9,9, \ + 10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17, \ + 18,18,20,19,20,20,22,21,22,23,24,23,24,25,32,32, \ + 32,32,32,32,32,32,32,32,32,32,32,32,32,32,34,34, \ + 34,34,36,36,36,36,38,38,38,38,40,40,40,40,42,42, \ + 42,44,44,44,44,44,46,45,46,46,48,47,48,48,64,64, \ + 64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64, \ + 64,64,64,64,64,64,64,64,64,64,64,68,68,64,68,72, \ + 68,68,68,68,72,72,72,72,72,72,72,72,72,76,76,98, \ + 98,98,98,99,98,99,98,99,98,99,98,99,98,99,98,99, \ + 98,99,98,99,98,99,98,99,102,99,102,99,102,105,102,105, \ + 102,105,98,99,98,99,98,99,98,99,98,99,98,99,98,99, \ + 102,102,102,105,104,105,104,105,108,105,108,111,110,111,114,111, \ + 114,117,116,117,117,117,120,117,120,123,120,123,122,123,126,129, \ + 126,117,116,117,120,117,120,123,123,123,126,126,126,129,126,129, \ + 122,129,123,123,126,126,126,126,129,126,129,128,129,129,129,129, \ + 132,132,135,132,135,132,135,135,135,134,135,138,141,138,141,141, \ + 141,189,189,189,192,189,192,189,192,189,192,192,192,192,192,192, \ + 192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192, \ + 192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192, \ + 192,192,192,192,192,192,189,192,192,192,192,192,192,192,192,192, \ + 192,192,192,192,192,192,192,192,192,192,192,192,192,192,201,201, \ + 201,201,201,201,201,201,201,201,201,201,201,213,213,213,213,213, \ + 213,213,213,213,213,213,213,216,213,213,213,213,213,213,213,213, \ + 213,213,213,213,213,216,213,213,213,225,225,225,225,225,225,224, \ + 225,225,225,237,237,237,237,237,237,237,237,294,294,294,294,294, \ + 294,294,294,294,294,294,294,294,294,294,294,294,294,294,294,294, \ + 294,294,294,294,294,294,294,294,294,294,294,294,294,294,294,294, \ + 294,294,294,294,294,294,294,294,294,294,294,294,294,294,294,294, \ + 294,294,294,294,294,294,294,294,294,294,294,294,294,294,294,294, \ + 294,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402, \ + 402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402, \ + 402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402, \ + 402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402, \ + 402,402,402,402,402,402,402,402,402,402,402,402,400,402,402,402, \ + 402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402, \ + 402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402, \ + 402,402,402,402,402,402,402,402,402,402,402,426,426,426,504,504, \ + 504,503,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,503,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,503,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 503,504,504,504,504,504,504,504,504,504,504,504,504,504,504,503, \ + 504,504,503,504,504,504,504,536,536,536,536,536,536,536,536,536, \ + 536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,535, \ + 536,536,535,536,536,536,536,536,568,568,568,568,568,568,568,568, \ + 568,568,568,568,567,568,568,568,568,568,568,568,568,568,568,567, \ + 568,568,567,568,568,568,568,568,568,568,568,568,568,568,568,568, \ + 568,568,568,568,568,568,568,568,568,568,568,568,568,568,568,599, \ + 600,600,568,600,600,568,600,600,600,600,568,600,568,600,504,504, \ + 504,504,504,504,504,503,503,503,504,503,504,504,504,504,502,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \ + 504,503,503,504,504,504,504,504,504,504,503,504,504,504,504,504, \ + 504,504,504,536,536,536,536,536,536,536,536,536,536,536,536,536, \ + 536,536,536,536,536,536,536,536,536,536,535,536,536,536,536,536, \ + 536,536,536,536,568,568,568,568,552,568,568,568,568,568,568,536 \ + +#define MPFR_DIVHIGH_TAB \ + 0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0, /*0-15*/ \ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /*16-31*/ \ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /*32-47*/ \ + 0,0,0,27,0,28,0,29,30,30,31,32,32,33,34,33, /*48-63*/ \ + 34,35,36,35,36,36,37,37,38,39,39,39,40,40,41,41, /*64-79*/ \ + 50,51,50,50,52,50,50,52,51,52,50,51,50,50,52,50, /*80-95*/ \ + 52,50,52,52,52,52,56,55,56,64,64,64,64,64,64,64, /*96-111*/ \ + 64,64,64,64,64,64,64,64,64,64,64,64,64,64,72,66, /*112-127*/ \ + 66,71,72,71,72,71,72,69,72,72,72,72,72,72,78,80, /*128-143*/ \ + 78,79,78,80,80,80,80,80,80,79,80,80,80,80,88,84, /*144-159*/ \ + 88,88,88,88,88,84,87,85,86,86,88,87,88,88,104,89, /*160-175*/ \ + 104,100,102,104,104,102,100,100,102,103,100,103,128,103,100,104, /*176-191*/ \ + 128,103,100,100,104,103,104,103,128,102,104,128,104,128,128,128, /*192-207*/ \ + 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, /*208-223*/ \ + 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, /*224-239*/ \ + 128,128,127,127,128,128,127,128,128,128,140,128,144,128,144,132, /*240-255*/ \ + 144,135,143,144,144,143,144,143,144,144,142,143,144,144,140,144, /*256-271*/ \ + 138,141,144,144,144,143,144,143,144,144,144,144,144,144,160,160, /*272-287*/ \ + 160,160,148,152,156,157,160,160,160,158,159,160,160,160,160,159, /*288-303*/ \ + 160,160,160,159,159,160,160,159,159,160,160,161,176,160,162,181, /*304-319*/ \ + 182,185,186,184,185,186,185,176,185,186,200,192,186,208,184,208, /*320-335*/ \ + 185,206,200,200,203,200,208,204,204,206,208,208,209,208,208,208, /*336-351*/ \ + 206,208,206,206,200,204,204,208,208,208,208,208,208,208,208,208, /*352-367*/ \ + 207,204,206,207,208,208,208,206,208,208,208,208,208,208,208,206, /*368-383*/ \ + 208,208,208,208,206,208,208,208,256,256,208,256,256,206,256,256, /*384-399*/ \ + 256,256,256,208,255,256,256,256,256,256,256,256,256,256,256,256, /*400-415*/ \ + 256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256, /*416-431*/ \ + 256,256,255,256,256,256,256,256,256,256,256,254,256,255,256,256, /*432-447*/ \ + 256,256,256,256,256,256,255,255,256,256,256,255,254,254,256,253, /*448-463*/ \ + 256,256,256,256,256,256,256,256,256,255,255,256,256,256,256,256, /*464-479*/ \ + 256,256,256,255,256,256,255,256,256,256,256,255,254,256,256,255, /*480-495*/ \ + 256,256,256,256,255,256,255,255,255,256,255,256,256,256,257,264, /*496-511*/ \ + 272,264,269,281,277,281,280,268,269,281,282,282,279,264,288,288, /*512-527*/ \ + 287,280,281,280,288,288,288,282,287,288,287,288,287,288,282,287, /*528-543*/ \ + 281,282,288,288,280,288,288,282,281,288,280,282,287,288,287,288, /*544-559*/ \ + 282,288,288,288,287,285,288,287,288,288,288,288,288,288,289,292, /*560-575*/ \ + 296,293,304,304,304,312,304,306,304,305,303,304,312,304,305,316, /*576-591*/ \ + 315,318,318,312,316,316,318,316,316,320,318,318,320,320,371,370, /*592-607*/ \ + 371,372,373,372,372,373,376,376,378,377,378,378,384,373,377,372, /*608-623*/ \ + 378,372,378,378,378,378,377,384,378,384,378,372,378,378,378,378, /*624-639*/ \ + 372,377,378,378,377,378,378,378,377,371,384,384,378,378,378,378, /*640-655*/ \ + 378,377,378,378,378,378,378,378,378,384,384,384,383,384,417,384, /*656-671*/ \ + 378,378,378,378,377,378,378,401,378,400,378,378,400,408,384,412, /*672-687*/ \ + 384,384,414,408,416,417,411,416,384,414,414,414,416,416,417,414, /*688-703*/ \ + 416,420,400,412,412,412,416,413,416,414,414,416,416,416,412,412, /*704-719*/ \ + 416,416,414,416,416,416,417,416,416,416,416,414,415,416,416,416, /*720-735*/ \ + 414,378,378,377,384,378,378,384,384,384,384,384,384,384,414,384, /*736-751*/ \ + 415,416,416,413,414,416,416,413,414,414,416,416,415,416,416,400, /*752-767*/ \ + 412,408,417,411,412,416,415,416,416,412,416,417,416,414,416,416, /*768-783*/ \ + 416,416,416,416,416,416,416,414,416,416,416,400,415,416,416,401, /*784-799*/ \ + 416,420,412,408,408,412,416,407,408,416,415,412,416,414,416,415, /*800-815*/ \ + 414,412,413,416,412,414,413,416,416,416,418,416,416,416,417,417, /*816-831*/ \ + 419,418,420,419,420,420,426,421,424,426,424,432,426,425,426,426, /*832-847*/ \ + 426,426,432,432,432,432,432,432,432,432,436,432,432,432,433,435, /*848-863*/ \ + 440,438,440,438,436,440,440,438,448,444,444,448,440,444,448,446, /*864-879*/ \ + 444,448,444,443,444,446,446,448,448,449,448,448,448,449,450,468, /*880-895*/ \ + 466,468,460,457,458,460,463,456,460,456,464,467,462,473,512,458, /*896-911*/ \ + 488,468,512,473,512,468,512,510,512,512,510,510,512,508,512,512, /*912-927*/ \ + 512,512,510,512,512,510,512,510,474,511,486,512,512,512,512,512, /*928-943*/ \ + 509,510,510,512,512,512,512,512,512,512,514,512,512,511,508,512, /*944-959*/ \ + 512,510,512,511,512,508,512,512,512,511,512,512,510,512,512,510, /*960-975*/ \ + 512,510,510,512,512,511,512,512,512,512,512,512,512,512,549,512, /*976-991*/ \ + 512,512,545,512,512,512,510,512,512,512,512,512,512,512,510,512, /*992-1007*/ \ + 512,512,551,510,545,512,550,512,552,545,511,557,545,512,544,551 /*1008-1023*/ \ + +#define MPFR_MUL_THRESHOLD 6 /* limbs */ +#define MPFR_SQR_THRESHOLD 9 /* limbs */ +#define MPFR_DIV_THRESHOLD 6 /* limbs */ +#define MPFR_EXP_2_THRESHOLD 530 /* bits */ +#define MPFR_EXP_THRESHOLD 12546 /* bits */ +#define MPFR_SINCOS_THRESHOLD 22043 /* bits */ +#define MPFR_AI_THRESHOLD1 -17975 /* threshold for negative input of mpfr_ai */ +#define MPFR_AI_THRESHOLD2 1889 +#define MPFR_AI_THRESHOLD3 28004 +/* Tuneup completed successfully, took 13753 seconds */ diff -Nru mpfr4-3.1.4/src/modf.c mpfr4-4.0.2/src/modf.c --- mpfr4-3.1.4/src/modf.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/modf.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_modf -- Integral and fractional part. -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/mparam_h.in mpfr4-4.0.2/src/mparam_h.in --- mpfr4-3.1.4/src/mparam_h.in 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/mparam_h.in 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. @@ -16,18 +16,23 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __MPFR_IMPL_H__ # error "MPFR Internal not included" #endif +/* Threshold when testing coverage */ +#if defined(MPFR_TUNE_COVERAGE) +#define MPFR_TUNE_CASE "src/generic/coverage/mparam.h" +#include "generic/coverage/mparam.h" + /* Note: the different macros used here are those defined by gcc, for example with gcc -dM -E -xc /dev/null As of gcc 4.2, you can also use: -march=native or -mtune=native */ -#if defined (__tune_pentium4__) /* Threshold for Pentium 4 */ +#elif defined (__tune_pentium4__) /* Threshold for Pentium 4 */ #define MPFR_TUNE_CASE "src/x86_64/pentium4/mparam.h" #include "x86_64/pentium4/mparam.h" @@ -40,7 +45,7 @@ #define MPFR_TUNE_CASE "src/x86/core2/mparam.h" #include "x86/core2/mparam.h" -#elif defined (__tune_k8__) /* Threshold for AMD 64 */ +#elif defined (__tune_k8__) && defined (__amd64__) /* AMD K8 */ #define MPFR_TUNE_CASE "src/amd/k8/mparam.h" #include "amd/k8/mparam.h" @@ -79,6 +84,10 @@ #define MPFR_TUNE_CASE "src/hppa/mparam.h" #include "hppa/mparam.h" +#elif defined (__mips__) /* MIPS */ +#define MPFR_TUNE_CASE "src/mips/mparam.h" +#include "mips/mparam.h" + #else #define MPFR_TUNE_CASE "default" #endif diff -Nru mpfr4-3.1.4/src/mp_clz_tab.c mpfr4-4.0.2/src/mp_clz_tab.c --- mpfr4-3.1.4/src/mp_clz_tab.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/mp_clz_tab.c 2019-01-07 13:53:20.000000000 +0000 @@ -3,7 +3,7 @@ THE CONTENTS OF THIS FILE ARE FOR INTERNAL USE AND MAY CHANGE INCOMPATIBLY OR DISAPPEAR IN A FUTURE GNU MPFR RELEASE. -Copyright 1991, 1993-1994, 1996-1997, 2000-2001, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1991, 1993-1994, 1996-1997, 2000-2001, 2004, 2006-2019 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. It has been copied and adapted from the GNU MP Library. @@ -20,19 +20,21 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" -#if defined(COUNT_LEADING_ZEROS_NEED_CLZ_TAB) && defined(__GMPFR_GMP_H__) +/* Warning: up from version 5.1.0, __clz_tab has 129 elements. */ +#if defined(COUNT_LEADING_ZEROS_NEED_CLZ_TAB) && !defined(MPFR_HAVE_GMP_IMPL) const -unsigned char __clz_tab[128] = +unsigned char __clz_tab[129] = { 1,2,3,3,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 9 }; #endif diff -Nru mpfr4-3.1.4/src/mpf2mpfr.h mpfr4-4.0.2/src/mpf2mpfr.h --- mpfr4-3.1.4/src/mpf2mpfr.h 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/mpf2mpfr.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpf2mpfr.h -- Compatibility include file with mpf. -Copyright 1999-2002, 2004-2016 Free Software Foundation, Inc. +Copyright 1999-2002, 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __MPFR_FROM_MPF__ @@ -33,12 +33,18 @@ # define MPFR_DEFAULT_RND mpfr_get_default_rounding_mode () #endif -/* mpf_init initalizes at 0 */ +/* mpf_init initializes at 0 */ #undef mpf_init #define mpf_init(x) mpfr_init_set_ui ((x), 0, MPFR_DEFAULT_RND) #undef mpf_init2 #define mpf_init2(x,p) (mpfr_init2((x),(p)), mpfr_set_ui ((x), 0, MPFR_DEFAULT_RND)) +/* Warning! This assumes that all pointer types have the same representation. */ +#undef mpf_inits +#define mpf_inits mpfr_inits +#undef mpf_clears +#define mpf_clears mpfr_clears + /* functions which don't take as argument the rounding mode */ #undef mpf_ceil #define mpf_ceil mpfr_ceil @@ -52,6 +58,11 @@ #define mpf_cmp_ui mpfr_cmp_ui #undef mpf_cmp_d #define mpf_cmp_d mpfr_cmp_d +/* mpf_cmp_z appeared in GMP 6.1.0 */ +#if __GNU_MP_VERSION > 6 || (__GNU_MP_VERSION == 6 && __GNU_MP_VERSION_MINOR >= 1) +#undef mpf_cmp_z +#define mpf_cmp_z mpfr_cmp_z +#endif #undef mpf_eq #define mpf_eq mpfr_eq #undef mpf_floor @@ -93,15 +104,15 @@ #undef mpf_div_2exp #define mpf_div_2exp(x,y,z) mpfr_div_2exp(x,y,z,MPFR_DEFAULT_RND) #undef mpf_fits_slong_p -#define mpf_fits_slong_p(x) mpfr_fits_ulong_p(x,MPFR_DEFAULT_RND) +#define mpf_fits_slong_p(x) mpfr_fits_slong_p(x,MPFR_DEFAULT_RND) #undef mpf_fits_ulong_p #define mpf_fits_ulong_p(x) mpfr_fits_ulong_p(x,MPFR_DEFAULT_RND) #undef mpf_fits_sint_p -#define mpf_fits_sint_p(x) mpfr_fits_uint_p(x,MPFR_DEFAULT_RND) +#define mpf_fits_sint_p(x) mpfr_fits_sint_p(x,MPFR_DEFAULT_RND) #undef mpf_fits_uint_p #define mpf_fits_uint_p(x) mpfr_fits_uint_p(x,MPFR_DEFAULT_RND) #undef mpf_fits_sshort_p -#define mpf_fits_sshort_p(x) mpfr_fits_ushort_p(x,MPFR_DEFAULT_RND) +#define mpf_fits_sshort_p(x) mpfr_fits_sshort_p(x,MPFR_DEFAULT_RND) #undef mpf_fits_ushort_p #define mpf_fits_ushort_p(x) mpfr_fits_ushort_p(x,MPFR_DEFAULT_RND) #undef mpf_get_str @@ -113,7 +124,7 @@ #undef mpf_get_ui #define mpf_get_ui(x) mpfr_get_ui(x,MPFR_DEFAULT_RND) #undef mpf_get_si -#define mpf_get_si(x) mpfr_get_ui(x,MPFR_DEFAULT_RND) +#define mpf_get_si(x) mpfr_get_si(x,MPFR_DEFAULT_RND) #undef mpf_inp_str #define mpf_inp_str(x,y,z) mpfr_inp_str(x,y,z,MPFR_DEFAULT_RND) #undef mpf_set_str @@ -171,5 +182,7 @@ #undef mpz_set_f #define mpz_set_f(z,f) mpfr_get_z(z,f,MPFR_DEFAULT_RND) +#undef mpq_set_f +#define mpq_set_f(q,f) mpfr_get_q(q,f) #endif /* __MPFR_FROM_MPF__ */ diff -Nru mpfr4-3.1.4/src/mpfr-cvers.h mpfr4-4.0.2/src/mpfr-cvers.h --- mpfr4-3.1.4/src/mpfr-cvers.h 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/mpfr-cvers.h 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,62 @@ +/* Utilities for MPFR developers, not exported. + +Copyright 1999-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef __MPFR_CVERS_H__ +#define __MPFR_CVERS_H__ + +/* Macros to detect STDC, ICC, GCC, and GLIBC versions */ +#if defined(__STDC_VERSION__) +# define __MPFR_STDC(version) (__STDC_VERSION__ >= (version)) +#else +# define __MPFR_STDC(version) 0 +#endif + +#if defined(_WIN32) +/* Under MS Windows (e.g. with VS2008 or VS2010), Intel's compiler doesn't + support/enable extensions like the ones seen under GNU/Linux. + https://sympa.inria.fr/sympa/arc/mpfr/2011-02/msg00032.html */ +# define __MPFR_ICC(a,b,c) 0 +#elif defined(__ICC) +# define __MPFR_ICC(a,b,c) (__ICC >= (a)*100+(b)*10+(c)) +#elif defined(__INTEL_COMPILER) +# define __MPFR_ICC(a,b,c) (__INTEL_COMPILER >= (a)*100+(b)*10+(c)) +#else +# define __MPFR_ICC(a,b,c) 0 +#endif + +#define __MPFR_MAJMIN(a,i) (((a) << 8) | (i)) + +#if defined(__GNUC__) && defined(__GNUC_MINOR__) && ! __MPFR_ICC(0,0,0) +# define __MPFR_GNUC(a,i) \ + (__MPFR_MAJMIN(__GNUC__,__GNUC_MINOR__) >= __MPFR_MAJMIN(a,i)) +#else +# define __MPFR_GNUC(a,i) 0 +#endif + +#if defined(__GLIBC__) && defined(__GLIBC_MINOR__) +# define __MPFR_GLIBC(a,i) \ + (__MPFR_MAJMIN(__GLIBC__,__GLIBC_MINOR__) >= __MPFR_MAJMIN(a,i)) +#else +# define __MPFR_GLIBC(a,i) 0 +#endif + +#endif diff -Nru mpfr4-3.1.4/src/mpfr-gmp.c mpfr4-4.0.2/src/mpfr-gmp.c --- mpfr4-3.1.4/src/mpfr-gmp.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/mpfr-gmp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_gmp -- Limited gmp-impl emulator Modified version of the GMP files. -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,18 +18,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include /* For malloc, free, realloc and abort */ - #include "mpfr-impl.h" #ifndef MPFR_HAVE_GMP_IMPL -char mpfr_rands_initialized = 0; -gmp_randstate_t mpfr_rands; - const struct bases mpfr_bases[257] = { /* 0 */ {0.0}, @@ -291,9 +286,9 @@ /* 256 */ {0.1250000000000000}, }; -void +MPFR_COLD_FUNCTION_ATTR void mpfr_assert_fail (const char *filename, int linenum, - const char *expr) + const char *expr) { if (filename != NULL && filename[0] != '\0') { @@ -305,54 +300,41 @@ abort(); } -#ifdef mp_get_memory_functions - -/* putting 0 as initial values forces those symbols to be fully defined, - and always resolved, otherwise they are only tentatively defined, which - leads to problems on e.g. MacOS, cf - http://lists.gforge.inria.fr/pipermail/mpc-discuss/2008-November/000048.html - and http://software.intel.com/en-us/articles/intelr-fortran-compiler-for-mac-os-non_lazy_ptr-unresolved-references-from-linking - Note that using ranlib -c or libtool -c is another fix. -*/ -MPFR_THREAD_ATTR void * (*mpfr_allocate_func) (size_t) = 0; -MPFR_THREAD_ATTR void * (*mpfr_reallocate_func) (void *, size_t, size_t) = 0; -MPFR_THREAD_ATTR void (*mpfr_free_func) (void *, size_t) = 0; - -#endif - -void * -mpfr_default_allocate (size_t size) +/* Performing a concentration for theses indirect functions may be + good for performance since branch prediction for indirect calls + is not well supported by a lot of CPU's (typically they can only + predict a limited number of indirections). */ +MPFR_HOT_FUNCTION_ATTR void * +mpfr_allocate_func (size_t alloc_size) { - void *ret; - ret = malloc (size); - if (ret == NULL) - { - fprintf (stderr, "MPFR: Can't allocate memory (size=%lu)\n", - (unsigned long) size); - abort (); - } - return ret; + void * (*allocate_func) (size_t); + void * (*reallocate_func) (void *, size_t, size_t); + void (*free_func) (void *, size_t); + /* Always calling with the 3 arguments smooths branch prediction. */ + mp_get_memory_functions (&allocate_func, &reallocate_func, &free_func); + return (*allocate_func) (alloc_size); } -void * -mpfr_default_reallocate (void *oldptr, size_t old_size, size_t new_size) +MPFR_HOT_FUNCTION_ATTR void * +mpfr_reallocate_func (void * ptr, size_t old_size, size_t new_size) { - void *ret; - ret = realloc (oldptr, new_size); - if (ret == NULL) - { - fprintf (stderr, - "MPFR: Can't reallocate memory (old_size=%lu new_size=%lu)\n", - (unsigned long) old_size, (unsigned long) new_size); - abort (); - } - return ret; + void * (*allocate_func) (size_t); + void * (*reallocate_func) (void *, size_t, size_t); + void (*free_func) (void *, size_t); + /* Always calling with the 3 arguments smooths branch prediction. */ + mp_get_memory_functions (&allocate_func, &reallocate_func, &free_func); + return (*reallocate_func) (ptr, old_size, new_size); } -void -mpfr_default_free (void *blk_ptr, size_t blk_size) +MPFR_HOT_FUNCTION_ATTR void +mpfr_free_func (void *ptr, size_t size) { - free (blk_ptr); + void * (*allocate_func) (size_t); + void * (*reallocate_func) (void *, size_t, size_t); + void (*free_func) (void *, size_t); + /* Always calling with the 3 arguments smooths branch prediction. */ + mp_get_memory_functions (&allocate_func, &reallocate_func, &free_func); + (*free_func) (ptr, size); } void * @@ -361,8 +343,8 @@ struct tmp_marker *head; head = (struct tmp_marker *) - mpfr_default_allocate (sizeof (struct tmp_marker)); - head->ptr = mpfr_default_allocate (size); + mpfr_allocate_func (sizeof (struct tmp_marker)); + head->ptr = mpfr_allocate_func (size); head->size = size; head->next = *tmp_marker; *tmp_marker = head; @@ -377,9 +359,9 @@ while (tmp_marker != NULL) { t = tmp_marker; - mpfr_default_free (t->ptr, t->size); + mpfr_free_func (t->ptr, t->size); tmp_marker = t->next; - mpfr_default_free (t, sizeof (struct tmp_marker)); + mpfr_free_func (t, sizeof (struct tmp_marker)); } } diff -Nru mpfr4-3.1.4/src/mpfr-gmp.h mpfr4-4.0.2/src/mpfr-gmp.h --- mpfr4-3.1.4/src/mpfr-gmp.h 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/mpfr-gmp.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ -/* Interface to replace gmp-impl.h +/* Uniform Interface to GMP. -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __GMPFR_GMP_H__ @@ -27,8 +27,72 @@ # error "mpfr-impl.h not included" #endif -#include /* For INT_MAX, ... */ -#include /* For memcpy, memset and memmove */ + +/****************************************************** + ******************** C++ Compatibility *************** + ******************************************************/ +#if defined (__cplusplus) +extern "C" { +#endif + + +/****************************************************** + ******************** Identify GMP ******************** + ******************************************************/ + +/* Macro to detect the GMP version */ +#if defined(__GNU_MP_VERSION) && \ + defined(__GNU_MP_VERSION_MINOR) && \ + defined(__GNU_MP_VERSION_PATCHLEVEL) +# define __MPFR_GMP(a,b,c) \ + (MPFR_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL) >= MPFR_VERSION_NUM(a,b,c)) +#else +# define __MPFR_GMP(a,b,c) 0 +#endif + + + +/****************************************************** + ******************** Check GMP *********************** + ******************************************************/ + +#if !__MPFR_GMP(5,0,0) && !defined(MPFR_USE_MINI_GMP) +# error "GMP 5.0.0 or newer is required" +#endif + +#if GMP_NAIL_BITS != 0 +# error "MPFR doesn't support nonzero values of GMP_NAIL_BITS" +#endif + +#if (GMP_NUMB_BITS<32) || (GMP_NUMB_BITS & (GMP_NUMB_BITS - 1)) +# error "GMP_NUMB_BITS must be a power of 2, and >= 32" +#endif + +#if GMP_NUMB_BITS == 32 +# define MPFR_LOG2_GMP_NUMB_BITS 5 +#elif GMP_NUMB_BITS == 64 +# define MPFR_LOG2_GMP_NUMB_BITS 6 +#elif GMP_NUMB_BITS == 128 +# define MPFR_LOG2_GMP_NUMB_BITS 7 +#elif GMP_NUMB_BITS == 256 +# define MPFR_LOG2_GMP_NUMB_BITS 8 +#else +# error "Can't compute log2(GMP_NUMB_BITS)" +#endif + + + +/****************************************************** + ************* Define GMP Internal Interface ********* + ******************************************************/ + +#ifdef MPFR_HAVE_GMP_IMPL /* with gmp build */ + +#define mpfr_allocate_func (*__gmp_allocate_func) +#define mpfr_reallocate_func (*__gmp_reallocate_func) +#define mpfr_free_func (*__gmp_free_func) + +#else /* without gmp build (gmp-impl.h replacement) */ /* The following tries to get a good version of alloca. See gmp-impl.h for implementation details and original version */ @@ -51,36 +115,12 @@ # endif #endif -#if defined (__cplusplus) -extern "C" { -#endif - -/* Define GMP_NUMB_BITS - Can't use sizeof(mp_limb_t) since it should be a preprocessor constant */ -#if defined(GMP_NUMB_BITS) /* GMP 4.1.2 or above */ -#ifndef GMP_NUMB_BITS -# define GMP_NUMB_BITS (GMP_NUMB_BITS+GMP_NAIL_BITS) -#endif -#elif defined (__GMP_GMP_NUMB_BITS) /* Older versions 4.x.x */ -# define GMP_NUMB_BITS __GMP_GMP_NUMB_BITS -# define GMP_NUMB_BITS GMP_NUMB_BITS -# ifndef GMP_NAIL_BITS -# define GMP_NAIL_BITS 0 -# endif -#else -# error "Could not detect GMP_NUMB_BITS. Try with gmp internal files." -#endif - /* Define some macros */ -#define MP_LIMB_T_MAX (~(mp_limb_t)0) - #define ULONG_HIGHBIT (ULONG_MAX ^ ((unsigned long) ULONG_MAX >> 1)) #define UINT_HIGHBIT (UINT_MAX ^ ((unsigned) UINT_MAX >> 1)) #define USHRT_HIGHBIT ((unsigned short) (USHRT_MAX ^ ((unsigned short) USHRT_MAX >> 1))) -#define GMP_LIMB_HIGHBIT (MP_LIMB_T_MAX ^ (MP_LIMB_T_MAX >> 1)) - #if __GMP_MP_SIZE_T_INT #define MP_SIZE_T_MAX INT_MAX @@ -90,14 +130,8 @@ #define MP_SIZE_T_MIN LONG_MIN #endif -#define LONG_HIGHBIT LONG_MIN -#define INT_HIGHBIT INT_MIN -#define SHRT_HIGHBIT SHRT_MIN - /* MP_LIMB macros */ #define MPN_ZERO(dst, n) memset((dst), 0, (n)*MPFR_BYTES_PER_MP_LIMB) -#define MPN_COPY_DECR(dst,src,n) memmove((dst),(src),(n)*MPFR_BYTES_PER_MP_LIMB) -#define MPN_COPY_INCR(dst,src,n) memmove((dst),(src),(n)*MPFR_BYTES_PER_MP_LIMB) #define MPN_COPY(dst,src,n) \ do \ { \ @@ -152,24 +186,27 @@ #endif /* ASSERT */ -__MPFR_DECLSPEC void mpfr_assert_fail _MPFR_PROTO((const char *, int, - const char *)); +__MPFR_DECLSPEC void mpfr_assert_fail (const char *, int, + const char *); #define ASSERT_FAIL(expr) mpfr_assert_fail (__FILE__, __LINE__, #expr) +/* ASSERT() is for mpfr-longlong.h only. */ #define ASSERT(expr) MPFR_ASSERTD(expr) /* Access fields of GMP struct */ #define SIZ(x) ((x)->_mp_size) #define ABSIZ(x) ABS (SIZ (x)) #define PTR(x) ((x)->_mp_d) +#define ALLOC(x) ((x)->_mp_alloc) +/* For mpf numbers only. */ +#ifdef MPFR_NEED_MPF_INTERNALS +/* Note: the EXP macro name is reserved when is included. + For compatibility with gmp-impl.h (cf --with-gmp-build), we cannot + change this macro, but let's define it only when we need it, where + will not be included. */ #define EXP(x) ((x)->_mp_exp) #define PREC(x) ((x)->_mp_prec) -#define ALLOC(x) ((x)->_mp_alloc) -#define MPZ_REALLOC(z,n) ((n) > ALLOC(z) ? _mpz_realloc(z,n) : PTR(z)) - -/* Non IEEE float supports -- needs to detect them with proper configure */ -#undef XDEBUG -#define XDEBUG +#endif /* For longlong.h */ #ifdef HAVE_ATTRIBUTE_MODE @@ -201,7 +238,7 @@ /* Use (4.0 * ...) instead of (2.0 * ...) to work around buggy compilers that don't convert ulong->double correctly (eg. SunOS 4 native cc). */ #undef MP_BASE_AS_DOUBLE -#define MP_BASE_AS_DOUBLE (4.0 * ((mp_limb_t) 1 << (GMP_NUMB_BITS - 2))) +#define MP_BASE_AS_DOUBLE (4.0 * (MPFR_LIMB_ONE << (GMP_NUMB_BITS - 2))) /* Structure for conversion between internal binary format and strings in base 2..36. */ @@ -218,91 +255,50 @@ #undef ABS #undef MIN #undef MAX -#undef numberof #define ABS(x) ((x) >= 0 ? (x) : -(x)) #define MIN(l,o) ((l) < (o) ? (l) : (o)) #define MAX(h,i) ((h) > (i) ? (h) : (i)) -#define numberof(x) (sizeof (x) / sizeof ((x)[0])) - -/* Random */ -#undef __gmp_rands_initialized -#undef __gmp_rands -#define __gmp_rands_initialized mpfr_rands_initialized -#define __gmp_rands mpfr_rands - -__MPFR_DECLSPEC extern char mpfr_rands_initialized; -__MPFR_DECLSPEC extern gmp_randstate_t mpfr_rands; - -#undef RANDS -#define RANDS \ - ((__gmp_rands_initialized ? 0 \ - : (__gmp_rands_initialized = 1, \ - gmp_randinit_default (__gmp_rands), 0)), \ - __gmp_rands) - -#undef RANDS_CLEAR -#define RANDS_CLEAR() \ - do { \ - if (__gmp_rands_initialized) \ - { \ - __gmp_rands_initialized = 0; \ - gmp_randclear (__gmp_rands); \ - } \ - } while (0) - -typedef __gmp_randstate_struct *gmp_randstate_ptr; - -/* Allocate func are defined in gmp-impl.h */ - -/* In newer GMP, there aren't anymore __gmp_allocate_func, - __gmp_reallocate_func & __gmp_free_func in gmp.h - Just getting the correct value by calling mp_get_memory_functions */ -#ifdef mp_get_memory_functions - -#undef __gmp_allocate_func -#undef __gmp_reallocate_func -#undef __gmp_free_func -#define MPFR_GET_MEMFUNC \ - ((void) (MPFR_LIKELY (mpfr_allocate_func != 0) || \ - (mp_get_memory_functions(&mpfr_allocate_func, \ - &mpfr_reallocate_func, \ - &mpfr_free_func), 1))) -#define __gmp_allocate_func (MPFR_GET_MEMFUNC, mpfr_allocate_func) -#define __gmp_reallocate_func (MPFR_GET_MEMFUNC, mpfr_reallocate_func) -#define __gmp_free_func (MPFR_GET_MEMFUNC, mpfr_free_func) -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR void * (*mpfr_allocate_func) _MPFR_PROTO ((size_t)); -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR void * (*mpfr_reallocate_func) _MPFR_PROTO ((void *, size_t, size_t)); -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR void (*mpfr_free_func) _MPFR_PROTO ((void *, size_t)); +/* Size of an array, safe version but not a constant expression: + Since an array can silently be converted to a pointer, we check + that this macro is applied on an array, not a pointer. */ +#undef numberof +#if 0 +/* The following should work with GCC as documented in its manual, + but fails: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38377#c10 + Thus disabled for now. */ +# define numberof(x) \ + ( __extension__ ({ \ + int is_array = (void *) &(x) == (void *) &(x)[0]; \ + MPFR_STAT_STATIC_ASSERT (__builtin_constant_p (is_array) ? \ + is_array : 1); \ + MPFR_ASSERTN (is_array); \ + numberof_const (x); \ + }) ) +#else +# define numberof(x) \ + (MPFR_ASSERTN ((void *) &(x) == (void *) &(x)[0]), \ + numberof_const (x)) #endif -#undef __gmp_default_allocate -#undef __gmp_default_reallocate -#undef __gmp_default_free -#define __gmp_default_allocate mpfr_default_allocate -#define __gmp_default_reallocate mpfr_default_reallocate -#define __gmp_default_free mpfr_default_free -__MPFR_DECLSPEC void *__gmp_default_allocate _MPFR_PROTO ((size_t)); -__MPFR_DECLSPEC void *__gmp_default_reallocate _MPFR_PROTO ((void *, size_t, - size_t)); -__MPFR_DECLSPEC void __gmp_default_free _MPFR_PROTO ((void *, size_t)); - -#if defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_ROOTREM) -#ifndef __gmpn_rootrem - __MPFR_DECLSPEC mp_size_t __gmpn_rootrem _MPFR_PROTO ((mp_limb_t*, - mp_limb_t*, mp_limb_t*, mp_size_t, mp_limb_t)); -#endif -#endif +__MPFR_DECLSPEC void * mpfr_allocate_func (size_t); +__MPFR_DECLSPEC void * mpfr_reallocate_func (void *, size_t, size_t); +__MPFR_DECLSPEC void mpfr_free_func (void *, size_t); #if defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_SBPI1_DIVAPPR_Q) #ifndef __gmpn_sbpi1_divappr_q - __MPFR_DECLSPEC mp_limb_t __gmpn_sbpi1_divappr_q _MPFR_PROTO ((mp_limb_t*, - mp_limb_t*, mp_size_t, mp_limb_t*, mp_size_t, mp_limb_t)); +__MPFR_DECLSPEC mp_limb_t __gmpn_sbpi1_divappr_q (mp_limb_t*, + mp_limb_t*, mp_size_t, mp_limb_t*, mp_size_t, mp_limb_t); #endif #endif -/* Temp memory allocate */ +#if defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_INVERT_LIMB) +#ifndef __gmpn_invert_limb +__MPFR_DECLSPEC mp_limb_t __gmpn_invert_limb (mp_limb_t); +#endif +#endif +/* Temp memory allocate */ struct tmp_marker { void *ptr; @@ -310,62 +306,59 @@ struct tmp_marker *next; }; -__MPFR_DECLSPEC void *mpfr_tmp_allocate _MPFR_PROTO ((struct tmp_marker **, - size_t)); -__MPFR_DECLSPEC void mpfr_tmp_free _MPFR_PROTO ((struct tmp_marker *)); +__MPFR_DECLSPEC void *mpfr_tmp_allocate (struct tmp_marker **, + size_t); +__MPFR_DECLSPEC void mpfr_tmp_free (struct tmp_marker *); + +/* Can be overridden at configure time. Useful for checking buffer overflow. */ +#ifndef MPFR_ALLOCA_MAX +# define MPFR_ALLOCA_MAX 16384 +#endif /* Do not define TMP_SALLOC (see the test in mpfr-impl.h)! */ -#define TMP_ALLOC(n) (MPFR_LIKELY ((n) < 16384) ? \ +#define TMP_ALLOC(n) (MPFR_LIKELY ((n) <= MPFR_ALLOCA_MAX) ? \ alloca (n) : mpfr_tmp_allocate (&tmp_marker, (n))) #define TMP_DECL(m) struct tmp_marker *tmp_marker #define TMP_MARK(m) (tmp_marker = 0) -#define TMP_FREE(m) mpfr_tmp_free (tmp_marker) +/* Note about TMP_FREE: For small precisions, tmp_marker is null as + the allocation is done on the stack (see TMP_ALLOC above). */ +#define TMP_FREE(m) \ + (MPFR_LIKELY (tmp_marker == NULL) ? (void) 0 : mpfr_tmp_free (tmp_marker)) + +#endif /* gmp-impl.h replacement */ + + + +/****************************************************** + ****** GMP Interface which changes with versions ***** + ****** to other versions of GMP. Add missing ***** + ****** interfaces. ***** + ******************************************************/ + +/* If mpn_sqr is not defined, use mpn_mul_n instead + (mpn_sqr was called mpn_sqr_n (internal) in older versions of GMP). */ +#ifndef mpn_sqr +# define mpn_sqr(dst,src,n) mpn_mul_n((dst),(src),(src),(n)) +#endif /* invert_limb macro, copied from GMP 5.0.2, file gmp-impl.h. It returns invxl = floor((B^2-1)/xl)-B, where B=2^BITS_PER_LIMB, assuming the most significant bit of xl is set. */ -#undef invert_limb +#ifndef invert_limb +#if defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_INVERT_LIMB) #define invert_limb(invxl,xl) \ do { \ - mp_limb_t dummy; \ - MPFR_ASSERTD ((xl) != 0); \ - udiv_qrnnd (invxl, dummy, ~(xl), ~(mp_limb_t)0, xl); \ + invxl = __gmpn_invert_limb (xl); \ } while (0) - -typedef struct {mp_limb_t inv32;} mpfr_pi1_t; /* We changed gmp_pi1_t into - mpfr_pi1_t to avoid using - GMP's namespace. */ -/* invert_pi1 macro, adapted from GMP 5.0.2, file gmp-impl.h. - It returns dinv = floor((B^3-1)/(d1*B+d0))-B, where B=2^BITS_PER_LIMB, - assuming the most significant bit of d1 is set. */ -#undef invert_pi1 -#define invert_pi1(dinv, d1, d0) \ - do { \ - mp_limb_t _v, _p, _t1, _t0, _mask; \ - invert_limb (_v, d1); \ - _p = d1 * _v; \ - _p += d0; \ - if (_p < d0) \ - { \ - _v--; \ - _mask = -(_p >= d1); \ - _p -= d1; \ - _v += _mask; \ - _p -= _mask & d1; \ - } \ - umul_ppmm (_t1, _t0, d0, _v); \ - _p += _t1; \ - if (_p < _t1) \ - { \ - _v--; \ - if (MPFR_UNLIKELY (_p >= d1)) \ - { \ - if (_p > d1 || _t0 >= d0) \ - _v--; \ - } \ - } \ - (dinv).inv32 = _v; \ +#else +#define invert_limb(invxl,xl) \ + do { \ + mp_limb_t dummy MPFR_MAYBE_UNUSED; \ + MPFR_ASSERTD ((xl) != 0); \ + udiv_qrnnd (invxl, dummy, ~(xl), MPFR_LIMB_MAX, xl); \ } while (0) +#endif /* defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_INVERT_LIMB) */ +#endif /* ifndef invert_limb */ /* udiv_qr_3by2 macro, adapted from GMP 5.0.2, file gmp-impl.h. Compute quotient the quotient and remainder for n / d. Requires d @@ -376,7 +369,7 @@ NOTE: Output variables are updated multiple times. Only some inputs and outputs may overlap. */ -#undef udiv_qr_3by2 +#ifndef udiv_qr_3by2 #define udiv_qr_3by2(q, r1, r0, n2, n1, n0, d1, d0, dinv) \ do { \ mp_limb_t _q0, _t1, _t0, _mask; \ @@ -404,7 +397,245 @@ } \ } \ } while (0) +#endif + +/* invert_pi1 macro adapted from GMP 5 */ +typedef struct {mp_limb_t inv32;} mpfr_pi1_t; +#ifndef invert_pi1 +#define invert_pi1(dinv, d1, d0) \ + do { \ + mp_limb_t _v, _p, _t1, _t0, _mask; \ + invert_limb (_v, d1); \ + _p = (d1) * _v; \ + _p += (d0); \ + if (_p < (d0)) \ + { \ + _v--; \ + _mask = -(mp_limb_t) (_p >= (d1)); \ + _p -= (d1); \ + _v += _mask; \ + _p -= _mask & (d1); \ + } \ + umul_ppmm (_t1, _t0, d0, _v); \ + _p += _t1; \ + if (_p < _t1) \ + { \ + _v--; \ + if (MPFR_UNLIKELY (_p >= (d1))) \ + { \ + if (_p > (d1) || _t0 >= (d0)) \ + _v--; \ + } \ + } \ + (dinv).inv32 = _v; \ + } while (0) +#endif + +/* The following macro is copied from GMP-6.1.1, file gmp-impl.h, + macro udiv_qrnnd_preinv. + It computes q and r such that nh*2^GMP_NUMB_BITS + nl = q*d + r, + with 0 <= r < d, assuming di = __gmpn_invert_limb (d). */ +#define __udiv_qrnnd_preinv(q, r, nh, nl, d, di) \ + do { \ + mp_limb_t _qh, _ql, _r, _mask; \ + umul_ppmm (_qh, _ql, (nh), (di)); \ + if (__builtin_constant_p (nl) && (nl) == 0) \ + { \ + _qh += (nh) + 1; \ + _r = - _qh * (d); \ + _mask = -(mp_limb_t) (_r > _ql); /* both > and >= are OK */ \ + _qh += _mask; \ + _r += _mask & (d); \ + } \ + else \ + { \ + add_ssaaaa (_qh, _ql, _qh, _ql, (nh) + 1, (nl)); \ + _r = (nl) - _qh * (d); \ + _mask = -(mp_limb_t) (_r > _ql); /* both > and >= are OK */ \ + _qh += _mask; \ + _r += _mask & (d); \ + if (MPFR_UNLIKELY (_r >= (d))) \ + { \ + _r -= (d); \ + _qh++; \ + } \ + } \ + (r) = _r; \ + (q) = _qh; \ + } while (0) + +#if GMP_NUMB_BITS == 64 +/* specialized version for nl = 0, with di computed inside */ +#define __udiv_qrnd_preinv(q, r, nh, d) \ + do { \ + mp_limb_t _di; \ + \ + MPFR_ASSERTD ((d) != 0); \ + MPFR_ASSERTD ((nh) < (d)); \ + MPFR_ASSERTD ((d) & MPFR_LIMB_HIGHBIT); \ + \ + __gmpfr_invert_limb (_di, d); \ + __udiv_qrnnd_preinv (q, r, nh, 0, d, _di); \ + } while (0) +#elif defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_INVERT_LIMB) +/* specialized version for nl = 0, with di computed inside */ +#define __udiv_qrnd_preinv(q, r, nh, d) \ + do { \ + mp_limb_t _di; \ + \ + MPFR_ASSERTD ((d) != 0); \ + MPFR_ASSERTD ((nh) < (d)); \ + MPFR_ASSERTD ((d) & MPFR_LIMB_HIGHBIT); \ + \ + _di = __gmpn_invert_limb (d); \ + __udiv_qrnnd_preinv (q, r, nh, 0, d, _di); \ + } while (0) +#else +/* Same as __udiv_qrnnd_c from longlong.h, but using a single UWType/UWtype + division instead of two, and with n0=0. The analysis below assumes a limb + has 64 bits for simplicity. */ +#define __udiv_qrnd_preinv(q, r, n1, d) \ + do { \ + UWtype __d1, __d0, __q1, __q0, __r1, __r0, __i; \ + \ + MPFR_ASSERTD ((d) != 0); \ + MPFR_ASSERTD ((n1) < (d)); \ + MPFR_ASSERTD ((d) & MPFR_LIMB_HIGHBIT); \ + \ + __d1 = __ll_highpart (d); \ + /* 2^31 <= d1 < 2^32 */ \ + __d0 = __ll_lowpart (d); \ + /* 0 <= d0 < 2^32 */ \ + __i = ~(UWtype) 0 / __d1; \ + /* 2^32 < i < 2^33 with i < 2^64/d1 */ \ + \ + __q1 = (((n1) / __ll_B) * __i) / __ll_B; \ + /* Since n1 < d, high(n1) <= d1 = high(d), thus */ \ + /* q1 <= high(n1) * (2^64/d1) / 2^32 <= 2^32 */ \ + /* and also q1 <= n1/d1 thus r1 >= 0 below */ \ + __r1 = (n1) - __q1 * __d1; \ + while (__r1 >= __d1) \ + __q1 ++, __r1 -= __d1; \ + /* by construction, we have n1 = q1*d1+r1, and 0 <= r1 < d1 */ \ + /* thus q1 <= n1/d1 < 2^32+2 */ \ + /* q1*d0 <= (2^32+1)*(2^32-1) <= 2^64-1 thus it fits in a limb. */ \ + __r0 = __r1 * __ll_B; \ + __r1 = __r0 - __q1 * __d0; \ + /* At most two corrections are needed like in __udiv_qrnnd_c. */ \ + if (__r1 > __r0) /* borrow when subtracting q1*d0 */ \ + { \ + __q1--, __r1 += (d); \ + if (__r1 > (d)) /* no carry when adding d */ \ + __q1--, __r1 += (d); \ + } \ + /* We can have r1 < m here, but in this case the true remainder */ \ + /* is 2^64+r1, which is > m (same analysis as below for r0). */ \ + /* Now we have n1*2^32 = q1*d + r1, with 0 <= r1 < d. */ \ + MPFR_ASSERTD(__r1 < (d)); \ + \ + /* The same analysis as above applies, with n1 replaced by r1, */ \ + /* q1 by q0, r1 by r0. */ \ + __q0 = ((__r1 / __ll_B) * __i) / __ll_B; \ + __r0 = __r1 - __q0 * __d1; \ + while (__r0 >= __d1) \ + __q0 ++, __r0 -= __d1; \ + __r1 = __r0 * __ll_B; \ + __r0 = __r1 - __q0 * __d0; \ + /* We know the quotient floor(r1*2^64/d) is q0, q0-1 or q0-2.*/ \ + if (__r0 > __r1) /* borrow when subtracting q0*d0 */ \ + { \ + /* The quotient is either q0-1 or q0-2. */ \ + __q0--, __r0 += (d); \ + if (__r0 > (d)) /* no carry when adding d */ \ + __q0--, __r0 += (d); \ + } \ + /* Now we have n1*2^64 = (q1*2^32+q0)*d + r0, with 0 <= r0 < d. */ \ + MPFR_ASSERTD(__r0 < (d)); \ + \ + (q) = __q1 * __ll_B | __q0; \ + (r) = __r0; \ + } while (0) +#endif + +/****************************************************** + ************* GMP Basic Pointer Types **************** + ******************************************************/ + +typedef mp_limb_t *mpfr_limb_ptr; +typedef const mp_limb_t *mpfr_limb_srcptr; + +/* mpfr_ieee_double_extract structure (copied from GMP 6.1.0, gmp-impl.h, with + ieee_double_extract changed into mpfr_ieee_double_extract, and + _GMP_IEEE_FLOATS changed into _MPFR_IEEE_FLOATS). */ + +/* Define mpfr_ieee_double_extract and _MPFR_IEEE_FLOATS. + + Bit field packing is "implementation defined" according to C99, which + leaves us at the compiler's mercy here. For some systems packing is + defined in the ABI (eg. x86). In any case so far it seems universal that + little endian systems pack from low to high, and big endian from high to + low within the given type. + + Within the fields we rely on the integer endianness being the same as the + float endianness, this is true everywhere we know of and it'd be a fairly + strange system that did anything else. */ + +/* Note for MPFR: building with "gcc -std=c89 -pedantic -pedantic-errors" + fails if the bit-field type is unsigned long: + + error: type of bit-field '...' is a GCC extension [-Wpedantic] + + Though with -std=c99 no errors are obtained, this is still an extension + in C99, which says: + + A bit-field shall have a type that is a qualified or unqualified version + of _Bool, signed int, unsigned int, or some other implementation-defined + type. + + So, unsigned int should be better. This will fail with implementations + having 16-bit int's, but such implementations are not required to + support bit-fields of size > 16 anyway; if ever an implementation with + 16-bit int's is found, the appropriate minimal changes could still be + done in the future. +*/ + +#ifndef _MPFR_IEEE_FLOATS + +#ifdef HAVE_DOUBLE_IEEE_LITTLE_ENDIAN +#define _MPFR_IEEE_FLOATS 1 +union mpfr_ieee_double_extract +{ + struct + { + unsigned int manl:32; + unsigned int manh:20; + unsigned int exp:11; + unsigned int sig:1; + } s; + double d; +}; +#endif + +#ifdef HAVE_DOUBLE_IEEE_BIG_ENDIAN +#define _MPFR_IEEE_FLOATS 1 +union mpfr_ieee_double_extract +{ + struct + { + unsigned int sig:1; + unsigned int exp:11; + unsigned int manh:20; + unsigned int manl:32; + } s; + double d; +}; +#endif + +#endif /* _MPFR_IEEE_FLOATS */ +/****************************************************** + ******************** C++ Compatibility *************** + ******************************************************/ #if defined (__cplusplus) } #endif diff -Nru mpfr4-3.1.4/src/mpfr.h mpfr4-4.0.2/src/mpfr.h --- mpfr4-3.1.4/src/mpfr.h 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/mpfr.h 2019-01-31 20:29:48.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr.h -- Include file for mpfr. -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,39 +17,39 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __MPFR_H #define __MPFR_H /* Define MPFR version number */ -#define MPFR_VERSION_MAJOR 3 -#define MPFR_VERSION_MINOR 1 -#define MPFR_VERSION_PATCHLEVEL 4 -#define MPFR_VERSION_STRING "3.1.4" +#define MPFR_VERSION_MAJOR 4 +#define MPFR_VERSION_MINOR 0 +#define MPFR_VERSION_PATCHLEVEL 2 +#define MPFR_VERSION_STRING "4.0.2" + +/* User macros: + MPFR_USE_FILE: Define it to make MPFR define functions dealing + with FILE* (auto-detect). + MPFR_USE_INTMAX_T: Define it to make MPFR define functions dealing + with intmax_t (auto-detect). + MPFR_USE_VA_LIST: Define it to make MPFR define functions dealing + with va_list (auto-detect). + MPFR_USE_C99_FEATURE: Define it to 1 to make MPFR support C99-feature + (auto-detect), to 0 to bypass the detection. + MPFR_USE_EXTENSION: Define it to make MPFR use GCC extension to + reduce warnings. + MPFR_USE_NO_MACRO: Define it to make MPFR remove any overriding + function macro. +*/ /* Macros dealing with MPFR VERSION */ #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) #define MPFR_VERSION \ MPFR_VERSION_NUM(MPFR_VERSION_MAJOR,MPFR_VERSION_MINOR,MPFR_VERSION_PATCHLEVEL) -/* Check if GMP is included, and try to include it (Works with local GMP) */ -#ifndef __GMP_H__ -# include -#endif - -/* GMP's internal __gmp_const macro has been removed on 2012-03-04: - http://gmplib.org:8000/gmp/rev/d287cfaf6732 - const is standard and now assumed to be available. If the __gmp_const - definition is no longer present in GMP, this probably means that GMP - assumes that const is available; thus let's define it to const. - Note: this is a temporary fix that can be backported to previous MPFR - versions. In the future, __gmp_const should be replaced by const like - in GMP. */ -#ifndef __gmp_const -# define __gmp_const const -#endif +#include /* Avoid some problems with macro expansion if the user defines macros with the same name as keywords. By convention, identifiers and macro @@ -61,6 +61,28 @@ typedef unsigned long mpfr_ulong; typedef size_t mpfr_size_t; +/* Global (possibly TLS) flags. Might also be used in an mpfr_t in the + future (there would be room as mpfr_sign_t just needs 1 byte). + TODO: The tests currently assume that the flags fits in an unsigned int; + this should be cleaned up, e.g. by defining a function that outputs the + flags as a string or by using the flags_out function (from tests/tests.c + directly). */ +typedef unsigned int mpfr_flags_t; + +/* Flags macros (in the public API) */ +#define MPFR_FLAGS_UNDERFLOW 1 +#define MPFR_FLAGS_OVERFLOW 2 +#define MPFR_FLAGS_NAN 4 +#define MPFR_FLAGS_INEXACT 8 +#define MPFR_FLAGS_ERANGE 16 +#define MPFR_FLAGS_DIVBY0 32 +#define MPFR_FLAGS_ALL (MPFR_FLAGS_UNDERFLOW | \ + MPFR_FLAGS_OVERFLOW | \ + MPFR_FLAGS_NAN | \ + MPFR_FLAGS_INEXACT | \ + MPFR_FLAGS_ERANGE | \ + MPFR_FLAGS_DIVBY0) + /* Definition of rounding modes (DON'T USE MPFR_RNDNA!). Warning! Changing the contents of this enum should be seen as an interface change since the old and the new types are not compatible @@ -70,9 +92,6 @@ MPFR_RNDU must appear just before MPFR_RNDD (see MPFR_IS_RNDUTEST_OR_RNDDNOTTEST in mpfr-impl.h). - MPFR_RNDF has been added, though not implemented yet, in order to avoid - to break the ABI once faithful rounding gets implemented. - If you change the order of the rounding modes, please update the routines in texceptions.c which assume 0=RNDN, 1=RNDZ, 2=RNDU, 3=RNDD, 4=RNDA. */ @@ -82,7 +101,7 @@ MPFR_RNDU, /* round toward +Inf */ MPFR_RNDD, /* round toward -Inf */ MPFR_RNDA, /* round away from zero */ - MPFR_RNDF, /* faithful rounding (not implemented yet) */ + MPFR_RNDF, /* faithful rounding */ MPFR_RNDNA=-1 /* round to nearest, with ties away from zero (mpfr_round) */ } mpfr_rnd_t; @@ -98,7 +117,7 @@ /* Define precision: 1 (short), 2 (int) or 3 (long) (DON'T USE IT!) */ #ifndef _MPFR_PREC_FORMAT -# if __GMP_MP_SIZE_T_INT == 1 +# if __GMP_MP_SIZE_T_INT # define _MPFR_PREC_FORMAT 2 # else # define _MPFR_PREC_FORMAT 3 @@ -132,10 +151,13 @@ #endif /* Definition of precision limits without needing */ -/* Note: the casts allows the expression to yield the wanted behavior - for _MPFR_PREC_FORMAT == 1 (due to integer promotion rules). */ -#define MPFR_PREC_MIN 2 -#define MPFR_PREC_MAX ((mpfr_prec_t)((mpfr_uprec_t)(~(mpfr_uprec_t)0)>>1)) +/* Note: The casts allows the expression to yield the wanted behavior + for _MPFR_PREC_FORMAT == 1 (due to integer promotion rules). We + also make sure that MPFR_PREC_MIN and MPFR_PREC_MAX have a signed + integer type. The "- 256" allows more security, avoiding some + integer overflows in extreme cases; ideally it should be useless. */ +#define MPFR_PREC_MIN 1 +#define MPFR_PREC_MAX ((mpfr_prec_t) ((((mpfr_uprec_t) -1) >> 1) - 256)) /* Definition of sign */ typedef int mpfr_sign_t; @@ -167,7 +189,11 @@ /* DON'T USE THIS! (For MPFR-public macros only, see below.) The mpfr_sgn macro uses the fact that __MPFR_EXP_NAN and __MPFR_EXP_ZERO - are the smallest values. */ + are the smallest values. For a n-bit type, EXP_MAX is 2^(n-1)-1, + EXP_ZERO is 1-2^(n-1), EXP_NAN is 2-2^(n-1), EXP_INF is 3-2^(n-1). + This may change in the future. MPFR code should not be based on these + representations (but if this is absolutely needed, protect the code + with a static assertion). */ #define __MPFR_EXP_MAX ((mpfr_exp_t) (((mpfr_uexp_t) -1) >> 1)) #define __MPFR_EXP_NAN (1 - __MPFR_EXP_MAX) #define __MPFR_EXP_ZERO (0 - __MPFR_EXP_MAX) @@ -202,7 +228,7 @@ typedef __mpfr_struct mpfr_t[1]; typedef __mpfr_struct *mpfr_ptr; -typedef __gmp_const __mpfr_struct *mpfr_srcptr; +typedef const __mpfr_struct *mpfr_srcptr; /* For those who need a direct and fast access to the sign field. However it is not in the API, thus use it at your own risk: it might @@ -214,16 +240,22 @@ /* Stack interface */ typedef enum { - MPFR_NAN_KIND = 0, - MPFR_INF_KIND = 1, MPFR_ZERO_KIND = 2, MPFR_REGULAR_KIND = 3 + MPFR_NAN_KIND = 0, + MPFR_INF_KIND = 1, + MPFR_ZERO_KIND = 2, + MPFR_REGULAR_KIND = 3 } mpfr_kind_t; +/* Free cache policy */ +typedef enum { + MPFR_FREE_LOCAL_CACHE = 1, /* 1 << 0 */ + MPFR_FREE_GLOBAL_CACHE = 2 /* 1 << 1 */ +} mpfr_free_cache_t; + /* GMP defines: + size_t: Standard size_t - + __GMP_ATTRIBUTE_PURE Attribute for math functions. + __GMP_NOTHROW For C++: can't throw . + __GMP_EXTERN_INLINE Attribute for inline function. - * __gmp_const const (Supports for K&R compiler only for mpfr.h). + __GMP_DECLSPEC_EXPORT compiling to go into a DLL + __GMP_DECLSPEC_IMPORT compiling to go into a application */ @@ -236,25 +268,59 @@ # endif #endif -/* Prototypes: Support of K&R compiler */ -#if defined (__GMP_PROTO) -# define _MPFR_PROTO __GMP_PROTO -#elif defined (__STDC__) || defined (__cplusplus) -# define _MPFR_PROTO(x) x -#else -# define _MPFR_PROTO(x) () +/* If the user hasn't requested his/her preference + and if the intension of support by the compiler is C99 + and if the compiler is known to support the C99 feature + then we can auto-detect the C99 support as OK. + __GNUC__ is used to detect GNU-C, ICC & CLANG compilers. + Currently we need only variadic macros, and they are present + since GCC >= 3. We don't test library version since we don't + use any feature present in the library too (except intmax_t, + but they use another detection).*/ +#ifndef MPFR_USE_C99_FEATURE +# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +# if defined (__GNUC__) +# if __GNUC__ >= 3 +# define MPFR_USE_C99_FEATURE 1 +# endif +# endif +# endif +# ifndef MPFR_USE_C99_FEATURE +# define MPFR_USE_C99_FEATURE 0 +# endif #endif + /* Support for WINDOWS Dll: Check if we are inside a MPFR build, and if so export the functions. Otherwise does the same thing as GMP */ #if defined(__MPFR_WITHIN_MPFR) && __GMP_LIBGMP_DLL # define __MPFR_DECLSPEC __GMP_DECLSPEC_EXPORT #else +# ifndef __GMP_DECLSPEC +# define __GMP_DECLSPEC +# endif # define __MPFR_DECLSPEC __GMP_DECLSPEC #endif /* Use MPFR_DEPRECATED to mark MPFR functions, types or variables as - deprecated. Code inspired by Apache Subversion's svn_types.h file. */ + deprecated. Code inspired by Apache Subversion's svn_types.h file. + For compatibility with MSVC, MPFR_DEPRECATED must be put before + __MPFR_DECLSPEC (not at the end of the function declaration as + documented in the GCC manual); GCC does not seem to care. + Moreover, in order to avoid a warning when testing such functions, + do something like: + +------------------------------------------ + |#ifndef _MPFR_NO_DEPRECATED_funcname + |MPFR_DEPRECATED + |#endif + |__MPFR_DECLSPEC int mpfr_funcname (...); + +------------------------------------------ + and in the corresponding test program: + +------------------------------------------ + |#define _MPFR_NO_DEPRECATED_funcname + |#include "mpfr-test.h" + +------------------------------------------ +*/ #if defined(__GNUC__) && \ (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) # define MPFR_DEPRECATED __attribute__ ((deprecated)) @@ -263,6 +329,11 @@ #else # define MPFR_DEPRECATED #endif +/* TODO: Also define MPFR_EXPERIMENTAL for experimental functions? + See SVN_EXPERIMENTAL in Subversion 1.9+ as an example: + __attribute__((warning("..."))) can be used with GCC 4.3.1+ but + not __llvm__, and __declspec(deprecated("...")) can be used with + MSC as above. */ /* Note: In order to be declared, some functions need a specific system header to be included *before* "mpfr.h". If the user @@ -276,451 +347,415 @@ extern "C" { #endif -__MPFR_DECLSPEC __gmp_const char * mpfr_get_version _MPFR_PROTO ((void)); -__MPFR_DECLSPEC __gmp_const char * mpfr_get_patches _MPFR_PROTO ((void)); -__MPFR_DECLSPEC int mpfr_buildopt_tls_p _MPFR_PROTO ((void)); -__MPFR_DECLSPEC int mpfr_buildopt_decimal_p _MPFR_PROTO ((void)); -__MPFR_DECLSPEC int mpfr_buildopt_gmpinternals_p _MPFR_PROTO ((void)); -__MPFR_DECLSPEC __gmp_const char * mpfr_buildopt_tune_case _MPFR_PROTO ((void)); - -__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin _MPFR_PROTO ((void)); -__MPFR_DECLSPEC int mpfr_set_emin _MPFR_PROTO ((mpfr_exp_t)); -__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_min _MPFR_PROTO ((void)); -__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_max _MPFR_PROTO ((void)); -__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax _MPFR_PROTO ((void)); -__MPFR_DECLSPEC int mpfr_set_emax _MPFR_PROTO ((mpfr_exp_t)); -__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_min _MPFR_PROTO ((void)); -__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_max _MPFR_PROTO ((void)); - -__MPFR_DECLSPEC void mpfr_set_default_rounding_mode _MPFR_PROTO((mpfr_rnd_t)); -__MPFR_DECLSPEC mpfr_rnd_t mpfr_get_default_rounding_mode _MPFR_PROTO((void)); -__MPFR_DECLSPEC __gmp_const char * - mpfr_print_rnd_mode _MPFR_PROTO((mpfr_rnd_t)); - -__MPFR_DECLSPEC void mpfr_clear_flags _MPFR_PROTO ((void)); -__MPFR_DECLSPEC void mpfr_clear_underflow _MPFR_PROTO ((void)); -__MPFR_DECLSPEC void mpfr_clear_overflow _MPFR_PROTO ((void)); -__MPFR_DECLSPEC void mpfr_clear_divby0 _MPFR_PROTO ((void)); -__MPFR_DECLSPEC void mpfr_clear_nanflag _MPFR_PROTO ((void)); -__MPFR_DECLSPEC void mpfr_clear_inexflag _MPFR_PROTO ((void)); -__MPFR_DECLSPEC void mpfr_clear_erangeflag _MPFR_PROTO ((void)); - -__MPFR_DECLSPEC void mpfr_set_underflow _MPFR_PROTO ((void)); -__MPFR_DECLSPEC void mpfr_set_overflow _MPFR_PROTO ((void)); -__MPFR_DECLSPEC void mpfr_set_divby0 _MPFR_PROTO ((void)); -__MPFR_DECLSPEC void mpfr_set_nanflag _MPFR_PROTO ((void)); -__MPFR_DECLSPEC void mpfr_set_inexflag _MPFR_PROTO ((void)); -__MPFR_DECLSPEC void mpfr_set_erangeflag _MPFR_PROTO ((void)); - -__MPFR_DECLSPEC int mpfr_underflow_p _MPFR_PROTO ((void)); -__MPFR_DECLSPEC int mpfr_overflow_p _MPFR_PROTO ((void)); -__MPFR_DECLSPEC int mpfr_divby0_p _MPFR_PROTO ((void)); -__MPFR_DECLSPEC int mpfr_nanflag_p _MPFR_PROTO ((void)); -__MPFR_DECLSPEC int mpfr_inexflag_p _MPFR_PROTO ((void)); -__MPFR_DECLSPEC int mpfr_erangeflag_p _MPFR_PROTO ((void)); - -__MPFR_DECLSPEC int - mpfr_check_range _MPFR_PROTO ((mpfr_ptr, int, mpfr_rnd_t)); - -__MPFR_DECLSPEC void mpfr_init2 _MPFR_PROTO ((mpfr_ptr, mpfr_prec_t)); -__MPFR_DECLSPEC void mpfr_init _MPFR_PROTO ((mpfr_ptr)); -__MPFR_DECLSPEC void mpfr_clear _MPFR_PROTO ((mpfr_ptr)); +__MPFR_DECLSPEC const char * mpfr_get_version (void); +__MPFR_DECLSPEC const char * mpfr_get_patches (void); +__MPFR_DECLSPEC int mpfr_buildopt_tls_p (void); +__MPFR_DECLSPEC int mpfr_buildopt_float128_p (void); +__MPFR_DECLSPEC int mpfr_buildopt_decimal_p (void); +__MPFR_DECLSPEC int mpfr_buildopt_gmpinternals_p (void); +__MPFR_DECLSPEC int mpfr_buildopt_sharedcache_p (void); +__MPFR_DECLSPEC const char * mpfr_buildopt_tune_case (void); + +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin (void); +__MPFR_DECLSPEC int mpfr_set_emin (mpfr_exp_t); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_min (void); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_max (void); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax (void); +__MPFR_DECLSPEC int mpfr_set_emax (mpfr_exp_t); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_min (void); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_max (void); + +__MPFR_DECLSPEC void mpfr_set_default_rounding_mode (mpfr_rnd_t); +__MPFR_DECLSPEC mpfr_rnd_t mpfr_get_default_rounding_mode (void); +__MPFR_DECLSPEC const char * mpfr_print_rnd_mode (mpfr_rnd_t); + +__MPFR_DECLSPEC void mpfr_clear_flags (void); +__MPFR_DECLSPEC void mpfr_clear_underflow (void); +__MPFR_DECLSPEC void mpfr_clear_overflow (void); +__MPFR_DECLSPEC void mpfr_clear_divby0 (void); +__MPFR_DECLSPEC void mpfr_clear_nanflag (void); +__MPFR_DECLSPEC void mpfr_clear_inexflag (void); +__MPFR_DECLSPEC void mpfr_clear_erangeflag (void); + +__MPFR_DECLSPEC void mpfr_set_underflow (void); +__MPFR_DECLSPEC void mpfr_set_overflow (void); +__MPFR_DECLSPEC void mpfr_set_divby0 (void); +__MPFR_DECLSPEC void mpfr_set_nanflag (void); +__MPFR_DECLSPEC void mpfr_set_inexflag (void); +__MPFR_DECLSPEC void mpfr_set_erangeflag (void); + +__MPFR_DECLSPEC int mpfr_underflow_p (void); +__MPFR_DECLSPEC int mpfr_overflow_p (void); +__MPFR_DECLSPEC int mpfr_divby0_p (void); +__MPFR_DECLSPEC int mpfr_nanflag_p (void); +__MPFR_DECLSPEC int mpfr_inexflag_p (void); +__MPFR_DECLSPEC int mpfr_erangeflag_p (void); + +__MPFR_DECLSPEC void mpfr_flags_clear (mpfr_flags_t); +__MPFR_DECLSPEC void mpfr_flags_set (mpfr_flags_t); +__MPFR_DECLSPEC mpfr_flags_t mpfr_flags_test (mpfr_flags_t); +__MPFR_DECLSPEC mpfr_flags_t mpfr_flags_save (void); +__MPFR_DECLSPEC void mpfr_flags_restore (mpfr_flags_t, + mpfr_flags_t); + +__MPFR_DECLSPEC int mpfr_check_range (mpfr_ptr, int, mpfr_rnd_t); + +__MPFR_DECLSPEC void mpfr_init2 (mpfr_ptr, mpfr_prec_t); +__MPFR_DECLSPEC void mpfr_init (mpfr_ptr); +__MPFR_DECLSPEC void mpfr_clear (mpfr_ptr); __MPFR_DECLSPEC void - mpfr_inits2 _MPFR_PROTO ((mpfr_prec_t, mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR; + mpfr_inits2 (mpfr_prec_t, mpfr_ptr, ...) __MPFR_SENTINEL_ATTR; __MPFR_DECLSPEC void - mpfr_inits _MPFR_PROTO ((mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR; + mpfr_inits (mpfr_ptr, ...) __MPFR_SENTINEL_ATTR; __MPFR_DECLSPEC void - mpfr_clears _MPFR_PROTO ((mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR; + mpfr_clears (mpfr_ptr, ...) __MPFR_SENTINEL_ATTR; -__MPFR_DECLSPEC int - mpfr_prec_round _MPFR_PROTO ((mpfr_ptr, mpfr_prec_t, mpfr_rnd_t)); -__MPFR_DECLSPEC int - mpfr_can_round _MPFR_PROTO ((mpfr_srcptr, mpfr_exp_t, mpfr_rnd_t, mpfr_rnd_t, - mpfr_prec_t)); -__MPFR_DECLSPEC mpfr_prec_t mpfr_min_prec _MPFR_PROTO ((mpfr_srcptr)); - -__MPFR_DECLSPEC mpfr_exp_t mpfr_get_exp _MPFR_PROTO ((mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_set_exp _MPFR_PROTO ((mpfr_ptr, mpfr_exp_t)); -__MPFR_DECLSPEC mpfr_prec_t mpfr_get_prec _MPFR_PROTO((mpfr_srcptr)); -__MPFR_DECLSPEC void mpfr_set_prec _MPFR_PROTO((mpfr_ptr, mpfr_prec_t)); -__MPFR_DECLSPEC void mpfr_set_prec_raw _MPFR_PROTO((mpfr_ptr, mpfr_prec_t)); -__MPFR_DECLSPEC void mpfr_set_default_prec _MPFR_PROTO((mpfr_prec_t)); -__MPFR_DECLSPEC mpfr_prec_t mpfr_get_default_prec _MPFR_PROTO((void)); +__MPFR_DECLSPEC int mpfr_prec_round (mpfr_ptr, mpfr_prec_t, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_can_round (mpfr_srcptr, mpfr_exp_t, mpfr_rnd_t, + mpfr_rnd_t, mpfr_prec_t); +__MPFR_DECLSPEC mpfr_prec_t mpfr_min_prec (mpfr_srcptr); + +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_exp (mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_set_exp (mpfr_ptr, mpfr_exp_t); +__MPFR_DECLSPEC mpfr_prec_t mpfr_get_prec (mpfr_srcptr); +__MPFR_DECLSPEC void mpfr_set_prec (mpfr_ptr, mpfr_prec_t); +__MPFR_DECLSPEC void mpfr_set_prec_raw (mpfr_ptr, mpfr_prec_t); +__MPFR_DECLSPEC void mpfr_set_default_prec (mpfr_prec_t); +__MPFR_DECLSPEC mpfr_prec_t mpfr_get_default_prec (void); -__MPFR_DECLSPEC int mpfr_set_d _MPFR_PROTO ((mpfr_ptr, double, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_set_flt _MPFR_PROTO ((mpfr_ptr, float, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_set_d (mpfr_ptr, double, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_set_flt (mpfr_ptr, float, mpfr_rnd_t); #ifdef MPFR_WANT_DECIMAL_FLOATS -__MPFR_DECLSPEC int mpfr_set_decimal64 _MPFR_PROTO ((mpfr_ptr, _Decimal64, - mpfr_rnd_t)); -#endif -__MPFR_DECLSPEC int - mpfr_set_ld _MPFR_PROTO ((mpfr_ptr, long double, mpfr_rnd_t)); -__MPFR_DECLSPEC int - mpfr_set_z _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int - mpfr_set_z_2exp _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, mpfr_exp_t, mpfr_rnd_t)); -__MPFR_DECLSPEC void mpfr_set_nan _MPFR_PROTO ((mpfr_ptr)); -__MPFR_DECLSPEC void mpfr_set_inf _MPFR_PROTO ((mpfr_ptr, int)); -__MPFR_DECLSPEC void mpfr_set_zero _MPFR_PROTO ((mpfr_ptr, int)); -__MPFR_DECLSPEC int - mpfr_set_f _MPFR_PROTO ((mpfr_ptr, mpf_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int - mpfr_get_f _MPFR_PROTO ((mpf_ptr, mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_set_si _MPFR_PROTO ((mpfr_ptr, long, mpfr_rnd_t)); -__MPFR_DECLSPEC int - mpfr_set_ui _MPFR_PROTO ((mpfr_ptr, unsigned long, mpfr_rnd_t)); -__MPFR_DECLSPEC int - mpfr_set_si_2exp _MPFR_PROTO ((mpfr_ptr, long, mpfr_exp_t, mpfr_rnd_t)); -__MPFR_DECLSPEC int - mpfr_set_ui_2exp _MPFR_PROTO ((mpfr_ptr,unsigned long,mpfr_exp_t,mpfr_rnd_t)); -__MPFR_DECLSPEC int - mpfr_set_q _MPFR_PROTO ((mpfr_ptr, mpq_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int - mpfr_set_str _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, int, mpfr_rnd_t)); -__MPFR_DECLSPEC int - mpfr_init_set_str _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, int, - mpfr_rnd_t)); -__MPFR_DECLSPEC int - mpfr_set4 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t, int)); -__MPFR_DECLSPEC int - mpfr_abs _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int - mpfr_set _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_neg _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_signbit _MPFR_PROTO ((mpfr_srcptr)); -__MPFR_DECLSPEC int - mpfr_setsign _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, int, mpfr_rnd_t)); -__MPFR_DECLSPEC int - mpfr_copysign _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t)); - -__MPFR_DECLSPEC mpfr_exp_t mpfr_get_z_2exp _MPFR_PROTO ((mpz_ptr, mpfr_srcptr)); -__MPFR_DECLSPEC float mpfr_get_flt _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC double mpfr_get_d _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t)); +/* _Decimal64 is not defined in C++, + cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51364 */ +__MPFR_DECLSPEC int mpfr_set_decimal64 (mpfr_ptr, _Decimal64, mpfr_rnd_t); +#endif +__MPFR_DECLSPEC int mpfr_set_ld (mpfr_ptr, long double, mpfr_rnd_t); +#ifdef MPFR_WANT_FLOAT128 +__MPFR_DECLSPEC int mpfr_set_float128 (mpfr_ptr, __float128, mpfr_rnd_t); +__MPFR_DECLSPEC __float128 mpfr_get_float128 (mpfr_srcptr, mpfr_rnd_t); +#endif +__MPFR_DECLSPEC int mpfr_set_z (mpfr_ptr, mpz_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_set_z_2exp (mpfr_ptr, mpz_srcptr, mpfr_exp_t, + mpfr_rnd_t); +__MPFR_DECLSPEC void mpfr_set_nan (mpfr_ptr); +__MPFR_DECLSPEC void mpfr_set_inf (mpfr_ptr, int); +__MPFR_DECLSPEC void mpfr_set_zero (mpfr_ptr, int); + +#ifndef MPFR_USE_MINI_GMP + /* mini-gmp does not provide mpf_t, we disable the following functions */ +__MPFR_DECLSPEC int mpfr_set_f (mpfr_ptr, mpf_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_cmp_f (mpfr_srcptr, mpf_srcptr); +__MPFR_DECLSPEC int mpfr_get_f (mpf_ptr, mpfr_srcptr, mpfr_rnd_t); +#endif +__MPFR_DECLSPEC int mpfr_set_si (mpfr_ptr, long, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_set_ui (mpfr_ptr, unsigned long, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_set_si_2exp (mpfr_ptr, long, mpfr_exp_t, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_set_ui_2exp (mpfr_ptr, unsigned long, mpfr_exp_t, + mpfr_rnd_t); +#ifndef MPFR_USE_MINI_GMP + /* mini-gmp does not provide mpq_t, we disable the following functions */ +__MPFR_DECLSPEC int mpfr_set_q (mpfr_ptr, mpq_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_mul_q (mpfr_ptr, mpfr_srcptr, mpq_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_div_q (mpfr_ptr, mpfr_srcptr, mpq_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_add_q (mpfr_ptr, mpfr_srcptr, mpq_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_sub_q (mpfr_ptr, mpfr_srcptr, mpq_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_cmp_q (mpfr_srcptr, mpq_srcptr); +__MPFR_DECLSPEC void mpfr_get_q (mpq_ptr q, mpfr_srcptr f); +#endif +__MPFR_DECLSPEC int mpfr_set_str (mpfr_ptr, const char *, int, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_init_set_str (mpfr_ptr, const char *, int, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_set4 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t, int); +__MPFR_DECLSPEC int mpfr_abs (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_set (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_neg (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_signbit (mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_setsign (mpfr_ptr, mpfr_srcptr, int, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_copysign (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, + mpfr_rnd_t); + +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_z_2exp (mpz_ptr, mpfr_srcptr); +__MPFR_DECLSPEC float mpfr_get_flt (mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC double mpfr_get_d (mpfr_srcptr, mpfr_rnd_t); #ifdef MPFR_WANT_DECIMAL_FLOATS -__MPFR_DECLSPEC _Decimal64 mpfr_get_decimal64 _MPFR_PROTO ((mpfr_srcptr, - mpfr_rnd_t)); +__MPFR_DECLSPEC _Decimal64 mpfr_get_decimal64 (mpfr_srcptr, mpfr_rnd_t); #endif -__MPFR_DECLSPEC long double mpfr_get_ld _MPFR_PROTO ((mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC double mpfr_get_d1 _MPFR_PROTO ((mpfr_srcptr)); -__MPFR_DECLSPEC double mpfr_get_d_2exp _MPFR_PROTO ((long*, mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC long double mpfr_get_ld_2exp _MPFR_PROTO ((long*, mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_frexp _MPFR_PROTO ((mpfr_exp_t*, mpfr_ptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC long mpfr_get_si _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC unsigned long mpfr_get_ui _MPFR_PROTO ((mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC char*mpfr_get_str _MPFR_PROTO ((char*, mpfr_exp_t*, int, size_t, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_get_z _MPFR_PROTO ((mpz_ptr z, mpfr_srcptr f, - mpfr_rnd_t)); - -__MPFR_DECLSPEC void mpfr_free_str _MPFR_PROTO ((char *)); - -__MPFR_DECLSPEC int mpfr_urandom _MPFR_PROTO ((mpfr_ptr, gmp_randstate_t, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_grandom _MPFR_PROTO ((mpfr_ptr, mpfr_ptr, gmp_randstate_t, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_urandomb _MPFR_PROTO ((mpfr_ptr, gmp_randstate_t)); - -__MPFR_DECLSPEC void mpfr_nextabove _MPFR_PROTO ((mpfr_ptr)); -__MPFR_DECLSPEC void mpfr_nextbelow _MPFR_PROTO ((mpfr_ptr)); -__MPFR_DECLSPEC void mpfr_nexttoward _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr)); - -__MPFR_DECLSPEC int mpfr_printf _MPFR_PROTO ((__gmp_const char*, ...)); -__MPFR_DECLSPEC int mpfr_asprintf _MPFR_PROTO ((char**, __gmp_const char*, - ...)); -__MPFR_DECLSPEC int mpfr_sprintf _MPFR_PROTO ((char*, __gmp_const char*, - ...)); -__MPFR_DECLSPEC int mpfr_snprintf _MPFR_PROTO ((char*, size_t, - __gmp_const char*, ...)); - -__MPFR_DECLSPEC int mpfr_pow _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_pow_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - long int, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_pow_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - unsigned long int, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_ui_pow_ui _MPFR_PROTO ((mpfr_ptr, unsigned long int, - unsigned long int, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_ui_pow _MPFR_PROTO ((mpfr_ptr, unsigned long int, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_pow_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpz_srcptr, mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_sqrt _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_sqrt_ui _MPFR_PROTO ((mpfr_ptr, unsigned long, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_rec_sqrt _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_add _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_sub _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_mul _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_div _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_add_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - unsigned long, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_sub_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - unsigned long, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_ui_sub _MPFR_PROTO ((mpfr_ptr, unsigned long, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_mul_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - unsigned long, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_div_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - unsigned long, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_ui_div _MPFR_PROTO ((mpfr_ptr, unsigned long, - mpfr_srcptr, mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_add_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - long int, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_sub_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - long int, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_si_sub _MPFR_PROTO ((mpfr_ptr, long int, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_mul_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - long int, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_div_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - long int, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_si_div _MPFR_PROTO ((mpfr_ptr, long int, - mpfr_srcptr, mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_add_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - double, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_sub_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - double, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_d_sub _MPFR_PROTO ((mpfr_ptr, double, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_mul_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - double, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_div_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - double, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_d_div _MPFR_PROTO ((mpfr_ptr, double, - mpfr_srcptr, mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_sqr _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_const_pi _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_const_log2 _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_const_euler _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_const_catalan _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_agm _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, - mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_log _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_log2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_log10 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_log1p _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_exp2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_exp10 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_expm1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_eint _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_li2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_cmp _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_cmp3 _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr, int)); -__MPFR_DECLSPEC int mpfr_cmp_d _MPFR_PROTO ((mpfr_srcptr, double)); -__MPFR_DECLSPEC int mpfr_cmp_ld _MPFR_PROTO ((mpfr_srcptr, long double)); -__MPFR_DECLSPEC int mpfr_cmpabs _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_cmp_ui _MPFR_PROTO ((mpfr_srcptr, unsigned long)); -__MPFR_DECLSPEC int mpfr_cmp_si _MPFR_PROTO ((mpfr_srcptr, long)); -__MPFR_DECLSPEC int mpfr_cmp_ui_2exp _MPFR_PROTO ((mpfr_srcptr, unsigned long, - mpfr_exp_t)); -__MPFR_DECLSPEC int mpfr_cmp_si_2exp _MPFR_PROTO ((mpfr_srcptr, long, - mpfr_exp_t)); -__MPFR_DECLSPEC void mpfr_reldiff _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_eq _MPFR_PROTO((mpfr_srcptr, mpfr_srcptr, - unsigned long)); -__MPFR_DECLSPEC int mpfr_sgn _MPFR_PROTO ((mpfr_srcptr)); - -__MPFR_DECLSPEC int mpfr_mul_2exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - unsigned long, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_div_2exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - unsigned long, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_mul_2ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - unsigned long, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_div_2ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - unsigned long, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_mul_2si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - long, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_div_2si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - long, mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_rint _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_round _MPFR_PROTO((mpfr_ptr, mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_trunc _MPFR_PROTO((mpfr_ptr, mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_ceil _MPFR_PROTO((mpfr_ptr, mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_floor _MPFR_PROTO((mpfr_ptr, mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_rint_round _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_rint_trunc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_rint_ceil _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_rint_floor _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_frac _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_modf _MPFR_PROTO ((mpfr_ptr, mpfr_ptr, mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_remquo _MPFR_PROTO ((mpfr_ptr, long*, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_remainder _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_fmod _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_fits_ulong_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_fits_slong_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_fits_uint_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_fits_sint_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_fits_ushort_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_fits_sshort_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_fits_uintmax_p _MPFR_PROTO((mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_fits_intmax_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t)); - -__MPFR_DECLSPEC void mpfr_extract _MPFR_PROTO ((mpz_ptr, mpfr_srcptr, - unsigned int)); -__MPFR_DECLSPEC void mpfr_swap _MPFR_PROTO ((mpfr_ptr, mpfr_ptr)); -__MPFR_DECLSPEC void mpfr_dump _MPFR_PROTO ((mpfr_srcptr)); - -__MPFR_DECLSPEC int mpfr_nan_p _MPFR_PROTO((mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_inf_p _MPFR_PROTO((mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_number_p _MPFR_PROTO((mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_integer_p _MPFR_PROTO ((mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_zero_p _MPFR_PROTO ((mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_regular_p _MPFR_PROTO ((mpfr_srcptr)); - -__MPFR_DECLSPEC int mpfr_greater_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_greaterequal_p _MPFR_PROTO ((mpfr_srcptr, - mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_less_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_lessequal_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_lessgreater_p _MPFR_PROTO((mpfr_srcptr,mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_equal_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr)); -__MPFR_DECLSPEC int mpfr_unordered_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr)); - -__MPFR_DECLSPEC int mpfr_atanh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_acosh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_asinh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_cosh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_sinh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_tanh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_sinh_cosh _MPFR_PROTO ((mpfr_ptr, mpfr_ptr, - mpfr_srcptr, mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_sech _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_csch _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_coth _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_acos _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_asin _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_atan _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_sin _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_sin_cos _MPFR_PROTO ((mpfr_ptr, mpfr_ptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_cos _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_tan _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_atan2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_sec _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_csc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_cot _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_hypot _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_erf _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_erfc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_cbrt _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_root _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,unsigned long,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_gamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_lngamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_lgamma _MPFR_PROTO((mpfr_ptr,int*,mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_digamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_zeta _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_zeta_ui _MPFR_PROTO ((mpfr_ptr,unsigned long,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_fac_ui _MPFR_PROTO ((mpfr_ptr, unsigned long int, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_j0 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_j1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_jn _MPFR_PROTO ((mpfr_ptr, long, mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_y0 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_y1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_yn _MPFR_PROTO ((mpfr_ptr, long, mpfr_srcptr, - mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_ai _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_min _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_max _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, - mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_dim _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, - mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_mul_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpz_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_div_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpz_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_add_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpz_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_sub_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpz_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_z_sub _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_cmp_z _MPFR_PROTO ((mpfr_srcptr, mpz_srcptr)); - -__MPFR_DECLSPEC int mpfr_mul_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpq_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_div_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpq_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_add_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpq_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_sub_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpq_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_cmp_q _MPFR_PROTO ((mpfr_srcptr, mpq_srcptr)); - -__MPFR_DECLSPEC int mpfr_cmp_f _MPFR_PROTO ((mpfr_srcptr, mpf_srcptr)); - -__MPFR_DECLSPEC int mpfr_fma _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_fms _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_sum _MPFR_PROTO ((mpfr_ptr, mpfr_ptr *__gmp_const, - unsigned long, mpfr_rnd_t)); - -__MPFR_DECLSPEC void mpfr_free_cache _MPFR_PROTO ((void)); - -__MPFR_DECLSPEC int mpfr_subnormalize _MPFR_PROTO ((mpfr_ptr, int, - mpfr_rnd_t)); - -__MPFR_DECLSPEC int mpfr_strtofr _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, - char **, int, mpfr_rnd_t)); - -__MPFR_DECLSPEC size_t mpfr_custom_get_size _MPFR_PROTO ((mpfr_prec_t)); -__MPFR_DECLSPEC void mpfr_custom_init _MPFR_PROTO ((void *, mpfr_prec_t)); -__MPFR_DECLSPEC void * mpfr_custom_get_significand _MPFR_PROTO ((mpfr_srcptr)); -__MPFR_DECLSPEC mpfr_exp_t mpfr_custom_get_exp _MPFR_PROTO ((mpfr_srcptr)); -__MPFR_DECLSPEC void mpfr_custom_move _MPFR_PROTO ((mpfr_ptr, void *)); -__MPFR_DECLSPEC void mpfr_custom_init_set _MPFR_PROTO ((mpfr_ptr, int, - mpfr_exp_t, mpfr_prec_t, void *)); -__MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr)); +__MPFR_DECLSPEC long double mpfr_get_ld (mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC double mpfr_get_d1 (mpfr_srcptr); +__MPFR_DECLSPEC double mpfr_get_d_2exp (long*, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC long double mpfr_get_ld_2exp (long*, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_frexp (mpfr_exp_t*, mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC long mpfr_get_si (mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC unsigned long mpfr_get_ui (mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC char * mpfr_get_str (char*, mpfr_exp_t*, int, size_t, + mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_get_z (mpz_ptr z, mpfr_srcptr f, mpfr_rnd_t); + +__MPFR_DECLSPEC void mpfr_free_str (char *); + +__MPFR_DECLSPEC int mpfr_urandom (mpfr_ptr, gmp_randstate_t, mpfr_rnd_t); +#ifndef _MPFR_NO_DEPRECATED_GRANDOM /* for the test of this function */ +MPFR_DEPRECATED +#endif +__MPFR_DECLSPEC int mpfr_grandom (mpfr_ptr, mpfr_ptr, gmp_randstate_t, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_nrandom (mpfr_ptr, gmp_randstate_t, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_erandom (mpfr_ptr, gmp_randstate_t, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_urandomb (mpfr_ptr, gmp_randstate_t); + +__MPFR_DECLSPEC void mpfr_nextabove (mpfr_ptr); +__MPFR_DECLSPEC void mpfr_nextbelow (mpfr_ptr); +__MPFR_DECLSPEC void mpfr_nexttoward (mpfr_ptr, mpfr_srcptr); + +#ifndef MPFR_USE_MINI_GMP +__MPFR_DECLSPEC int mpfr_printf (const char*, ...); +__MPFR_DECLSPEC int mpfr_asprintf (char**, const char*, ...); +__MPFR_DECLSPEC int mpfr_sprintf (char*, const char*, ...); +__MPFR_DECLSPEC int mpfr_snprintf (char*, size_t, const char*, ...); +#endif + +__MPFR_DECLSPEC int mpfr_pow (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_pow_si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_pow_ui (mpfr_ptr, mpfr_srcptr, unsigned long, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_ui_pow_ui (mpfr_ptr, unsigned long, unsigned long, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_ui_pow (mpfr_ptr, unsigned long, mpfr_srcptr, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_pow_z (mpfr_ptr, mpfr_srcptr, mpz_srcptr, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_sqrt (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_sqrt_ui (mpfr_ptr, unsigned long, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_rec_sqrt (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_add (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_sub (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_mul (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_div (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_add_ui (mpfr_ptr, mpfr_srcptr, unsigned long, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_sub_ui (mpfr_ptr, mpfr_srcptr, unsigned long, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_ui_sub (mpfr_ptr, unsigned long, mpfr_srcptr, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_mul_ui (mpfr_ptr, mpfr_srcptr, unsigned long, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_div_ui (mpfr_ptr, mpfr_srcptr, unsigned long, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_ui_div (mpfr_ptr, unsigned long, mpfr_srcptr, + mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_add_si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_sub_si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_si_sub (mpfr_ptr, long, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_mul_si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_div_si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_si_div (mpfr_ptr, long, mpfr_srcptr, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_add_d (mpfr_ptr, mpfr_srcptr, double, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_sub_d (mpfr_ptr, mpfr_srcptr, double, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_d_sub (mpfr_ptr, double, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_mul_d (mpfr_ptr, mpfr_srcptr, double, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_div_d (mpfr_ptr, mpfr_srcptr, double, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_d_div (mpfr_ptr, double, mpfr_srcptr, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_sqr (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_const_pi (mpfr_ptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_const_log2 (mpfr_ptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_const_euler (mpfr_ptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_const_catalan (mpfr_ptr, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_agm (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_log (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_log2 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_log10 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_log1p (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_log_ui (mpfr_ptr, unsigned long, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_exp (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_exp2 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_exp10 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_expm1 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_eint (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_li2 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_cmp (mpfr_srcptr, mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_cmp3 (mpfr_srcptr, mpfr_srcptr, int); +__MPFR_DECLSPEC int mpfr_cmp_d (mpfr_srcptr, double); +__MPFR_DECLSPEC int mpfr_cmp_ld (mpfr_srcptr, long double); +__MPFR_DECLSPEC int mpfr_cmpabs (mpfr_srcptr, mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_cmp_ui (mpfr_srcptr, unsigned long); +__MPFR_DECLSPEC int mpfr_cmp_si (mpfr_srcptr, long); +__MPFR_DECLSPEC int mpfr_cmp_ui_2exp (mpfr_srcptr, unsigned long, mpfr_exp_t); +__MPFR_DECLSPEC int mpfr_cmp_si_2exp (mpfr_srcptr, long, mpfr_exp_t); +__MPFR_DECLSPEC void mpfr_reldiff (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_eq (mpfr_srcptr, mpfr_srcptr, unsigned long); +__MPFR_DECLSPEC int mpfr_sgn (mpfr_srcptr); + +__MPFR_DECLSPEC int mpfr_mul_2exp (mpfr_ptr, mpfr_srcptr, unsigned long, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_div_2exp (mpfr_ptr, mpfr_srcptr, unsigned long, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_mul_2ui (mpfr_ptr, mpfr_srcptr, unsigned long, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_div_2ui (mpfr_ptr, mpfr_srcptr, unsigned long, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_mul_2si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_div_2si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_rint (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_roundeven (mpfr_ptr, mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_round (mpfr_ptr, mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_trunc (mpfr_ptr, mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_ceil (mpfr_ptr, mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_floor (mpfr_ptr, mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_rint_roundeven (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_rint_round (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_rint_trunc (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_rint_ceil (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_rint_floor (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_frac (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_modf (mpfr_ptr, mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_remquo (mpfr_ptr, long*, mpfr_srcptr, mpfr_srcptr, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_remainder (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_fmod (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_fmodquo (mpfr_ptr, long*, mpfr_srcptr, mpfr_srcptr, + mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_fits_ulong_p (mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_fits_slong_p (mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_fits_uint_p (mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_fits_sint_p (mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_fits_ushort_p (mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_fits_sshort_p (mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_fits_uintmax_p (mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_fits_intmax_p (mpfr_srcptr, mpfr_rnd_t); + +__MPFR_DECLSPEC void mpfr_extract (mpz_ptr, mpfr_srcptr, unsigned int); +__MPFR_DECLSPEC void mpfr_swap (mpfr_ptr, mpfr_ptr); +__MPFR_DECLSPEC void mpfr_dump (mpfr_srcptr); + +__MPFR_DECLSPEC int mpfr_nan_p (mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_inf_p (mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_number_p (mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_integer_p (mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_zero_p (mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_regular_p (mpfr_srcptr); + +__MPFR_DECLSPEC int mpfr_greater_p (mpfr_srcptr, mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_greaterequal_p (mpfr_srcptr, mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_less_p (mpfr_srcptr, mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_lessequal_p (mpfr_srcptr, mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_lessgreater_p (mpfr_srcptr, mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_equal_p (mpfr_srcptr, mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_unordered_p (mpfr_srcptr, mpfr_srcptr); + +__MPFR_DECLSPEC int mpfr_atanh (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_acosh (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_asinh (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_cosh (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_sinh (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_tanh (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_sinh_cosh (mpfr_ptr, mpfr_ptr, mpfr_srcptr, + mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_sech (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_csch (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_coth (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_acos (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_asin (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_atan (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_sin (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_sin_cos (mpfr_ptr, mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_cos (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_tan (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_atan2 (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_sec (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_csc (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_cot (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_hypot (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_erf (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_erfc (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_cbrt (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +#ifndef _MPFR_NO_DEPRECATED_ROOT /* for the test of this function */ +MPFR_DEPRECATED +#endif +__MPFR_DECLSPEC int mpfr_root (mpfr_ptr, mpfr_srcptr, unsigned long, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_rootn_ui (mpfr_ptr, mpfr_srcptr, unsigned long, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_gamma (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_gamma_inc (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_beta (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_lngamma (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_lgamma (mpfr_ptr, int *, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_digamma (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_zeta (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_zeta_ui (mpfr_ptr, unsigned long, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_fac_ui (mpfr_ptr, unsigned long, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_j0 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_j1 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_jn (mpfr_ptr, long, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_y0 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_y1 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_yn (mpfr_ptr, long, mpfr_srcptr, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_ai (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_min (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_max (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_dim (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_mul_z (mpfr_ptr, mpfr_srcptr, mpz_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_div_z (mpfr_ptr, mpfr_srcptr, mpz_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_add_z (mpfr_ptr, mpfr_srcptr, mpz_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_sub_z (mpfr_ptr, mpfr_srcptr, mpz_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_z_sub (mpfr_ptr, mpz_srcptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_cmp_z (mpfr_srcptr, mpz_srcptr); + +__MPFR_DECLSPEC int mpfr_fma (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_fms (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_fmma (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr, + mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_fmms (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr, + mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_sum (mpfr_ptr, const mpfr_ptr *, unsigned long, + mpfr_rnd_t); + +__MPFR_DECLSPEC void mpfr_free_cache (void); +__MPFR_DECLSPEC void mpfr_free_cache2 (mpfr_free_cache_t); +__MPFR_DECLSPEC void mpfr_free_pool (void); +__MPFR_DECLSPEC int mpfr_mp_memory_cleanup (void); + +__MPFR_DECLSPEC int mpfr_subnormalize (mpfr_ptr, int, mpfr_rnd_t); + +__MPFR_DECLSPEC int mpfr_strtofr (mpfr_ptr, const char *, char **, int, + mpfr_rnd_t); + +__MPFR_DECLSPEC void mpfr_round_nearest_away_begin (mpfr_t); +__MPFR_DECLSPEC int mpfr_round_nearest_away_end (mpfr_t, int); + +__MPFR_DECLSPEC size_t mpfr_custom_get_size (mpfr_prec_t); +__MPFR_DECLSPEC void mpfr_custom_init (void *, mpfr_prec_t); +__MPFR_DECLSPEC void * mpfr_custom_get_significand (mpfr_srcptr); +__MPFR_DECLSPEC mpfr_exp_t mpfr_custom_get_exp (mpfr_srcptr); +__MPFR_DECLSPEC void mpfr_custom_move (mpfr_ptr, void *); +__MPFR_DECLSPEC void mpfr_custom_init_set (mpfr_ptr, int, mpfr_exp_t, + mpfr_prec_t, void *); +__MPFR_DECLSPEC int mpfr_custom_get_kind (mpfr_srcptr); #if defined (__cplusplus) } @@ -742,6 +777,18 @@ MPFR_EXTENSION mp_limb_t __gmpfr_local_tab_##_x[((_p)-1)/GMP_NUMB_BITS+1]; \ MPFR_EXTENSION mpfr_t _x = {{(_p),1,__MPFR_EXP_NAN,__gmpfr_local_tab_##_x}} +#if MPFR_USE_C99_FEATURE +/* C99 & C11 version: functions with multiple inputs supported */ +#define mpfr_round_nearest_away(func, rop, ...) \ + (mpfr_round_nearest_away_begin(rop), \ + mpfr_round_nearest_away_end((rop), func((rop), __VA_ARGS__, MPFR_RNDN))) +#else +/* C89 version: function with one input supported */ +#define mpfr_round_nearest_away(func, rop, op) \ + (mpfr_round_nearest_away_begin(rop), \ + mpfr_round_nearest_away_end((rop), func((rop), (op), MPFR_RNDN))) +#endif + /* Fast access macros to replace function interface. If the USER don't want to use the macro interface, let him make happy even if it produces faster and smaller code. */ @@ -761,8 +808,12 @@ #define MPFR_VALUE_OF(x) (0 ? (x) : (x)) #define mpfr_get_prec(_x) MPFR_VALUE_OF((_x)->_mpfr_prec) #define mpfr_get_exp(_x) MPFR_VALUE_OF((_x)->_mpfr_exp) -/* Note: if need be, the MPFR_VALUE_OF can be used for other expressions - (of any type). Thanks to Wojtek Lerch and Tim Rentsch for the idea. */ +/* Note 1: If need be, the MPFR_VALUE_OF can be used for other expressions + (of any type). Thanks to Wojtek Lerch and Tim Rentsch for the idea. + Note 2: Defining mpfr_get_exp() as a macro has the effect to disable + the check that the argument is a pure FP number (done in the function); + this increases the risk of undetected error and makes debugging more + complex. Is it really worth in practice? (Potential FIXME) */ #define mpfr_round(a,b) mpfr_rint((a), (b), MPFR_RNDNA) #define mpfr_trunc(a,b) mpfr_rint((a), (b), MPFR_RNDZ) @@ -782,12 +833,13 @@ /* When using GCC, optimize certain common comparisons and affectations. - + Remove ICC since it defines __GNUC__ but produces a - huge number of warnings if you use this code. + + Remove some Intel C/C++ (ICC) versions since they now define __GNUC__ + but produce a huge number of warnings if you use this code. VL: I couldn't reproduce a single warning when enabling these macros - with icc 10.1 20080212 on Itanium. But with this version, __ICC isn't - defined (__INTEL_COMPILER is, though), so that these macros are enabled - anyway. Checking with other ICC versions is needed. Possibly detect + with icc 10.1 20080212 on Itanium. But with this version, the obsolete + __ICC macro isn't defined (__INTEL_COMPILER is, though), so that these + macros are enabled anyway. Checking with other ICC versions is needed. + For now, !defined(__ICC) seems to be the right test. Possibly detect whether warnings are produced or not with a configure test. + Remove C++ too, since it complains too much. */ /* Added casts to improve robustness in case of undefined behavior and @@ -799,8 +851,8 @@ are OK since if X is a constant expression, then (unsigned long) X is also a constant expression, so that the optimizations still work. The warnings are probably related to the following two bugs: - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4210 - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38470 (possibly a variant) + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=4210 + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38470 (possibly a variant) and the casts could be removed once these bugs are fixed. Casts shouldn't be used on the generic calls (to the ..._2exp functions), where implicit conversions are performed. Indeed, having at least one @@ -812,6 +864,7 @@ be used. */ #if defined (__GNUC__) && !defined(__ICC) && !defined(__cplusplus) #if (__GNUC__ >= 2) + #undef mpfr_cmp_ui /* We use the fact that mpfr_sgn on NaN sets the erange flag and returns 0. But warning! mpfr_sgn is specified as a macro in the API, thus the macro @@ -820,11 +873,13 @@ (__builtin_constant_p (_u) && (mpfr_ulong) (_u) == 0 ? \ (mpfr_sgn) (_f) : \ mpfr_cmp_ui_2exp ((_f), (_u), 0)) + #undef mpfr_cmp_si #define mpfr_cmp_si(_f,_s) \ (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \ mpfr_cmp_ui ((_f), (mpfr_ulong) (mpfr_long) (_s)) : \ mpfr_cmp_si_2exp ((_f), (_s), 0)) + #if __GNUC__ > 2 || __GNUC_MINOR__ >= 95 #undef mpfr_set_ui #define mpfr_set_ui(_f,_u,_r) \ @@ -836,11 +891,43 @@ (mpfr_void) (_r); 0; }) : \ mpfr_set_ui_2exp ((_f), (_u), 0, (_r))) #endif + #undef mpfr_set_si #define mpfr_set_si(_f,_s,_r) \ (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \ mpfr_set_ui ((_f), (mpfr_ulong) (mpfr_long) (_s), (_r)) : \ mpfr_set_si_2exp ((_f), (_s), 0, (_r))) + +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +/* If the source is a constant number that is a power of 2, + optimize the call */ +#undef mpfr_mul_ui +#define mpfr_mul_ui(_f, _g, _u,_r) \ + (__builtin_constant_p (_u) && (mpfr_ulong) (_u) >= 1 && \ + ((mpfr_ulong) (_u) & ((mpfr_ulong) (_u) - 1)) == 0 ? \ + mpfr_mul_2si((_f), (_g), __builtin_ctzl (_u), (_r)) : \ + mpfr_mul_ui ((_f), (_g), (_u), (_r))) +#undef mpfr_div_ui +#define mpfr_div_ui(_f, _g, _u,_r) \ + (__builtin_constant_p (_u) && (mpfr_ulong) (_u) >= 1 && \ + ((mpfr_ulong) (_u) & ((mpfr_ulong) (_u) - 1)) == 0 ? \ + mpfr_mul_2si((_f), (_g), - __builtin_ctzl (_u), (_r)) : \ + mpfr_div_ui ((_f), (_g), (_u), (_r))) +#endif + +/* If the source is a constant number that is non-negative, + optimize the call */ +#undef mpfr_mul_si +#define mpfr_mul_si(_f, _g, _s,_r) \ + (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \ + mpfr_mul_ui ((_f), (_g), (mpfr_ulong) (mpfr_long) (_s), (_r)) : \ + mpfr_mul_si ((_f), (_g), (_s), (_r))) +#undef mpfr_div_si +#define mpfr_div_si(_f, _g, _s,_r) \ + (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \ + mpfr_div_ui ((_f), (_g), (mpfr_ulong) (mpfr_long) (_s), (_r)) : \ + mpfr_div_si ((_f), (_g), (_s), (_r))) + #endif #endif @@ -894,12 +981,14 @@ ( mpfr_init(x), mpfr_set_ld((x), (d), (rnd)) ) #define mpfr_init_set_z(x, i, rnd) \ ( mpfr_init(x), mpfr_set_z((x), (i), (rnd)) ) +#ifndef MPFR_USE_MINI_GMP #define mpfr_init_set_q(x, i, rnd) \ ( mpfr_init(x), mpfr_set_q((x), (i), (rnd)) ) -#define mpfr_init_set(x, y, rnd) \ - ( mpfr_init(x), mpfr_set((x), (y), (rnd)) ) #define mpfr_init_set_f(x, y, rnd) \ ( mpfr_init(x), mpfr_set_f((x), (y), (rnd)) ) +#endif +#define mpfr_init_set(x, y, rnd) \ + ( mpfr_init(x), mpfr_set((x), (y), (rnd)) ) /* Compatibility layer -- obsolete functions and macros */ /* Note: it is not possible to output warnings, unless one defines @@ -923,10 +1012,6 @@ #ifndef mpz_set_fr # define mpz_set_fr mpfr_get_z #endif -#define mpfr_add_one_ulp(x,r) \ - (mpfr_sgn (x) > 0 ? mpfr_nextabove (x) : mpfr_nextbelow (x)) -#define mpfr_sub_one_ulp(x,r) \ - (mpfr_sgn (x) > 0 ? mpfr_nextbelow (x) : mpfr_nextabove (x)) #define mpfr_get_z_exp mpfr_get_z_2exp #define mpfr_custom_get_mantissa mpfr_custom_get_significand @@ -934,7 +1019,7 @@ /* Check if / is included or if the user - explicitly wants intmax_t. Automatical detection is done by + explicitly wants intmax_t. Automatic detection is done by checking: - INTMAX_C and UINTMAX_C, but not if the compiler is a C++ one (as suggested by Patrick Pelissier) because the test does not @@ -950,7 +1035,8 @@ */ #if (defined (INTMAX_C) && defined (UINTMAX_C) && !defined(__cplusplus)) || \ defined (MPFR_USE_INTMAX_T) || \ - defined (_STDINT_H) || defined (_STDINT_H_) || defined (_STDINT) + defined (_STDINT_H) || defined (_STDINT_H_) || defined (_STDINT) || \ + defined (_SYS_STDINT_H_) /* needed for FreeBSD */ # ifndef _MPFR_H_HAVE_INTMAX_T # define _MPFR_H_HAVE_INTMAX_T 1 @@ -964,14 +1050,12 @@ #define mpfr_set_uj_2exp __gmpfr_set_uj_2exp #define mpfr_get_sj __gmpfr_mpfr_get_sj #define mpfr_get_uj __gmpfr_mpfr_get_uj -__MPFR_DECLSPEC int mpfr_set_sj _MPFR_PROTO ((mpfr_t, intmax_t, mpfr_rnd_t)); -__MPFR_DECLSPEC int - mpfr_set_sj_2exp _MPFR_PROTO ((mpfr_t, intmax_t, intmax_t, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_set_uj _MPFR_PROTO ((mpfr_t, uintmax_t, mpfr_rnd_t)); -__MPFR_DECLSPEC int - mpfr_set_uj_2exp _MPFR_PROTO ((mpfr_t, uintmax_t, intmax_t, mpfr_rnd_t)); -__MPFR_DECLSPEC intmax_t mpfr_get_sj _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC uintmax_t mpfr_get_uj _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_set_sj (mpfr_t, intmax_t, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_set_sj_2exp (mpfr_t, intmax_t, intmax_t, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_set_uj (mpfr_t, uintmax_t, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_set_uj_2exp (mpfr_t, uintmax_t, intmax_t, mpfr_rnd_t); +__MPFR_DECLSPEC intmax_t mpfr_get_sj (mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC uintmax_t mpfr_get_uj (mpfr_srcptr, mpfr_rnd_t); #if defined (__cplusplus) } @@ -992,13 +1076,17 @@ #define mpfr_inp_str __gmpfr_inp_str #define mpfr_out_str __gmpfr_out_str -__MPFR_DECLSPEC size_t mpfr_inp_str _MPFR_PROTO ((mpfr_ptr, FILE*, int, - mpfr_rnd_t)); -__MPFR_DECLSPEC size_t mpfr_out_str _MPFR_PROTO ((FILE*, int, size_t, - mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC size_t mpfr_inp_str (mpfr_ptr, FILE*, int, mpfr_rnd_t); +__MPFR_DECLSPEC size_t mpfr_out_str (FILE*, int, size_t, mpfr_srcptr, + mpfr_rnd_t); +#ifndef MPFR_USE_MINI_GMP #define mpfr_fprintf __gmpfr_fprintf -__MPFR_DECLSPEC int mpfr_fprintf _MPFR_PROTO ((FILE*, __gmp_const char*, - ...)); +__MPFR_DECLSPEC int mpfr_fprintf (FILE*, const char*, ...); +#endif +#define mpfr_fpif_export __gmpfr_fpif_export +#define mpfr_fpif_import __gmpfr_fpif_import +__MPFR_DECLSPEC int mpfr_fpif_export (FILE*, mpfr_ptr); +__MPFR_DECLSPEC int mpfr_fpif_import (mpfr_ptr, FILE*); #if defined (__cplusplus) } @@ -1021,13 +1109,10 @@ #define mpfr_vasprintf __gmpfr_vasprintf #define mpfr_vsprintf __gmpfr_vsprintf #define mpfr_vsnprintf __gmpfr_vsnprintf -__MPFR_DECLSPEC int mpfr_vprintf _MPFR_PROTO ((__gmp_const char*, va_list)); -__MPFR_DECLSPEC int mpfr_vasprintf _MPFR_PROTO ((char**, __gmp_const char*, - va_list)); -__MPFR_DECLSPEC int mpfr_vsprintf _MPFR_PROTO ((char*, __gmp_const char*, - va_list)); -__MPFR_DECLSPEC int mpfr_vsnprintf _MPFR_PROTO ((char*, size_t, - __gmp_const char*, va_list)); +__MPFR_DECLSPEC int mpfr_vprintf (const char*, va_list); +__MPFR_DECLSPEC int mpfr_vasprintf (char**, const char*, va_list); +__MPFR_DECLSPEC int mpfr_vsprintf (char*, const char*, va_list); +__MPFR_DECLSPEC int mpfr_vsnprintf (char*, size_t, const char*, va_list); #if defined (__cplusplus) } @@ -1048,8 +1133,7 @@ #endif #define mpfr_vfprintf __gmpfr_vfprintf -__MPFR_DECLSPEC int mpfr_vfprintf _MPFR_PROTO ((FILE*, __gmp_const char*, - va_list)); +__MPFR_DECLSPEC int mpfr_vfprintf (FILE*, const char*, va_list); #if defined (__cplusplus) } diff -Nru mpfr4-3.1.4/src/mpfr-impl.h mpfr4-4.0.2/src/mpfr-impl.h --- mpfr4-3.1.4/src/mpfr-impl.h 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/mpfr-impl.h 2019-01-27 18:30:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Utilities for MPFR developers, not exported. -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,22 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __MPFR_IMPL_H__ #define __MPFR_IMPL_H__ +/* Include config.h before using ANY configure macros if needed. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + + +/****************************************************** + ***************** Standard headers ***************** + ******************************************************/ + /* Let's include some standard headers unconditionally as they are already needed by several source files or when some options are enabled/disabled, and it is easy to forget them (some configure @@ -31,16 +41,34 @@ (which is very unlikely and probably means something broken in this source file), we should do that with some macro (that would also force to disable incompatible features). */ + #if defined (__cplusplus) -#include -#include +# include +# include #else -#include -#include +# include +# include #endif + +/* Since ( for C++) is unconditionally included... */ +#ifndef MPFR_DONT_USE_FILE +# define MPFR_USE_FILE +#endif + +#include #include -#if _MPFR_EXP_FORMAT == 4 + +/****************************************************** + ***************** Include files ******************** + ******************************************************/ + +/* The macros defined in mpfr-cvers.h do not depend on anything, + so that it is better to include this header file early: then + it can be used by any other header. */ +#include "mpfr-cvers.h" + +#if defined(_MPFR_EXP_FORMAT) && _MPFR_EXP_FORMAT == 4 /* mpfr_exp_t will be defined as intmax_t */ # include "mpfr-intmax.h" #endif @@ -52,131 +80,50 @@ # define __MPFR_WITHIN_MPFR 1 #endif -/****************************************************** - ****************** Include files ********************* - ******************************************************/ - -/* Include 'config.h' before using ANY configure macros if needed - NOTE: It isn't MPFR 'config.h', but GMP's one! */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - /* For the definition of MPFR_THREAD_ATTR. GCC/ICC detection macros are no longer used, as they sometimes gave incorrect information about the support of thread-local variables. A configure check is now done. */ +#if defined(MPFR_WANT_SHARED_CACHE) +# define MPFR_NEED_THREAD_LOCK 1 +#endif #include "mpfr-thread.h" -#ifdef MPFR_HAVE_GMP_IMPL /* Build with gmp internals */ +#ifdef MPFR_HAVE_GMP_IMPL /* Build with gmp internals */ -# ifndef __GMP_H__ -# include "gmp.h" -# endif -# ifndef __GMP_IMPL_H__ -# include "gmp-impl.h" -# endif +# include "gmp.h" +# include "gmp-impl.h" # ifdef MPFR_NEED_LONGLONG_H # include "longlong.h" # endif -# ifndef __MPFR_H -# include "mpfr.h" -# endif +# include "mpfr.h" +# include "mpfr-gmp.h" #else /* Build without gmp internals */ -# ifndef __GMP_H__ -# include "gmp.h" -# endif -# ifndef __MPFR_H -# include "mpfr.h" -# endif -# ifndef __GMPFR_GMP_H__ -# include "mpfr-gmp.h" +# include "gmp.h" +/* if using mini-gmp, include missing definitions in mini-gmp */ +# ifdef MPFR_USE_MINI_GMP +# include "mpfr-mini-gmp.h" # endif +# include "mpfr.h" +# include "mpfr-gmp.h" # ifdef MPFR_NEED_LONGLONG_H # define LONGLONG_STANDALONE # include "mpfr-longlong.h" # endif #endif -#undef MPFR_NEED_LONGLONG_H - -/* If a mpn_sqr_n macro is not defined, use mpn_mul. GMP 4.x defines a - mpn_sqr_n macro in gmp-impl.h (and this macro disappeared in GMP 5), - so that GMP's macro can only be used when MPFR has been configured - with --with-gmp-build (and only with GMP 4.x). */ -#ifndef mpn_sqr_n -# define mpn_sqr_n(dst,src,n) mpn_mul((dst),(src),(n),(src),(n)) -#endif - - -/****************************************************** - ***************** Detection macros ******************* - ******************************************************/ - -/* Macros to detect STDC, GCC, GLIBC, GMP and ICC version */ -#if defined(__STDC_VERSION__) -# define __MPFR_STDC(version) (__STDC_VERSION__>=(version)) -#elif defined(__STDC__) -# define __MPFR_STDC(version) (0 == (version)) -#else -# define __MPFR_STDC(version) 0 -#endif - -#if defined(_WIN32) -/* Under MS Windows (e.g. with VS2008 or VS2010), Intel's compiler doesn't - support/enable extensions like the ones seen under GNU/Linux. - https://sympa.inria.fr/sympa/arc/mpfr/2011-02/msg00032.html */ -# define __MPFR_ICC(a,b,c) 0 -#elif defined(__ICC) -# define __MPFR_ICC(a,b,c) (__ICC >= (a)*100+(b)*10+(c)) -#elif defined(__INTEL_COMPILER) -# define __MPFR_ICC(a,b,c) (__INTEL_COMPILER >= (a)*100+(b)*10+(c)) -#else -# define __MPFR_ICC(a,b,c) 0 -#endif - -#if defined(__GNUC__) && defined(__GNUC_MINOR__) && ! __MPFR_ICC(0,0,0) -# define __MPFR_GNUC(a,i) \ - (MPFR_VERSION_NUM(__GNUC__,__GNUC_MINOR__,0) >= MPFR_VERSION_NUM(a,i,0)) -#else -# define __MPFR_GNUC(a,i) 0 -#endif - -#if defined(__GLIBC__) && defined(__GLIBC_MINOR__) -# define __MPFR_GLIBC(a,i) \ - (MPFR_VERSION_NUM(__GLIBC__,__GLIBC_MINOR__,0) >= MPFR_VERSION_NUM(a,i,0)) -#else -# define __MPFR_GLIBC(a,i) 0 -#endif - -#if defined(__GNU_MP_VERSION) && \ - defined(__GNU_MP_VERSION_MINOR) && \ - defined(__GNU_MP_VERSION_PATCHLEVEL) -# define __MPFR_GMP(a,b,c) \ - (MPFR_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL) >= MPFR_VERSION_NUM(a,b,c)) -#else -# define __MPFR_GMP(a,b,c) 0 -#endif - - - -/****************************************************** - ************* GMP Basic Pointer Types **************** - ******************************************************/ - -typedef mp_limb_t *mpfr_limb_ptr; -typedef __gmp_const mp_limb_t *mpfr_limb_srcptr; +#undef MPFR_NEED_LONGLONG_H /****************************************************** - ****************** (U)INTMAX_MAX ********************* + ***************** (U)INTMAX_MAX ******************** ******************************************************/ /* Let's try to fix UINTMAX_MAX and INTMAX_MAX if these macros don't work (e.g. with gcc -ansi -pedantic-errors in 32-bit mode under GNU/Linux), - see . */ + see . */ #ifdef _MPFR_H_HAVE_INTMAX_T # ifdef MPFR_HAVE_INTMAX_MAX # define MPFR_UINTMAX_MAX UINTMAX_MAX @@ -189,61 +136,93 @@ # endif #endif -#define MPFR_BYTES_PER_MP_LIMB (GMP_NUMB_BITS/CHAR_BIT) /****************************************************** - ******************** Check GMP *********************** + ************* Attribute definitions **************** ******************************************************/ -#if !__MPFR_GMP(4,1,0) -# error "GMP 4.1.0 or newer needed" +#if defined(MPFR_HAVE_NORETURN) +/* _Noreturn is specified by ISO C11 (Section 6.7.4); + in GCC, it is supported as of version 4.7. */ +# define MPFR_NORETURN _Noreturn +#elif !defined(noreturn) +/* A noreturn macro could be defined if has been included, + in which case it would make sense to #define MPFR_NORETURN noreturn. + But this is unlikely, as MPFR_HAVE_NORETURN should have been defined + in such a case. So, in doubt, let us avoid any code that would use a + noreturn macro, since it could be invalid. */ +# if __MPFR_GNUC(3,0) || __MPFR_ICC(8,1,0) +# define MPFR_NORETURN __attribute__ ((noreturn)) +# elif defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200) +# define MPFR_NORETURN __declspec (noreturn) +# endif +#endif +#ifndef MPFR_NORETURN +# define MPFR_NORETURN +#endif + +#if __MPFR_GNUC(3,0) || __MPFR_ICC(8,1,0) +# define MPFR_CONST_ATTR __attribute__ ((const)) +#else +# define MPFR_CONST_ATTR #endif -#if GMP_NAIL_BITS != 0 -# error "MPFR doesn't support nonzero values of GMP_NAIL_BITS" +#if __MPFR_GNUC(3,0) || __MPFR_ICC(8,1,0) +# define MPFR_PURE_FUNCTION_ATTR __attribute__ ((pure)) +#else +# define MPFR_PURE_FUNCTION_ATTR #endif -#if (GMP_NUMB_BITS<32) || (GMP_NUMB_BITS & (GMP_NUMB_BITS - 1)) -# error "GMP_NUMB_BITS must be a power of 2, and >= 32" +/* The hot attribute on a function is used to inform the compiler + that the function is a hot spot of the compiled program. */ +#if __MPFR_GNUC(4,3) +# define MPFR_HOT_FUNCTION_ATTR __attribute__ ((hot)) +#else +# define MPFR_HOT_FUNCTION_ATTR #endif -#if GMP_NUMB_BITS == 16 -# define MPFR_LOG2_GMP_NUMB_BITS 4 -#elif GMP_NUMB_BITS == 32 -# define MPFR_LOG2_GMP_NUMB_BITS 5 -#elif GMP_NUMB_BITS == 64 -# define MPFR_LOG2_GMP_NUMB_BITS 6 -#elif GMP_NUMB_BITS == 128 -# define MPFR_LOG2_GMP_NUMB_BITS 7 -#elif GMP_NUMB_BITS == 256 -# define MPFR_LOG2_GMP_NUMB_BITS 8 +/* The cold attribute on functions is used to inform the compiler + that the function is unlikely to be executed. */ +#if __MPFR_GNUC(4,3) +# define MPFR_COLD_FUNCTION_ATTR __attribute__ ((cold)) #else -# error "Can't compute log2(GMP_NUMB_BITS)" +# define MPFR_COLD_FUNCTION_ATTR #endif -#if __MPFR_GNUC(3,0) || __MPFR_ICC(8,1,0) -/* For the future: N1478: Supporting the 'noreturn' property in C1x - http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1478.htm */ -# define MPFR_NORETURN_ATTR __attribute__ ((noreturn)) -# define MPFR_CONST_ATTR __attribute__ ((const)) +/* add MPFR_MAYBE_UNUSED after a variable declaration to avoid compiler + warnings if it is not used */ +#if __MPFR_GNUC(3,4) +#define MPFR_MAYBE_UNUSED __attribute__ ((unused)) #else -# define MPFR_NORETURN_ATTR -# define MPFR_CONST_ATTR +#define MPFR_MAYBE_UNUSED #endif + + /****************************************************** - ************* Global Internal Variables ************** + *** Global internal variables and related macros *** ******************************************************/ #if defined (__cplusplus) extern "C" { #endif -/* Cache struct */ +#if defined(MPFR_WANT_SHARED_CACHE) +# define MPFR_CACHE_ATTR +#else +# define MPFR_CACHE_ATTR MPFR_THREAD_ATTR +#endif + +/* Note: The following structure and types depend on the MPFR build options + (including compiler options), due to the various locking methods affecting + MPFR_DEFERRED_INIT_SLAVE_DECL and MPFR_LOCK_DECL. But since this is only + internal, that's OK. */ struct __gmpfr_cache_s { mpfr_t x; int inexact; int (*func)(mpfr_ptr, mpfr_rnd_t); + MPFR_DEFERRED_INIT_SLAVE_DECL() + MPFR_LOCK_DECL(lock) }; typedef struct __gmpfr_cache_s mpfr_cache_t[1]; typedef struct __gmpfr_cache_s *mpfr_cache_ptr; @@ -252,62 +231,50 @@ # define MPFR_WIN_THREAD_SAFE_DLL 1 #endif -/* Detect some possible inconsistencies under Unix. */ -#if defined(__unix__) -# if defined(_WIN32) -# error "Both __unix__ and _WIN32 are defined" -# endif -# if __GMP_LIBGMP_DLL -# error "__unix__ is defined and __GMP_LIBGMP_DLL is true" -# endif -# if defined(MPFR_WIN_THREAD_SAFE_DLL) -# error "Both __unix__ and MPFR_WIN_THREAD_SAFE_DLL are defined" -# endif -#endif - #if defined(__MPFR_WITHIN_MPFR) || !defined(MPFR_WIN_THREAD_SAFE_DLL) -extern MPFR_THREAD_ATTR unsigned int __gmpfr_flags; +extern MPFR_THREAD_ATTR mpfr_flags_t __gmpfr_flags; extern MPFR_THREAD_ATTR mpfr_exp_t __gmpfr_emin; extern MPFR_THREAD_ATTR mpfr_exp_t __gmpfr_emax; extern MPFR_THREAD_ATTR mpfr_prec_t __gmpfr_default_fp_bit_precision; extern MPFR_THREAD_ATTR mpfr_rnd_t __gmpfr_default_rounding_mode; -extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_euler; -extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_catalan; +extern MPFR_CACHE_ATTR mpfr_cache_t __gmpfr_cache_const_euler; +extern MPFR_CACHE_ATTR mpfr_cache_t __gmpfr_cache_const_catalan; # ifndef MPFR_USE_LOGGING -extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_pi; -extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_log2; +extern MPFR_CACHE_ATTR mpfr_cache_t __gmpfr_cache_const_pi; +extern MPFR_CACHE_ATTR mpfr_cache_t __gmpfr_cache_const_log2; # else /* Two constants are used by the logging functions (via mpfr_fprintf, then mpfr_log, for the base conversion): pi and log(2). Since the mpfr_cache function isn't re-entrant when working on the same cache, we need to define two caches for each constant. */ -extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_normal_pi; -extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_normal_log2; -extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_logging_pi; -extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_logging_log2; -extern MPFR_THREAD_ATTR mpfr_cache_ptr __gmpfr_cache_const_pi; -extern MPFR_THREAD_ATTR mpfr_cache_ptr __gmpfr_cache_const_log2; +extern MPFR_CACHE_ATTR mpfr_cache_t __gmpfr_normal_pi; +extern MPFR_CACHE_ATTR mpfr_cache_t __gmpfr_normal_log2; +extern MPFR_CACHE_ATTR mpfr_cache_t __gmpfr_logging_pi; +extern MPFR_CACHE_ATTR mpfr_cache_t __gmpfr_logging_log2; +extern MPFR_CACHE_ATTR mpfr_cache_ptr __gmpfr_cache_const_pi; +extern MPFR_CACHE_ATTR mpfr_cache_ptr __gmpfr_cache_const_log2; # endif #endif #ifdef MPFR_WIN_THREAD_SAFE_DLL -__MPFR_DECLSPEC unsigned int * __gmpfr_flags_f(); -__MPFR_DECLSPEC mpfr_exp_t * __gmpfr_emin_f(); -__MPFR_DECLSPEC mpfr_exp_t * __gmpfr_emax_f(); -__MPFR_DECLSPEC mpfr_prec_t * __gmpfr_default_fp_bit_precision_f(); -__MPFR_DECLSPEC mpfr_rnd_t * __gmpfr_default_rounding_mode_f(); -__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_cache_const_euler_f(); -__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_cache_const_catalan_f(); +# define MPFR_MAKE_VARFCT(T,N) T * N ## _f (void) { return &N; } +__MPFR_DECLSPEC mpfr_flags_t * __gmpfr_flags_f (void); +__MPFR_DECLSPEC mpfr_exp_t * __gmpfr_emin_f (void); +__MPFR_DECLSPEC mpfr_exp_t * __gmpfr_emax_f (void); +__MPFR_DECLSPEC mpfr_prec_t * __gmpfr_default_fp_bit_precision_f (void); +__MPFR_DECLSPEC mpfr_rnd_t * __gmpfr_default_rounding_mode_f (void); +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_cache_const_euler_f (void); +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_cache_const_catalan_f (void); # ifndef MPFR_USE_LOGGING -__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_cache_const_pi_f(); -__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_cache_const_log2_f(); +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_cache_const_pi_f (void); +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_cache_const_log2_f (void); # else -__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_normal_pi_f(); -__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_normal_log2_f(); -__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_logging_pi_f(); -__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_logging_log2_f(); -__MPFR_DECLSPEC mpfr_cache_ptr * __gmpfr_cache_const_pi_f(); -__MPFR_DECLSPEC mpfr_cache_ptr * __gmpfr_cache_const_log2_f(); +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_normal_pi_f (void); +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_normal_log2_f (void); +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_logging_pi_f (void); +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_logging_log2_f (void); +__MPFR_DECLSPEC mpfr_cache_ptr * __gmpfr_cache_const_pi_f (void); +__MPFR_DECLSPEC mpfr_cache_ptr * __gmpfr_cache_const_log2_f (void); # endif # ifndef __MPFR_WITHIN_MPFR # define __gmpfr_flags (*__gmpfr_flags_f()) @@ -328,8 +295,14 @@ # define __gmpfr_cache_const_log2 (*__gmpfr_cache_const_log2_f()) # endif # endif +#else +# define MPFR_MAKE_VARFCT(T,N) #endif +# define MPFR_THREAD_VAR(T,N,V) \ + MPFR_THREAD_ATTR T N = (V); \ + MPFR_MAKE_VARFCT (T,N) + #define BASE_MAX 62 __MPFR_DECLSPEC extern const __mpfr_struct __gmpfr_l2b[BASE_MAX-1][2]; @@ -340,41 +313,36 @@ __MPFR_DECLSPEC extern const mpfr_t __gmpfr_one; __MPFR_DECLSPEC extern const mpfr_t __gmpfr_two; __MPFR_DECLSPEC extern const mpfr_t __gmpfr_four; - +__MPFR_DECLSPEC extern const mpfr_t __gmpfr_mone; +__MPFR_DECLSPEC extern const mpfr_t __gmpfr_const_log2_RNDD; +__MPFR_DECLSPEC extern const mpfr_t __gmpfr_const_log2_RNDU; #if defined (__cplusplus) } #endif -/* Flags of __gmpfr_flags */ -#define MPFR_FLAGS_UNDERFLOW 1 -#define MPFR_FLAGS_OVERFLOW 2 -#define MPFR_FLAGS_NAN 4 -#define MPFR_FLAGS_INEXACT 8 -#define MPFR_FLAGS_ERANGE 16 -#define MPFR_FLAGS_DIVBY0 32 -#define MPFR_FLAGS_ALL 63 - -/* Replace some common functions for direct access to the global vars */ -#define mpfr_get_emin() (__gmpfr_emin + 0) -#define mpfr_get_emax() (__gmpfr_emax + 0) -#define mpfr_get_default_rounding_mode() (__gmpfr_default_rounding_mode + 0) -#define mpfr_get_default_prec() (__gmpfr_default_fp_bit_precision + 0) - -#define mpfr_clear_flags() \ - ((void) (__gmpfr_flags = 0)) -#define mpfr_clear_underflow() \ - ((void) (__gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_UNDERFLOW)) -#define mpfr_clear_overflow() \ - ((void) (__gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_OVERFLOW)) -#define mpfr_clear_nanflag() \ - ((void) (__gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_NAN)) -#define mpfr_clear_inexflag() \ - ((void) (__gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_INEXACT)) -#define mpfr_clear_erangeflag() \ - ((void) (__gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_ERANGE)) -#define mpfr_clear_divby0() \ - ((void) (__gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_DIVBY0)) +/* Replace some common functions for direct access to the global vars. + The casts prevent these macros from being used as a lvalue (and this + method makes sure that the expressions have the correct type). */ + +#define mpfr_get_emin() ((mpfr_exp_t) __gmpfr_emin) +#define mpfr_get_emax() ((mpfr_exp_t) __gmpfr_emax) +#define mpfr_get_default_rounding_mode() \ + ((mpfr_rnd_t) __gmpfr_default_rounding_mode) +#define mpfr_get_default_prec() \ + ((mpfr_prec_t) __gmpfr_default_fp_bit_precision) + +/* Flags related macros. */ +/* Note: Function-like macros that modify __gmpfr_flags are not defined + because of the risk to break the sequence point rules if two such + macros are used in the same expression (without a sequence point + between). For instance, mpfr_sgn currently uses mpfr_set_erangeflag, + which mustn't be implemented as a macro for this reason. */ + +#define mpfr_flags_test(mask) \ + (__gmpfr_flags & (mpfr_flags_t) (mask)) + +#if MPFR_FLAGS_ALL <= INT_MAX #define mpfr_underflow_p() \ ((int) (__gmpfr_flags & MPFR_FLAGS_UNDERFLOW)) #define mpfr_overflow_p() \ @@ -387,6 +355,41 @@ ((int) (__gmpfr_flags & MPFR_FLAGS_ERANGE)) #define mpfr_divby0_p() \ ((int) (__gmpfr_flags & MPFR_FLAGS_DIVBY0)) +#endif + +/* Use a do-while statement for the following macros in order to prevent + one from using them in an expression, as the sequence point rules could + be broken if __gmpfr_flags is assigned twice in the same expression + (via macro expansions). For instance, the mpfr_sgn macro currently uses + mpfr_set_erangeflag, which mustn't be implemented as a function-like + macro for this reason. It is not clear whether an expression with + sequence points, like (void) (0, __gmpfr_flags = 0), would avoid UB. */ +#define MPFR_CLEAR_FLAGS() \ + do __gmpfr_flags = 0; while (0) +#define MPFR_CLEAR_UNDERFLOW() \ + do __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_UNDERFLOW; while (0) +#define MPFR_CLEAR_OVERFLOW() \ + do __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_OVERFLOW; while (0) +#define MPFR_CLEAR_DIVBY0() \ + do __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_DIVBY0; while (0) +#define MPFR_CLEAR_NANFLAG() \ + do __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_NAN; while (0) +#define MPFR_CLEAR_INEXFLAG() \ + do __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_INEXACT; while (0) +#define MPFR_CLEAR_ERANGEFLAG() \ + do __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_ERANGE; while (0) +#define MPFR_SET_UNDERFLOW() \ + do __gmpfr_flags |= MPFR_FLAGS_UNDERFLOW; while (0) +#define MPFR_SET_OVERFLOW() \ + do __gmpfr_flags |= MPFR_FLAGS_OVERFLOW; while (0) +#define MPFR_SET_DIVBY0() \ + do __gmpfr_flags |= MPFR_FLAGS_DIVBY0; while (0) +#define MPFR_SET_NANFLAG() \ + do __gmpfr_flags |= MPFR_FLAGS_NAN; while (0) +#define MPFR_SET_INEXFLAG() \ + do __gmpfr_flags |= MPFR_FLAGS_INEXACT; while (0) +#define MPFR_SET_ERANGEFLAG() \ + do __gmpfr_flags |= MPFR_FLAGS_ERANGE; while (0) /* Testing an exception flag correctly is tricky. There are mainly two pitfalls: First, one needs to remember to clear the corresponding @@ -401,14 +404,14 @@ Note: _op can be either a statement or an expression. MPFR_BLOCK_EXCEP should be used only inside a block; it is useful to detect some exception in order to exit the block as soon as possible. */ -#define MPFR_BLOCK_DECL(_flags) unsigned int _flags +#define MPFR_BLOCK_DECL(_flags) mpfr_flags_t _flags /* The (void) (_flags) makes sure that _flags is read at least once (it makes sense to use MPFR_BLOCK while _flags will never be read in the source, so that we wish to avoid the corresponding warning). */ #define MPFR_BLOCK(_flags,_op) \ do \ { \ - mpfr_clear_flags (); \ + MPFR_CLEAR_FLAGS (); \ _op; \ (_flags) = __gmpfr_flags; \ (void) (_flags); \ @@ -430,41 +433,120 @@ /****************************************************** - ******************** Assertions ********************** + ******************* Assertions ********************* ******************************************************/ -/* Compile with -DMPFR_WANT_ASSERT to check all assert statements */ +/* MPFR_WANT_ASSERT can take 4 values (the default value is 0): + -1 (or below): Do not check any assertion. Discouraged, in particular + for a shared library (for time-critical applications, LTO with a + static library should also be used anyway). + 0: Check normal assertions. + 1: Check debugging assertions too. + 2 (or above): Additional checks that may take time. For instance, + some functions may be tested by using two different implementations + and comparing the results. +*/ /* Note: do not use GMP macros ASSERT_ALWAYS and ASSERT as they are not expressions, and as a consequence, they cannot be used in a for(), with a comma operator and so on. */ -/* MPFR_ASSERTN(expr): assertions that should always be checked */ -#define MPFR_ASSERTN(expr) \ - ((void) ((MPFR_UNLIKELY(expr)) || MPFR_UNLIKELY( (ASSERT_FAIL(expr),0) ))) +/* MPFR_ASSERTN(expr): assertions that should normally be checked, + otherwise give a hint to the compiler. + MPFR_ASSERTD(expr): assertions that should be checked when testing, + otherwise give a hint to the compiler. + MPFR_DBGRES(assignment): to be used when the result is tested only + in an MPFR_ASSERTD expression (in order to avoid a warning, e.g. + with GCC's -Wunused-but-set-variable, in non-debug mode). + Note: Evaluating expr might yield side effects, but such side effects + must not change the results (except by yielding an assertion failure). +*/ +#ifndef MPFR_WANT_ASSERT +# define MPFR_WANT_ASSERT 0 +#endif + +#if MPFR_WANT_ASSERT < 0 +# undef MPFR_EXP_CHECK +# define MPFR_ASSERTN(expr) MPFR_ASSUME (expr) +#else +# define MPFR_ASSERTN(expr) \ + ((void) ((MPFR_LIKELY(expr)) || (ASSERT_FAIL(expr),MPFR_ASSUME(expr),0))) +/* Some explanations: mpfr_assert_fail is not marked as "no return", + so that ((void) ((MPFR_LIKELY(expr)) || (ASSERT_FAIL(expr),0))) + cannot be a way to tell the compiler that after this code, expr is + necessarily true. The MPFR_ASSUME(expr) is a way to tell the compiler + that if expr is false, then ASSERT_FAIL(expr) does not return + (otherwise they would be a contradiction / UB when MPFR_ASSUME(expr) + is reached). Such information is useful to avoid warnings like those + from -Wmaybe-uninitialized, e.g. in tests/turandom.c r11663 on t[0] + from "mpfr_equal_p (y, t[0])". + TODO: Remove the MPFR_ASSUME(expr) once mpfr_assert_fail is marked as + "no return". + */ +#endif -/* MPFR_ASSERTD(expr): assertions that should be checked when testing */ -#ifdef MPFR_WANT_ASSERT +#if MPFR_WANT_ASSERT > 0 # define MPFR_EXP_CHECK 1 # define MPFR_ASSERTD(expr) MPFR_ASSERTN (expr) +# define MPFR_DBGRES(A) (A) #else -# define MPFR_ASSERTD(expr) ((void) 0) +# define MPFR_ASSERTD(expr) MPFR_ASSUME (expr) +# define MPFR_DBGRES(A) ((void) (A)) #endif -/* Code to deal with impossible - WARNING: It doesn't use do { } while (0) for Insure++*/ -#define MPFR_RET_NEVER_GO_HERE() {MPFR_ASSERTN(0); return 0;} +/* MPFR_ASSUME is like assert(), but it is a hint to a compiler about a + statement of fact in a function call free expression, which allows + the compiler to generate better machine code. + __builtin_unreachable has been introduced in GCC 4.5 but it works + fine since 4.8 only (before it may generate unoptimized code if there + are more than one decision). + Note: + The goal of MPFR_ASSUME() is to allow the compiler to optimize even + more. Thus we need to make sure that its use in MPFR will never yield + code generation. Since MPFR_ASSUME() may be used by MPFR_ASSERTN() + and MPFR_ASSERTD(), whose expression might have side effects, we need + to make sure that the expression x is not evaluated in such a case. + This is done with __builtin_constant_p (!!(x) || !(x)), whose value + is 0 if x has side effects, and normally 1 if the compiler knows that + x has no side effects (since here, it can deduce that !!(x) || !(x) + is equivalent to the constant 1). In the former case, MPFR_ASSUME(x) + will give (void) 0, and in the latter case, it will give: + (x) ? (void) 0 : __builtin_unreachable() + In the development code, it is better to use MPFR_ASSERTD than + MPFR_ASSUME, since it'll check if the condition is true in debug + build. +*/ +#if defined(MPFR_HAVE_BUILTIN_UNREACHABLE) && __MPFR_GNUC(4, 8) +# define MPFR_ASSUME(x) \ + (! __builtin_constant_p (!!(x) || !(x)) || (x) ? \ + (void) 0 : __builtin_unreachable()) +#elif defined(_MSC_VER) +# define MPFR_ASSUME(x) __assume(x) +#else +# define MPFR_ASSUME(x) ((void) 0) +#endif + +#include "mpfr-sassert.h" + +/* Code to deal with impossible, for functions returning an int. + The "return 0;" avoids an error with current GCC versions and + "-Werror=return-type". + WARNING: It doesn't use do { } while (0) for Insure++ */ +#if defined(HAVE_BUILTIN_UNREACHABLE) +# define MPFR_RET_NEVER_GO_HERE() do { __builtin_unreachable(); } while (0) +#else +# define MPFR_RET_NEVER_GO_HERE() do { MPFR_ASSERTN(0); return 0; } while (0) +#endif /****************************************************** - ******************** Warnings ************************ + ******************* Warnings *********************** ******************************************************/ /* MPFR_WARNING is no longer useful, but let's keep the macro in case it needs to be used again in the future. */ #ifdef MPFR_USE_WARNINGS -# include # define MPFR_WARNING(W) \ do \ { \ @@ -479,7 +561,7 @@ /****************************************************** - ****************** double macros ********************* + ***************** double macros ******************** ******************************************************/ /* Precision used for lower precision computations */ @@ -487,8 +569,6 @@ /* Definition of constants */ #define LOG2 0.69314718055994528622 /* log(2) rounded to zero on 53 bits */ -#define ALPHA 4.3191365662914471407 /* a+2 = a*log(a), rounded to +infinity */ -#define EXPM1 0.36787944117144227851 /* exp(-1), rounded to zero */ /* MPFR_DOUBLE_SPEC = 1 if the C type 'double' corresponds to IEEE-754 double precision, 0 if it doesn't, and undefined if one doesn't know. @@ -505,12 +585,12 @@ # endif #endif -/* Debug non IEEE floats */ -#ifdef XDEBUG -# undef _GMP_IEEE_FLOATS -#endif -#ifndef _GMP_IEEE_FLOATS -# define _GMP_IEEE_FLOATS 0 +/* With -DMPFR_DISABLE_IEEE_FLOATS, exercise non IEEE floats */ +#ifdef MPFR_DISABLE_IEEE_FLOATS +# ifdef _MPFR_IEEE_FLOATS +# undef _MPFR_IEEE_FLOATS +# endif +# define _MPFR_IEEE_FLOATS 0 #endif #ifndef IEEE_DBL_MANT_DIG @@ -526,11 +606,12 @@ /* Visual C++ doesn't support +1.0/0.0, -1.0/0.0 and 0.0/0.0 at compile time. Clang with -fsanitize=undefined is a bit similar due to a bug: - http://llvm.org/bugs/show_bug.cgi?id=17381 + https://llvm.org/bugs/show_bug.cgi?id=17381 (fixed on 2015-12-03) but even without its sanitizer, it may be better to use the double_zero version until IEEE 754 division by zero is properly supported: - http://llvm.org/bugs/show_bug.cgi?id=17000 + https://llvm.org/bugs/show_bug.cgi?id=17005 + Note: DBL_NAN is 0/0, thus its value is a quiet NaN (qNAN). */ #if (defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200)) || \ defined(__clang__) @@ -546,7 +627,7 @@ # define DBL_NEG_ZERO (-0.0) #endif -/* Note: In the past, there was specific code for _GMP_IEEE_FLOATS, which +/* Note: In the past, there was specific code for _MPFR_IEEE_FLOATS, which was based on NaN and Inf memory representations. This code was breaking the aliasing rules (see ISO C99, 6.5#6 and 6.5#7 on the effective type) and for this reason it did not behave correctly with GCC 4.5.0 20091119. @@ -571,15 +652,21 @@ /* Avoid MIPSpro / IRIX64 / gcc -ffast-math (incorrect) optimizations. The + must not be replaced by a ||. With gcc -ffast-math, NaN is regarded as a positive number or something like that; the second - test catches this case. */ + test catches this case. + [2016-03-01] Various tests now fail with gcc -ffast-math or just + -ffinite-math-only; such options are not supported, but this makes + difficult to test MPFR assuming x == x optimization to 1. Anyway + support of functions/tests of using native FP and special values for + non-IEEE-754 environment will always be on a case-by-case basis. */ # define DOUBLE_ISNAN(x) \ (LVALUE(x) && !((((x) >= 0.0) + ((x) <= 0.0)) && -(x)*(x) <= 0.0)) #else # define DOUBLE_ISNAN(x) (LVALUE(x) && (x) != (x)) #endif + /****************************************************** - *************** Long double macros ******************* + ********** long double macros and typedef ********** ******************************************************/ /* We try to get the exact value of the precision of long double @@ -595,6 +682,10 @@ Otherwise (e.g. in base 10), we get an upper bound of the precision, and correct rounding isn't currently provided. */ + +/* Definitions are enabled only if is included. */ +#if defined (FLT_RADIX) + #if defined(LDBL_MANT_DIG) && FLT_RADIX == 2 # define MPFR_LDBL_MANT_DIG LDBL_MANT_DIG #else @@ -670,7 +761,8 @@ optimizing anything. */ #ifdef WANT_LONGDOUBLE_VOLATILE # ifdef volatile -__MPFR_DECLSPEC long double __gmpfr_longdouble_volatile _MPFR_PROTO ((long double)) MPFR_CONST_ATTR; +__MPFR_DECLSPEC long double + __gmpfr_longdouble_volatile (long double) MPFR_CONST_ATTR; # define LONGDOUBLE_VOLATILE(x) (__gmpfr_longdouble_volatile (x)) # define WANT_GMPFR_LONGDOUBLE_VOLATILE 1 # else @@ -678,7 +770,7 @@ # endif #endif -/* Some special case for IEEE_EXT Litle Endian */ +/* Some special case for IEEE_EXT Little Endian */ #if HAVE_LDOUBLE_IEEE_EXT_LITTLE typedef union { @@ -699,19 +791,34 @@ #endif +#endif /* long double macros and typedef */ + + +/****************************************************** + **************** __float128 support **************** + ******************************************************/ + +/* This is standardized by IEEE 754-2008. */ +#define IEEE_FLOAT128_MANT_DIG 113 + + /****************************************************** - *************** _Decimal64 support ******************* + **************** _Decimal64 support **************** ******************************************************/ #ifdef MPFR_WANT_DECIMAL_FLOATS /* to cast between binary64 and decimal64 */ union ieee_double_decimal64 { double d; _Decimal64 d64; }; -#endif +#endif /* MPFR_WANT_DECIMAL_FLOATS */ + /****************************************************** - **************** mpfr_t properties ******************* + **************** mpfr_t properties ***************** ******************************************************/ +#define MPFR_PREC_COND(p) ((p) >= MPFR_PREC_MIN && (p) <= MPFR_PREC_MAX) +#define MPFR_PREC_IN_RANGE(p) (MPFR_ASSERTD (MPFR_PREC_COND(p)), (p)) + /* In the following macro, p is usually a mpfr_prec_t, but this macro works with other integer types (without integer overflow). Checking that p >= 1 in debug mode is useful here because this macro can be @@ -728,12 +835,13 @@ #define MPFR_PREC(x) ((x)->_mpfr_prec) #define MPFR_EXP(x) ((x)->_mpfr_exp) #define MPFR_MANT(x) ((x)->_mpfr_d) -#define MPFR_LAST_LIMB(x) ((MPFR_PREC (x) - 1) / GMP_NUMB_BITS) +#define MPFR_GET_PREC(x) MPFR_PREC_IN_RANGE (MPFR_PREC (x)) +#define MPFR_LAST_LIMB(x) ((MPFR_GET_PREC (x) - 1) / GMP_NUMB_BITS) #define MPFR_LIMB_SIZE(x) (MPFR_LAST_LIMB (x) + 1) /****************************************************** - **************** exponent properties ***************** + *************** Exponent properties **************** ******************************************************/ /* Limits of the mpfr_exp_t type (NOT those of valid exponent values). @@ -748,6 +856,8 @@ # define MPFR_EXP_MAX (LONG_MAX) # define MPFR_EXP_MIN (LONG_MIN) #elif _MPFR_EXP_FORMAT == 4 +/* Note: MPFR_EXP_MAX and MPFR_EXP_MIN must not be used in #if directives + if _MPFR_EXP_FORMAT == 4 and MPFR_HAVE_INTMAX_MAX is not defined. */ # define MPFR_EXP_MAX (MPFR_INTMAX_MAX) # define MPFR_EXP_MIN (MPFR_INTMAX_MIN) #else @@ -758,20 +868,30 @@ nonnegative. */ #define MPFR_UEXP(X) (MPFR_ASSERTD ((X) >= 0), (mpfr_uexp_t) (X)) -#if MPFR_EXP_MIN >= LONG_MIN && MPFR_EXP_MAX <= LONG_MAX -typedef long int mpfr_eexp_t; +/* Define mpfr_eexp_t, mpfr_ueexp_t and MPFR_EXP_FSPEC. + Warning! MPFR_EXP_FSPEC is the length modifier associated with + these types mpfr_eexp_t / mpfr_ueexp_t, not with mpfr_exp_t. + (Should we change that, or is this safer to detect bugs, e.g. + in the context of an expression with computations with long?) +*/ +#if _MPFR_EXP_FORMAT <= 3 +typedef long mpfr_eexp_t; +typedef unsigned long mpfr_ueexp_t; # define mpfr_get_exp_t(x,r) mpfr_get_si((x),(r)) # define mpfr_set_exp_t(x,e,r) mpfr_set_si((x),(e),(r)) # define MPFR_EXP_FSPEC "l" -#elif defined (_MPFR_H_HAVE_INTMAX_T) +#else typedef intmax_t mpfr_eexp_t; +typedef uintmax_t mpfr_ueexp_t; # define mpfr_get_exp_t(x,r) mpfr_get_sj((x),(r)) # define mpfr_set_exp_t(x,e,r) mpfr_set_sj((x),(e),(r)) # define MPFR_EXP_FSPEC "j" -#else -# error "Cannot define mpfr_get_exp_t and mpfr_set_exp_t" #endif +/* Size of mpfr_exp_t in limbs */ +#define MPFR_EXP_LIMB_SIZE \ + ((sizeof (mpfr_exp_t) - 1) / MPFR_BYTES_PER_MP_LIMB + 1) + /* Invalid exponent value (to track bugs...) */ #define MPFR_EXP_INVALID \ ((mpfr_exp_t) 1 << (GMP_NUMB_BITS*sizeof(mpfr_exp_t)/sizeof(mp_limb_t)-2)) @@ -795,28 +915,42 @@ setting the exponent before calling mpfr_check_range. MPFR_EXP_CHECK is defined when MPFR_WANT_ASSERT is defined, but if you don't use MPFR_WANT_ASSERT (for speed reasons), you can still define - MPFR_EXP_CHECK by setting -DMPFR_EXP_CHECK in $CFLAGS. */ + MPFR_EXP_CHECK by setting -DMPFR_EXP_CHECK in $CFLAGS. + Note about MPFR_EXP_IN_RANGE and MPFR_SET_EXP: + The exp expression is required to have a signed type. To avoid spurious + failures, we could cast (exp) to mpfr_exp_t, but this wouldn't allow us + to detect some bugs that can occur on particular platforms. Anyway, an + unsigned type for exp is suspicious and should be regarded as a bug. +*/ + +#define MPFR_EXP_IN_RANGE(e) \ + (MPFR_ASSERTD (IS_SIGNED (e)), (e) >= __gmpfr_emin && (e) <= __gmpfr_emax) #ifdef MPFR_EXP_CHECK # define MPFR_GET_EXP(x) (mpfr_get_exp) (x) -# define MPFR_SET_EXP(x, exp) MPFR_ASSERTN (!mpfr_set_exp ((x), (exp))) +# define MPFR_SET_EXP(x,e) (MPFR_ASSERTN (MPFR_EXP_IN_RANGE (e)), \ + (void) (MPFR_EXP (x) = (e))) # define MPFR_SET_INVALID_EXP(x) ((void) (MPFR_EXP (x) = MPFR_EXP_INVALID)) #else # define MPFR_GET_EXP(x) MPFR_EXP (x) -# define MPFR_SET_EXP(x, exp) ((void) (MPFR_EXP (x) = (exp))) +# define MPFR_SET_EXP(x,e) ((void) (MPFR_EXP (x) = (e))) # define MPFR_SET_INVALID_EXP(x) ((void) 0) #endif +#define MPFR_UBF_EXP_LESS_P(x,y) \ + (MPFR_UNLIKELY (MPFR_IS_UBF (x) || MPFR_IS_UBF (y)) ? \ + mpfr_ubf_exp_less_p (x, y) : MPFR_GET_EXP (x) < MPFR_GET_EXP (y)) /****************************************************** - ********** Singular Values (NAN, INF, ZERO) ********** + ********* Singular values (NAN, INF, ZERO) ********* ******************************************************/ /* Enum special value of exponent. */ # define MPFR_EXP_ZERO (MPFR_EXP_MIN+1) # define MPFR_EXP_NAN (MPFR_EXP_MIN+2) # define MPFR_EXP_INF (MPFR_EXP_MIN+3) +# define MPFR_EXP_UBF (MPFR_EXP_MIN+4) #define MPFR_IS_NAN(x) (MPFR_EXP(x) == MPFR_EXP_NAN) #define MPFR_SET_NAN(x) (MPFR_EXP(x) = MPFR_EXP_NAN) @@ -825,29 +959,51 @@ #define MPFR_IS_ZERO(x) (MPFR_EXP(x) == MPFR_EXP_ZERO) #define MPFR_SET_ZERO(x) (MPFR_EXP(x) = MPFR_EXP_ZERO) #define MPFR_NOTZERO(x) (MPFR_EXP(x) != MPFR_EXP_ZERO) +#define MPFR_IS_UBF(x) (MPFR_EXP(x) == MPFR_EXP_UBF) +#define MPFR_SET_UBF(x) (MPFR_EXP(x) = MPFR_EXP_UBF) + +#define MPFR_IS_NORMALIZED(x) \ + (MPFR_LIMB_MSB (MPFR_MANT(x)[MPFR_LAST_LIMB(x)]) != 0) #define MPFR_IS_FP(x) (!MPFR_IS_NAN(x) && !MPFR_IS_INF(x)) +/* Note: contrary to the MPFR_IS_PURE_*(x) macros, the MPFR_IS_SINGULAR*(x) + macros may be used even when x is being constructed, i.e. its exponent + field is already set (possibly out-of-range), but its significand field + may still contain arbitrary data. Thus MPFR_IS_PURE_FP(x) is not always + equivalent to !MPFR_IS_SINGULAR(x); see the code below. */ #define MPFR_IS_SINGULAR(x) (MPFR_EXP(x) <= MPFR_EXP_INF) -#define MPFR_IS_PURE_FP(x) (!MPFR_IS_SINGULAR(x) && \ - (MPFR_ASSERTD ((MPFR_MANT(x)[MPFR_LAST_LIMB(x)] \ - & MPFR_LIMB_HIGHBIT) != 0), 1)) +#define MPFR_IS_SINGULAR_OR_UBF(x) (MPFR_EXP(x) <= MPFR_EXP_UBF) +#define MPFR_IS_PURE_FP(x) \ + (!MPFR_IS_SINGULAR(x) && \ + (MPFR_ASSERTD (MPFR_EXP (x) >= MPFR_EMIN_MIN && \ + MPFR_EXP (x) <= MPFR_EMAX_MAX && \ + MPFR_IS_NORMALIZED (x)), 1)) +#define MPFR_IS_PURE_UBF(x) \ + (!MPFR_IS_SINGULAR(x) && \ + (MPFR_ASSERTD ((MPFR_IS_UBF (x) || \ + (MPFR_EXP (x) >= MPFR_EMIN_MIN && \ + MPFR_EXP (x) <= MPFR_EMAX_MAX)) && \ + MPFR_IS_NORMALIZED (x)), 1)) #define MPFR_ARE_SINGULAR(x,y) \ (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x)) || MPFR_UNLIKELY(MPFR_IS_SINGULAR(y))) -#define MPFR_IS_POWER_OF_2(x) \ - (mpfr_cmp_ui_2exp ((x), 1, MPFR_GET_EXP (x) - 1) == 0) +#define MPFR_ARE_SINGULAR_OR_UBF(x,y) \ + (MPFR_UNLIKELY(MPFR_IS_SINGULAR_OR_UBF(x)) || \ + MPFR_UNLIKELY(MPFR_IS_SINGULAR_OR_UBF(y))) /****************************************************** - ********************* Sign Macros ******************** + ******************** Sign macros ******************* ******************************************************/ +/* These are sign macros for MPFR numbers only. */ + #define MPFR_SIGN_POS (1) #define MPFR_SIGN_NEG (-1) -#define MPFR_IS_STRICTPOS(x) (MPFR_NOTZERO((x)) && MPFR_SIGN(x) > 0) -#define MPFR_IS_STRICTNEG(x) (MPFR_NOTZERO((x)) && MPFR_SIGN(x) < 0) +#define MPFR_IS_STRICTPOS(x) (MPFR_NOTZERO (x) && MPFR_IS_POS (x)) +#define MPFR_IS_STRICTNEG(x) (MPFR_NOTZERO (x) && MPFR_IS_NEG (x)) #define MPFR_IS_NEG(x) (MPFR_SIGN(x) < 0) #define MPFR_IS_POS(x) (MPFR_SIGN(x) > 0) @@ -862,17 +1018,16 @@ (MPFR_ASSERTD((s) == MPFR_SIGN_POS || (s) == MPFR_SIGN_NEG)) #define MPFR_SET_SIGN(x, s) \ (MPFR_ASSERT_SIGN(s), MPFR_SIGN(x) = s) -#define MPFR_IS_POS_SIGN(s1) (s1 > 0) -#define MPFR_IS_NEG_SIGN(s1) (s1 < 0) +#define MPFR_IS_POS_SIGN(s1) ((s1) > 0) +#define MPFR_IS_NEG_SIGN(s1) ((s1) < 0) #define MPFR_MULT_SIGN(s1, s2) ((s1) * (s2)) /* Transform a sign to 1 or -1 */ #define MPFR_FROM_SIGN_TO_INT(s) (s) #define MPFR_INT_SIGN(x) MPFR_FROM_SIGN_TO_INT(MPFR_SIGN(x)) - /****************************************************** - ***************** Ternary Value Macros *************** + *************** Ternary value macros *************** ******************************************************/ /* Special inexact value */ @@ -886,25 +1041,21 @@ following two macros, unless the flag comes from another function returning the ternary inexact value */ #define MPFR_RET(I) return \ - (I) ? ((__gmpfr_flags |= MPFR_FLAGS_INEXACT), (I)) : 0 + (I) != 0 ? ((__gmpfr_flags |= MPFR_FLAGS_INEXACT), (I)) : 0 #define MPFR_RET_NAN return (__gmpfr_flags |= MPFR_FLAGS_NAN), 0 -#define MPFR_SET_ERANGE() (__gmpfr_flags |= MPFR_FLAGS_ERANGE) - -#define SIGN(I) ((I) < 0 ? -1 : (I) > 0) -#define SAME_SIGN(I1,I2) (SIGN (I1) == SIGN (I2)) - +/* Sign of a native value. */ +#define VSIGN(I) ((I) < 0 ? -1 : (I) > 0) +#define SAME_SIGN(I1,I2) (VSIGN (I1) == VSIGN (I2)) /****************************************************** - ************** Rounding mode macros ***************** + *************** Rounding mode macros *************** ******************************************************/ /* MPFR_RND_MAX gives the number of supported rounding modes by all functions. - * Once faithful rounding is implemented, MPFR_RNDA should be changed - * to MPFR_RNDF. But this will also require more changes in the tests. */ -#define MPFR_RND_MAX ((mpfr_rnd_t)((MPFR_RNDA)+1)) +#define MPFR_RND_MAX ((mpfr_rnd_t)((MPFR_RNDF)+1)) /* We want to test this : * (rnd == MPFR_RNDU && test) || (rnd == RNDD && !test) @@ -913,86 +1064,98 @@ (((rnd) + (test)) == MPFR_RNDD) /* We want to test if rnd = Zero, or Away. - 'test' is 1 if negative, and 0 if positive. */ -#define MPFR_IS_LIKE_RNDZ(rnd, test) \ - ((rnd==MPFR_RNDZ) || MPFR_IS_RNDUTEST_OR_RNDDNOTTEST (rnd, test)) - -#define MPFR_IS_LIKE_RNDU(rnd, sign) \ - ((rnd==MPFR_RNDU) || (rnd==MPFR_RNDZ && sign<0) || (rnd==MPFR_RNDA && sign>0)) - -#define MPFR_IS_LIKE_RNDD(rnd, sign) \ - ((rnd==MPFR_RNDD) || (rnd==MPFR_RNDZ && sign>0) || (rnd==MPFR_RNDA && sign<0)) + 'neg' is 1 if negative, and 0 if positive. */ +#define MPFR_IS_LIKE_RNDZ(rnd, neg) \ + ((rnd) == MPFR_RNDZ || MPFR_IS_RNDUTEST_OR_RNDDNOTTEST (rnd, neg)) + +#define MPFR_IS_LIKE_RNDA(rnd, neg) \ + ((rnd) == MPFR_RNDA || MPFR_IS_RNDUTEST_OR_RNDDNOTTEST (rnd, (neg) == 0)) + +#define MPFR_IS_LIKE_RNDU(rnd, sign) \ + (((rnd) == MPFR_RNDU) || \ + ((rnd) == MPFR_RNDZ && MPFR_IS_NEG_SIGN (sign)) || \ + ((rnd) == MPFR_RNDA && MPFR_IS_POS_SIGN (sign))) + +#define MPFR_IS_LIKE_RNDD(rnd, sign) \ + (((rnd) == MPFR_RNDD) || \ + ((rnd) == MPFR_RNDZ && MPFR_IS_POS_SIGN (sign)) || \ + ((rnd) == MPFR_RNDA && MPFR_IS_NEG_SIGN (sign))) /* Invert a rounding mode, RNDN, RNDZ and RNDA are unchanged */ -#define MPFR_INVERT_RND(rnd) ((rnd == MPFR_RNDU) ? MPFR_RNDD : \ - ((rnd == MPFR_RNDD) ? MPFR_RNDU : rnd)) +#define MPFR_INVERT_RND(rnd) ((rnd) == MPFR_RNDU ? MPFR_RNDD : \ + (rnd) == MPFR_RNDD ? MPFR_RNDU : (rnd)) /* Transform RNDU and RNDD to RNDZ according to test */ -#define MPFR_UPDATE_RND_MODE(rnd, test) \ - do { \ - if (MPFR_UNLIKELY(MPFR_IS_RNDUTEST_OR_RNDDNOTTEST(rnd, test))) \ +#define MPFR_UPDATE_RND_MODE(rnd, test) \ + do { \ + if (MPFR_UNLIKELY(MPFR_IS_RNDUTEST_OR_RNDDNOTTEST(rnd, test))) \ rnd = MPFR_RNDZ; \ } while (0) /* Transform RNDU and RNDD to RNDZ or RNDA according to sign, leave the other modes unchanged */ -#define MPFR_UPDATE2_RND_MODE(rnd, sign) \ - do { \ - if (rnd == MPFR_RNDU) \ - rnd = (sign > 0) ? MPFR_RNDA : MPFR_RNDZ; \ - else if (rnd == MPFR_RNDD) \ - rnd = (sign < 0) ? MPFR_RNDA : MPFR_RNDZ; \ +#define MPFR_UPDATE2_RND_MODE(rnd, sign) \ + do { \ + if (rnd == MPFR_RNDU) \ + rnd = MPFR_IS_POS_SIGN (sign) ? MPFR_RNDA : MPFR_RNDZ; \ + else if (rnd == MPFR_RNDD) \ + rnd = MPFR_IS_NEG_SIGN (sign) ? MPFR_RNDA : MPFR_RNDZ; \ } while (0) /****************************************************** - ******************* Limb Macros ********************** + ****************** Limb macros ********************* ******************************************************/ - /* Definition of MPFR_LIMB_HIGHBIT */ -#if defined(GMP_LIMB_HIGHBIT) -# define MPFR_LIMB_HIGHBIT GMP_LIMB_HIGHBIT -#elif defined(MP_LIMB_T_HIGHBIT) -# define MPFR_LIMB_HIGHBIT MP_LIMB_T_HIGHBIT -#else -# error "Neither GMP_LIMB_HIGHBIT nor MP_LIMB_T_HIGHBIT defined in GMP" -#endif +/* Definition of simple mp_limb_t constants */ +#define MPFR_LIMB_ZERO ((mp_limb_t) 0) +#define MPFR_LIMB_ONE ((mp_limb_t) 1) +#define MPFR_LIMB_HIGHBIT (MPFR_LIMB_ONE << (GMP_NUMB_BITS - 1)) +#define MPFR_LIMB_MAX ((mp_limb_t) -1) /* Mask to get the Most Significant Bit of a limb */ -#define MPFR_LIMB_MSB(l) ((l)&MPFR_LIMB_HIGHBIT) - -/* Definition of MPFR_LIMB_ONE & MPFR_LIMB_ZERO */ -#ifdef CNST_LIMB -# define MPFR_LIMB_ONE CNST_LIMB(1) -# define MPFR_LIMB_ZERO CNST_LIMB(0) -#else -# define MPFR_LIMB_ONE ((mp_limb_t) 1L) -# define MPFR_LIMB_ZERO ((mp_limb_t) 0L) -#endif +#define MPFR_LIMB_MSB(l) ((l) & MPFR_LIMB_HIGHBIT) /* Mask for the low 's' bits of a limb */ -#define MPFR_LIMB_MASK(s) ((MPFR_LIMB_ONE<<(s))-MPFR_LIMB_ONE) - +#define MPFR_LIMB_MASK(s) ((MPFR_LIMB_ONE << (s)) - MPFR_LIMB_ONE) /****************************************************** - ********************** Memory ************************ + ********************** Memory ********************** ******************************************************/ -/* Heap Memory gestion */ +#define MPFR_BYTES_PER_MP_LIMB (GMP_NUMB_BITS/CHAR_BIT) + +/* Heap memory handling + -------------------- + Memory allocated for a significand (mantissa) has the following + format: + * A mp_size_t in a mpfr_size_limb_t union (see below). + * An array of mp_limb_t (not all of them are necessarily used, + as the precision can change without a reallocation). + The goal of the mpfr_size_limb_t union is to make sure that + size and alignment requirements are satisfied if mp_size_t and + mp_limb_t have different sizes and/or alignment requirements. + Moreover, pointer conversions are not fully specified by the + C standard, and the use of a union (and the double casts below) + might help even if mp_size_t and mp_limb_t have the same size + and the same alignment requirements. Still, there is currently + no guarantee that this code is portable. Note that union members + are not used at all. +*/ typedef union { mp_size_t s; mp_limb_t l; } mpfr_size_limb_t; #define MPFR_GET_ALLOC_SIZE(x) \ - ( ((mp_size_t*) MPFR_MANT(x))[-1] + 0) + (((mp_size_t *) (mpfr_size_limb_t *) MPFR_MANT(x))[-1] + 0) #define MPFR_SET_ALLOC_SIZE(x, n) \ - ( ((mp_size_t*) MPFR_MANT(x))[-1] = n) + (((mp_size_t *) (mpfr_size_limb_t *) MPFR_MANT(x))[-1] = (n)) #define MPFR_MALLOC_SIZE(s) \ - ( sizeof(mpfr_size_limb_t) + MPFR_BYTES_PER_MP_LIMB * ((size_t) s) ) + (sizeof(mpfr_size_limb_t) + MPFR_BYTES_PER_MP_LIMB * (size_t) (s)) #define MPFR_SET_MANT_PTR(x,p) \ - (MPFR_MANT(x) = (mp_limb_t*) ((mpfr_size_limb_t*) p + 1)) + (MPFR_MANT(x) = (mp_limb_t *) ((mpfr_size_limb_t *) (p) + 1)) #define MPFR_GET_REAL_PTR(x) \ - ((mp_limb_t*) ((mpfr_size_limb_t*) MPFR_MANT(x) - 1)) + ((mp_limb_t *) ((mpfr_size_limb_t *) MPFR_MANT(x) - 1)) -/* Temporary memory gestion */ +/* Temporary memory handling */ #ifndef TMP_SALLOC /* GMP 4.1.x or below or internals */ #define MPFR_TMP_DECL TMP_DECL @@ -1006,19 +1169,6 @@ #define MPFR_TMP_FREE(x) TMP_FREE #endif -/* This code is experimental: don't use it */ -#ifdef MPFR_USE_OWN_MPFR_TMP_ALLOC -extern unsigned char *mpfr_stack; -#undef MPFR_TMP_DECL -#undef MPFR_TMP_MARK -#undef MPFR_TMP_ALLOC -#undef MPFR_TMP_FREE -#define MPFR_TMP_DECL(_x) unsigned char *(_x) -#define MPFR_TMP_MARK(_x) ((_x) = mpfr_stack) -#define MPFR_TMP_ALLOC(_s) (mpfr_stack += (_s), mpfr_stack - (_s)) -#define MPFR_TMP_FREE(_x) (mpfr_stack = (_x)) -#endif - #define MPFR_TMP_LIMBS_ALLOC(N) \ ((mp_limb_t *) MPFR_TMP_ALLOC ((size_t) (N) * MPFR_BYTES_PER_MP_LIMB)) @@ -1041,51 +1191,132 @@ MPFR_SET_POS(d), \ MPFR_EXP(d) = MPFR_EXP(s)) +#define MPFR_TMP_INIT_NEG(d, s) \ + ( MPFR_PREC(d) = MPFR_PREC(s), \ + MPFR_MANT(d) = MPFR_MANT(s), \ + MPFR_SET_OPPOSITE_SIGN(d,s), \ + MPFR_EXP(d) = MPFR_EXP(s)) /****************************************************** - ***************** Cache macros ********************** + ******************* Cache macros ******************* ******************************************************/ +/* Cache struct */ #define mpfr_const_pi(_d,_r) mpfr_cache(_d, __gmpfr_cache_const_pi,_r) #define mpfr_const_log2(_d,_r) mpfr_cache(_d, __gmpfr_cache_const_log2, _r) #define mpfr_const_euler(_d,_r) mpfr_cache(_d, __gmpfr_cache_const_euler, _r) #define mpfr_const_catalan(_d,_r) mpfr_cache(_d,__gmpfr_cache_const_catalan,_r) +/* Declare a global cache for a MPFR constant. + If the shared cache is enabled, and if the constructor/destructor + attributes are available, we need to initialize the shared lock of + the cache with a constructor. It is the goal of the macro + MPFR_DEFERRED_INIT_MASTER_DECL. + FIXME: When MPFR is built with shared cache, the field "lock" is + not explicitly initialized, which can yield a warning, e.g. with + GCC's -Wmissing-field-initializers (and an error with -Werror). + Since one does not know what is behind the associated typedef name, + one cannot provide an explicit initialization for such a type. Two + possible solutions: + 1. Encapsulate the type in a structure or a union and use the + universal zero initializer: { 0 } + But: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80454 + 2. Use designated initializers when supported. But this needs a + configure test. +*/ #define MPFR_DECL_INIT_CACHE(_cache,_func) \ - MPFR_THREAD_ATTR mpfr_cache_t _cache = \ - {{{{0,MPFR_SIGN_POS,0,(mp_limb_t*)0}},0,_func}} - - + MPFR_DEFERRED_INIT_MASTER_DECL(_func, \ + MPFR_LOCK_INIT( (_cache)->lock), \ + MPFR_LOCK_CLEAR((_cache)->lock)) \ + MPFR_CACHE_ATTR mpfr_cache_t _cache = {{ \ + {{ 0, MPFR_SIGN_POS, 0, (mp_limb_t *) 0 }}, 0, _func \ + MPFR_DEFERRED_INIT_SLAVE_VALUE(_func) \ + }}; \ + MPFR_MAKE_VARFCT (mpfr_cache_t,_cache) /****************************************************** - ******************* Threshold *********************** + *************** Threshold parameters *************** ******************************************************/ #include "mparam.h" + /****************************************************** - ***************** Useful macros ********************* + ****************** Useful macros ******************* ******************************************************/ /* Theses macros help the compiler to determine if a test is likely or unlikely. The !! is necessary in case x is larger than a long. */ -#if __MPFR_GNUC(3,0) || __MPFR_ICC(8,1,0) -# define MPFR_LIKELY(x) (__builtin_expect(!!(x),1)) -# define MPFR_UNLIKELY(x) (__builtin_expect(!!(x),0)) +#if defined MPFR_DEBUG_PREDICTION && __MPFR_GNUC(3,0) + +/* Code to debug branch prediction, based on Ulrich Drepper's paper + * "What Every Programmer Should Know About Memory": + * http://people.freebsd.org/~lstewart/articles/cpumemory.pdf + */ +asm (".section predict_data, \"aw\"; .previous\n" + ".section predict_line, \"a\"; .previous\n" + ".section predict_file, \"a\"; .previous"); +# if defined __x86_64__ +# define MPFR_DEBUGPRED__(e,E) \ + ({ long _e = !!(e); \ + asm volatile (".pushsection predict_data\n" \ + "..predictcnt%=: .quad 0; .quad 0\n" \ + ".section predict_line; .quad %c1\n" \ + ".section predict_file; .quad %c2; .popsection\n" \ + "addq $1,..predictcnt%=(,%0,8)" \ + : : "r" (_e == E), "i" (__LINE__), "i" (__FILE__)); \ + __builtin_expect (_e, E); \ + }) +# elif defined __i386__ +# define MPFR_DEBUGPRED__(e,E) \ + ({ long _e = !!(e); \ + asm volatile (".pushsection predict_data\n" \ + "..predictcnt%=: .long 0; .long 0\n" \ + ".section predict_line; .long %c1\n" \ + ".section predict_file; .long %c2; .popsection\n" \ + "incl ..predictcnt%=(,%0,4)" \ + : : "r" (_e == E), "i" (__LINE__), "i" (__FILE__)); \ + __builtin_expect (_e, E); \ + }) +# else +# error "MPFR_DEBUGPRED__ definition missing" +# endif + +# define MPFR_LIKELY(x) MPFR_DEBUGPRED__ ((x), 1) +# define MPFR_UNLIKELY(x) MPFR_DEBUGPRED__ ((x), 0) + +#elif __MPFR_GNUC(3,0) || __MPFR_ICC(8,1,0) + +# define MPFR_LIKELY(x) (__builtin_expect(!!(x), 1)) +# define MPFR_UNLIKELY(x) (__builtin_expect(!!(x), 0)) + #else + # define MPFR_LIKELY(x) (x) # define MPFR_UNLIKELY(x) (x) + #endif /* Declare that some variable is initialized before being used (without a dummy initialization) in order to avoid some compiler warnings. Use the - VAR = VAR trick (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36296) - only with gcc as this is undefined behavior, and we don't know what - other compilers do (they may also be smarter). This trick could be - disabled with future gcc versions. */ -#if defined(__GNUC__) + VAR = VAR trick (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36296#c3) + only with gcc as this is undefined behavior, and we don't know what other + compilers do (they may also be smarter). This self-initialization trick + could be disabled with future gcc versions. + However, for clang (which defines __GNUC__), this trick must not be used + as it currently generates a warning, at least with: + Debian clang version 3.0-6.2 (tags/RELEASE_30/final) (based on LLVM 3.0) + __VERSION__ "4.2.1 Compatible Debian Clang 3.0 (tags/RELEASE_30/final)" + __clang__ 1 + __clang_major__ 3 + __clang_minor__ 0 + __clang_patchlevel__ 0 + __clang_version__ "3.0 (tags/RELEASE_30/final)" + (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=705583 for this + problem with clang). */ +#if defined(__GNUC__) && !defined(__clang__) # define INITIALIZED(VAR) VAR = VAR #else # define INITIALIZED(VAR) VAR @@ -1097,6 +1328,16 @@ * Computes ceil(log2(x)) only for x integer (unsigned long) * Undefined if x is 0 */ #if __MPFR_GNUC(2,95) || __MPFR_ICC(8,1,0) +/* Note: This macro MPFR_INT_CEIL_LOG2 shouldn't be used in an MPFR_ASSERT* + macro, either directly or indirectly via other macros, otherwise it can + yield an error due to a too large stringized expression in ASSERT_FAIL. + A static inline function could be a better solution than this macro. */ +/* FIXME: The current code assumes that x fits in an unsigned long + (used by __gmpfr_int_ceil_log2) while MPFR_INT_CEIL_LOG2 is used on + values that might be larger than ULONG_MAX on some platforms and/or + with some build options; a loop could be used if x > ULONG_MAX. If + the type of x is <= unsigned long, then no additional code will be + generated thanks to obvious compiler optimization. */ # define MPFR_INT_CEIL_LOG2(x) \ (MPFR_UNLIKELY ((x) == 1) ? 0 : \ __extension__ ({ int _b; mp_limb_t _limb; \ @@ -1106,7 +1347,8 @@ count_leading_zeros (_b, _limb); \ (GMP_NUMB_BITS - _b); })) #else -# define MPFR_INT_CEIL_LOG2(x) (__gmpfr_int_ceil_log2(x)) +# define MPFR_INT_CEIL_LOG2(x) \ + (MPFR_ASSERTN (x <= ULONG_MAX), __gmpfr_int_ceil_log2(x)) #endif /* Add two integers with overflow handling */ @@ -1165,35 +1407,33 @@ } \ while (0) -/* Use it only for debug reasons */ -/* MPFR_TRACE (operation) : execute operation iff DEBUG flag is set */ -/* MPFR_DUMP (x) : print x (a mpfr_t) on stdout */ -#ifdef DEBUG -# define MPFR_TRACE(x) x -#else -# define MPFR_TRACE(x) (void) 0 -#endif -#define MPFR_DUMP(x) ( printf(#x"="), mpfr_dump(x) ) - /* Test if X (positive) is a power of 2 */ #define IS_POW2(X) (((X) & ((X) - 1)) == 0) #define NOT_POW2(X) (((X) & ((X) - 1)) != 0) -/* Safe absolute value (to avoid possible integer overflow) */ +/* Safe absolute value and difference (to avoid possible integer overflow) */ /* type is the target (unsigned) type */ #define SAFE_ABS(type,x) ((x) >= 0 ? (type)(x) : -(type)(x)) +#define SAFE_DIFF(type,x,y) (MPFR_ASSERTD((x) >= (y)), (type)(x) - (type)(y)) + +/* Check whether an integer type (after integer promotion) is signed. + This can be determined at compilation time, but unfortunately this + is not a constant expression, so that this cannot be used for a + static assertion. */ +#define IS_SIGNED(X) ((X) * 0 - 1 < 0) #define mpfr_get_d1(x) mpfr_get_d(x,__gmpfr_default_rounding_mode) /* Store in r the size in bits of the mpz_t z */ -#define MPFR_MPZ_SIZEINBASE2(r, z) \ - do { \ - int _cnt; \ - mp_size_t _size; \ - MPFR_ASSERTD (mpz_sgn (z) != 0); \ - _size = ABSIZ(z); \ - count_leading_zeros (_cnt, PTR(z)[_size-1]); \ - (r) = _size * GMP_NUMB_BITS - _cnt; \ +#define MPFR_MPZ_SIZEINBASE2(r, z) \ + do { \ + int _cnt; \ + mp_size_t _size; \ + MPFR_ASSERTD (mpz_sgn (z) != 0); \ + _size = ABSIZ(z); \ + MPFR_ASSERTD (_size >= 1); \ + count_leading_zeros (_cnt, PTR(z)[_size-1]); \ + (r) = (mp_bitcnt_t) _size * GMP_NUMB_BITS - _cnt; \ } while (0) /* MPFR_LCONV_DPTS can also be forced to 0 or 1 by the user. */ @@ -1207,15 +1447,28 @@ # endif #endif +/* FIXME: Add support for multibyte decimal_point and thousands_sep since + this can be found in practice: https://reviews.llvm.org/D27167 says: + "I found this problem on FreeBSD 11, where thousands_sep in fr_FR.UTF-8 + is a no-break space (U+00A0)." + Note, however, that this is not allowed by the C standard, which just + says "character" and not "multibyte character". + In the mean time, in case of non-single-byte character, revert to the + default value. */ #if MPFR_LCONV_DPTS #include /* Warning! In case of signed char, the value of MPFR_DECIMAL_POINT may be negative (the ISO C99 does not seem to forbid negative values). */ -#define MPFR_DECIMAL_POINT (localeconv()->decimal_point[0]) -#define MPFR_THOUSANDS_SEPARATOR (localeconv()->thousands_sep[0]) +#define MPFR_DECIMAL_POINT \ + (localeconv()->decimal_point[1] != '\0' ? \ + (char) '.' : localeconv()->decimal_point[0]) +#define MPFR_THOUSANDS_SEPARATOR \ + (localeconv()->thousands_sep[0] == '\0' || \ + localeconv()->thousands_sep[1] != '\0' ? \ + (char) '\0' : localeconv()->thousands_sep[0]) #else #define MPFR_DECIMAL_POINT ((char) '.') -#define MPFR_THOUSANDS_SEPARATOR ('\0') +#define MPFR_THOUSANDS_SEPARATOR ((char) '\0') #endif @@ -1235,9 +1488,15 @@ MPFR_MANT(y) = MPFR_MANT(x); \ } while (0) +/* Size of an array, as a constant expression. */ +#define numberof_const(x) (sizeof (x) / sizeof ((x)[0])) + +/* Addition with carry (detected by GCC and other good compilers). */ +#define ADD_LIMB(u,v,c) ((u) += (v), (c) = (u) < (v)) + /****************************************************** - ************** Save exponent macros **************** + ************ Save exponent/flags macros ************ ******************************************************/ /* See README.dev for details on how to use the macros. @@ -1245,7 +1504,7 @@ temporarily */ typedef struct { - unsigned int saved_flags; + mpfr_flags_t saved_flags; mpfr_exp_t saved_emin; mpfr_exp_t saved_emax; } mpfr_save_expo_t; @@ -1270,13 +1529,13 @@ /* Speed up final checking */ #define mpfr_check_range(x,t,r) \ - (MPFR_LIKELY (MPFR_EXP (x) >= __gmpfr_emin && MPFR_EXP (x) <= __gmpfr_emax) \ - ? ((t) ? (__gmpfr_flags |= MPFR_FLAGS_INEXACT, (t)) : 0) \ - : mpfr_check_range(x,t,r)) + (MPFR_LIKELY (MPFR_EXP_IN_RANGE (MPFR_EXP (x))) \ + ? ((t) ? (__gmpfr_flags |= MPFR_FLAGS_INEXACT, (t)) : 0) \ + : mpfr_check_range(x,t,r)) /****************************************************** - ***************** Inline Rounding ******************* + ***************** Inline rounding ****************** ******************************************************/ /* @@ -1290,6 +1549,10 @@ * In rounding to nearest mode, execute MIDDLE_HANDLER when the value * is the middle of two consecutive numbers in dest precision. * Execute OVERFLOW_HANDLER in case of overflow when rounding. + * + * Note: the exponent field of dest is not used, possibly except by the + * handlers. It is the caller (via the handlers) who entirely decides + * how to handle it. */ #define MPFR_RNDRAW_GEN(inexact, dest, srcp, sprec, rnd, sign, \ MIDDLE_HANDLER, OVERFLOW_HANDLER) \ @@ -1301,6 +1564,8 @@ /* Check Trivial Case when Dest Mantissa has more bits than source */ \ _srcprec = (sprec); \ _destprec = MPFR_PREC (dest); \ + MPFR_ASSERTD (_srcprec >= MPFR_PREC_MIN); \ + MPFR_ASSERTD (_destprec >= MPFR_PREC_MIN); \ _destp = MPFR_MANT (dest); \ if (MPFR_UNLIKELY (_destprec >= _srcprec)) \ { \ @@ -1337,9 +1602,8 @@ _mask = MPFR_LIMB_ONE << (_sh - 1); \ _rb = _sp[0] & _mask; \ _sb = _sp[0] & (_mask - 1); \ - if (MPFR_UNLIKELY (_sb == 0) && \ - ((rnd) == MPFR_RNDN || _rb == 0)) \ - { /* TODO: Improve it */ \ + if ((rnd) == MPFR_RNDN || _rb == 0) \ + { \ mp_limb_t *_tmp; \ mp_size_t _n; \ for (_tmp = _sp, _n = _srcs - _dests ; \ @@ -1354,8 +1618,7 @@ /* Compute Rounding Bit and Sticky Bit - see note above */ \ _rb = _sp[-1] & MPFR_LIMB_HIGHBIT; \ _sb = _sp[-1] & (MPFR_LIMB_HIGHBIT-1); \ - if (MPFR_UNLIKELY (_sb == 0) && \ - ((rnd) == MPFR_RNDN || _rb == 0)) \ + if ((rnd) == MPFR_RNDN || _rb == 0) \ { \ mp_limb_t *_tmp; \ mp_size_t _n; \ @@ -1366,7 +1629,12 @@ _ulp = MPFR_LIMB_ONE; \ } \ /* Rounding */ \ - if (MPFR_LIKELY (rnd == MPFR_RNDN)) \ + if (rnd == MPFR_RNDF) \ + { \ + inexact = 0; \ + goto trunc_doit; \ + } \ + else if (rnd == MPFR_RNDN) \ { \ if (_rb == 0) \ { \ @@ -1397,8 +1665,7 @@ } \ else \ { /* Directed rounding mode */ \ - if (MPFR_LIKELY (MPFR_IS_LIKE_RNDZ (rnd, \ - MPFR_IS_NEG_SIGN (sign)))) \ + if (MPFR_IS_LIKE_RNDZ (rnd, MPFR_IS_NEG_SIGN (sign))) \ goto trunc; \ else if (MPFR_UNLIKELY ((_sb | _rb) == 0)) \ { \ @@ -1457,10 +1724,10 @@ /* Copy the sign and the significand, and handle the exponent in exp. */ #define MPFR_SETRAW(inexact,dest,src,exp,rnd) \ - if (MPFR_UNLIKELY (dest != src)) \ + if (dest != src) \ { \ MPFR_SET_SIGN (dest, MPFR_SIGN (src)); \ - if (MPFR_LIKELY (MPFR_PREC (dest) == MPFR_PREC (src))) \ + if (MPFR_PREC (dest) == MPFR_PREC (src)) \ { \ MPN_COPY (MPFR_MANT (dest), MPFR_MANT (src), \ MPFR_LIMB_SIZE (src)); \ @@ -1532,7 +1799,7 @@ if (MPFR_UNLIKELY (_err > MPFR_PREC (_y) + 1)) \ { \ int _inexact; \ - mpfr_clear_flags (); \ + MPFR_CLEAR_FLAGS (); \ _inexact = mpfr_round_near_x (_y,(v),_err,(dir),(rnd)); \ if (_inexact != 0) \ { \ @@ -1545,15 +1812,31 @@ } \ } while (0) + /****************************************************** - *************** Ziv Loop Macro ********************* + ***************** Ziv loop macros ****************** ******************************************************/ +/* To safely increase some precision, detecting integer overflows. + This macro is particularly useful when determining the initial + working precision before Ziv's loop. P is a precision, X is an + arbitrary nonnegative integer. + Note: On 2012-02-23, the MPFR_PREC_MAX value has been decreased + by 256 from the maximum value representable in the mpfr_prec_t + type, in order to avoid some integer overflows when this macro + is not used (if the result is larger than MPFR_PREC_MAX, this + should be detected with a later assertion, e.g. in mpfr_init2). + But this change is mainly for existing code that has not been + updated yet. So, it is advised to always use MPFR_ADD_PREC if + the result can be larger than MPFR_PREC_MAX. */ +#define MPFR_ADD_PREC(P,X) \ + (MPFR_ASSERTN ((X) <= MPFR_PREC_MAX - (P)), (P) + (X)) + #ifndef MPFR_USE_LOGGING #define MPFR_ZIV_DECL(_x) mpfr_prec_t _x #define MPFR_ZIV_INIT(_x, _p) (_x) = GMP_NUMB_BITS -#define MPFR_ZIV_NEXT(_x, _p) ((_p) += (_x), (_x) = (_p)/2) +#define MPFR_ZIV_NEXT(_x, _p) ((_p) = MPFR_ADD_PREC (_p, _x), (_x) = (_p)/2) #define MPFR_ZIV_FREE(x) #else @@ -1579,11 +1862,15 @@ static const char *_x ## _fname = __func__; \ auto void __attribute__ ((destructor)) x ## _f (void); \ void __attribute__ ((destructor)) x ## _f (void) { \ - if (_x ## _loop != 0 && (MPFR_LOG_STAT_F & mpfr_log_type)) \ + if (_x ## _loop != 0 && (MPFR_LOG_STAT_F & mpfr_log_type)) { \ fprintf (mpfr_log_file, \ "%s: Ziv failed %2.2f%% (%lu bad cases / %lu calls)\n", \ _x ## _fname, (double) 100.0 * _x ## _bad / _x ## _loop, \ - _x ## _bad, _x ## _loop ); } + _x ## _bad, _x ## _loop ); \ + if (mpfr_log_flush) \ + fflush (mpfr_log_file); \ + } \ + } #define MPFR_ZIV_INIT(_x, _p) \ do \ @@ -1591,43 +1878,36 @@ (_x) = GMP_NUMB_BITS; \ if (mpfr_log_level >= 0) \ _x ## _loop ++; \ - if ((MPFR_LOG_BADCASE_F & mpfr_log_type) && \ - (mpfr_log_current <= mpfr_log_level)) \ - LOG_PRINT ("%s:ZIV 1st prec=%Pd\n", \ - __func__, (mpfr_prec_t) (_p)); \ + LOG_PRINT (MPFR_LOG_BADCASE_F, "%s:ZIV 1st prec=%Pd\n", \ + __func__, (mpfr_prec_t) (_p)); \ } \ while (0) #define MPFR_ZIV_NEXT(_x, _p) \ do \ { \ - (_p) += (_x); \ + (_p) = MPFR_ADD_PREC (_p, _x); \ (_x) = (_p) / 2; \ if (mpfr_log_level >= 0) \ _x ## _bad += (_x ## _cpt == 1); \ _x ## _cpt ++; \ - if ((MPFR_LOG_BADCASE_F & mpfr_log_type) && \ - (mpfr_log_current <= mpfr_log_level)) \ - LOG_PRINT ("%s:ZIV new prec=%Pd\n", \ - __func__, (mpfr_prec_t) (_p)); \ + LOG_PRINT (MPFR_LOG_BADCASE_F, "%s:ZIV new prec=%Pd\n", \ + __func__, (mpfr_prec_t) (_p)); \ } \ while (0) #define MPFR_ZIV_FREE(_x) \ do \ - { \ - if ((MPFR_LOG_BADCASE_F & mpfr_log_type) && _x ## _cpt > 1 && \ - (mpfr_log_current <= mpfr_log_level)) \ - fprintf (mpfr_log_file, "%s:ZIV %d loops\n", \ + if (_x ## _cpt > 1) \ + LOG_PRINT (MPFR_LOG_BADCASE_F, "%s:ZIV %d loops\n", \ __func__, _x ## _cpt); \ - } \ while (0) #endif /****************************************************** - *************** Logging Macros ********************* + ****************** Logging macros ****************** ******************************************************/ /* The different kind of LOG */ @@ -1654,6 +1934,7 @@ #endif __MPFR_DECLSPEC extern FILE *mpfr_log_file; +__MPFR_DECLSPEC extern int mpfr_log_flush; __MPFR_DECLSPEC extern int mpfr_log_type; __MPFR_DECLSPEC extern int mpfr_log_level; __MPFR_DECLSPEC extern int mpfr_log_current; @@ -1665,41 +1946,34 @@ /* LOG_PRINT calls mpfr_fprintf on mpfr_log_file with logging disabled (recursive logging is not wanted and freezes MPFR). */ -#define LOG_PRINT(format, ...) \ +#define LOG_PRINT(type, format, ...) \ do \ - { \ - int old_level = mpfr_log_level; \ - mpfr_log_level = -1; /* disable logging in mpfr_fprintf */ \ - __gmpfr_cache_const_pi = __gmpfr_logging_pi; \ - __gmpfr_cache_const_log2 = __gmpfr_logging_log2; \ - mpfr_fprintf (mpfr_log_file, format, __VA_ARGS__); \ - mpfr_log_level = old_level; \ - __gmpfr_cache_const_pi = __gmpfr_normal_pi; \ - __gmpfr_cache_const_log2 = __gmpfr_normal_log2; \ - } \ + if ((mpfr_log_type & (type)) && mpfr_log_current <= mpfr_log_level) \ + { \ + int old_level = mpfr_log_level; \ + mpfr_log_level = -1; /* disable logging in mpfr_fprintf */ \ + __gmpfr_cache_const_pi = __gmpfr_logging_pi; \ + __gmpfr_cache_const_log2 = __gmpfr_logging_log2; \ + mpfr_fprintf (mpfr_log_file, format, __VA_ARGS__); \ + if (mpfr_log_flush) \ + fflush (mpfr_log_file); \ + mpfr_log_level = old_level; \ + __gmpfr_cache_const_pi = __gmpfr_normal_pi; \ + __gmpfr_cache_const_log2 = __gmpfr_normal_log2; \ + } \ while (0) #define MPFR_LOG_VAR(x) \ - do \ - if ((MPFR_LOG_INTERNAL_F & mpfr_log_type) && \ - (mpfr_log_current <= mpfr_log_level)) \ - LOG_PRINT ("%s.%d:%s[%#Pu]=%.*Rg\n", __func__, __LINE__, \ - #x, mpfr_get_prec (x), mpfr_log_prec, x); \ - while (0) + LOG_PRINT (MPFR_LOG_INTERNAL_F, "%s.%d:%s[%#Pu]=%.*Rg\n", __func__, \ + __LINE__, #x, mpfr_get_prec (x), mpfr_log_prec, x) #define MPFR_LOG_MSG2(format, ...) \ - do \ - if ((MPFR_LOG_MSG_F & mpfr_log_type) && \ - (mpfr_log_current <= mpfr_log_level)) \ - LOG_PRINT ("%s.%d: "format, __func__, __LINE__, __VA_ARGS__); \ - while (0) + LOG_PRINT (MPFR_LOG_MSG_F, "%s.%d: "format, __func__, __LINE__, __VA_ARGS__) #define MPFR_LOG_MSG(x) MPFR_LOG_MSG2 x #define MPFR_LOG_BEGIN2(format, ...) \ mpfr_log_current ++; \ - if ((MPFR_LOG_INPUT_F & mpfr_log_type) && \ - (mpfr_log_current <= mpfr_log_level)) \ - LOG_PRINT ("%s:IN "format"\n", __func__, __VA_ARGS__); \ + LOG_PRINT (MPFR_LOG_INPUT_F, "%s:IN "format"\n", __func__, __VA_ARGS__); \ if ((MPFR_LOG_TIME_F & mpfr_log_type) && \ (mpfr_log_current <= mpfr_log_level)) \ __gmpfr_log_time = mpfr_get_cputime (); @@ -1708,13 +1982,10 @@ MPFR_LOG_BEGIN2 x #define MPFR_LOG_END2(format, ...) \ - if ((MPFR_LOG_TIME_F & mpfr_log_type) && \ - (mpfr_log_current <= mpfr_log_level)) \ - fprintf (mpfr_log_file, "%s:TIM %dms\n", __mpfr_log_fname, \ + LOG_PRINT (MPFR_LOG_TIME_F, "%s:TIM %dms\n", __mpfr_log_fname, \ mpfr_get_cputime () - __gmpfr_log_time); \ - if ((MPFR_LOG_OUTPUT_F & mpfr_log_type) && \ - (mpfr_log_current <= mpfr_log_level)) \ - LOG_PRINT ("%s:OUT "format"\n", __mpfr_log_fname, __VA_ARGS__); \ + LOG_PRINT (MPFR_LOG_OUTPUT_F, "%s:OUT "format"\n", __mpfr_log_fname, \ + __VA_ARGS__); \ mpfr_log_current --; #define MPFR_LOG_END(x) \ static const char *__mpfr_log_fname = __func__; \ @@ -1762,9 +2033,9 @@ MPFR_LOG_MSG (("GROUP_CLEAR: ptr = 0x%lX, size = %lu\n", \ (unsigned long) (g).mant, \ (unsigned long) (g).alloc)); \ - if (MPFR_UNLIKELY ((g).alloc != 0)) { \ + if ((g).alloc != 0) { \ MPFR_ASSERTD ((g).mant != (g).tab); \ - (*__gmp_free_func) ((g).mant, (g).alloc); \ + mpfr_free_func ((g).mant, (g).alloc); \ }} while (0) #define MPFR_GROUP_INIT_TEMPLATE(g, prec, num, handler) do { \ @@ -1774,10 +2045,10 @@ if (MPFR_UNLIKELY (_prec > MPFR_PREC_MAX)) \ mpfr_abort_prec_max (); \ _size = MPFR_PREC2LIMBS (_prec); \ - if (MPFR_UNLIKELY (_size * (num) > MPFR_GROUP_STATIC_SIZE)) \ + if (_size * (num) > MPFR_GROUP_STATIC_SIZE) \ { \ (g).alloc = (num) * _size * sizeof (mp_limb_t); \ - (g).mant = (mp_limb_t *) (*__gmp_allocate_func) ((g).alloc); \ + (g).mant = (mp_limb_t *) mpfr_allocate_func ((g).alloc); \ } \ else \ { \ @@ -1826,11 +2097,11 @@ mpfr_abort_prec_max (); \ _size = MPFR_PREC2LIMBS (_prec); \ (g).alloc = (num) * _size * sizeof (mp_limb_t); \ - if (MPFR_LIKELY (_oalloc == 0)) \ - (g).mant = (mp_limb_t *) (*__gmp_allocate_func) ((g).alloc); \ + if (_oalloc == 0) \ + (g).mant = (mp_limb_t *) mpfr_allocate_func ((g).alloc); \ else \ (g).mant = (mp_limb_t *) \ - (*__gmp_reallocate_func) ((g).mant, _oalloc, (g).alloc); \ + mpfr_reallocate_func ((g).mant, _oalloc, (g).alloc); \ MPFR_LOG_MSG (("GROUP_REPREC: newptr = 0x%lX, newsize = %lu\n", \ (unsigned long) (g).mant, (unsigned long) (g).alloc)); \ handler; \ @@ -1862,140 +2133,283 @@ /****************************************************** - *************** Internal Functions ***************** + *************** Internal functions ***************** ******************************************************/ #if defined (__cplusplus) extern "C" { #endif -__MPFR_DECLSPEC int mpfr_underflow _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t, int)); -__MPFR_DECLSPEC int mpfr_overflow _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t, int)); - -__MPFR_DECLSPEC int mpfr_add1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_sub1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_add1sp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_sub1sp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_can_round_raw _MPFR_PROTO ((const mp_limb_t *, - mp_size_t, int, mpfr_exp_t, mpfr_rnd_t, mpfr_rnd_t, mpfr_prec_t)); - -__MPFR_DECLSPEC int mpfr_cmp2 _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr, - mpfr_prec_t *)); - -__MPFR_DECLSPEC long __gmpfr_ceil_log2 _MPFR_PROTO ((double)); -__MPFR_DECLSPEC long __gmpfr_floor_log2 _MPFR_PROTO ((double)); -__MPFR_DECLSPEC double __gmpfr_ceil_exp2 _MPFR_PROTO ((double)); -__MPFR_DECLSPEC unsigned long __gmpfr_isqrt _MPFR_PROTO ((unsigned long)); -__MPFR_DECLSPEC unsigned long __gmpfr_cuberoot _MPFR_PROTO ((unsigned long)); -__MPFR_DECLSPEC int __gmpfr_int_ceil_log2 _MPFR_PROTO ((unsigned long)); - -__MPFR_DECLSPEC mpfr_exp_t mpfr_ceil_mul _MPFR_PROTO ((mpfr_exp_t, int, int)); - -__MPFR_DECLSPEC int mpfr_exp_2 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_exp_3 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_powerof2_raw _MPFR_PROTO ((mpfr_srcptr)); +MPFR_COLD_FUNCTION_ATTR __MPFR_DECLSPEC int + mpfr_underflow (mpfr_ptr, mpfr_rnd_t, int); +MPFR_COLD_FUNCTION_ATTR __MPFR_DECLSPEC int + mpfr_overflow (mpfr_ptr, mpfr_rnd_t, int); + +__MPFR_DECLSPEC int mpfr_add1 (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_sub1 (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_add1sp (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_sub1sp (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, + mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_can_round_raw (const mp_limb_t *, + mp_size_t, int, mpfr_exp_t, mpfr_rnd_t, mpfr_rnd_t, mpfr_prec_t); + +__MPFR_DECLSPEC int mpfr_set_1_2 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t, int); + +__MPFR_DECLSPEC int mpfr_cmp2 (mpfr_srcptr, mpfr_srcptr, mpfr_prec_t *); + +__MPFR_DECLSPEC long __gmpfr_ceil_log2 (double); +__MPFR_DECLSPEC long __gmpfr_floor_log2 (double); +__MPFR_DECLSPEC double __gmpfr_ceil_exp2 (double); +__MPFR_DECLSPEC unsigned long __gmpfr_isqrt (unsigned long); +__MPFR_DECLSPEC unsigned long __gmpfr_cuberoot (unsigned long); +__MPFR_DECLSPEC int __gmpfr_int_ceil_log2 (unsigned long); + +__MPFR_DECLSPEC mpfr_exp_t mpfr_ceil_mul (mpfr_exp_t, int, int); + +__MPFR_DECLSPEC int mpfr_exp_2 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_exp_3 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_powerof2_raw (mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_powerof2_raw2 (const mp_limb_t *, mp_size_t); -__MPFR_DECLSPEC int mpfr_pow_general _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_srcptr, mpfr_rnd_t, int, mpfr_save_expo_t *)); +__MPFR_DECLSPEC int mpfr_pow_general (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, + mpfr_rnd_t, int, mpfr_save_expo_t *); -__MPFR_DECLSPEC void mpfr_setmax _MPFR_PROTO ((mpfr_ptr, mpfr_exp_t)); -__MPFR_DECLSPEC void mpfr_setmin _MPFR_PROTO ((mpfr_ptr, mpfr_exp_t)); +__MPFR_DECLSPEC void mpfr_setmax (mpfr_ptr, mpfr_exp_t); +__MPFR_DECLSPEC void mpfr_setmin (mpfr_ptr, mpfr_exp_t); -__MPFR_DECLSPEC long mpfr_mpn_exp _MPFR_PROTO ((mp_limb_t *, mpfr_exp_t *, int, - mpfr_exp_t, size_t)); +__MPFR_DECLSPEC long mpfr_mpn_exp (mp_limb_t *, mpfr_exp_t *, int, + mpfr_exp_t, size_t); #ifdef _MPFR_H_HAVE_FILE -__MPFR_DECLSPEC void mpfr_fprint_binary _MPFR_PROTO ((FILE *, mpfr_srcptr)); +__MPFR_DECLSPEC void mpfr_fdump (FILE *, mpfr_srcptr); #endif -__MPFR_DECLSPEC void mpfr_print_binary _MPFR_PROTO ((mpfr_srcptr)); -__MPFR_DECLSPEC void mpfr_print_mant_binary _MPFR_PROTO ((const char*, - const mp_limb_t*, mpfr_prec_t)); -__MPFR_DECLSPEC void mpfr_set_str_binary _MPFR_PROTO((mpfr_ptr, const char*)); - -__MPFR_DECLSPEC int mpfr_round_raw _MPFR_PROTO ((mp_limb_t *, - const mp_limb_t *, mpfr_prec_t, int, mpfr_prec_t, mpfr_rnd_t, int *)); -__MPFR_DECLSPEC int mpfr_round_raw_2 _MPFR_PROTO ((const mp_limb_t *, - mpfr_prec_t, int, mpfr_prec_t, mpfr_rnd_t)); +__MPFR_DECLSPEC void mpfr_print_mant_binary (const char*, const mp_limb_t*, + mpfr_prec_t); +__MPFR_DECLSPEC void mpfr_set_str_binary (mpfr_ptr, const char*); + +__MPFR_DECLSPEC int mpfr_round_raw (mp_limb_t *, + const mp_limb_t *, mpfr_prec_t, int, mpfr_prec_t, mpfr_rnd_t, int *); +__MPFR_DECLSPEC int mpfr_round_raw_2 (const mp_limb_t *, mpfr_prec_t, int, + mpfr_prec_t, mpfr_rnd_t); /* No longer defined (see round_prec.c). Uncomment if it needs to be defined again. -__MPFR_DECLSPEC int mpfr_round_raw_3 _MPFR_PROTO ((const mp_limb_t *, - mpfr_prec_t, int, mpfr_prec_t, mpfr_rnd_t, int *)); +__MPFR_DECLSPEC int mpfr_round_raw_3 (const mp_limb_t *, + mpfr_prec_t, int, mpfr_prec_t, mpfr_rnd_t, int *); */ -__MPFR_DECLSPEC int mpfr_round_raw_4 _MPFR_PROTO ((mp_limb_t *, - const mp_limb_t *, mpfr_prec_t, int, mpfr_prec_t, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_round_raw_4 (mp_limb_t *, + const mp_limb_t *, mpfr_prec_t, int, mpfr_prec_t, mpfr_rnd_t); #define mpfr_round_raw2(xp, xn, neg, r, prec) \ mpfr_round_raw_2((xp),(xn)*GMP_NUMB_BITS,(neg),(prec),(r)) -__MPFR_DECLSPEC int mpfr_check _MPFR_PROTO ((mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_check (mpfr_srcptr); -__MPFR_DECLSPEC int mpfr_sum_sort _MPFR_PROTO ((mpfr_srcptr *const, - unsigned long, mpfr_srcptr *, - mpfr_prec_t *)); +__MPFR_DECLSPEC int mpfr_get_cputime (void); -__MPFR_DECLSPEC int mpfr_get_cputime _MPFR_PROTO ((void)); +__MPFR_DECLSPEC void mpfr_nexttozero (mpfr_ptr); +__MPFR_DECLSPEC void mpfr_nexttoinf (mpfr_ptr); -__MPFR_DECLSPEC void mpfr_nexttozero _MPFR_PROTO ((mpfr_ptr)); -__MPFR_DECLSPEC void mpfr_nexttoinf _MPFR_PROTO ((mpfr_ptr)); - -__MPFR_DECLSPEC int mpfr_const_pi_internal _MPFR_PROTO ((mpfr_ptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_const_log2_internal _MPFR_PROTO((mpfr_ptr,mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_const_euler_internal _MPFR_PROTO((mpfr_ptr, mpfr_rnd_t)); -__MPFR_DECLSPEC int mpfr_const_catalan_internal _MPFR_PROTO((mpfr_ptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_const_pi_internal (mpfr_ptr,mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_const_log2_internal (mpfr_ptr,mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_const_euler_internal (mpfr_ptr, mpfr_rnd_t); +__MPFR_DECLSPEC int mpfr_const_catalan_internal (mpfr_ptr, mpfr_rnd_t); #if 0 -__MPFR_DECLSPEC void mpfr_init_cache _MPFR_PROTO ((mpfr_cache_t, - int(*)(mpfr_ptr,mpfr_rnd_t))); +__MPFR_DECLSPEC void mpfr_init_cache (mpfr_cache_t, + int(*)(mpfr_ptr,mpfr_rnd_t)); #endif -__MPFR_DECLSPEC void mpfr_clear_cache _MPFR_PROTO ((mpfr_cache_t)); -__MPFR_DECLSPEC int mpfr_cache _MPFR_PROTO ((mpfr_ptr, mpfr_cache_t, - mpfr_rnd_t)); - -__MPFR_DECLSPEC void mpfr_mulhigh_n _MPFR_PROTO ((mpfr_limb_ptr, - mpfr_limb_srcptr, mpfr_limb_srcptr, mp_size_t)); -__MPFR_DECLSPEC void mpfr_mullow_n _MPFR_PROTO ((mpfr_limb_ptr, - mpfr_limb_srcptr, mpfr_limb_srcptr, mp_size_t)); -__MPFR_DECLSPEC void mpfr_sqrhigh_n _MPFR_PROTO ((mpfr_limb_ptr, - mpfr_limb_srcptr, mp_size_t)); -__MPFR_DECLSPEC mp_limb_t mpfr_divhigh_n _MPFR_PROTO ((mpfr_limb_ptr, - mpfr_limb_ptr, mpfr_limb_ptr, mp_size_t)); - -__MPFR_DECLSPEC int mpfr_round_p _MPFR_PROTO ((mp_limb_t *, mp_size_t, - mpfr_exp_t, mpfr_prec_t)); - -__MPFR_DECLSPEC void mpfr_dump_mant _MPFR_PROTO ((const mp_limb_t *, - mpfr_prec_t, mpfr_prec_t, - mpfr_prec_t)); - -__MPFR_DECLSPEC int mpfr_round_near_x _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, - mpfr_uexp_t, int, - mpfr_rnd_t)); -__MPFR_DECLSPEC void mpfr_abort_prec_max _MPFR_PROTO ((void)) - MPFR_NORETURN_ATTR; - -__MPFR_DECLSPEC void mpfr_rand_raw _MPFR_PROTO((mpfr_limb_ptr, gmp_randstate_t, - mpfr_prec_t)); - -__MPFR_DECLSPEC mpz_t* mpfr_bernoulli_internal _MPFR_PROTO((mpz_t*, - unsigned long)); - -__MPFR_DECLSPEC int mpfr_sincos_fast _MPFR_PROTO((mpfr_t, mpfr_t, - mpfr_srcptr, mpfr_rnd_t)); - -__MPFR_DECLSPEC double mpfr_scale2 _MPFR_PROTO((double, int)); - -__MPFR_DECLSPEC void mpfr_div_ui2 _MPFR_PROTO((mpfr_ptr, mpfr_srcptr, - unsigned long int, unsigned long int, - mpfr_rnd_t)); +__MPFR_DECLSPEC void mpfr_clear_cache (mpfr_cache_t); +__MPFR_DECLSPEC int mpfr_cache (mpfr_ptr, mpfr_cache_t, mpfr_rnd_t); + +__MPFR_DECLSPEC void mpfr_mulhigh_n (mpfr_limb_ptr, mpfr_limb_srcptr, + mpfr_limb_srcptr, mp_size_t); +__MPFR_DECLSPEC void mpfr_mullow_n (mpfr_limb_ptr, mpfr_limb_srcptr, + mpfr_limb_srcptr, mp_size_t); +__MPFR_DECLSPEC void mpfr_sqrhigh_n (mpfr_limb_ptr, mpfr_limb_srcptr, + mp_size_t); +__MPFR_DECLSPEC mp_limb_t mpfr_divhigh_n (mpfr_limb_ptr, mpfr_limb_ptr, + mpfr_limb_ptr, mp_size_t); + +__MPFR_DECLSPEC int mpfr_round_p (mp_limb_t *, mp_size_t, mpfr_exp_t, + mpfr_prec_t); + +__MPFR_DECLSPEC int mpfr_round_near_x (mpfr_ptr, mpfr_srcptr, mpfr_uexp_t, int, + mpfr_rnd_t); +__MPFR_DECLSPEC MPFR_COLD_FUNCTION_ATTR MPFR_NORETURN void + mpfr_abort_prec_max (void); -__MPFR_DECLSPEC void mpfr_gamma_one_and_two_third _MPFR_PROTO((mpfr_ptr, mpfr_ptr, mpfr_prec_t)); +__MPFR_DECLSPEC void mpfr_rand_raw (mpfr_limb_ptr, gmp_randstate_t, + mpfr_prec_t); + +__MPFR_DECLSPEC mpz_srcptr mpfr_bernoulli_cache (unsigned long); +__MPFR_DECLSPEC void mpfr_bernoulli_freecache (void); + +__MPFR_DECLSPEC int mpfr_sincos_fast (mpfr_t, mpfr_t, mpfr_srcptr, mpfr_rnd_t); + +__MPFR_DECLSPEC double mpfr_scale2 (double, int); + +__MPFR_DECLSPEC void mpfr_div_ui2 (mpfr_ptr, mpfr_srcptr, unsigned long, + unsigned long, mpfr_rnd_t); + +__MPFR_DECLSPEC void mpfr_gamma_one_and_two_third (mpfr_ptr, mpfr_ptr, + mpfr_prec_t); + +__MPFR_DECLSPEC void mpfr_mpz_init (mpz_ptr); +__MPFR_DECLSPEC void mpfr_mpz_init2 (mpz_t, mp_bitcnt_t); +__MPFR_DECLSPEC void mpfr_mpz_clear (mpz_ptr); + +__MPFR_DECLSPEC int mpfr_odd_p (mpfr_srcptr); + +#ifdef _MPFR_H_HAVE_VA_LIST +/* Declared only if has been included. */ +__MPFR_DECLSPEC int mpfr_vasnprintf_aux (char**, char*, size_t, const char*, + va_list); +#endif + +#if defined (__cplusplus) +} +#endif + + +/***************************************************** + *************** Internal mpz_t pool *************** + *****************************************************/ + +/* don't use the mpz_t pool with mini-gmp */ +#ifdef MPFR_USE_MINI_GMP +# define MPFR_POOL_NENTRIES 0 +#endif + +#ifndef MPFR_POOL_NENTRIES +# define MPFR_POOL_NENTRIES 32 /* default number of entries of the pool */ +#endif + +#if MPFR_POOL_NENTRIES && !defined(MPFR_POOL_DONT_REDEFINE) +# undef mpz_init +# undef mpz_init2 +# undef mpz_clear +# undef mpz_init_set_ui +# undef mpz_init_set +# define mpz_init mpfr_mpz_init +# define mpz_init2 mpfr_mpz_init2 +# define mpz_clear mpfr_mpz_clear +# define mpz_init_set_ui(a,b) do { mpz_init (a); mpz_set_ui (a, b); } while (0) +# define mpz_init_set(a,b) do { mpz_init (a); mpz_set (a, b); } while (0) +#endif + + +/****************************************************** + ******** Compute LOG2(LOG2(MPFR_PREC_MAX)) ********* + ******************************************************/ + +#if _MPFR_PREC_FORMAT == 1 +# define MPFR_PREC_MAX_TEMP USHRT_MAX +#elif _MPFR_PREC_FORMAT == 2 +# define MPFR_PREC_MAX_TEMP UINT_MAX +#elif _MPFR_PREC_FORMAT == 3 +# define MPFR_PREC_MAX_TEMP ULONG_MAX +#else +# error "Invalid MPFR Prec format" +#endif + +/* Note: In the constants below, it is sufficient to use the suffix U. + * A large enough unsigned type will be chosen automatically, but the + * exact type doesn't matter here. + */ + +#if MPFR_PREC_MAX_TEMP == 255U +# define MPFR_PREC_BITS 8 +# define MPFR_LOG2_PREC_BITS 3 +#elif MPFR_PREC_MAX_TEMP == 65535U +# define MPFR_PREC_BITS 16 +# define MPFR_LOG2_PREC_BITS 4 +#elif MPFR_PREC_MAX_TEMP == 4294967295U +# define MPFR_PREC_BITS 32 +# define MPFR_LOG2_PREC_BITS 5 +#elif MPFR_PREC_MAX_TEMP == 18446744073709551615U +# define MPFR_PREC_BITS 64 +# define MPFR_LOG2_PREC_BITS 6 +#else +# error "Unsupported MPFR_PREC_MAX_TEMP value" +#endif + + +/****************************************************** + ************* Value coverage checking ************** + ******************************************************/ + +#ifdef MPFR_COV_CHECK + +/* Variable names should start with the __gmpfr_cov_ prefix. */ + +#define MPFR_COV_SET(X) (__gmpfr_cov_ ## X = 1) + +#if defined (__cplusplus) +extern "C" { +#endif + +__MPFR_DECLSPEC extern int __gmpfr_cov_div_ui_sb[10][2]; +__MPFR_DECLSPEC extern int __gmpfr_cov_sum_tmd[MPFR_RND_MAX][2][2][3][2][2]; #if defined (__cplusplus) } #endif +#else /* MPFR_COV_CHECK */ + +#define MPFR_COV_SET(X) ((void) 0) + +#endif /* MPFR_COV_CHECK */ + + +/****************************************************** + ***************** Unbounded Floats ***************** + ******************************************************/ + +#if defined (__cplusplus) +extern "C" { +#endif + +/* An UBF is like a MPFR number, but with an additional mpz_t member, + which is assumed to be present (with a value in it) when the usual + exponent field has the value MPFR_EXP_UBF. The goal of this compatible + representation is to easily be able to support UBF in "normal" code + and hopefully avoid aliasing issues at the same time. And code that + accepts UBF in input should also accept mpfr_t as a consequence; this + makes mpfr_t to UBF conversion unnecessary. + When an input of a public function is a UBF, the semantic remains + internal to MPFR and can change in the future. + Note that functions used for logging need to support UBF (currently + done by printing that a number is a UBF, as it may be difficult to + do more without significant changes). */ + +typedef struct { + mpfr_prec_t _mpfr_prec; + mpfr_sign_t _mpfr_sign; + mpfr_exp_t _mpfr_exp; + mp_limb_t *_mpfr_d; + mpz_t _mpfr_zexp; +} __mpfr_ubf_struct; + +typedef __mpfr_ubf_struct mpfr_ubf_t[1]; +typedef __mpfr_ubf_struct *mpfr_ubf_ptr; + +__MPFR_DECLSPEC void mpfr_ubf_mul_exact (mpfr_ubf_ptr, + mpfr_srcptr, mpfr_srcptr); +__MPFR_DECLSPEC int mpfr_ubf_exp_less_p (mpfr_srcptr, mpfr_srcptr); +__MPFR_DECLSPEC mpfr_exp_t mpfr_ubf_zexp2exp (mpz_ptr); +__MPFR_DECLSPEC mpfr_exp_t mpfr_ubf_diff_exp (mpfr_srcptr, mpfr_srcptr); + +#if defined (__cplusplus) +} #endif + +#define MPFR_ZEXP(x) \ + ((void) (x)->_mpfr_exp /* to check that x has a correct type */, \ + ((mpfr_ubf_ptr) (x))->_mpfr_zexp) + +#define MPFR_UBF_CLEAR_EXP(x) \ + ((void) (MPFR_IS_UBF (x) && (mpz_clear (MPFR_ZEXP (x)), 0))) + +#endif /* __MPFR_IMPL_H__ */ diff -Nru mpfr4-3.1.4/src/mpfr-intmax.h mpfr4-4.0.2/src/mpfr-intmax.h --- mpfr4-3.1.4/src/mpfr-intmax.h 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/mpfr-intmax.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* MPFR internal header related to intmax_t. -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,24 +17,54 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __MPFR_INTMAX_H__ #define __MPFR_INTMAX_H__ /* The ISO C99 standard specifies that in C++ implementations the - INTMAX_MAX, ... macros should only be defined if explicitly requested. */ + * INTMAX_MAX, ... macros should only be defined if explicitly requested. + */ #if defined __cplusplus # define __STDC_LIMIT_MACROS # define __STDC_CONSTANT_MACROS #endif +/* The definition of MPFR_USE_INTMAX_T is needed on systems for which + * the current (non-standard) macro tests in mpfr.h is not sufficient. + * This will force the support of intmax_t/uintmax_t if + * and/or are available. This also avoids a failure in the + * tests (replace the macro tests in mpfr.h by just + * #if defined (MPFR_USE_INTMAX_T) + * to simulate such a system and reproduce the problem). + * Note: if this makes the build fail on some systems (because these + * headers are broken), we will need a configure test to undefine + * HAVE_INTTYPES_H and HAVE_STDINT_H in such a case. + */ + #if HAVE_INTTYPES_H # include +# define MPFR_USE_INTMAX_T #endif + #if HAVE_STDINT_H # include +# define MPFR_USE_INTMAX_T +#endif + +/* Largest signed integer type available for the MPFR build. */ +#if defined(MPFR_USE_INTMAX_T) +typedef intmax_t mpfr_intmax_t; +typedef uintmax_t mpfr_uintmax_t; +#elif defined(HAVE_LONG_LONG) +typedef long long mpfr_intmax_t; +typedef unsigned long long mpfr_uintmax_t; +# define MPFR_INTMAX_MAX LLONG_MAX +#else +typedef long mpfr_intmax_t; +typedef unsigned long mpfr_uintmax_t; +# define MPFR_INTMAX_MAX LONG_MAX #endif #endif diff -Nru mpfr4-3.1.4/src/mpfr-longlong.h mpfr4-4.0.2/src/mpfr-longlong.h --- mpfr4-3.1.4/src/mpfr-longlong.h 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/mpfr-longlong.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,36 +1,48 @@ /* longlong.h -- definitions for mixed size 32/64 bit arithmetic. -Copyright 1991, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003, -2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012, 2013-2016 Free Software Foundation, Inc. +Copyright 1991-1994, 1996, 1997, 1999-2005, 2007-2009, 2011-2019 Free Software Foundation, Inc. -This file is free software; you can redistribute it and/or modify it under the -terms of the GNU Lesser General Public License as published by the Free -Software Foundation; either version 3 of the License, or (at your option) any -later version. - -This file is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -details. +This file is part of the GNU MPFR Library and has been copied from +GNU MP 6.1.0 (the FIXME's come from GNU MP), except the parts marked +beginning of code specific to MPFR ... end of code specific to MPFR. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. You should have received a copy of the GNU Lesser General Public License -along with this file. If not, see http://www.gnu.org/licenses/. */ +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* You have to define the following before including this file: UWtype -- An unsigned type, default type for operations (typically a "word") - UHWtype -- An unsigned type, at least half the size of UWtype. + UHWtype -- An unsigned type, at least half the size of UWtype UDWtype -- An unsigned type, at least twice as large a UWtype W_TYPE_SIZE -- size in bits of UWtype - SItype, USItype -- Signed and unsigned 32 bit types. - DItype, UDItype -- Signed and unsigned 64 bit types. + SItype, USItype -- Signed and unsigned 32 bit types + DItype, UDItype -- Signed and unsigned 64 bit types On a 32 bit machine UWtype should typically be USItype; on a 64 bit machine, UWtype should typically be UDItype. - CAUTION! Using this file outside of GMP is not safe. You need to include - gmp.h and gmp-impl.h, or certain things might not work as expected. + Optionally, define: + + LONGLONG_STANDALONE -- Avoid code that needs machine-dependent support files + NO_ASM -- Disable inline asm + + + CAUTION! Using this version of longlong.h outside of GMP is not safe. You + need to include gmp.h and gmp-impl.h, or certain things might not work as + expected. */ #define __BITS4 (W_TYPE_SIZE / 4) @@ -44,14 +56,6 @@ #define __MPN(x) __##x #endif -#ifndef _PROTO -#if (__STDC__-0) || defined (__cplusplus) -#define _PROTO(x) x -#else -#define _PROTO(x) () -#endif -#endif - /* Define auxiliary asm macros. 1) umul_ppmm(high_prod, low_prod, multiplier, multiplicand) multiplies two @@ -71,7 +75,7 @@ 4) sdiv_qrnnd(quotient, remainder, high_numerator, low_numerator, denominator). Like udiv_qrnnd but the numbers are signed. The quotient - is rounded toward 0. + is rounded towards 0. 5) count_leading_zeros(count, x) counts the number of zero-bits from the msb to the first non-zero bit in the UWtype X. This is the number of @@ -140,35 +144,34 @@ or want. */ #ifdef _LONG_LONG_LIMB -#define count_leading_zeros_gcc_clz(count,x) \ - do { \ - ASSERT ((x) != 0); \ - (count) = __builtin_clzll (x); \ +#define count_leading_zeros_gcc_clz(count,x) \ + do { \ + ASSERT ((x) != 0); \ + (count) = __builtin_clzll (x); \ } while (0) #else -#define count_leading_zeros_gcc_clz(count,x) \ - do { \ - ASSERT ((x) != 0); \ - (count) = __builtin_clzl (x); \ +#define count_leading_zeros_gcc_clz(count,x) \ + do { \ + ASSERT ((x) != 0); \ + (count) = __builtin_clzl (x); \ } while (0) #endif #ifdef _LONG_LONG_LIMB -#define count_trailing_zeros_gcc_ctz(count,x) \ - do { \ - ASSERT ((x) != 0); \ - (count) = __builtin_ctzll (x); \ +#define count_trailing_zeros_gcc_ctz(count,x) \ + do { \ + ASSERT ((x) != 0); \ + (count) = __builtin_ctzll (x); \ } while (0) #else -#define count_trailing_zeros_gcc_ctz(count,x) \ - do { \ - ASSERT ((x) != 0); \ - (count) = __builtin_ctzl (x); \ +#define count_trailing_zeros_gcc_ctz(count,x) \ + do { \ + ASSERT ((x) != 0); \ + (count) = __builtin_ctzl (x); \ } while (0) #endif -/* Note: the following FIXME comes from GMP, thus it does make sense to try - to resolve it in MPFR. */ + /* FIXME: The macros using external routines like __MPN(count_leading_zeros) don't need to be under !NO_ASM */ #if ! defined (NO_ASM) @@ -189,7 +192,7 @@ UDItype __m0 = (m0), __m1 = (m1); \ __asm__ ("umulh %r1,%2,%0" \ : "=r" (ph) \ - : "%rJ" (m0), "rI" (m1)); \ + : "%rJ" (__m0), "rI" (__m1)); \ (pl) = __m0 * __m1; \ } while (0) #endif @@ -199,7 +202,7 @@ #define umul_ppmm(ph, pl, m0, m1) \ do { \ UDItype __m0 = (m0), __m1 = (m1); \ - (ph) = __UMULH (m0, m1); \ + (ph) = __UMULH (__m0, __m1); \ (pl) = __m0 * __m1; \ } while (0) #endif @@ -225,55 +228,64 @@ __asm__("cttz %1,%0" : "=r"(COUNT) : "r"(X)) #endif /* clz/ctz using cix */ -#if ! defined (count_leading_zeros) \ +#if ! defined (count_leading_zeros) \ && defined (__GNUC__) && ! defined (LONGLONG_STANDALONE) /* ALPHA_CMPBGE_0 gives "cmpbge $31,src,dst", ie. test src bytes == 0. "$31" is written explicitly in the asm, since an "r" constraint won't select reg 31. There seems no need to worry about "r31" syntax for cray, - since gcc itself (pre-release 3.4) emits just $31 in various places. */ -#define ALPHA_CMPBGE_0(dst, src) \ + since gcc itself (pre-release 3.4) emits just $31 in various places. */ +#define ALPHA_CMPBGE_0(dst, src) \ do { asm ("cmpbge $31, %1, %0" : "=r" (dst) : "r" (src)); } while (0) /* Zero bytes are turned into bits with cmpbge, a __clz_tab lookup counts them, locating the highest non-zero byte. A second __clz_tab lookup counts the leading zero bits in that byte, giving the result. */ -#define count_leading_zeros(count, x) \ - do { \ - UWtype __clz__b, __clz__c, __clz__x = (x); \ - ALPHA_CMPBGE_0 (__clz__b, __clz__x); /* zero bytes */ \ - __clz__b = __clz_tab [(__clz__b >> 1) ^ 0x7F]; /* 8 to 1 byte */ \ - __clz__b = __clz__b * 8 - 7; /* 57 to 1 shift */ \ - __clz__x >>= __clz__b; \ - __clz__c = __clz_tab [__clz__x]; /* 8 to 1 bit */ \ - __clz__b = 65 - __clz__b; \ - (count) = __clz__b - __clz__c; \ +#define count_leading_zeros(count, x) \ + do { \ + UWtype __clz__b, __clz__c, __clz__x = (x); \ + ALPHA_CMPBGE_0 (__clz__b, __clz__x); /* zero bytes */ \ + __clz__b = __clz_tab [(__clz__b >> 1) ^ 0x7F]; /* 8 to 1 byte */ \ + __clz__b = __clz__b * 8 - 7; /* 57 to 1 shift */ \ + __clz__x >>= __clz__b; \ + __clz__c = __clz_tab [__clz__x]; /* 8 to 1 bit */ \ + __clz__b = 65 - __clz__b; \ + (count) = __clz__b - __clz__c; \ } while (0) #define COUNT_LEADING_ZEROS_NEED_CLZ_TAB #endif /* clz using cmpbge */ #if ! defined (count_leading_zeros) && ! defined (LONGLONG_STANDALONE) #if HAVE_ATTRIBUTE_CONST -long __MPN(count_leading_zeros) _PROTO ((UDItype)) __attribute__ ((const)); +long __MPN(count_leading_zeros) (UDItype) __attribute__ ((const)); #else -long __MPN(count_leading_zeros) _PROTO ((UDItype)); +long __MPN(count_leading_zeros) (UDItype); #endif #define count_leading_zeros(count, x) \ ((count) = __MPN(count_leading_zeros) (x)) #endif /* clz using mpn */ #endif /* __alpha */ +#if defined (__AVR) && W_TYPE_SIZE == 8 +#define umul_ppmm(ph, pl, m0, m1) \ + do { \ + unsigned short __p = (unsigned short) (m0) * (m1); \ + (ph) = __p >> 8; \ + (pl) = __p; \ + } while (0) +#endif /* AVR */ + #if defined (_CRAY) && W_TYPE_SIZE == 64 #include #define UDIV_PREINV_ALWAYS 1 #define UDIV_NEEDS_NORMALIZATION 1 #define UDIV_TIME 220 -long __MPN(count_leading_zeros) _PROTO ((UDItype)); +long __MPN(count_leading_zeros) (UDItype); #define count_leading_zeros(count, x) \ ((count) = _leadz ((UWtype) (x))) #if defined (_CRAYIEEE) /* I.e., Cray T90/ieee, T3D, and T3E */ #define umul_ppmm(ph, pl, m0, m1) \ do { \ UDItype __m0 = (m0), __m1 = (m1); \ - (ph) = _int_mult_upper (m0, m1); \ + (ph) = _int_mult_upper (__m0, __m1); \ (pl) = __m0 * __m1; \ } while (0) #ifndef LONGLONG_STANDALONE @@ -292,14 +304,14 @@ code using "al #define umul_ppmm(ph, pl, m0, m1) \ do { \ - UWtype _m0 = (m0), _m1 = (m1); \ - ph = _m64_xmahu (_m0, _m1, 0); \ - pl = _m0 * _m1; \ + UWtype __m0 = (m0), __m1 = (m1); \ + ph = _m64_xmahu (__m0, __m1, 0); \ + pl = __m0 * __m1; \ } while (0) #endif #ifndef LONGLONG_STANDALONE @@ -398,26 +410,29 @@ #define COUNT_LEADING_ZEROS_0 32 #endif /* __a29k__ */ +/* MPFR: changed "J" constraint to "Cal" constraint + (https://sympa.inria.fr/sympa/arc/mpfr/2018-10/msg00010.html) */ #if defined (__arc__) #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ __asm__ ("add.f\t%1, %4, %5\n\tadc\t%0, %2, %3" \ : "=r" (sh), \ "=&r" (sl) \ : "r" ((USItype) (ah)), \ - "rIJ" ((USItype) (bh)), \ + "rICal" ((USItype) (bh)), \ "%r" ((USItype) (al)), \ - "rIJ" ((USItype) (bl))) + "rICal" ((USItype) (bl))) #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ __asm__ ("sub.f\t%1, %4, %5\n\tsbc\t%0, %2, %3" \ : "=r" (sh), \ "=&r" (sl) \ : "r" ((USItype) (ah)), \ - "rIJ" ((USItype) (bh)), \ + "rICal" ((USItype) (bh)), \ "r" ((USItype) (al)), \ - "rIJ" ((USItype) (bl))) + "rICal" ((USItype) (bl))) #endif -#if defined (__arm__) && W_TYPE_SIZE == 32 +#if defined (__arm__) && (defined (__thumb2__) || !defined (__thumb__)) \ + && W_TYPE_SIZE == 32 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ __asm__ ("adds\t%1, %4, %5\n\tadc\t%0, %2, %3" \ : "=r" (sh), "=&r" (sl) \ @@ -462,7 +477,37 @@ : "=r" (sh), "=&r" (sl) \ : "r" (ah), "rI" (bh), "r" (al), "rI" (bl) __CLOBBER_CC);\ } while (0) -#if 1 || defined (__arm_m__) /* `M' series has widening multiply support */ +#if defined (__ARM_ARCH_2__) || defined (__ARM_ARCH_2A__) \ + || defined (__ARM_ARCH_3__) +#define umul_ppmm(xh, xl, a, b) \ + do { \ + register USItype __t0, __t1, __t2; \ + __asm__ ("%@ Inlined umul_ppmm\n" \ + " mov %2, %5, lsr #16\n" \ + " mov %0, %6, lsr #16\n" \ + " bic %3, %5, %2, lsl #16\n" \ + " bic %4, %6, %0, lsl #16\n" \ + " mul %1, %3, %4\n" \ + " mul %4, %2, %4\n" \ + " mul %3, %0, %3\n" \ + " mul %0, %2, %0\n" \ + " adds %3, %4, %3\n" \ + " addcs %0, %0, #65536\n" \ + " adds %1, %1, %3, lsl #16\n" \ + " adc %0, %0, %3, lsr #16" \ + : "=&r" ((USItype) (xh)), "=r" ((USItype) (xl)), \ + "=&r" (__t0), "=&r" (__t1), "=r" (__t2) \ + : "r" ((USItype) (a)), "r" ((USItype) (b)) __CLOBBER_CC); \ + } while (0) +#define UMUL_TIME 20 +#define udiv_qrnnd(q, r, n1, n0, d) \ + do { UWtype __r; \ + (q) = __MPN(udiv_qrnnd) (&__r, (n1), (n0), (d)); \ + (r) = __r; \ + } while (0) +extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype); +#define UDIV_TIME 200 +#else /* ARMv4 or newer */ #define umul_ppmm(xh, xl, a, b) \ __asm__ ("umull %0,%1,%2,%3" : "=&r" (xl), "=&r" (xh) : "r" (a), "r" (b)) #define UMUL_TIME 5 @@ -478,37 +523,36 @@ #define UDIV_NEEDS_NORMALIZATION 1 #define UDIV_TIME 70 #endif /* LONGLONG_STANDALONE */ -#else -#define umul_ppmm(xh, xl, a, b) \ - __asm__ ("%@ Inlined umul_ppmm\n" \ -" mov %|r0, %2, lsr #16\n" \ -" mov %|r2, %3, lsr #16\n" \ -" bic %|r1, %2, %|r0, lsl #16\n" \ -" bic %|r2, %3, %|r2, lsl #16\n" \ -" mul %1, %|r1, %|r2\n" \ -" mul %|r2, %|r0, %|r2\n" \ -" mul %|r1, %0, %|r1\n" \ -" mul %0, %|r0, %0\n" \ -" adds %|r1, %|r2, %|r1\n" \ -" addcs %0, %0, #65536\n" \ -" adds %1, %1, %|r1, lsl #16\n" \ -" adc %0, %0, %|r1, lsr #16" \ - : "=&r" (xh), "=r" (xl) \ - : "r" (a), "r" (b) \ - : "r0", "r1", "r2") -#define UMUL_TIME 20 -#ifndef LONGLONG_STANDALONE -#define udiv_qrnnd(q, r, n1, n0, d) \ - do { UWtype __r; \ - (q) = __MPN(udiv_qrnnd) (&__r, (n1), (n0), (d)); \ - (r) = __r; \ - } while (0) -extern UWtype __MPN(udiv_qrnnd) _PROTO ((UWtype *, UWtype, UWtype, UWtype)); -#define UDIV_TIME 200 -#endif /* LONGLONG_STANDALONE */ -#endif +#endif /* defined(__ARM_ARCH_2__) ... */ +#define count_leading_zeros(count, x) count_leading_zeros_gcc_clz(count, x) +#define count_trailing_zeros(count, x) count_trailing_zeros_gcc_ctz(count, x) +#define COUNT_LEADING_ZEROS_0 32 #endif /* __arm__ */ +#if defined (__aarch64__) && W_TYPE_SIZE == 64 +/* FIXME: Extend the immediate range for the low word by using both + ADDS and SUBS, since they set carry in the same way. */ +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + __asm__ ("adds\t%1, %x4, %5\n\tadc\t%0, %x2, %x3" \ + : "=r" (sh), "=&r" (sl) \ + : "rZ" ((UDItype)(ah)), "rZ" ((UDItype)(bh)), \ + "%r" ((UDItype)(al)), "rI" ((UDItype)(bl)) __CLOBBER_CC) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("subs\t%1, %x4, %5\n\tsbc\t%0, %x2, %x3" \ + : "=r,r" (sh), "=&r,&r" (sl) \ + : "rZ,rZ" ((UDItype)(ah)), "rZ,rZ" ((UDItype)(bh)), \ + "r,Z" ((UDItype)(al)), "rI,r" ((UDItype)(bl)) __CLOBBER_CC) +#define umul_ppmm(ph, pl, m0, m1) \ + do { \ + UDItype __m0 = (m0), __m1 = (m1); \ + __asm__ ("umulh\t%0, %1, %2" : "=r" (ph) : "r" (__m0), "r" (__m1)); \ + (pl) = __m0 * __m1; \ + } while (0) +#define count_leading_zeros(count, x) count_leading_zeros_gcc_clz(count, x) +#define count_trailing_zeros(count, x) count_trailing_zeros_gcc_ctz(count, x) +#define COUNT_LEADING_ZEROS_0 64 +#endif /* __aarch64__ */ + #if defined (__clipper__) && W_TYPE_SIZE == 32 #define umul_ppmm(w1, w0, u, v) \ ({union {UDItype __ll; \ @@ -642,29 +686,176 @@ #endif /* hppa */ #if (defined (__i370__) || defined (__s390__) || defined (__mvs__)) && W_TYPE_SIZE == 32 -#define smul_ppmm(xh, xl, m0, m1) \ +#if defined (__zarch__) || defined (HAVE_HOST_CPU_s390_zarch) +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + do { \ +/* if (__builtin_constant_p (bl)) \ + __asm__ ("alfi\t%1,%o5\n\talcr\t%0,%3" \ + : "=r" (sh), "=&r" (sl) \ + : "0" (ah), "r" (bh), "%1" (al), "n" (bl) __CLOBBER_CC);\ + else \ +*/ __asm__ ("alr\t%1,%5\n\talcr\t%0,%3" \ + : "=r" (sh), "=&r" (sl) \ + : "0" (ah), "r" (bh), "%1" (al), "r" (bl)__CLOBBER_CC); \ + } while (0) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + do { \ +/* if (__builtin_constant_p (bl)) \ + __asm__ ("slfi\t%1,%o5\n\tslbr\t%0,%3" \ + : "=r" (sh), "=&r" (sl) \ + : "0" (ah), "r" (bh), "1" (al), "n" (bl) __CLOBBER_CC); \ + else \ +*/ __asm__ ("slr\t%1,%5\n\tslbr\t%0,%3" \ + : "=r" (sh), "=&r" (sl) \ + : "0" (ah), "r" (bh), "1" (al), "r" (bl) __CLOBBER_CC); \ + } while (0) +#if __GMP_GNUC_PREREQ (4,5) +#define umul_ppmm(xh, xl, m0, m1) \ + do { \ + union {UDItype __ll; \ + struct {USItype __h, __l;} __i; \ + } __x; \ + __x.__ll = (UDItype) (m0) * (UDItype) (m1); \ + (xh) = __x.__i.__h; (xl) = __x.__i.__l; \ + } while (0) +#else +#if 0 +/* FIXME: this fails if gcc knows about the 64-bit registers. Use only + with a new enough processor pretending we have 32-bit registers. */ +#define umul_ppmm(xh, xl, m0, m1) \ + do { \ + union {UDItype __ll; \ + struct {USItype __h, __l;} __i; \ + } __x; \ + __asm__ ("mlr\t%0,%2" \ + : "=r" (__x.__ll) \ + : "%0" (m0), "r" (m1)); \ + (xh) = __x.__i.__h; (xl) = __x.__i.__l; \ + } while (0) +#else +#define umul_ppmm(xh, xl, m0, m1) \ + do { \ + /* When we have 64-bit regs and gcc is aware of that, we cannot simply use + DImode for the product, since that would be allocated to a single 64-bit + register, whereas mlr uses the low 32-bits of an even-odd register pair. + */ \ + register USItype __r0 __asm__ ("0"); \ + register USItype __r1 __asm__ ("1") = (m0); \ + __asm__ ("mlr\t%0,%3" \ + : "=r" (__r0), "=r" (__r1) \ + : "r" (__r1), "r" (m1)); \ + (xh) = __r0; (xl) = __r1; \ + } while (0) +#endif /* if 0 */ +#endif +#if 0 +/* FIXME: this fails if gcc knows about the 64-bit registers. Use only + with a new enough processor pretending we have 32-bit registers. */ +#define udiv_qrnnd(q, r, n1, n0, d) \ + do { \ + union {UDItype __ll; \ + struct {USItype __h, __l;} __i; \ + } __x; \ + __x.__i.__h = n1; __x.__i.__l = n0; \ + __asm__ ("dlr\t%0,%2" \ + : "=r" (__x.__ll) \ + : "0" (__x.__ll), "r" (d)); \ + (q) = __x.__i.__l; (r) = __x.__i.__h; \ + } while (0) +#else +#define udiv_qrnnd(q, r, n1, n0, d) \ + do { \ + register USItype __r0 __asm__ ("0") = (n1); \ + register USItype __r1 __asm__ ("1") = (n0); \ + __asm__ ("dlr\t%0,%4" \ + : "=r" (__r0), "=r" (__r1) \ + : "r" (__r0), "r" (__r1), "r" (d)); \ + (q) = __r1; (r) = __r0; \ + } while (0) +#endif /* if 0 */ +#else /* if __zarch__ */ +/* FIXME: this fails if gcc knows about the 64-bit registers. */ +#define smul_ppmm(xh, xl, m0, m1) \ do { \ union {DItype __ll; \ struct {USItype __h, __l;} __i; \ } __x; \ - __asm__ ("lr %N0,%1\n\tmr %0,%2" \ - : "=&r" (__x.__ll) \ - : "r" (m0), "r" (m1)); \ + __asm__ ("mr\t%0,%2" \ + : "=r" (__x.__ll) \ + : "%0" (m0), "r" (m1)); \ (xh) = __x.__i.__h; (xl) = __x.__i.__l; \ } while (0) -#define sdiv_qrnnd(q, r, n1, n0, d) \ +/* FIXME: this fails if gcc knows about the 64-bit registers. */ +#define sdiv_qrnnd(q, r, n1, n0, d) \ do { \ union {DItype __ll; \ struct {USItype __h, __l;} __i; \ } __x; \ __x.__i.__h = n1; __x.__i.__l = n0; \ - __asm__ ("dr %0,%2" \ + __asm__ ("dr\t%0,%2" \ : "=r" (__x.__ll) \ : "0" (__x.__ll), "r" (d)); \ (q) = __x.__i.__l; (r) = __x.__i.__h; \ } while (0) +#endif /* if __zarch__ */ +#endif + +#if defined (__s390x__) && W_TYPE_SIZE == 64 +/* We need to cast operands with register constraints, otherwise their types + will be assumed to be SImode by gcc. For these machines, such operations + will insert a value into the low 32 bits, and leave the high 32 bits with + garbage. */ +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + do { \ + __asm__ ("algr\t%1,%5\n\talcgr\t%0,%3" \ + : "=r" (sh), "=&r" (sl) \ + : "0" ((UDItype)(ah)), "r" ((UDItype)(bh)), \ + "%1" ((UDItype)(al)), "r" ((UDItype)(bl)) __CLOBBER_CC); \ + } while (0) +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + do { \ + __asm__ ("slgr\t%1,%5\n\tslbgr\t%0,%3" \ + : "=r" (sh), "=&r" (sl) \ + : "0" ((UDItype)(ah)), "r" ((UDItype)(bh)), \ + "1" ((UDItype)(al)), "r" ((UDItype)(bl)) __CLOBBER_CC); \ + } while (0) +#define umul_ppmm(xh, xl, m0, m1) \ + do { \ + union {unsigned int __attribute__ ((mode(TI))) __ll; \ + struct {UDItype __h, __l;} __i; \ + } __x; \ + __asm__ ("mlgr\t%0,%2" \ + : "=r" (__x.__ll) \ + : "%0" ((UDItype)(m0)), "r" ((UDItype)(m1))); \ + (xh) = __x.__i.__h; (xl) = __x.__i.__l; \ + } while (0) +#define udiv_qrnnd(q, r, n1, n0, d) \ + do { \ + union {unsigned int __attribute__ ((mode(TI))) __ll; \ + struct {UDItype __h, __l;} __i; \ + } __x; \ + __x.__i.__h = n1; __x.__i.__l = n0; \ + __asm__ ("dlgr\t%0,%2" \ + : "=r" (__x.__ll) \ + : "0" (__x.__ll), "r" ((UDItype)(d))); \ + (q) = __x.__i.__l; (r) = __x.__i.__h; \ + } while (0) +#if 0 /* FIXME: Enable for z10 (?) */ +#define count_leading_zeros(cnt, x) \ + do { \ + union {unsigned int __attribute__ ((mode(TI))) __ll; \ + struct {UDItype __h, __l;} __i; \ + } __clr_cnt; \ + __asm__ ("flogr\t%0,%1" \ + : "=r" (__clr_cnt.__ll) \ + : "r" (x) __CLOBBER_CC); \ + (cnt) = __clr_cnt.__i.__h; \ + } while (0) +#endif #endif +/* On x86 and x86_64, every asm implicitly clobbers "flags" and "fpsr", + so we don't need __CLOBBER_CC. */ #if (defined (__i386__) || defined (__i486__)) && W_TYPE_SIZE == 32 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ __asm__ ("addl %5,%k1\n\tadcl %3,%k0" \ @@ -759,7 +950,7 @@ being 1 code byte smaller. "31-__cbtmp" is a workaround, probably at the cost of one extra instruction. Do this for "i386" too, since that means generic x86. */ -#if ! defined (count_leading_zeros) && __GNUC__ < 3 \ +#if ! defined (count_leading_zeros) && __GNUC__ < 3 \ && (HAVE_HOST_CPU_i386 \ || HAVE_HOST_CPU_i686 \ || HAVE_HOST_CPU_pentiumpro \ @@ -840,7 +1031,7 @@ ASSERT ((x) != 0); \ __asm__ ("bsfq %1,%q0" : "=r" (count) : "rm" ((UDItype)(x))); \ } while (0) -#endif /* x86_64 */ +#endif /* __amd64__ */ #if defined (__i860__) && W_TYPE_SIZE == 32 #define rshift_rhlc(r,h,l,c) \ @@ -969,7 +1160,7 @@ || defined (__mc68030__) || defined (mc68030) \ || defined (__mc68040__) || defined (mc68040) \ || defined (__mc68060__) || defined (mc68060) \ - || defined (__NeXT__)) \ + || defined (__NeXT__)) \ && ! defined (__mcpu32__) #define count_leading_zeros(count, x) \ __asm__ ("bfffo %1{%b2:%b2},%0" \ @@ -1030,7 +1221,7 @@ w0 = __ll; \ } while (0) #endif -#if !defined (umul_ppmm) && __GMP_GNUC_PREREQ (2,7) +#if !defined (umul_ppmm) && __GMP_GNUC_PREREQ (2,7) && !defined (__clang__) #define umul_ppmm(w1, w0, u, v) \ __asm__ ("multu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v)) #endif @@ -1053,14 +1244,17 @@ w0 = __ll; \ } while (0) #endif -#if !defined (umul_ppmm) && __GMP_GNUC_PREREQ (2,7) +#if !defined (umul_ppmm) && __GMP_GNUC_PREREQ (2,7) && !defined (__clang__) #define umul_ppmm(w1, w0, u, v) \ - __asm__ ("dmultu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v)) + __asm__ ("dmultu %2,%3" \ + : "=l" (w0), "=h" (w1) \ + : "d" ((UDItype)(u)), "d" ((UDItype)(v))) #endif #if !defined (umul_ppmm) #define umul_ppmm(w1, w0, u, v) \ __asm__ ("dmultu %2,%3\n\tmflo %0\n\tmfhi %1" \ - : "=d" (w0), "=d" (w1) : "d" (u), "d" (v)) + : "=d" (w0), "=d" (w1) \ + : "d" ((UDItype)(u)), "d" ((UDItype)(v))) #endif #define UMUL_TIME 20 #define UDIV_TIME 140 @@ -1122,42 +1316,42 @@ the system vendor compilers. (Is that vendor compilers with inline asm, or what?) */ -#if (HAVE_HOST_CPU_FAMILY_power || HAVE_HOST_CPU_FAMILY_powerpc) \ +#if (HAVE_HOST_CPU_FAMILY_power || HAVE_HOST_CPU_FAMILY_powerpc) \ && W_TYPE_SIZE == 32 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ do { \ if (__builtin_constant_p (bh) && (bh) == 0) \ - __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ + __asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl)); \ else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ - __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ + __asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl)); \ else \ - __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \ + __asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3" \ : "=r" (sh), "=&r" (sl) \ : "r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \ } while (0) #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ do { \ if (__builtin_constant_p (ah) && (ah) == 0) \ - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \ + __asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \ : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ else if (__builtin_constant_p (ah) && (ah) == ~(USItype) 0) \ - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \ + __asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \ : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ else if (__builtin_constant_p (bh) && (bh) == 0) \ - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \ + __asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \ : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \ + __asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \ : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ else \ - __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \ + __asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \ : "=r" (sh), "=&r" (sl) \ : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \ } while (0) #define count_leading_zeros(count, x) \ - __asm__ ("{cntlz|cntlzw} %0,%1" : "=r" (count) : "r" (x)) + __asm__ ("cntlzw %0,%1" : "=r" (count) : "r" (x)) #define COUNT_LEADING_ZEROS_0 32 #if HAVE_HOST_CPU_FAMILY_powerpc #if __GMP_GNUC_PREREQ (4,4) @@ -1205,61 +1399,84 @@ #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ do { \ if (__builtin_constant_p (bh) && (bh) == 0) \ - __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ + __asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2" \ + : "=r" (sh), "=&r" (sl) \ + : "r" ((UDItype)(ah)), \ + "%r" ((UDItype)(al)), "rI" ((UDItype)(bl))); \ else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \ - __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ + __asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2" \ + : "=r" (sh), "=&r" (sl) \ + : "r" ((UDItype)(ah)), \ + "%r" ((UDItype)(al)), "rI" ((UDItype)(bl))); \ else \ - __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \ - : "=r" (sh), "=&r" (sl) \ - : "r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \ + __asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3" \ + : "=r" (sh), "=&r" (sl) \ + : "r" ((UDItype)(ah)), "r" ((UDItype)(bh)), \ + "%r" ((UDItype)(al)), "rI" ((UDItype)(bl))); \ } while (0) /* We use "*rI" for the constant operand here, since with just "I", gcc barfs. This might seem strange, but gcc folds away the dead code late. */ #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - do { \ - if (__builtin_constant_p (bl) && bl > -0x8000 && bl <= 0x8000) { \ - if (__builtin_constant_p (ah) && (ah) == 0) \ - __asm__ ("{ai|addic} %1,%3,%4\n\t{sfze|subfze} %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "*rI" (-bl)); \ - else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \ - __asm__ ("{ai|addic} %1,%3,%4\n\t{sfme|subfme} %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "*rI" (-bl)); \ - else if (__builtin_constant_p (bh) && (bh) == 0) \ - __asm__ ("{ai|addic} %1,%3,%4\n\t{ame|addme} %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "*rI" (-bl)); \ - else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \ - __asm__ ("{ai|addic} %1,%3,%4\n\t{aze|addze} %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "*rI" (-bl)); \ - else \ - __asm__ ("{ai|addic} %1,%4,%5\n\t{sfe|subfe} %0,%3,%2" \ - : "=r" (sh), "=&r" (sl) \ - : "r" (ah), "r" (bh), "rI" (al), "*rI" (-bl)); \ - } else { \ - if (__builtin_constant_p (ah) && (ah) == 0) \ - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl)); \ - else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \ - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl)); \ - else if (__builtin_constant_p (bh) && (bh) == 0) \ - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl)); \ - else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \ - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl)); \ - else \ - __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \ - : "=r" (sh), "=&r" (sl) \ - : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \ - } \ + do { \ + if (__builtin_constant_p (bl) && bl > -0x8000 && bl <= 0x8000) { \ + if (__builtin_constant_p (ah) && (ah) == 0) \ + __asm__ ("addic %1,%3,%4\n\tsubfze %0,%2" \ + : "=r" (sh), "=&r" (sl) \ + : "r" ((UDItype)(bh)), \ + "rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl)))); \ + else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \ + __asm__ ("addic %1,%3,%4\n\tsubfme %0,%2" \ + : "=r" (sh), "=&r" (sl) \ + : "r" ((UDItype)(bh)), \ + "rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl)))); \ + else if (__builtin_constant_p (bh) && (bh) == 0) \ + __asm__ ("addic %1,%3,%4\n\taddme %0,%2" \ + : "=r" (sh), "=&r" (sl) \ + : "r" ((UDItype)(ah)), \ + "rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl)))); \ + else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \ + __asm__ ("addic %1,%3,%4\n\taddze %0,%2" \ + : "=r" (sh), "=&r" (sl) \ + : "r" ((UDItype)(ah)), \ + "rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl)))); \ + else \ + __asm__ ("addic %1,%4,%5\n\tsubfe %0,%3,%2" \ + : "=r" (sh), "=&r" (sl) \ + : "r" ((UDItype)(ah)), "r" ((UDItype)(bh)), \ + "rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl)))); \ + } else { \ + if (__builtin_constant_p (ah) && (ah) == 0) \ + __asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \ + : "=r" (sh), "=&r" (sl) \ + : "r" ((UDItype)(bh)), \ + "rI" ((UDItype)(al)), "r" ((UDItype)(bl))); \ + else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \ + __asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \ + : "=r" (sh), "=&r" (sl) \ + : "r" ((UDItype)(bh)), \ + "rI" ((UDItype)(al)), "r" ((UDItype)(bl))); \ + else if (__builtin_constant_p (bh) && (bh) == 0) \ + __asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \ + : "=r" (sh), "=&r" (sl) \ + : "r" ((UDItype)(ah)), \ + "rI" ((UDItype)(al)), "r" ((UDItype)(bl))); \ + else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \ + __asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \ + : "=r" (sh), "=&r" (sl) \ + : "r" ((UDItype)(ah)), \ + "rI" ((UDItype)(al)), "r" ((UDItype)(bl))); \ + else \ + __asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \ + : "=r" (sh), "=&r" (sl) \ + : "r" ((UDItype)(ah)), "r" ((UDItype)(bh)), \ + "rI" ((UDItype)(al)), "r" ((UDItype)(bl))); \ + } \ } while (0) #endif /* ! _LONG_LONG_LIMB */ #define count_leading_zeros(count, x) \ __asm__ ("cntlzd %0,%1" : "=r" (count) : "r" (x)) #define COUNT_LEADING_ZEROS_0 64 -#if __GMP_GNUC_PREREQ (4,4) +#if 0 && __GMP_GNUC_PREREQ (4,4) /* Disable, this results in libcalls! */ #define umul_ppmm(w1, w0, u, v) \ do { \ typedef unsigned int __ll_UTItype __attribute__((mode(TI))); \ @@ -1272,7 +1489,7 @@ #define umul_ppmm(ph, pl, m0, m1) \ do { \ UDItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("mulhdu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \ + __asm__ ("mulhdu %0,%1,%2" : "=r" (ph) : "%r" (__m0), "r" (__m1)); \ (pl) = __m0 * __m1; \ } while (0) #endif @@ -1280,7 +1497,7 @@ #define smul_ppmm(ph, pl, m0, m1) \ do { \ DItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("mulhd %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \ + __asm__ ("mulhd %0,%1,%2" : "=r" (ph) : "%r" (__m0), "r" (__m1)); \ (pl) = __m0 * __m1; \ } while (0) #define SMUL_TIME 14 /* ??? */ @@ -1361,7 +1578,7 @@ } while (0) #endif /* RT/ROMP */ -#if defined (__sh2__) && W_TYPE_SIZE == 32 +#if (defined (__SH2__) || defined (__SH3__) || defined (__SH4__)) && W_TYPE_SIZE == 32 #define umul_ppmm(w1, w0, u, v) \ __asm__ ("dmulu.l %2,%3\n\tsts macl,%1\n\tsts mach,%0" \ : "=r" (w1), "=r" (w0) : "r" (u), "r" (v) : "macl", "mach") @@ -1379,8 +1596,6 @@ : "=r" (sh), "=&r" (sl) \ : "rJ" (ah), "rI" (bh), "rJ" (al), "rI" (bl) \ __CLOBBER_CC) -/* Note: the following FIXME comes from GMP, thus it does make sense to try - to resolve it in MPFR. */ /* FIXME: When gcc -mcpu=v9 is used on solaris, gcc/config/sol2-sld-64.h doesn't define anything to indicate that to us, it only sets __sparcv8. */ #if defined (__sparc_v9__) || defined (__sparcv9) @@ -1545,7 +1760,7 @@ (q) = __MPN(udiv_qrnnd) (&__r, (n1), (n0), (d)); \ (r) = __r; \ } while (0) -extern UWtype __MPN(udiv_qrnnd) _PROTO ((UWtype *, UWtype, UWtype, UWtype)); +extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype); #ifndef UDIV_TIME #define UDIV_TIME 140 #endif @@ -1559,22 +1774,46 @@ "addcc %r4,%5,%1\n" \ " addccc %r6,%7,%%g0\n" \ " addc %r2,%3,%0" \ - : "=r" (sh), "=&r" (sl) \ - : "rJ" (ah), "rI" (bh), "%rJ" (al), "rI" (bl), \ - "%rJ" ((al) >> 32), "rI" ((bl) >> 32) \ + : "=r" (sh), "=&r" (sl) \ + : "rJ" ((UDItype)(ah)), "rI" ((UDItype)(bh)), \ + "%rJ" ((UDItype)(al)), "rI" ((UDItype)(bl)), \ + "%rJ" ((UDItype)(al) >> 32), "rI" ((UDItype)(bl) >> 32) \ __CLOBBER_CC) #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ __asm__ ( \ "subcc %r4,%5,%1\n" \ " subccc %r6,%7,%%g0\n" \ " subc %r2,%3,%0" \ - : "=r" (sh), "=&r" (sl) \ - : "rJ" (ah), "rI" (bh), "rJ" (al), "rI" (bl), \ - "rJ" ((al) >> 32), "rI" ((bl) >> 32) \ + : "=r" (sh), "=&r" (sl) \ + : "rJ" ((UDItype)(ah)), "rI" ((UDItype)(bh)), \ + "rJ" ((UDItype)(al)), "rI" ((UDItype)(bl)), \ + "rJ" ((UDItype)(al) >> 32), "rI" ((UDItype)(bl) >> 32) \ __CLOBBER_CC) +#if __VIS__ >= 0x300 +#undef add_ssaaaa +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + __asm__ ( \ + "addcc %r4, %5, %1\n" \ + " addxc %r2, %r3, %0" \ + : "=r" (sh), "=&r" (sl) \ + : "rJ" ((UDItype)(ah)), "rJ" ((UDItype)(bh)), \ + "%rJ" ((UDItype)(al)), "rI" ((UDItype)(bl)) __CLOBBER_CC) +#define umul_ppmm(ph, pl, m0, m1) \ + do { \ + UDItype __m0 = (m0), __m1 = (m1); \ + (pl) = __m0 * __m1; \ + __asm__ ("umulxhi\t%2, %1, %0" \ + : "=r" (ph) \ + : "%r" (__m0), "r" (__m1)); \ + } while (0) +#define count_leading_zeros(count, x) \ + __asm__ ("lzd\t%1,%0" : "=r" (count) : "r" (x)) +/* Needed by count_leading_zeros_32 in sparc64.h. */ +#define COUNT_LEADING_ZEROS_NEED_CLZ_TAB +#endif #endif -#if defined (__vax__) && W_TYPE_SIZE == 32 +#if (defined (__vax) || defined (__vax__)) && W_TYPE_SIZE == 32 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ __asm__ ("addl2 %5,%1\n\tadwc %3,%0" \ : "=g" (sh), "=&g" (sl) \ @@ -1605,8 +1844,6 @@ : "=g" (q), "=g" (r) : "g" (__x.__ll), "g" (d)); \ } while (0) #if 0 -/* Note: the following FIXME comes from GMP, thus it does make sense to try - to resolve it in MPFR. */ /* FIXME: This instruction appears to be unimplemented on some systems (vax 8800 maybe). */ #define count_trailing_zeros(count,x) \ @@ -1616,7 +1853,7 @@ : "g" ((USItype) (x))); \ } while (0) #endif -#endif /* __vax__ */ +#endif /* vax */ #if defined (__z8000__) && W_TYPE_SIZE == 16 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ @@ -1649,13 +1886,14 @@ #endif /* NO_ASM */ +/* FIXME: "sidi" here is highly doubtful, should sometimes be "diti". */ #if !defined (umul_ppmm) && defined (__umulsidi3) #define umul_ppmm(ph, pl, m0, m1) \ - { \ + do { \ UDWtype __ll = __umulsidi3 (m0, m1); \ ph = (UWtype) (__ll >> W_TYPE_SIZE); \ pl = (UWtype) __ll; \ - } + } while (0) #endif #if !defined (__umulsidi3) @@ -1666,62 +1904,68 @@ #endif +#if defined (__cplusplus) +#define __longlong_h_C "C" +#else +#define __longlong_h_C +#endif + /* Use mpn_umul_ppmm or mpn_udiv_qrnnd functions, if they exist. The "_r" forms have "reversed" arguments, meaning the pointer is last, which sometimes allows better parameter passing, in particular on 64-bit hppa. */ #define mpn_umul_ppmm __MPN(umul_ppmm) -extern UWtype mpn_umul_ppmm _PROTO ((UWtype *, UWtype, UWtype)); +extern __longlong_h_C UWtype mpn_umul_ppmm (UWtype *, UWtype, UWtype); #if ! defined (umul_ppmm) && HAVE_NATIVE_mpn_umul_ppmm \ && ! defined (LONGLONG_STANDALONE) -#define umul_ppmm(wh, wl, u, v) \ - do { \ - UWtype __umul_ppmm__p0; \ - (wh) = mpn_umul_ppmm (&__umul_ppmm__p0, (UWtype) (u), (UWtype) (v)); \ - (wl) = __umul_ppmm__p0; \ +#define umul_ppmm(wh, wl, u, v) \ + do { \ + UWtype __umul_ppmm__p0; \ + (wh) = mpn_umul_ppmm (&__umul_ppmm__p0, (UWtype) (u), (UWtype) (v));\ + (wl) = __umul_ppmm__p0; \ } while (0) #endif #define mpn_umul_ppmm_r __MPN(umul_ppmm_r) -extern UWtype mpn_umul_ppmm_r _PROTO ((UWtype, UWtype, UWtype *)); +extern __longlong_h_C UWtype mpn_umul_ppmm_r (UWtype, UWtype, UWtype *); #if ! defined (umul_ppmm) && HAVE_NATIVE_mpn_umul_ppmm_r \ && ! defined (LONGLONG_STANDALONE) -#define umul_ppmm(wh, wl, u, v) \ - do { \ - UWtype __umul_ppmm__p0; \ - (wh) = mpn_umul_ppmm_r ((UWtype) (u), (UWtype) (v), &__umul_ppmm__p0); \ - (wl) = __umul_ppmm__p0; \ +#define umul_ppmm(wh, wl, u, v) \ + do { \ + UWtype __umul_p0; \ + (wh) = mpn_umul_ppmm_r ((UWtype) (u), (UWtype) (v), &__umul_p0); \ + (wl) = __umul_p0; \ } while (0) #endif #define mpn_udiv_qrnnd __MPN(udiv_qrnnd) -extern UWtype mpn_udiv_qrnnd _PROTO ((UWtype *, UWtype, UWtype, UWtype)); +extern __longlong_h_C UWtype mpn_udiv_qrnnd (UWtype *, UWtype, UWtype, UWtype); #if ! defined (udiv_qrnnd) && HAVE_NATIVE_mpn_udiv_qrnnd \ && ! defined (LONGLONG_STANDALONE) #define udiv_qrnnd(q, r, n1, n0, d) \ do { \ - UWtype __udiv_qrnnd__r; \ - (q) = mpn_udiv_qrnnd (&__udiv_qrnnd__r, \ + UWtype __udiv_qrnnd_r; \ + (q) = mpn_udiv_qrnnd (&__udiv_qrnnd_r, \ (UWtype) (n1), (UWtype) (n0), (UWtype) d); \ - (r) = __udiv_qrnnd__r; \ + (r) = __udiv_qrnnd_r; \ } while (0) #endif #define mpn_udiv_qrnnd_r __MPN(udiv_qrnnd_r) -extern UWtype mpn_udiv_qrnnd_r _PROTO ((UWtype, UWtype, UWtype, UWtype *)); +extern __longlong_h_C UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *); #if ! defined (udiv_qrnnd) && HAVE_NATIVE_mpn_udiv_qrnnd_r \ && ! defined (LONGLONG_STANDALONE) #define udiv_qrnnd(q, r, n1, n0, d) \ do { \ - UWtype __udiv_qrnnd__r; \ + UWtype __udiv_qrnnd_r; \ (q) = mpn_udiv_qrnnd_r ((UWtype) (n1), (UWtype) (n0), (UWtype) d, \ - &__udiv_qrnnd__r); \ - (r) = __udiv_qrnnd__r; \ + &__udiv_qrnnd_r); \ + (r) = __udiv_qrnnd_r; \ } while (0) #endif @@ -1743,7 +1987,7 @@ do { \ UWtype __x; \ __x = (al) - (bl); \ - (sh) = (ah) - (bh) - ((al) < (bl)); \ + (sh) = (ah) - (bh) - ((al) < (bl)); \ (sl) = __x; \ } while (0) #endif @@ -1854,13 +2098,14 @@ /* If the processor has no udiv_qrnnd but sdiv_qrnnd, go through __udiv_w_sdiv (defined in libgcc or elsewhere). */ -#if !defined (udiv_qrnnd) && defined (sdiv_qrnnd) +#if !defined (udiv_qrnnd) && defined (sdiv_qrnnd) && !defined(LONGLONG_STANDALONE) #define udiv_qrnnd(q, r, nh, nl, d) \ do { \ UWtype __r; \ (q) = __MPN(udiv_w_sdiv) (&__r, nh, nl, d); \ (r) = __r; \ } while (0) +__MPFR_DECLSPEC UWtype __MPN(udiv_w_sdiv) (UWtype *, UWtype, UWtype, UWtype); #endif /* If udiv_qrnnd was not defined for this processor, use __udiv_qrnnd_c. */ @@ -1895,6 +2140,7 @@ /* This version gives a well-defined value for zero. */ #define COUNT_LEADING_ZEROS_0 (W_TYPE_SIZE - 1) #define COUNT_LEADING_ZEROS_NEED_CLZ_TAB +#define COUNT_LEADING_ZEROS_SLOW #endif /* clz_tab needed by mpn/x86/pentium/mod_1.asm in a fat binary */ @@ -1903,17 +2149,13 @@ #endif #ifdef COUNT_LEADING_ZEROS_NEED_CLZ_TAB -# ifdef MPFR_HAVE_GMP_IMPL - extern const unsigned char __GMP_DECLSPEC __clz_tab[128]; -# else - extern const unsigned char __clz_tab[128]; -# endif +extern const unsigned char __MPFR_DECLSPEC __clz_tab[129]; #endif #if !defined (count_trailing_zeros) -/* Define count_trailing_zeros using count_leading_zeros. The latter might be - defined in asm, but if it is not, the C version above is good enough. */ -#define count_trailing_zeros(count, x) \ +#if !defined (COUNT_LEADING_ZEROS_SLOW) +/* Define count_trailing_zeros using an asm count_leading_zeros. */ +#define count_trailing_zeros(count, x) \ do { \ UWtype __ctz_x = (x); \ UWtype __ctz_c; \ @@ -1921,6 +2163,30 @@ count_leading_zeros (__ctz_c, __ctz_x & -__ctz_x); \ (count) = W_TYPE_SIZE - 1 - __ctz_c; \ } while (0) +#else +/* Define count_trailing_zeros in plain C, assuming small counts are common. + We use clz_tab without ado, since the C count_leading_zeros above will have + pulled it in. */ +#define count_trailing_zeros(count, x) \ + do { \ + UWtype __ctz_x = (x); \ + int __ctz_c; \ + \ + if (LIKELY ((__ctz_x & 0xff) != 0)) \ + (count) = __clz_tab[__ctz_x & -__ctz_x] - 2; \ + else \ + { \ + for (__ctz_c = 8 - 2; __ctz_c < W_TYPE_SIZE - 2; __ctz_c += 8) \ + { \ + __ctz_x >>= 8; \ + if (LIKELY ((__ctz_x & 0xff) != 0)) \ + break; \ + } \ + \ + (count) = __ctz_c + __clz_tab[__ctz_x & -__ctz_x]; \ + } \ + } while (0) +#endif #endif #ifndef UDIV_NEEDS_NORMALIZATION diff -Nru mpfr4-3.1.4/src/mpfr-mini-gmp.c mpfr4-4.0.2/src/mpfr-mini-gmp.c --- mpfr4-3.1.4/src/mpfr-mini-gmp.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/mpfr-mini-gmp.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,211 @@ +/* mpfr-mini-gmp.c -- Interface functions for mini-gmp. + +Copyright 2014-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* The following include will do 2 things: include the config.h + if there is one (as it may define MPFR_USE_MINI_GMP), and avoid + an empty translation unit (see ISO C99, 6.9). */ +#include "mpfr-impl.h" + +#ifdef MPFR_USE_MINI_GMP + +#include "mpfr-mini-gmp.h" + +/************************ random generation functions ************************/ + +#ifdef WANT_gmp_randinit_default +void +gmp_randinit_default (gmp_randstate_t state) +{ +} +#endif + +#ifdef WANT_gmp_randseed_ui +void +gmp_randseed_ui (gmp_randstate_t state, unsigned long int seed) +{ + srand48 (seed); +} +#endif + +#ifdef WANT_gmp_randclear +void +gmp_randclear (gmp_randstate_t state) +{ +} +#endif + +#ifdef WANT_gmp_randinit_set +void +gmp_randinit_set (gmp_randstate_t s1, gmp_randstate_t s2) +{ +} +#endif + +static mp_limb_t +random_limb (void) +{ + /* lrand48() only gives 31 bits */ +#if GMP_NUMB_BITS == 32 + return lrand48 () + (lrand48 () << 31); +#else + return lrand48 () + (((mp_limb_t) lrand48 ()) << 31) + + (((mp_limb_t) lrand48 ()) << 62); +#endif +} + +#ifdef WANT_mpz_urandomb +void +mpz_urandomb (mpz_t rop, gmp_randstate_t state, mp_bitcnt_t nbits) +{ + unsigned long n, i; + + mpz_realloc2 (rop, nbits); + n = (nbits - 1) / GMP_NUMB_BITS + 1; /* number of limbs */ + for (i = n; i-- > 0;) + rop->_mp_d[i] = random_limb (); + i = n * GMP_NUMB_BITS - nbits; + /* mask the upper i bits */ + if (i) + rop->_mp_d[n-1] = (rop->_mp_d[n-1] << i) >> i; + while (n > 0 && (rop->_mp_d[n-1] == 0)) + n--; + rop->_mp_size = n; +} +#endif + +#ifdef WANT_gmp_urandomm_ui +unsigned long +gmp_urandomm_ui (gmp_randstate_t state, unsigned long n) +{ + return random_limb () % n; +} +#endif + +#ifdef WANT_gmp_urandomb_ui +unsigned long +gmp_urandomb_ui (gmp_randstate_t state, unsigned long n) +{ + return random_limb () % (1UL << n); +} +#endif + +/************************* division functions ********************************/ + +#ifdef WANT_mpn_divrem_1 +mp_limb_t +mpn_divrem_1 (mp_limb_t *qp, mp_size_t qxn, mp_limb_t *np, mp_size_t nn, + mp_limb_t d0) +{ + mpz_t q, r, n, d; + mp_limb_t ret, dd[1]; + + d->_mp_d = dd; + d->_mp_d[0] = d0; + d->_mp_size = 1; + mpz_init (q); + mpz_init (r); + if (qxn == 0) + { + n->_mp_d = np; + n->_mp_size = nn; + } + else + { + mpz_init2 (n, (nn + qxn) * GMP_NUMB_BITS); + mpn_copyi (n->_mp_d + qxn, np, nn); + mpn_zero (n->_mp_d, qxn); + n->_mp_size = nn + qxn; + } + mpz_tdiv_qr (q, r, n, d); + if (q->_mp_size > 0) + mpn_copyi (qp, q->_mp_d, q->_mp_size); + if (q->_mp_size < nn + qxn) + mpn_zero (qp + q->_mp_size, nn + qxn - q->_mp_size); + ret = (r->_mp_size == 1) ? r->_mp_d[0] : 0; + mpz_clear (q); + mpz_clear (r); + if (qxn != 0) + mpz_clear (n); + return ret; +} +#endif + +#ifdef WANT_mpn_divrem +mp_limb_t +mpn_divrem (mp_limb_t *qp, mp_size_t qn, mp_limb_t *np, + mp_size_t nn, const mp_limb_t *dp, mp_size_t dn) +{ + mpz_t q, r, n, d; + mp_limb_t ret; + + MPFR_ASSERTN(qn == 0); + qn = nn - dn; + n->_mp_d = np; + n->_mp_size = nn; + d->_mp_d = (mp_limb_t*) dp; + d->_mp_size = dn; + mpz_init (q); + mpz_init (r); + mpz_tdiv_qr (q, r, n, d); + MPFR_ASSERTN(q->_mp_size == qn || q->_mp_size == qn + 1); + mpn_copyi (qp, q->_mp_d, qn); + ret = (q->_mp_size == qn) ? 0 : q->_mp_d[qn]; + if (r->_mp_size > 0) + mpn_copyi (np, r->_mp_d, r->_mp_size); + if (r->_mp_size < dn) + mpn_zero (np + r->_mp_size, dn - r->_mp_size); + mpz_clear (q); + mpz_clear (r); + return ret; +} +#endif + +#ifdef WANT_mpn_tdiv_qr +void +mpn_tdiv_qr (mp_limb_t *qp, mp_limb_t *rp, mp_size_t qxn, + const mp_limb_t *np, mp_size_t nn, + const mp_limb_t *dp, mp_size_t dn) +{ + mpz_t q, r, n, d; + + MPFR_ASSERTN(qxn == 0); + n->_mp_d = (mp_limb_t*) np; + n->_mp_size = nn; + d->_mp_d = (mp_limb_t*) dp; + d->_mp_size = dn; + mpz_init (q); + mpz_init (r); + mpz_tdiv_qr (q, r, n, d); + MPFR_ASSERTN(q->_mp_size > 0); + mpn_copyi (qp, q->_mp_d, q->_mp_size); + if (q->_mp_size < nn - dn + 1) + mpn_zero (qp + q->_mp_size, nn - dn + 1 - q->_mp_size); + if (r->_mp_size > 0) + mpn_copyi (rp, r->_mp_d, r->_mp_size); + if (r->_mp_size < dn) + mpn_zero (rp + r->_mp_size, dn - r->_mp_size); + mpz_clear (q); + mpz_clear (r); +} +#endif + +#endif /* MPFR_USE_MINI_GMP */ diff -Nru mpfr4-3.1.4/src/mpfr-mini-gmp.h mpfr4-4.0.2/src/mpfr-mini-gmp.h --- mpfr4-3.1.4/src/mpfr-mini-gmp.h 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/mpfr-mini-gmp.h 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,141 @@ +/* mpfr-mini-gmp.h -- Interface header for mini-gmp. + +Copyright 2014-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include /* for size_t */ +#include "gmp.h" + +#ifndef gmp_version +extern char gmp_version[]; +#endif + +#ifndef GMP_NUMB_BITS +/* see https://gmplib.org/list-archives/gmp-bugs/2015-October/003755.html */ +#include +#define GMP_NUMB_BITS (CHAR_BIT * sizeof(mp_limb_t)) +#endif + +#ifndef mp_limb_signed_t +typedef long mp_limb_signed_t; +#endif + +#ifndef __gmp_allocate_func +#define __gmp_allocate_func gmp_default_alloc +#define __gmp_reallocate_func gmp_default_realloc +#define __gmp_free_func gmp_default_free +#endif + +#ifndef gmp_randstate_t +typedef long int __gmp_randstate_struct; +typedef __gmp_randstate_struct gmp_randstate_t[1]; +#endif + +#ifndef gmp_randinit_default +#define WANT_gmp_randinit_default +void gmp_randinit_default (gmp_randstate_t); +#endif + +#ifndef gmp_randseed_ui +#define WANT_gmp_randseed_ui +void gmp_randseed_ui (gmp_randstate_t, unsigned long int); +#endif + +#ifndef gmp_randclear +#define WANT_gmp_randclear +void gmp_randclear (gmp_randstate_t); +#endif + +#ifndef gmp_randinit_set +#define WANT_gmp_randinit_set +void gmp_randinit_set (gmp_randstate_t, gmp_randstate_t); +#endif + +#ifndef mpn_scan1 +#define WANT_mpn_scan1 +mp_bitcnt_t mpn_scan1 (const mp_limb_t *, mp_bitcnt_t); +#endif + +#ifndef mpz_perfect_square_p +#define WANT_mpz_perfect_square_p +int mpz_perfect_square_p (const mpz_t); +#endif + +#ifndef mpz_addmul_ui +#define WANT_mpz_addmul_ui +void mpz_addmul_ui (mpz_t, const mpz_t, unsigned long); +#endif + +#ifndef mpn_divrem_1 +#define WANT_mpn_divrem_1 +mp_limb_t mpn_divrem_1 (mp_limb_t*, mp_size_t, mp_limb_t*, mp_size_t, + mp_limb_t); +#endif + +#ifndef mpz_urandomb +#define WANT_mpz_urandomb +void mpz_urandomb (mpz_t, gmp_randstate_t, mp_bitcnt_t); +#endif + +#ifndef mpn_zero +#define WANT_mpn_zero +void mpn_zero (mp_limb_t *, mp_size_t); +#endif + +#ifndef mpn_popcount +#define WANT_mpn_popcount +mp_bitcnt_t mpn_popcount (const mp_limb_t *, mp_size_t); +#endif + +#ifndef gmp_urandomm_ui +#define WANT_gmp_urandomm_ui +unsigned long gmp_urandomm_ui (gmp_randstate_t state, unsigned long n); +#endif + +#ifndef gmp_urandomb_ui +#define WANT_gmp_urandomb_ui +unsigned long gmp_urandomb_ui (gmp_randstate_t state, unsigned long n); +#endif + +#ifndef mpn_divrem +#define WANT_mpn_divrem +mp_limb_t mpn_divrem (mp_limb_t *, mp_size_t, mp_limb_t *, + mp_size_t, const mp_limb_t *, mp_size_t); +#endif + +#ifndef mpz_submul +#define WANT_mpz_submul +void mpz_submul (mpz_t, const mpz_t, const mpz_t); +#endif + +#ifndef mpz_addmul +#define WANT_mpz_addmul +void mpz_addmul (mpz_t, const mpz_t, const mpz_t); +#endif + +#ifndef mpn_tdiv_qr +#define WANT_mpn_tdiv_qr +void mpn_tdiv_qr (mp_limb_t *, mp_limb_t *, mp_size_t, + const mp_limb_t *, mp_size_t, const mp_limb_t *, mp_size_t); +#endif + +#ifndef mpz_rrandomb +#define mpz_rrandomb mpz_urandomb +#endif diff -Nru mpfr4-3.1.4/src/mpfr-sassert.h mpfr4-4.0.2/src/mpfr-sassert.h --- mpfr4-3.1.4/src/mpfr-sassert.h 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/mpfr-sassert.h 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,75 @@ +/* MPFR internal header related to Static Assertions + +Copyright 2012-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef __MPFR_STATIC_ASSERT_H__ +#define __MPFR_STATIC_ASSERT_H__ + +#include "mpfr-cvers.h" /* for __MPFR_GNUC */ + +/* How to use: + =========== + MPFR_DECL_STATIC_ASSERT: + + to check a condition at compile time within the declaration section. + MPFR_STAT_STATIC_ASSERT: + + to check a condition at compile time within the statement section. +*/ + +#ifdef MPFR_USE_STATIC_ASSERT + +/* C11 version */ +# if defined (__STDC_VERSION__) +# if (__STDC_VERSION__ >= 201112L) +# define MPFR_DECL_STATIC_ASSERT(c) _Static_assert((c), #c ) +# define MPFR_STAT_STATIC_ASSERT(c) _Static_assert((c), #c ) +# endif +# endif + +/* Default version which should be compatible with nearly all compilers */ +# if !defined(MPFR_DECL_STATIC_ASSERT) +# if __MPFR_GNUC(4,8) +/* Get rid of annoying warnings "typedef '...' locally defined but not used" + (new in GCC 4.8). Thanks to Jonathan Wakely for this solution: + https://gcc.gnu.org/ml/gcc-help/2013-07/msg00142.html */ +# define MPFR_TYPEDEF_UNUSED __attribute__ ((unused)) +# else +# define MPFR_TYPEDEF_UNUSED +# endif +# define MPFR_ASSERT_CAT(a,b) MPFR_ASSERT_CAT_(a,b) +# define MPFR_ASSERT_CAT_(a,b) a ## b +# define MPFR_STAT_STATIC_ASSERT(c) do { \ + typedef enum { MPFR_ASSERT_CAT(MPFR_STATIC_ASSERT_CONST_,__LINE__) = !(c) } \ + MPFR_ASSERT_CAT(MPFR_ASSERT_,__LINE__)[!!(c) ? 1 : -1] \ + MPFR_TYPEDEF_UNUSED; } while (0) +# define MPFR_DECL_STATIC_ASSERT(c) \ + typedef enum { MPFR_ASSERT_CAT(MPFR_STATIC_ASSERT_CONST_,__LINE__) = !(c) } \ + MPFR_ASSERT_CAT(MPFR_ASSERT_,__LINE__)[!!(c) ? 1 : -1]; +# endif + +#else + +/* No support: default to classic assertions */ +# define MPFR_DECL_STATIC_ASSERT(c) /* Nothing */ +# define MPFR_STAT_STATIC_ASSERT(c) MPFR_ASSERTN(c) + +#endif + +#endif diff -Nru mpfr4-3.1.4/src/mpfr-thread.h mpfr4-4.0.2/src/mpfr-thread.h --- mpfr4-3.1.4/src/mpfr-thread.h 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/mpfr-thread.h 2019-01-27 18:30:16.000000000 +0000 @@ -1,6 +1,6 @@ /* MPFR internal header related to thread-local variables. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,15 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __MPFR_THREAD_H__ #define __MPFR_THREAD_H__ +/* Note: MPFR_NEED_THREAD_LOCK shall be defined before including this + header */ + /* Note: Let's define MPFR_THREAD_ATTR even after a #error to make the error message more visible (e.g. gcc doesn't immediately stop after the #error line and outputs many error messages if MPFR_THREAD_ATTR @@ -42,4 +45,197 @@ # endif #endif +/* If MPFR needs a lock mechanism for thread synchro */ +#ifdef MPFR_NEED_THREAD_LOCK + +/**************************************************************************/ +/**************************************************************************/ +/* ISO C11 version */ +/**************************************************************************/ +/**************************************************************************/ + +#if defined (MPFR_HAVE_C11_LOCK) +/* NOTE: This version has not been completely tested */ + +#define MPFR_THREAD_LOCK_METHOD "C11" + +#include + +#define MPFR_LOCK_DECL(_lock) \ + mtx_t _lock; + +#define MPFR_LOCK_C(E) \ + do { \ + if ((E) != thrd_success) \ + abort (); \ + } while (0) + +#define MPFR_LOCK_INIT(_lock) MPFR_LOCK_C(mtx_init(&(_lock), mtx_plain)) +#define MPFR_LOCK_CLEAR(_lock) do { mtx_destroy(&(_lock)); } while (0) +#define MPFR_LOCK_READ(_lock) MPFR_LOCK_C(mtx_lock(&(_lock))) +#define MPFR_UNLOCK_READ(_lock) MPFR_LOCK_C(mtx_unlock(&(_lock))) +#define MPFR_LOCK_WRITE(_lock) MPFR_LOCK_C(mtx_lock(&(_lock))) +#define MPFR_UNLOCK_WRITE(_lock) MPFR_LOCK_C(mtx_unlock(&(_lock))) + +#define MPFR_LOCK_READ2WRITE(_lock) do {} while (0) +#define MPFR_LOCK_WRITE2READ(_lock) do {} while (0) + +#define MPFR_ONCE_DECL(_once) \ + once_flag _once; + +#define MPFR_ONCE_INIT_VALUE ONCE_FLAG_INIT + +#define MPFR_ONCE_CALL(_once, _func) do { \ + call_once(&(_once), (_func)); \ + } while (0) + +#define MPFR_NEED_DEFERRED_INIT 1 + + +/**************************************************************************/ +/**************************************************************************/ +/* POSIX version */ +/**************************************************************************/ +/**************************************************************************/ + +#elif defined (HAVE_PTHREAD) + +#define MPFR_THREAD_LOCK_METHOD "pthread" + +#include + +#define MPFR_LOCK_DECL(_lock) \ + pthread_rwlock_t _lock; + +#define MPFR_LOCK_C(E) \ + do { \ + if ((E) != 0) \ + abort (); \ + } while (0) + +#define MPFR_LOCK_INIT(_lock) MPFR_LOCK_C(pthread_rwlock_init(&(_lock), NULL)) + +#define MPFR_LOCK_CLEAR(_lock) do { \ + pthread_rwlock_destroy(&(_lock)); \ + } while (0) + +#define MPFR_LOCK_READ(_lock) MPFR_LOCK_C(pthread_rwlock_rdlock(&(_lock))) +#define MPFR_UNLOCK_READ(_lock) MPFR_LOCK_C(pthread_rwlock_unlock(&(_lock))) +#define MPFR_LOCK_WRITE(_lock) MPFR_LOCK_C(pthread_rwlock_wrlock(&(_lock))) +#define MPFR_UNLOCK_WRITE(_lock) MPFR_LOCK_C(pthread_rwlock_unlock(&(_lock))) + +#define MPFR_LOCK_READ2WRITE(_lock) do { \ + MPFR_UNLOCK_READ(_lock); \ + MPFR_LOCK_WRITE(_lock); \ + } while (0) + +#define MPFR_LOCK_WRITE2READ(_lock) do { \ + MPFR_UNLOCK_WRITE(_lock); \ + MPFR_LOCK_READ(_lock); \ + } while (0) + +#define MPFR_ONCE_DECL(_once) \ + pthread_once_t _once ; + +#define MPFR_ONCE_INIT_VALUE PTHREAD_ONCE_INIT + +#define MPFR_ONCE_CALL(_once, _func) \ + MPFR_LOCK_C(pthread_once (&(_once), (_func))) + +#define MPFR_NEED_DEFERRED_INIT 1 + +#else + +/* TODO: Win32 */ +# error "No thread lock / unsupported OS." + +#endif + +#else + +/**************************************************************************/ +/**************************************************************************/ +/* No lock thread version */ +/**************************************************************************/ +/**************************************************************************/ + +#define MPFR_LOCK_DECL(_lock) +#define MPFR_LOCK_INIT(_lock) do {} while (0) +#define MPFR_LOCK_CLEAR(_lock) do {} while (0) +#define MPFR_LOCK_READ(_lock) do {} while (0) +#define MPFR_UNLOCK_READ(_lock) do {} while (0) +#define MPFR_LOCK_WRITE(_lock) do {} while (0) +#define MPFR_UNLOCK_WRITE(_lock) do {} while (0) +#define MPFR_LOCK_READ2WRITE(_lock) do {} while (0) +#define MPFR_LOCK_WRITE2READ(_lock) do {} while (0) +#define MPFR_ONCE_INIT_VALUE +#define MPFR_ONCE_DECL(_once) +#define MPFR_ONCE_CALL(_once,_func) do {} while (0) + +#endif + + + +/**************************************************************************/ +/**************************************************************************/ + +/**************************************************************************/ +/**************************************************************************/ + +/* If MPFR Needs a way to init data before using them */ +#if defined(MPFR_NEED_DEFERRED_INIT) + +#if defined(MPFR_HAVE_CONSTRUCTOR_ATTR) + +/*********************** Use constructor extension ************************/ +#define MPFR_DEFERRED_INIT_MASTER_DECL(_id, _init, _clear) \ + __attribute__ ((constructor)) static void \ + mpfr_init_cache_ ## _id (void) { \ + _init ; \ + } \ + __attribute__ ((destructor)) static void \ + mpfr_clean_cache_ ## _id (void) { \ + _clear; \ + } + +#define MPFR_DEFERRED_INIT_CALL(_master) do {} while (0) +#define MPFR_DEFERRED_INIT_SLAVE_DECL() +#define MPFR_DEFERRED_INIT_SLAVE_VALUE(_id) + +#else + +/**************************** Use once semantic ***************************/ +#define MPFR_DEFERRED_INIT_MASTER_DECL(_id, _init, _clear) \ + static void mpfr_once_ ## _id ## _clear_func (void) { \ + _clear ; \ + } \ + static void mpfr_once_ ## _id ## _init_func (void) { \ + _init; \ + atexit(mpfr_once_ ## _id ## _clear_func); \ + } + +#define MPFR_DEFERRED_INIT_CALL(_master) \ + MPFR_ONCE_CALL((_master)->once, (_master)->init_once) + +#define MPFR_DEFERRED_INIT_SLAVE_DECL() \ + MPFR_ONCE_DECL(once) \ + void (*init_once)(void); + +#define MPFR_DEFERRED_INIT_SLAVE_VALUE(_id) \ + , MPFR_ONCE_INIT_VALUE, mpfr_once_ ## _id ## _init_func + +#endif + +#else + +/* No need */ +#define MPFR_DEFERRED_INIT_MASTER_DECL(_id_lock, _init, _clear) +#define MPFR_DEFERRED_INIT_CALL(_master) do {} while (0) +#define MPFR_DEFERRED_INIT_SLAVE_DECL() +#define MPFR_DEFERRED_INIT_SLAVE_VALUE(_id) + +#endif + +/**************************************************************************/ + #endif diff -Nru mpfr4-3.1.4/src/mpn_exp.c mpfr4-4.0.2/src/mpn_exp.c --- mpfr4-3.1.4/src/mpn_exp.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/mpn_exp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_mpn_exp -- auxiliary function for mpfr_get_str and mpfr_set_str -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ @@ -91,7 +91,9 @@ n1 = (n * GMP_NUMB_BITS - bits) / GMP_NUMB_BITS; /* square of A : {c+2n1, 2(n-n1)} = {a+n1, n-n1}^2 */ - mpn_sqr_n (c + 2 * n1, a + n1, n - n1); + /* TODO: we should use a short square here, but this needs to redo + the error analysis */ + mpn_sqr (c + 2 * n1, a + n1, n - n1); /* set {c+n, 2n1-n} to 0 : {c, n} = {a, n}^2*K^n */ diff -Nru mpfr4-3.1.4/src/mul_2exp.c mpfr4-4.0.2/src/mul_2exp.c --- mpfr4-3.1.4/src/mul_2exp.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/mul_2exp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_mul_2exp -- multiply a floating-point number by a power of two -Copyright 1999, 2001, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999, 2001, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/mul_2si.c mpfr4-4.0.2/src/mul_2si.c --- mpfr4-3.1.4/src/mul_2si.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/mul_2si.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_mul_2si -- multiply a floating-point number by a power of two -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/mul_2ui.c mpfr4-4.0.2/src/mul_2ui.c --- mpfr4-3.1.4/src/mul_2ui.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/mul_2ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_mul_2ui -- multiply a floating-point number by a power of two -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -33,7 +33,7 @@ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y, inexact)); - inexact = MPFR_UNLIKELY(y != x) ? mpfr_set (y, x, rnd_mode) : 0; + inexact = (y != x) ? mpfr_set (y, x, rnd_mode) : 0; if (MPFR_LIKELY( MPFR_IS_PURE_FP(y)) ) { diff -Nru mpfr4-3.1.4/src/mul.c mpfr4-4.0.2/src/mul.c --- mpfr4-3.1.4/src/mul.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/mul.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_mul -- multiply two floating-point numbers -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -28,8 +28,7 @@ /* Check if we have to check the result of mpfr_mul. TODO: Find a better (and faster?) check than using old implementation */ -#ifdef MPFR_WANT_ASSERT -# if MPFR_WANT_ASSERT >= 3 +#if MPFR_WANT_ASSERT >= 2 int mpfr_mul2 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode); static int @@ -57,7 +56,7 @@ { if (MPFR_IS_INF(c) || MPFR_NOTZERO(c)) { - MPFR_SET_SIGN(a,sign_product); + MPFR_SET_SIGN(a, sign_product); MPFR_SET_INF(a); MPFR_RET(0); /* exact */ } @@ -164,6 +163,9 @@ mpfr_t ta, tb, tc; int inexact1, inexact2; + if (rnd_mode == MPFR_RNDF) + return mpfr_mul2 (a, b, c, rnd_mode); + mpfr_init2 (ta, MPFR_PREC (a)); mpfr_init2 (tb, MPFR_PREC (b)); mpfr_init2 (tc, MPFR_PREC (c)); @@ -171,22 +173,32 @@ MPFR_ASSERTN (mpfr_set (tc, c, MPFR_RNDN) == 0); inexact2 = mpfr_mul3 (ta, tb, tc, rnd_mode); - inexact1 = mpfr_mul2 (a, b, c, rnd_mode); - if (mpfr_cmp (ta, a) || inexact1*inexact2 < 0 - || (inexact1*inexact2 == 0 && (inexact1|inexact2) != 0)) + inexact1 = mpfr_mul2 (a, b, c, rnd_mode); + if (MPFR_IS_NAN (ta) && MPFR_IS_NAN (a)) + { + /* Getting both NaN is OK. */ + } + else if (! mpfr_equal_p (ta, a) || ! SAME_SIGN (inexact1, inexact2)) { + /* We do not have MPFR_PREC_FSPEC, so let's use mpfr_eexp_t and + MPFR_EXP_FSPEC since mpfr_prec_t values are guaranteed to be + representable in mpfr_exp_t, thus in mpfr_eexp_t. */ fprintf (stderr, "mpfr_mul return different values for %s\n" - "Prec_a = %lu, Prec_b = %lu, Prec_c = %lu\nB = ", + "Prec_a = %" MPFR_EXP_FSPEC "d, " + "Prec_b = %" MPFR_EXP_FSPEC "d, " + "Prec_c = %" MPFR_EXP_FSPEC "d\nb = ", mpfr_print_rnd_mode (rnd_mode), - MPFR_PREC (a), MPFR_PREC (b), MPFR_PREC (c)); - mpfr_out_str (stderr, 16, 0, tb, MPFR_RNDN); - fprintf (stderr, "\nC = "); - mpfr_out_str (stderr, 16, 0, tc, MPFR_RNDN); - fprintf (stderr, "\nOldMul: "); - mpfr_out_str (stderr, 16, 0, ta, MPFR_RNDN); - fprintf (stderr, "\nNewMul: "); - mpfr_out_str (stderr, 16, 0, a, MPFR_RNDN); - fprintf (stderr, "\nNewInexact = %d | OldInexact = %d\n", + (mpfr_eexp_t) MPFR_PREC (a), + (mpfr_eexp_t) MPFR_PREC (b), + (mpfr_eexp_t) MPFR_PREC (c)); + mpfr_fdump (stderr, b); + fprintf (stderr, "c = "); + mpfr_fdump (stderr, c); + fprintf (stderr, "OldMul: "); + mpfr_fdump (stderr, ta); + fprintf (stderr, "NewMul: "); + mpfr_fdump (stderr, a); + fprintf (stderr, "NewInexact = %d | OldInexact = %d\n", inexact1, inexact2); MPFR_ASSERTN(0); } @@ -196,27 +208,493 @@ } # define mpfr_mul mpfr_mul2 -# endif -#endif + +#endif /* MPFR_WANT_ASSERT >= 2 */ /****** END OF CHECK *******/ /* Multiply 2 mpfr_t */ +#if !defined(MPFR_GENERIC_ABI) + +/* Special code for prec(a) < GMP_NUMB_BITS and + prec(b), prec(c) <= GMP_NUMB_BITS. + Note: this code was copied in sqr.c, function mpfr_sqr_1 (this saves a few cycles + with respect to have this function exported). As a consequence, any change here + should be reported in mpfr_sqr_1. */ +static int +mpfr_mul_1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode, + mpfr_prec_t p) +{ + mp_limb_t a0; + mpfr_limb_ptr ap = MPFR_MANT(a); + mp_limb_t b0 = MPFR_MANT(b)[0]; + mp_limb_t c0 = MPFR_MANT(c)[0]; + mpfr_exp_t ax; + mpfr_prec_t sh = GMP_NUMB_BITS - p; + mp_limb_t rb, sb, mask = MPFR_LIMB_MASK(sh); + + /* When prec(b), prec(c) <= GMP_NUMB_BITS / 2, we could replace umul_ppmm + by a limb multiplication as follows, but we assume umul_ppmm is as fast + as a limb multiplication on modern processors: + a0 = (b0 >> (GMP_NUMB_BITS / 2)) * (c0 >> (GMP_NUMB_BITS / 2)); + sb = 0; + */ + ax = MPFR_GET_EXP(b) + MPFR_GET_EXP(c); + umul_ppmm (a0, sb, b0, c0); + if (a0 < MPFR_LIMB_HIGHBIT) + { + ax --; + /* TODO: This is actually an addition with carry (no shifts and no OR + needed in asm). Make sure that GCC generates optimized code once + it supports carry-in. */ + a0 = (a0 << 1) | (sb >> (GMP_NUMB_BITS - 1)); + sb <<= 1; + } + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (a0 & mask) ^ rb; + ap[0] = a0 & ~mask; + + MPFR_SIGN(a) = MPFR_MULT_SIGN (MPFR_SIGN (b), MPFR_SIGN (c)); + + /* rounding */ + if (MPFR_UNLIKELY(ax > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); + + /* Warning: underflow should be checked *after* rounding, thus when rounding + away and when a > 0.111...111*2^(emin-1), or when rounding to nearest and + a >= 0.111...111[1]*2^(emin-1), there is no underflow. */ + if (MPFR_UNLIKELY(ax < __gmpfr_emin)) + { + if (ax == __gmpfr_emin - 1 && ap[0] == ~mask && + ((rnd_mode == MPFR_RNDN && rb) || + (MPFR_IS_LIKE_RNDA(rnd_mode, MPFR_IS_NEG (a)) && (rb | sb)))) + goto rounding; /* no underflow */ + /* For RNDN, mpfr_underflow always rounds away, thus for |a| <= 2^(emin-2) + we have to change to RNDZ. This corresponds to: + (a) either ax < emin - 1 + (b) or ax = emin - 1 and ap[0] = 1000....000 and rb = sb = 0 */ + if (rnd_mode == MPFR_RNDN && + (ax < __gmpfr_emin - 1 || + (ap[0] == MPFR_LIMB_HIGHBIT && (rb | sb) == 0))) + rnd_mode = MPFR_RNDZ; + return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a)); + } + + rounding: + MPFR_EXP (a) = ax; /* Don't use MPFR_SET_EXP since ax might be < __gmpfr_emin + in the cases "goto rounding" above. */ + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + { + MPFR_ASSERTD(ax >= __gmpfr_emin); + MPFR_RET (0); + } + else if (rnd_mode == MPFR_RNDN) + { + if (rb == 0 || (sb == 0 && (ap[0] & (MPFR_LIMB_ONE << sh)) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(a))) + { + truncate: + MPFR_ASSERTD(ax >= __gmpfr_emin); + MPFR_RET(-MPFR_SIGN(a)); + } + else /* round away from zero */ + { + add_one_ulp: + ap[0] += MPFR_LIMB_ONE << sh; + if (ap[0] == 0) + { + ap[0] = MPFR_LIMB_HIGHBIT; + if (MPFR_UNLIKELY(ax + 1 > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); + MPFR_ASSERTD(ax + 1 <= __gmpfr_emax); + MPFR_ASSERTD(ax + 1 >= __gmpfr_emin); + MPFR_SET_EXP (a, ax + 1); + } + MPFR_RET(MPFR_SIGN(a)); + } +} + +/* Special code for prec(a) = GMP_NUMB_BITS and + prec(b), prec(c) <= GMP_NUMB_BITS. */ +static int +mpfr_mul_1n (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) +{ + mp_limb_t a0; + mpfr_limb_ptr ap = MPFR_MANT(a); + mp_limb_t b0 = MPFR_MANT(b)[0]; + mp_limb_t c0 = MPFR_MANT(c)[0]; + mpfr_exp_t ax; + mp_limb_t rb, sb; + + ax = MPFR_GET_EXP(b) + MPFR_GET_EXP(c); + umul_ppmm (a0, sb, b0, c0); + if (a0 < MPFR_LIMB_HIGHBIT) + { + ax --; + /* TODO: This is actually an addition with carry (no shifts and no OR + needed in asm). Make sure that GCC generates optimized code once + it supports carry-in. */ + a0 = (a0 << 1) | (sb >> (GMP_NUMB_BITS - 1)); + sb <<= 1; + } + rb = sb & MPFR_LIMB_HIGHBIT; + sb = sb & ~MPFR_LIMB_HIGHBIT; + ap[0] = a0; + + MPFR_SIGN(a) = MPFR_MULT_SIGN (MPFR_SIGN (b), MPFR_SIGN (c)); + + /* rounding */ + if (MPFR_UNLIKELY(ax > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); + + /* Warning: underflow should be checked *after* rounding, thus when rounding + away and when a > 0.111...111*2^(emin-1), or when rounding to nearest and + a >= 0.111...111[1]*2^(emin-1), there is no underflow. + Note: this case can only occur when the initial a0 (after the umul_ppmm + call above) had its most significant bit 0, since the largest a0 is + obtained for b0 = c0 = B-1 where B=2^GMP_NUMB_BITS, thus b0*c0 <= (B-1)^2 + thus a0 <= B-2. */ + if (MPFR_UNLIKELY(ax < __gmpfr_emin)) + { + if (ax == __gmpfr_emin - 1 && ap[0] == ~MPFR_LIMB_ZERO && + ((rnd_mode == MPFR_RNDN && rb) || + (MPFR_IS_LIKE_RNDA(rnd_mode, MPFR_IS_NEG (a)) && (rb | sb)))) + goto rounding; /* no underflow */ + /* For RNDN, mpfr_underflow always rounds away, thus for |a| <= 2^(emin-2) + we have to change to RNDZ. This corresponds to: + (a) either ax < emin - 1 + (b) or ax = emin - 1 and ap[0] = 1000....000 and rb = sb = 0 */ + if (rnd_mode == MPFR_RNDN && + (ax < __gmpfr_emin - 1 || + (ap[0] == MPFR_LIMB_HIGHBIT && (rb | sb) == 0))) + rnd_mode = MPFR_RNDZ; + return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a)); + } + + rounding: + MPFR_EXP (a) = ax; /* Don't use MPFR_SET_EXP since ax might be < __gmpfr_emin + in the cases "goto rounding" above. */ + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + { + MPFR_ASSERTD(ax >= __gmpfr_emin); + MPFR_RET (0); + } + else if (rnd_mode == MPFR_RNDN) + { + if (rb == 0 || (sb == 0 && (ap[0] & MPFR_LIMB_ONE) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(a))) + { + truncate: + MPFR_ASSERTD(ax >= __gmpfr_emin); + MPFR_RET(-MPFR_SIGN(a)); + } + else /* round away from zero */ + { + add_one_ulp: + ap[0] += MPFR_LIMB_ONE; + if (ap[0] == 0) + { + ap[0] = MPFR_LIMB_HIGHBIT; + if (MPFR_UNLIKELY(ax + 1 > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); + MPFR_ASSERTD(ax + 1 <= __gmpfr_emax); + MPFR_ASSERTD(ax + 1 >= __gmpfr_emin); + MPFR_SET_EXP (a, ax + 1); + } + MPFR_RET(MPFR_SIGN(a)); + } +} + +/* Special code for GMP_NUMB_BITS < prec(a) < 2*GMP_NUMB_BITS and + GMP_NUMB_BITS < prec(b), prec(c) <= 2*GMP_NUMB_BITS. + Note: this code was copied in sqr.c, function mpfr_sqr_2 (this saves a few cycles + with respect to have this function exported). As a consequence, any change here + should be reported in mpfr_sqr_2. */ +static int +mpfr_mul_2 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode, + mpfr_prec_t p) +{ + mp_limb_t h, l, u, v, w; + mpfr_limb_ptr ap = MPFR_MANT(a); + mpfr_exp_t ax = MPFR_GET_EXP(b) + MPFR_GET_EXP(c); + mpfr_prec_t sh = 2 * GMP_NUMB_BITS - p; + mp_limb_t rb, sb, sb2, mask = MPFR_LIMB_MASK(sh); + mp_limb_t *bp = MPFR_MANT(b), *cp = MPFR_MANT(c); + + /* we store the 4-limb product in h=ap[1], l=ap[0], sb=ap[-1], sb2=ap[-2] */ + umul_ppmm (h, l, bp[1], cp[1]); + umul_ppmm (u, v, bp[1], cp[0]); + l += u; + h += (l < u); + umul_ppmm (u, w, bp[0], cp[1]); + l += u; + h += (l < u); + + /* now the full product is {h, l, v + w + high(b0*c0), low(b0*c0)}, + where the lower part contributes to less than 3 ulps to {h, l} */ + + /* If h has its most significant bit set and the low sh-1 bits of l are not + 000...000 nor 111...111 nor 111...110, then we can round correctly; + if h has zero as most significant bit, we have to shift left h and l, + thus if the low sh-2 bits are not 000...000 nor 111...111 nor 111...110, + then we can round correctly. To avoid an extra test we consider the latter + case (if we can round, we can also round in the former case). + For sh <= 3, we have mask <= 7, thus (mask>>2) <= 1, and the approximation + cannot be enough. */ + if (MPFR_LIKELY(((l + 2) & (mask >> 2)) > 2)) + sb = sb2 = 1; /* result cannot be exact in that case */ + else + { + umul_ppmm (sb, sb2, bp[0], cp[0]); + /* the full product is {h, l, sb + v + w, sb2} */ + sb += v; + l += (sb < v); + h += (l == 0) && (sb < v); + sb += w; + l += (sb < w); + h += (l == 0) && (sb < w); + } + if (h < MPFR_LIMB_HIGHBIT) + { + ax --; + h = (h << 1) | (l >> (GMP_NUMB_BITS - 1)); + l = (l << 1) | (sb >> (GMP_NUMB_BITS - 1)); + sb <<= 1; + /* no need to shift sb2 since we only want to know if it is zero or not */ + } + ap[1] = h; + rb = l & (MPFR_LIMB_ONE << (sh - 1)); + sb |= ((l & mask) ^ rb) | sb2; + ap[0] = l & ~mask; + + MPFR_SIGN(a) = MPFR_MULT_SIGN (MPFR_SIGN (b), MPFR_SIGN (c)); + + /* rounding */ + if (MPFR_UNLIKELY(ax > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); + + /* Warning: underflow should be checked *after* rounding, thus when rounding + away and when a > 0.111...111*2^(emin-1), or when rounding to nearest and + a >= 0.111...111[1]*2^(emin-1), there is no underflow. */ + if (MPFR_UNLIKELY(ax < __gmpfr_emin)) + { + if (ax == __gmpfr_emin - 1 && + ap[1] == MPFR_LIMB_MAX && + ap[0] == ~mask && + ((rnd_mode == MPFR_RNDN && rb) || + (MPFR_IS_LIKE_RNDA(rnd_mode, MPFR_IS_NEG (a)) && (rb | sb)))) + goto rounding; /* no underflow */ + /* for RNDN, mpfr_underflow always rounds away, thus for |a| <= 2^(emin-2) + we have to change to RNDZ */ + if (rnd_mode == MPFR_RNDN && + (ax < __gmpfr_emin - 1 || + (ap[1] == MPFR_LIMB_HIGHBIT && ap[0] == 0 && (rb | sb) == 0))) + rnd_mode = MPFR_RNDZ; + return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a)); + } + + rounding: + MPFR_EXP (a) = ax; /* Don't use MPFR_SET_EXP since ax might be < __gmpfr_emin + in the cases "goto rounding" above. */ + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + { + MPFR_ASSERTD(ax >= __gmpfr_emin); + MPFR_RET (0); + } + else if (rnd_mode == MPFR_RNDN) + { + if (rb == 0 || (sb == 0 && (ap[0] & (MPFR_LIMB_ONE << sh)) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(a))) + { + truncate: + MPFR_ASSERTD(ax >= __gmpfr_emin); + MPFR_RET(-MPFR_SIGN(a)); + } + else /* round away from zero */ + { + add_one_ulp: + ap[0] += MPFR_LIMB_ONE << sh; + ap[1] += (ap[0] == 0); + if (ap[1] == 0) + { + ap[1] = MPFR_LIMB_HIGHBIT; + if (MPFR_UNLIKELY(ax + 1 > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); + MPFR_ASSERTD(ax + 1 <= __gmpfr_emax); + MPFR_ASSERTD(ax + 1 >= __gmpfr_emin); + MPFR_SET_EXP (a, ax + 1); + } + MPFR_RET(MPFR_SIGN(a)); + } +} + +/* Special code for 2*GMP_NUMB_BITS < prec(a) < 3*GMP_NUMB_BITS and + 2*GMP_NUMB_BITS < prec(b), prec(c) <= 3*GMP_NUMB_BITS. */ +static int +mpfr_mul_3 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode, + mpfr_prec_t p) +{ + mp_limb_t a0, a1, a2, h, l, cy; + mpfr_limb_ptr ap = MPFR_MANT(a); + mpfr_exp_t ax = MPFR_GET_EXP(b) + MPFR_GET_EXP(c); + mpfr_prec_t sh = 3 * GMP_NUMB_BITS - p; + mp_limb_t rb, sb, sb2, mask = MPFR_LIMB_MASK(sh); + mp_limb_t *bp = MPFR_MANT(b), *cp = MPFR_MANT(c); + + /* we store the upper 3-limb product in a2, a1, a0: + b2*c2, b2*c1+b1*c2, b2*c0+b1*c1+b0*c2 */ + umul_ppmm (a2, a1, bp[2], cp[2]); + umul_ppmm (h, a0, bp[2], cp[1]); + a1 += h; + a2 += (a1 < h); + umul_ppmm (h, l, bp[1], cp[2]); + a1 += h; + a2 += (a1 < h); + a0 += l; + cy = a0 < l; /* carry in a1 */ + umul_ppmm (h, l, bp[2], cp[0]); + a0 += h; + cy += (a0 < h); + umul_ppmm (h, l, bp[1], cp[1]); + a0 += h; + cy += (a0 < h); + umul_ppmm (h, l, bp[0], cp[2]); + a0 += h; + cy += (a0 < h); + /* now propagate cy */ + a1 += cy; + a2 += (a1 < cy); + + /* Now the approximate product {a2, a1, a0} has an error of less than + 5 ulps (3 ulps for the ignored low limbs of b2*c0+b1*c1+b0*c2, + plus 2 ulps for the ignored b1*c0+b0*c1 (plus b0*c0)). + Since we might shift by 1 bit, we make sure the low sh-2 bits of a0 + are not 0, -1, -2, -3 or -4. */ + + if (MPFR_LIKELY(((a0 + 4) & (mask >> 2)) > 4)) + sb = sb2 = 1; /* result cannot be exact in that case */ + else + { + mp_limb_t p[6]; + mpn_mul_n (p, bp, cp, 3); + a2 = p[5]; + a1 = p[4]; + a0 = p[3]; + sb = p[2]; + sb2 = p[1] | p[0]; + } + if (a2 < MPFR_LIMB_HIGHBIT) + { + ax --; + a2 = (a2 << 1) | (a1 >> (GMP_NUMB_BITS - 1)); + a1 = (a1 << 1) | (a0 >> (GMP_NUMB_BITS - 1)); + a0 = (a0 << 1) | (sb >> (GMP_NUMB_BITS - 1)); + sb <<= 1; + /* no need to shift sb2: we only need to know if it is zero or not */ + } + ap[2] = a2; + ap[1] = a1; + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= ((a0 & mask) ^ rb) | sb2; + ap[0] = a0 & ~mask; + + MPFR_SIGN(a) = MPFR_MULT_SIGN (MPFR_SIGN (b), MPFR_SIGN (c)); + + /* rounding */ + if (MPFR_UNLIKELY(ax > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); + + /* Warning: underflow should be checked *after* rounding, thus when rounding + away and when a > 0.111...111*2^(emin-1), or when rounding to nearest and + a >= 0.111...111[1]*2^(emin-1), there is no underflow. */ + if (MPFR_UNLIKELY(ax < __gmpfr_emin)) + { + if (ax == __gmpfr_emin - 1 && + ap[2] == MPFR_LIMB_MAX && + ap[1] == MPFR_LIMB_MAX && + ap[0] == ~mask && + ((rnd_mode == MPFR_RNDN && rb) || + (MPFR_IS_LIKE_RNDA(rnd_mode, MPFR_IS_NEG (a)) && (rb | sb)))) + goto rounding; /* no underflow */ + /* for RNDN, mpfr_underflow always rounds away, thus for |a| <= 2^(emin-2) + we have to change to RNDZ */ + if (rnd_mode == MPFR_RNDN && + (ax < __gmpfr_emin - 1 || + (ap[2] == MPFR_LIMB_HIGHBIT && ap[1] == 0 && ap[0] == 0 + && (rb | sb) == 0))) + rnd_mode = MPFR_RNDZ; + return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a)); + } + + rounding: + MPFR_EXP (a) = ax; /* Don't use MPFR_SET_EXP since ax might be < __gmpfr_emin + in the cases "goto rounding" above. */ + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + { + MPFR_ASSERTD(ax >= __gmpfr_emin); + MPFR_RET (0); + } + else if (rnd_mode == MPFR_RNDN) + { + if (rb == 0 || (sb == 0 && (ap[0] & (MPFR_LIMB_ONE << sh)) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(a))) + { + truncate: + MPFR_ASSERTD(ax >= __gmpfr_emin); + MPFR_RET(-MPFR_SIGN(a)); + } + else /* round away from zero */ + { + add_one_ulp: + ap[0] += MPFR_LIMB_ONE << sh; + ap[1] += (ap[0] == 0); + ap[2] += (ap[1] == 0) && (ap[0] == 0); + if (ap[2] == 0) + { + ap[2] = MPFR_LIMB_HIGHBIT; + if (MPFR_UNLIKELY(ax + 1 > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); + MPFR_ASSERTD(ax + 1 <= __gmpfr_emax); + MPFR_ASSERTD(ax + 1 >= __gmpfr_emin); + MPFR_SET_EXP (a, ax + 1); + } + MPFR_RET(MPFR_SIGN(a)); + } +} + +#endif /* !defined(MPFR_GENERIC_ABI) */ + /* Note: mpfr_sqr will call mpfr_mul if bn > MPFR_SQR_THRESHOLD, in order to use Mulders' mulhigh, which is handled only here to avoid partial code duplication. There is some overhead due to the additional tests, but slowdown should not be noticeable as this code is not executed in very small precisions. */ -int +MPFR_HOT_FUNCTION_ATTR int mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) { int sign, inexact; mpfr_exp_t ax, ax2; mp_limb_t *tmp; mp_limb_t b1; - mpfr_prec_t bq, cq; + mpfr_prec_t aq, bq, cq; mp_size_t bn, cn, tn, k, threshold; MPFR_TMP_DECL (marker); @@ -272,13 +750,35 @@ MPFR_RET (0); } } + + aq = MPFR_GET_PREC (a); + bq = MPFR_GET_PREC (b); + cq = MPFR_GET_PREC (c); + +#if !defined(MPFR_GENERIC_ABI) + if (aq == bq && aq == cq) + { + if (aq < GMP_NUMB_BITS) + return mpfr_mul_1 (a, b, c, rnd_mode, aq); + + if (GMP_NUMB_BITS < aq && aq < 2 * GMP_NUMB_BITS) + return mpfr_mul_2 (a, b, c, rnd_mode, aq); + + if (aq == GMP_NUMB_BITS) + return mpfr_mul_1n (a, b, c, rnd_mode); + + if (2 * GMP_NUMB_BITS < aq && aq < 3 * GMP_NUMB_BITS) + return mpfr_mul_3 (a, b, c, rnd_mode, aq); + } +#endif + sign = MPFR_MULT_SIGN (MPFR_SIGN (b), MPFR_SIGN (c)); ax = MPFR_GET_EXP (b) + MPFR_GET_EXP (c); /* Note: the exponent of the exact result will be e = bx + cx + ec with ec in {-1,0,1} and the following assumes that e is representable. */ - /* FIXME: Useful since we do an exponent check after ? + /* FIXME: Useful since we do an exponent check after? * It is useful iff the precision is big, there is an overflow * and we are doing further mults...*/ #ifdef HUGE @@ -289,9 +789,6 @@ sign); #endif - bq = MPFR_PREC (b); - cq = MPFR_PREC (c); - MPFR_ASSERTN ((mpfr_uprec_t) bq + cq <= MPFR_PREC_MAX); bn = MPFR_PREC2LIMBS (bq); /* number of limbs of b */ @@ -300,7 +797,7 @@ tn = MPFR_PREC2LIMBS (bq + cq); MPFR_ASSERTD (tn <= k); /* tn <= k, thus no int overflow */ - /* Check for no size_t overflow*/ + /* Check for no size_t overflow. */ MPFR_ASSERTD ((size_t) k <= ((size_t) -1) / MPFR_BYTES_PER_MP_LIMB); MPFR_TMP_MARK (marker); tmp = MPFR_TMP_LIMBS_ALLOC (k); @@ -316,19 +813,19 @@ cn = zn; } MPFR_ASSERTD (bn >= cn); - if (MPFR_LIKELY (bn <= 2)) + if (bn <= 2) { + /* The 3 cases perform the same first operation. */ + umul_ppmm (tmp[1], tmp[0], MPFR_MANT (b)[0], MPFR_MANT (c)[0]); if (bn == 1) { /* 1 limb * 1 limb */ - umul_ppmm (tmp[1], tmp[0], MPFR_MANT (b)[0], MPFR_MANT (c)[0]); b1 = tmp[1]; } else if (MPFR_UNLIKELY (cn == 1)) { /* 2 limbs * 1 limb */ mp_limb_t t; - umul_ppmm (tmp[1], tmp[0], MPFR_MANT (b)[0], MPFR_MANT (c)[0]); umul_ppmm (tmp[2], t, MPFR_MANT (b)[1], MPFR_MANT (c)[0]); add_ssaaaa (tmp[2], tmp[1], tmp[2], tmp[1], 0, t); b1 = tmp[2]; @@ -338,7 +835,6 @@ /* 2 limbs * 2 limbs */ mp_limb_t t1, t2, t3; /* First 2 limbs * 1 limb */ - umul_ppmm (tmp[1], tmp[0], MPFR_MANT (b)[0], MPFR_MANT (c)[0]); umul_ppmm (tmp[2], t1, MPFR_MANT (b)[1], MPFR_MANT (c)[0]); add_ssaaaa (tmp[2], tmp[1], tmp[2], tmp[1], 0, t1); /* Second, the other 2 limbs * 1 limb product */ @@ -358,7 +854,7 @@ else /* Mulders' mulhigh. This code can also be used via mpfr_sqr, hence the tests b != c. */ - if (MPFR_UNLIKELY (bn > (threshold = b != c ? + if (MPFR_UNLIKELY (cn > (threshold = b != c ? MPFR_MUL_THRESHOLD : MPFR_SQR_THRESHOLD))) { mp_limb_t *bp, *cp; @@ -369,7 +865,8 @@ exact values are a nightmare for the short product trick */ bp = MPFR_MANT (b); cp = MPFR_MANT (c); - MPFR_ASSERTN (threshold >= 1); + MPFR_STAT_STATIC_ASSERT (MPFR_MUL_THRESHOLD >= 1 && + MPFR_SQR_THRESHOLD >= 1); if (MPFR_UNLIKELY ((bp[0] == 0 && bp[1] == 0) || (cp[0] == 0 && cp[1] == 0))) { @@ -384,7 +881,7 @@ MPFR_ASSERTD (bn > 0); } /* This must end since the most significant limb is != 0 */ - /* Check for c too: if b ==c, will do nothing */ + /* Check for c too: if b == c, this will do nothing */ while (*cp == 0) { cp++; @@ -392,7 +889,7 @@ MPFR_ASSERTD (cn > 0); } /* This must end since the most significant limb is != 0 */ - /* It is not the faster way, but it is safer */ + /* It is not the fastest way, but it is safer. */ MPFR_SET_SAME_SIGN (b_tmp, b); MPFR_SET_EXP (b_tmp, MPFR_GET_EXP (b)); MPFR_PREC (b_tmp) = bn * GMP_NUMB_BITS; @@ -426,14 +923,14 @@ /* Check if MulHigh can produce a roundable result. We may lose 1 bit due to RNDN, 1 due to final shift. */ - if (MPFR_UNLIKELY (MPFR_PREC (a) > p - 5)) + if (MPFR_UNLIKELY (aq > p - 5)) { - if (MPFR_UNLIKELY (MPFR_PREC (a) > p - 5 + GMP_NUMB_BITS + if (MPFR_UNLIKELY (aq > p - 5 + GMP_NUMB_BITS || bn <= threshold + 1)) { /* MulHigh can't produce a roundable result. */ MPFR_LOG_MSG (("mpfr_mulhigh can't be used (%lu VS %lu)\n", - MPFR_PREC (a), p)); + aq, p)); goto full_multiply; } /* Add one extra limb to mantissa of b and c. */ @@ -462,7 +959,7 @@ Mulders' short product */ p = n * GMP_NUMB_BITS - MPFR_INT_CEIL_LOG2 (n + 2); /* Due to some nasty reasons we can have only 4 bits */ - MPFR_ASSERTD (MPFR_PREC (a) <= p - 4); + MPFR_ASSERTD (aq <= p - 4); if (MPFR_LIKELY (k < 2*n)) { @@ -470,21 +967,14 @@ tmp += 2*n-k; /* `tmp' still points to an area of `k' limbs */ } } - MPFR_LOG_MSG (("Use mpfr_mulhigh (%lu VS %lu)\n", MPFR_PREC (a), p)); + MPFR_LOG_MSG (("Use mpfr_mulhigh (%lu VS %lu)\n", aq, p)); /* Compute an approximation of the product of b and c */ if (b != c) mpfr_mulhigh_n (tmp + k - 2 * n, bp, cp, n); else mpfr_sqrhigh_n (tmp + k - 2 * n, bp, n); - /* now tmp[0]..tmp[k-1] contains the product of both mantissa, - with tmp[k-1]>=2^(GMP_NUMB_BITS-2) */ - /* [VL] FIXME: This cannot be true: mpfr_mulhigh_n only - depends on pointers and n. As k can be arbitrarily larger, - the result cannot depend on k. And indeed, with GMP compiled - with --enable-alloca=debug, valgrind was complaining, at - least because MPFR_RNDRAW at the end tried to compute the - sticky bit even when not necessary; this problem is fixed, - but there's at least something wrong with the comment above. */ + /* now tmp[k-n]..tmp[k-1] contains an approximation of the n upper + limbs of the product, with tmp[k-1] >= 2^(GMP_NUMB_BITS-2) */ b1 = tmp[k-1] >> (GMP_NUMB_BITS - 1); /* msb from the product */ /* If the mantissas of b and c are uniformly distributed in (1/2, 1], @@ -495,12 +985,18 @@ tmp[k-n-1..k-1], thus we shift only those limbs */ mpn_lshift (tmp + k - n - 1, tmp + k - n - 1, n + 1, 1); tmp += k - tn; + /* now the approximation is in tmp[tn-n]...tmp[tn-1] */ MPFR_ASSERTD (MPFR_LIMB_MSB (tmp[tn-1]) != 0); + /* for RNDF, we simply use RNDZ, since anyway here we multiply numbers + with large precisions, thus the overhead of RNDZ is small */ + if (rnd_mode == MPFR_RNDF) + rnd_mode = MPFR_RNDZ; + /* if the most significant bit b1 is zero, we have only p-1 correct bits */ - if (MPFR_UNLIKELY (!mpfr_round_p (tmp, tn, p + b1 - 1, MPFR_PREC(a) - + (rnd_mode == MPFR_RNDN)))) + if (MPFR_UNLIKELY (!mpfr_round_p (tmp, tn, p + b1 - 1, + aq + (rnd_mode == MPFR_RNDN)))) { tmp -= k - tn; /* tmp may have changed, FIX IT!!!!! */ goto full_multiply; @@ -525,9 +1021,9 @@ } ax2 = ax + (mpfr_exp_t) (b1 - 1); - MPFR_RNDRAW (inexact, a, tmp, bq+cq, rnd_mode, sign, ax2++); + MPFR_RNDRAW (inexact, a, tmp, bq + cq, rnd_mode, sign, ax2++); MPFR_TMP_FREE (marker); - MPFR_EXP (a) = ax2; /* Can't use MPFR_SET_EXP: Expo may be out of range */ + MPFR_EXP (a) = ax2; /* Can't use MPFR_SET_EXP: Expo may be out of range */ MPFR_SET_SIGN (a, sign); if (MPFR_UNLIKELY (ax2 > __gmpfr_emax)) return mpfr_overflow (a, rnd_mode, sign); diff -Nru mpfr4-3.1.4/src/mul_d.c mpfr4-4.0.2/src/mul_d.c --- mpfr4-3.1.4/src/mul_d.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/mul_d.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_mul_d -- multiply a multiple precision floating-point number by a machine double precision float -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -28,6 +28,7 @@ { int inexact; mpfr_t d; + mp_limb_t tmp_man[MPFR_LIMBS_PER_DOUBLE]; MPFR_SAVE_EXPO_DECL (expo); MPFR_LOG_FUNC @@ -38,15 +39,14 @@ MPFR_SAVE_EXPO_MARK (expo); - mpfr_init2 (d, IEEE_DBL_MANT_DIG); + MPFR_TMP_INIT1(tmp_man, d, IEEE_DBL_MANT_DIG); inexact = mpfr_set_d (d, c, rnd_mode); - MPFR_ASSERTN (inexact == 0); + MPFR_ASSERTD (inexact == 0); - mpfr_clear_flags (); + MPFR_CLEAR_FLAGS (); inexact = mpfr_mul (a, b, d, rnd_mode); MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); - mpfr_clear(d); MPFR_SAVE_EXPO_FREE (expo); return mpfr_check_range (a, inexact, rnd_mode); } diff -Nru mpfr4-3.1.4/src/mulders.c mpfr4-4.0.2/src/mulders.c --- mpfr4-3.1.4/src/mulders.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/mulders.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ -/* Mulders' MulHigh function (short product) +/* Mulders' short product, square and division. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* References: @@ -26,6 +26,9 @@ July 25-27, 2011, pages 7-14. */ +/* Defines it to 1 to use short div (or 0 for FoldDiv(K)) */ +#define USE_SHORT_DIV 1 + #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" @@ -38,8 +41,7 @@ static short mulhigh_ktab[MPFR_MULHIGH_TAB_SIZE]; #else static short mulhigh_ktab[] = {MPFR_MULHIGH_TAB}; -#define MPFR_MULHIGH_TAB_SIZE \ - ((mp_size_t) (sizeof(mulhigh_ktab) / sizeof(mulhigh_ktab[0]))) +#define MPFR_MULHIGH_TAB_SIZE (numberof_const (mulhigh_ktab)) #endif /* Put in rp[n..2n-1] an approximation of the n high limbs @@ -64,19 +66,6 @@ /* in total, we neglect less than n*B^n, i.e., n ulps of rp[n]. */ } -/* Put in rp[0..n] the n+1 low limbs of {up, n} * {vp, n}. - Assume 2n limbs are allocated at rp. */ -static void -mpfr_mullow_n_basecase (mpfr_limb_ptr rp, mpfr_limb_srcptr up, - mpfr_limb_srcptr vp, mp_size_t n) -{ - mp_size_t i; - - rp[n] = mpn_mul_1 (rp, up, n, vp[0]); - for (i = 1 ; i < n ; i++) - mpn_addmul_1 (rp + i, up, n - i + 1, vp[i]); -} - /* Put in rp[n..2n-1] an approximation of the n high limbs of {np, n} * {mp, n}. The error is less than n ulps of rp[n] (and the approximation is always less or equal to the truncated full product). @@ -89,7 +78,7 @@ { mp_size_t k; - MPFR_ASSERTN (MPFR_MULHIGH_TAB_SIZE >= 8); /* so that 3*(n/4) > n/2 */ + MPFR_STAT_STATIC_ASSERT (MPFR_MULHIGH_TAB_SIZE >= 8); /* so that 3*(n/4) > n/2 */ k = MPFR_LIKELY (n < MPFR_MULHIGH_TAB_SIZE) ? mulhigh_ktab[n] : 3*(n/4); /* Algorithm ShortMul from [1] requires k >= (n+3)/2, which translates into k >= (n+4)/2 in the C language. */ @@ -114,6 +103,20 @@ } } +#if USE_SHORT_DIV == 0 +/* Put in rp[0..n] the n+1 low limbs of {up, n} * {vp, n}. + Assume 2n limbs are allocated at rp. */ +static void +mpfr_mullow_n_basecase (mpfr_limb_ptr rp, mpfr_limb_srcptr up, + mpfr_limb_srcptr vp, mp_size_t n) +{ + mp_size_t i; + + rp[n] = mpn_mul_1 (rp, up, n, vp[0]); + for (i = 1 ; i < n ; i++) + mpn_addmul_1 (rp + i, up, n - i + 1, vp[i]); +} + /* Put in rp[0..n] the n+1 low limbs of {np, n} * {mp, n}. Assume 2n limbs are allocated at rp. */ void @@ -122,7 +125,7 @@ { mp_size_t k; - MPFR_ASSERTN (MPFR_MULHIGH_TAB_SIZE >= 8); /* so that 3*(n/4) > n/2 */ + MPFR_STAT_STATIC_ASSERT (MPFR_MULHIGH_TAB_SIZE >= 8); /* so that 3*(n/4) > n/2 */ k = MPFR_LIKELY (n < MPFR_MULHIGH_TAB_SIZE) ? mulhigh_ktab[n] : 3*(n/4); MPFR_ASSERTD (k == -1 || k == 0 || (2 * k >= n && k < n)); if (k < 0) @@ -142,12 +145,13 @@ mpn_add_n (rp + k, rp + k, rp + n, l + 1); } } +#endif #ifdef MPFR_SQRHIGH_TAB_SIZE static short sqrhigh_ktab[MPFR_SQRHIGH_TAB_SIZE]; #else static short sqrhigh_ktab[] = {MPFR_SQRHIGH_TAB}; -#define MPFR_SQRHIGH_TAB_SIZE (sizeof(sqrhigh_ktab) / sizeof(sqrhigh_ktab[0])) +#define MPFR_SQRHIGH_TAB_SIZE (numberof_const (sqrhigh_ktab)) #endif /* Put in rp[n..2n-1] an approximation of the n high limbs @@ -157,7 +161,7 @@ { mp_size_t k; - MPFR_ASSERTN (MPFR_SQRHIGH_TAB_SIZE > 2); /* ensures k < n */ + MPFR_STAT_STATIC_ASSERT (MPFR_SQRHIGH_TAB_SIZE > 2); /* ensures k < n */ k = MPFR_LIKELY (n < MPFR_SQRHIGH_TAB_SIZE) ? sqrhigh_ktab[n] : (n+4)/2; /* ensures that k >= (n+3)/2 */ MPFR_ASSERTD (k == -1 || k == 0 || (k >= (n+4)/2 && k < n)); @@ -165,7 +169,7 @@ /* we can't use mpn_sqr_basecase here, since it requires n <= SQR_KARATSUBA_THRESHOLD, where SQR_KARATSUBA_THRESHOLD is not exported by GMP */ - mpn_sqr_n (rp, np, n); + mpn_sqr (rp, np, n); else if (k == 0) mpfr_mulhigh_n_basecase (rp, np, np, n); else @@ -173,7 +177,7 @@ mp_size_t l = n - k; mp_limb_t cy; - mpn_sqr_n (rp + 2 * l, np + l, k); /* fills rp[2l..2n-1] */ + mpn_sqr (rp + 2 * l, np + l, k); /* fills rp[2l..2n-1] */ mpfr_mulhigh_n (rp, np, np + k, l); /* fills rp[l-1..2l-1] */ /* {rp+n-1,l+1} += 2 * {rp+l-1,l+1} */ cy = mpn_lshift (rp + l - 1, rp + l - 1, l + 1, 1); @@ -182,15 +186,13 @@ } } +#if USE_SHORT_DIV == 1 + #ifdef MPFR_DIVHIGH_TAB_SIZE static short divhigh_ktab[MPFR_DIVHIGH_TAB_SIZE]; #else static short divhigh_ktab[] = {MPFR_DIVHIGH_TAB}; -#define MPFR_DIVHIGH_TAB_SIZE (sizeof(divhigh_ktab) / sizeof(divhigh_ktab[0])) -#endif - -#ifndef __GMPFR_GMP_H__ -#define mpfr_pi1_t gmp_pi1_t /* with a GMP build */ +#define MPFR_DIVHIGH_TAB_SIZE (numberof_const (divhigh_ktab)) #endif #if !(defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_SBPI1_DIVAPPR_Q)) @@ -240,7 +242,7 @@ since we truncate the divisor at each step, but since {np,n} < D originally, the largest possible partial quotient is B-1. */ if (MPFR_UNLIKELY(np[n-1] > d1 || (np[n-1] == d1 && np[n-2] >= d0))) - q2 = ~ (mp_limb_t) 0; + q2 = MPFR_LIMB_MAX; else udiv_qr_3by2 (q2, q1, q0, np[n - 1], np[n - 2], np[n - 3], d1, d0, dinv2.inv32); @@ -290,7 +292,6 @@ This implements the ShortDiv algorithm from reference [1]. */ -#if 1 mp_limb_t mpfr_divhigh_n (mpfr_limb_ptr qp, mpfr_limb_ptr np, mpfr_limb_ptr dp, mp_size_t n) @@ -300,7 +301,7 @@ mpfr_limb_ptr tp; MPFR_TMP_DECL(marker); - MPFR_ASSERTN (MPFR_MULHIGH_TAB_SIZE >= 15); /* so that 2*(n/3) >= (n+4)/2 */ + MPFR_STAT_STATIC_ASSERT (MPFR_DIVHIGH_TAB_SIZE >= 15); /* so that 2*(n/3) >= (n+4)/2 */ k = MPFR_LIKELY (n < MPFR_DIVHIGH_TAB_SIZE) ? divhigh_ktab[n] : 2*(n/3); if (k == 0) @@ -348,7 +349,9 @@ return qh; } + #else /* below is the FoldDiv(K) algorithm from [1] */ + mp_limb_t mpfr_divhigh_n (mpfr_limb_ptr qp, mpfr_limb_ptr np, mpfr_limb_ptr dp, mp_size_t n) diff -Nru mpfr4-3.1.4/src/mul_ui.c mpfr4-4.0.2/src/mul_ui.c --- mpfr4-3.1.4/src/mul_ui.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/mul_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,6 @@ /* mpfr_mul_ui -- multiply a floating-point number by a machine integer - mpfr_mul_si -- multiply a floating-point number by a machine integer -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,13 +17,14 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" -int +#undef mpfr_mul_ui +MPFR_HOT_FUNCTION_ATTR int mpfr_mul_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mpfr_rnd_t rnd_mode) { mp_limb_t *yp; @@ -61,7 +61,7 @@ MPFR_RET (0); /* zero is exact */ } } - else if (MPFR_UNLIKELY (u <= 1)) + else if (u <= 1) { if (u < 1) { @@ -117,18 +117,3 @@ MPFR_RET (inexact); } - -int mpfr_mul_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode) -{ - int res; - - if (u >= 0) - res = mpfr_mul_ui (y, x, u, rnd_mode); - else - { - res = - mpfr_mul_ui (y, x, - (unsigned long) u, - MPFR_INVERT_RND (rnd_mode)); - MPFR_CHANGE_SIGN (y); - } - return res; -} diff -Nru mpfr4-3.1.4/src/neg.c mpfr4-4.0.2/src/neg.c --- mpfr4-3.1.4/src/neg.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/neg.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_neg -- change the sign of a floating-point number -Copyright 1999-2001, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999-2001, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -27,13 +27,12 @@ { if (MPFR_UNLIKELY(a != b)) return mpfr_set4 (a, b, rnd_mode, -MPFR_SIGN(b)); - else if (MPFR_UNLIKELY(MPFR_IS_NAN (b))) - { - MPFR_RET_NAN; - } else { - MPFR_CHANGE_SIGN(a); - MPFR_RET(0); + MPFR_CHANGE_SIGN (a); + if (MPFR_UNLIKELY (MPFR_IS_NAN (b))) + MPFR_RET_NAN; + else + MPFR_RET (0); } } diff -Nru mpfr4-3.1.4/src/next.c mpfr4-4.0.2/src/next.c --- mpfr4-3.1.4/src/next.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/next.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_nextabove, mpfr_nextbelow, mpfr_nexttoward -- next representable floating-point number -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,23 +18,32 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* Note concerning the exceptions: In case of NaN result, the NaN flag is + * set as usual. No underflow or overflow is generated (this contradicts + * the obsolete IEEE 754-1985 standard for Nextafter, but conforms to the + * current standard IEEE 754-2008 for nextUp and nextDown). + */ + #include "mpfr-impl.h" void mpfr_nexttozero (mpfr_ptr x) { - if (MPFR_UNLIKELY(MPFR_IS_INF(x))) - { - mpfr_setmax (x, __gmpfr_emax); - return; - } - else if (MPFR_UNLIKELY( MPFR_IS_ZERO(x) )) + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) { - MPFR_CHANGE_SIGN(x); - mpfr_setmin (x, __gmpfr_emin); + if (MPFR_IS_INF (x)) + { + mpfr_setmax (x, __gmpfr_emax); + } + else + { + MPFR_ASSERTN (MPFR_IS_ZERO (x)); + MPFR_CHANGE_SIGN(x); + mpfr_setmin (x, __gmpfr_emin); + } } else { @@ -46,18 +55,17 @@ MPFR_UNSIGNED_MINUS_MODULO (sh, MPFR_PREC(x)); xp = MPFR_MANT(x); mpn_sub_1 (xp, xp, xn, MPFR_LIMB_ONE << sh); - if (MPFR_UNLIKELY( MPFR_LIMB_MSB(xp[xn-1]) == 0) ) - { /* was an exact power of two: not normalized any more */ + if (MPFR_UNLIKELY (MPFR_LIMB_MSB (xp[xn-1]) == 0)) + { /* was an exact power of two: not normalized any more, + thus do not use MPFR_GET_EXP. */ mpfr_exp_t exp = MPFR_EXP (x); - if (MPFR_UNLIKELY(exp == __gmpfr_emin)) + if (MPFR_UNLIKELY (exp == __gmpfr_emin)) MPFR_SET_ZERO(x); else { - mp_size_t i; MPFR_SET_EXP (x, exp - 1); - xp[0] = MP_LIMB_T_MAX << sh; - for (i = 1; i < xn; i++) - xp[i] = MP_LIMB_T_MAX; + /* The following is valid whether xn = 1 or xn > 1. */ + xp[xn-1] |= MPFR_LIMB_HIGHBIT; } } } @@ -66,10 +74,11 @@ void mpfr_nexttoinf (mpfr_ptr x) { - if (MPFR_UNLIKELY(MPFR_IS_INF(x))) - return; - else if (MPFR_UNLIKELY(MPFR_IS_ZERO(x))) - mpfr_setmin (x, __gmpfr_emin); + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) + { + if (MPFR_IS_ZERO (x)) + mpfr_setmin (x, __gmpfr_emin); + } else { mp_size_t xn; @@ -79,12 +88,12 @@ xn = MPFR_LIMB_SIZE (x); MPFR_UNSIGNED_MINUS_MODULO (sh, MPFR_PREC(x)); xp = MPFR_MANT(x); - if (MPFR_UNLIKELY( mpn_add_1 (xp, xp, xn, MPFR_LIMB_ONE << sh)) ) + if (MPFR_UNLIKELY (mpn_add_1 (xp, xp, xn, MPFR_LIMB_ONE << sh))) /* got 1.0000... */ { mpfr_exp_t exp = MPFR_EXP (x); - if (MPFR_UNLIKELY(exp == __gmpfr_emax)) - MPFR_SET_INF(x); + if (MPFR_UNLIKELY (exp == __gmpfr_emax)) + MPFR_SET_INF (x); else { MPFR_SET_EXP (x, exp + 1); diff -Nru mpfr4-3.1.4/src/nrandom.c mpfr4-4.0.2/src/nrandom.c --- mpfr4-3.1.4/src/nrandom.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/nrandom.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,183 @@ +/* mpfr_nrandom (rop, state, rnd_mode) -- Generate a normal deviate with mean 0 + and variance 1 and round it to the precision of rop according to the given + rounding mode. + +Copyright 2013-2019 Free Software Foundation, Inc. +Contributed by Charles Karney , SRI International. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* + * Sampling from the normal distribution with zero mean and unit variance. + * This uses Algorithm N given in: + * Charles F. F. Karney, + * "Sampling exactly from the normal distribution", + * ACM Trans. Math. Software 42(1), 3:1-14 (Jan. 2016). + * https://dx.doi.org/10.1145/2710016 + * http://arxiv.org/abs/1303.6257 + * + * The implementation here closely follows the C++ one given in the paper + * above. However, here, C is simplified by using gmp_urandomm_ui; the initial + * rejection step in H just tests the leading bit of p; and the assignment of + * the sign to the deviate using gmp_urandomb_ui. Finally, the C++ + * implementation benefits from caching temporary random deviates across calls. + * This isn't possible in C without additional machinery which would complicate + * the interface. + * + * There are a few "weasel words" regarding the accuracy of this + * implementation. The algorithm produces exactly rounded normal deviates + * provided that gmp's random number engine delivers truly random bits. If it + * did, the algorithm would be perfect; however, this implementation would have + * problems, e.g., in that the integer part of the normal deviate is + * represented by an unsigned long, whereas in reality the integer part in + * unbounded. In this implementation, asserts catch overflow in the integer + * part and similar (very, very) unlikely events. In reality, of course, gmp's + * random number engine has a finite internal state (19937 bits in the case of + * the MT19937 method). This means that these unlikely events in fact won't + * occur. If the asserts are triggered, then this is an indication that the + * random number engine is defective. (Even if a hardware random number + * generator were used, the most likely explanation for the triggering of the + * asserts would be that the hardware generator was broken.) + */ + +#include "random_deviate.h" + +/* Algorithm H: true with probability exp(-1/2). */ +static int +H (gmp_randstate_t r, mpfr_random_deviate_t p, mpfr_random_deviate_t q) +{ + /* p and q are temporaries */ + mpfr_random_deviate_reset (p); + if (mpfr_random_deviate_tstbit (p, 1, r)) + return 1; + for (;;) + { + mpfr_random_deviate_reset (q); + if (!mpfr_random_deviate_less (q, p, r)) + return 0; + mpfr_random_deviate_reset (p); + if (!mpfr_random_deviate_less (p, q, r)) + return 1; + } +} + +/* Step N1: return n >= 0 with prob. exp(-n/2) * (1 - exp(-1/2)). */ +static unsigned long +G (gmp_randstate_t r, mpfr_random_deviate_t p, mpfr_random_deviate_t q) +{ + /* p and q are temporaries */ + unsigned long n = 0; + + while (H (r, p, q)) + { + ++n; + /* Catch n wrapping around to 0; for a 32-bit unsigned long, the + * probability of this is exp(-2^30)). */ + MPFR_ASSERTN (n != 0UL); + } + return n; +} + +/* Step N2: true with probability exp(-m*n/2). */ +static int +P (unsigned long m, unsigned long n, gmp_randstate_t r, + mpfr_random_deviate_t p, mpfr_random_deviate_t q) +{ + /* p and q are temporaries. m*n is passed as two separate parameters to deal + * with the case where m*n overflows an unsigned long. This may be called + * with m = 0 and n = (unsigned long)(-1) and, because m in handled in to the + * outer loop, this routine will correctly return 1. */ + while (m--) + { + unsigned long k = n; + while (k--) + { + if (!H (r, p, q)) + return 0; + } + } + return 1; +} + +/* Algorithm C: return (-1, 0, 1) with prob (1/m, 1/m, 1-2/m). */ +static int +C (unsigned long m, gmp_randstate_t r) +{ + unsigned long n = gmp_urandomm_ui (r, m); + return n == 0 ? -1 : (n == 1 ? 0 : 1); +} + +/* Algorithm B: true with prob exp(-x * (2*k + x) / (2*k + 2)). */ +static int +B (unsigned long k, mpfr_random_deviate_t x, gmp_randstate_t r, + mpfr_random_deviate_t p, mpfr_random_deviate_t q) +{ + /* p and q are temporaries */ + + unsigned long m = 2 * k + 2; + /* n tracks the parity of the loop; s == 1 on first trip through loop. */ + unsigned n = 0, s = 1; + int f; + + /* Check if 2 * k + 2 would overflow; for a 32-bit unsigned long, the + * probability of this is exp(-2^61)). */ + MPFR_ASSERTN (k < ((unsigned long)(-1) >> 1)); + + for (;; ++n, s = 0) /* overflow of n is innocuous */ + { + if ( ((f = k ? 0 : C (m, r)) < 0) || + (mpfr_random_deviate_reset (q), + !mpfr_random_deviate_less (q, s ? x : p, r)) || + ((f = k ? C (m, r) : f) < 0) || + (f == 0 && + (mpfr_random_deviate_reset (p), + !mpfr_random_deviate_less (p, x, r))) ) + break; + mpfr_random_deviate_swap (p, q); /* an efficient way of doing p = q */ + } + return (n & 1U) == 0; +} + +/* return a normal random deviate with mean 0 and variance 1 as a MPFR */ +int +mpfr_nrandom (mpfr_t z, gmp_randstate_t r, mpfr_rnd_t rnd) +{ + mpfr_random_deviate_t x, p, q; + int inex; + unsigned long k, j; + + mpfr_random_deviate_init (x); + mpfr_random_deviate_init (p); + mpfr_random_deviate_init (q); + for (;;) + { + k = G (r, p, q); /* step 1 */ + if (!P (k, k - 1, r, p, q)) + continue; /* step 2 */ + mpfr_random_deviate_reset (x); /* step 3 */ + for (j = 0; j <= k && B (k, x, r, p, q); ++j); /* step 4 */ + if (j > k) + break; + } + mpfr_random_deviate_clear (q); + mpfr_random_deviate_clear (p); + /* steps 5, 6, 7 */ + inex = mpfr_random_deviate_value (gmp_urandomb_ui (r, 1), k, x, z, r, rnd); + mpfr_random_deviate_clear (x); + return inex; +} diff -Nru mpfr4-3.1.4/src/odd_p.c mpfr4-4.0.2/src/odd_p.c --- mpfr4-3.1.4/src/odd_p.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/odd_p.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,73 @@ +/* mpfr_odd_p -- check for odd integers + +Copyright 2001-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define MPFR_NEED_LONGLONG_H +#include "mpfr-impl.h" + +/* Return 1 if y is an odd integer, 0 otherwise. + Assumes y is not singular. */ +int +mpfr_odd_p (mpfr_srcptr y) +{ + mpfr_exp_t expo; + mpfr_prec_t prec; + mp_size_t yn; + mp_limb_t *yp; + + /* NAN, INF or ZERO are not allowed */ + MPFR_ASSERTD (!MPFR_IS_SINGULAR (y)); + + expo = MPFR_GET_EXP (y); + if (expo <= 0) + return 0; /* |y| < 1 and not 0 */ + + prec = MPFR_PREC(y); + if ((mpfr_prec_t) expo > prec) + return 0; /* y is a multiple of 2^(expo-prec), thus not odd */ + + /* 0 < expo <= prec: + y = 1xxxxxxxxxt.zzzzzzzzzzzzzzzzzz[000] + expo bits (prec-expo) bits + + We have to check that: + (a) the bit 't' is set + (b) all the 'z' bits are zero + */ + + prec = MPFR_PREC2LIMBS (prec) * GMP_NUMB_BITS - expo; + /* number of z+0 bits */ + + yn = prec / GMP_NUMB_BITS; + MPFR_ASSERTN(yn >= 0); + /* yn is the index of limb containing the 't' bit */ + + yp = MPFR_MANT(y); + /* if expo is a multiple of GMP_NUMB_BITS, t is bit 0 */ + if (expo % GMP_NUMB_BITS == 0 ? (yp[yn] & 1) == 0 + : yp[yn] << ((expo % GMP_NUMB_BITS) - 1) != MPFR_LIMB_HIGHBIT) + return 0; + while (--yn >= 0) + if (yp[yn] != 0) + return 0; + return 1; +} + diff -Nru mpfr4-3.1.4/src/out_str.c mpfr4-4.0.2/src/out_str.c --- mpfr4-3.1.4/src/out_str.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/out_str.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_out_str -- output a floating-point number to a stream -Copyright 1999, 2001-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2002, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -43,10 +43,6 @@ MPFR_ASSERTN (base >= 2 && base <= 62); - /* when stream=NULL, output to stdout */ - if (stream == NULL) - stream = stdout; - if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (op))) { if (MPFR_IS_NAN (op)) @@ -73,7 +69,7 @@ || fputc (*s++, stream) == EOF /* leading digit */ || fputc ((unsigned char) MPFR_DECIMAL_POINT, stream) == EOF || fputs (s, stream) == EOF; /* trailing significand */ - (*__gmp_free_func) (s0, l); + mpfr_free_func (s0, l); if (MPFR_UNLIKELY (err)) return 0; diff -Nru mpfr4-3.1.4/src/pool.c mpfr4-4.0.2/src/pool.c --- mpfr4-3.1.4/src/pool.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/pool.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,117 @@ +/* mpz_t pool + +Copyright 2014-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define MPFR_POOL_DONT_REDEFINE +#include "mpfr-impl.h" + +#ifndef MPFR_POOL_MAX_SIZE +# define MPFR_POOL_MAX_SIZE 32 /* maximal size (in limbs) for each entry */ +#endif + +/* If the number of entries of the mpz_t pool is not zero */ +#if MPFR_POOL_NENTRIES + +/* Index in the stack table of mpz_t and stack table of mpz_t */ +static MPFR_THREAD_ATTR int n_alloc = 0; +static MPFR_THREAD_ATTR __mpz_struct mpz_tab[MPFR_POOL_NENTRIES]; + +MPFR_HOT_FUNCTION_ATTR void +mpfr_mpz_init (mpz_t z) +{ + if (MPFR_LIKELY (n_alloc > 0)) + { + /* Get a mpz_t from the MPFR stack of previously used mpz_t. + It reduces memory pressure, and it allows to reuse + a mpz_t that should be sufficiently big. */ + MPFR_ASSERTD (n_alloc <= numberof (mpz_tab)); + memcpy (z, &mpz_tab[--n_alloc], sizeof (mpz_t)); + SIZ(z) = 0; + } + else + { + /* Call the real GMP function */ + mpz_init (z); + } +} + +MPFR_HOT_FUNCTION_ATTR void +mpfr_mpz_init2 (mpz_t z, mp_bitcnt_t n) +{ + /* The condition on n is used below as the argument n will be ignored if + the mpz_t is obtained from the MPFR stack of previously used mpz_t. + Said otherwise, it z is expected to have a large size at the end, then + it is better to allocate this size directly than to get a mpz_t of + small size, with possibly several realloc's on it. But if n satisfies + the condition and is larger than the stacked mpz_t, this may still + yield useless realloc's. This is not ideal. We might consider to use + mpz_init2 with the maximum size in mpfr_mpz_init to solve this issue. */ + if (MPFR_LIKELY (n_alloc > 0 && n <= MPFR_POOL_MAX_SIZE * GMP_NUMB_BITS)) + { + /* Get a mpz_t from the MPFR stack of previously used mpz_t. + It reduces memory pressure, and it allows to reuse + a mpz_t that should be sufficiently big. */ + MPFR_ASSERTD (n_alloc <= numberof (mpz_tab)); + memcpy (z, &mpz_tab[--n_alloc], sizeof (mpz_t)); + SIZ(z) = 0; + } + else + { + /* Call the real GMP function */ + mpz_init2 (z, n); + } +} + + +MPFR_HOT_FUNCTION_ATTR void +mpfr_mpz_clear (mpz_t z) +{ + /* We only put objects with at most MPFR_POOL_MAX_SIZE in the mpz_t pool, + to avoid it takes too much memory (and anyway the speedup is mainly + for small precision). */ + if (MPFR_LIKELY (n_alloc < numberof (mpz_tab) && + ALLOC (z) <= MPFR_POOL_MAX_SIZE)) + { + /* Push back the mpz_t inside the stack of the used mpz_t */ + MPFR_ASSERTD (n_alloc >= 0); + memcpy (&mpz_tab[n_alloc++], z, sizeof (mpz_t)); + } + else + { + /* Call the real GMP function */ + mpz_clear (z); + } +} + +#endif + +void +mpfr_free_pool (void) +{ +#if MPFR_POOL_NENTRIES + int i; + + MPFR_ASSERTD (n_alloc >= 0 && n_alloc <= numberof (mpz_tab)); + for (i = 0; i < n_alloc; i++) + mpz_clear (&mpz_tab[i]); + n_alloc = 0; +#endif +} diff -Nru mpfr4-3.1.4/src/pow.c mpfr4-4.0.2/src/pow.c --- mpfr4-3.1.4/src/pow.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/pow.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_pow -- power function x^y -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -107,55 +107,10 @@ return res; } -/* Return 1 if y is an odd integer, 0 otherwise. */ -static int -is_odd (mpfr_srcptr y) -{ - mpfr_exp_t expo; - mpfr_prec_t prec; - mp_size_t yn; - mp_limb_t *yp; - - /* NAN, INF or ZERO are not allowed */ - MPFR_ASSERTD (!MPFR_IS_SINGULAR (y)); - - expo = MPFR_GET_EXP (y); - if (expo <= 0) - return 0; /* |y| < 1 and not 0 */ - - prec = MPFR_PREC(y); - if ((mpfr_prec_t) expo > prec) - return 0; /* y is a multiple of 2^(expo-prec), thus not odd */ - - /* 0 < expo <= prec: - y = 1xxxxxxxxxt.zzzzzzzzzzzzzzzzzz[000] - expo bits (prec-expo) bits - - We have to check that: - (a) the bit 't' is set - (b) all the 'z' bits are zero - */ - - prec = MPFR_PREC2LIMBS (prec) * GMP_NUMB_BITS - expo; - /* number of z+0 bits */ - - yn = prec / GMP_NUMB_BITS; - MPFR_ASSERTN(yn >= 0); - /* yn is the index of limb containing the 't' bit */ - - yp = MPFR_MANT(y); - /* if expo is a multiple of GMP_NUMB_BITS, t is bit 0 */ - if (expo % GMP_NUMB_BITS == 0 ? (yp[yn] & 1) == 0 - : yp[yn] << ((expo % GMP_NUMB_BITS) - 1) != MPFR_LIMB_HIGHBIT) - return 0; - while (--yn >= 0) - if (yp[yn] != 0) - return 0; - return 1; -} - /* Assumes that the exponent range has already been extended and if y is - an integer, then the result is not exact in unbounded exponent range. */ + an integer, then the result is not exact in unbounded exponent range. + If x < 0, assumes y is an integer. +*/ int mpfr_pow_general (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode, int y_is_integer, mpfr_save_expo_t *expo) @@ -184,18 +139,26 @@ MPFR_ALIAS(absx, x, /*sign=*/ 1, /*EXP=*/ MPFR_EXP(x)); /* We will compute the absolute value of the result. So, let's - invert the rounding mode if the result is negative. */ - if (MPFR_IS_NEG (x) && is_odd (y)) + invert the rounding mode if the result is negative (in which case + y not an integer was already filtered out). */ + if (MPFR_IS_NEG (x)) { - neg_result = 1; - rnd_mode = MPFR_INVERT_RND (rnd_mode); + MPFR_ASSERTD (y_is_integer); + if (mpfr_odd_p (y)) + { + neg_result = 1; + rnd_mode = MPFR_INVERT_RND (rnd_mode); + } } - /* compute the precision of intermediary variable */ - /* the optimal number of bits : see algorithms.tex */ - Nt = Nz + 5 + MPFR_INT_CEIL_LOG2 (Nz); + /* Compute the precision of intermediary variable. */ + /* The increment 9 + MPFR_INT_CEIL_LOG2 (Nz) gives few Ziv failures + in binary64 and binary128 formats: + mfv5 -p53 -e1 mpfr_pow: 5903 / 6469.59 / 6686 + mfv5 -p113 -e1 mpfr_pow: 10913 / 11989.46 / 12321 */ + Nt = Nz + 9 + MPFR_INT_CEIL_LOG2 (Nz); - /* initialise of intermediary variable */ + /* initialize of intermediary variable */ mpfr_init2 (t, Nt); MPFR_ZIV_INIT (ziv_loop, Nt); @@ -360,15 +323,28 @@ MPFR_GET_EXP (z) == __gmpfr_emin - 1 - lk && mpfr_powerof2_raw (z)) { /* Rounding to nearest, real result > z * 2^k = 2^(emin - 2), - * underflow case: as the minimum precision is > 1, we will - * obtain the correct result and exceptions by replacing z by - * nextabove(z). + * underflow case: + * (a) if the precision of z is > 1, we will obtain the correct + * result and exceptions by replacing z by nextabove(z). + * (b) if the precision of z is 1, we first copy z to zcopy of + * precision 2 bits and perform nextabove(zcopy). */ - MPFR_ASSERTN (MPFR_PREC_MIN > 1); - mpfr_nextabove (z); + if (MPFR_PREC(z) >= 2) + mpfr_nextabove (z); + else + { + mpfr_t zcopy; + mpfr_init2 (zcopy, MPFR_PREC(z) + 1); + mpfr_set (zcopy, z, MPFR_RNDZ); + mpfr_nextabove (zcopy); + inex2 = mpfr_mul_2si (z, zcopy, lk, rnd_mode); + mpfr_clear (zcopy); + goto under_over; + } } - mpfr_clear_flags (); + MPFR_CLEAR_FLAGS (); inex2 = mpfr_mul_2si (z, z, lk, rnd_mode); + under_over: if (inex2) /* underflow or overflow */ { inexact = inex2; @@ -482,7 +458,7 @@ { int negative; /* Determine the sign now, in case y and z are the same object */ - negative = MPFR_IS_NEG (x) && is_odd (y); + negative = MPFR_IS_NEG (x) && mpfr_odd_p (y); if (MPFR_IS_POS (y)) MPFR_SET_INF (z); else @@ -498,12 +474,12 @@ int negative; MPFR_ASSERTD (MPFR_IS_ZERO (x)); /* Determine the sign now, in case y and z are the same object */ - negative = MPFR_IS_NEG(x) && is_odd (y); + negative = MPFR_IS_NEG(x) && mpfr_odd_p (y); if (MPFR_IS_NEG (y)) { MPFR_ASSERTD (! MPFR_IS_INF (y)); MPFR_SET_INF (z); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); } else MPFR_SET_ZERO (z); @@ -529,7 +505,7 @@ cmp_x_1 = mpfr_cmpabs (x, __gmpfr_one); if (cmp_x_1 == 0) - return mpfr_set_si (z, MPFR_IS_NEG (x) && is_odd (y) ? -1 : 1, rnd_mode); + return mpfr_set_si (z, MPFR_IS_NEG (x) && mpfr_odd_p (y) ? -1 : 1, rnd_mode); /* now we have: (1) either x > 0 @@ -550,6 +526,15 @@ Otherwise, it should enable one to check only underflow or overflow, instead of both cases as in the present case. */ + + /* fast check for cases where no overflow nor underflow is possible: + if |y| <= 2^15, and -32767 < EXP(x) <= 32767, then + |y*log2(x)| <= 2^15*32767 < 1073741823, thus for the default + emax=1073741823 and emin=-emax there can be no overflow nor underflow */ + if (__gmpfr_emax >= 1073741823 && __gmpfr_emin <= -1073741823 && + MPFR_EXP(y) <= 15 && -32767 < MPFR_EXP(x) && MPFR_EXP(x) <= 32767) + goto no_overflow_nor_underflow; + if (cmp_x_1 * MPFR_SIGN (y) > 0) { mpfr_t t; @@ -562,7 +547,7 @@ to round y*o(log2(x)) toward zero too; (ii) if x < 0, we first compute t = o(-x), with rounding toward 1, and then follow as in case (1). */ - if (MPFR_SIGN (x) > 0) + if (MPFR_IS_POS (x)) mpfr_log2 (t, x, MPFR_RNDZ); else { @@ -576,7 +561,7 @@ if (overflow) { MPFR_LOG_MSG (("early overflow detection\n", 0)); - negative = MPFR_SIGN(x) < 0 && is_odd (y); + negative = MPFR_IS_NEG (x) && mpfr_odd_p (y); return mpfr_overflow (z, rnd_mode, negative ? -1 : 1); } } @@ -590,13 +575,14 @@ */ if (MPFR_IS_NEG (y) ? (MPFR_GET_EXP (x) > 1) : (MPFR_GET_EXP (x) < 0)) { + mp_limb_t tmp_limb[MPFR_EXP_LIMB_SIZE]; mpfr_t tmp; mpfr_eexp_t ebound; int inex2; /* We must restore the flags. */ MPFR_SAVE_EXPO_MARK (expo); - mpfr_init2 (tmp, sizeof (mpfr_exp_t) * CHAR_BIT); + MPFR_TMP_INIT1 (tmp_limb, tmp, sizeof (mpfr_exp_t) * CHAR_BIT); inex2 = mpfr_set_exp_t (tmp, MPFR_GET_EXP (x), MPFR_RNDN); MPFR_ASSERTN (inex2 == 0); if (MPFR_IS_NEG (y)) @@ -610,7 +596,6 @@ /* tmp doesn't necessarily fit in ebound, but that doesn't matter since we get the minimum value in such a case. */ ebound = mpfr_get_exp_t (tmp, MPFR_RNDU); - mpfr_clear (tmp); MPFR_SAVE_EXPO_FREE (expo); if (MPFR_UNLIKELY (ebound <= __gmpfr_emin - (rnd_mode == MPFR_RNDN ? 2 : 1))) @@ -619,10 +604,12 @@ MPFR_LOG_MSG (("early underflow detection\n", 0)); return mpfr_underflow (z, rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode, - MPFR_SIGN (x) < 0 && is_odd (y) ? -1 : 1); + MPFR_IS_NEG (x) && mpfr_odd_p (y) ? -1 : 1); } } + no_overflow_nor_underflow: + /* If y is an integer, we can use mpfr_pow_z (based on multiplications), but if y is very large (I'm not sure about the best threshold -- VL), we shouldn't use it, as it can be very slow and take a lot of memory @@ -645,65 +632,59 @@ /* Special case (+/-2^b)^Y which could be exact. If x is negative, then necessarily y is a large integer. */ + if (mpfr_powerof2_raw (x)) { mpfr_exp_t b = MPFR_GET_EXP (x) - 1; + mpfr_t tmp; + int sgnx = MPFR_SIGN (x); MPFR_ASSERTN (b >= LONG_MIN && b <= LONG_MAX); /* FIXME... */ - if (mpfr_cmp_si_2exp (x, MPFR_SIGN(x), b) == 0) - { - mpfr_t tmp; - int sgnx = MPFR_SIGN (x); - MPFR_LOG_MSG (("special case (+/-2^b)^Y\n", 0)); - /* now x = +/-2^b, so x^y = (+/-1)^y*2^(b*y) is exact whenever b*y is - an integer */ - MPFR_SAVE_EXPO_MARK (expo); - mpfr_init2 (tmp, MPFR_PREC (y) + sizeof (long) * CHAR_BIT); - inexact = mpfr_mul_si (tmp, y, b, MPFR_RNDN); /* exact */ - MPFR_ASSERTN (inexact == 0); - /* Note: as the exponent range has been extended, an overflow is not - possible (due to basic overflow and underflow checking above, as - the result is ~ 2^tmp), and an underflow is not possible either - because b is an integer (thus either 0 or >= 1). */ - mpfr_clear_flags (); - inexact = mpfr_exp2 (z, tmp, rnd_mode); - mpfr_clear (tmp); - if (sgnx < 0 && is_odd (y)) - { - mpfr_neg (z, z, rnd_mode); - inexact = -inexact; - } - /* Without the following, the overflows3 test in tpow.c fails. */ - MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); - MPFR_SAVE_EXPO_FREE (expo); - return mpfr_check_range (z, inexact, rnd_mode); + MPFR_LOG_MSG (("special case (+/-2^b)^Y\n", 0)); + /* now x = +/-2^b, so x^y = (+/-1)^y*2^(b*y) is exact whenever b*y is + an integer */ + MPFR_SAVE_EXPO_MARK (expo); + mpfr_init2 (tmp, MPFR_PREC (y) + sizeof (long) * CHAR_BIT); + inexact = mpfr_mul_si (tmp, y, b, MPFR_RNDN); /* exact */ + MPFR_ASSERTN (inexact == 0); + /* Note: as the exponent range has been extended, an overflow is not + possible (due to basic overflow and underflow checking above, as + the result is ~ 2^tmp), and an underflow is not possible either + because b is an integer (thus either 0 or >= 1). */ + MPFR_CLEAR_FLAGS (); + inexact = mpfr_exp2 (z, tmp, rnd_mode); + mpfr_clear (tmp); + if (sgnx < 0 && mpfr_odd_p (y)) + { + mpfr_neg (z, z, rnd_mode); + inexact = -inexact; } + /* Without the following, the overflows3 test in tpow.c fails. */ + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); + MPFR_SAVE_EXPO_FREE (expo); + return mpfr_check_range (z, inexact, rnd_mode); } MPFR_SAVE_EXPO_MARK (expo); - /* Case where |y * log(x)| is very small. Warning: x can be negative, in + /* Case where y * log(x) is very small. Warning: x can be negative, in that case y is a large integer. */ { - mpfr_t t; - mpfr_exp_t err; + mpfr_exp_t err, expx, logt; /* We need an upper bound on the exponent of y * log(x). */ - mpfr_init2 (t, 16); if (MPFR_IS_POS(x)) - mpfr_log (t, x, cmp_x_1 < 0 ? MPFR_RNDD : MPFR_RNDU); /* away from 0 */ + expx = cmp_x_1 > 0 ? MPFR_EXP(x) : 1 - MPFR_EXP(x); else - { - /* if x < -1, round to +Inf, else round to zero */ - mpfr_neg (t, x, (mpfr_cmp_si (x, -1) < 0) ? MPFR_RNDU : MPFR_RNDD); - mpfr_log (t, t, (mpfr_cmp_ui (t, 1) < 0) ? MPFR_RNDD : MPFR_RNDU); - } - MPFR_ASSERTN (MPFR_IS_PURE_FP (t)); - err = MPFR_GET_EXP (y) + MPFR_GET_EXP (t); - mpfr_clear (t); - mpfr_clear_flags (); + expx = mpfr_cmp_si (x, -1) > 0 ? 1 - MPFR_EXP(x) : MPFR_EXP(x); + MPFR_ASSERTD(expx >= 0); + /* now |log(x)| < expx */ + logt = MPFR_INT_CEIL_LOG2 (expx); + /* now expx <= 2^logt */ + err = MPFR_GET_EXP (y) + logt; + MPFR_CLEAR_FLAGS (); MPFR_SMALL_INPUT_AFTER_SAVE_EXPO (z, __gmpfr_one, - err, 0, - (MPFR_SIGN (y) > 0) ^ (cmp_x_1 < 0), + (MPFR_IS_POS (y)) ^ (cmp_x_1 < 0), rnd_mode, expo, {}); } diff -Nru mpfr4-3.1.4/src/powerof2.c mpfr4-4.0.2/src/powerof2.c --- mpfr4-3.1.4/src/powerof2.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/powerof2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_powerof2_raw -- test whether a floating-point number is a power of 2 -Copyright 2002-2016 Free Software Foundation, Inc. +Copyright 2002-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -31,16 +31,17 @@ int mpfr_powerof2_raw (mpfr_srcptr x) { - mp_limb_t *xp; - mp_size_t xn; - /* This is an internal function, and we may call it with some wrong numbers (ie good mantissa but wrong flags or exp) So we don't want to test if it is a pure FP. MPFR_ASSERTN(MPFR_IS_PURE_FP(x)); */ - xp = MPFR_MANT(x); - xn = (MPFR_PREC(x) - 1) / GMP_NUMB_BITS; - if (xp[xn] != MPFR_LIMB_HIGHBIT) + return mpfr_powerof2_raw2 (MPFR_MANT(x), MPFR_LIMB_SIZE(x)); +} + +int +mpfr_powerof2_raw2 (const mp_limb_t *xp, mp_size_t xn) +{ + if (xp[--xn] != MPFR_LIMB_HIGHBIT) return 0; while (xn > 0) if (xp[--xn] != 0) diff -Nru mpfr4-3.1.4/src/powerpc32/mparam.h mpfr4-4.0.2/src/powerpc32/mparam.h --- mpfr4-3.1.4/src/powerpc32/mparam.h 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/powerpc32/mparam.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Generated by MPFR's tuneup.c, 2010-10-22, gcc 4.2.4, gmp 5.0.1 */ diff -Nru mpfr4-3.1.4/src/powerpc64/mparam.h mpfr4-4.0.2/src/powerpc64/mparam.h --- mpfr4-3.1.4/src/powerpc64/mparam.h 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/powerpc64/mparam.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Generated by MPFR's tuneup.c, 2011-07-31, gcc 4.3.2 */ @@ -88,7 +88,7 @@ 832,832,831,832,832,832,832,831,832,830,832,832,832,832,832,832, \ 832,832,832,832,832,832,832,831,832,832,832,832,832,832,832,832, \ 832,832,832,832,832,832,832,832,832,832,832,832,832,832,832,832 \ - + #define MPFR_SQRHIGH_TAB \ -1,0,0,0,0,0,0,0,0,0,0,0,0,0,10,9, \ 10,10,12,12,12,12,14,13,14,14,15,15,16,16,17,17, \ @@ -154,7 +154,7 @@ 568,568,592,592,592,592,568,592,568,568,592,568,568,592,568,592, \ 568,568,592,592,544,568,592,592,592,592,592,568,592,592,592,592, \ 592,592,591,592,592,592,592,592,592,592,592,568,592,592,592,568 \ - + #define MPFR_DIVHIGH_TAB \ 0,1,2,3,4,5,6,7,6,9,8,9,10,8,12,13, \ 10,10,11,12,13,14,14,13,15,14,15,17,17,18,19,20, \ @@ -220,7 +220,7 @@ 512,513,576,512,512,513,514,512,512,576,576,512,513,576,513,515, \ 552,552,576,512,512,512,564,513,564,576,576,576,564,576,564,576, \ 564,512,576,564,564,576,576,564,564,576,564,576,564,576,551,576 \ - + #define MPFR_MUL_THRESHOLD 1 /* limbs */ #define MPFR_SQR_THRESHOLD 5 /* limbs */ #define MPFR_DIV_THRESHOLD 17 /* limbs */ diff -Nru mpfr4-3.1.4/src/pow_si.c mpfr4-4.0.2/src/pow_si.c --- mpfr4-3.1.4/src/pow_si.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/pow_si.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_pow_si -- power function x^y with y a signed int -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -56,7 +56,7 @@ { MPFR_ASSERTD (MPFR_IS_ZERO (x)); MPFR_SET_INF (y); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); } if (positive) MPFR_SET_POS (y); @@ -158,14 +158,14 @@ MPFR_SAVE_EXPO_MARK (expo); - /* initialise of intermediary variable */ + /* initialize of intermediary variable */ mpfr_init2 (t, Nt); /* We will compute rnd(rnd1(1/x) ^ |n|), where rnd1 is the rounding toward sign(x), to avoid spurious overflow or underflow, as in mpfr_pow_z. */ rnd1 = MPFR_EXP (x) < 1 ? MPFR_RNDZ : - (MPFR_SIGN (x) > 0 ? MPFR_RNDU : MPFR_RNDD); + (MPFR_IS_POS (x) ? MPFR_RNDU : MPFR_RNDD); MPFR_ZIV_INIT (loop, Nt); for (;;) @@ -233,7 +233,7 @@ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, Nt - size_n - 2, Ny, rnd))) break; - /* actualisation of the precision */ + /* actualization of the precision */ MPFR_ZIV_NEXT (loop, Nt); mpfr_set_prec (t, Nt); } diff -Nru mpfr4-3.1.4/src/pow_ui.c mpfr4-4.0.2/src/pow_ui.c --- mpfr4-3.1.4/src/pow_ui.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/pow_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_pow_ui-- compute the power of a floating-point by a machine integer -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H diff -Nru mpfr4-3.1.4/src/pow_z.c mpfr4-4.0.2/src/pow_z.c --- mpfr4-3.1.4/src/pow_z.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/pow_z.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_pow_z -- power function x^z with z a MPZ -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -52,7 +52,7 @@ return mpfr_set (y, x, rnd); absz[0] = z[0]; - SIZ (absz) = ABS(SIZ(absz)); /* Hack to get abs(z) */ + SIZ (absz) = ABSIZ (absz); /* Hack to get abs(z) */ MPFR_MPZ_SIZEINBASE2 (size_z, z); /* round toward 1 (or -1) to avoid spurious overflow or underflow, @@ -128,7 +128,7 @@ MPFR_ASSERTD (mpfr_cmp_si_2exp (x, MPFR_SIGN (x), MPFR_EXP (x) - 1) != 0); mpfr_init2 (y2, 2); - mpfr_init2 (zz, ABS (SIZ (z)) * GMP_NUMB_BITS); + mpfr_init2 (zz, ABSIZ (z) * GMP_NUMB_BITS); inexact = mpfr_set_z (zz, z, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); inexact = mpfr_pow_general (y2, x, zz, rnd, 1, @@ -211,7 +211,7 @@ { /* 0^(-n) if +/- INF */ MPFR_SET_INF (y); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); } if (MPFR_LIKELY (MPFR_IS_POS (x) || mpz_even_p (z))) MPFR_SET_POS (y); @@ -280,13 +280,13 @@ Nt = Nt + size_z + 3 + MPFR_INT_CEIL_LOG2 (Nt); /* ensures Nt >= bits(z)+2 */ - /* initialise of intermediary variable */ + /* initialize of intermediary variable */ mpfr_init2 (t, Nt); /* We will compute rnd(rnd1(1/x) ^ (-z)), where rnd1 is the rounding toward sign(x), to avoid spurious overflow or underflow. */ rnd1 = MPFR_EXP (x) < 1 ? MPFR_RNDZ : - (MPFR_SIGN (x) > 0 ? MPFR_RNDU : MPFR_RNDD); + (MPFR_IS_POS (x) ? MPFR_RNDU : MPFR_RNDD); MPFR_ZIV_INIT (loop, Nt); for (;;) @@ -336,7 +336,7 @@ MPFR_ASSERTD (mpfr_cmp_si_2exp (x, MPFR_SIGN (x), MPFR_EXP (x) - 1) != 0); mpfr_init2 (y2, 2); - mpfr_init2 (zz, ABS (SIZ (z)) * GMP_NUMB_BITS); + mpfr_init2 (zz, ABSIZ (z) * GMP_NUMB_BITS); inexact = mpfr_set_z (zz, z, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); inexact = mpfr_pow_general (y2, x, zz, rnd, 1, @@ -357,7 +357,7 @@ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, Nt - size_z - 2, MPFR_PREC (y), rnd))) break; - /* actualisation of the precision */ + /* actualization of the precision */ MPFR_ZIV_NEXT (loop, Nt); mpfr_set_prec (t, Nt); } diff -Nru mpfr4-3.1.4/src/printf.c mpfr4-4.0.2/src/printf.c --- mpfr4-3.1.4/src/printf.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/printf.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ -/* mpfr_printf -- printf function and friends. +/* Formatted output functions (printf functions family). -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,15 +17,16 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include "config.h" #endif -/* The mpfr_printf-like functions are defined only if exists */ -#ifdef HAVE_STDARG +/* The mpfr_printf-like functions are defined only if exists. + Since they use mpf_t, they cannot be defined with mini-gmp. */ +#if defined(HAVE_STDARG) && !defined(MPFR_USE_MINI_GMP) #include @@ -40,17 +41,16 @@ # endif /* HAVE___VA_COPY */ #endif /* HAVE_VA_COPY */ -#include #include "mpfr-impl.h" #ifdef _MPFR_H_HAVE_FILE -/* Each printf-like function calls mpfr_vasprintf which - - returns the number of characters in the returned string excluding the - terminating null - - returns -1 and sets the erange flag if the number of produced characters - exceeds INT_MAX (in that case, also sets errno to EOVERFLOW in POSIX - systems) */ +/* Each printf-like function calls mpfr_vasnprintf_aux (directly or + via mpfr_vasprintf), which + - returns the number of characters to be written excluding the + terminating null character (disregarding the size argument); + - returns -1 and sets the erange flag if this number exceeds INT_MAX + (in that case, also sets errno to EOVERFLOW on POSIX systems). */ #define GET_STR_VA(sz, str, fmt, ap) \ do \ @@ -131,6 +131,7 @@ mpfr_free_str (str); return ret; } + #endif /* _MPFR_H_HAVE_FILE */ int @@ -162,45 +163,20 @@ int mpfr_snprintf (char *buf, size_t size, const char *fmt, ...) { - char *str; int ret; - size_t min_size; + va_list ap; - GET_STR (ret, str, fmt); + va_start(ap, fmt); + ret = mpfr_vasnprintf_aux (NULL, buf, size, fmt, ap); + va_end (ap); - /* C99 allows SIZE to be zero */ - if (size != 0) - { - MPFR_ASSERTN (buf != NULL); - min_size = (size_t)ret < size ? (size_t)ret : size - 1; - strncpy (buf, str, min_size); - buf[min_size] = '\0'; - } - - mpfr_free_str (str); return ret; } int mpfr_vsnprintf (char *buf, size_t size, const char *fmt, va_list ap) { - char *str; - int ret; - int min_size; - - GET_STR_VA (ret, str, fmt, ap); - - /* C99 allows SIZE to be zero */ - if (size != 0) - { - MPFR_ASSERTN (buf != NULL); - min_size = (size_t)ret < size ? (size_t)ret : size - 1; - strncpy (buf, str, min_size); - buf[min_size] = '\0'; - } - - mpfr_free_str (str); - return ret; + return mpfr_vasnprintf_aux (NULL, buf, size, fmt, ap); } int @@ -212,4 +188,16 @@ return ret; } + +int +mpfr_vasprintf (char **ptr, const char *fmt, va_list ap) +{ + return mpfr_vasnprintf_aux (ptr, NULL, 0, fmt, ap); +} + +#else /* HAVE_STDARG */ + +/* Avoid an empty translation unit (see ISO C99, 6.9) */ +typedef int foo; + #endif /* HAVE_STDARG */ diff -Nru mpfr4-3.1.4/src/print_raw.c mpfr4-4.0.2/src/print_raw.c --- mpfr4-3.1.4/src/print_raw.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/print_raw.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,8 @@ -/* mpfr_print_binary -- print the internal binary representation of a - floating-point number +/* mpfr_print_mant_binary -- print the internal binary representation + of a significand of floating-point number (for the tests and + debugging purpose) -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,112 +19,30 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" void -mpfr_fprint_binary (FILE *stream, mpfr_srcptr x) -{ - if (MPFR_IS_NAN (x)) - { - fprintf (stream, "@NaN@"); - return; - } - - if (MPFR_SIGN (x) < 0) - fprintf (stream, "-"); - - if (MPFR_IS_INF (x)) - fprintf (stream, "@Inf@"); - else if (MPFR_IS_ZERO (x)) - fprintf (stream, "0"); - else - { - mp_limb_t *mx; - mpfr_prec_t px; - mp_size_t n; - - mx = MPFR_MANT (x); - px = MPFR_PREC (x); - - fprintf (stream, "0."); - for (n = (px - 1) / GMP_NUMB_BITS; ; n--) - { - mp_limb_t wd, t; - - MPFR_ASSERTN (n >= 0); - wd = mx[n]; - for (t = MPFR_LIMB_HIGHBIT; t != 0; t >>= 1) - { - putc ((wd & t) == 0 ? '0' : '1', stream); - if (--px == 0) - { - mpfr_exp_t ex; - - ex = MPFR_GET_EXP (x); - MPFR_ASSERTN (ex >= LONG_MIN && ex <= LONG_MAX); - fprintf (stream, "E%ld", (long) ex); - return; - } - } - } - } -} - -void -mpfr_print_binary (mpfr_srcptr x) -{ - mpfr_fprint_binary (stdout, x); -} - -void -mpfr_print_mant_binary(const char *str, const mp_limb_t *p, mpfr_prec_t r) -{ - int i; - mpfr_prec_t count = 0; - char c; - mp_size_t n = MPFR_PREC2LIMBS (r); - - printf("%s ", str); - for(n-- ; n>=0 ; n--) - { - for(i = GMP_NUMB_BITS-1 ; i >=0 ; i--) - { - c = (p[n] & (((mp_limb_t)1L)<=0 ; n--) + printf ("%s ", str); + for (n-- ; n >= 0 ; n--) { - for(i = GMP_NUMB_BITS-1 ; i >=0 ; i--) + for (i = GMP_NUMB_BITS - 1 ; i >=0 ; i--) { - c = (p[n] & (((mp_limb_t)1L)<= r) + putchar (']'); + putchar ('\n'); } diff -Nru mpfr4-3.1.4/src/print_rnd_mode.c mpfr4-4.0.2/src/print_rnd_mode.c --- mpfr4-3.1.4/src/print_rnd_mode.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/print_rnd_mode.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_print_rnd_mode -- convert a given rounding mode to a string -Copyright 1999, 2001-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -27,7 +27,7 @@ { /* If we forget to update this function after a new rounding mode is added, this will be detected by the following assertion. */ - MPFR_ASSERTN (MPFR_RND_MAX == MPFR_RNDA + 1); + MPFR_STAT_STATIC_ASSERT (MPFR_RND_MAX == MPFR_RNDF + 1); switch (rnd_mode) { case MPFR_RNDD: @@ -40,6 +40,8 @@ return "MPFR_RNDZ"; case MPFR_RNDA: return "MPFR_RNDA"; + case MPFR_RNDF: + return "MPFR_RNDF"; default: return (const char*) 0; } diff -Nru mpfr4-3.1.4/src/random_deviate.c mpfr4-4.0.2/src/random_deviate.c --- mpfr4-3.1.4/src/random_deviate.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/random_deviate.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,384 @@ +/* random_deviate routines for mpfr_erandom and mpfr_nrandom. + +Copyright 2013-2019 Free Software Foundation, Inc. +Contributed by Charles Karney , SRI International. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* + * A mpfr_random_deviate represents the initial portion e bits of a random + * deviate uniformly distributed in (0,1) as + * + * typedef struct { + * unsigned long e; // bits in the fraction + * unsigned long h; // the high W bits of the fraction + * mpz_t f; // the rest of the fraction + * } mpfr_random_deviate_t[1]; + * + * e is always a multiple of RANDOM_CHUNK. The first RANDOM_CHUNK bits, the + * high fraction, are held in an unsigned long, h, and the rest are held in an + * mpz_t, f. The data in h is undefined if e == 0 and, similarly the data in f + * is undefined if e <= RANDOM_CHUNK. + */ + +#define MPFR_NEED_LONGLONG_H +#include "random_deviate.h" + +/* + * RANDOM_CHUNK can be picked in the range 1 <= RANDOM_CHUNK <= 64. Low values + * of RANDOM_CHUNK are good for testing, since they are more likely to make + * bugs obvious. For portability, pick RANDOM_CHUNK <= 32 (since an unsigned + * long may only hold 32 bits). For reproducibility across platforms, + * standardize on RANDOM_CHUNK = 32. + * + * When RANDOM_CHUNK = 32, this representation largely avoids manipulating + * mpz's (until the final cast to an mpfr is done). In addition + * mpfr_random_deviate_less usually entails just a single comparison of + * unsigned longs. In this way, we can stick with the published interface for + * extracting portions of an mpz (namely through mpz_tstbit) without hurting + * efficiency. + */ +#if !defined(RANDOM_CHUNK) +/* note: for MPFR, we could use RANDOM_CHUNK = 32 or 64 according to the + number of bits per limb, but we use 32 everywhere to get reproducible + results on 32-bit and 64-bit computers */ +#define RANDOM_CHUNK 32 /* Require 1 <= RANDOM_CHUNK <= 32; recommend 32 */ +#endif + +#define W RANDOM_CHUNK /* W is just an shorter name for RANDOM_CHUNK */ + +/* allocate and set to (0,1) */ +void +mpfr_random_deviate_init (mpfr_random_deviate_t x) +{ + mpz_init (x->f); + x->e = 0; +} + +/* reset to (0,1) */ +void +mpfr_random_deviate_reset (mpfr_random_deviate_t x) +{ + x->e = 0; +} + +/* deallocate */ +void +mpfr_random_deviate_clear (mpfr_random_deviate_t x) +{ + mpz_clear (x->f); +} + +/* swap two random deviates */ +void +mpfr_random_deviate_swap (mpfr_random_deviate_t x, mpfr_random_deviate_t y) +{ + mpfr_random_size_t s; + unsigned long t; + + /* swap x->e and y->e */ + s = x->e; + x->e = y->e; + y->e = s; + + /* swap x->h and y->h */ + t = x->h; + x->h = y->h; + y->h = t; + + /* swap x->f and y->f */ + mpz_swap (x->f, y->f); +} + +/* ensure x has at least k bits */ +static void +random_deviate_generate (mpfr_random_deviate_t x, mpfr_random_size_t k, + gmp_randstate_t r, mpz_t t) +{ + /* Various compile time checks on mprf_random_deviate_t */ + + /* Check that the h field of a mpfr_random_deviate_t can hold W bits */ + MPFR_STAT_STATIC_ASSERT (W > 0 && W <= sizeof (unsigned long) * CHAR_BIT); + + /* Check mpfr_random_size_t can hold 32 bits and a mpfr_uprec_t. This + * ensures that max(mpfr_random_size_t) exceeds MPFR_PREC_MAX by at least + * 2^31 because mpfr_prec_t is a signed version of mpfr_uprec_t. This allows + * random deviates with many leading zeros in the fraction to be handled + * correctly. */ + MPFR_STAT_STATIC_ASSERT (sizeof (mpfr_random_size_t) * CHAR_BIT >= 32 && + sizeof (mpfr_random_size_t) >= + sizeof (mpfr_uprec_t)); + + /* Finally, at runtime, check that k is not too big. e is set to ceil(k/W)*W + * and we require that this allows x->e + 1 in random_deviate_leading_bit to + * be computed without overflow. */ + MPFR_ASSERTN (k <= (mpfr_random_size_t)(-((int) W + 1))); + + /* if t is non-null, it is used as a temporary */ + if (x->e >= k) + return; + + if (x->e == 0) + { + x->h = gmp_urandomb_ui (r, W); /* Generate the high fraction */ + x->e = W; + if (x->e >= k) + return; /* Maybe that's it? */ + } + + if (t) + { + /* passed a mpz_t so compute needed bits in one call to mpz_urandomb */ + k = ((k + (W-1)) / W) * W; /* Round up to multiple of W */ + k -= x->e; /* The number of new bits */ + mpz_urandomb (x->e == W ? x->f : t, r, k); /* Copy directly to x->f? */ + if (x->e > W) + { + mpz_mul_2exp (x->f, x->f, k); + mpz_add (x->f, x->f, t); + } + x->e += k; + } + else + { + /* no mpz_t so compute the bits W at a time via gmp_urandomb_ui */ + while (x->e < k) + { + unsigned long w = gmp_urandomb_ui (r, W); + if (x->e == W) + mpz_set_ui (x->f, w); + else + { + mpz_mul_2exp (x->f, x->f, W); + mpz_add_ui (x->f, x->f, w); + } + x->e += W; + } + } +} + +/* + * return index [-1..127] of highest bit set. Return -1 if x = 0, 2 if x = 4, + * etc. (From Algorithms for programmers by Joerg Arndt.) + */ +static int +highest_bit_idx_alt (unsigned long x) +{ + int r = 0; + + if (x == 0) + return -1; + MPFR_ASSERTN (sizeof (unsigned long) * CHAR_BIT <= 128); + if (sizeof (unsigned long) * CHAR_BIT > 64) + { + /* handle 128-bit unsigned longs avoiding compiler warnings */ + unsigned long y = x >> 16; y >>= 24; y >>= 24; + if (y) { x = y; r += 64;} + } + if (x & ~0xffffffffUL) { x >>= 16; x >>= 16; r +=32; } + if (x & 0xffff0000UL) { x >>= 16; r += 16; } + if (x & 0x0000ff00UL) { x >>= 8; r += 8; } + if (x & 0x000000f0UL) { x >>= 4; r += 4; } + if (x & 0x0000000cUL) { x >>= 2; r += 2; } + if (x & 0x00000002UL) { r += 1; } + return r; +} + +/* + * return index [-1..63] of highest bit set. + * Return -1 if x = 0, 63 is if x = ~0 (for 64-bit unsigned long). + * See highest_bit_idx_alt too. + */ +static int +highest_bit_idx (unsigned long x) +{ + /* this test should be evaluated at compile time */ + if (sizeof (mp_limb_t) >= sizeof (unsigned long)) + { + int cnt; + + if (x == 0) + return -1; + count_leading_zeros (cnt, (mp_limb_t) x); + MPFR_ASSERTD (cnt <= GMP_NUMB_BITS - 1); + return GMP_NUMB_BITS - 1 - cnt; + } + else + return highest_bit_idx_alt (x); +} + +/* return position of leading bit, counting from 1 */ +static mpfr_random_size_t +random_deviate_leading_bit (mpfr_random_deviate_t x, gmp_randstate_t r) +{ + mpfr_random_size_t l; + random_deviate_generate (x, W, r, 0); + if (x->h) + return W - highest_bit_idx (x->h); + random_deviate_generate (x, 2 * W, r, 0); + while (mpz_sgn (x->f) == 0) + random_deviate_generate (x, x->e + 1, r, 0); + l = x->e + 1 - mpz_sizeinbase (x->f, 2); + /* Guard against a ridiculously long string of leading zeros in the fraction; + * probability of this happening is 2^(-2^31). In particular ensure that + * p + 1 + l in mpfr_random_deviate_value doesn't overflow with p = + * MPFR_PREC_MAX. */ + MPFR_ASSERTN (l + 1 < (mpfr_random_size_t)(-MPFR_PREC_MAX)); + return l; +} + +/* return kth bit of fraction, representing 2^-k */ +int +mpfr_random_deviate_tstbit (mpfr_random_deviate_t x, mpfr_random_size_t k, + gmp_randstate_t r) +{ + if (k == 0) + return 0; + random_deviate_generate (x, k, r, 0); + if (k <= W) + return (x->h >> (W - k)) & 1UL; + return mpz_tstbit (x->f, x->e - k); +} + +/* compare two random deviates, x < y */ +int +mpfr_random_deviate_less (mpfr_random_deviate_t x, mpfr_random_deviate_t y, + gmp_randstate_t r) +{ + mpfr_random_size_t k = 1; + + if (x == y) + return 0; + random_deviate_generate (x, W, r, 0); + random_deviate_generate (y, W, r, 0); + if (x->h != y->h) + return x->h < y->h; /* Compare the high fractions */ + k += W; + for (; ; ++k) + { /* Compare the rest of the fraction bit by bit */ + int a = mpfr_random_deviate_tstbit (x, k, r); + int b = mpfr_random_deviate_tstbit (y, k, r); + if (a != b) + return a < b; + } +} + +/* set mpfr_t z = (neg ? -1 : 1) * (n + x) */ +int +mpfr_random_deviate_value (int neg, unsigned long n, + mpfr_random_deviate_t x, mpfr_t z, + gmp_randstate_t r, mpfr_rnd_t rnd) +{ + /* r is used to add as many bits as necessary to match the precision of z */ + int s; + mpfr_random_size_t l; /* The leading bit is 2^(s*l) */ + mpfr_random_size_t p = mpfr_get_prec (z); /* Number of bits in result */ + mpz_t t; + int inex; + + if (n == 0) + { + s = -1; + l = random_deviate_leading_bit (x, r); /* l > 0 */ + } + else + { + s = 1; + l = highest_bit_idx (n); /* l >= 0 */ + } + + /* + * Leading bit is 2^(s*l); thus the trailing bit in result is 2^(s*l-p+1) = + * 2^-(p-1-s*l). For the sake of illustration, take l = 0 and p = 4, thus + * bits through the 1/8 position need to be generated; assume that these bits + * are 1.010 = 10/8 which represents a deviate in the range (10,11)/8. + * + * If the rounding mode is one of RNDZ, RNDU, RNDD, RNDA, we add a 1 bit to + * the result to give 1.0101 = (10+1/2)/8. When this is converted to a MPFR + * the result is rounded to 10/8, 11/8, 10/8, 11/8, respectively, and the + * inexact flag is set to -1, 1, -1, 1. + * + * If the rounding mode is RNDN, an additional random bit must be generated + * to determine if the result is in (10,10+1/2)/8 or (10+1/2,11)/8. Assume + * that this random bit is 0, so the result is 1.0100 = (10+0/2)/8. Then an + * additional 1 bit is added to give 1.010101 = (10+1/4)/8. This last bit + * avoids the "round ties to even rule" (because there are no ties) and sets + * the inexact flag so that the result is 10/8 with the inexact flag = 1. + * + * Here we always generate at least 2 additional random bits, so that bit + * position 2^-(p+1-s*l) is generated. (The result often contains more + * random bits than this because random bits are added in batches of W and + * because additional bits may have been required in the process of + * generating the random deviate.) The integer and all the bits in the + * fraction are then copied into an mpz, the least significant bit is + * unconditionally set to 1, the sign is set, and the result together with + * the exponent -x->e is used to generate an mpfr using mpfr_set_z_2exp. + * + * If random bits were very expensive, we would only need to generate to the + * 2^-(p-1-s*l) bit (no extra bits) for the RNDZ, RNDU, RNDD, RNDA modes and + * to the 2^-(p-s*l) bit (1 extra bit) for RNDN. By always generating 2 bits + * we save on some bit shuffling when formed the mpz to be converted to an + * mpfr. The implementation of the RandomNumber class in RandomLib + * illustrates the more parsimonious approach (which was taken to allow + * accurate counts of the number of random digits to be made). + */ + mpz_init (t); + /* + * This is the only call to random_deviate_generate where a mpz_t is passed + * (because an arbitrarily large number of bits may need to be generated). + */ + if ((s > 0 && p + 1 > l) || + (s < 0 && p + 1 + l > 0)) + random_deviate_generate (x, s > 0 ? p + 1 - l : p + 1 + l, r, t); + if (n == 0) + { + /* Since the minimum prec is 2 we know that x->h has been generated. */ + mpz_set_ui (t, x->h); /* Set high fraction */ + } + else + { + mpz_set_ui (t, n); /* The integer part */ + if (x->e > 0) + { + mpz_mul_2exp (t, t, W); /* Shift to allow for high fraction */ + mpz_add_ui (t, t, x->h); /* Add high fraction */ + } + } + if (x->e > W) + { + mpz_mul_2exp (t, t, x->e - W); /* Shift to allow for low fraction */ + mpz_add (t, t, x->f); /* Add low fraction */ + } + /* + * We could trim off any excess bits here by shifting rightward. This is an + * unnecessary complication. + */ + mpz_setbit (t, 0); /* Set the trailing bit so result is always inexact */ + if (neg) + mpz_neg (t, t); + /* Is -x->e representable as a mpfr_exp_t? */ + MPFR_ASSERTN (x->e <= (mpfr_uexp_t)(-1) >> 1); + /* + * Let mpfr_set_z_2exp do all the work of rounding to the requested + * precision, setting overflow/underflow flags, and returning the right + * inexact value. + */ + inex = mpfr_set_z_2exp (z, t, -x->e, rnd); + mpz_clear (t); + return inex; +} diff -Nru mpfr4-3.1.4/src/random_deviate.h mpfr4-4.0.2/src/random_deviate.h --- mpfr4-3.1.4/src/random_deviate.h 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/random_deviate.h 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,86 @@ +/* Declarations of random_deviate routines for mpfr_erandom and mpfr_nrandom. + +Copyright 2013-2019 Free Software Foundation, Inc. +Contributed by Charles Karney , SRI International. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if !defined(MPFR_RANDOM_DEVIATE_H) +#define MPFR_RANDOM_DEVIATE_H 1 + +#include "mpfr-impl.h" + +/* This should be an unsigned type with a width of at least 32 and capable of + * representing at least 2*MPFR_PREC_MAX. This is used to count the bits in + * the fraction of a mpfr_random_deviate_t. See the checks made on this type + * in random_deviate_generate. */ +typedef unsigned long mpfr_random_size_t; + +typedef struct { + mpfr_random_size_t e; /* total number of bits in the fraction */ + unsigned long h; /* the high W bits of the fraction */ + mpz_t f; /* the rest of the fraction */ +} __mpfr_random_deviate_struct; + +typedef __mpfr_random_deviate_struct mpfr_random_deviate_t[1]; +typedef __mpfr_random_deviate_struct *mpfr_random_deviate_ptr; + +#if defined(__cplusplus) +extern "C" { +#endif + +/* allocate and set to (0,1) */ +__MPFR_DECLSPEC void + mpfr_random_deviate_init (mpfr_random_deviate_ptr); + +/* reset to (0,1) */ +__MPFR_DECLSPEC void + mpfr_random_deviate_reset (mpfr_random_deviate_ptr); + +/* deallocate */ +__MPFR_DECLSPEC void + mpfr_random_deviate_clear (mpfr_random_deviate_ptr); + +/* swap two random deviates */ +__MPFR_DECLSPEC void + mpfr_random_deviate_swap (mpfr_random_deviate_ptr, + mpfr_random_deviate_ptr); + +/* return kth bit of fraction, representing 2^-k */ +__MPFR_DECLSPEC int + mpfr_random_deviate_tstbit (mpfr_random_deviate_ptr, + mpfr_random_size_t, + gmp_randstate_t); + +/* compare two random deviates, x < y */ +__MPFR_DECLSPEC int + mpfr_random_deviate_less (mpfr_random_deviate_ptr, + mpfr_random_deviate_ptr, + gmp_randstate_t); + +/* set mpfr_t z = (neg ? -1 : 1) * (n + x) */ +__MPFR_DECLSPEC int + mpfr_random_deviate_value (int, unsigned long, + mpfr_random_deviate_ptr, mpfr_t, + gmp_randstate_t, mpfr_rnd_t); + +#if defined(__cplusplus) +} +#endif + +#endif diff -Nru mpfr4-3.1.4/src/rec_sqrt.c mpfr4-4.0.2/src/rec_sqrt.c --- mpfr4-3.1.4/src/rec_sqrt.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/rec_sqrt.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_rec_sqrt -- inverse square root -Copyright 2008-2016 Free Software Foundation, Inc. +Copyright 2008-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,23 +17,22 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #define MPFR_NEED_LONGLONG_H /* for umul_ppmm */ #include "mpfr-impl.h" #define LIMB_SIZE(x) ((((x)-1)>>MPFR_LOG2_GMP_NUMB_BITS) + 1) #define MPFR_COM_N(x,y,n) \ - { \ - mp_size_t i; \ - for (i = 0; i < n; i++) \ - *((x)+i) = ~*((y)+i); \ - } + do \ + { \ + mp_size_t i; \ + for (i = 0; i < n; i++) \ + *((x)+i) = ~*((y)+i); \ + } \ + while (0) /* Put in X a p-bit approximation of 1/sqrt(A), where X = {x, n}/B^n, n = ceil(p/GMP_NUMB_BITS), @@ -68,7 +67,7 @@ References: [1] Modern Computer Algebra, Richard Brent and Paul Zimmermann, - http://www.loria.fr/~zimmerma/mca/pub226.html + https://members.loria.fr/PZimmermann/mca/pub226.html */ static void mpfr_mpn_rec_sqrt (mpfr_limb_ptr x, mpfr_prec_t p, @@ -166,7 +165,7 @@ MPFR_ASSERTD((a[an - 1] & MPFR_LIMB_HIGHBIT) != 0); /* We should have enough bits in one limb and GMP_NUMB_BITS should be even. Since that does not depend on MPFR, we always check this. */ - MPFR_ASSERTN((GMP_NUMB_BITS >= 12) && ((GMP_NUMB_BITS & 1) == 0)); + MPFR_STAT_STATIC_ASSERT (GMP_NUMB_BITS >= 12 && (GMP_NUMB_BITS & 1) == 0); /* {a, an} and {x, n} should not overlap */ MPFR_ASSERTD((a + an <= x) || (x + n <= a)); MPFR_ASSERTD(p >= 11); @@ -424,7 +423,7 @@ } /* cy can be 1 when A=1, i.e., {a, n} = B^n. In that case we should - have X = B^n, and setting X to 1-2^{-p} satisties the error bound + have X = B^n, and setting X to 1-2^{-p} satisfies the error bound of 1 ulp. */ if (MPFR_UNLIKELY(cy != 0)) { @@ -459,10 +458,10 @@ } else if (MPFR_IS_ZERO(u)) /* 1/sqrt(+0) = 1/sqrt(-0) = +Inf */ { - /* 0+ or 0- */ + /* +0 or -0 */ MPFR_SET_INF(r); MPFR_SET_POS(r); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); MPFR_RET(0); /* Inf is exact */ } else diff -Nru mpfr4-3.1.4/src/reldiff.c mpfr4-4.0.2/src/reldiff.c --- mpfr4-3.1.4/src/reldiff.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/reldiff.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_reldiff -- compute relative difference of two floating-point numbers. -Copyright 2000-2001, 2004-2016 Free Software Foundation, Inc. +Copyright 2000-2001, 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/rem1.c mpfr4-4.0.2/src/rem1.c --- mpfr4-3.1.4/src/rem1.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/rem1.c 2019-01-07 13:53:20.000000000 +0000 @@ -2,7 +2,7 @@ mpfr_fmod -- compute the floating-point remainder of x/y mpfr_remquo and mpfr_remainder -- argument reduction functions -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -19,7 +19,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ # include "mpfr-impl.h" @@ -255,3 +255,10 @@ { return mpfr_rem1 (rem, (long *) 0, MPFR_RNDZ, x, y, rnd); } + +int +mpfr_fmodquo (mpfr_ptr rem, long *quo, mpfr_srcptr x, mpfr_srcptr y, + mpfr_rnd_t rnd) +{ + return mpfr_rem1 (rem, quo, MPFR_RNDZ, x, y, rnd); +} diff -Nru mpfr4-3.1.4/src/rint.c mpfr4-4.0.2/src/rint.c --- mpfr4-3.1.4/src/rint.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/rint.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_rint -- Round to an integer. -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -213,7 +213,7 @@ uj = un - ui; /* lowest limb of the integer part in u */ rj = rn - ui; /* lowest limb of the integer part in r */ - if (MPFR_LIKELY (rp != up)) + if (rp != up) MPN_COPY(rp + rj, up + uj, ui); /* Ignore the lowest rj limbs, all equal to zero. */ @@ -281,7 +281,7 @@ } if (sh != 0) - rp[0] &= MP_LIMB_T_MAX << sh; + rp[0] &= MPFR_LIMB_MAX << sh; /* If u is a representable integer, there is no rounding. */ if (uflags == 0) @@ -304,6 +304,14 @@ } /* exp > 0, |u| >= 1 */ } +#undef mpfr_roundeven + +int +mpfr_roundeven (mpfr_ptr r, mpfr_srcptr u) +{ + return mpfr_rint (r, u, MPFR_RNDN); +} + #undef mpfr_round int @@ -341,6 +349,32 @@ * the inexact flag when the argument is not an integer. */ +#undef mpfr_rint_roundeven + +int +mpfr_rint_roundeven (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode) +{ + if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(u) ) || mpfr_integer_p (u)) + return mpfr_set (r, u, rnd_mode); + else + { + mpfr_t tmp; + int inex; + mpfr_flags_t saved_flags = __gmpfr_flags; + MPFR_BLOCK_DECL (flags); + + mpfr_init2 (tmp, MPFR_PREC (u)); + /* round(u) is representable in tmp unless an overflow occurs */ + MPFR_BLOCK (flags, mpfr_roundeven (tmp, u)); + __gmpfr_flags = saved_flags; + inex = (MPFR_OVERFLOW (flags) + ? mpfr_overflow (r, rnd_mode, MPFR_SIGN (u)) + : mpfr_set (r, tmp, rnd_mode)); + mpfr_clear (tmp); + return inex; + } +} + #undef mpfr_rint_round int @@ -352,7 +386,7 @@ { mpfr_t tmp; int inex; - unsigned int saved_flags = __gmpfr_flags; + mpfr_flags_t saved_flags = __gmpfr_flags; MPFR_BLOCK_DECL (flags); mpfr_init2 (tmp, MPFR_PREC (u)); @@ -378,7 +412,7 @@ { mpfr_t tmp; int inex; - unsigned int saved_flags = __gmpfr_flags; + mpfr_flags_t saved_flags = __gmpfr_flags; mpfr_init2 (tmp, MPFR_PREC (u)); /* trunc(u) is always representable in tmp */ @@ -401,7 +435,7 @@ { mpfr_t tmp; int inex; - unsigned int saved_flags = __gmpfr_flags; + mpfr_flags_t saved_flags = __gmpfr_flags; MPFR_BLOCK_DECL (flags); mpfr_init2 (tmp, MPFR_PREC (u)); @@ -427,7 +461,7 @@ { mpfr_t tmp; int inex; - unsigned int saved_flags = __gmpfr_flags; + mpfr_flags_t saved_flags = __gmpfr_flags; MPFR_BLOCK_DECL (flags); mpfr_init2 (tmp, MPFR_PREC (u)); diff -Nru mpfr4-3.1.4/src/rndna.c mpfr4-4.0.2/src/rndna.c --- mpfr4-3.1.4/src/rndna.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/rndna.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,193 @@ +/* mpfr_round_nearest_away -- round to nearest away + +Copyright 2012-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-impl.h" + +/* Note: this doesn't work for 2^(emin-2). Currently, the best that can be + done is to extend the exponent range internally, and do not support the + case emin = MPFR_EMIN_MIN from the caller. */ + +/* In order to work, we'll save the context within the mantissa of 'rop'. + For that, we need to do some low level stuff like for init2/clear to create + a mantissa of bigger size, which contains the extra context. + To add a new field of type T in the context, add its type in + mpfr_size_limb_extended_t (if it is not already present) + and add a new value for the enum mpfr_index_extended_t before MANTISSA. */ +typedef union { + mp_size_t si; + mp_limb_t li; + mpfr_exp_t ex; + mpfr_prec_t pr; + mpfr_sign_t sg; + mpfr_flags_t fl; + mpfr_limb_ptr pi; +} mpfr_size_limb_extended_t; +typedef enum { + ALLOC_SIZE = 0, + OLD_MANTISSA, + OLD_EXPONENT, + OLD_SIGN, + OLD_PREC, + OLD_FLAGS, + OLD_EXP_MIN, + OLD_EXP_MAX, + MANTISSA +} mpfr_index_extended_t ; + +#define MPFR_MALLOC_EXTENDED_SIZE(s) \ + (MANTISSA * sizeof(mpfr_size_limb_extended_t) + \ + MPFR_BYTES_PER_MP_LIMB * (size_t) (s)) + +/* This function is called before the applied function + and prepares rop to give it one more bit of precision + and to save its old value within it. */ +void +mpfr_round_nearest_away_begin (mpfr_t rop) +{ + mpfr_t tmp; + mp_size_t xsize; + mpfr_size_limb_extended_t *ext; + mpfr_prec_t p; + int inexact; + MPFR_SAVE_EXPO_DECL (expo); + + /* when emin is the smallest possible value, we cannot + determine the correct round-to-nearest-away rounding for + 0.25*2^emin, which gets rounded to 0 with nearest-even, + instead of 0.5^2^emin. */ + MPFR_ASSERTN(__gmpfr_emin > MPFR_EMIN_MIN); + + p = MPFR_PREC (rop) + 1; + MPFR_SAVE_EXPO_MARK (expo); + + /* We can't use mpfr_init2 since we need to store an additional context + within the mantissa. */ + MPFR_ASSERTN(p <= MPFR_PREC_MAX); + /* Allocate the context within the needed mantissa. */ + xsize = MPFR_PREC2LIMBS (p); + ext = (mpfr_size_limb_extended_t *) + mpfr_allocate_func (MPFR_MALLOC_EXTENDED_SIZE(xsize)); + + /* Save the context first. */ + ext[ALLOC_SIZE].si = xsize; + ext[OLD_MANTISSA].pi = MPFR_MANT(rop); + ext[OLD_EXPONENT].ex = MPFR_EXP(rop); + ext[OLD_SIGN].sg = MPFR_SIGN(rop); + ext[OLD_PREC].pr = MPFR_PREC(rop); + ext[OLD_FLAGS].fl = expo.saved_flags; + ext[OLD_EXP_MIN].ex = expo.saved_emin; + ext[OLD_EXP_MAX].ex = expo.saved_emax; + + /* Create tmp as a proper NAN. */ + MPFR_PREC(tmp) = p; /* Set prec */ + MPFR_SET_POS(tmp); /* Set a sign */ + MPFR_MANT(tmp) = (mp_limb_t*)(ext+MANTISSA); /* Set Mantissa ptr */ + MPFR_SET_NAN(tmp); /* initializes to NaN */ + + /* Note: This full initialization to NaN may be unnecessary because of + the mpfr_set just below, but this is cleaner in case internals would + change in the future (for instance, some fields of tmp could be read + before being set, and reading an uninitialized value is UB here). */ + + /* Copy rop into tmp now (rop may be used as input later). */ + MPFR_DBGRES (inexact = mpfr_set(tmp, rop, MPFR_RNDN)); + MPFR_ASSERTD(inexact == 0); /* Shall be exact since prec(tmp) > prec(rop) */ + + /* Overwrite rop with tmp. */ + rop[0] = tmp[0]; + + /* The new rop now contains a copy of the old rop, with one extra bit of + precision while keeping the old rop "hidden" within its mantissa. */ + + return; +} + +/* This function is called after the applied function. + rop is the one prepared in the function above, + and contains the result of the applied function. + This function restores rop like it was before the + calls to mpfr_round_nearest_away_begin while + copying it back the result of the applied function + and performing additional roundings. */ +int +mpfr_round_nearest_away_end (mpfr_t rop, int inex) +{ + mpfr_t tmp; + mp_size_t xsize; + mpfr_size_limb_extended_t *ext; + mpfr_prec_t n; + MPFR_SAVE_EXPO_DECL (expo); + + /* Get back the hidden context. */ + ext = ((mpfr_size_limb_extended_t *) MPFR_MANT(rop)) - MANTISSA; + + /* Create tmp with the result of the function. */ + tmp[0] = rop[0]; + + /* Revert rop back to what it was before calling + mpfr_round_neareset_away_begin. */ + MPFR_PREC(rop) = ext[OLD_PREC].pr; + MPFR_SIGN(rop) = ext[OLD_SIGN].sg; + MPFR_EXP(rop) = ext[OLD_EXPONENT].ex; + MPFR_MANT(rop) = ext[OLD_MANTISSA].pi; + MPFR_ASSERTD(MPFR_PREC(tmp) == MPFR_PREC(rop)+1); + + /* Restore the saved context. */ + expo.saved_flags = ext[OLD_FLAGS].fl; + expo.saved_emin = ext[OLD_EXP_MIN].ex; + expo.saved_emax = ext[OLD_EXP_MAX].ex; + xsize = ext[ALLOC_SIZE].si; + + /* Perform RNDNA. */ + n = MPFR_PREC(rop); + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (tmp))) + mpfr_set (rop, tmp, MPFR_RNDN); /* inex unchanged */ + else + { + int lastbit, sh; + + MPFR_UNSIGNED_MINUS_MODULO(sh, n + 1); + lastbit = (MPFR_MANT(tmp)[0] >> sh) & 1; + + if (lastbit == 0) + mpfr_set (rop, tmp, MPFR_RNDN); /* exact, inex unchanged */ + else if (inex == 0) /* midpoint: round away from zero */ + inex = mpfr_set (rop, tmp, MPFR_RNDA); + else /* lastbit == 1, inex != 0: double rounding */ + inex = mpfr_set (rop, tmp, (inex > 0) ? MPFR_RNDD : MPFR_RNDU); + } + + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); + MPFR_SAVE_EXPO_FREE (expo); + + /* special treatment for the case rop = +/- 2^(emin-2), which should be + rounded to +/- 2^(emin-1). We do as if it was rounded to zero, thus the + mpfr_check_range() call will round it to +/- 2^(emin-1). */ + if (inex == 0 && mpfr_cmp_si_2exp (rop, (mpfr_sgn (rop) > 0) ? 1 : -1, + __gmpfr_emin - 2) == 0) + inex = -mpfr_sgn (rop); + + /* Free tmp (cannot call mpfr_clear): free the associated context. */ + mpfr_free_func(ext, MPFR_MALLOC_EXTENDED_SIZE(xsize)); + + return mpfr_check_range (rop, inex, MPFR_RNDN); +} diff -Nru mpfr4-3.1.4/src/root.c mpfr4-4.0.2/src/root.c --- mpfr4-3.1.4/src/root.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/root.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_root -- kth root. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -45,7 +45,7 @@ mpfr_rnd_t rnd_mode); int -mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode) +mpfr_rootn_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode) { mpz_t m; mpfr_exp_t e, r, sh, f; @@ -63,6 +63,7 @@ { if (k == 0) { + /* rootn(x,0) is NaN (IEEE 754-2008). */ MPFR_SET_NAN (y); MPFR_RET_NAN; } @@ -79,34 +80,43 @@ MPFR_RET_NAN; } - if (MPFR_IS_INF (x)) /* +Inf^(1/k) = +Inf - -Inf^(1/k) = -Inf if k odd - -Inf^(1/k) = NaN if k even */ + if (MPFR_IS_INF (x)) /* (+Inf)^(1/k) = +Inf + (-Inf)^(1/k) = -Inf if k odd + (-Inf)^(1/k) = NaN if k even */ { - if (MPFR_IS_NEG(x) && (k % 2 == 0)) + if (MPFR_IS_NEG (x) && (k & 1) == 0) { MPFR_SET_NAN (y); MPFR_RET_NAN; } MPFR_SET_INF (y); + MPFR_SET_SAME_SIGN (y, x); } else /* x is necessarily 0: (+0)^(1/k) = +0 (-0)^(1/k) = -0 */ { MPFR_ASSERTD (MPFR_IS_ZERO (x)); MPFR_SET_ZERO (y); + if (MPFR_IS_POS (x) || (k & 1) == 0) + MPFR_SET_POS (y); + else + MPFR_SET_NEG (y); } - MPFR_SET_SAME_SIGN (y, x); MPFR_RET (0); } /* Returns NAN for x < 0 and k even */ - if (MPFR_UNLIKELY (MPFR_IS_NEG (x) && (k % 2 == 0))) + if (MPFR_UNLIKELY (MPFR_IS_NEG (x) && (k & 1) == 0)) { MPFR_SET_NAN (y); MPFR_RET_NAN; } + /* Special case |x| = 1. Note that if x = -1, then k is odd + (NaN results have already been filtered), so that y = -1. */ + if (mpfr_cmpabs (x, __gmpfr_one) == 0) + return mpfr_set (y, x, rnd_mode); + /* General case */ /* For large k, use exp(log(x)/k). The threshold of 100 seems to be quite @@ -188,6 +198,14 @@ Assume all special cases have been eliminated before. In the extended exponent range, overflows/underflows are not possible. Assume x > 0, or x < 0 and k odd. + Also assume |x| <> 1 because log(1) = 0, which does not have an exponent + and would yield a failure in the error bound computation. A priori, this + constraint is quite artificial because if |x| is close enough to 1, then + the exponent of log|x| does not need to be used (in the code, err would + be 1 in such a domain). So this constraint |x| <> 1 could be avoided in + the code. However, this is an exact case easy to detect, so that such a + change would be useless. Values very close to 1 are not an issue, since + an underflow is not possible before the MPFR_GET_EXP. */ static int mpfr_root_aux (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode) @@ -219,7 +237,8 @@ mpfr_log (t, absx, MPFR_RNDN); /* t = log|x| * (1 + theta) with |theta| <= 2^(-w) */ mpfr_div_ui (t, t, k, MPFR_RNDN); - expt = MPFR_GET_EXP (t); + /* No possible underflow in mpfr_log and mpfr_div_ui. */ + expt = MPFR_GET_EXP (t); /* assumes t <> 0 */ /* t = log|x|/k * (1 + theta) + eps with |theta| <= 2^(-w) and |eps| <= 1/2 ulp(t), thus the total error is bounded by 1.5 * 2^(expt - w) */ @@ -277,3 +296,36 @@ return mpfr_check_range (y, inexact, rnd_mode); } + +int +mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode) +{ + MPFR_LOG_FUNC + (("x[%Pu]=%.*Rg k=%lu rnd=%d", + mpfr_get_prec (x), mpfr_log_prec, x, k, rnd_mode), + ("y[%Pu]=%.*Rg", + mpfr_get_prec (y), mpfr_log_prec, y)); + + /* Like mpfr_rootn_ui... */ + if (MPFR_UNLIKELY (k <= 1)) + { + if (k == 0) + { + /* rootn(x,0) is NaN (IEEE 754-2008). */ + MPFR_SET_NAN (y); + MPFR_RET_NAN; + } + else /* y = x^(1/1) = x */ + return mpfr_set (y, x, rnd_mode); + } + + if (MPFR_UNLIKELY (MPFR_IS_ZERO (x))) + { + /* The only case that may differ from mpfr_rootn_ui. */ + MPFR_SET_ZERO (y); + MPFR_SET_SAME_SIGN (y, x); + MPFR_RET (0); + } + else + return mpfr_rootn_ui (y, x, k, rnd_mode); +} diff -Nru mpfr4-3.1.4/src/round_near_x.c mpfr4-4.0.2/src/round_near_x.c --- mpfr4-3.1.4/src/round_near_x.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/round_near_x.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_round_near_x -- Round a floating point number nears another one. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -157,7 +157,10 @@ mpfr_rnd_t rnd) { int inexact, sign; - unsigned int old_flags = __gmpfr_flags; + mpfr_flags_t old_flags = __gmpfr_flags; + + if (rnd == MPFR_RNDF) + rnd = MPFR_RNDZ; MPFR_ASSERTD (!MPFR_IS_SINGULAR (v)); MPFR_ASSERTD (dir == 0 || dir == 1); @@ -207,21 +210,21 @@ inexact = -sign; mpfr_nexttozero (y); if (MPFR_UNLIKELY (MPFR_IS_ZERO (y))) - mpfr_set_underflow (); + MPFR_SET_UNDERFLOW (); } } else /* The error term is positive for v positive */ { inexact = -sign; /* Round Away */ - if (rnd != MPFR_RNDN && !MPFR_IS_LIKE_RNDZ (rnd, MPFR_IS_NEG_SIGN(sign))) + if (MPFR_IS_LIKE_RNDA (rnd, MPFR_IS_NEG_SIGN(sign))) { /* case nexttoinf */ /* The overflow flag should be set if the result is infinity */ inexact = sign; mpfr_nexttoinf (y); if (MPFR_UNLIKELY (MPFR_IS_INF (y))) - mpfr_set_overflow (); + MPFR_SET_OVERFLOW (); } } } diff -Nru mpfr4-3.1.4/src/round_p.c mpfr4-4.0.2/src/round_p.c --- mpfr4-3.1.4/src/round_p.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/round_p.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_round_p -- check if an approximation is roundable. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,14 +17,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" /* Check against mpfr_can_round? */ -#ifdef MPFR_WANT_ASSERT -# if MPFR_WANT_ASSERT >= 2 +#if MPFR_WANT_ASSERT >= 2 int mpfr_round_p_2 (mp_limb_t *, mp_size_t, mpfr_exp_t, mpfr_prec_t); int mpfr_round_p (mp_limb_t *bp, mp_size_t bn, mpfr_exp_t err0, mpfr_prec_t prec) @@ -35,10 +34,16 @@ i1 = mpfr_round_p_2 (bp, bn, err0, prec); - /* compare with mpfr_can_round_raw */ + /* Note: since revision 10747, mpfr_can_round_raw is supposed to be always + correct, whereas mpfr_round_p_2 might return 0 in some cases where one + could round, for example with err0=67 and prec=54: + b = 1111101101010001100011111011100010100011101111011011101111111111 + thus we cannot compare i1 and i2, we only can check that we don't have + i1 <> 0 and i2 = 0. + */ i2 = mpfr_can_round_raw (bp, bn, MPFR_SIGN_POS, err0, MPFR_RNDN, MPFR_RNDZ, prec); - if (i1 != i2) + if (i1 && (i2 == 0)) { fprintf (stderr, "mpfr_round_p(%d) != mpfr_can_round(%d)!\n" "bn = %lu, err0 = %ld, prec = %lu\nbp = ", i1, i2, @@ -50,8 +55,7 @@ return i1; } # define mpfr_round_p mpfr_round_p_2 -# endif -#endif +#endif /* MPFR_WANT_ASSERT >= 2 */ /* * Assuming {bp, bn} is an approximation of a non-singular number @@ -75,16 +79,16 @@ err = MIN (err, (mpfr_uexp_t) err0); k = prec / GMP_NUMB_BITS; - s = GMP_NUMB_BITS - prec%GMP_NUMB_BITS; + s = GMP_NUMB_BITS - prec % GMP_NUMB_BITS; n = err / GMP_NUMB_BITS - k; MPFR_ASSERTD (n >= 0); MPFR_ASSERTD (bn > k); /* Check first limb */ - bp += bn-1-k; + bp += bn - 1 - k; tmp = *bp--; - mask = s == GMP_NUMB_BITS ? MP_LIMB_T_MAX : MPFR_LIMB_MASK (s); + mask = s == GMP_NUMB_BITS ? MPFR_LIMB_MAX : MPFR_LIMB_MASK (s); tmp &= mask; if (MPFR_LIKELY (n == 0)) @@ -113,14 +117,14 @@ { /* Check if all (n-1) limbs are 11111111111111111 */ while (--n) - if (*bp-- != MP_LIMB_T_MAX) + if (*bp-- != MPFR_LIMB_MAX) return 1; /* Check if final error limb is 0 */ s = GMP_NUMB_BITS - err % GMP_NUMB_BITS; if (s == GMP_NUMB_BITS) return 0; tmp = *bp >> s; - return tmp != (MP_LIMB_T_MAX >> s); + return tmp != (MPFR_LIMB_MAX >> s); } else { diff -Nru mpfr4-3.1.4/src/round_prec.c mpfr4-4.0.2/src/round_prec.c --- mpfr4-3.1.4/src/round_prec.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/round_prec.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_round_raw_generic, mpfr_round_raw2, mpfr_round_raw, mpfr_prec_round, mpfr_can_round, mpfr_can_round_raw -- various rounding functions -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -45,6 +45,9 @@ #define use_inexp 0 #include "round_raw_generic.c" +/* Note: if the new prec is lower than the current one, a reallocation + must not be done (see exp_2.c). */ + int mpfr_prec_round (mpfr_ptr x, mpfr_prec_t prec, mpfr_rnd_t rnd_mode) { @@ -53,7 +56,7 @@ mpfr_prec_t nw, ow; MPFR_TMP_DECL(marker); - MPFR_ASSERTN(prec >= MPFR_PREC_MIN && prec <= MPFR_PREC_MAX); + MPFR_ASSERTN (MPFR_PREC_COND (prec)); nw = MPFR_PREC2LIMBS (prec); /* needed allocated limbs */ @@ -61,15 +64,17 @@ /* Get the number of limbs from the precision. (Compatible with all allocation methods) */ ow = MPFR_LIMB_SIZE (x); - if (nw > ow) + if (MPFR_UNLIKELY (nw > ow)) { /* FIXME: Variable can't be created using custom allocation, MPFR_DECL_INIT or GROUP_ALLOC: How to detect? */ ow = MPFR_GET_ALLOC_SIZE(x); if (nw > ow) { + mpfr_size_limb_t *tmpx; + /* Realloc significand */ - mpfr_limb_ptr tmpx = (mpfr_limb_ptr) (*__gmp_reallocate_func) + tmpx = (mpfr_size_limb_t *) mpfr_reallocate_func (MPFR_GET_REAL_PTR(x), MPFR_MALLOC_SIZE(ow), MPFR_MALLOC_SIZE(nw)); MPFR_SET_MANT_PTR(x, tmpx); /* mant ptr must be set before alloc size */ @@ -122,8 +127,32 @@ /* assuming b is an approximation to x in direction rnd1 with error at most 2^(MPFR_EXP(b)-err), returns 1 if one is able to round exactly x to precision prec with direction rnd2, and 0 otherwise. - Side effects: none. + + rnd1 = RNDN and RNDF are similar: the sign of the error is unknown. + + rnd2 = RNDF: assume that the user will round the approximation b + toward the direction of x, i.e. the opposite of rnd1 in directed + rounding modes, otherwise RNDN. Some details: + + u xinf v xsup w + -----|----+----------|--+------------|----- + [----- x -----] + rnd1 = RNDD b | + rnd1 = RNDU b + + where u, v and w are consecutive machine numbers. + + * If [xinf,xsup] contains no machine numbers, then return 1. + + * If [xinf,xsup] contains 2 machine numbers, then return 0. + + * If [xinf,xsup] contains a single machine number, then return 1 iff + the rounding of b is this machine number. + With the above choice for the rounding of b, this will always be + the case if rnd1 is a directed rounding mode; said otherwise, for + rnd2 = RNDF and rnd1 being a directed rounding mode, return 1 iff + [xinf,xsup] contains at most 1 machine number. */ int @@ -137,48 +166,187 @@ MPFR_SIGN(b), err, rnd1, rnd2, prec); } +/* TODO: mpfr_can_round_raw currently does a memory allocation and some + mpn operations. A bit inspection like for mpfr_round_p (round_p.c) may + be sufficient, though this would be more complex than the one done in + mpfr_round_p, and in particular, for some rnd1/rnd2 combinations, one + needs to take care of changes of binade when the value is close to a + power of 2. */ + int -mpfr_can_round_raw (const mp_limb_t *bp, mp_size_t bn, int neg, mpfr_exp_t err0, +mpfr_can_round_raw (const mp_limb_t *bp, mp_size_t bn, int neg, mpfr_exp_t err, mpfr_rnd_t rnd1, mpfr_rnd_t rnd2, mpfr_prec_t prec) { - mpfr_prec_t err, prec0 = prec; + mpfr_prec_t prec2; mp_size_t k, k1, tn; int s, s1; mp_limb_t cc, cc2; mp_limb_t *tmp; + mp_limb_t cy = 0, tmp_hi; + int res; MPFR_TMP_DECL(marker); - MPFR_ASSERTD(bp[bn - 1] & MPFR_LIMB_HIGHBIT); + /* Since mpfr_can_round is a function in the API, use MPFR_ASSERTN. + The specification makes sense only for prec >= 1. */ + MPFR_ASSERTN (prec >= 1); - if (MPFR_UNLIKELY(err0 < 0 || (mpfr_uexp_t) err0 <= prec)) - return 0; /* can't round */ + MPFR_ASSERTD(bp[bn - 1] & MPFR_LIMB_HIGHBIT); MPFR_ASSERT_SIGN(neg); neg = MPFR_IS_NEG_SIGN(neg); /* Transform RNDD and RNDU to Zero / Away */ - MPFR_ASSERTD((neg == 0) || (neg == 1)); + MPFR_ASSERTD (neg == 0 || neg == 1); + /* transform RNDF to RNDN */ + if (rnd1 == MPFR_RNDF) + rnd1 = MPFR_RNDN; if (rnd1 != MPFR_RNDN) rnd1 = MPFR_IS_LIKE_RNDZ(rnd1, neg) ? MPFR_RNDZ : MPFR_RNDA; + if (rnd2 == MPFR_RNDF) + rnd2 = (rnd1 == MPFR_RNDN) ? MPFR_RNDN : + MPFR_IS_LIKE_RNDZ(rnd2, neg) ? MPFR_RNDA : MPFR_RNDZ; if (rnd2 != MPFR_RNDN) rnd2 = MPFR_IS_LIKE_RNDZ(rnd2, neg) ? MPFR_RNDZ : MPFR_RNDA; + /* For err < prec (+1 for rnd1=RNDN), we can never round correctly, since + the error is at least 2*ulp(b) >= ulp(round(b)). + However for err = prec (+1 for rnd1=RNDN), we can round correctly in some + rare cases where ulp(b) = 1/2*ulp(U) [see below for the definition of U], + which implies rnd1 = RNDZ or RNDN, and rnd2 = RNDA or RNDN. */ + + if (MPFR_UNLIKELY (err < prec + (rnd1 == MPFR_RNDN) || + (err == prec + (rnd1 == MPFR_RNDN) && + (rnd1 == MPFR_RNDA || + rnd2 == MPFR_RNDZ)))) + return 0; /* can't round */ + + /* As a consequence... */ + MPFR_ASSERTD (err >= prec); + + /* The bound c on the error |x-b| is: c = 2^(MPFR_EXP(b)-err) <= b/2. + * So, we now know that x and b have the same sign. By symmetry, + * assume x > 0 and b > 0. We have: L <= x <= U, where, depending + * on rnd1: + * MPFR_RNDN: L = b-c, U = b+c + * MPFR_RNDZ: L = b, U = b+c + * MPFR_RNDA: L = b-c, U = b + * + * We can round x iff round(L,prec,rnd2) = round(U,prec,rnd2). + */ + if (MPFR_UNLIKELY (prec > (mpfr_prec_t) bn * GMP_NUMB_BITS)) - { /* Then prec < PREC(b): we can round: - (i) in rounding to the nearest iff err0 >= prec + 2 + { /* Then prec > PREC(b): we can round: + (i) in rounding to the nearest as long as err >= prec + 2. + When err = prec + 1 and b is not a power + of two (so that a change of binade cannot occur), then one + can round to nearest thanks to the even rounding rule (in the + target precision prec, the significand of b ends with a 0). + When err = prec + 1 and b is a power of two, when rnd1 = RNDZ one + can round too. (ii) in directed rounding mode iff rnd1 is compatible with rnd2 - and err0 >= prec + 1, unless b = 2^k and rnd1=rnd2=RNDA in - which case we need err0 >= prec + 2. */ + and err >= prec + 1, unless b = 2^k and rnd1 = RNDA or RNDN in + which case we need err >= prec + 2. + */ + if ((rnd1 == rnd2 || rnd2 == MPFR_RNDN) && err >= prec + 1) + { + if (rnd1 != MPFR_RNDZ && + err == prec + 1 && + mpfr_powerof2_raw2 (bp, bn)) + return 0; + else + return 1; + } + return 0; + } + + /* now prec <= bn * GMP_NUMB_BITS */ + + if (MPFR_UNLIKELY (err > (mpfr_prec_t) bn * GMP_NUMB_BITS)) + { + /* we distinguish the case where b is a power of two: + rnd1 rnd2 can round? + RNDZ RNDZ ok + RNDZ RNDA no + RNDZ RNDN ok + RNDA RNDZ no + RNDA RNDA ok except when err = prec + 1 + RNDA RNDN ok except when err = prec + 1 + RNDN RNDZ no + RNDN RNDA no + RNDN RNDN ok except when err = prec + 1 */ + if (mpfr_powerof2_raw2 (bp, bn)) + { + if ((rnd2 == MPFR_RNDZ || rnd2 == MPFR_RNDA) && rnd1 != rnd2) + return 0; + else if (rnd1 == MPFR_RNDZ) + return 1; /* RNDZ RNDZ and RNDZ RNDN */ + else + return err > prec + 1; + } + + /* now the general case where b is not a power of two: + rnd1 rnd2 can round? + RNDZ RNDZ ok + RNDZ RNDA except when b is representable in precision 'prec' + RNDZ RNDN except when b is the middle of two representable numbers in + precision 'prec' and b ends with 'xxx0[1]', + or b is representable in precision 'prec' + and err = prec + 1 and b ends with '1'. + RNDA RNDZ except when b is representable in precision 'prec' + RNDA RNDA ok + RNDA RNDN except when b is the middle of two representable numbers in + precision 'prec' and b ends with 'xxx1[1]', + or b is representable in precision 'prec' + and err = prec + 1 and b ends with '1'. + RNDN RNDZ except when b is representable in precision 'prec' + RNDN RNDA except when b is representable in precision 'prec' + RNDN RNDN except when b is the middle of two representable numbers in + precision 'prec', or b is representable in precision 'prec' + and err = prec + 1 and b ends with '1'. */ if (rnd2 == MPFR_RNDN) - return (mpfr_uexp_t) err0 - 2 >= prec; + { + if (err == prec + 1 && (bp[0] & 1)) + return 0; /* err == prec + 1 implies prec = bn * GMP_NUMB_BITS */ + if (prec < (mpfr_prec_t) bn * GMP_NUMB_BITS) + { + k1 = MPFR_PREC2LIMBS (prec + 1); + MPFR_UNSIGNED_MINUS_MODULO(s1, prec + 1); + if (((bp[bn - k1] >> s1) & 1) && + mpfr_round_raw2 (bp, bn, neg, MPFR_RNDA, prec + 1) == 0) + { /* b is the middle of two representable numbers */ + if (rnd1 == MPFR_RNDN) + return 0; + k1 = MPFR_PREC2LIMBS (prec); + MPFR_UNSIGNED_MINUS_MODULO(s1, prec); + return (rnd1 == MPFR_RNDZ) ^ + (((bp[bn - k1] >> s1) & 1) == 0); + } + } + return 1; + } + else if (rnd1 == rnd2) + { + if (rnd1 == MPFR_RNDN && prec < (mpfr_prec_t) bn * GMP_NUMB_BITS) + { + /* then rnd2 = RNDN, and for prec = bn * GMP_NUMB_BITS we cannot + have b the middle of two representable numbers */ + k1 = MPFR_PREC2LIMBS (prec + 1); + MPFR_UNSIGNED_MINUS_MODULO(s1, prec + 1); + if (((bp[bn - k1] >> s1) & 1) && + mpfr_round_raw2 (bp, bn, neg, MPFR_RNDA, prec + 1) == 0) + /* b is representable in precision prec+1 and ends with a 1 */ + return 0; + else + return 1; + } + else + return 1; + } else - return (rnd1 == rnd2) && (mpfr_uexp_t) err0 - 2 >= prec; + return mpfr_round_raw2 (bp, bn, neg, MPFR_RNDA, prec) != 0; } - /* if the error is smaller than ulp(b), then anyway it will propagate - up to ulp(b) */ - err = ((mpfr_uexp_t) err0 > (mpfr_prec_t) bn * GMP_NUMB_BITS) ? - (mpfr_prec_t) bn * GMP_NUMB_BITS : (mpfr_prec_t) err0; + /* now err <= bn * GMP_NUMB_BITS */ /* warning: if k = m*GMP_NUMB_BITS, consider limb m-1 and not m */ k = (err - 1) / GMP_NUMB_BITS; @@ -196,7 +364,7 @@ Warning! The number with updated bn may no longer be normalized. */ k -= k1; bn -= k1; - prec -= (mpfr_prec_t) k1 * GMP_NUMB_BITS; + prec2 = prec - (mpfr_prec_t) k1 * GMP_NUMB_BITS; /* We can decide of the correct rounding if rnd2(b-eps) and rnd2(b+eps) give the same result to the target precision 'prec', i.e., if when @@ -215,64 +383,150 @@ switch (rnd1) { case MPFR_RNDZ: - /* Round to Zero */ + /* rnd1 = Round to Zero */ cc = (bp[bn - 1] >> s1) & 1; /* mpfr_round_raw2 returns 1 if one should add 1 at ulp(b,prec), and 0 otherwise */ - cc ^= mpfr_round_raw2 (bp, bn, neg, rnd2, prec); + cc ^= mpfr_round_raw2 (bp, bn, neg, rnd2, prec2); /* cc is the new value of bit s1 in bp[bn-1] after rounding 'rnd2' */ /* now round b + 2^(MPFR_EXP(b)-err) */ - mpn_add_1 (tmp + bn - k, bp + bn - k, k, MPFR_LIMB_ONE << s); - /* if there was a carry here, then necessarily bit s1 of bp[bn-1] - changed, thus we surely cannot round for directed rounding, but this - will be detected below, with cc2 != cc */ + cy = mpn_add_1 (tmp + bn - k, bp + bn - k, k, MPFR_LIMB_ONE << s); + /* propagate carry up to most significant limb */ + for (tn = 0; tn + 1 < k1 && cy != 0; tn ++) + cy = ~bp[bn + tn] == 0; + if (cy == 0 && err == prec) + { + res = 0; + goto end; + } + if (MPFR_UNLIKELY(cy)) + { + /* when a carry occurs, we have b < 2^h <= b+c, we can round iff: + rnd2 = RNDZ: never, since b and b+c round to different values; + rnd2 = RNDA: when b+c is an exact power of two, and err > prec + (since for err = prec, b = 2^h - 1/2*ulp(2^h) is + exactly representable and thus rounds to itself); + rnd2 = RNDN: whenever cc = 0, since err >= prec implies + c <= ulp(b) = 1/2*ulp(2^h), thus b+c rounds to 2^h, + and b+c >= 2^h implies that bit 'prec' of b is 1, + thus cc = 0 means that b is rounded to 2^h too. */ + res = (rnd2 == MPFR_RNDZ) ? 0 + : (rnd2 == MPFR_RNDA) ? (err > prec && k == bn && tmp[0] == 0) + : cc == 0; + goto end; + } break; case MPFR_RNDN: - /* Round to nearest */ + /* rnd1 = Round to nearest */ /* first round b+2^(MPFR_EXP(b)-err) */ - mpn_add_1 (tmp + bn - k, bp + bn - k, k, MPFR_LIMB_ONE << s); - /* same remark as above in case a carry occurs in mpn_add_1() */ + cy = mpn_add_1 (tmp + bn - k, bp + bn - k, k, MPFR_LIMB_ONE << s); + /* propagate carry up to most significant limb */ + for (tn = 0; tn + 1 < k1 && cy != 0; tn ++) + cy = ~bp[bn + tn] == 0; cc = (tmp[bn - 1] >> s1) & 1; /* gives 0 when cc=1 */ - cc ^= mpfr_round_raw2 (tmp, bn, neg, rnd2, prec); + cc ^= mpfr_round_raw2 (tmp, bn, neg, rnd2, prec2); /* cc is the new value of bit s1 in bp[bn-1]+eps after rounding 'rnd2' */ - + if (MPFR_UNLIKELY (cy != 0)) + { + /* when a carry occurs, we have b-c < b < 2^h <= b+c, we can round + iff: + rnd2 = RNDZ: never, since b-c and b+c round to different values; + rnd2 = RNDA: when b+c is an exact power of two, and + err > prec + 1 (since for err <= prec + 1, + b-c <= 2^h - 1/2*ulp(2^h) is exactly representable + and thus rounds to itself); + rnd2 = RNDN: whenever err > prec + 1, since for err = prec + 1, + b+c rounds to 2^h, and b-c rounds to nextbelow(2^h). + For err > prec + 1, c <= 1/4*ulp(b) <= 1/8*ulp(2^h), + thus + 2^h - 1/4*ulp(b) <= b-c < b+c <= 2^h + 1/8*ulp(2^h), + therefore both b-c and b+c round to 2^h. */ + res = (rnd2 == MPFR_RNDZ) ? 0 + : (rnd2 == MPFR_RNDA) ? (err > prec + 1 && k == bn && tmp[0] == 0) + : err > prec + 1; + goto end; + } subtract_eps: - /* now round b-2^(MPFR_EXP(b)-err) */ - cc2 = mpn_sub_1 (tmp + bn - k, bp + bn - k, k, MPFR_LIMB_ONE << s); + /* now round b-2^(MPFR_EXP(b)-err), this happens for + rnd1 = RNDN or RNDA */ + MPFR_ASSERTD(rnd1 == MPFR_RNDN || rnd1 == MPFR_RNDA); + cy = mpn_sub_1 (tmp + bn - k, bp + bn - k, k, MPFR_LIMB_ONE << s); /* propagate the potential borrow up to the most significant limb (it cannot propagate further since the most significant limb is - at least MPFR_LIMB_HIGHBIT) */ - for (tn = 0; tn + 1 < k1 && (cc2 != 0); tn ++) - cc2 = bp[bn + tn] == 0; - /* We have an exponent decrease when either: - (i) k1 = 0 and tmp[bn-1] < MPFR_LIMB_HIGHBIT - (ii) k1 > 0 and cc <> 0 and bp[bn + tn] = MPFR_LIMB_HIGHBIT - (then necessarily tn = k1-1). - Then for directed rounding we cannot round, - and for rounding to nearest we cannot round when err = prec + 1. + at least MPFR_LIMB_HIGHBIT). + Note: we use the same limb tmp[bn-1] to subtract. */ + tmp_hi = tmp[bn - 1]; + for (tn = 0; tn < k1 && cy != 0; tn ++) + cy = mpn_sub_1 (&tmp_hi, bp + bn + tn, 1, cy); + /* We have an exponent decrease when tn = k1 and + tmp[bn-1] < MPFR_LIMB_HIGHBIT: + b-c < 2^h <= b (for RNDA) or b+c (for RNDN). + Then we surely cannot round when rnd2 = RNDZ, since b or b+c round to + a value >= 2^h, and b-c rounds to a value < 2^h. + We also surely cannot round when (rnd1,rnd2) = (RNDN,RNDA), since + b-c rounds to a value <= 2^h, and b+c > 2^h rounds to a value > 2^h. + It thus remains: + (rnd1,rnd2) = (RNDA,RNDA), (RNDA,RNDN) and (RNDN,RNDN). + For (RNDA,RNDA) we can round only when b-c and b round to 2^h, which + implies b = 2^h and err > prec (which is true in that case): + a necessary condition is that cc = 0. + For (RNDA,RNDN) we can round only when b-c and b round to 2^h, which + implies b-c >= 2^h - 1/4*ulp(2^h), and b <= 2^h + 1/2*ulp(2^h); + since ulp(2^h) = ulp(b), this implies c <= 3/4*ulp(b), thus + err > prec. + For (RNDN,RNDN) we can round only when b-c and b+c round to 2^h, + which implies b-c >= 2^h - 1/4*ulp(2^h), and + b+c <= 2^h + 1/2*ulp(2^h); + since ulp(2^h) = ulp(b), this implies 2*c <= 3/4*ulp(b), thus + err > prec+1. */ - if (((k1 == 0 && tmp[bn - 1] < MPFR_LIMB_HIGHBIT) || - (k1 != 0 && cc2 != 0 && bp[bn + tn] == MPFR_LIMB_HIGHBIT)) && - (rnd2 != MPFR_RNDN || err0 == prec0 + 1)) + if (tn == k1 && tmp_hi < MPFR_LIMB_HIGHBIT) /* exponent decrease */ + { + if (rnd2 == MPFR_RNDZ || (rnd1 == MPFR_RNDN && rnd2 == MPFR_RNDA) || + cc != 0 /* b or b+c does not round to 2^h */) + { + res = 0; + goto end; + } + /* in that case since the most significant bit of tmp is 0, we + should consider one more bit; res = 0 when b-c does not round + to 2^h. */ + res = mpfr_round_raw2 (tmp, bn, neg, rnd2, prec2 + 1) != 0; + goto end; + } + if (err == prec + (rnd1 == MPFR_RNDN)) { - MPFR_TMP_FREE(marker); - return 0; + /* No exponent increase nor decrease, thus we have |U-L| = ulp(b). + For rnd2 = RNDZ or RNDA, either [L,U] contains one representable + number in the target precision, and then L and U round + differently; or both L and U are representable: they round + differently too; thus in all cases we cannot round. + For rnd2 = RNDN, the only case where we can round is when the + middle of [L,U] (i.e. b) is representable, and ends with a 0. */ + res = (rnd2 == MPFR_RNDN && (((bp[bn - 1] >> s1) & 1) == 0) && + mpfr_round_raw2 (bp, bn, neg, MPFR_RNDZ, prec2) == + mpfr_round_raw2 (bp, bn, neg, MPFR_RNDA, prec2)); + goto end; } break; default: - /* Round away */ + /* rnd1 = Round away */ + MPFR_ASSERTD (rnd1 == MPFR_RNDA); cc = (bp[bn - 1] >> s1) & 1; - cc ^= mpfr_round_raw2 (bp, bn, neg, rnd2, prec); + /* the mpfr_round_raw2() call below returns whether one should add 1 or + not for rounding */ + cc ^= mpfr_round_raw2 (bp, bn, neg, rnd2, prec2); /* cc is the new value of bit s1 in bp[bn-1]+eps after rounding 'rnd2' */ goto subtract_eps; } cc2 = (tmp[bn - 1] >> s1) & 1; - cc2 ^= mpfr_round_raw2 (tmp, bn, neg, rnd2, prec); + res = cc == (cc2 ^ mpfr_round_raw2 (tmp, bn, neg, rnd2, prec2)); + end: MPFR_TMP_FREE(marker); - return cc == cc2; + return res; } diff -Nru mpfr4-3.1.4/src/round_raw_generic.c mpfr4-4.0.2/src/round_raw_generic.c --- mpfr4-3.1.4/src/round_raw_generic.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/round_raw_generic.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_round_raw_generic -- Generic rounding function -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef flag @@ -48,6 +48,10 @@ * to 1. In this case, the even rounding is done away from 0, which is * a natural generalization. Indeed, a number with 1-bit precision can * be seen as a subnormal number with more precision. + * + * MPFR_RNDNA is now supported, but needs to be tested [TODO] and is + * still not part of the API. In particular, the MPFR_RNDNA value (-1) + * may change in the future without notice. */ int @@ -64,7 +68,7 @@ { mp_size_t xsize, nw; mp_limb_t himask, lomask, sb; - int rw; + int rw, new_use_inexp; #if flag == 0 int carry; #endif @@ -76,9 +80,22 @@ MPFR_ASSERTD(inexp != ((int*) 0)); MPFR_ASSERTD(neg == 0 || neg == 1); - if (flag && !use_inexp && - (xprec <= yprec || MPFR_IS_LIKE_RNDZ (rnd_mode, neg))) - return 0; + if (rnd_mode == MPFR_RNDF) + { + if (use_inexp) + *inexp = 0; /* make sure it has a valid value */ + if (flag) + return 0; + rnd_mode = MPFR_RNDZ; /* faster */ + new_use_inexp = 0; + } + else + { + if (flag && !use_inexp && + (xprec <= yprec || MPFR_IS_LIKE_RNDZ (rnd_mode, neg))) + return 0; + new_use_inexp = use_inexp; + } xsize = MPFR_PREC2LIMBS (xprec); nw = yprec / GMP_NUMB_BITS; @@ -86,7 +103,7 @@ if (MPFR_UNLIKELY(xprec <= yprec)) { /* No rounding is necessary. */ - /* if yp=xp, maybe an overlap: MPN_COPY_DECR is ok when src <= dst */ + /* if yp=xp, maybe an overlap: mpn_copyd is OK when src <= dst */ if (MPFR_LIKELY(rw)) nw++; MPFR_ASSERTD(nw >= 1); @@ -94,13 +111,13 @@ if (use_inexp) *inexp = 0; #if flag == 0 - MPN_COPY_DECR(yp + (nw - xsize), xp, xsize); + mpn_copyd (yp + (nw - xsize), xp, xsize); MPN_ZERO(yp, nw - xsize); #endif return 0; } - if (use_inexp || !MPFR_IS_LIKE_RNDZ(rnd_mode, neg)) + if (new_use_inexp || !MPFR_IS_LIKE_RNDZ(rnd_mode, neg)) { mp_size_t k = xsize - nw - 1; @@ -112,26 +129,25 @@ } else { - lomask = ~(mp_limb_t) 0; - himask = ~(mp_limb_t) 0; + lomask = MPFR_LIMB_MAX; + himask = MPFR_LIMB_MAX; } MPFR_ASSERTD(k >= 0); sb = xp[k] & lomask; /* First non-significant bits */ - /* Rounding to nearest ? */ - if (MPFR_LIKELY( rnd_mode == MPFR_RNDN) ) + /* Rounding to nearest? */ + if (rnd_mode == MPFR_RNDN || rnd_mode == MPFR_RNDNA) { /* Rounding to nearest */ mp_limb_t rbmask = MPFR_LIMB_ONE << (GMP_NUMB_BITS - 1 - rw); - if (sb & rbmask) /* rounding bit */ - sb &= ~rbmask; /* it is 1, clear it */ - else - { - /* Rounding bit is 0, behave like rounding to 0 */ - goto rnd_RNDZ; - } + + if ((sb & rbmask) == 0) /* rounding bit = 0 ? */ + goto rnd_RNDZ; /* yes, behave like rounding toward zero */ + /* Rounding to nearest with rounding bit = 1 */ + if (MPFR_UNLIKELY (rnd_mode == MPFR_RNDNA)) + goto away_addone_ulp; /* like rounding away from zero */ + sb &= ~rbmask; /* first bits after the rounding bit */ while (MPFR_UNLIKELY(sb == 0) && k > 0) sb = xp[--k]; - /* rounding to nearest, with rounding bit = 1 */ if (MPFR_UNLIKELY(sb == 0)) /* Even rounding. */ { /* sb == 0 && rnd_mode == MPFR_RNDN */ @@ -140,34 +156,32 @@ { if (use_inexp) *inexp = 2*MPFR_EVEN_INEX*neg-MPFR_EVEN_INEX; - /* ((neg!=0)^(sb!=0)) ? MPFR_EVEN_INEX : -MPFR_EVEN_INEX;*/ - /* Since neg = 0 or 1 and sb=0*/ -#if flag == 1 - return 0 /*sb != 0 && rnd_mode != MPFR_RNDZ */; -#else - MPN_COPY_INCR(yp, xp + xsize - nw, nw); + /* ((neg!=0)^(sb!=0)) ? MPFR_EVEN_INEX : -MPFR_EVEN_INEX */ + /* since neg = 0 or 1 and sb = 0 */ +#if flag == 0 + mpn_copyi (yp, xp + xsize - nw, nw); yp[0] &= himask; - return 0; #endif + return 0; /* sb != 0 && rnd_mode != MPFR_RNDZ */ } else { + away_addone_ulp: /* sb != 0 && rnd_mode == MPFR_RNDN */ if (use_inexp) *inexp = MPFR_EVEN_INEX-2*MPFR_EVEN_INEX*neg; - /*((neg!=0)^(sb!=0))? MPFR_EVEN_INEX : -MPFR_EVEN_INEX; */ - /*Since neg= 0 or 1 and sb != 0 */ + /* ((neg!=0)^(sb!=0)) ? MPFR_EVEN_INEX : -MPFR_EVEN_INEX */ + /* since neg = 0 or 1 and sb != 0 */ goto rnd_RNDN_add_one_ulp; } } - else /* sb != 0 && rnd_mode == MPFR_RNDN*/ + else /* sb != 0 && rnd_mode == MPFR_RNDN */ { if (use_inexp) - /* *inexp = (neg == 0) ? 1 : -1; but since neg = 0 or 1 */ - *inexp = 1-2*neg; + *inexp = 1-2*neg; /* neg == 0 ? 1 : -1 */ rnd_RNDN_add_one_ulp: #if flag == 1 - return 1; /*sb != 0 && rnd_mode != MPFR_RNDZ;*/ + return 1; /* sb != 0 && rnd_mode != MPFR_RNDZ */ #else carry = mpn_add_1 (yp, xp + xsize - nw, nw, rw ? @@ -178,7 +192,7 @@ #endif } } - /* Rounding to Zero ? */ + /* Rounding toward zero? */ else if (MPFR_IS_LIKE_RNDZ(rnd_mode, neg)) { /* rnd_mode == MPFR_RNDZ */ @@ -187,41 +201,36 @@ sb = xp[--k]; if (use_inexp) /* rnd_mode == MPFR_RNDZ and neg = 0 or 1 */ - /* (neg != 0) ^ (rnd_mode != MPFR_RNDZ)) ? 1 : -1);*/ + /* ((neg != 0) ^ (rnd_mode != MPFR_RNDZ)) ? 1 : -1 */ *inexp = MPFR_UNLIKELY(sb == 0) ? 0 : (2*neg-1); -#if flag == 1 - return 0; /*sb != 0 && rnd_mode != MPFR_RNDZ;*/ -#else - MPN_COPY_INCR(yp, xp + xsize - nw, nw); +#if flag == 0 + mpn_copyi (yp, xp + xsize - nw, nw); yp[0] &= himask; - return 0; #endif + return 0; /* sb != 0 && rnd_mode != MPFR_RNDZ */ } else { - /* rnd_mode = Away */ + /* Rounding away from zero */ while (MPFR_UNLIKELY(sb == 0) && k > 0) sb = xp[--k]; if (MPFR_UNLIKELY(sb == 0)) { /* sb = 0 && rnd_mode != MPFR_RNDZ */ if (use_inexp) - /* (neg != 0) ^ (rnd_mode != MPFR_RNDZ)) ? 1 : -1);*/ + /* ((neg != 0) ^ (rnd_mode != MPFR_RNDZ)) ? 1 : -1 */ *inexp = 0; -#if flag == 1 - return 0; -#else - MPN_COPY_INCR(yp, xp + xsize - nw, nw); +#if flag == 0 + mpn_copyi (yp, xp + xsize - nw, nw); yp[0] &= himask; - return 0; #endif + return 0; } else { /* sb != 0 && rnd_mode != MPFR_RNDZ */ if (use_inexp) - /* (neg != 0) ^ (rnd_mode != MPFR_RNDZ)) ? 1 : -1);*/ - *inexp = 1-2*neg; + *inexp = 1-2*neg; /* neg == 0 ? 1 : -1 */ #if flag == 1 return 1; #else @@ -236,21 +245,19 @@ } else { - /* Roundind mode = Zero / No inexact flag */ -#if flag == 1 - return 0 /*sb != 0 && rnd_mode != MPFR_RNDZ*/; -#else + /* Rounding toward zero / no inexact flag */ +#if flag == 0 if (MPFR_LIKELY(rw)) { nw++; himask = ~MPFR_LIMB_MASK (GMP_NUMB_BITS - rw); } else - himask = ~(mp_limb_t) 0; - MPN_COPY_INCR(yp, xp + xsize - nw, nw); + himask = MPFR_LIMB_MAX; + mpn_copyi (yp, xp + xsize - nw, nw); yp[0] &= himask; - return 0; #endif + return 0; } } diff -Nru mpfr4-3.1.4/src/scale2.c mpfr4-4.0.2/src/scale2.c --- mpfr4-3.1.4/src/scale2.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/scale2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_scale2 -- multiply a double float by 2^exp -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include /* for DBL_EPSILON */ @@ -30,9 +30,9 @@ double mpfr_scale2 (double d, int exp) { -#if _GMP_IEEE_FLOATS +#if _MPFR_IEEE_FLOATS { - union ieee_double_extract x; + union mpfr_ieee_double_extract x; if (MPFR_UNLIKELY (d == 1.0)) { @@ -57,7 +57,7 @@ } return x.d; } -#else /* _GMP_IEEE_FLOATS */ +#else /* _MPFR_IEEE_FLOATS */ { double factor; @@ -87,5 +87,5 @@ } return d; } -#endif +#endif /* _MPFR_IEEE_FLOATS */ } diff -Nru mpfr4-3.1.4/src/sec.c mpfr4-4.0.2/src/sec.c --- mpfr4-3.1.4/src/sec.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/sec.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_sec - secant function = 1/cos. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define FUNCTION mpfr_sec diff -Nru mpfr4-3.1.4/src/sech.c mpfr4-4.0.2/src/sech.c --- mpfr4-3.1.4/src/sech.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/sech.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_sech - Hyperbolic secant function = 1/cosh. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* The hyperbolic secant function is defined by sech(x)=1/cosh(x): diff -Nru mpfr4-3.1.4/src/set.c mpfr4-4.0.2/src/set.c --- mpfr4-3.1.4/src/set.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/set.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set -- copy of a floating-point number -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" /* set a to abs(b) * signb: a=b when signb = SIGN(b), a=abs(b) when signb=1 */ -int +MPFR_HOT_FUNCTION_ATTR int mpfr_set4 (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode, int signb) { /* Sign is ALWAYS copied */ @@ -43,7 +43,7 @@ else MPFR_RET (0); } - else if (MPFR_LIKELY (MPFR_PREC (b) == MPFR_PREC (a))) + else if (MPFR_PREC (b) == MPFR_PREC (a)) { /* Same precision and b is not singular: * just copy the mantissa, and set the exponent and the sign @@ -57,8 +57,9 @@ /* Else Round B inside a */ MPFR_RNDRAW (inex, a, MPFR_MANT (b), MPFR_PREC (b), rnd_mode, signb, - if (MPFR_UNLIKELY ( ++MPFR_EXP (a) > __gmpfr_emax)) - return mpfr_overflow (a, rnd_mode, signb) ); + if (MPFR_UNLIKELY (++ MPFR_EXP (a) > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, signb) + ); MPFR_RET (inex); } } @@ -78,3 +79,139 @@ { return mpfr_set4 (a, b, rnd_mode, MPFR_SIGN_POS); } + +/* Round (u, inex) into s with rounding mode rnd_mode, where inex is + the ternary value associated with u, which has been obtained using + the *same* rounding mode rnd_mode. + Assumes PREC(u) = 2*PREC(s). + The generic algorithm is the following: + 1. inex2 = mpfr_set (s, u, rnd_mode); + 2. if (inex2 != 0) return inex2; else return inex; + except in the double-rounding case: in MPFR_RNDN, when u is in the + middle of two consecutive PREC(s)-bit numbers, if inex and inex2 + are both > 0 (resp. both < 0), we correct s to nextbelow(s) (resp. + nextabove(s)), and return the opposite of inex. + Note: this function can be called with rnd_mode == MPFR_RNDF, in + which case, the rounding direction and the returned ternary value + are unspecified. */ +int +mpfr_set_1_2 (mpfr_ptr s, mpfr_srcptr u, mpfr_rnd_t rnd_mode, int inex) +{ + mpfr_prec_t p = MPFR_PREC(s); + mpfr_prec_t sh = GMP_NUMB_BITS - p; + mp_limb_t rb, sb; + mp_limb_t *sp = MPFR_MANT(s); + mp_limb_t *up = MPFR_MANT(u); + mp_limb_t mask; + int inex2; + + if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(u))) + { + mpfr_set (s, u, rnd_mode); + return inex; + } + + MPFR_ASSERTD(MPFR_PREC(u) == 2 * p); + + if (p < GMP_NUMB_BITS) + { + mask = MPFR_LIMB_MASK(sh); + + if (MPFR_PREC(u) <= GMP_NUMB_BITS) + { + mp_limb_t u0 = up[0]; + + /* it suffices to round (u0, inex) */ + rb = u0 & (MPFR_LIMB_ONE << (sh - 1)); + sb = (u0 & mask) ^ rb; + sp[0] = u0 & ~mask; + } + else + { + mp_limb_t u1 = up[1]; + + /* we need to round (u1, u0, inex) */ + mask = MPFR_LIMB_MASK(sh); + rb = u1 & (MPFR_LIMB_ONE << (sh - 1)); + sb = ((u1 & mask) ^ rb) | up[0]; + sp[0] = u1 & ~mask; + } + + inex2 = inex * MPFR_SIGN(u); + MPFR_SIGN(s) = MPFR_SIGN(u); + MPFR_EXP(s) = MPFR_EXP(u); + + /* in case inex2 > 0, the value of u is rounded away, + thus we need to subtract something from (u0, rb, sb): + (a) if sb is not zero, since the subtracted value is < 1, we can leave + sb as it is; + (b) if rb <> 0 and sb = 0: change to rb = 0 and sb = 1 + (c) if rb = sb = 0: change to rb = 1 and sb = 1, and subtract 1 */ + if (inex2 > 0) + { + if (rb && sb == 0) + { + rb = 0; + sb = 1; + } + } + else /* inex2 <= 0 */ + sb |= inex; + + /* now rb, sb are the round and sticky bits, together with the value of + sp[0], except possibly in the case rb = sb = 0 and inex2 > 0 */ + if (rb == 0 && sb == 0) + { + if (inex2 <= 0) + MPFR_RET(0); + else /* inex2 > 0 can only occur for RNDN and RNDA: + RNDN: return sp[0] and inex + RNDA: return sp[0] and inex */ + MPFR_RET(inex); + } + else if (rnd_mode == MPFR_RNDN) + { + if (rb == 0 || (sb == 0 && (sp[0] & (MPFR_LIMB_ONE << sh)) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(s))) + { + truncate: + MPFR_RET(-MPFR_SIGN(s)); + } + else /* round away from zero */ + { + add_one_ulp: + sp[0] += MPFR_LIMB_ONE << sh; + if (MPFR_UNLIKELY(sp[0] == 0)) + { + sp[0] = MPFR_LIMB_HIGHBIT; + if (MPFR_EXP(s) + 1 <= __gmpfr_emax) + MPFR_SET_EXP (s, MPFR_EXP(s) + 1); + else /* overflow */ + return mpfr_overflow (s, rnd_mode, MPFR_SIGN(s)); + } + MPFR_RET(MPFR_SIGN(s)); + } + } + + /* general case PREC(s) >= GMP_NUMB_BITS */ + inex2 = mpfr_set (s, u, rnd_mode); + /* Check the double-rounding case, i.e. with u = middle of two + consecutive PREC(s)-bit numbers, which is equivalent to u being + exactly representable on PREC(s) + 1 bits but not on PREC(s) bits. + Moreover, since PREC(u) = 2*PREC(s), u and s cannot be identical + (as pointers), thus u was not changed. */ + if (rnd_mode == MPFR_RNDN && inex * inex2 > 0 && + mpfr_min_prec (u) == p + 1) + { + if (inex > 0) + mpfr_nextbelow (s); + else + mpfr_nextabove (s); + return -inex; + } + return inex2 != 0 ? inex2 : inex; +} diff -Nru mpfr4-3.1.4/src/set_d64.c mpfr4-4.0.2/src/set_d64.c --- mpfr4-3.1.4/src/set_d64.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/set_d64.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,11 +1,11 @@ -/* mpfr_set_decimal64 -- convert a IEEE 754r decimal64 float to +/* mpfr_set_decimal64 -- convert an IEEE 754-2008 decimal64 float to a multiple precision floating-point number -See http://gcc.gnu.org/ml/gcc/2006-06/msg00691.html, -http://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html, +See https://gcc.gnu.org/ml/gcc/2006-06/msg00691.html, +https://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html, and TR 24732 . -Copyright 2006-2016 Free Software Foundation, Inc. +Copyright 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -22,7 +22,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -102,13 +102,19 @@ 774, 775, 776, 777, 778, 779, 796, 797, 976, 977, 998, 999 }; #endif +#if _MPFR_IEEE_FLOATS /* Convert d to a decimal string (one-to-one correspondence, no rounding). - The string s needs to have at least 23 characters. + The string s needs to have at least 25 characters (with the final '\0'): + * 1 for the sign '-' + * 2 for the leading '0.' + * 16 for the significand + * 5 for the exponent (for example 'E-100') + * 1 for the final '\0' */ static void decimal64_to_string (char *s, _Decimal64 d) { - union ieee_double_extract x; + union mpfr_ieee_double_extract x; union ieee_double_decimal64 y; char *t; unsigned int Gh; /* most 5 significant bits from combination field */ @@ -205,20 +211,221 @@ #endif /* DPD or BID */ exp -= 398; /* unbiased exponent */ - t += sprintf (t, "E%d", exp); + sprintf (t, "E%d", exp); } +#else +/* portable version */ +#ifndef DEC64_MAX +# define DEC64_MAX 9.999999999999999E384dd +#endif + +static void +decimal64_to_string (char *s, _Decimal64 d) +{ + int sign = 0, n; + int exp = 0; + + if (MPFR_UNLIKELY (DOUBLE_ISNAN (d))) /* NaN */ + { + sprintf (s, "NaN"); /* sprintf puts a final '\0' */ + return; + } + else if (MPFR_UNLIKELY (d > DEC64_MAX)) /* +Inf */ + { + sprintf (s, "Inf"); + return; + } + else if (MPFR_UNLIKELY (d < -DEC64_MAX)) /* -Inf */ + { + sprintf (s, "-Inf"); + return; + } + + /* now d is neither NaN nor +Inf nor -Inf */ + + if (d < (_Decimal64) 0.0) + { + sign = 1; + d = -d; + } + else if (d == (_Decimal64) -0.0) + { /* Warning: the comparison d == -0.0 returns true for d = 0.0 too, + copy code from set_d.c here. We first compare to the +0.0 bitstring, + in case +0.0 and -0.0 are represented identically. */ + double dd = (double) d, poszero = +0.0, negzero = DBL_NEG_ZERO; + if (memcmp (&dd, &poszero, sizeof(double)) != 0 && + memcmp (&dd, &negzero, sizeof(double)) == 0) + { + sign = 1; + d = -d; + } + } + + /* now normalize d in [0.1, 1[ */ + if (d >= (_Decimal64) 1.0) + { + _Decimal64 ten16 = (double) 1e16; /* 10^16 is exactly representable + in binary64 */ + _Decimal64 ten32 = ten16 * ten16; + _Decimal64 ten64 = ten32 * ten32; + _Decimal64 ten128 = ten64 * ten64; + _Decimal64 ten256 = ten128 * ten128; + + if (d >= ten256) + { + d /= ten256; + exp += 256; + } + if (d >= ten128) + { + d /= ten128; + exp += 128; + } + if (d >= ten64) + { + d /= ten64; + exp += 64; + } + if (d >= ten32) + { + d /= ten32; + exp += 32; + } + if (d >= (_Decimal64) 10000000000000000.0) + { + d /= (_Decimal64) 10000000000000000.0; + exp += 16; + } + if (d >= (_Decimal64) 100000000.0) + { + d /= (_Decimal64) 100000000.0; + exp += 8; + } + if (d >= (_Decimal64) 10000.0) + { + d /= (_Decimal64) 10000.0; + exp += 4; + } + if (d >= (_Decimal64) 100.0) + { + d /= (_Decimal64) 100.0; + exp += 2; + } + if (d >= (_Decimal64) 10.0) + { + d /= (_Decimal64) 10.0; + exp += 1; + } + if (d >= (_Decimal64) 1.0) + { + d /= (_Decimal64) 10.0; + exp += 1; + } + } + else /* d < 1.0 */ + { + _Decimal64 ten16, ten32, ten64, ten128, ten256; + + ten16 = (double) 1e16; /* 10^16 is exactly representable in binary64 */ + ten16 = (_Decimal64) 1.0 / ten16; /* 10^(-16), exact */ + ten32 = ten16 * ten16; + ten64 = ten32 * ten32; + ten128 = ten64 * ten64; + ten256 = ten128 * ten128; + + if (d < ten256) + { + d /= ten256; + exp -= 256; + } + if (d < ten128) + { + d /= ten128; + exp -= 128; + } + if (d < ten64) + { + d /= ten64; + exp -= 64; + } + if (d < ten32) + { + d /= ten32; + exp -= 32; + } + /* the double constant 0.0000000000000001 is 2028240960365167/2^104, + which should be rounded to 1e-16 in _Decimal64 */ + if (d < (_Decimal64) 0.0000000000000001) + { + d *= (_Decimal64) 10000000000000000.0; + exp -= 16; + } + /* the double constant 0.00000001 is 3022314549036573/2^78, + which should be rounded to 1e-8 in _Decimal64 */ + if (d < (_Decimal64) 0.00000001) + { + d *= (_Decimal64) 100000000.0; + exp -= 8; + } + /* the double constant 0.0001 is 7378697629483821/2^66, + which should be rounded to 1e-4 in _Decimal64 */ + if (d < (_Decimal64) 0.0001) + { + d *= (_Decimal64) 10000.0; + exp -= 4; + } + /* the double constant 0.01 is 5764607523034235/2^59, + which should be rounded to 1e-2 in _Decimal64 */ + if (d < (_Decimal64) 0.01) + { + d *= (_Decimal64) 100.0; + exp -= 2; + } + /* the double constant 0.1 is 3602879701896397/2^55, + which should be rounded to 1e-1 in _Decimal64 */ + if (d < (_Decimal64) 0.1) + { + d *= (_Decimal64) 10.0; + exp -= 1; + } + } + + /* now 0.1 <= d < 1 */ + if (sign == 1) + *s++ = '-'; + *s++ = '0'; + *s++ = '.'; + for (n = 0; n < 16; n++) + { + double e; + int r; + + d *= (_Decimal64) 10.0; + e = (double) d; + r = (int) e; + *s++ = '0' + r; + d -= (_Decimal64) r; + } + MPFR_ASSERTN(d == (_Decimal64) 0.0); + if (exp != 0) + sprintf (s, "E%d", exp); /* adds a final '\0' */ + else + *s = '\0'; +} +#endif /* _MPFR_IEEE_FLOATS */ int mpfr_set_decimal64 (mpfr_ptr r, _Decimal64 d, mpfr_rnd_t rnd_mode) { - char s[23]; /* need 1 character for sign, - 16 characters for mantissa, - 1 character for exponent, + char s[25]; /* need 1 character for sign, + 2 characters for '0.' + 16 characters for significand, + 1 character for exponent 'E', 4 characters for exponent (including sign), 1 character for terminating \0. */ decimal64_to_string (s, d); - return mpfr_set_str (r, s, 10, rnd_mode); + return mpfr_strtofr (r, s, NULL, 10, rnd_mode); } #endif /* MPFR_WANT_DECIMAL_FLOATS */ diff -Nru mpfr4-3.1.4/src/set_d.c mpfr4-4.0.2/src/set_d.c --- mpfr4-3.1.4/src/set_d.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/set_d.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_set_d -- convert a machine double precision float to a multiple precision floating-point number -Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include /* For DOUBLE_ISINF and DOUBLE_ISNAN */ @@ -26,71 +26,83 @@ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" -/* extracts the bits of d in rp[0..n-1] where n=ceil(53/GMP_NUMB_BITS). - Assumes d is neither 0 nor NaN nor Inf. */ -static long -__gmpfr_extract_double (mpfr_limb_ptr rp, double d) - /* e=0 iff GMP_NUMB_BITS=32 and rp has only one limb */ +/* Extracts the bits of |d| in rp[0..n-1] where n=ceil(53/GMP_NUMB_BITS). + Assumes d finite and <> 0. + Returns the corresponding exponent such that |d| = {rp, n} * 2^exp, + with the value of {rp, n} in [1/2, 1). + The int type should be sufficient for exp. +*/ +static int +extract_double (mpfr_limb_ptr rp, double d) { - long exp; + int exp; mp_limb_t manl; #if GMP_NUMB_BITS == 32 mp_limb_t manh; #endif - /* BUGS - 1. Should handle Inf and NaN in IEEE specific code. - 2. Handle Inf and NaN also in default code, to avoid hangs. - 3. Generalize to handle all GMP_NUMB_BITS. - 4. This lits is incomplete and misspelled. - */ + /* FIXME: Generalize to handle all GMP_NUMB_BITS. */ MPFR_ASSERTD(!DOUBLE_ISNAN(d)); MPFR_ASSERTD(!DOUBLE_ISINF(d)); MPFR_ASSERTD(d != 0.0); -#if _GMP_IEEE_FLOATS +#if _MPFR_IEEE_FLOATS { - union ieee_double_extract x; + union mpfr_ieee_double_extract x; x.d = d; exp = x.s.exp; if (exp) { #if GMP_NUMB_BITS >= 64 - manl = ((MPFR_LIMB_ONE << 63) - | ((mp_limb_t) x.s.manh << 43) | ((mp_limb_t) x.s.manl << 11)); + manl = ((MPFR_LIMB_ONE << (GMP_NUMB_BITS - 1)) | + ((mp_limb_t) x.s.manh << (GMP_NUMB_BITS - 21)) | + ((mp_limb_t) x.s.manl << (GMP_NUMB_BITS - 53))); #else + MPFR_STAT_STATIC_ASSERT (GMP_NUMB_BITS == 32); manh = (MPFR_LIMB_ONE << 31) | (x.s.manh << 11) | (x.s.manl >> 21); manl = x.s.manl << 11; #endif + exp -= 1022; } else /* subnormal number */ { + int cnt; + exp = -1021; #if GMP_NUMB_BITS >= 64 - manl = ((mp_limb_t) x.s.manh << 43) | ((mp_limb_t) x.s.manl << 11); + manl = (((mp_limb_t) x.s.manh << (GMP_NUMB_BITS - 21)) | + ((mp_limb_t) x.s.manl << (GMP_NUMB_BITS - 53))); + count_leading_zeros (cnt, manl); #else + MPFR_STAT_STATIC_ASSERT (GMP_NUMB_BITS == 32); manh = (x.s.manh << 11) /* high 21 bits */ | (x.s.manl >> 21); /* middle 11 bits */ manl = x.s.manl << 11; /* low 21 bits */ + if (manh == 0) + { + manh = manl; + manl = 0; + exp -= GMP_NUMB_BITS; + } + count_leading_zeros (cnt, manh); + manh = (manh << cnt) | + (cnt != 0 ? manl >> (GMP_NUMB_BITS - cnt) : 0); #endif + manl <<= cnt; + exp -= cnt; } - - if (exp) - exp -= 1022; - else - exp = -1021; } -#else /* _GMP_IEEE_FLOATS */ +#else /* _MPFR_IEEE_FLOATS */ { /* Unknown (or known to be non-IEEE) double format. */ exp = 0; + d = ABS (d); if (d >= 1.0) { - MPFR_ASSERTN (d * 0.5 != d); while (d >= 32768.0) { d *= (1.0 / 65536.0); @@ -118,22 +130,31 @@ d *= MP_BASE_AS_DOUBLE; #if GMP_NUMB_BITS >= 64 +#ifndef __clang__ manl = d; #else + /* clang produces an invalid exception when d >= 2^63, + see https://bugs.llvm.org//show_bug.cgi?id=17686. + Since this is always the case, here, we use the following patch. */ + MPFR_STAT_STATIC_ASSERT (GMP_NUMB_BITS == 64); + manl = 0x8000000000000000 + (mp_limb_t) (d - 0x8000000000000000); +#endif /* __clang__ */ +#else + MPFR_STAT_STATIC_ASSERT (GMP_NUMB_BITS == 32); manh = (mp_limb_t) d; manl = (mp_limb_t) ((d - manh) * MP_BASE_AS_DOUBLE); #endif } -#endif /* _GMP_IEEE_FLOATS */ +#endif /* _MPFR_IEEE_FLOATS */ -#if GMP_NUMB_BITS >= 64 rp[0] = manl; -#else +#if GMP_NUMB_BITS == 32 rp[1] = manh; - rp[0] = manl; #endif + MPFR_ASSERTD((rp[MPFR_LIMBS_PER_DOUBLE - 1] & MPFR_LIMB_HIGHBIT) != 0); + return exp; } @@ -142,9 +163,7 @@ int mpfr_set_d (mpfr_ptr r, double d, mpfr_rnd_t rnd_mode) { - int signd, inexact; - unsigned int cnt; - mp_size_t i, k; + int inexact; mpfr_t tmp; mp_limb_t tmpmant[MPFR_LIMBS_PER_DOUBLE]; MPFR_SAVE_EXPO_DECL (expo); @@ -156,8 +175,8 @@ } else if (MPFR_UNLIKELY(d == 0)) { -#if _GMP_IEEE_FLOATS - union ieee_double_extract x; +#if _MPFR_IEEE_FLOATS + union mpfr_ieee_double_extract x; MPFR_SET_ZERO(r); /* set correct sign */ @@ -166,16 +185,23 @@ MPFR_SET_NEG(r); else MPFR_SET_POS(r); -#else /* _GMP_IEEE_FLOATS */ +#else /* _MPFR_IEEE_FLOATS */ MPFR_SET_ZERO(r); { /* This is to get the sign of zero on non-IEEE hardware - Some systems support +0.0, -0.0 and unsigned zero. - We can't use d==+0.0 since it should be always true, + Some systems support +0.0, -0.0, and unsigned zero. + Some other systems may just have an unsigned zero. + We can't use d == +0.0 since it should be always true, so we check that the memory representation of d is the - same than +0.0. etc */ - /* FIXME: consider the case where +0.0 or -0.0 may have several - representations. */ + same than +0.0, etc. + Note: r is set to -0 only if d is detected as a negative zero + *and*, for the double type, -0 has a different representation + from +0. If -0.0 has several representations, the code below + may not work as expected, but this is hardly fixable in a + portable way (without depending on a math library) and only + the sign could be incorrect. Such systems should be taken + into account on a case-by-case basis. If the code is changed + here, set_d64.c code should be updated too. */ double poszero = +0.0, negzero = DBL_NEG_ZERO; if (memcmp(&d, &poszero, sizeof(double)) == 0) MPFR_SET_POS(r); @@ -184,7 +210,7 @@ else MPFR_SET_POS(r); } -#endif +#endif /* _MPFR_IEEE_FLOATS */ return 0; /* 0 is exact */ } else if (MPFR_UNLIKELY(DOUBLE_ISINF(d))) @@ -207,45 +233,12 @@ MPFR_MANT(tmp) = tmpmant; MPFR_PREC(tmp) = IEEE_DBL_MANT_DIG; - signd = (d < 0) ? MPFR_SIGN_NEG : MPFR_SIGN_POS; - d = ABS (d); - - /* don't use MPFR_SET_EXP here since the exponent may be out of range */ - MPFR_EXP(tmp) = __gmpfr_extract_double (tmpmant, d); - -#ifdef MPFR_WANT_ASSERT - /* Failed assertion if the stored value is 0 (e.g., if the exponent range - has been reduced at the wrong moment and an underflow to 0 occurred). - Probably a bug in the C implementation if this happens. */ - i = 0; - while (tmpmant[i] == 0) - { - i++; - MPFR_ASSERTN(i < MPFR_LIMBS_PER_DOUBLE); - } -#endif - - /* determine the index i-1 of the most significant non-zero limb - and the number k of zero high limbs */ - i = MPFR_LIMBS_PER_DOUBLE; - MPN_NORMALIZE_NOT_ZERO(tmpmant, i); - k = MPFR_LIMBS_PER_DOUBLE - i; - - count_leading_zeros (cnt, tmpmant[i - 1]); - - if (MPFR_LIKELY(cnt != 0)) - mpn_lshift (tmpmant + k, tmpmant, i, cnt); - else if (k != 0) - MPN_COPY (tmpmant + k, tmpmant, i); - - if (MPFR_UNLIKELY(k != 0)) - MPN_ZERO (tmpmant, k); - /* don't use MPFR_SET_EXP here since the exponent may be out of range */ - MPFR_EXP(tmp) -= (mpfr_exp_t) (cnt + k * GMP_NUMB_BITS); + MPFR_EXP(tmp) = extract_double (tmpmant, d); /* tmp is exact since PREC(tmp)=53 */ - inexact = mpfr_set4 (r, tmp, rnd_mode, signd); + inexact = mpfr_set4 (r, tmp, rnd_mode, + (d < 0) ? MPFR_SIGN_NEG : MPFR_SIGN_POS); MPFR_SAVE_EXPO_FREE (expo); return mpfr_check_range (r, inexact, rnd_mode); diff -Nru mpfr4-3.1.4/src/set_dfl_prec.c mpfr4-4.0.2/src/set_dfl_prec.c --- mpfr4-3.1.4/src/set_dfl_prec.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/set_dfl_prec.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_default_prec, mpfr_get_default_prec -- set/get default precision -Copyright 1999-2001, 2004-2016 Free Software Foundation, Inc. +Copyright 1999-2001, 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,26 +17,19 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" /* default is IEEE double precision, i.e. 53 bits */ -MPFR_THREAD_ATTR mpfr_prec_t __gmpfr_default_fp_bit_precision \ - = IEEE_DBL_MANT_DIG; - -#ifdef MPFR_WIN_THREAD_SAFE_DLL -mpfr_prec_t * __gmpfr_default_fp_bit_precision_f() -{ - return &__gmpfr_default_fp_bit_precision; -} -#endif +MPFR_THREAD_VAR (mpfr_prec_t, __gmpfr_default_fp_bit_precision, + IEEE_DBL_MANT_DIG) void mpfr_set_default_prec (mpfr_prec_t prec) { - MPFR_ASSERTN (prec >= MPFR_PREC_MIN && prec <= MPFR_PREC_MAX); + MPFR_ASSERTN (MPFR_PREC_COND (prec)); __gmpfr_default_fp_bit_precision = prec; } diff -Nru mpfr4-3.1.4/src/set_exp.c mpfr4-4.0.2/src/set_exp.c --- mpfr4-3.1.4/src/set_exp.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/set_exp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_exp - set the exponent of a floating-point number -Copyright 2002-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2002-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -25,7 +25,9 @@ int mpfr_set_exp (mpfr_ptr x, mpfr_exp_t exponent) { - if (exponent >= __gmpfr_emin && exponent <= __gmpfr_emax) + if (MPFR_LIKELY (MPFR_IS_PURE_FP (x) && + exponent >= __gmpfr_emin && + exponent <= __gmpfr_emax)) { MPFR_EXP(x) = exponent; /* do not use MPFR_SET_EXP of course... */ return 0; diff -Nru mpfr4-3.1.4/src/set_f.c mpfr4-4.0.2/src/set_f.c --- mpfr4-3.1.4/src/set_f.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/set_f.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_f -- set a MPFR number from a GNU MPF number -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,21 +17,24 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H +#define MPFR_NEED_MPF_INTERNALS #include "mpfr-impl.h" +#ifndef MPFR_USE_MINI_GMP int mpfr_set_f (mpfr_ptr y, mpf_srcptr x, mpfr_rnd_t rnd_mode) { mp_limb_t *my, *mx, *tmp; - unsigned long cnt, sx, sy; + int cnt; + mp_size_t sx, sy; int inexact, carry = 0; MPFR_TMP_DECL(marker); - sx = ABS(SIZ(x)); /* number of limbs of the mantissa of x */ + sx = ABSIZ(x); /* number of limbs of the mantissa of x */ if (sx == 0) /* x is zero */ { @@ -51,7 +54,7 @@ if (sy <= sx) /* we may have to round even when sy = sx */ { - unsigned long xprec = sx * GMP_NUMB_BITS; + mpfr_prec_t xprec = (mpfr_prec_t) sx * GMP_NUMB_BITS; MPFR_TMP_MARK(marker); tmp = MPFR_TMP_LIMBS_ALLOC (sx); @@ -92,8 +95,9 @@ else { /* Do not use MPFR_SET_EXP as the exponent may be out of range. */ - MPFR_EXP (y) = EXP (x) * GMP_NUMB_BITS - (mpfr_exp_t) cnt + carry; + MPFR_EXP (y) = EXP (x) * GMP_NUMB_BITS - cnt + carry; } return mpfr_check_range (y, inexact, rnd_mode); } +#endif diff -Nru mpfr4-3.1.4/src/set_float128.c mpfr4-4.0.2/src/set_float128.c --- mpfr4-3.1.4/src/set_float128.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/set_float128.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,139 @@ +/* mpfr_set_float128 -- convert a machine __float128 number to + a multiple precision floating-point number + +Copyright 2012-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include /* for DBL_MAX */ + +#define MPFR_NEED_LONGLONG_H +#include "mpfr-impl.h" + +#ifdef MPFR_WANT_FLOAT128 + +/* The q suffix is a GNU C extension, but so is __float128. */ +#define MPFR_FLOAT128_MAX 0x1.ffffffffffffffffffffffffffffp+16383q + +int +mpfr_set_float128 (mpfr_ptr r, __float128 d, mpfr_rnd_t rnd_mode) +{ + mpfr_t t; + mp_limb_t *tp; + int inexact, shift_exp, neg, e, i; + __float128 p[14], q[14]; + MPFR_SAVE_EXPO_DECL (expo); + + /* Check for NaN */ + if (MPFR_UNLIKELY (DOUBLE_ISNAN (d))) + { + MPFR_SET_NAN(r); + MPFR_RET_NAN; + } + + /* Check for INF */ + if (MPFR_UNLIKELY (d > MPFR_FLOAT128_MAX)) + { + MPFR_SET_INF (r); + MPFR_SET_POS (r); + return 0; + } + else if (MPFR_UNLIKELY (d < -MPFR_FLOAT128_MAX)) + { + MPFR_SET_INF (r); + MPFR_SET_NEG (r); + return 0; + } + /* Check for ZERO */ + else if (MPFR_UNLIKELY (d == (__float128) 0.0)) + return mpfr_set_d (r, (double) d, rnd_mode); + + shift_exp = 0; /* invariant: remainder to deal with is d*2^shift_exp */ + neg = d < 0; + if (d < 0) + d = -d; + + /* Scaling, avoiding (slow) divisions. Should the tables be cached? */ + if (d >= 1.0) + { + p[0] = 2.0; + q[0] = 0.5; + e = 1; + /* p[i] = 2^(2^i), q[i] = 1/p[i] */ + for (i = 0; i < 13 && d >= p[i]; i++) + { + p[i+1] = p[i] * p[i]; + q[i+1] = q[i] * q[i]; + e <<= 1; + } + for (; i >= 0; e >>= 1, i--) + if (d >= p[i]) + { + d *= q[i]; + shift_exp += e; + } + d *= 0.5; + shift_exp++; + } + else if (d < 0.5) + { + p[0] = 2.0; + q[0] = 0.5; + e = 1; + /* p[i] = 2^(2^i), q[i] = 1/p[i] */ + for (i = 0; i < 13 && d < q[i]; i++) + { + p[i+1] = p[i] * p[i]; + q[i+1] = q[i] * q[i]; + e <<= 1; + } + /* The while() may be needed for i = 13 due to subnormals. + This can probably be improved without yielding an underflow. */ + for (; i >= 0; e >>= 1, i--) + while (d < q[i]) + { + d *= p[i]; + shift_exp -= e; + } + } + + MPFR_ASSERTD (d >= 0.5 && d < 1.0); + + mpfr_init2 (t, IEEE_FLOAT128_MANT_DIG); + tp = MPFR_MANT (t); + + MPFR_SAVE_EXPO_MARK (expo); + MPFR_SET_EXP (t, shift_exp); + MPFR_SET_SIGN (t, neg ? MPFR_SIGN_NEG : MPFR_SIGN_POS); + + for (i = MPFR_LAST_LIMB (t); i >= 0; i--) + { + d *= 2 * (__float128) MPFR_LIMB_HIGHBIT; + tp[i] = (mp_limb_t) d; + d -= tp[i]; + } + + inexact = mpfr_set (r, t, rnd_mode); + mpfr_clear (t); + + MPFR_SAVE_EXPO_FREE (expo); + return mpfr_check_range (r, inexact, rnd_mode); +} + +#endif /* MPFR_WANT_FLOAT128 */ diff -Nru mpfr4-3.1.4/src/set_flt.c mpfr4-4.0.2/src/set_flt.c --- mpfr4-3.1.4/src/set_flt.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/set_flt.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_flt -- convert a machine single precision float to mpfr_t -Copyright 2009-2016 Free Software Foundation, Inc. +Copyright 2009-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/set_inf.c mpfr4-4.0.2/src/set_inf.c --- mpfr4-3.1.4/src/set_inf.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/set_inf.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_inf -- set a number to plus or minus infinity. -Copyright 2002, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2002, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/set_ld.c mpfr4-4.0.2/src/set_ld.c --- mpfr4-3.1.4/src/set_ld.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/set_ld.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_set_ld -- convert a machine long double to a multiple precision floating-point number -Copyright 2002-2016 Free Software Foundation, Inc. +Copyright 2002-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,10 +18,10 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include /* needed so that MPFR_LDBL_MANT_DIG is correctly defined */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" @@ -45,7 +45,176 @@ #define MPFR_LDBL_MAX LDBL_MAX #endif -#ifndef HAVE_LDOUBLE_IEEE_EXT_LITTLE +/* To check for +inf, one can use the test x > MPFR_LDBL_MAX, as LDBL_MAX + is the maximum finite number representable in a long double, according + to DR 467; see + http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2092.htm + If this fails on some platform, a test x - x != 0 might be used. */ + +#if defined(HAVE_LDOUBLE_IS_DOUBLE) + +/* the "long double" format is the same as "double" */ +int +mpfr_set_ld (mpfr_ptr r, long double d, mpfr_rnd_t rnd_mode) +{ + return mpfr_set_d (r, (double) d, rnd_mode); +} + +#elif defined(HAVE_LDOUBLE_IEEE_EXT_LITTLE) + +/* IEEE Extended Little Endian Code */ +int +mpfr_set_ld (mpfr_ptr r, long double d, mpfr_rnd_t rnd_mode) +{ + int inexact, i, k, cnt; + mpfr_t tmp; + mp_limb_t tmpmant[MPFR_LIMBS_PER_LONG_DOUBLE]; + mpfr_long_double_t x; + mpfr_exp_t exp; + int signd; + MPFR_SAVE_EXPO_DECL (expo); + + /* Check for NAN */ + if (MPFR_UNLIKELY (DOUBLE_ISNAN (d))) + { + MPFR_SET_NAN (r); + MPFR_RET_NAN; + } + /* Check for INF */ + else if (MPFR_UNLIKELY (d > MPFR_LDBL_MAX)) + { + MPFR_SET_INF (r); + MPFR_SET_POS (r); + return 0; + } + else if (MPFR_UNLIKELY (d < -MPFR_LDBL_MAX)) + { + MPFR_SET_INF (r); + MPFR_SET_NEG (r); + return 0; + } + /* Check for ZERO */ + else if (MPFR_UNLIKELY (d == 0.0)) + { + x.ld = d; + MPFR_SET_ZERO (r); + if (x.s.sign == 1) + MPFR_SET_NEG(r); + else + MPFR_SET_POS(r); + return 0; + } + + /* now d is neither 0, nor NaN nor Inf */ + MPFR_SAVE_EXPO_MARK (expo); + + MPFR_MANT (tmp) = tmpmant; + MPFR_PREC (tmp) = 64; + + /* Extract sign */ + x.ld = d; + signd = MPFR_SIGN_POS; + if (x.ld < 0.0) + { + signd = MPFR_SIGN_NEG; + x.ld = -x.ld; + } + + /* Extract mantissa */ +#if GMP_NUMB_BITS >= 64 + tmpmant[0] = ((mp_limb_t) x.s.manh << 32) | ((mp_limb_t) x.s.manl); +#else + tmpmant[0] = (mp_limb_t) x.s.manl; + tmpmant[1] = (mp_limb_t) x.s.manh; +#endif + + /* Normalize mantissa */ + i = MPFR_LIMBS_PER_LONG_DOUBLE; + MPN_NORMALIZE_NOT_ZERO (tmpmant, i); + k = MPFR_LIMBS_PER_LONG_DOUBLE - i; + count_leading_zeros (cnt, tmpmant[i - 1]); + if (MPFR_UNLIKELY (cnt != 0)) + mpn_lshift (tmpmant + k, tmpmant, i, cnt); + else if (MPFR_UNLIKELY (k != 0)) + MPN_COPY (tmpmant + k, tmpmant, i); + if (MPFR_UNLIKELY (k != 0)) + MPN_ZERO (tmpmant, k); + + /* Set exponent */ + exp = (mpfr_exp_t) ((x.s.exph << 8) + x.s.expl); /* 15-bit unsigned int */ + if (MPFR_UNLIKELY (exp == 0)) + exp -= 0x3FFD; + else + exp -= 0x3FFE; + + MPFR_SET_EXP (tmp, exp - cnt - k * GMP_NUMB_BITS); + + /* tmp is exact */ + inexact = mpfr_set4 (r, tmp, rnd_mode, signd); + + MPFR_SAVE_EXPO_FREE (expo); + return mpfr_check_range (r, inexact, rnd_mode); +} + +#elif defined(HAVE_LDOUBLE_MAYBE_DOUBLE_DOUBLE) + +/* double-double code */ +int +mpfr_set_ld (mpfr_ptr r, long double d, mpfr_rnd_t rnd_mode) +{ + mpfr_t t, u; + int inexact, shift_exp; + double h, l; + MPFR_SAVE_EXPO_DECL (expo); + + /* Check for NAN */ + LONGDOUBLE_NAN_ACTION (d, goto nan); + + /* Check for INF */ + if (d > MPFR_LDBL_MAX) + { + mpfr_set_inf (r, 1); + return 0; + } + else if (d < -MPFR_LDBL_MAX) + { + mpfr_set_inf (r, -1); + return 0; + } + /* Check for ZERO */ + else if (d == 0.0) + return mpfr_set_d (r, (double) d, rnd_mode); + + if (d >= (long double) MPFR_LDBL_MAX || d <= (long double) -MPFR_LDBL_MAX) + h = (d >= (long double) MPFR_LDBL_MAX) ? MPFR_LDBL_MAX : -MPFR_LDBL_MAX; + else + h = (double) d; /* should not overflow */ + l = (double) (d - (long double) h); + + MPFR_SAVE_EXPO_MARK (expo); + + mpfr_init2 (t, IEEE_DBL_MANT_DIG); + mpfr_init2 (u, IEEE_DBL_MANT_DIG); + + inexact = mpfr_set_d (t, h, MPFR_RNDN); + MPFR_ASSERTN(inexact == 0); + inexact = mpfr_set_d (u, l, MPFR_RNDN); + MPFR_ASSERTN(inexact == 0); + inexact = mpfr_add (r, t, u, rnd_mode); + + mpfr_clear (t); + mpfr_clear (u); + + MPFR_SAVE_EXPO_FREE (expo); + inexact = mpfr_check_range (r, inexact, rnd_mode); + return inexact; + + nan: + MPFR_SET_NAN(r); + MPFR_RET_NAN; +} + +#else /* Generic code */ int @@ -191,7 +360,8 @@ break; /* Inexact. This cannot happen unless the C implementation "lies" on the precision or when long doubles are - implemented with FP expansions like under Mac OS X. */ + implemented with FP expansions like double-double on + PowerPC. */ if (MPFR_PREC (t) != MPFR_PREC (r) + 1) { /* We assume that MPFR_PREC (r) < MPFR_PREC_MAX. @@ -233,99 +403,4 @@ MPFR_RET_NAN; } -#else /* IEEE Extended Little Endian Code */ - -int -mpfr_set_ld (mpfr_ptr r, long double d, mpfr_rnd_t rnd_mode) -{ - int inexact, i, k, cnt; - mpfr_t tmp; - mp_limb_t tmpmant[MPFR_LIMBS_PER_LONG_DOUBLE]; - mpfr_long_double_t x; - mpfr_exp_t exp; - int signd; - MPFR_SAVE_EXPO_DECL (expo); - - /* Check for NAN */ - if (MPFR_UNLIKELY (d != d)) - { - MPFR_SET_NAN (r); - MPFR_RET_NAN; - } - /* Check for INF */ - else if (MPFR_UNLIKELY (d > MPFR_LDBL_MAX)) - { - MPFR_SET_INF (r); - MPFR_SET_POS (r); - return 0; - } - else if (MPFR_UNLIKELY (d < -MPFR_LDBL_MAX)) - { - MPFR_SET_INF (r); - MPFR_SET_NEG (r); - return 0; - } - /* Check for ZERO */ - else if (MPFR_UNLIKELY (d == 0.0)) - { - x.ld = d; - MPFR_SET_ZERO (r); - if (x.s.sign == 1) - MPFR_SET_NEG(r); - else - MPFR_SET_POS(r); - return 0; - } - - /* now d is neither 0, nor NaN nor Inf */ - MPFR_SAVE_EXPO_MARK (expo); - - MPFR_MANT (tmp) = tmpmant; - MPFR_PREC (tmp) = 64; - - /* Extract sign */ - x.ld = d; - signd = MPFR_SIGN_POS; - if (x.ld < 0.0) - { - signd = MPFR_SIGN_NEG; - x.ld = -x.ld; - } - - /* Extract mantissa */ -#if GMP_NUMB_BITS >= 64 - tmpmant[0] = ((mp_limb_t) x.s.manh << 32) | ((mp_limb_t) x.s.manl); -#else - tmpmant[0] = (mp_limb_t) x.s.manl; - tmpmant[1] = (mp_limb_t) x.s.manh; -#endif - - /* Normalize mantissa */ - i = MPFR_LIMBS_PER_LONG_DOUBLE; - MPN_NORMALIZE_NOT_ZERO (tmpmant, i); - k = MPFR_LIMBS_PER_LONG_DOUBLE - i; - count_leading_zeros (cnt, tmpmant[i - 1]); - if (MPFR_LIKELY (cnt != 0)) - mpn_lshift (tmpmant + k, tmpmant, i, cnt); - else if (k != 0) - MPN_COPY (tmpmant + k, tmpmant, i); - if (MPFR_UNLIKELY (k != 0)) - MPN_ZERO (tmpmant, k); - - /* Set exponent */ - exp = (mpfr_exp_t) ((x.s.exph << 8) + x.s.expl); /* 15-bit unsigned int */ - if (MPFR_UNLIKELY (exp == 0)) - exp -= 0x3FFD; - else - exp -= 0x3FFE; - - MPFR_SET_EXP (tmp, exp - cnt - k * GMP_NUMB_BITS); - - /* tmp is exact */ - inexact = mpfr_set4 (r, tmp, rnd_mode, signd); - - MPFR_SAVE_EXPO_FREE (expo); - return mpfr_check_range (r, inexact, rnd_mode); -} - #endif diff -Nru mpfr4-3.1.4/src/setmax.c mpfr4-4.0.2/src/setmax.c --- mpfr4-3.1.4/src/setmax.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/setmax.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_setmax -- maximum representable floating-point number (raw version) -Copyright 2002-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2002-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -35,7 +35,7 @@ xn = MPFR_LIMB_SIZE (x); sh = (mpfr_prec_t) xn * GMP_NUMB_BITS - MPFR_PREC(x); xp = MPFR_MANT(x); - xp[0] = MP_LIMB_T_MAX << sh; + xp[0] = MPFR_LIMB_MAX << sh; for (i = 1; i < xn; i++) - xp[i] = MP_LIMB_T_MAX; + xp[i] = MPFR_LIMB_MAX; } diff -Nru mpfr4-3.1.4/src/setmin.c mpfr4-4.0.2/src/setmin.c --- mpfr4-3.1.4/src/setmin.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/setmin.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_setmin -- minimum representable floating-point number (raw version) -Copyright 2002-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2002-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/set_nan.c mpfr4-4.0.2/src/set_nan.c --- mpfr4-3.1.4/src/set_nan.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/set_nan.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_nan -- set a number to NaN. -Copyright 2002, 2006-2016 Free Software Foundation, Inc. +Copyright 2002, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff -Nru mpfr4-3.1.4/src/set_prc_raw.c mpfr4-4.0.2/src/set_prc_raw.c --- mpfr4-3.1.4/src/set_prc_raw.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/set_prc_raw.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_prec_raw -- reset the precision of a floating-point number -Copyright 2000-2001, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2000-2001, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -25,7 +25,7 @@ void mpfr_set_prec_raw (mpfr_ptr x, mpfr_prec_t p) { - MPFR_ASSERTN (p >= MPFR_PREC_MIN && p <= MPFR_PREC_MAX); + MPFR_ASSERTN (MPFR_PREC_COND (p)); MPFR_ASSERTN (p <= (mpfr_prec_t) MPFR_GET_ALLOC_SIZE(x) * GMP_NUMB_BITS); MPFR_PREC(x) = p; } diff -Nru mpfr4-3.1.4/src/set_prec.c mpfr4-4.0.2/src/set_prec.c --- mpfr4-3.1.4/src/set_prec.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/set_prec.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_prec -- reset the precision of a floating-point number -Copyright 1999, 2001-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2002, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,19 +17,18 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" -void +MPFR_HOT_FUNCTION_ATTR void mpfr_set_prec (mpfr_ptr x, mpfr_prec_t p) { mp_size_t xsize, xoldsize; - mpfr_limb_ptr tmp; /* first, check if p is correct */ - MPFR_ASSERTN (p >= MPFR_PREC_MIN && p <= MPFR_PREC_MAX); + MPFR_ASSERTN (MPFR_PREC_COND (p)); /* Calculate the new number of limbs */ xsize = MPFR_PREC2LIMBS (p); @@ -38,8 +37,12 @@ xoldsize = MPFR_GET_ALLOC_SIZE (x); if (xsize > xoldsize) { - tmp = (mpfr_limb_ptr) (*__gmp_reallocate_func) - (MPFR_GET_REAL_PTR(x), MPFR_MALLOC_SIZE(xoldsize), MPFR_MALLOC_SIZE(xsize)); + mpfr_size_limb_t *tmp; + + tmp = (mpfr_size_limb_t *) mpfr_reallocate_func + (MPFR_GET_REAL_PTR(x), + MPFR_MALLOC_SIZE(xoldsize), + MPFR_MALLOC_SIZE(xsize)); MPFR_SET_MANT_PTR(x, tmp); MPFR_SET_ALLOC_SIZE(x, xsize); } diff -Nru mpfr4-3.1.4/src/set_q.c mpfr4-4.0.2/src/set_q.c --- mpfr4-3.1.4/src/set_q.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/set_q.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_q -- set a floating-point number from a multiple-precision rational -Copyright 2000-2002, 2004-2016 Free Software Foundation, Inc. +Copyright 2000-2002, 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" +#ifndef MPFR_USE_MINI_GMP /* * Set f to z, choosing the smallest precision for f * so that z = f*(2^BPML)*zs*2^(RetVal) @@ -38,7 +39,7 @@ MPFR_ASSERTD (mpz_sgn (z) != 0); /* Remove useless ending 0 */ - for (p = PTR (z), s = *zs = ABS (SIZ (z)) ; *p == 0; p++, s--) + for (p = PTR (z), s = *zs = ABSIZ (z) ; *p == 0; p++, s--) MPFR_ASSERTD (s >= 0); /* Get working precision */ @@ -131,5 +132,4 @@ mpfr_clear (n); MPFR_RET (inexact); } - - +#endif diff -Nru mpfr4-3.1.4/src/set_rnd.c mpfr4-4.0.2/src/set_rnd.c --- mpfr4-3.1.4/src/set_rnd.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/set_rnd.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +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, 2004-2016 Free Software Foundation, Inc. +Copyright 1999, 2001, 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,20 +18,12 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" -MPFR_THREAD_ATTR mpfr_rnd_t __gmpfr_default_rounding_mode = MPFR_RNDN; - -#ifdef MPFR_WIN_THREAD_SAFE_DLL -mpfr_rnd_t * -__gmpfr_default_rounding_mode_f() -{ - return &__gmpfr_default_rounding_mode; -} -#endif +MPFR_THREAD_VAR (mpfr_rnd_t, __gmpfr_default_rounding_mode, MPFR_RNDN) void mpfr_set_default_rounding_mode (mpfr_rnd_t rnd_mode) diff -Nru mpfr4-3.1.4/src/set_si_2exp.c mpfr4-4.0.2/src/set_si_2exp.c --- mpfr4-3.1.4/src/set_si_2exp.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/set_si_2exp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_set_si_2exp -- set a MPFR number from a machine signed integer with a shift -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -36,7 +36,7 @@ else { mp_size_t xn; - unsigned int cnt, nbits; + int cnt, nbits; mp_limb_t ai, *xp; int inex = 0; diff -Nru mpfr4-3.1.4/src/set_si.c mpfr4-4.0.2/src/set_si.c --- mpfr4-3.1.4/src/set_si.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/set_si.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_si -- set a MPFR number from a machine signed integer -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/setsign.c mpfr4-4.0.2/src/setsign.c --- mpfr4-3.1.4/src/setsign.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/setsign.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_setsign -- Produce a value with the magnitude of x and sign bit s -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/set_sj.c mpfr4-4.0.2/src/set_sj.c --- mpfr4-3.1.4/src/set_sj.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/set_sj.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_sj -- set a MPFR number from a huge machine signed integer -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -# include "config.h" /* for a build within gmp */ +# include "config.h" #endif #include "mpfr-intmax.h" diff -Nru mpfr4-3.1.4/src/set_str.c mpfr4-4.0.2/src/set_str.c --- mpfr4-3.1.4/src/set_str.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/set_str.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_str -- set a floating-point number from a string -Copyright 2000-2016 Free Software Foundation, Inc. +Copyright 2000-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/set_str_raw.c mpfr4-4.0.2/src/set_str_raw.c --- mpfr4-3.1.4/src/set_str_raw.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/set_str_raw.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_str_binary -- set a floating-point number from a binary string -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/set_ui_2exp.c mpfr4-4.0.2/src/set_ui_2exp.c --- mpfr4-3.1.4/src/set_ui_2exp.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/set_ui_2exp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_set_ui_2exp -- set a MPFR number from a machine unsigned integer with a shift -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,18 +18,18 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" -int +MPFR_HOT_FUNCTION_ATTR int mpfr_set_ui_2exp (mpfr_ptr x, unsigned long i, mpfr_exp_t e, mpfr_rnd_t rnd_mode) { MPFR_SET_POS (x); - if (i == 0) + if (MPFR_UNLIKELY (i == 0)) { MPFR_SET_ZERO (x); MPFR_RET (0); @@ -37,7 +37,7 @@ else { mp_size_t xn; - unsigned int cnt, nbits; + int cnt, nbits; mp_limb_t *xp; int inex = 0; diff -Nru mpfr4-3.1.4/src/set_ui.c mpfr4-4.0.2/src/set_ui.c --- mpfr4-3.1.4/src/set_ui.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/set_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_ui -- set a MPFR number from a machine unsigned integer -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/set_uj.c mpfr4-4.0.2/src/set_uj.c --- mpfr4-3.1.4/src/set_uj.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/set_uj.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_uj -- set a MPFR number from a huge machine unsigned integer -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -# include "config.h" /* for a build within gmp */ +# include "config.h" #endif #define MPFR_NEED_LONGLONG_H @@ -30,6 +30,8 @@ #ifdef _MPFR_H_HAVE_INTMAX_T +#define uintmaxpml (sizeof(uintmax_t) / sizeof(mp_limb_t)) + int mpfr_set_uj (mpfr_t x, uintmax_t j, mpfr_rnd_t rnd) { @@ -39,10 +41,10 @@ int mpfr_set_uj_2exp (mpfr_t x, uintmax_t j, intmax_t e, mpfr_rnd_t rnd) { - unsigned int cnt, i; - mp_size_t k, len; + int cnt; + mp_size_t i, k; mp_limb_t limb; - mp_limb_t yp[sizeof(uintmax_t) / sizeof(mp_limb_t)]; + mp_limb_t yp[uintmaxpml]; mpfr_t y; unsigned long uintmax_bit_size = sizeof(uintmax_t) * CHAR_BIT; unsigned long bpml = GMP_NUMB_BITS % uintmax_bit_size; @@ -57,13 +59,20 @@ MPFR_ASSERTN (sizeof(uintmax_t) % sizeof(mp_limb_t) == 0); - /* Create an auxillary var */ + /* Create an auxiliary var */ MPFR_TMP_INIT1 (yp, y, uintmax_bit_size); - k = numberof (yp); - if (k == 1) - limb = yp[0] = j; + /* The compiler will optimize the code by removing the useless branch. */ + k = uintmaxpml; + if (uintmaxpml == 1) + { + limb = j; + count_leading_zeros(cnt, limb); + /* Normalize the most significant limb */ + yp[0] = limb << cnt; + } else { + mp_size_t len; /* Note: either GMP_NUMB_BITS = uintmax_bit_size, then k = 1 the shift j >>= bpml is never done, or GMP_NUMB_BITS < uintmax_bit_size and bpml = GMP_NUMB_BITS. */ @@ -78,23 +87,22 @@ } while (limb == 0); k++; - } - count_leading_zeros(cnt, limb); - len = numberof (yp) - k; + len = numberof (yp) - k; + count_leading_zeros(cnt, limb); - /* Normalize it: len = number of last 0 limb, k number of non-zero limbs */ - if (MPFR_LIKELY(cnt)) - mpn_lshift (yp+len, yp, k, cnt); /* Normalize the High Limb*/ - else if (len != 0) - MPN_COPY_DECR (yp+len, yp, k); /* Must use DECR */ - if (len != 0) - /* Note: when numberof(yp)==1, len is constant and null, so the compiler - can optimize out this code. */ - { - if (len == 1) - yp[0] = (mp_limb_t) 0; - else - MPN_ZERO (yp, len); /* Zeroing the last limbs */ + /* Normalize it: len = number of last zero limbs, + k = number of previous limbs */ + if (MPFR_LIKELY (cnt != 0)) + mpn_lshift (yp+len, yp, k, cnt); /* Normalize the high limb */ + else if (len != 0) + mpn_copyd (yp+len, yp, k); /* Must use copyd */ + if (len != 0) + { + if (len == 1) + yp[0] = MPFR_LIMB_ZERO; + else + MPN_ZERO (yp, len); /* Zero the last limbs */ + } } e += k * GMP_NUMB_BITS - cnt; /* Update Expo */ MPFR_ASSERTD (MPFR_LIMB_MSB(yp[numberof (yp) - 1]) != 0); diff -Nru mpfr4-3.1.4/src/set_z.c mpfr4-4.0.2/src/set_z.c --- mpfr4-3.1.4/src/set_z.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/set_z.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_z -- set a floating-point number from a multiple-precision integer -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/set_zero.c mpfr4-4.0.2/src/set_zero.c --- mpfr4-3.1.4/src/set_zero.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/set_zero.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_zero -- set a number to plus or minus zero. -Copyright 2009-2016 Free Software Foundation, Inc. +Copyright 2009-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/set_z_exp.c mpfr4-4.0.2/src/set_z_exp.c --- mpfr4-3.1.4/src/set_z_exp.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/set_z_exp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_set_z_2exp -- set a floating-point number from a multiple-precision integer and an exponent -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -42,7 +42,7 @@ } MPFR_ASSERTD (sign_z == MPFR_SIGN_POS || sign_z == MPFR_SIGN_NEG); - zn = ABS(SIZ(z)); /* limb size of z */ + zn = ABSIZ(z); /* limb size of z */ /* compute en = floor(e/GMP_NUMB_BITS) */ en = (e >= 0) ? e / GMP_NUMB_BITS : (e + 1) / GMP_NUMB_BITS - 1; MPFR_ASSERTD (zn >= 1); @@ -81,7 +81,7 @@ if (MPFR_LIKELY (k != 0)) { mpn_lshift (fp, &zp[dif], fn, k); - if (MPFR_LIKELY (dif > 0)) + if (MPFR_UNLIKELY (dif > 0)) fp[0] |= zp[dif - 1] >> (GMP_NUMB_BITS - k); } else @@ -101,7 +101,7 @@ else /* sh == 0 */ { mp_limb_t mask = MPFR_LIMB_ONE << (GMP_NUMB_BITS - 1 - k); - if (MPFR_LIKELY (dif > 0)) + if (MPFR_UNLIKELY (dif > 0)) { rb = zp[--dif] & mask; sb = zp[dif] & (mask-1); @@ -111,7 +111,7 @@ k = 0; ulp = MPFR_LIMB_ONE; } - if (MPFR_UNLIKELY (sb == 0) && MPFR_LIKELY (dif > 0)) + if (MPFR_UNLIKELY (sb == 0 && dif > 0)) { sb = zp[--dif]; if (MPFR_LIKELY (k != 0)) @@ -140,7 +140,7 @@ } trunc: - inex = MPFR_LIKELY ((sb | rb) != 0) ? -1 : 0; + inex = - ((sb | rb) != 0); goto end; addoneulp: diff -Nru mpfr4-3.1.4/src/sgn.c mpfr4-4.0.2/src/sgn.c --- mpfr4-3.1.4/src/sgn.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/sgn.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_sgn -- Sign of a floating point number. -Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2003-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -31,7 +31,7 @@ return 0; if (MPFR_UNLIKELY (MPFR_IS_NAN (a))) { - MPFR_SET_ERANGE (); + MPFR_SET_ERANGEFLAG (); return 0; } /* Remains infinity, handled by the return below. */ diff -Nru mpfr4-3.1.4/src/signbit.c mpfr4-4.0.2/src/signbit.c --- mpfr4-3.1.4/src/signbit.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/signbit.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_signbit -- Signbit of a MPFR number -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -26,5 +26,5 @@ int mpfr_signbit (mpfr_srcptr x) { - return MPFR_SIGN (x) < 0; + return MPFR_IS_NEG (x); } diff -Nru mpfr4-3.1.4/src/sin.c mpfr4-4.0.2/src/sin.c --- mpfr4-3.1.4/src/sin.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/sin.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_sin -- sine of a floating-point number -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -38,7 +38,7 @@ { mpfr_t c, xr; mpfr_srcptr xx; - mpfr_exp_t expx, err; + mpfr_exp_t expx, err1, err; mpfr_prec_t precy, m; int inexact, sign, reduce; MPFR_ZIV_DECL (loop); @@ -55,7 +55,6 @@ { MPFR_SET_NAN (y); MPFR_RET_NAN; - } else /* x is zero */ { @@ -66,9 +65,11 @@ } } + expx = MPFR_GET_EXP (x); + err1 = -2 * expx; + /* sin(x) = x - x^3/6 + ... so the error is < 2^(3*EXP(x)-2) */ - MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, x, -2 * MPFR_GET_EXP (x), 2, 0, - rnd_mode, {}); + MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, x, err1, 2, 0, rnd_mode, {}); MPFR_SAVE_EXPO_MARK (expo); @@ -81,8 +82,20 @@ goto end; } - m = precy + MPFR_INT_CEIL_LOG2 (precy) + 13; - expx = MPFR_GET_EXP (x); + m = precy + MPFR_INT_CEIL_LOG2 (precy) + 7; + + /* since we compute sin(x) as sqrt(1-cos(x)^2), and for x small we have + cos(x)^2 ~ 1 - x^2, when subtracting cos(x)^2 from 1 we will lose + about -2*expx bits if expx < 0 */ + if (expx < 0) + { + /* The following assertion includes a check for integer overflow. + At this point, precy < MPFR_SINCOS_THRESHOLD, so that both m and + err1 should be small enough. But the assertion makes the code + safer (a smart compiler might be able to remove it). */ + MPFR_ASSERTN (err1 <= MPFR_PREC_MAX - m); + m += err1; + } mpfr_init (c); mpfr_init (xr); @@ -113,7 +126,7 @@ mpfr_div_2ui (c, c, 1, MPFR_RNDN); /* Since c approximates Pi with an error <= 2^(2-expx-m) <= 2^(-m), it suffices to check that c - |xr| >= 2^(2-m). */ - if (MPFR_SIGN (xr) > 0) + if (MPFR_IS_POS (xr)) mpfr_sub (c, c, xr, MPFR_RNDZ); else mpfr_add (c, c, xr, MPFR_RNDZ); @@ -135,9 +148,8 @@ sign = MPFR_SIGN(xx); /* now that the argument is reduced, precision m is enough */ mpfr_set_prec (c, m); - mpfr_cos (c, xx, MPFR_RNDZ); /* can't be exact */ - mpfr_nexttoinf (c); /* now c = cos(x) rounded away */ - mpfr_mul (c, c, c, MPFR_RNDU); /* away */ + mpfr_cos (c, xx, MPFR_RNDA); /* c = cos(x) rounded away */ + mpfr_mul (c, c, c, MPFR_RNDU); /* away */ mpfr_ui_sub (c, 1, c, MPFR_RNDZ); mpfr_sqrt (c, c, MPFR_RNDZ); if (MPFR_IS_NEG_SIGN(sign)) diff -Nru mpfr4-3.1.4/src/sin_cos.c mpfr4-4.0.2/src/sin_cos.c --- mpfr4-3.1.4/src/sin_cos.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/sin_cos.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_sin_cos -- sine and cosine of a floating-point number -Copyright 2002-2016 Free Software Foundation, Inc. +Copyright 2002-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -147,7 +147,7 @@ mpfr_mul_2ui (c, c, 1, MPFR_RNDN); mpfr_remainder (xr, x, c, MPFR_RNDN); mpfr_div_2ui (c, c, 1, MPFR_RNDN); - if (MPFR_SIGN (xr) > 0) + if (MPFR_IS_POS (xr)) mpfr_sub (c, c, xr, MPFR_RNDZ); else mpfr_add (c, c, xr, MPFR_RNDZ); @@ -174,11 +174,10 @@ err = m; else err = MPFR_GET_EXP (c) + (mpfr_exp_t) (m - 3); - if (!mpfr_can_round (c, err, MPFR_RNDN, MPFR_RNDZ, - MPFR_PREC (z) + (rnd_mode == MPFR_RNDN))) + if (!MPFR_CAN_ROUND (c, err, MPFR_PREC (z), rnd_mode)) goto next_step; - /* we can't set z now, because in case z = x, and the mpfr_can_round() + /* we can't set z now, because in case z = x, and the MPFR_CAN_ROUND() call below fails, we will have clobbered the input */ mpfr_set_prec (xr, MPFR_PREC(c)); mpfr_swap (xr, c); /* save the approximation of the cosine in xr */ @@ -197,8 +196,7 @@ /* the absolute error on c is at most 2^(err-m), which we must put in the form 2^(EXP(c)-err). */ err = MPFR_GET_EXP (c) + (mpfr_exp_t) m - err; - if (mpfr_can_round (c, err, MPFR_RNDN, MPFR_RNDZ, - MPFR_PREC (y) + (rnd_mode == MPFR_RNDN))) + if (MPFR_CAN_ROUND (c, err, MPFR_PREC (y), rnd_mode)) break; /* check for huge cancellation */ if (err < (mpfr_exp_t) MPFR_PREC (y)) @@ -236,8 +234,9 @@ static mpfr_prec_t reduce (mpz_t Q, mpz_srcptr R, mpfr_prec_t prec) { - mpfr_prec_t l = mpz_sizeinbase (R, 2); + mpfr_prec_t l; + MPFR_MPZ_SIZEINBASE2(l, R); l = (l > prec) ? l - prec : 0; mpz_fdiv_q_2exp (Q, R, l); return l; @@ -249,10 +248,13 @@ static unsigned long reduce2 (mpz_t S, mpz_t C, mpfr_prec_t prec) { - unsigned long ls = mpz_sizeinbase (S, 2); - unsigned long lc = mpz_sizeinbase (C, 2); + unsigned long ls; + unsigned long lc; unsigned long l; + MPFR_MPZ_SIZEINBASE2(ls, S); + MPFR_MPZ_SIZEINBASE2(lc, C); + l = (ls < lc) ? ls : lc; /* smaller length */ l = (l > prec) ? l - prec : 0; mpz_fdiv_q_2exp (S, S, l); @@ -287,9 +289,9 @@ mpz_t T[GMP_NUMB_BITS], Q[GMP_NUMB_BITS], ptoj[GMP_NUMB_BITS], pp; mpfr_prec_t log2_nb_terms[GMP_NUMB_BITS], mult[GMP_NUMB_BITS]; mpfr_prec_t accu[GMP_NUMB_BITS], size_ptoj[GMP_NUMB_BITS]; - mpfr_prec_t prec_i_have, r0 = r; - unsigned long alloc, i, j, k; - mpfr_prec_t l; + mpfr_prec_t prec_i_have, h, r0 = r, pp_s, p_s; + unsigned long i, j, m; + int alloc, k, l; if (MPFR_UNLIKELY(mpz_cmp_ui (p, 0) == 0)) /* sin(x)/x -> 1 */ { @@ -305,10 +307,10 @@ mpz_init (pp); /* normalize p (non-zero here) */ - l = mpz_scan1 (p, 0); - mpz_fdiv_q_2exp (pp, p, l); /* p = pp * 2^l */ + h = mpz_scan1 (p, 0); + mpz_fdiv_q_2exp (pp, p, h); /* p = pp * 2^h */ mpz_mul (pp, pp, pp); - r = 2 * (r - l); /* x^2 = (p/2^r0)^2 = pp / 2^r */ + r = 2 * (r - h); /* x^2 = (p/2^r0)^2 = pp / 2^r */ /* now p is odd */ alloc = 2; @@ -319,14 +321,16 @@ mpz_init (Q[1]); mpz_init (ptoj[1]); mpz_mul (ptoj[1], pp, pp); /* ptoj[1] = pp^2 */ - size_ptoj[1] = mpz_sizeinbase (ptoj[1], 2); + MPFR_MPZ_SIZEINBASE2(size_ptoj[1], ptoj[1]); mpz_mul_2exp (T[0], T[0], r); mpz_sub (T[0], T[0], pp); /* 6*2^r - pp = 6*2^r*(1 - x^2/6) */ log2_nb_terms[0] = 1; /* already take into account the factor x=p/2^r in sin(x) = x * (...) */ - mult[0] = r - mpz_sizeinbase (pp, 2) + r0 - mpz_sizeinbase (p, 2); + MPFR_MPZ_SIZEINBASE2(pp_s, pp); + MPFR_MPZ_SIZEINBASE2(p_s, p); + mult[0] = r - pp_s + r0 - p_s; /* we have x^3 < 1/2^mult[0] */ for (i = 2, k = 0, prec_i_have = mult[0]; prec_i_have < prec; i += 2) @@ -343,20 +347,23 @@ mpz_init (Q[k+1]); mpz_init (ptoj[k+1]); mpz_mul (ptoj[k+1], ptoj[k], ptoj[k]); /* pp^(2^(k+1)) */ - size_ptoj[k+1] = mpz_sizeinbase (ptoj[k+1], 2); + MPFR_MPZ_SIZEINBASE2(size_ptoj[k+1], ptoj[k+1]); } /* for i even, we have Q[k] = (2*i)*(2*i+1), T[k] = 1, then Q[k+1] = (2*i+2)*(2*i+3), T[k+1] = 1, which reduces to T[k] = (2*i+2)*(2*i+3)*2^r-pp, Q[k] = (2*i)*(2*i+1)*(2*i+2)*(2*i+3). */ log2_nb_terms[k] = 1; - mpz_set_ui (Q[k], (2 * i + 2) * (2 * i + 3)); + mpz_set_ui (Q[k], 2 * i + 2); + mpz_mul_ui (Q[k], Q[k], 2 * i + 3); mpz_mul_2exp (T[k], Q[k], r); mpz_sub (T[k], T[k], pp); - mpz_mul_ui (Q[k], Q[k], (2 * i) * (2 * i + 1)); + mpz_mul_ui (Q[k], Q[k], 2 * i); + mpz_mul_ui (Q[k], Q[k], 2 * i + 1); /* the next term of the series is divided by Q[k] and multiplied by pp^2/2^(2r), thus the mult. factor < 1/2^mult[k] */ - mult[k] = mpz_sizeinbase (Q[k], 2) + 2 * r - size_ptoj[1] - 1; + MPFR_MPZ_SIZEINBASE2(mult[k], Q[k]); + mult[k] += 2 * r - size_ptoj[1] - 1; /* the absolute contribution of the next term is 1/2^accu[k] */ accu[k] = (k == 0) ? mult[k] : mult[k] + accu[k-1]; prec_i_have = accu[k]; /* the current term is < 1/2^accu[k] */ @@ -371,7 +378,7 @@ mpz_mul (Q[k-1], Q[k-1], Q[k]); log2_nb_terms[k-1] ++; /* number of terms in S[k-1] is a power of 2 by construction */ - prec_i_have = mpz_sizeinbase (Q[k], 2); + MPFR_MPZ_SIZEINBASE2(prec_i_have, Q[k]); mult[k-1] += prec_i_have + (r << l) - size_ptoj[l] - 1; accu[k-1] = (k == 1) ? mult[k-1] : mult[k-1] + accu[k-2]; prec_i_have = accu[k-1]; @@ -383,46 +390,45 @@ /* accumulate all products in T[0] and Q[0]. Warning: contrary to above, here we do not have log2_nb_terms[k-1] = log2_nb_terms[k]+1. */ - l = 0; /* number of accumulated terms in the right part T[k]/Q[k] */ + h = 0; /* number of accumulated terms in the right part T[k]/Q[k] */ while (k > 0) { - j = log2_nb_terms[k-1]; - mpz_mul (T[k], T[k], ptoj[j]); + mpz_mul (T[k], T[k], ptoj[log2_nb_terms[k-1]]); mpz_mul (T[k-1], T[k-1], Q[k]); - l += 1 << log2_nb_terms[k]; - mpz_mul_2exp (T[k-1], T[k-1], r * l); + h += (mpfr_prec_t) 1 << log2_nb_terms[k]; + mpz_mul_2exp (T[k-1], T[k-1], r * h); mpz_add (T[k-1], T[k-1], T[k]); mpz_mul (Q[k-1], Q[k-1], Q[k]); k--; } - l = r0 + r * (i - 1); /* implicit multiplier 2^r for Q0 */ - /* at this point T[0]/(2^l*Q[0]) is an approximation of sin(x) where the 1st + m = r0 + r * (i - 1); /* implicit multiplier 2^r for Q0 */ + /* at this point T[0]/(2^m*Q[0]) is an approximation of sin(x) where the 1st neglected term has contribution < 1/2^prec, thus since the series has alternate signs, the error is < 1/2^prec */ /* we truncate Q0 to prec bits: the relative error is at most 2^(1-prec), which means that Q0 = Q[0] * (1+theta) with |theta| <= 2^(1-prec) [up to a power of two] */ - l += reduce (Q0, Q[0], prec); - l -= reduce (T[0], T[0], prec); - /* multiply by x = p/2^l */ + m += reduce (Q0, Q[0], prec); + m -= reduce (T[0], T[0], prec); + /* multiply by x = p/2^m */ mpz_mul (S0, T[0], p); - l -= reduce (S0, S0, prec); /* S0 = T[0] * (1 + theta)^2 up to power of 2 */ + m -= reduce (S0, S0, prec); /* S0 = T[0] * (1 + theta)^2 up to power of 2 */ /* sin(X) ~ S0/Q0*(1 + theta)^3 + err with |theta| <= 2^(1-prec) and |err| <= 2^(-prec), thus since |S0/Q0| <= 1: |sin(X) - S0/Q0| <= 4*|theta*S0/Q0| + |err| <= 9*2^(-prec) */ mpz_clear (pp); - for (j = 0; j < alloc; j ++) + for (k = 0; k < alloc; k ++) { - mpz_clear (T[j]); - mpz_clear (Q[j]); - mpz_clear (ptoj[j]); + mpz_clear (T[k]); + mpz_clear (Q[k]); + mpz_clear (ptoj[k]); } /* compute cos(X) from sin(X): sqrt(1-(S/Q)^2) = sqrt(Q^2-S^2)/Q - = sqrt(Q0^2*2^(2l)-S0^2)/Q0. + = sqrt(Q0^2*2^(2m)-S0^2)/Q0. Write S/Q = sin(X) + eps with |eps| <= 9*2^(-prec), then sqrt(Q^2-S^2) = sqrt(Q^2-Q^2*(sin(X)+eps)^2) = sqrt(Q^2*cos(X)^2-Q^2*(2*sin(X)*eps+eps^2)) @@ -436,14 +442,14 @@ = Q*cos(X)*(1+eps3+eps2/(Q*cos(X))) = Q*cos(X)*(1+eps4) with |eps4| <= 9*2^(-prec) since |Q| >= 2^(prec-1) */ - /* we assume that Q0*2^l >= 2^(prec-1) */ - MPFR_ASSERTN(l + mpz_sizeinbase (Q0, 2) >= prec); + /* we assume that Q0*2^m >= 2^(prec-1) */ + MPFR_ASSERTN(m + mpz_sizeinbase (Q0, 2) >= prec); mpz_mul (C0, Q0, Q0); - mpz_mul_2exp (C0, C0, 2 * l); + mpz_mul_2exp (C0, C0, 2 * m); mpz_submul (C0, S0, S0); mpz_sqrt (C0, C0); - return l; + return m; } /* Put in s and c approximations of sin(x) and cos(x) respectively. @@ -497,7 +503,7 @@ { /* y <- trunc(x2 * 2^sh) = trunc(x * 2^(2*sh-1)) */ mpfr_mul_2exp (x2, x2, sh, MPFR_RNDN); /* exact */ - mpfr_get_z (y, x2, MPFR_RNDZ); /* round towards zero: now + mpfr_get_z (y, x2, MPFR_RNDZ); /* round toward zero: now 0 <= x2 < 2^sh, thus 0 <= x2/2^(sh-1) < 2^(1-sh) */ if (mpz_cmp_ui (y, 0) == 0) @@ -571,6 +577,7 @@ mpfr_t x_red, ts, tc; mpfr_prec_t w; mpfr_exp_t err, errs, errc; + MPFR_GROUP_DECL (group); MPFR_ZIV_DECL (loop); MPFR_ASSERTN(s != c); @@ -581,8 +588,8 @@ else w = MPFR_PREC(s) >= MPFR_PREC(c) ? MPFR_PREC(s) : MPFR_PREC(c); w += MPFR_INT_CEIL_LOG2(w) + 9; /* ensures w >= 10 (needed by sincos_aux) */ - mpfr_init2 (ts, w); - mpfr_init2 (tc, w); + + MPFR_GROUP_INIT_2(group, w, ts, tc); MPFR_ZIV_INIT (loop, w); for (;;) @@ -595,11 +602,9 @@ /* if -Pi/4 <= x < 0, use sin(-x)=-sin(x) */ else if (MPFR_IS_NEG(x) && mpfr_cmp_si_2exp (x, -1686629713, -31) >= 0) { - mpfr_init2 (x_red, MPFR_PREC(x)); - mpfr_neg (x_red, x, rnd); /* exact */ + MPFR_ALIAS(x_red, x, MPFR_SIGN_POS, MPFR_GET_EXP(x)); err = sincos_aux (ts, tc, x_red, MPFR_RNDN); - mpfr_neg (ts, ts, MPFR_RNDN); - mpfr_clear (x_red); + MPFR_CHANGE_SIGN(ts); } else /* argument reduction is needed */ { @@ -648,15 +653,13 @@ (c == NULL || MPFR_CAN_ROUND (tc, w - errc, MPFR_PREC(c), rnd))) break; MPFR_ZIV_NEXT (loop, w); - mpfr_set_prec (ts, w); - mpfr_set_prec (tc, w); + MPFR_GROUP_REPREC_2(group, w, ts, tc); } MPFR_ZIV_FREE (loop); inexs = (s == NULL) ? 0 : mpfr_set (s, ts, rnd); inexc = (c == NULL) ? 0 : mpfr_set (c, tc, rnd); - mpfr_clear (ts); - mpfr_clear (tc); + MPFR_GROUP_CLEAR (group); return INEX(inexs,inexc); } diff -Nru mpfr4-3.1.4/src/sinh.c mpfr4-4.0.2/src/sinh.c --- mpfr4-3.1.4/src/sinh.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/sinh.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_sinh -- hyperbolic sine -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -84,7 +84,7 @@ if (MPFR_GET_EXP (x) < 0) Nt -= 2*MPFR_GET_EXP (x); - /* initialise of intermediary variables */ + /* initialize of intermediary variables */ MPFR_GROUP_INIT_2 (group, Nt, t, ti); /* First computation of sinh */ @@ -170,7 +170,7 @@ } } - /* actualisation of the precision */ + /* actualization of the precision */ Nt += err; MPFR_ZIV_NEXT (loop, Nt); MPFR_GROUP_REPREC_2 (group, Nt, t, ti); diff -Nru mpfr4-3.1.4/src/sinh_cosh.c mpfr4-4.0.2/src/sinh_cosh.c --- mpfr4-3.1.4/src/sinh_cosh.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/sinh_cosh.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_sinh_cosh -- hyperbolic sine and cosine -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -95,7 +95,7 @@ /* the optimal number of bits : see algorithms.ps */ N = N + MPFR_INT_CEIL_LOG2 (N) + 4; - /* initialise of intermediary variables */ + /* initialize of intermediary variables */ MPFR_GROUP_INIT_3 (group, N, s, c, ti); /* First computation of sinh_cosh */ @@ -143,7 +143,7 @@ break; } } - /* actualisation of the precision */ + /* actualization of the precision */ N += err; MPFR_ZIV_NEXT (loop, N); MPFR_GROUP_REPREC_3 (group, N, s, c, ti); diff -Nru mpfr4-3.1.4/src/si_op.c mpfr4-4.0.2/src/si_op.c --- mpfr4-3.1.4/src/si_op.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/si_op.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,8 +1,11 @@ /* mpfr_add_si -- add a floating-point number with a machine integer - mpfr_sub_si -- sub a floating-point number with a machine integer - mpfr_si_sub -- sub a machine number with a floating-point number + mpfr_sub_si -- sub a floating-point number with a machine integer + mpfr_si_sub -- sub a machine number with a floating-point number + mpfr_mul_si -- multiply a floating-point number by a machine integer + mpfr_div_si -- divide a floating-point number by a machine integer + mpfr_si_div -- divide a machine number by a floating-point number -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -19,7 +22,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -27,31 +30,131 @@ int mpfr_add_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode) { + int res; + + MPFR_LOG_FUNC + (("x[%Pu]=%.*Rg u=%ld rnd=%d", + mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode), + ("y[%Pu]=%.*Rg inexact=%d", + mpfr_get_prec(y), mpfr_log_prec, y, res)); + if (u >= 0) - return mpfr_add_ui (y, x, u, rnd_mode); + res = mpfr_add_ui (y, x, u, rnd_mode); else - return mpfr_sub_ui (y, x, - (unsigned long) u, rnd_mode); + res = mpfr_sub_ui (y, x, - (unsigned long) u, rnd_mode); + + return res; } int mpfr_sub_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode) { + int res; + + MPFR_LOG_FUNC + (("x[%Pu]=%.*Rg u=%ld rnd=%d", + mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode), + ("y[%Pu]=%.*Rg inexact=%d", + mpfr_get_prec(y), mpfr_log_prec, y, res)); + if (u >= 0) - return mpfr_sub_ui (y, x, u, rnd_mode); + res = mpfr_sub_ui (y, x, u, rnd_mode); else - return mpfr_add_ui (y, x, - (unsigned long) u, rnd_mode); + res = mpfr_add_ui (y, x, - (unsigned long) u, rnd_mode); + + return res; } int mpfr_si_sub (mpfr_ptr y, long int u, mpfr_srcptr x, mpfr_rnd_t rnd_mode) { + int res; + + MPFR_LOG_FUNC + (("x[%Pu]=%.*Rg u=%ld rnd=%d", + mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode), + ("y[%Pu]=%.*Rg inexact=%d", + mpfr_get_prec(y), mpfr_log_prec, y, res)); + if (u >= 0) - return mpfr_ui_sub (y, u, x, rnd_mode); + res = mpfr_ui_sub (y, u, x, rnd_mode); else { - int res = - mpfr_add_ui (y, x, - (unsigned long) u, - MPFR_INVERT_RND (rnd_mode)); + res = - mpfr_add_ui (y, x, - (unsigned long) u, + MPFR_INVERT_RND (rnd_mode)); MPFR_CHANGE_SIGN (y); - return res; } + + return res; +} + +#undef mpfr_mul_si +int +mpfr_mul_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode) +{ + int res; + + MPFR_LOG_FUNC + (("x[%Pu]=%.*Rg u=%ld rnd=%d", + mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode), + ("y[%Pu]=%.*Rg inexact=%d", + mpfr_get_prec(y), mpfr_log_prec, y, res)); + + if (u >= 0) + res = mpfr_mul_ui (y, x, u, rnd_mode); + else + { + res = - mpfr_mul_ui (y, x, - (unsigned long) u, + MPFR_INVERT_RND (rnd_mode)); + MPFR_CHANGE_SIGN (y); + } + + return res; +} + +#undef mpfr_div_si +int +mpfr_div_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode) +{ + int res; + + MPFR_LOG_FUNC + (("x[%Pu]=%.*Rg u=%ld rnd=%d", + mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode), + ("y[%Pu]=%.*Rg inexact=%d", + mpfr_get_prec(y), mpfr_log_prec, y, res)); + + if (u >= 0) + res = mpfr_div_ui (y, x, u, rnd_mode); + else + { + res = - mpfr_div_ui (y, x, - (unsigned long) u, + MPFR_INVERT_RND (rnd_mode)); + MPFR_CHANGE_SIGN (y); + } + + return res; +} + +int +mpfr_si_div (mpfr_ptr y, long int u, mpfr_srcptr x, mpfr_rnd_t rnd_mode) +{ + int res; + + MPFR_LOG_FUNC + (("x[%Pu]=%.*Rg u=%ld rnd=%d", + mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode), + ("y[%Pu]=%.*Rg inexact=%d", + mpfr_get_prec(y), mpfr_log_prec, y, res)); + + if (u >= 0) + res = mpfr_ui_div (y, u, x, rnd_mode); + else + { + res = - mpfr_ui_div (y, - (unsigned long) u, x, + MPFR_INVERT_RND(rnd_mode)); + MPFR_CHANGE_SIGN (y); + } + + return res; } diff -Nru mpfr4-3.1.4/src/sparc64/mparam.h mpfr4-4.0.2/src/sparc64/mparam.h --- mpfr4-3.1.4/src/sparc64/mparam.h 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/sparc64/mparam.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Generated by MPFR's tuneup.c, 2011-07-31, gcc 3.3.5 */ @@ -88,7 +88,7 @@ 791,792,792,792,791,792,792,792,791,792,792,792,791,792,791,791, \ 791,791,791,792,792,791,792,792,791,792,792,792,791,792,792,792, \ 792,791,792,792,791,792,792,856,792,792,792,856,792,791,792,856 \ - + #define MPFR_SQRHIGH_TAB \ -1,0,0,0,0,-1,5,5,7,7,9,7,9,8,9,10, \ 11,10,11,11,13,12,13,13,17,14,16,16,16,16,17,18, \ @@ -154,7 +154,7 @@ 536,536,552,552,536,552,552,520,567,544,552,552,552,568,567,567, \ 568,568,567,567,568,568,535,584,568,512,568,567,512,568,567,568, \ 576,568,567,584,568,600,584,584,600,568,597,592,591,600,599,599 \ - + #define MPFR_DIVHIGH_TAB \ 0,1,2,3,4,5,6,7,6,7,8,9,10,11,12,13, \ 10,10,11,11,13,12,13,13,14,14,15,15,18,17,19,19, \ @@ -220,7 +220,7 @@ 542,542,542,542,544,544,544,560,542,542,575,543,544,544,544,542, \ 544,575,575,544,544,544,544,544,561,561,543,559,544,560,560,560, \ 608,587,573,575,575,608,583,585,560,575,585,575,588,573,608,577 \ - + #define MPFR_MUL_THRESHOLD 13 /* limbs */ #define MPFR_SQR_THRESHOLD 11 /* limbs */ #define MPFR_DIV_THRESHOLD 19 /* limbs */ diff -Nru mpfr4-3.1.4/src/sqr.c mpfr4-4.0.2/src/sqr.c --- mpfr4-3.1.4/src/sqr.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/sqr.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ -/* mpfr_sqr -- Floating square +/* mpfr_sqr -- Floating-point square -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,489 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" +#if !defined(MPFR_GENERIC_ABI) && (GMP_NUMB_BITS == 32 || GMP_NUMB_BITS == 64) + +/* Special code for prec(a) < GMP_NUMB_BITS and prec(b) <= GMP_NUMB_BITS. + Note: this function was copied from mpfr_mul_1 in file mul.c, thus any change + here should be done also in mpfr_mul_1. */ +static int +mpfr_sqr_1 (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode, mpfr_prec_t p) +{ + mp_limb_t a0; + mpfr_limb_ptr ap = MPFR_MANT(a); + mp_limb_t b0 = MPFR_MANT(b)[0]; + mpfr_exp_t ax; + mpfr_prec_t sh = GMP_NUMB_BITS - p; + mp_limb_t rb, sb, mask = MPFR_LIMB_MASK(sh); + + /* When prec(b) <= GMP_NUMB_BITS / 2, we could replace umul_ppmm + by a limb multiplication as follows, but we assume umul_ppmm is as fast + as a limb multiplication on modern processors: + a0 = (b0 >> (GMP_NUMB_BITS / 2)) * (b0 >> (GMP_NUMB_BITS / 2)); + sb = 0; + */ + ax = MPFR_GET_EXP(b) * 2; + umul_ppmm (a0, sb, b0, b0); + if (a0 < MPFR_LIMB_HIGHBIT) + { + ax --; + a0 = (a0 << 1) | (sb >> (GMP_NUMB_BITS - 1)); + sb <<= 1; + } + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (a0 & mask) ^ rb; + ap[0] = a0 & ~mask; + + MPFR_SIGN(a) = MPFR_SIGN_POS; + + /* rounding */ + if (MPFR_UNLIKELY(ax > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN_POS); + + /* Warning: underflow should be checked *after* rounding, thus when rounding + away and when a > 0.111...111*2^(emin-1), or when rounding to nearest and + a >= 0.111...111[1]*2^(emin-1), there is no underflow. */ + if (MPFR_UNLIKELY(ax < __gmpfr_emin)) + { + /* Note: for emin=2*k+1, a >= 0.111...111*2^(emin-1) is not possible, + i.e., a >= (1 - 2^(-p))*2^(2k), since we need a = b^2 with EXP(b)=k, + and the largest such b is (1 - 2^(-p))*2^k satisfies + b^2 < (1 - 2^(-p))*2^(2k). + For emin=2*k, it is only possible for some values of p: it is not + possible for p=53, because the largest significand is 6369051672525772 + but its square has only 52 leading ones. For p=24 it is possible, + with b = 11863283, whose square has 24 leading ones. */ + if ((ax == __gmpfr_emin - 1) && (ap[0] == ~mask) && + ((rnd_mode == MPFR_RNDN && rb) || + (MPFR_IS_LIKE_RNDA(rnd_mode, MPFR_IS_NEG (a)) && (rb | sb)))) + goto rounding; /* no underflow */ + /* For RNDN, mpfr_underflow always rounds away, thus for |a| <= 2^(emin-2) + we have to change to RNDZ. This corresponds to: + (a) either ax < emin - 1 + (b) or ax = emin - 1 and ap[0] = 1000....000 and rb = sb = 0 */ + if (rnd_mode == MPFR_RNDN && + (ax < __gmpfr_emin - 1 || (ap[0] == MPFR_LIMB_HIGHBIT && (rb | sb) == 0))) + rnd_mode = MPFR_RNDZ; + return mpfr_underflow (a, rnd_mode, MPFR_SIGN_POS); + } + + rounding: + MPFR_EXP (a) = ax; /* Don't use MPFR_SET_EXP since ax might be < __gmpfr_emin + in the cases "goto rounding" above. */ + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + { + MPFR_ASSERTD(ax >= __gmpfr_emin); + MPFR_RET (0); + } + else if (rnd_mode == MPFR_RNDN) + { + if (rb == 0 || (sb == 0 && (ap[0] & (MPFR_LIMB_ONE << sh)) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(a))) + { + truncate: + MPFR_ASSERTD(ax >= __gmpfr_emin); + MPFR_RET(-MPFR_SIGN_POS); + } + else /* round away from zero */ + { + add_one_ulp: + ap[0] += MPFR_LIMB_ONE << sh; + if (ap[0] == 0) + { + ap[0] = MPFR_LIMB_HIGHBIT; + if (MPFR_UNLIKELY(ax + 1 > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN_POS); + MPFR_ASSERTD(ax + 1 <= __gmpfr_emax); + MPFR_ASSERTD(ax + 1 >= __gmpfr_emin); + MPFR_SET_EXP (a, ax + 1); + } + MPFR_RET(MPFR_SIGN_POS); + } +} + +/* special code for PREC(a) = GMP_NUMB_BITS */ +static int +mpfr_sqr_1n (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode) +{ + mp_limb_t a0; + mpfr_limb_ptr ap = MPFR_MANT(a); + mp_limb_t b0 = MPFR_MANT(b)[0]; + mpfr_exp_t ax; + mp_limb_t rb, sb; + + ax = MPFR_GET_EXP(b) * 2; + umul_ppmm (a0, sb, b0, b0); + if (a0 < MPFR_LIMB_HIGHBIT) + { + ax --; + a0 = (a0 << 1) | (sb >> (GMP_NUMB_BITS - 1)); + sb <<= 1; + } + rb = sb & MPFR_LIMB_HIGHBIT; + sb = sb & ~MPFR_LIMB_HIGHBIT; + ap[0] = a0; + + MPFR_SIGN(a) = MPFR_SIGN_POS; + + /* rounding */ + if (MPFR_UNLIKELY(ax > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN_POS); + + /* Warning: underflow should be checked *after* rounding, thus when rounding + away and when a > 0.111...111*2^(emin-1), or when rounding to nearest and + a >= 0.111...111[1]*2^(emin-1), there is no underflow. */ + if (MPFR_UNLIKELY(ax < __gmpfr_emin)) + { + /* As seen in mpfr_mul_1, we cannot have a0 = 111...111 here if there + was not an exponent decrease (ax--) above. + In the case of an exponent decrease: + - For GMP_NUMB_BITS=32, a0 = 111...111 is not possible since the + largest b0 such that b0^2 < 2^(2*32-1) is b0=3037000499, but + its square has only 30 leading ones. + - For GMP_NUMB_BITS=64, a0 = 111...111 is possible: the largest b0 + is 13043817825332782212, and its square has 64 leading ones; but + since the next bit is rb=0, for RNDN, we always have an underflow. + For the test below, note that a is positive. + */ + if (ax == __gmpfr_emin - 1 && ap[0] == MPFR_LIMB_MAX && + MPFR_IS_LIKE_RNDA (rnd_mode, 0)) + goto rounding; /* no underflow */ + /* For RNDN, mpfr_underflow always rounds away, thus for |a| <= 2^(emin-2) + we have to change to RNDZ. This corresponds to: + (a) either ax < emin - 1 + (b) or ax = emin - 1 and ap[0] = 1000....000 and rb = sb = 0 */ + if (rnd_mode == MPFR_RNDN && + (ax < __gmpfr_emin - 1 || (ap[0] == MPFR_LIMB_HIGHBIT && (rb | sb) == 0))) + rnd_mode = MPFR_RNDZ; + return mpfr_underflow (a, rnd_mode, MPFR_SIGN_POS); + } + + rounding: + MPFR_EXP (a) = ax; /* Don't use MPFR_SET_EXP since ax might be < __gmpfr_emin + in the cases "goto rounding" above. */ + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + { + MPFR_ASSERTD(ax >= __gmpfr_emin); + MPFR_RET (0); + } + else if (rnd_mode == MPFR_RNDN) + { + if (rb == 0 || (sb == 0 && (ap[0] & MPFR_LIMB_ONE) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(a))) + { + truncate: + MPFR_ASSERTD(ax >= __gmpfr_emin); + MPFR_RET(-MPFR_SIGN_POS); + } + else /* round away from zero */ + { + add_one_ulp: + ap[0] += MPFR_LIMB_ONE; + if (ap[0] == 0) + { + ap[0] = MPFR_LIMB_HIGHBIT; + if (MPFR_UNLIKELY(ax + 1 > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN_POS); + MPFR_ASSERTD(ax + 1 <= __gmpfr_emax); + MPFR_ASSERTD(ax + 1 >= __gmpfr_emin); + MPFR_SET_EXP (a, ax + 1); + } + MPFR_RET(MPFR_SIGN_POS); + } +} + +/* Special code for GMP_NUMB_BITS < prec(a) < 2*GMP_NUMB_BITS and + GMP_NUMB_BITS < prec(b) <= 2*GMP_NUMB_BITS. + Note: this function was copied and optimized from mpfr_mul_2 in file mul.c, + thus any change here should be done also in mpfr_mul_2, if applicable. */ +static int +mpfr_sqr_2 (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode, mpfr_prec_t p) +{ + mp_limb_t h, l, u, v; + mpfr_limb_ptr ap = MPFR_MANT(a); + mpfr_exp_t ax = 2 * MPFR_GET_EXP(b); + mpfr_prec_t sh = 2 * GMP_NUMB_BITS - p; + mp_limb_t rb, sb, sb2, mask = MPFR_LIMB_MASK(sh); + mp_limb_t *bp = MPFR_MANT(b); + + /* we store the 4-limb product in h=ap[1], l=ap[0], sb=ap[-1], sb2=ap[-2] */ + umul_ppmm (h, l, bp[1], bp[1]); + umul_ppmm (u, v, bp[1], bp[0]); + l += u << 1; + h += (l < (u << 1)) + (u >> (GMP_NUMB_BITS - 1)); + + /* now the full square is {h, l, 2*v + high(b0*c0), low(b0*c0)}, + where the lower part contributes to less than 3 ulps to {h, l} */ + + /* If h has its most significant bit set and the low sh-1 bits of l are not + 000...000 nor 111...111 nor 111...110, then we can round correctly; + if h has zero as most significant bit, we have to shift left h and l, + thus if the low sh-2 bits are not 000...000 nor 111...111 nor 111...110, + then we can round correctly. To avoid an extra test we consider the latter + case (if we can round, we can also round in the former case). + For sh <= 3, we have mask <= 7, thus (mask>>2) <= 1, and the approximation + cannot be enough. */ + if (MPFR_LIKELY(((l + 2) & (mask >> 2)) > 2)) + sb = sb2 = 1; /* result cannot be exact in that case */ + else + { + mp_limb_t carry1, carry2; + + umul_ppmm (sb, sb2, bp[0], bp[0]); + /* the full product is {h, l, sb + v + w, sb2} */ + ADD_LIMB (sb, v, carry1); + ADD_LIMB (l, carry1, carry2); + h += carry2; + ADD_LIMB (sb, v, carry1); + ADD_LIMB (l, carry1, carry2); + h += carry2; + } + if (h < MPFR_LIMB_HIGHBIT) + { + ax --; + h = (h << 1) | (l >> (GMP_NUMB_BITS - 1)); + l = (l << 1) | (sb >> (GMP_NUMB_BITS - 1)); + sb <<= 1; + /* no need to shift sb2 since we only want to know if it is zero or not */ + } + ap[1] = h; + rb = l & (MPFR_LIMB_ONE << (sh - 1)); + sb |= ((l & mask) ^ rb) | sb2; + ap[0] = l & ~mask; + + MPFR_SIGN(a) = MPFR_SIGN_POS; + + /* rounding */ + if (MPFR_UNLIKELY(ax > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN_POS); + + /* Warning: underflow should be checked *after* rounding, thus when rounding + away and when a > 0.111...111*2^(emin-1), or when rounding to nearest and + a >= 0.111...111[1]*2^(emin-1), there is no underflow. */ + if (MPFR_UNLIKELY(ax < __gmpfr_emin)) + { + /* Note: like for mpfr_sqr_2, the case + 0.111...111*2^(emin-1) < a < 2^(emin-1) is not possible when emin is + odd, since (modulo a shift) this would imply 1-2^(-p) < a = b^2 < 1, + and this is not possible with 1-2^(-p) <= b < 1. + For emin even, it is possible for some values of p, for example for + p=69 with b=417402170410649030795*2^k. */ + if ((ax == __gmpfr_emin - 1) && + (ap[1] == MPFR_LIMB_MAX) && + (ap[0] == ~mask) && + ((rnd_mode == MPFR_RNDN && rb) || + (MPFR_IS_LIKE_RNDA(rnd_mode, MPFR_IS_NEG (a)) && (rb | sb)))) + goto rounding; /* no underflow */ + /* for RNDN, mpfr_underflow always rounds away, thus for |a| <= 2^(emin-2) + we have to change to RNDZ */ + if (rnd_mode == MPFR_RNDN && + (ax < __gmpfr_emin - 1 || + (ap[1] == MPFR_LIMB_HIGHBIT && ap[0] == 0 && (rb | sb) == 0))) + rnd_mode = MPFR_RNDZ; + return mpfr_underflow (a, rnd_mode, MPFR_SIGN_POS); + } + + rounding: + MPFR_EXP (a) = ax; /* Don't use MPFR_SET_EXP since ax might be < __gmpfr_emin + in the cases "goto rounding" above. */ + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + { + MPFR_ASSERTD(ax >= __gmpfr_emin); + MPFR_RET (0); + } + else if (rnd_mode == MPFR_RNDN) + { + if (rb == 0 || (sb == 0 && (ap[0] & (MPFR_LIMB_ONE << sh)) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(a))) + { + truncate: + MPFR_ASSERTD(ax >= __gmpfr_emin); + MPFR_RET(-MPFR_SIGN_POS); + } + else /* round away from zero */ + { + add_one_ulp: + ap[0] += MPFR_LIMB_ONE << sh; + ap[1] += (ap[0] == 0); + if (ap[1] == 0) + { + ap[1] = MPFR_LIMB_HIGHBIT; + if (MPFR_UNLIKELY(ax + 1 > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN_POS); + MPFR_ASSERTD(ax + 1 <= __gmpfr_emax); + MPFR_ASSERTD(ax + 1 >= __gmpfr_emin); + MPFR_SET_EXP (a, ax + 1); + } + MPFR_RET(MPFR_SIGN_POS); + } +} + +/* Special code for 2*GMP_NUMB_BITS < prec(a) < 3*GMP_NUMB_BITS and + 2*GMP_NUMB_BITS < prec(b) <= 3*GMP_NUMB_BITS. */ +static int +mpfr_sqr_3 (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode, mpfr_prec_t p) +{ + mp_limb_t a0, a1, a2, h, l; + mpfr_limb_ptr ap = MPFR_MANT(a); + mpfr_exp_t ax = 2 * MPFR_GET_EXP(b); + mpfr_prec_t sh = 3 * GMP_NUMB_BITS - p; + mp_limb_t rb, sb, sb2, mask = MPFR_LIMB_MASK(sh); + mp_limb_t *bp = MPFR_MANT(b); + + /* we store the upper 3-limb product in a2, a1, a0: + b2^2, 2*b2*b1, 2*b2*b0+b1^2 */ + + /* first compute b2*b1 and b2*b0, which will be shifted by 1 */ + umul_ppmm (a1, a0, bp[2], bp[1]); + umul_ppmm (h, l, bp[2], bp[0]); + a0 += h; + a1 += (a0 < h); + /* now a1, a0 contains b2*b1 + floor(b2*b0/B): there can be no overflow + since b2*b1*B + b2*b0 <= b2*(b1*B+b0) <= b2*(B^2-1) < B^3 */ + + /* multiply a2, a1, a0 by 2 */ + a2 = a1 >> (GMP_NUMB_BITS - 1); + a1 = (a1 << 1) | (a0 >> (GMP_NUMB_BITS - 1)); + a0 = (a0 << 1); + + /* add b2^2 */ + umul_ppmm (h, l, bp[2], bp[2]); + a1 += l; + a2 += h + (a1 < l); + + /* add b1^2 */ + umul_ppmm (h, l, bp[1], bp[1]); + a0 += h; + a1 += (a0 < h); + a2 += (a1 == 0 && a0 < h); + + /* Now the approximate product {a2, a1, a0} has an error of less than + 5 ulps (3 ulps for the ignored low limbs of 2*b2*b0+b1^2, + plus 2 ulps for the ignored 2*b1*b0 (plus b0^2). + Since we might shift by 1 bit, we make sure the low sh-2 bits of a0 + are not 0, -1, -2, -3 or -4. */ + + if (MPFR_LIKELY(((a0 + 4) & (mask >> 2)) > 4)) + sb = sb2 = 1; /* result cannot be exact in that case */ + else + { + mp_limb_t p[6]; + mpn_sqr (p, bp, 3); + a2 = p[5]; + a1 = p[4]; + a0 = p[3]; + sb = p[2]; + sb2 = p[1] | p[0]; + } + if (a2 < MPFR_LIMB_HIGHBIT) + { + ax --; + a2 = (a2 << 1) | (a1 >> (GMP_NUMB_BITS - 1)); + a1 = (a1 << 1) | (a0 >> (GMP_NUMB_BITS - 1)); + a0 = (a0 << 1) | (sb >> (GMP_NUMB_BITS - 1)); + sb <<= 1; + /* no need to shift sb2: we only need to know if it is zero or not */ + } + ap[2] = a2; + ap[1] = a1; + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= ((a0 & mask) ^ rb) | sb2; + ap[0] = a0 & ~mask; + + MPFR_SIGN(a) = MPFR_SIGN_POS; + + /* rounding */ + if (MPFR_UNLIKELY(ax > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN_POS); + + /* Warning: underflow should be checked *after* rounding, thus when rounding + away and when a > 0.111...111*2^(emin-1), or when rounding to nearest and + a >= 0.111...111[1]*2^(emin-1), there is no underflow. */ + if (MPFR_UNLIKELY(ax < __gmpfr_emin)) + { + if ((ax == __gmpfr_emin - 1) && + (ap[2] == MPFR_LIMB_MAX) && + (ap[1] == MPFR_LIMB_MAX) && + (ap[0] == ~mask) && + ((rnd_mode == MPFR_RNDN && rb) || + (MPFR_IS_LIKE_RNDA(rnd_mode, MPFR_IS_NEG (a)) && (rb | sb)))) + goto rounding; /* no underflow */ + /* for RNDN, mpfr_underflow always rounds away, thus for |a| <= 2^(emin-2) + we have to change to RNDZ */ + if (rnd_mode == MPFR_RNDN && + (ax < __gmpfr_emin - 1 || + (ap[2] == MPFR_LIMB_HIGHBIT && ap[1] == 0 && ap[0] == 0 + && (rb | sb) == 0))) + rnd_mode = MPFR_RNDZ; + return mpfr_underflow (a, rnd_mode, MPFR_SIGN_POS); + } + + rounding: + MPFR_EXP (a) = ax; /* Don't use MPFR_SET_EXP since ax might be < __gmpfr_emin + in the cases "goto rounding" above. */ + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + { + MPFR_ASSERTD(ax >= __gmpfr_emin); + MPFR_RET (0); + } + else if (rnd_mode == MPFR_RNDN) + { + if (rb == 0 || (sb == 0 && (ap[0] & (MPFR_LIMB_ONE << sh)) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(a))) + { + truncate: + MPFR_ASSERTD(ax >= __gmpfr_emin); + MPFR_RET(-MPFR_SIGN_POS); + } + else /* round away from zero */ + { + add_one_ulp: + ap[0] += MPFR_LIMB_ONE << sh; + ap[1] += (ap[0] == 0); + ap[2] += (ap[1] == 0) && (ap[0] == 0); + if (ap[2] == 0) + { + ap[2] = MPFR_LIMB_HIGHBIT; + if (MPFR_UNLIKELY(ax + 1 > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN_POS); + MPFR_ASSERTD(ax + 1 <= __gmpfr_emax); + MPFR_ASSERTD(ax + 1 >= __gmpfr_emin); + MPFR_SET_EXP (a, ax + 1); + } + MPFR_RET(MPFR_SIGN_POS); + } +} + +#endif /* !defined(MPFR_GENERIC_ABI) && ... */ + +/* Note: mpfr_sqr will call mpfr_mul if bn > MPFR_SQR_THRESHOLD, + in order to use Mulders' mulhigh, which is handled only here + to avoid partial code duplication. There is some overhead due + to the additional tests, but slowdown should not be noticeable + as this code is not executed in very small precisions. */ + int mpfr_sqr (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode) { @@ -29,7 +507,7 @@ mpfr_exp_t ax; mp_limb_t *tmp; mp_limb_t b1; - mpfr_prec_t bq; + mpfr_prec_t aq, bq; mp_size_t bn, tn; MPFR_TMP_DECL(marker); @@ -53,9 +531,26 @@ ( MPFR_ASSERTD(MPFR_IS_ZERO(b)), MPFR_SET_ZERO(a) ); MPFR_RET(0); } - ax = 2 * MPFR_GET_EXP (b); - bq = MPFR_PREC(b); + aq = MPFR_GET_PREC(a); + bq = MPFR_GET_PREC(b); +#if !defined(MPFR_GENERIC_ABI) && (GMP_NUMB_BITS == 32 || GMP_NUMB_BITS == 64) + if (aq < GMP_NUMB_BITS && bq <= GMP_NUMB_BITS) + return mpfr_sqr_1 (a, b, rnd_mode, aq); + + if (GMP_NUMB_BITS < aq && aq < 2 * GMP_NUMB_BITS + && GMP_NUMB_BITS < bq && bq <= 2 * GMP_NUMB_BITS) + return mpfr_sqr_2 (a, b, rnd_mode, aq); + + if (aq == GMP_NUMB_BITS && bq <= GMP_NUMB_BITS) + return mpfr_sqr_1n (a, b, rnd_mode); + + if (2 * GMP_NUMB_BITS < aq && aq < 3 * GMP_NUMB_BITS + && 2 * GMP_NUMB_BITS < bq && bq <= 3 * GMP_NUMB_BITS) + return mpfr_sqr_3 (a, b, rnd_mode, aq); +#endif + + ax = 2 * MPFR_GET_EXP (b); MPFR_ASSERTN (2 * (mpfr_uprec_t) bq <= MPFR_PREC_MAX); bn = MPFR_LIMB_SIZE (b); /* number of limbs of b */ @@ -69,7 +564,7 @@ tmp = MPFR_TMP_LIMBS_ALLOC (2 * bn); /* Multiplies the mantissa in temporary allocated space */ - mpn_sqr_n (tmp, MPFR_MANT(b), bn); + mpn_sqr (tmp, MPFR_MANT(b), bn); b1 = tmp[2 * bn - 1]; /* now tmp[0]..tmp[2*bn-1] contains the product of both mantissa, @@ -83,8 +578,7 @@ if (MPFR_UNLIKELY(b1 == 0)) mpn_lshift (tmp, tmp, tn, 1); /* tn <= k, so no stack corruption */ - cc = mpfr_round_raw (MPFR_MANT (a), tmp, 2 * bq, 0, - MPFR_PREC (a), rnd_mode, &inexact); + cc = mpfr_round_raw (MPFR_MANT (a), tmp, 2 * bq, 0, aq, rnd_mode, &inexact); /* cc = 1 ==> result is a power of two */ if (MPFR_UNLIKELY(cc)) MPFR_MANT(a)[MPFR_LIMB_SIZE(a)-1] = MPFR_LIMB_HIGHBIT; diff -Nru mpfr4-3.1.4/src/sqrt.c mpfr4-4.0.2/src/sqrt.c --- mpfr4-3.1.4/src/sqrt.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/sqrt.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_sqrt -- square root of a floating-point number -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,463 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +#define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" +#if !defined(MPFR_GENERIC_ABI) && GMP_NUMB_BITS == 64 + +#include "invsqrt_limb.h" + +/* Put in rp[1]*2^64+rp[0] an approximation of floor(sqrt(2^128*n)), + with 2^126 <= n := np[1]*2^64 + np[0] < 2^128. We have: + {rp, 2} - 4 <= floor(sqrt(2^128*n)) <= {rp, 2} + 26. */ +static void +mpfr_sqrt2_approx (mpfr_limb_ptr rp, mpfr_limb_srcptr np) +{ + mp_limb_t x, r1, r0, h, l, t; + + __gmpfr_sqrt_limb (r1, h, l, x, np[1]); + + /* now r1 = floor(sqrt(n1)) and h:l = n1^2 - r1^2 with h:l <= 2*r1, + thus h <= 1 */ + + l += np[0]; + h += (l < np[0]); + + /* now h <= 2 */ + + /* divide by 2 */ + l = (h << 63) | (l >> 1); + h = h >> 1; + + /* now h <= 1 */ + + /* now add (2^64+x) * (h*2^64+l) / 2^64 to [r1*2^64, 0] */ + + umul_ppmm (r0, t, x, l); /* x * l */ + r0 += l; + r1 += h + (r0 < l); /* now we have added 2^64 * (h*2^64+l) */ + if (h) + { + r0 += x; + r1 += (r0 < x); /* add x */ + } + + MPFR_ASSERTD(r1 & MPFR_LIMB_HIGHBIT); + + rp[0] = r0; + rp[1] = r1; +} + +/* Special code for prec(r), prec(u) < GMP_NUMB_BITS. We cannot have + prec(u) = GMP_NUMB_BITS here, since when the exponent of u is odd, + we need to shift u by one bit to the right without losing any bit. + Assumes GMP_NUMB_BITS = 64. */ +static int +mpfr_sqrt1 (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode) +{ + mpfr_prec_t p = MPFR_GET_PREC(r); + mpfr_prec_t exp_u = MPFR_EXP(u), exp_r, sh = GMP_NUMB_BITS - p; + mp_limb_t u0, r0, rb, sb, mask = MPFR_LIMB_MASK(sh); + mpfr_limb_ptr rp = MPFR_MANT(r); + + MPFR_STAT_STATIC_ASSERT (GMP_NUMB_BITS == 64); + + /* first make the exponent even */ + u0 = MPFR_MANT(u)[0]; + if (((unsigned int) exp_u & 1) != 0) + { + u0 >>= 1; + exp_u ++; + } + MPFR_ASSERTD (((unsigned int) exp_u & 1) == 0); + exp_r = exp_u / 2; + + /* then compute an approximation of the integer square root of + u0*2^GMP_NUMB_BITS */ + __gmpfr_sqrt_limb_approx (r0, u0); + + sb = 1; /* when we can round correctly with the approximation, the sticky bit + is non-zero */ + + /* the exact square root is in [r0, r0 + 7] */ + if (MPFR_UNLIKELY(((r0 + 7) & (mask >> 1)) <= 7)) + { + /* first ensure r0 has its most significant bit set */ + if (MPFR_UNLIKELY(r0 < MPFR_LIMB_HIGHBIT)) + r0 = MPFR_LIMB_HIGHBIT; + umul_ppmm (rb, sb, r0, r0); + sub_ddmmss (rb, sb, u0, 0, rb, sb); + /* for the exact square root, we should have 0 <= rb:sb <= 2*r0 */ + while (!(rb == 0 || (rb == 1 && sb <= 2 * r0))) + { + /* subtract 2*r0+1 from rb:sb: subtract r0 before incrementing r0, + then r0 after (which is r0+1) */ + rb -= (sb < r0); + sb -= r0; + r0 ++; + rb -= (sb < r0); + sb -= r0; + } + /* now we should have rb*2^64 + sb <= 2*r0 */ + MPFR_ASSERTD(rb == 0 || (rb == 1 && sb <= 2 * r0)); + sb = rb | sb; + } + + rb = r0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (r0 & mask) ^ rb; + rp[0] = r0 & ~mask; + + /* rounding: sb = 0 implies rb = 0, since (rb,sb)=(1,0) is not possible */ + MPFR_ASSERTD (rb == 0 || sb != 0); + + /* Note: if 1 and 2 are in [emin,emax], no overflow nor underflow + is possible */ + if (MPFR_UNLIKELY (exp_r > __gmpfr_emax)) + return mpfr_overflow (r, rnd_mode, 1); + + /* See comments in mpfr_div_1 */ + if (MPFR_UNLIKELY (exp_r < __gmpfr_emin)) + { + if (rnd_mode == MPFR_RNDN) + { + if ((exp_r == __gmpfr_emin - 1) && (rp[0] == ~mask) && rb) + goto rounding; /* no underflow */ + if (exp_r < __gmpfr_emin - 1 || (rp[0] == MPFR_LIMB_HIGHBIT && sb == 0)) + rnd_mode = MPFR_RNDZ; + } + else if (MPFR_IS_LIKE_RNDA(rnd_mode, 0)) + { + if ((exp_r == __gmpfr_emin - 1) && (rp[0] == ~mask) && (rb | sb)) + goto rounding; /* no underflow */ + } + return mpfr_underflow (r, rnd_mode, 1); + } + + rounding: + MPFR_EXP (r) = exp_r; + if (sb == 0 /* implies rb = 0 */ || rnd_mode == MPFR_RNDF) + { + MPFR_ASSERTD (rb == 0 || rnd_mode == MPFR_RNDF); + MPFR_ASSERTD(exp_r >= __gmpfr_emin); + MPFR_ASSERTD(exp_r <= __gmpfr_emax); + MPFR_RET (0); + } + else if (rnd_mode == MPFR_RNDN) + { + /* since sb <> 0, only rb is needed to decide how to round, and the exact + middle is not possible */ + if (rb == 0) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, 0)) + { + truncate: + MPFR_ASSERTD(exp_r >= __gmpfr_emin); + MPFR_ASSERTD(exp_r <= __gmpfr_emax); + MPFR_RET(-1); + } + else /* round away from zero */ + { + add_one_ulp: + rp[0] += MPFR_LIMB_ONE << sh; + if (rp[0] == 0) + { + rp[0] = MPFR_LIMB_HIGHBIT; + if (MPFR_UNLIKELY(exp_r + 1 > __gmpfr_emax)) + return mpfr_overflow (r, rnd_mode, 1); + MPFR_ASSERTD(exp_r + 1 <= __gmpfr_emax); + MPFR_ASSERTD(exp_r + 1 >= __gmpfr_emin); + MPFR_SET_EXP (r, exp_r + 1); + } + MPFR_RET(1); + } +} + +/* Special code for prec(r) = GMP_NUMB_BITS and prec(u) <= GMP_NUMB_BITS. */ +static int +mpfr_sqrt1n (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode) +{ + mpfr_prec_t exp_u = MPFR_EXP(u), exp_r; + mp_limb_t u0, r0, rb, sb, low; + mpfr_limb_ptr rp = MPFR_MANT(r); + + MPFR_STAT_STATIC_ASSERT (GMP_NUMB_BITS == 64); + MPFR_ASSERTD(MPFR_PREC(r) == GMP_NUMB_BITS); + MPFR_ASSERTD(MPFR_PREC(u) <= GMP_NUMB_BITS); + + /* first make the exponent even */ + u0 = MPFR_MANT(u)[0]; + if (((unsigned int) exp_u & 1) != 0) + { + low = u0 << (GMP_NUMB_BITS - 1); + u0 >>= 1; + exp_u ++; + } + else + low = 0; /* low part of u0 */ + MPFR_ASSERTD (((unsigned int) exp_u & 1) == 0); + exp_r = exp_u / 2; + + /* then compute an approximation of the integer square root of + u0*2^GMP_NUMB_BITS */ + __gmpfr_sqrt_limb_approx (r0, u0); + + /* the exact square root is in [r0, r0 + 7] */ + + /* first ensure r0 has its most significant bit set */ + if (MPFR_UNLIKELY(r0 < MPFR_LIMB_HIGHBIT)) + r0 = MPFR_LIMB_HIGHBIT; + + umul_ppmm (rb, sb, r0, r0); + sub_ddmmss (rb, sb, u0, low, rb, sb); + /* for the exact square root, we should have 0 <= rb:sb <= 2*r0 */ + while (!(rb == 0 || (rb == 1 && sb <= 2 * r0))) + { + /* subtract 2*r0+1 from rb:sb: subtract r0 before incrementing r0, + then r0 after (which is r0+1) */ + rb -= (sb < r0); + sb -= r0; + r0 ++; + rb -= (sb < r0); + sb -= r0; + } + /* now we have u0*2^64+low = r0^2 + rb*2^64+sb, with rb*2^64+sb <= 2*r0 */ + MPFR_ASSERTD(rb == 0 || (rb == 1 && sb <= 2 * r0)); + + /* We can't have the middle case u0*2^64 = (r0 + 1/2)^2 since + (r0 + 1/2)^2 is not an integer. + We thus rb = 1 whenever u0*2^64 > (r0 + 1/2)^2, thus rb*2^64 + sb > r0 + and the sticky bit is always 1, unless we had rb = sb = 0. */ + + rb = rb || (sb > r0); + sb = rb | sb; + rp[0] = r0; + + /* rounding */ + + /* Note: if 1 and 2 are in [emin,emax], no overflow nor underflow + is possible */ + if (MPFR_UNLIKELY (exp_r > __gmpfr_emax)) + return mpfr_overflow (r, rnd_mode, 1); + + /* See comments in mpfr_div_1 */ + if (MPFR_UNLIKELY (exp_r < __gmpfr_emin)) + { + if (rnd_mode == MPFR_RNDN) + { + /* the case rp[0] = 111...111 and rb = 1 cannot happen, since it + would imply u0 >= (2^64-1/2)^2/2^64 thus u0 >= 2^64 */ + if (exp_r < __gmpfr_emin - 1 || (rp[0] == MPFR_LIMB_HIGHBIT && sb == 0)) + rnd_mode = MPFR_RNDZ; + } + else if (MPFR_IS_LIKE_RNDA(rnd_mode, 0)) + { + if ((exp_r == __gmpfr_emin - 1) && (rp[0] == ~MPFR_LIMB_ZERO) && (rb | sb)) + goto rounding; /* no underflow */ + } + return mpfr_underflow (r, rnd_mode, 1); + } + + /* sb = 0 can only occur when the square root is exact, i.e., rb = 0 */ + + rounding: + MPFR_EXP (r) = exp_r; + if (sb == 0 /* implies rb = 0 */ || rnd_mode == MPFR_RNDF) + { + MPFR_ASSERTD(exp_r >= __gmpfr_emin); + MPFR_ASSERTD(exp_r <= __gmpfr_emax); + MPFR_RET (0); + } + else if (rnd_mode == MPFR_RNDN) + { + /* we can't have sb = 0, thus rb is enough */ + if (rb == 0) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, 0)) + { + truncate: + MPFR_ASSERTD(exp_r >= __gmpfr_emin); + MPFR_ASSERTD(exp_r <= __gmpfr_emax); + MPFR_RET(-1); + } + else /* round away from zero */ + { + add_one_ulp: + rp[0] += MPFR_LIMB_ONE; + if (rp[0] == 0) + { + rp[0] = MPFR_LIMB_HIGHBIT; + if (MPFR_UNLIKELY(exp_r + 1 > __gmpfr_emax)) + return mpfr_overflow (r, rnd_mode, 1); + MPFR_ASSERTD(exp_r + 1 <= __gmpfr_emax); + MPFR_ASSERTD(exp_r + 1 >= __gmpfr_emin); + MPFR_SET_EXP (r, exp_r + 1); + } + MPFR_RET(1); + } +} + +/* Special code for GMP_NUMB_BITS < prec(r) < 2*GMP_NUMB_BITS, + and GMP_NUMB_BITS < prec(u) <= 2*GMP_NUMB_BITS. + Assumes GMP_NUMB_BITS=64. */ +static int +mpfr_sqrt2 (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode) +{ + mpfr_prec_t p = MPFR_GET_PREC(r); + mpfr_limb_ptr up = MPFR_MANT(u), rp = MPFR_MANT(r); + mp_limb_t np[4], rb, sb, mask; + mpfr_prec_t exp_u = MPFR_EXP(u), exp_r, sh = 2 * GMP_NUMB_BITS - p; + + MPFR_STAT_STATIC_ASSERT (GMP_NUMB_BITS == 64); + + if (((unsigned int) exp_u & 1) != 0) + { + np[3] = up[1] >> 1; + np[2] = (up[1] << (GMP_NUMB_BITS - 1)) | (up[0] >> 1); + np[1] = up[0] << (GMP_NUMB_BITS - 1); + exp_u ++; + } + else + { + np[3] = up[1]; + np[2] = up[0]; + np[1] = 0; + } + exp_r = exp_u / 2; + + mask = MPFR_LIMB_MASK(sh); + + mpfr_sqrt2_approx (rp, np + 2); + /* with n = np[3]*2^64+np[2], we have: + {rp, 2} - 4 <= floor(sqrt(2^128*n)) <= {rp, 2} + 26, thus we can round + correctly except when the number formed by the last sh-1 bits + of rp[0] is in the range [-26, 4]. */ + if (MPFR_LIKELY(((rp[0] + 26) & (mask >> 1)) > 30)) + sb = 1; + else + { + mp_limb_t tp[4], h, l; + + np[0] = 0; + mpn_sqr (tp, rp, 2); + /* since we know s - 26 <= r <= s + 4 and 0 <= n^2 - s <= 2*s, we have + -8*s-16 <= n - r^2 <= 54*s - 676, thus it suffices to compute + n - r^2 modulo 2^192 */ + mpn_sub_n (tp, np, tp, 3); + /* invariant: h:l = 2 * {rp, 2}, with upper bit implicit */ + h = (rp[1] << 1) | (rp[0] >> (GMP_NUMB_BITS - 1)); + l = rp[0] << 1; + while ((mp_limb_signed_t) tp[2] < 0) /* approximation was too large */ + { + /* subtract 1 to {rp, 2}, thus 2 to h:l */ + h -= (l <= MPFR_LIMB_ONE); + l -= 2; + /* add (1:h:l)+1 to {tp,3} */ + tp[0] += l + 1; + tp[1] += h + (tp[0] < l); + /* necessarily rp[1] has its most significant bit set */ + tp[2] += MPFR_LIMB_ONE + (tp[1] < h || (tp[1] == h && tp[0] < l)); + } + /* now tp[2] >= 0 */ + /* now we want {tp, 4} <= 2 * {rp, 2}, which implies tp[2] <= 1 */ + while (tp[2] > 1 || (tp[2] == 1 && tp[1] > h) || + (tp[2] == 1 && tp[1] == h && tp[0] > l)) + { + /* subtract (1:h:l)+1 from {tp,3} */ + tp[2] -= MPFR_LIMB_ONE + (tp[1] < h || (tp[1] == h && tp[0] <= l)); + tp[1] -= h + (tp[0] <= l); + tp[0] -= l + 1; + /* add 2 to h:l */ + l += 2; + h += (l <= MPFR_LIMB_ONE); + } + /* restore {rp, 2} from h:l */ + rp[1] = MPFR_LIMB_HIGHBIT | (h >> 1); + rp[0] = (h << (GMP_NUMB_BITS - 1)) | (l >> 1); + sb = tp[2] | tp[0] | tp[1]; + } + + rb = rp[0] & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (rp[0] & mask) ^ rb; + rp[0] = rp[0] & ~mask; + + /* rounding */ + if (MPFR_UNLIKELY (exp_r > __gmpfr_emax)) + return mpfr_overflow (r, rnd_mode, 1); + + /* See comments in mpfr_div_1 */ + if (MPFR_UNLIKELY (exp_r < __gmpfr_emin)) + { + if (rnd_mode == MPFR_RNDN) + { + if (exp_r == __gmpfr_emin - 1 && (rp[1] == MPFR_LIMB_MAX && + rp[0] == ~mask) && rb) + goto rounding; /* no underflow */ + if (exp_r < __gmpfr_emin - 1 || (rp[1] == MPFR_LIMB_HIGHBIT && + rp[0] == MPFR_LIMB_ZERO && sb == 0)) + rnd_mode = MPFR_RNDZ; + } + else if (MPFR_IS_LIKE_RNDA(rnd_mode, 0)) + { + if (exp_r == __gmpfr_emin - 1 && (rp[1] == MPFR_LIMB_MAX && + rp[0] == ~mask) && (rb | sb)) + goto rounding; /* no underflow */ + } + return mpfr_underflow (r, rnd_mode, 1); + } + + rounding: + MPFR_EXP (r) = exp_r; + if (sb == 0 /* implies rb = 0 */ || rnd_mode == MPFR_RNDF) + { + MPFR_ASSERTD(exp_r >= __gmpfr_emin); + MPFR_ASSERTD(exp_r <= __gmpfr_emax); + MPFR_RET (0); + } + else if (rnd_mode == MPFR_RNDN) + { + /* since sb <> 0 now, only rb is needed */ + if (rb == 0) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, 0)) + { + truncate: + MPFR_ASSERTD(exp_r >= __gmpfr_emin); + MPFR_ASSERTD(exp_r <= __gmpfr_emax); + MPFR_RET(-1); + } + else /* round away from zero */ + { + add_one_ulp: + rp[0] += MPFR_LIMB_ONE << sh; + rp[1] += rp[0] == 0; + if (rp[1] == 0) + { + rp[1] = MPFR_LIMB_HIGHBIT; + if (MPFR_UNLIKELY(exp_r + 1 > __gmpfr_emax)) + return mpfr_overflow (r, rnd_mode, 1); + MPFR_ASSERTD(exp_r + 1 <= __gmpfr_emax); + MPFR_ASSERTD(exp_r + 1 >= __gmpfr_emin); + MPFR_SET_EXP (r, exp_r + 1); + } + MPFR_RET(1); + } +} + +#endif /* !defined(MPFR_GENERIC_ABI) && GMP_NUMB_BITS == 64 */ + int mpfr_sqrt (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode) { @@ -41,6 +493,7 @@ int sh; /* number of extra bits in rp[0] */ int inexact; /* return ternary flag */ mpfr_exp_t expr; + mpfr_prec_t rq = MPFR_GET_PREC (r); MPFR_TMP_DECL(marker); MPFR_LOG_FUNC @@ -83,8 +536,26 @@ } MPFR_SET_POS(r); +#if !defined(MPFR_GENERIC_ABI) && GMP_NUMB_BITS == 64 + { + mpfr_prec_t uq = MPFR_GET_PREC (u); + + if (rq == uq) + { + if (rq < GMP_NUMB_BITS) + return mpfr_sqrt1 (r, u, rnd_mode); + + if (GMP_NUMB_BITS < rq && rq < 2*GMP_NUMB_BITS) + return mpfr_sqrt2 (r, u, rnd_mode); + + if (rq == GMP_NUMB_BITS) + return mpfr_sqrt1n (r, u, rnd_mode); + } + } +#endif + MPFR_TMP_MARK (marker); - MPFR_UNSIGNED_MINUS_MODULO(sh,MPFR_PREC(r)); + MPFR_UNSIGNED_MINUS_MODULO (sh, rq); if (sh == 0 && rnd_mode == MPFR_RNDN) sh = GMP_NUMB_BITS; /* ugly case */ rsize = MPFR_LIMB_SIZE(r) + (sh == GMP_NUMB_BITS); @@ -133,20 +604,14 @@ /* sticky0 is non-zero iff the truncated part of the input is non-zero */ - /* mpn_rootrem with NULL 2nd argument is faster than mpn_sqrtrem, thus use - it if available and if the user asked to use GMP internal functions */ -#if defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_ROOTREM) - tsize = __gmpn_rootrem (rp, NULL, sp, rrsize, 2); -#else tsize = mpn_sqrtrem (rp, NULL, sp, rrsize); -#endif /* a return value of zero in mpn_sqrtrem indicates a perfect square */ sticky = sticky0 || tsize != 0; /* truncate low bits of rp[0] */ sticky1 = rp[0] & ((sh < GMP_NUMB_BITS) ? MPFR_LIMB_MASK(sh) - : ~MPFR_LIMB_ZERO); + : MPFR_LIMB_MAX); rp[0] -= sticky1; sticky = sticky || sticky1; @@ -224,6 +689,7 @@ MPN_COPY (rp0, rp + 1, rsize - 1); end: + /* Do not use MPFR_SET_EXP because the range has not been checked yet. */ MPFR_ASSERTN (expr >= MPFR_EMIN_MIN && expr <= MPFR_EMAX_MAX); MPFR_EXP (r) = expr; MPFR_TMP_FREE(marker); diff -Nru mpfr4-3.1.4/src/sqrt_ui.c mpfr4-4.0.2/src/sqrt_ui.c --- mpfr4-3.1.4/src/sqrt_ui.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/sqrt_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_sqrt_ui -- square root of a machine integer -Copyright 2000-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2000-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -30,7 +30,7 @@ { mpfr_t uu; mp_limb_t up[1]; - unsigned long cnt; + int cnt; int inex; MPFR_SAVE_EXPO_DECL (expo); diff -Nru mpfr4-3.1.4/src/stack_interface.c mpfr4-4.0.2/src/stack_interface.c --- mpfr4-3.1.4/src/stack_interface.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/stack_interface.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_stack -- initialize a floating-point number with given allocation area -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/strtofr.c mpfr4-4.0.2/src/strtofr.c --- mpfr4-3.1.4/src/strtofr.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/strtofr.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_strtofr -- set a floating-point number from a string -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,10 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include /* For strtol */ #include /* For isspace */ #define MPFR_NEED_LONGLONG_H @@ -37,79 +36,80 @@ allocated for the mantissa field. */ size_t prec; /* length of mant (zero for +/-0) */ size_t alloc; /* allocation size of mantissa */ - mpfr_exp_t exp_base; /* number of digits before the point */ - mpfr_exp_t exp_bin; /* exponent in case base=2 or 16, and the pxxx - format is used (i.e., exponent is given in - base 10) */ + mpfr_exp_t exp_base; /* number of digits before the point, + exponent + except in case of binary exponent (exp_bin) */ + mpfr_exp_t exp_bin; /* binary exponent of the pxxx format for + base = 2 or 16 */ }; /* This table has been generated by the following program. For 2 <= b <= MPFR_MAX_BASE, RedInvLog2Table[b-2][0] / RedInvLog2Table[b-2][1] - is an upper approximation of log(2)/log(b). + is an upper approximation to log(2)/log(b), no larger than 1. + Note: these numbers must fit on 16 bits, thus unsigned int is OK. */ -static const unsigned long RedInvLog2Table[MPFR_MAX_BASE-1][2] = { - {1UL, 1UL}, - {53UL, 84UL}, - {1UL, 2UL}, - {4004UL, 9297UL}, - {53UL, 137UL}, - {2393UL, 6718UL}, - {1UL, 3UL}, - {665UL, 2108UL}, - {4004UL, 13301UL}, - {949UL, 3283UL}, - {53UL, 190UL}, - {5231UL, 19357UL}, - {2393UL, 9111UL}, - {247UL, 965UL}, - {1UL, 4UL}, - {4036UL, 16497UL}, - {665UL, 2773UL}, - {5187UL, 22034UL}, - {4004UL, 17305UL}, - {51UL, 224UL}, - {949UL, 4232UL}, - {3077UL, 13919UL}, - {53UL, 243UL}, - {73UL, 339UL}, - {5231UL, 24588UL}, - {665UL, 3162UL}, - {2393UL, 11504UL}, - {4943UL, 24013UL}, - {247UL, 1212UL}, - {3515UL, 17414UL}, - {1UL, 5UL}, - {4415UL, 22271UL}, - {4036UL, 20533UL}, - {263UL, 1349UL}, - {665UL, 3438UL}, - {1079UL, 5621UL}, - {5187UL, 27221UL}, - {2288UL, 12093UL}, - {4004UL, 21309UL}, - {179UL, 959UL}, - {51UL, 275UL}, - {495UL, 2686UL}, - {949UL, 5181UL}, - {3621UL, 19886UL}, - {3077UL, 16996UL}, - {229UL, 1272UL}, - {53UL, 296UL}, - {109UL, 612UL}, - {73UL, 412UL}, - {1505UL, 8537UL}, - {5231UL, 29819UL}, - {283UL, 1621UL}, - {665UL, 3827UL}, - {32UL, 185UL}, - {2393UL, 13897UL}, - {1879UL, 10960UL}, - {4943UL, 28956UL}, - {409UL, 2406UL}, - {247UL, 1459UL}, - {231UL, 1370UL}, - {3515UL, 20929UL} }; +static const unsigned int RedInvLog2Table[MPFR_MAX_BASE-1][2] = { + {1, 1}, + {53, 84}, + {1, 2}, + {4004, 9297}, + {53, 137}, + {2393, 6718}, + {1, 3}, + {665, 2108}, + {4004, 13301}, + {949, 3283}, + {53, 190}, + {5231, 19357}, + {2393, 9111}, + {247, 965}, + {1, 4}, + {4036, 16497}, + {665, 2773}, + {5187, 22034}, + {4004, 17305}, + {51, 224}, + {949, 4232}, + {3077, 13919}, + {53, 243}, + {73, 339}, + {5231, 24588}, + {665, 3162}, + {2393, 11504}, + {4943, 24013}, + {247, 1212}, + {3515, 17414}, + {1, 5}, + {4415, 22271}, + {4036, 20533}, + {263, 1349}, + {665, 3438}, + {1079, 5621}, + {5187, 27221}, + {2288, 12093}, + {4004, 21309}, + {179, 959}, + {51, 275}, + {495, 2686}, + {949, 5181}, + {3621, 19886}, + {3077, 16996}, + {229, 1272}, + {53, 296}, + {109, 612}, + {73, 412}, + {1505, 8537}, + {5231, 29819}, + {283, 1621}, + {665, 3827}, + {32, 185}, + {2393, 13897}, + {1879, 10960}, + {4943, 28956}, + {409, 2406}, + {247, 1459}, + {231, 1370}, + {3515, 20929} }; #if 0 #define N 8 int main () @@ -220,7 +220,7 @@ It returns: -1 if invalid string, 0 if special string (like nan), - 1 if the string is ok. + 1 if the string is OK. 2 if overflows So it doesn't return the ternary value BUT if it returns 0 (NAN or INF), the ternary value is also '0' @@ -324,7 +324,7 @@ /* Alloc mantissa */ pstr->alloc = (size_t) strlen (str) + 1; - pstr->mantissa = (unsigned char*) (*__gmp_allocate_func) (pstr->alloc); + pstr->mantissa = (unsigned char*) mpfr_allocate_func (pstr->alloc); /* Read mantissa digits */ parse_begin: @@ -378,6 +378,13 @@ res = 1; MPFR_ASSERTD (pstr->exp_base >= 0); + /* FIXME: In the code below (both cases), if the exponent from the + string is large, it will be replaced by MPFR_EXP_MIN or MPFR_EXP_MAX, + i.e. it will have a different value. This may not change the result + in most cases, but there is no guarantee on very long strings when + mpfr_exp_t is a 32-bit type, as the exponent could be brought back + to the current exponent range. */ + /* an optional exponent (e or E, p or P, @) */ if ( (*str == '@' || (base <= 10 && (*str == 'e' || *str == 'E'))) && (!isspace((unsigned char) str[1])) ) @@ -436,7 +443,7 @@ *string = str; end: if (pstr->mantissa != NULL && res != 1) - (*__gmp_free_func) (pstr->mantissa, pstr->alloc); + mpfr_free_func (pstr->mantissa, pstr->alloc); return res; } @@ -446,112 +453,174 @@ static int parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd) { - mpfr_prec_t prec; + mpfr_prec_t precx, prec, ysize_bits, pstr_size; mpfr_exp_t exp; - mpfr_exp_t ysize_bits; - mp_limb_t *y, *result; + mp_limb_t *result; int count, exact; - size_t pstr_size; - mp_size_t ysize, real_ysize; + mp_size_t ysize, real_ysize, diff_ysize; int res, err; + const int extra_limbs = GMP_NUMB_BITS >= 12 ? 1 : 2; /* see below */ MPFR_ZIV_DECL (loop); MPFR_TMP_DECL (marker); /* initialize the working precision */ - prec = MPFR_PREC (x) + MPFR_INT_CEIL_LOG2 (MPFR_PREC (x)); + precx = MPFR_GET_PREC (x); + prec = precx + MPFR_INT_CEIL_LOG2 (precx); - /* compute the value y of the leading characters as long as rounding is not - possible */ + /* Compute the value y of the leading characters as long as rounding is not + possible. + Note: We have some integer overflow checking using MPFR_EXP_MIN and + MPFR_EXP_MAX in this loop. Thanks to the large margin between these + extremal values of the mpfr_exp_t type and the valid minimum/maximum + exponents, such integer overflows would correspond to real underflow + or overflow on the result (possibly except in huge precisions, which + are disregarded here; anyway, in practice, such issues could occur + only with 32-bit precision and exponent types). Such checks could be + extended to real early underflow/overflow checking, in order to avoid + useless computations in such cases; in such a case, be careful that + the approximation errors need to be taken into account. */ MPFR_TMP_MARK(marker); MPFR_ZIV_INIT (loop, prec); for (;;) { - /* Set y to the value of the ~prec most significant bits of pstr->mant - (as long as we guarantee correct rounding, we don't need to get - exactly prec bits). */ + mp_limb_t *y0, *y; + + /* y will be regarded as a number with precision prec. */ ysize = MPFR_PREC2LIMBS (prec); /* prec bits corresponds to ysize limbs */ - ysize_bits = ysize * GMP_NUMB_BITS; - /* and to ysize_bits >= prec > MPFR_PREC (x) bits */ - /* we need to allocate one more limb to work around bug + ysize_bits = (mpfr_prec_t) ysize * GMP_NUMB_BITS; + MPFR_ASSERTD (ysize_bits >= prec); + /* and to ysize_bits >= prec > precx bits. */ + /* We need to allocate one more limb as specified by mpn_set_str + (a limb may be written in rp[rn]). Note that the manual of GMP + up to 5.1.3 was incorrect on this point. + See the following discussion: https://gmplib.org/list-archives/gmp-bugs/2013-December/003267.html */ - y = MPFR_TMP_LIMBS_ALLOC (2 * ysize + 2); - y += ysize; /* y has (ysize+2) allocated limbs */ + y0 = MPFR_TMP_LIMBS_ALLOC (2 * ysize + extra_limbs + 1); + y = y0 + ysize; /* y has (ysize + extra_limbs + 1) allocated limbs */ - /* pstr_size is the number of characters we read in pstr->mant - to have at least ysize full limbs. + /* pstr_size is the number of bytes we want to read from pstr->mant + to fill at least ysize full limbs with mpn_set_str. We must have base^(pstr_size-1) >= (2^(GMP_NUMB_BITS))^ysize (in the worst case, the first digit is one and all others are zero). i.e., pstr_size >= 1 + ysize*GMP_NUMB_BITS/log2(base) Since ysize ~ prec/GMP_NUMB_BITS and prec < Umax/2 => ysize*GMP_NUMB_BITS can not overflow. We compute pstr_size = 1 + ceil(ysize_bits * Num / Den) - where Num/Den >= 1/log2(base) - It is not exactly ceil(1/log2(base)) but could be one more (base 2) + where 1/log2(base) <= Num/Den <= 1 + It is not exactly ceil(1/log2(base)) but could be one more (base 2). Quite ugly since it tries to avoid overflow: let Num = RedInvLog2Table[pstr->base-2][0] and Den = RedInvLog2Table[pstr->base-2][1], and ysize_bits = a*Den+b, then ysize_bits * Num/Den = a*Num + (b * Num)/Den, thus ceil(ysize_bits * Num/Den) = a*Num + floor(b * Num + Den - 1)/Den + + Note: denoting m = pstr_size and n = ysize_bits, assuming we have + m = 1 + ceil(n/log2(b)), i.e., b^(m-1) >= 2^n > b^(m-2), then + b^(m-1)/2^n < b, and since we consider m characters of the input, + the corresponding part is less than b^m < b^2*2^n. + This implies that if b^2 < 2^GMP_NUMB_BITS, which for b <= 62 holds + for GMP_NUMB_BITS >= 12, we have real_ysize <= ysize+1 below + (this also implies that for GMP_NUMB_BITS >= 13, the number of bits + of y[real_ysize-1] below is less than GMP_NUMB_BITS, thus + count < GMP_NUMB_BITS). + Warning: for GMP_NUMB_BITS=8, we can have real_ysize = ysize + 2! + Hence the allocation above for ysize + extra_limbs limbs. */ { - unsigned long Num = RedInvLog2Table[pstr->base-2][0]; - unsigned long Den = RedInvLog2Table[pstr->base-2][1]; - pstr_size = ((ysize_bits / Den) * Num) - + (((ysize_bits % Den) * Num + Den - 1) / Den) + unsigned int Num = RedInvLog2Table[pstr->base-2][0]; + unsigned int Den = RedInvLog2Table[pstr->base-2][1]; + MPFR_ASSERTD (Num <= Den && Den <= 65535); /* thus no overflow */ + pstr_size = (ysize_bits / Den) * Num + + ((unsigned long) (ysize_bits % Den) * Num + Den - 1) / Den + 1; } - /* since pstr_size corresponds to at least ysize_bits full bits, - and ysize_bits > prec, the weight of the neglected part of - pstr->mant (if any) is < ulp(y) < ulp(x) */ - - /* if the number of wanted characters is more than what we have in - pstr->mant, round it down */ - if (pstr_size >= pstr->prec) + /* Since pstr_size corresponds to at least ysize_bits bits, + and ysize_bits >= prec, the weight of the neglected part of + pstr->mant (if any) is < ulp(y) < ulp(x). */ + + /* If the number of wanted bytes is more than what is available + in pstr->mant, i.e. pstr->prec, reduce it to pstr->prec. */ + if (pstr_size > pstr->prec) pstr_size = pstr->prec; - MPFR_ASSERTD (pstr_size == (mpfr_exp_t) pstr_size); - /* convert str into binary: note that pstr->mant is big endian, - thus no offset is needed */ + /* Convert str (potentially truncated to pstr_size) into binary. + Note that pstr->mant is big endian, thus no offset is needed. */ real_ysize = mpn_set_str (y, pstr->mant, pstr_size, pstr->base); - MPFR_ASSERTD (real_ysize <= ysize+1); - /* normalize y: warning we can even get ysize+1 limbs! */ + /* See above for the explanation of the following assertion. */ + MPFR_ASSERTD (real_ysize <= ysize + extra_limbs); + + /* The Boolean "exact" will attempt to track exactness of the result: + If it is true, then this means that the result is exact, allowing + termination, even though the rounding test may not succeed. + Conversely, if the result is exact, then "exact" will not + necessarily be true at the end of the Ziv loop, but we will need + to make sure that at some point, "exact" will be true in order to + guarantee termination. FIXME: check that. */ + /* First, consider the part of the input string that has been ignored. + Note that the trailing zeros have been removed in parse_string, so + that if something has been ignored, it must be non-zero. */ + exact = pstr_size == pstr->prec; + + /* Normalize y and set the initial value of its exponent exp, which + is 0 when y is not shifted. + Since pstr->mant was normalized, mpn_set_str guarantees that + the most significant limb is non-zero. */ MPFR_ASSERTD (y[real_ysize - 1] != 0); /* mpn_set_str guarantees this */ count_leading_zeros (count, y[real_ysize - 1]); - /* exact means that the number of limbs of the output of mpn_set_str - is less or equal to ysize */ - exact = real_ysize <= ysize; - if (exact) /* shift y to the left in that case y should be exact */ + diff_ysize = ysize - real_ysize; + MPFR_LOG_MSG (("diff_ysize = %ld\n", (long) diff_ysize)); + if (diff_ysize >= 0) { - /* we have enough limbs to store {y, real_ysize} */ - /* shift {y, num_limb} for count bits to the left */ + /* We have enough limbs to store {y, real_ysize} exactly + in {y, ysize}, so that we can do a left shift, without + losing any information ("exact" will not change). */ if (count != 0) - mpn_lshift (y + ysize - real_ysize, y, real_ysize, count); - if (real_ysize != ysize) + mpn_lshift (y + diff_ysize, y, real_ysize, count); + if (diff_ysize > 0) { if (count == 0) - MPN_COPY_DECR (y + ysize - real_ysize, y, real_ysize); - MPN_ZERO (y, ysize - real_ysize); + mpn_copyd (y + diff_ysize, y, real_ysize); + MPN_ZERO (y, diff_ysize); } - /* for each bit shift decrease exponent of y */ - /* (This should not overflow) */ - exp = - ((ysize - real_ysize) * GMP_NUMB_BITS + count); + /* exp = negation of the total shift count, avoiding overflows. */ + exp = - ((mpfr_exp_t) diff_ysize * GMP_NUMB_BITS + count); } - else /* shift y to the right, by doing this we might lose some - bits from the result of mpn_set_str (in addition to the - characters neglected from pstr->mant) */ + else { - /* shift {y, num_limb} for (GMP_NUMB_BITS - count) bits - to the right. FIXME: can we prove that count cannot be zero here, - since mpn_rshift does not accept a shift of GMP_NUMB_BITS? */ - MPFR_ASSERTD (count != 0); - exact = mpn_rshift (y, y, real_ysize, GMP_NUMB_BITS - count) == - MPFR_LIMB_ZERO; - /* for each bit shift increase exponent of y */ - exp = GMP_NUMB_BITS - count; + /* Shift {y, real_ysize} for (GMP_NUMB_BITS - count) bits to the + right, and put the ysize most significant limbs into {y, ysize}. + We have either real_ysize = ysize + 1 or real_ysize = ysize + 2 + (only possible with extra_limbs == 2). */ + MPFR_ASSERTD (diff_ysize == -1 || + (extra_limbs == 2 && diff_ysize == -2)); + if (count != 0) + { + /* Before doing the shift, consider the limb that will entirely + be lost if real_ysize = ysize + 2. */ + exact = exact && (diff_ysize == -1 || y[0] == MPFR_LIMB_ZERO); + /* mpn_rshift allows overlap, provided destination <= source */ + /* FIXME: The bits lost due to mpn_rshift are not taken + into account in the error analysis below! */ + if (mpn_rshift (y, y - (diff_ysize + 1), real_ysize, + GMP_NUMB_BITS - count) != MPFR_LIMB_ZERO) + exact = 0; /* some non-zero bits have been shifted out */ + } + else + { + /* the case real_ysize = ysize + 2 with count = 0 cannot happen + even with GMP_NUMB_BITS = 8 since 62^2 < 256^2/2 */ + MPFR_ASSERTD (diff_ysize == -1); + exact = exact && y[0] == MPFR_LIMB_ZERO; + /* copy {y+real_ysize-ysize, ysize} to {y, ysize} */ + mpn_copyi (y, y + 1, real_ysize - 1); + } + /* exp = shift count */ + /* TODO: add some explanations about what exp means exactly. */ + exp = GMP_NUMB_BITS * (- diff_ysize) - count; } /* compute base^(exp_base - pstr_size) on n limbs */ @@ -561,6 +630,8 @@ int pow2; mpfr_exp_t tmp; + MPFR_LOG_MSG (("case 1 (base = power of 2)\n", 0)); + count_leading_zeros (pow2, (mp_limb_t) pstr->base); pow2 = GMP_NUMB_BITS - pow2 - 1; /* base = 2^pow2 */ MPFR_ASSERTD (0 < pow2 && pow2 <= 5); @@ -597,10 +668,12 @@ mp_limb_t *z; mpfr_exp_t exp_z; + MPFR_LOG_MSG (("case 2 (exp_base > pstr_size)\n", 0)); + result = MPFR_TMP_LIMBS_ALLOC (2 * ysize + 1); /* z = base^(exp_base-sptr_size) using space allocated at y-ysize */ - z = y - ysize; + z = y0; /* NOTE: exp_base-pstr_size can't overflow since pstr_size > 0 */ err = mpfr_mpn_exp (z, &exp_z, pstr->base, pstr->exp_base - pstr_size, ysize); @@ -647,8 +720,7 @@ /* if the low ysize limbs of {result, 2*ysize} are all zero, then the result is still "exact" (if it was before) */ - exact = exact && (mpn_scan1 (result, 0) - >= (unsigned long) ysize_bits); + exact = exact && (mpn_scan1 (result, 0) >= ysize_bits); result += ysize; } /* case exp_base < pstr_size */ @@ -657,11 +729,12 @@ mp_limb_t *z; mpfr_exp_t exp_z; + MPFR_LOG_MSG (("case 3 (exp_base < pstr_size)\n", 0)); + result = MPFR_TMP_LIMBS_ALLOC (3 * ysize + 1); - /* set y to y * K^ysize */ - y = y - ysize; /* we have allocated ysize limbs at y - ysize */ - MPN_ZERO (y, ysize); + /* y0 = y * K^ysize */ + MPN_ZERO (y0, ysize); /* pstr_size - pstr->exp_base can overflow */ MPFR_SADD_OVERFLOW (exp_z, (mpfr_exp_t) pstr_size, -pstr->exp_base, @@ -669,33 +742,35 @@ MPFR_EXP_MIN, MPFR_EXP_MAX, goto underflow, goto overflow); - /* (z, exp_z) = base^(exp_base-pstr_size) */ + /* (z, exp_z) = base^(pstr_size - exp_base) */ z = result + 2*ysize + 1; err = mpfr_mpn_exp (z, &exp_z, pstr->base, exp_z, ysize); - /* Since we want y/z rounded toward zero, we must get an upper - bound of z. If err >= 0, the error on z is bounded by 2^err. */ - if (err >= 0) - { - mp_limb_t cy; - unsigned long h = err / GMP_NUMB_BITS; - unsigned long l = err - h * GMP_NUMB_BITS; - - if (h >= ysize) /* not enough precision in z */ - goto next_loop; - cy = mpn_add_1 (z, z, ysize - h, MPFR_LIMB_ONE << l); - if (cy != 0) /* the code below requires z on ysize limbs */ - goto next_loop; - } - exact = exact && (err == -1); + + /* Now {z, ysize} * 2^(exp_z_out - ysize_bits) is an approximation + to base^exp_z_in (denoted b^e below), rounded toward zero, with: + * if err = -1, the result is exact; + * if err = -2, an overflow occurred in the computation of exp_z; + * otherwise the error is bounded by 2^err ulps. + Thus the exact value of b^e is between z and z + 2^err, where + z is {z, ysize} properly scaled by a power of 2. Then the error + will be: + y/b^e - trunc(y/z) = eps1 + eps2 + with + eps1 = y/b^e - y/z <= 0 + eps2 = y/z - trunc(y/z) >= 0 + thus the errors will (partly) compensate, giving a bound + max(|eps1|,|eps2|). + In addition, there is a 3rd error eps3 since y might be the + conversion of only a part of the character string, and/or y + might be truncated by the mpn_rshift call above: + eps3 = exact_y/b^e - y/b^e >= 0. + */ if (err == -2) goto underflow; /* FIXME: Sure? */ - if (err == -1) - err = 0; - - /* compute y / z */ - /* result will be put into result + n, and remainder into result */ - mpn_tdiv_qr (result + ysize, result, (mp_size_t) 0, y, - 2 * ysize, z, ysize); + else if (err == -1) + err = 0; /* see the note below */ + else + exact = 0; /* exp -= exp_z + ysize_bits with overflow checking and check that we can add/subtract 2 to exp without overflow */ @@ -707,7 +782,59 @@ mpfr_exp_t, mpfr_uexp_t, MPFR_EXP_MIN+2, MPFR_EXP_MAX-2, goto overflow, goto underflow); - err += 2; + + /* Compute the integer division y/z rounded toward zero. + The quotient will be put at result + ysize (size: ysize + 1), + and the remainder at result (size: ysize). + Both the dividend {y, 2*ysize} and the divisor {z, ysize} are + normalized, i.e., the most significant bit of their most + significant limb is 1. */ + MPFR_ASSERTD (MPFR_LIMB_MSB (y0[2 * ysize - 1]) != 0); + MPFR_ASSERTD (MPFR_LIMB_MSB (z[ysize - 1]) != 0); + mpn_tdiv_qr (result + ysize, result, (mp_size_t) 0, y0, + 2 * ysize, z, ysize); + + /* The truncation error of the mpn_tdiv_qr call (eps2 above) is at + most 1 ulp. Idem for the error eps3, which has the same sign, + thus eps2 + eps3 <= 2 ulps. + FIXME: For eps3, this is not obvious and should be explained. + For the error eps1 coming from the approximation to b^e, + we have (still up to a power-of-2 normalization): + y/z - y/b^e = y * (b^e-z) / (z * b^e) <= y * 2^err / (z * b^e). + We have to convert that error in terms of ulp(trunc(y/z)). + We first have ulp(trunc(y/z)) = ulp(y/z). + + FIXME: There must be some discussion about the exponents, + because up to a power of 2, 1/2 <= |y/z| < 1 and + 1 <= |y/z| < 2 are equivalent and give no information. + Moreover 1/2 <= b^e < 1 has not been explained and may + hide mistakes since one may have 1/2 <= z < 1 < b^e. + + Since both y and z are normalized, the quotient + {result+ysize, ysize+1} has exactly ysize limbs, plus maybe one + bit (this corresponds to the MPFR_ASSERTD below): + * if the quotient has exactly ysize limbs, then 1/2 <= |y/z| < 1 + (up to a power of 2) and since 1/2 <= b^e < 1, the error is at + most 2^(err+1) ulps; + * if the quotient has one extra bit, then 1 <= |y/z| < 2 + (up to a power of 2) and since 1/2 <= b^e < 1, the error is at + most 2^(err+2) ulps; but since we will shift the result right + below by one bit, the final error will be at most 2^(err+1) ulps + too. + + Thus the error is: + * at most 2^(err+1) ulps for eps1 + * at most 2 ulps for eps2 + eps3, which is of opposite sign + and we can bound the error by 2^(err+1) ulps in all cases. + + Note: If eps1 was 0, the error would be bounded by 2 ulps, + thus replacing err = -1 by err = 0 above was the right thing + to do, since 2^(0+1) = 2. + */ + MPFR_ASSERTD (result[2 * ysize] <= 1); + + err += 1; /* see above for the explanation of the +1 term */ + /* if the remainder of the division is zero, then the result is still "exact" if it was before */ exact = exact && (mpn_popcount (result, ysize) == 0); @@ -727,39 +854,38 @@ /* case exp_base = pstr_size: no multiplication or division needed */ else { + MPFR_LOG_MSG (("case 4 (exp_base = pstr_size)\n", 0)); + /* base^(exp-pr) = 1 nothing to compute */ result = y; err = 0; } - /* If result is exact, we still have to consider the neglected part - of the input string. For a directed rounding, in that case we could - still correctly round, since the neglected part is less than - one ulp, but that would make the code more complex, and give a - speedup for rare cases only. */ - exact = exact && (pstr_size == pstr->prec); + MPFR_LOG_MSG (("exact = %d, err = %d, precx = %Pu\n", + exact, err, precx)); /* at this point, result is an approximation rounded toward zero of the pstr_size most significant digits of pstr->mant, with equality in case exact is non-zero. */ - /* test if rounding is possible, and if so exit the loop */ - if (exact || mpfr_can_round_raw (result, ysize, - (pstr->negative) ? -1 : 1, - ysize_bits - err - 1, - MPFR_RNDN, rnd, MPFR_PREC(x))) + /* test if rounding is possible, and if so exit the loop. + Note: we also need to be able to determine the correct ternary value, + thus we use the precx + (rnd == MPFR_RNDN) trick. + For example if result = xxx...xxx111...111 and rnd = RNDN, + then we know the correct rounding is xxx...xx(x+1), but we cannot know + the correct ternary value. */ + if (exact || mpfr_round_p (result, ysize, ysize_bits - err - 1, + precx + (rnd == MPFR_RNDN))) break; - next_loop: /* update the prec for next loop */ MPFR_ZIV_NEXT (loop, prec); } /* loop */ MPFR_ZIV_FREE (loop); /* round y */ - if (mpfr_round_raw (MPFR_MANT (x), result, - ysize_bits, - pstr->negative, MPFR_PREC(x), rnd, &res )) + if (mpfr_round_raw (MPFR_MANT (x), result, ysize_bits, + pstr->negative, precx, rnd, &res)) { /* overflow when rounding y */ MPFR_MANT (x)[MPFR_LIMB_SIZE (x) - 1] = MPFR_LIMB_HIGHBIT; @@ -767,12 +893,11 @@ exp ++; } - if (res == 0) /* fix ternary value */ - { - exact = exact && (pstr_size == pstr->prec); - if (!exact) - res = (pstr->negative) ? 1 : -1; - } + /* Note: if exact <> 0, then the approximation {result, ysize} is exact, + thus no double-rounding can occur: + (a) either the ternary value res is non-zero, and it is the correct + ternary value that we should return + (b) or the ternary value res is zero, and we should return 0. */ /* Set sign of x before exp since check_range needs a valid sign */ (pstr->negative) ? MPFR_SET_NEG (x) : MPFR_SET_POS (x); @@ -805,7 +930,7 @@ static void free_parsed_string (struct parsed_string *pstr) { - (*__gmp_free_func) (pstr->mantissa, pstr->alloc); + mpfr_free_func (pstr->mantissa, pstr->alloc); } int @@ -818,11 +943,11 @@ /* For base <= 36, parsing is case-insensitive. */ MPFR_ASSERTN (base == 0 || (base >= 2 && base <= 62)); - /* If an error occured, it must return 0 */ + /* If an error occurred, it must return 0. */ MPFR_SET_ZERO (x); MPFR_SET_POS (x); - MPFR_ASSERTN (MPFR_MAX_BASE >= 62); + MPFR_STAT_STATIC_ASSERT (MPFR_MAX_BASE >= 62); res = parse_string (x, &pstr, &string, base); /* If res == 0, then it was exact (NAN or INF), so it is also the ternary value */ diff -Nru mpfr4-3.1.4/src/sub1.c mpfr4-4.0.2/src/sub1.c --- mpfr4-3.1.4/src/sub1.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/sub1.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_sub1 -- internal function to perform a "real" subtraction -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -28,18 +28,21 @@ a positive value otherwise. */ +/* TODO: check the code in case exp_b == MPFR_EXP_MAX. */ + int mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) { int sign; - mpfr_uexp_t diff_exp; + mpfr_exp_t diff_exp, exp_a, exp_b; mpfr_prec_t cancel, cancel1; mp_size_t cancel2, an, bn, cn, cn0; mp_limb_t *ap, *bp, *cp; mp_limb_t carry, bb, cc; + mpfr_prec_t aq, bq; int inexact, shift_b, shift_c, add_exp = 0; int cmp_low = 0; /* used for rounding to nearest: 0 if low(b) = low(c), - negative if low(b) < low(c), positive if low(b)>low(c) */ + negative if low(b) < low(c), positive if low(b) > low(c) */ int sh, k; MPFR_TMP_DECL(marker); @@ -47,6 +50,10 @@ ap = MPFR_MANT(a); an = MPFR_LIMB_SIZE(a); + (void) MPFR_GET_PREC (a); + (void) MPFR_GET_PREC (b); + (void) MPFR_GET_PREC (c); + sign = mpfr_cmp2 (b, c, &cancel); if (MPFR_UNLIKELY(sign == 0)) { @@ -62,7 +69,7 @@ * If subtraction: sign(a) = sign * sign(b) * If addition: sign(a) = sign of the larger argument in absolute value. * - * Both cases can be simplidied in: + * Both cases can be simplified in: * if (sign>0) * if addition: sign(a) = sign * sign(b) = sign(b) * if subtraction, b is greater, so sign(a) = sign(b) @@ -82,72 +89,106 @@ else MPFR_SET_SAME_SIGN (a,b); + if (MPFR_UNLIKELY (MPFR_IS_UBF (b) || MPFR_IS_UBF (c))) + { + exp_b = MPFR_IS_UBF (b) ? + mpfr_ubf_zexp2exp (MPFR_ZEXP (b)) : MPFR_GET_EXP (b); + diff_exp = mpfr_ubf_diff_exp (b, c); + } + else + { + exp_b = MPFR_GET_EXP (b); + diff_exp = exp_b - MPFR_GET_EXP (c); + } + MPFR_ASSERTD (diff_exp >= 0); + + aq = MPFR_GET_PREC (a); + bq = MPFR_GET_PREC (b); + /* Check if c is too small. A more precise test is to replace 2 by (rnd == MPFR_RNDN) + mpfr_power2_raw (b) but it is more expensive and not very useful */ - if (MPFR_UNLIKELY (MPFR_GET_EXP (c) <= MPFR_GET_EXP (b) - - (mpfr_exp_t) MAX (MPFR_PREC (a), MPFR_PREC (b)) - 2)) + if (MPFR_UNLIKELY (MAX (aq, bq) + 2 <= diff_exp)) { + MPFR_LOG_MSG (("case c small\n", 0)); + /* Remember, we can't have an exact result! */ /* A.AAAAAAAAAAAAAAAAA = B.BBBBBBBBBBBBBBB - C.CCCCCCCCCCCCC */ /* A = S*ABS(B) +/- ulp(a) */ - MPFR_SET_EXP (a, MPFR_GET_EXP (b)); - MPFR_RNDRAW_EVEN (inexact, a, MPFR_MANT (b), MPFR_PREC (b), + + /* since we can't have an exact result, for RNDF we can truncate b */ + if (rnd_mode == MPFR_RNDF) + return mpfr_set4 (a, b, MPFR_RNDZ, MPFR_SIGN (a)); + + MPFR_EXP (a) = exp_b; /* may be up to MPFR_EXP_MAX */ + MPFR_RNDRAW_EVEN (inexact, a, MPFR_MANT (b), bq, rnd_mode, MPFR_SIGN (a), - if (MPFR_UNLIKELY ( ++MPFR_EXP (a) > __gmpfr_emax)) - inexact = mpfr_overflow (a, rnd_mode, MPFR_SIGN (a))); - /* inexact = mpfr_set4 (a, b, rnd_mode, MPFR_SIGN (a)); */ + if (MPFR_EXP (a) != MPFR_EXP_MAX) + ++ MPFR_EXP (a)); + MPFR_LOG_MSG (("inexact=%d\n", inexact)); if (inexact == 0) { - /* a = b (Exact) - But we know it isn't (Since we have to remove `c') - So if we round to Zero, we have to remove one ulp. - Otherwise the result is correctly rounded. */ - if (MPFR_IS_LIKE_RNDZ (rnd_mode, MPFR_IS_NEG (a))) + /* a = b, but the exact value of b - c is a bit below. Then, + except for directed rounding similar to toward zero and + before overflow checking: a is the correctly rounded value + and since |b| - |c| < |a|, the ternary value value is given + by the sign of a. */ + if (! MPFR_IS_LIKE_RNDZ (rnd_mode, MPFR_IS_NEG (a))) { - mpfr_nexttozero (a); - MPFR_RET (- MPFR_INT_SIGN (a)); + inexact = MPFR_INT_SIGN (a); + goto check_overflow; } - MPFR_RET (MPFR_INT_SIGN (a)); } - else + else /* inexact != 0 */ { /* A.AAAAAAAAAAAAAA = B.BBBBBBBBBBBBBBB - C.CCCCCCCCCCCCC */ - /* It isn't exact so Prec(b) > Prec(a) and the last - Prec(b)-Prec(a) bits of `b' are not zeros. - Which means that removing c from b can't generate a carry - execpt in case of even rounding. - In all other case the result and the inexact flag should be - correct (We can't have an exact result). - In case of EVEN rounding: + /* It isn't exact, so PREC(b) > PREC(a) and the last + PREC(b)-PREC(a) bits of b are not all zeros. + Subtracting c from b will not have an effect on the rounding + except in case of a midpoint in the round-to-nearest mode, + when the even rounding was done away from zero instead of + toward zero. + In case of even rounding: 1.BBBBBBBBBBBBBx10 - 1.CCCCCCCCCCCC - = 1.BBBBBBBBBBBBBx01 Rounded to Prec(b) - = 1.BBBBBBBBBBBBBx Nearest / Rounded to Prec(a) + = 1.BBBBBBBBBBBBBx01 Rounded to PREC(b) + = 1.BBBBBBBBBBBBBx Nearest / Rounded to PREC(a) Set gives: 1.BBBBBBBBBBBBB0 if inexact == EVEN_INEX (x == 0) 1.BBBBBBBBBBBBB1+1 if inexact == -EVEN_INEX (x == 1) - which means we get a wrong rounded result if x==1, - i.e. inexact= MPFR_EVEN_INEX */ - if (MPFR_UNLIKELY (inexact == MPFR_EVEN_INEX*MPFR_INT_SIGN (a))) - { - mpfr_nexttozero (a); - inexact = -MPFR_INT_SIGN (a); - } - MPFR_RET (inexact); - } + which means we get a wrong rounded result if x == 1, + i.e. inexact == MPFR_EVEN_INEX (for positive numbers). */ + if (MPFR_LIKELY (inexact != MPFR_EVEN_INEX * MPFR_INT_SIGN (a))) + goto check_overflow; + } + /* We need to take the value preceding |a|. We can't use + mpfr_nexttozero due to a possible out-of-range exponent. + But this will allow us to have more specific code. */ + MPFR_LOG_MSG (("correcting the value of a\n", 0)); + sh = (mpfr_prec_t) an * GMP_NUMB_BITS - aq; + mpn_sub_1 (ap, ap, an, MPFR_LIMB_ONE << sh); + if (MPFR_UNLIKELY (MPFR_LIMB_MSB (ap[an-1]) == 0)) + { + MPFR_EXP (a) --; + /* The following is valid whether an = 1 or an > 1. */ + ap[an-1] |= MPFR_LIMB_HIGHBIT; + } + inexact = - MPFR_INT_SIGN (a); + check_overflow: + if (MPFR_UNLIKELY (MPFR_EXP (a) > __gmpfr_emax)) + return mpfr_overflow (a, rnd_mode, MPFR_SIGN (a)); + else + MPFR_RET (inexact); } - diff_exp = (mpfr_uexp_t) MPFR_GET_EXP (b) - MPFR_GET_EXP (c); - /* reserve a space to store b aligned with the result, i.e. shifted by (-cancel) % GMP_NUMB_BITS to the right */ - bn = MPFR_LIMB_SIZE (b); + bn = MPFR_LIMB_SIZE (b); MPFR_UNSIGNED_MINUS_MODULO (shift_b, cancel); cancel1 = (cancel + shift_b) / GMP_NUMB_BITS; @@ -169,21 +210,21 @@ } /* reserve a space to store c aligned with the result, i.e. shifted by - (diff_exp-cancel) % GMP_NUMB_BITS to the right */ - cn = MPFR_LIMB_SIZE(c); - if ((UINT_MAX % GMP_NUMB_BITS) == (GMP_NUMB_BITS-1) - && ((-(unsigned) 1)%GMP_NUMB_BITS > 0)) + (diff_exp-cancel) % GMP_NUMB_BITS to the right */ + cn = MPFR_LIMB_SIZE (c); + if (IS_POW2 (GMP_NUMB_BITS)) shift_c = ((mpfr_uexp_t) diff_exp - cancel) % GMP_NUMB_BITS; else { + /* The above operation does not work if diff_exp - cancel < 0. */ shift_c = diff_exp - (cancel % GMP_NUMB_BITS); shift_c = (shift_c + GMP_NUMB_BITS) % GMP_NUMB_BITS; } - MPFR_ASSERTD( shift_c >= 0 && shift_c < GMP_NUMB_BITS); + MPFR_ASSERTD (shift_c >= 0 && shift_c < GMP_NUMB_BITS); if (MPFR_UNLIKELY(shift_c == 0)) { - cp = MPFR_MANT(c); + cp = MPFR_MANT(c); /* Ensure ap != cp */ if (ap == cp) { @@ -197,10 +238,10 @@ cp[0] = mpn_rshift (cp + 1, MPFR_MANT(c), cn++, shift_c); } -#ifdef DEBUG - printf ("rnd=%s shift_b=%d shift_c=%d diffexp=%lu\n", - mpfr_print_rnd_mode (rnd_mode), shift_b, shift_c, - (unsigned long) diff_exp); +#if 0 + MPFR_LOG_MSG (("rnd=%s shift_b=%d shift_c=%d diffexp=%" MPFR_EXP_FSPEC + "d\n", mpfr_print_rnd_mode (rnd_mode), shift_b, shift_c, + (mpfr_eexp_t) diff_exp)); #endif MPFR_ASSERTD (ap != cp); @@ -218,7 +259,7 @@ by the multiplication code), then the computation of cancel2 could be simplified to cancel2 = (cancel - (diff_exp - shift_c)) / GMP_NUMB_BITS; - because cancel, diff_exp and shift_c are all non-negative and + because cancel, diff_exp and shift_c are all nonnegative and these variables are signed. */ MPFR_ASSERTD (cancel >= 0); @@ -230,9 +271,9 @@ else cancel2 = - (mp_size_t) ((diff_exp - cancel) / GMP_NUMB_BITS); /* the high cancel2 limbs from b should not be taken into account */ -#ifdef DEBUG - printf ("cancel=%lu cancel1=%lu cancel2=%ld\n", - (unsigned long) cancel, (unsigned long) cancel1, (long) cancel2); +#if 0 + MPFR_LOG_MSG (("cancel=%Pd cancel1=%Pd cancel2=%Pd\n", + cancel, cancel1, cancel2)); #endif /* ap[an-1] ap[0] @@ -269,10 +310,6 @@ else MPN_ZERO (ap, an); -#ifdef DEBUG - printf("after copying high(b), a="); mpfr_print_binary(a); putchar('\n'); -#endif - /* subtract high(c) */ if (MPFR_LIKELY(an + cancel2 > 0)) /* otherwise c does not overlap with a */ { @@ -314,19 +351,19 @@ } } -#ifdef DEBUG - printf("after subtracting high(c), a="); - mpfr_print_binary(a); - putchar('\n'); -#endif - /* now perform rounding */ - sh = (mpfr_prec_t) an * GMP_NUMB_BITS - MPFR_PREC(a); + sh = (mpfr_prec_t) an * GMP_NUMB_BITS - aq; /* last unused bits from a */ carry = ap[0] & MPFR_LIMB_MASK (sh); ap[0] -= carry; - if (MPFR_LIKELY(rnd_mode == MPFR_RNDN)) + if (rnd_mode == MPFR_RNDF) + { + inexact = 0; + /* truncating is always correct since -1 ulp < low(b) - low(c) < 1 ulp */ + goto truncate; + } + else if (rnd_mode == MPFR_RNDN) { if (MPFR_LIKELY(sh)) { @@ -367,9 +404,9 @@ cn0 = cn; cn -= an + cancel2; -#ifdef DEBUG - printf ("last sh=%d bits from a are %lu, bn=%ld, cn=%ld\n", - sh, (unsigned long) carry, (long) bn, (long) cn); +#if 0 + MPFR_LOG_MSG (("last sh=%d bits from a are %Mu, bn=%Pd, cn=%Pd\n", + sh, carry, (mpfr_prec_t) bn, (mpfr_prec_t) cn)); #endif /* for rounding to nearest, we couldn't conclude up to here in the following @@ -460,10 +497,10 @@ } } -#ifdef DEBUG - printf ("k=%u bb=%lu cc=%lu cmp_low=%d\n", k, - (unsigned long) bb, (unsigned long) cc, cmp_low); +#if 0 + MPFR_LOG_MSG (("k=%d bb=%Mu cc=%Mu cmp_low=%d\n", k, bb, cc, cmp_low)); #endif + if (cmp_low < 0) /* low(b) - low(c) < 0: either truncate or subtract one ulp */ { @@ -615,42 +652,49 @@ /* we have to set MPFR_EXP(a) to MPFR_EXP(b) - cancel + add_exp, taking care of underflows/overflows in that computation, and of the allowed exponent range */ + MPFR_TMP_FREE (marker); if (MPFR_LIKELY(cancel)) { - mpfr_exp_t exp_a; - cancel -= add_exp; /* OK: add_exp is an int equal to 0 or 1 */ - exp_a = MPFR_GET_EXP (b) - cancel; - if (MPFR_UNLIKELY(exp_a < __gmpfr_emin)) + exp_a = exp_b - cancel; + /* The following assertion corresponds to a limitation of the MPFR + implementation. It may fail with a 32-bit ABI and huge precisions, + but this is practically impossible with a 64-bit ABI. This kind + of issue is not specific to this function. */ + MPFR_ASSERTN (exp_b != MPFR_EXP_MAX || exp_a > __gmpfr_emax); + if (MPFR_UNLIKELY (exp_a < __gmpfr_emin)) { - MPFR_TMP_FREE(marker); + underflow: if (rnd_mode == MPFR_RNDN && (exp_a < __gmpfr_emin - 1 || (inexact >= 0 && mpfr_powerof2_raw (a)))) rnd_mode = MPFR_RNDZ; return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a)); } - MPFR_SET_EXP (a, exp_a); + if (MPFR_UNLIKELY (exp_a > __gmpfr_emax)) + { + return mpfr_overflow (a, rnd_mode, MPFR_SIGN (a)); + } } else /* cancel = 0: MPFR_EXP(a) <- MPFR_EXP(b) + add_exp */ { + /* in case cancel = 0, add_exp can still be 1, in case b is just below a power of two, c is very small, prec(a) < prec(b), and rnd=away or nearest */ - mpfr_exp_t exp_b; - - exp_b = MPFR_GET_EXP (b); - if (MPFR_UNLIKELY(add_exp && exp_b == __gmpfr_emax)) - { - MPFR_TMP_FREE(marker); - return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); - } - MPFR_SET_EXP (a, exp_b + add_exp); + MPFR_ASSERTD (add_exp == 0 || add_exp == 1); + /* Overflow iff exp_b + add_exp > __gmpfr_emax in Z, but we do + a subtraction below to avoid a potential integer overflow in + the case exp_b == MPFR_EXP_MAX. */ + if (MPFR_UNLIKELY (exp_b > __gmpfr_emax - add_exp)) + { + return mpfr_overflow (a, rnd_mode, MPFR_SIGN (a)); + } + exp_a = exp_b + add_exp; + if (MPFR_UNLIKELY (exp_a < __gmpfr_emin)) + goto underflow; } - MPFR_TMP_FREE(marker); -#ifdef DEBUG - printf ("result is a="); mpfr_print_binary(a); putchar('\n'); -#endif + MPFR_SET_EXP (a, exp_a); /* check that result is msb-normalized */ MPFR_ASSERTD(ap[an-1] > ~ap[an-1]); MPFR_RET (inexact * MPFR_INT_SIGN (a)); diff -Nru mpfr4-3.1.4/src/sub1sp.c mpfr4-4.0.2/src/sub1sp.c --- mpfr4-3.1.4/src/sub1sp.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/sub1sp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ -/* mpfr_sub1sp -- internal function to perform a "real" substraction +/* mpfr_sub1sp -- internal function to perform a "real" subtraction All the op must have the same precision -Copyright 2003-2016 Free Software Foundation, Inc. +Copyright 2003-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,22 +18,27 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" /* Check if we have to check the result of mpfr_sub1sp with mpfr_sub1 */ -#ifdef MPFR_WANT_ASSERT -# if MPFR_WANT_ASSERT >= 2 +#if MPFR_WANT_ASSERT >= 2 -int mpfr_sub1sp2 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode); +int mpfr_sub1sp_ref (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t); int mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) { mpfr_t tmpa, tmpb, tmpc; + mpfr_flags_t old_flags, flags, flags2; int inexb, inexc, inexact, inexact2; + if (rnd_mode == MPFR_RNDF) + return mpfr_sub1sp_ref (a, b, c, rnd_mode); + + old_flags = __gmpfr_flags; + mpfr_init2 (tmpa, MPFR_PREC (a)); mpfr_init2 (tmpb, MPFR_PREC (b)); mpfr_init2 (tmpc, MPFR_PREC (c)); @@ -44,40 +49,995 @@ inexc = mpfr_set (tmpc, c, MPFR_RNDN); MPFR_ASSERTN (inexc == 0); + MPFR_ASSERTN (__gmpfr_flags == old_flags); + inexact2 = mpfr_sub1 (tmpa, tmpb, tmpc, rnd_mode); - inexact = mpfr_sub1sp2(a, b, c, rnd_mode); + flags2 = __gmpfr_flags; - if (mpfr_cmp (tmpa, a) || inexact != inexact2) + __gmpfr_flags = old_flags; + inexact = mpfr_sub1sp_ref (a, b, c, rnd_mode); + flags = __gmpfr_flags; + + if (! mpfr_equal_p (tmpa, a) || inexact != inexact2 || flags != flags2) { fprintf (stderr, "sub1 & sub1sp return different values for %s\n" "Prec_a = %lu, Prec_b = %lu, Prec_c = %lu\nB = ", - mpfr_print_rnd_mode (rnd_mode), (unsigned long) MPFR_PREC (a), - (unsigned long) MPFR_PREC (b), (unsigned long) MPFR_PREC (c)); - mpfr_fprint_binary (stderr, tmpb); - fprintf (stderr, "\nC = "); - mpfr_fprint_binary (stderr, tmpc); - fprintf (stderr, "\nSub1 : "); - mpfr_fprint_binary (stderr, tmpa); - fprintf (stderr, "\nSub1sp: "); - mpfr_fprint_binary (stderr, a); - fprintf (stderr, "\nInexact sp = %d | Inexact = %d\n", - inexact, inexact2); + mpfr_print_rnd_mode (rnd_mode), + (unsigned long) MPFR_PREC (a), + (unsigned long) MPFR_PREC (b), + (unsigned long) MPFR_PREC (c)); + mpfr_fdump (stderr, tmpb); + fprintf (stderr, "C = "); + mpfr_fdump (stderr, tmpc); + fprintf (stderr, "sub1 : "); + mpfr_fdump (stderr, tmpa); + fprintf (stderr, "sub1sp: "); + mpfr_fdump (stderr, a); + fprintf (stderr, "Inexact sp = %d | Inexact = %d\n" + "Flags sp = %u | Flags = %u\n", + inexact, inexact2, flags, flags2); MPFR_ASSERTN (0); } mpfr_clears (tmpa, tmpb, tmpc, (mpfr_ptr) 0); return inexact; } -# define mpfr_sub1sp mpfr_sub1sp2 -# endif -#endif +# define mpfr_sub1sp mpfr_sub1sp_ref +#endif /* MPFR_WANT_ASSERT >= 2 */ + +#if !defined(MPFR_GENERIC_ABI) + +/* special code for p < GMP_NUMB_BITS */ +static int +mpfr_sub1sp1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode, + mpfr_prec_t p) +{ + mpfr_exp_t bx = MPFR_GET_EXP (b); + mpfr_exp_t cx = MPFR_GET_EXP (c); + mp_limb_t *ap = MPFR_MANT(a); + mp_limb_t *bp = MPFR_MANT(b); + mp_limb_t *cp = MPFR_MANT(c); + mpfr_prec_t cnt, INITIALIZED(sh); + mp_limb_t rb; /* round bit */ + mp_limb_t sb; /* sticky bit */ + mp_limb_t a0; + mp_limb_t mask; + mpfr_uexp_t d; + + MPFR_ASSERTD(p < GMP_NUMB_BITS); + + if (bx == cx) + { + a0 = bp[0] - cp[0]; + if (a0 == 0) /* result is zero */ + { + if (rnd_mode == MPFR_RNDD) + MPFR_SET_NEG(a); + else + MPFR_SET_POS(a); + MPFR_SET_ZERO(a); + MPFR_RET (0); + } + else if (a0 > bp[0]) /* borrow: |c| > |b| */ + { + MPFR_SET_OPPOSITE_SIGN (a, b); + a0 = -a0; + } + else /* bp[0] > cp[0] */ + MPFR_SET_SAME_SIGN (a, b); + + /* now a0 != 0 */ + MPFR_ASSERTD(a0 != 0); + count_leading_zeros (cnt, a0); + ap[0] = a0 << cnt; + bx -= cnt; + rb = sb = 0; + /* Note: sh is not initialized, but will not be used in this case. */ + } + else if (bx > cx) + { + MPFR_SET_SAME_SIGN (a, b); + BGreater1: + d = (mpfr_uexp_t) bx - cx; + sh = GMP_NUMB_BITS - p; + mask = MPFR_LIMB_MASK(sh); + if (d < GMP_NUMB_BITS) + { + sb = - (cp[0] << (GMP_NUMB_BITS - d)); /* neglected part of -c */ + /* Note that "a0 = bp[0] - (cp[0] >> d) - (sb != 0);" is faster + on some other machines and has no immediate dependencies for + the first subtraction. In the future, make sure that the code + is recognized as a *single* subtraction with borrow and/or use + a builtin when available (currently provided by Clang, but not + by GCC); create a new macro for that. See the TODO later. + Note also that with Clang, the constant 0 for the first + subtraction instead of a variable breaks the optimization: + https://llvm.org/bugs/show_bug.cgi?id=31754 */ + a0 = bp[0] - (sb != 0) - (cp[0] >> d); + /* a0 cannot be zero here since: + a) if d >= 2, then a0 >= 2^(w-1) - (2^(w-2)-1) with + w = GMP_NUMB_BITS, thus a0 - 1 >= 2^(w-2), + b) if d = 1, then since p < GMP_NUMB_BITS we have sb=0. + */ + MPFR_ASSERTD(a0 > 0); + count_leading_zeros (cnt, a0); + if (cnt) + a0 = (a0 << cnt) | (sb >> (GMP_NUMB_BITS - cnt)); + sb <<= cnt; + bx -= cnt; + /* sh > 0 since p < GMP_NUMB_BITS */ + MPFR_ASSERTD(sh > 0); + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (a0 & mask) ^ rb; + ap[0] = a0 & ~mask; + } + else /* d >= GMP_NUMB_BITS */ + { + if (bp[0] > MPFR_LIMB_HIGHBIT) + { + /* We compute b - ulp(b), and the remainder ulp(b) - c satisfies: + 1/2 ulp(b) < ulp(b) - c < ulp(b), thus rb = sb = 1. */ + ap[0] = bp[0] - (MPFR_LIMB_ONE << sh); + rb = 1; + } + else + { + /* Warning: since we have an exponent decrease, when + p = GMP_NUMB_BITS - 1 and d = GMP_NUMB_BITS, the round bit + corresponds to the upper bit of -c. In that case rb = 0 and + sb = 1, except when c0 = MPFR_LIMB_HIGHBIT where rb = 1 and + sb = 0. */ + rb = sh > 1 || d > GMP_NUMB_BITS || cp[0] == MPFR_LIMB_HIGHBIT; + /* sb=1 below is incorrect when p = GMP_NUMB_BITS - 1, + d = GMP_NUMB_BITS and c0 = MPFR_LIMB_HIGHBIT, but in + that case the even rule wound round up too. */ + ap[0] = ~mask; + bx --; + /* Warning: if d = GMP_NUMB_BITS and c0 = 1000...000, then + b0 - c0 = |0111...111|1000...000|, which after the shift + becomes |111...111|000...000| thus if p = GMP_NUMB_BITS-1 + we have rb = 1 but sb = 0. However in this case the round + even rule will round up, which is what we get with sb = 1: + the final result will be correct, while sb is incorrect. */ + } + sb = 1; + } + } + else /* cx > bx */ + { + mpfr_exp_t tx; + mp_limb_t *tp; + tx = bx; bx = cx; cx = tx; + tp = bp; bp = cp; cp = tp; + MPFR_SET_OPPOSITE_SIGN (a, b); + goto BGreater1; + } + + /* now perform rounding */ + + /* Warning: MPFR considers underflow *after* rounding with an unbounded + exponent range. However since b and c have same precision p, they are + multiples of 2^(emin-p), likewise for b-c. Thus if bx < emin, the + subtraction (with an unbounded exponent range) is exact, so that bx is + also the exponent after rounding with an unbounded exponent range. */ + if (MPFR_UNLIKELY(bx < __gmpfr_emin)) + { + /* For RNDN, mpfr_underflow always rounds away, thus for |a| <= 2^(emin-2) + we have to change to RNDZ. This corresponds to: + (a) either bx < emin - 1 + (b) or bx = emin - 1 and ap[0] = 1000....000 (in this case necessarily + rb = sb = 0 since b-c is multiple of 2^(emin-p) */ + if (rnd_mode == MPFR_RNDN && + (bx < __gmpfr_emin - 1 || ap[0] == MPFR_LIMB_HIGHBIT)) + { + MPFR_ASSERTD(rb == 0 && sb == 0); + rnd_mode = MPFR_RNDZ; + } + return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a)); + } + + MPFR_SET_EXP (a, bx); + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + MPFR_RET (0); + else if (rnd_mode == MPFR_RNDN) + { + if (rb == 0 || (sb == 0 && (ap[0] & (MPFR_LIMB_ONE << sh)) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(a))) + { + truncate: + MPFR_RET(-MPFR_SIGN(a)); + } + else /* round away from zero */ + { + add_one_ulp: + ap[0] += MPFR_LIMB_ONE << sh; + if (MPFR_UNLIKELY(ap[0] == 0)) + { + ap[0] = MPFR_LIMB_HIGHBIT; + /* Note: bx+1 cannot exceed __gmpfr_emax, since |a| <= |b|, thus + bx+1 is at most equal to the original exponent of b. */ + MPFR_ASSERTD(bx + 1 <= __gmpfr_emax); + MPFR_SET_EXP (a, bx + 1); + } + MPFR_RET(MPFR_SIGN(a)); + } +} + +/* special code for p = GMP_NUMB_BITS */ +static int +mpfr_sub1sp1n (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) +{ + mpfr_exp_t bx = MPFR_GET_EXP (b); + mpfr_exp_t cx = MPFR_GET_EXP (c); + mp_limb_t *ap = MPFR_MANT(a); + mp_limb_t *bp = MPFR_MANT(b); + mp_limb_t *cp = MPFR_MANT(c); + mpfr_prec_t cnt; + mp_limb_t rb; /* round bit */ + mp_limb_t sb; /* sticky bit */ + mp_limb_t a0; + mpfr_uexp_t d; + + MPFR_ASSERTD(MPFR_PREC(a) == GMP_NUMB_BITS); + MPFR_ASSERTD(MPFR_PREC(b) == GMP_NUMB_BITS); + MPFR_ASSERTD(MPFR_PREC(c) == GMP_NUMB_BITS); + + if (bx == cx) + { + a0 = bp[0] - cp[0]; + if (a0 == 0) /* result is zero */ + { + if (rnd_mode == MPFR_RNDD) + MPFR_SET_NEG(a); + else + MPFR_SET_POS(a); + MPFR_SET_ZERO(a); + MPFR_RET (0); + } + else if (a0 > bp[0]) /* borrow: |c| > |b| */ + { + MPFR_SET_OPPOSITE_SIGN (a, b); + a0 = -a0; + } + else /* bp[0] > cp[0] */ + MPFR_SET_SAME_SIGN (a, b); + + /* now a0 != 0 */ + MPFR_ASSERTD(a0 != 0); + count_leading_zeros (cnt, a0); + ap[0] = a0 << cnt; + bx -= cnt; + rb = sb = 0; + } + else if (bx > cx) + { + MPFR_SET_SAME_SIGN (a, b); + BGreater1: + d = (mpfr_uexp_t) bx - cx; + if (d < GMP_NUMB_BITS) + { + sb = - (cp[0] << (GMP_NUMB_BITS - d)); /* neglected part of -c */ + a0 = bp[0] - (sb != 0) - (cp[0] >> d); + /* a0 can only be zero when d=1, b0 = B/2, and c0 = B-1, where + B = 2^GMP_NUMB_BITS, thus b0 - c0/2 = 1/2 */ + if (a0 == MPFR_LIMB_ZERO) + { + bx -= GMP_NUMB_BITS; + ap[0] = MPFR_LIMB_HIGHBIT; + rb = sb = 0; + } + else + { + count_leading_zeros (cnt, a0); + if (cnt) + a0 = (a0 << cnt) | (sb >> (GMP_NUMB_BITS - cnt)); + sb <<= cnt; + bx -= cnt; + rb = sb & MPFR_LIMB_HIGHBIT; + sb &= ~MPFR_LIMB_HIGHBIT; + ap[0] = a0; + } + } + else /* d >= GMP_NUMB_BITS */ + { + /* We compute b - ulp(b) */ + if (bp[0] > MPFR_LIMB_HIGHBIT) + { + /* If d = GMP_NUMB_BITS, rb = 0 and sb = 1, + unless c0 = MPFR_LIMB_HIGHBIT in which case rb = 1 and sb = 0. + If d > GMP_NUMB_BITS, rb = sb = 1. */ + rb = d > GMP_NUMB_BITS || cp[0] == MPFR_LIMB_HIGHBIT; + sb = d > GMP_NUMB_BITS || cp[0] != MPFR_LIMB_HIGHBIT; + ap[0] = bp[0] - MPFR_LIMB_ONE; + } + else + { + /* Warning: in this case a0 is shifted by one! + If d=GMP_NUMB_BITS: + (a) if c0 = MPFR_LIMB_HIGHBIT, a0 = 111...111, rb = sb = 0 + (b) otherwise, a0 = 111...110, rb = -c0 >= 01000...000, + sb = (-c0) << 2 + If d=GMP_NUMB_BITS+1: a0 = 111...111 + (c) if c0 = MPFR_LIMB_HIGHBIT, rb = 1 and sb = 0 + (d) otherwise rb = 0 and sb = 1 + If d > GMP_NUMB_BITS+1: + (e) a0 = 111...111, rb = sb = 1 + */ + bx --; + if (d == GMP_NUMB_BITS && cp[0] > MPFR_LIMB_HIGHBIT) + { /* case (b) */ + rb = (-cp[0]) >= (MPFR_LIMB_HIGHBIT >> 1); + sb = (-cp[0]) << 2; + ap[0] = -(MPFR_LIMB_ONE << 1); + } + else /* cases (a), (c), (d) and (e) */ + { + /* rb=1 in case (e) and case (c) */ + rb = d > GMP_NUMB_BITS + 1 + || (d == GMP_NUMB_BITS + 1 && cp[0] == MPFR_LIMB_HIGHBIT); + /* sb = 1 in case (d) and (e) */ + sb = d > GMP_NUMB_BITS + 1 + || (d == GMP_NUMB_BITS + 1 && cp[0] > MPFR_LIMB_HIGHBIT); + /* Warning: only set ap[0] last, otherwise in case ap=cp, + the above comparisons involving cp[0] would be wrong */ + ap[0] = -MPFR_LIMB_ONE; + } + } + } + } + else /* cx > bx */ + { + mpfr_exp_t tx; + mp_limb_t *tp; + tx = bx; bx = cx; cx = tx; + tp = bp; bp = cp; cp = tp; + MPFR_SET_OPPOSITE_SIGN (a, b); + goto BGreater1; + } + + /* now perform rounding */ + + /* Warning: MPFR considers underflow *after* rounding with an unbounded + exponent range. However since b and c have same precision p, they are + multiples of 2^(emin-p), likewise for b-c. Thus if bx < emin, the + subtraction (with an unbounded exponent range) is exact, so that bx is + also the exponent after rounding with an unbounded exponent range. */ + if (MPFR_UNLIKELY(bx < __gmpfr_emin)) + { + /* For RNDN, mpfr_underflow always rounds away, thus for |a| <= 2^(emin-2) + we have to change to RNDZ. This corresponds to: + (a) either bx < emin - 1 + (b) or bx = emin - 1 and ap[0] = 1000....000 (in this case necessarily + rb = sb = 0 since b-c is multiple of 2^(emin-p) */ + if (rnd_mode == MPFR_RNDN && + (bx < __gmpfr_emin - 1 || ap[0] == MPFR_LIMB_HIGHBIT)) + { + MPFR_ASSERTD(rb == 0 && sb == 0); + rnd_mode = MPFR_RNDZ; + } + return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a)); + } + + MPFR_SET_EXP (a, bx); + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + MPFR_RET (0); + else if (rnd_mode == MPFR_RNDN) + { + if (rb == 0 || (sb == 0 && (ap[0] & MPFR_LIMB_ONE) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(a))) + { + truncate: + MPFR_RET(-MPFR_SIGN(a)); + } + else /* round away from zero */ + { + add_one_ulp: + ap[0] += MPFR_LIMB_ONE; + if (MPFR_UNLIKELY(ap[0] == 0)) + { + ap[0] = MPFR_LIMB_HIGHBIT; + /* Note: bx+1 cannot exceed __gmpfr_emax, since |a| <= |b|, thus + bx+1 is at most equal to the original exponent of b. */ + MPFR_ASSERTD(bx + 1 <= __gmpfr_emax); + MPFR_SET_EXP (a, bx + 1); + } + MPFR_RET(MPFR_SIGN(a)); + } +} + +/* special code for GMP_NUMB_BITS < p < 2*GMP_NUMB_BITS */ +static int +mpfr_sub1sp2 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode, + mpfr_prec_t p) +{ + mpfr_exp_t bx = MPFR_GET_EXP (b); + mpfr_exp_t cx = MPFR_GET_EXP (c); + mp_limb_t *ap = MPFR_MANT(a); + mp_limb_t *bp = MPFR_MANT(b); + mp_limb_t *cp = MPFR_MANT(c); + mpfr_prec_t cnt, INITIALIZED(sh); + mp_limb_t rb; /* round bit */ + mp_limb_t sb; /* sticky bit */ + mp_limb_t mask, a0, a1; + mpfr_uexp_t d; + + MPFR_ASSERTD(GMP_NUMB_BITS < p && p < 2 * GMP_NUMB_BITS); + + if (bx == cx) /* subtraction is exact in this case */ + { + /* first compute a0: if the compiler is smart enough, it will use the generated + borrow to get for free the term (bp[0] < cp[0]) */ + a0 = bp[0] - cp[0]; + a1 = bp[1] - cp[1] - (bp[0] < cp[0]); + if (a1 == 0 && a0 == 0) /* result is zero */ + { + if (rnd_mode == MPFR_RNDD) + MPFR_SET_NEG(a); + else + MPFR_SET_POS(a); + MPFR_SET_ZERO(a); + MPFR_RET (0); + } + else if (a1 >= bp[1]) /* borrow: |c| > |b| */ + { + MPFR_SET_OPPOSITE_SIGN (a, b); + /* a = b-c mod 2^(2*GMP_NUMB_BITS) */ + a0 = -a0; + a1 = -a1 - (a0 != 0); + } + else /* bp[0] > cp[0] */ + MPFR_SET_SAME_SIGN (a, b); + + if (a1 == 0) + { + a1 = a0; + a0 = 0; + bx -= GMP_NUMB_BITS; + } + + /* now a1 != 0 */ + MPFR_ASSERTD(a1 != 0); + count_leading_zeros (cnt, a1); + if (cnt) + { + ap[1] = (a1 << cnt) | (a0 >> (GMP_NUMB_BITS - cnt)); + ap[0] = a0 << cnt; + bx -= cnt; + } + else + { + ap[1] = a1; + ap[0] = a0; + } + rb = sb = 0; + /* Note: sh is not initialized, but will not be used in this case. */ + } + else if (bx > cx) + { + mp_limb_t t; -/* Debugging support */ -#ifdef DEBUG -# undef DEBUG -# define DEBUG(x) (x) + MPFR_SET_SAME_SIGN (a, b); + BGreater2: + d = (mpfr_uexp_t) bx - cx; + sh = 2 * GMP_NUMB_BITS - p; + mask = MPFR_LIMB_MASK(sh); + if (d < GMP_NUMB_BITS) + { + t = (cp[1] << (GMP_NUMB_BITS - d)) | (cp[0] >> d); + /* TODO: Change the code to generate a full subtraction with borrow, + avoiding the test on sb and the corresponding correction. Note + that Clang has builtins: + http://clang.llvm.org/docs/LanguageExtensions.html#multiprecision-arithmetic-builtins + but the generated code may not be good: + https://llvm.org/bugs/show_bug.cgi?id=20748 + With the current source code, Clang generates on x86_64: + 1. sub %rsi,%rbx for the first subtraction in a1; + 2. sub %rdi,%rax for the subtraction in a0; + 3. sbb $0x0,%rbx for the second subtraction in a1, i.e. just + subtracting the borrow out from (2). + So, Clang recognizes the borrow, but doesn't merge (1) and (3). + Bug: https://llvm.org/bugs/show_bug.cgi?id=25858 + For GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79173 + */ +#ifndef MPFR_FULLSUB + a0 = bp[0] - t; + a1 = bp[1] - (cp[1] >> d) - (bp[0] < t); + sb = cp[0] << (GMP_NUMB_BITS - d); /* neglected part of c */ + if (sb) + { + a1 -= (a0 == 0); + a0 --; + /* a = a1,a0 cannot become zero here, since: + a) if d >= 2, then a1 >= 2^(w-1) - (2^(w-2)-1) with + w = GMP_NUMB_BITS, thus a1 - 1 >= 2^(w-2), + b) if d = 1, then since p < 2*GMP_NUMB_BITS we have sb=0. */ + MPFR_ASSERTD(a1 > 0 || a0 > 0); + sb = -sb; /* 2^GMP_NUMB_BITS - sb */ + } #else -# define DEBUG(x) /**/ + sb = - (cp[0] << (GMP_NUMB_BITS - d)); + a0 = bp[0] - t - (sb != 0); + a1 = bp[1] - (cp[1] >> d) - (bp[0] < t || (bp[0] == t && sb != 0)); #endif + if (a1 == 0) + { + /* this implies d=1, which in turn implies sb=0 */ + MPFR_ASSERTD(sb == 0); + a1 = a0; + a0 = 0; /* should be a0 = sb */ + /* since sb=0 already, no need to set it to 0 */ + bx -= GMP_NUMB_BITS; + } + /* now a1 != 0 */ + MPFR_ASSERTD(a1 != 0); + count_leading_zeros (cnt, a1); + if (cnt) + { + ap[1] = (a1 << cnt) | (a0 >> (GMP_NUMB_BITS - cnt)); + a0 = (a0 << cnt) | (sb >> (GMP_NUMB_BITS - cnt)); + sb <<= cnt; + bx -= cnt; + } + else + ap[1] = a1; + /* sh > 0 since p < 2*GMP_NUMB_BITS */ + MPFR_ASSERTD(sh > 0); + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (a0 & mask) ^ rb; + ap[0] = a0 & ~mask; + } + else if (d < 2 * GMP_NUMB_BITS) + { /* GMP_NUMB_BITS <= d < 2*GMP_NUMB_BITS */ + /* warning: the most significant bit of sb might become the least + significant bit of a0 below */ + sb = (d == GMP_NUMB_BITS) ? cp[0] + : (cp[1] << (2*GMP_NUMB_BITS - d)) | (cp[0] != 0); + t = (cp[1] >> (d - GMP_NUMB_BITS)) + (sb != 0); + /* warning: t might overflow to 0 if d=GMP_NUMB_BITS and sb <> 0 */ + a0 = bp[0] - t; + a1 = bp[1] - (bp[0] < t) - (t == 0 && sb != 0); + sb = -sb; + /* since bp[1] has its most significant bit set, we can have an + exponent decrease of at most one */ + if (a1 < MPFR_LIMB_HIGHBIT) + { + ap[1] = (a1 << 1) | (a0 >> (GMP_NUMB_BITS - 1)); + a0 = (a0 << 1) | (sb >> (GMP_NUMB_BITS - 1)); + sb <<= 1; + bx --; + } + else + ap[1] = a1; + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (a0 & mask) ^ rb; + ap[0] = a0 & ~mask; + } + else /* d >= 2*GMP_NUMB_BITS */ + { + /* We compute b - ulp(b), and the remainder ulp(b) - c satisfies: + 1/2 ulp(b) < ulp(b) - c < ulp(b), thus rb = sb = 1, unless we + had an exponent decrease. */ + t = MPFR_LIMB_ONE << sh; + a0 = bp[0] - t; + a1 = bp[1] - (bp[0] < t); + if (a1 < MPFR_LIMB_HIGHBIT) + { + /* necessarily we had b = 1000...000 */ + /* Warning: since we have an exponent decrease, when + p = 2*GMP_NUMB_BITS - 1 and d = 2*GMP_NUMB_BITS, the round bit + corresponds to the upper bit of -c. In that case rb = 0 and + sb = 1, except when c = 1000...000 where rb = 1 and sb = 0. */ + rb = sh > 1 || d > 2 * GMP_NUMB_BITS + || (cp[1] == MPFR_LIMB_HIGHBIT && cp[0] == MPFR_LIMB_ZERO); + /* sb=1 below is incorrect when p = 2*GMP_NUMB_BITS - 1, + d = 2*GMP_NUMB_BITS and c = 1000...000, but in + that case the even rule wound round up too. */ + ap[0] = ~mask; + ap[1] = MPFR_LIMB_MAX; + bx --; + } + else + { + ap[0] = a0; + ap[1] = a1; + rb = 1; + } + sb = 1; + } + } + else /* cx > bx */ + { + mpfr_exp_t tx; + mp_limb_t *tp; + tx = bx; bx = cx; cx = tx; + tp = bp; bp = cp; cp = tp; + MPFR_SET_OPPOSITE_SIGN (a, b); + goto BGreater2; + } + + /* now perform rounding */ + + /* Warning: MPFR considers underflow *after* rounding with an unbounded + exponent range. However since b and c have same precision p, they are + multiples of 2^(emin-p), likewise for b-c. Thus if bx < emin, the + subtraction (with an unbounded exponent range) is exact, so that bx is + also the exponent after rounding with an unbounded exponent range. */ + if (MPFR_UNLIKELY(bx < __gmpfr_emin)) + { + /* for RNDN, mpfr_underflow always rounds away, thus for |a|<=2^(emin-2) + we have to change to RNDZ */ + if (rnd_mode == MPFR_RNDN && + (bx < __gmpfr_emin - 1 || + (ap[1] == MPFR_LIMB_HIGHBIT && ap[0] == 0))) + rnd_mode = MPFR_RNDZ; + return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a)); + } + + MPFR_SET_EXP (a, bx); + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + MPFR_RET (0); + else if (rnd_mode == MPFR_RNDN) + { + if (rb == 0 || (sb == 0 && (ap[0] & (MPFR_LIMB_ONE << sh)) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(a))) + { + truncate: + MPFR_RET(-MPFR_SIGN(a)); + } + else /* round away from zero */ + { + add_one_ulp: + ap[0] += MPFR_LIMB_ONE << sh; + ap[1] += (ap[0] == 0); + if (MPFR_UNLIKELY(ap[1] == 0)) + { + ap[1] = MPFR_LIMB_HIGHBIT; + /* Note: bx+1 cannot exceed __gmpfr_emax, since |a| <= |b|, thus + bx+1 is at most equal to the original exponent of b. */ + MPFR_ASSERTD(bx + 1 <= __gmpfr_emax); + MPFR_SET_EXP (a, bx + 1); + } + MPFR_RET(MPFR_SIGN(a)); + } +} + +/* special code for 2*GMP_NUMB_BITS < p < 3*GMP_NUMB_BITS */ +static int +mpfr_sub1sp3 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode, + mpfr_prec_t p) +{ + mpfr_exp_t bx = MPFR_GET_EXP (b); + mpfr_exp_t cx = MPFR_GET_EXP (c); + mp_limb_t *ap = MPFR_MANT(a); + mp_limb_t *bp = MPFR_MANT(b); + mp_limb_t *cp = MPFR_MANT(c); + mpfr_prec_t cnt, INITIALIZED(sh); + mp_limb_t rb; /* round bit */ + mp_limb_t sb; /* sticky bit */ + mp_limb_t mask, a0, a1, a2; + mpfr_uexp_t d; + + MPFR_ASSERTD(2 * GMP_NUMB_BITS < p && p < 3 * GMP_NUMB_BITS); + + if (bx == cx) /* subtraction is exact in this case */ + { + a0 = bp[0] - cp[0]; + a1 = bp[1] - cp[1] - (bp[0] < cp[0]); + /* a borrow is generated for a when either bp[1] < cp[1], + or bp[1] = cp[1] and bp[0] < cp[0] */ + a2 = bp[2] - cp[2] + - (bp[1] < cp[1] || (bp[1] == cp[1] && bp[0] < cp[0])); + if (a2 == 0 && a1 == 0 && a0 == 0) /* result is zero */ + { + if (rnd_mode == MPFR_RNDD) + MPFR_SET_NEG(a); + else + MPFR_SET_POS(a); + MPFR_SET_ZERO(a); + MPFR_RET (0); + } + else if (a2 >= bp[2]) /* borrow: |c| > |b| */ + { + MPFR_SET_OPPOSITE_SIGN (a, b); + /* a = b-c mod 2^(3*GMP_NUMB_BITS) */ + a0 = -a0; + a1 = -a1 - (a0 != 0); + a2 = -a2 - (a0 != 0 || a1 != 0); + } + else /* bp[0] > cp[0] */ + MPFR_SET_SAME_SIGN (a, b); + + if (a2 == 0) + { + a2 = a1; + a1 = a0; + a0 = 0; + bx -= GMP_NUMB_BITS; + if (a2 == 0) + { + a2 = a1; + a1 = 0; + bx -= GMP_NUMB_BITS; + } + } + + /* now a2 != 0 */ + MPFR_ASSERTD(a2 != 0); + count_leading_zeros (cnt, a2); + if (cnt) + { + ap[2] = (a2 << cnt) | (a1 >> (GMP_NUMB_BITS - cnt)); + ap[1] = (a1 << cnt) | (a0 >> (GMP_NUMB_BITS - cnt)); + ap[0] = a0 << cnt; + bx -= cnt; + } + else + { + ap[2] = a2; + ap[1] = a1; + ap[0] = a0; + } + rb = sb = 0; + /* Note: sh is not initialized, but will not be used in this case. */ + } + else if (bx > cx) + { + MPFR_SET_SAME_SIGN (a, b); + BGreater2: + d = (mpfr_uexp_t) bx - cx; + sh = 3 * GMP_NUMB_BITS - p; + mask = MPFR_LIMB_MASK(sh); + if (d < GMP_NUMB_BITS) + { + mp_limb_t cy; + /* warning: we must have the most significant bit of sb correct + since it might become the round bit below */ + sb = cp[0] << (GMP_NUMB_BITS - d); /* neglected part of c */ + a0 = bp[0] - ((cp[1] << (GMP_NUMB_BITS - d)) | (cp[0] >> d)); + a1 = bp[1] - ((cp[2] << (GMP_NUMB_BITS - d)) | (cp[1] >> d)) + - (a0 > bp[0]); + cy = a1 > bp[1] || (a1 == bp[1] && a0 > bp[0]); /* borrow in a1 */ + a2 = bp[2] - (cp[2] >> d) - cy; + /* if sb is non-zero, subtract 1 from a2, a1, a0 since we want a + non-negative neglected part */ + if (sb) + { + a2 -= (a1 == 0 && a0 == 0); + a1 -= (a0 == 0); + a0 --; + /* a = a2,a1,a0 cannot become zero here, since: + a) if d >= 2, then a2 >= 2^(w-1) - (2^(w-2)-1) with + w = GMP_NUMB_BITS, thus a2 - 1 >= 2^(w-2), + b) if d = 1, then since p < 3*GMP_NUMB_BITS we have sb=0. */ + MPFR_ASSERTD(a2 > 0 || a1 > 0 || a0 > 0); + sb = -sb; /* 2^GMP_NUMB_BITS - sb */ + } + if (a2 == 0) + { + /* this implies d=1, which in turn implies sb=0 */ + MPFR_ASSERTD(sb == 0); + a2 = a1; + a1 = a0; + a0 = 0; /* should be a0 = sb */ + /* since sb=0 already, no need to set it to 0 */ + bx -= GMP_NUMB_BITS; + if (a2 == 0) + { + a2 = a1; + a1 = 0; /* should be a1 = a0 */ + bx -= GMP_NUMB_BITS; + } + } + /* now a1 != 0 */ + MPFR_ASSERTD(a2 != 0); + count_leading_zeros (cnt, a2); + if (cnt) + { + ap[2] = (a2 << cnt) | (a1 >> (GMP_NUMB_BITS - cnt)); + ap[1] = (a1 << cnt) | (a0 >> (GMP_NUMB_BITS - cnt)); + a0 = (a0 << cnt) | (sb >> (GMP_NUMB_BITS - cnt)); + sb <<= cnt; + bx -= cnt; + } + else + { + ap[2] = a2; + ap[1] = a1; + } + /* sh > 0 since p < 2*GMP_NUMB_BITS */ + MPFR_ASSERTD(sh > 0); + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (a0 & mask) ^ rb; + ap[0] = a0 & ~mask; + } + else if (d < 2 * GMP_NUMB_BITS) + { + mp_limb_t c0shifted; + /* warning: we must have the most significant bit of sb correct + since it might become the round bit below */ + sb = (d == GMP_NUMB_BITS) ? cp[0] + : (cp[1] << (2*GMP_NUMB_BITS - d)) | (cp[0] != 0); + c0shifted = (d == GMP_NUMB_BITS) ? cp[1] + : (cp[2] << (2*GMP_NUMB_BITS-d)) | (cp[1] >> (d - GMP_NUMB_BITS)); + a0 = bp[0] - c0shifted; + /* TODO: add a non-regression test for cp[2] == MPFR_LIMB_MAX, + d == GMP_NUMB_BITS and a0 > bp[0]. */ + a1 = bp[1] - (cp[2] >> (d - GMP_NUMB_BITS)) - (a0 > bp[0]); + a2 = bp[2] - (a1 > bp[1] || (a1 == bp[1] && a0 > bp[0])); + /* if sb is non-zero, subtract 1 from a2, a1, a0 since we want a + non-negative neglected part */ + if (sb) + { + a2 -= (a1 == 0 && a0 == 0); + a1 -= (a0 == 0); + a0 --; + /* a = a2,a1,a0 cannot become zero here, since: + a) if d >= 2, then a2 >= 2^(w-1) - (2^(w-2)-1) with + w = GMP_NUMB_BITS, thus a2 - 1 >= 2^(w-2), + b) if d = 1, then since p < 3*GMP_NUMB_BITS we have sb=0. */ + MPFR_ASSERTD(a2 > 0 || a1 > 0 || a0 > 0); + sb = -sb; /* 2^GMP_NUMB_BITS - sb */ + } + /* since bp[2] has its most significant bit set, we can have an + exponent decrease of at most one */ + if (a2 < MPFR_LIMB_HIGHBIT) + { + ap[2] = (a2 << 1) | (a1 >> (GMP_NUMB_BITS - 1)); + ap[1] = (a1 << 1) | (a0 >> (GMP_NUMB_BITS - 1)); + a0 = (a0 << 1) | (sb >> (GMP_NUMB_BITS - 1)); + sb <<= 1; + bx --; + } + else + { + ap[2] = a2; + ap[1] = a1; + } + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (a0 & mask) ^ rb; + ap[0] = a0 & ~mask; + } + else if (d < 3 * GMP_NUMB_BITS) /* 2*GMP_NUMB_BITS<=d<3*GMP_NUMB_BITS */ + { + MPFR_ASSERTD (2*GMP_NUMB_BITS <= d && d < 3*GMP_NUMB_BITS); + /* warning: we must have the most significant bit of sb correct + since it might become the round bit below */ + if (d == 2 * GMP_NUMB_BITS) + sb = cp[1] | (cp[0] != 0); + else + sb = cp[2] << (3*GMP_NUMB_BITS - d) | (cp[1] != 0) | (cp[0] != 0); + sb = -sb; + /* TODO: add a non-regression test for cp[2] == MPFR_LIMB_MAX, + d == 2*GMP_NUMB_BITS and sb != 0. */ + a0 = bp[0] - (cp[2] >> (d - 2*GMP_NUMB_BITS)) - (sb != 0); + a1 = bp[1] - (a0 > bp[0] || (a0 == bp[0] && sb != 0)); + a2 = bp[2] - (a1 > bp[1]); + if (a2 < MPFR_LIMB_HIGHBIT) + { + ap[2] = (a2 << 1) | (a1 >> (GMP_NUMB_BITS - 1)); + ap[1] = (a1 << 1) | (a0 >> (GMP_NUMB_BITS - 1)); + a0 = (a0 << 1) | (sb >> (GMP_NUMB_BITS - 1)); + sb <<= 1; + bx --; + } + else + { + ap[2] = a2; + ap[1] = a1; + } + rb = a0 & (MPFR_LIMB_ONE << (sh - 1)); + sb |= (a0 & mask) ^ rb; + ap[0] = a0 & ~mask; + } + else /* d >= 3*GMP_NUMB_BITS */ + { + /* We compute b - ulp(b), and the remainder ulp(b) - c satisfies: + 1/2 ulp(b) < ulp(b) - c < ulp(b), thus rb = sb = 1. */ + mp_limb_t t = MPFR_LIMB_ONE << sh; + a0 = bp[0] - t; + a1 = bp[1] - (bp[0] < t); + a2 = bp[2] - (a1 > bp[1]); + if (a2 < MPFR_LIMB_HIGHBIT) + { + /* necessarily we had b = 1000...000 */ + /* Warning: since we have an exponent decrease, when + p = 3*GMP_NUMB_BITS - 1 and d = 3*GMP_NUMB_BITS, the round bit + corresponds to the upper bit of -c. In that case rb = 0 and + sb = 1, except when c = 1000...000 where rb = 1 and sb = 0. */ + rb = sh > 1 || d > 3 * GMP_NUMB_BITS + || (cp[2] == MPFR_LIMB_HIGHBIT && cp[1] == MPFR_LIMB_ZERO && + cp[0] == MPFR_LIMB_ZERO); + /* sb=1 below is incorrect when p = 2*GMP_NUMB_BITS - 1, + d = 2*GMP_NUMB_BITS and c = 1000...000, but in + that case the even rule wound round up too. */ + ap[0] = ~mask; + ap[1] = MPFR_LIMB_MAX; + ap[2] = MPFR_LIMB_MAX; + bx --; + } + else + { + ap[0] = a0; + ap[1] = a1; + ap[2] = a2; + rb = 1; + } + sb = 1; + } + } + else /* cx > bx */ + { + mpfr_exp_t tx; + mp_limb_t *tp; + tx = bx; bx = cx; cx = tx; + tp = bp; bp = cp; cp = tp; + MPFR_SET_OPPOSITE_SIGN (a, b); + goto BGreater2; + } + + /* now perform rounding */ + + /* Warning: MPFR considers underflow *after* rounding with an unbounded + exponent range. However since b and c have same precision p, they are + multiples of 2^(emin-p), likewise for b-c. Thus if bx < emin, the + subtraction (with an unbounded exponent range) is exact, so that bx is + also the exponent after rounding with an unbounded exponent range. */ + if (MPFR_UNLIKELY(bx < __gmpfr_emin)) + { + /* for RNDN, mpfr_underflow always rounds away, thus for |a|<=2^(emin-2) + we have to change to RNDZ */ + if (rnd_mode == MPFR_RNDN && + (bx < __gmpfr_emin - 1 || + (ap[2] == MPFR_LIMB_HIGHBIT && ap[1] == 0 && ap[0] == 0))) + rnd_mode = MPFR_RNDZ; + return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a)); + } + + MPFR_SET_EXP (a, bx); + if ((rb == 0 && sb == 0) || rnd_mode == MPFR_RNDF) + MPFR_RET (0); + else if (rnd_mode == MPFR_RNDN) + { + if (rb == 0 || (sb == 0 && (ap[0] & (MPFR_LIMB_ONE << sh)) == 0)) + goto truncate; + else + goto add_one_ulp; + } + else if (MPFR_IS_LIKE_RNDZ(rnd_mode, MPFR_IS_NEG(a))) + { + truncate: + MPFR_RET(-MPFR_SIGN(a)); + } + else /* round away from zero */ + { + add_one_ulp: + ap[0] += MPFR_LIMB_ONE << sh; + ap[1] += (ap[0] == 0); + ap[2] += (ap[1] == 0 && ap[0] == 0); + if (MPFR_UNLIKELY(ap[2] == 0)) + { + ap[2] = MPFR_LIMB_HIGHBIT; + /* Note: bx+1 cannot exceed __gmpfr_emax, since |a| <= |b|, thus + bx+1 is at most equal to the original exponent of b. */ + MPFR_ASSERTD(bx + 1 <= __gmpfr_emax); + MPFR_SET_EXP (a, bx + 1); + } + MPFR_RET(MPFR_SIGN(a)); + } +} + +#endif /* !defined(MPFR_GENERIC_ABI) */ /* Rounding Sub */ @@ -131,10 +1091,10 @@ * */ -int +MPFR_HOT_FUNCTION_ATTR int mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) { - mpfr_exp_t bx,cx; + mpfr_exp_t bx, cx; mpfr_uexp_t d; mpfr_prec_t p, sh, cnt; mp_size_t n; @@ -142,34 +1102,54 @@ mp_limb_t limb; int inexact; mp_limb_t bcp,bcp1; /* Cp and C'p+1 */ - mp_limb_t bbcp = (mp_limb_t) -1, bbcp1 = (mp_limb_t) -1; /* Cp+1 and C'p+2, + mp_limb_t bbcp = MPFR_LIMB_MAX, bbcp1 = MPFR_LIMB_MAX; /* Cp+1 and C'p+2, gcc claims that they might be used uninitialized. We fill them with invalid values, which should produce a failure if so. See README.dev file. */ MPFR_TMP_DECL(marker); - MPFR_TMP_MARK(marker); - MPFR_ASSERTD(MPFR_PREC(a) == MPFR_PREC(b) && MPFR_PREC(b) == MPFR_PREC(c)); MPFR_ASSERTD(MPFR_IS_PURE_FP(b)); MPFR_ASSERTD(MPFR_IS_PURE_FP(c)); /* Read prec and num of limbs */ - p = MPFR_PREC (b); - n = MPFR_PREC2LIMBS (p); + p = MPFR_GET_PREC (b); + +#if !defined(MPFR_GENERIC_ABI) + /* special case for p < GMP_NUMB_BITS */ + if (p < GMP_NUMB_BITS) + return mpfr_sub1sp1 (a, b, c, rnd_mode, p); + + /* special case for GMP_NUMB_BITS < p < 2*GMP_NUMB_BITS */ + if (GMP_NUMB_BITS < p && p < 2 * GMP_NUMB_BITS) + return mpfr_sub1sp2 (a, b, c, rnd_mode, p); + + /* special case for p = GMP_NUMB_BITS: we put it *after* mpfr_sub1sp2, + in order not to slow down mpfr_sub1sp2, which should be more frequent */ + if (p == GMP_NUMB_BITS) + return mpfr_sub1sp1n (a, b, c, rnd_mode); + + /* special case for 2*GMP_NUMB_BITS < p < 3*GMP_NUMB_BITS */ + if (2 * GMP_NUMB_BITS < p && p < 3 * GMP_NUMB_BITS) + return mpfr_sub1sp3 (a, b, c, rnd_mode, p); +#endif - /* Fast cmp of |b| and |c|*/ + n = MPFR_PREC2LIMBS (p); + /* Fast cmp of |b| and |c| */ bx = MPFR_GET_EXP (b); cx = MPFR_GET_EXP (c); - if (MPFR_UNLIKELY(bx == cx)) + + MPFR_TMP_MARK(marker); + + if (bx == cx) { mp_size_t k = n - 1; - /* Check mantissa since exponent are equals */ + /* Check mantissa since exponents are equal */ bp = MPFR_MANT(b); cp = MPFR_MANT(c); - while (k>=0 && MPFR_UNLIKELY(bp[k] == cp[k])) + while (k >= 0 && MPFR_UNLIKELY(bp[k] == cp[k])) k--; - if (MPFR_UNLIKELY(k < 0)) + if (k < 0) /* b == c ! */ { /* Return exact number 0 */ @@ -184,11 +1164,11 @@ goto BGreater; else { - MPFR_ASSERTD(bp[k] c */ + /* |b| > |c| */ BGreater: MPFR_SET_SAME_SIGN(a,b); } - /* Now b > c */ + /* Now |b| > |c| */ MPFR_ASSERTD(bx >= cx); d = (mpfr_uexp_t) bx - cx; - DEBUG (printf ("New with diff=%lu\n", (unsigned long) d)); + /* printf ("New with diff=%lu\n", (unsigned long) d); */ - if (MPFR_UNLIKELY(d <= 1)) + if (d <= 1) { - if (MPFR_LIKELY(d < 1)) + if (d == 0) { /* <-- b --> <-- c --> : exact sub */ @@ -221,7 +1201,7 @@ /* Normalize */ ExactNormalize: limb = ap[n-1]; - if (MPFR_LIKELY(limb)) + if (MPFR_LIKELY (limb != 0)) { /* First limb is not zero. */ count_leading_zeros(cnt, limb); @@ -231,7 +1211,7 @@ mpn_lshift(ap, ap, n, cnt); /* Normalize number */ bx -= cnt; /* Update final expo */ } - /* Last limb should be ok */ + /* Last limb should be OK */ MPFR_ASSERTD(!(ap[0] & MPFR_LIMB_MASK((unsigned int) (-p) % GMP_NUMB_BITS))); } @@ -239,8 +1219,8 @@ { /* First limb is zero */ mp_size_t k = n-1, len; - /* Find the first limb not equal to zero. - FIXME:It is assume it exists (since |b| > |c| and same prec)*/ + /* Find the first limb not equal to zero. It necessarily exists + since |b| > |c|. */ do { MPFR_ASSERTD( k > 0 ); @@ -252,28 +1232,30 @@ k++; len = n - k; /* Number of last limb */ MPFR_ASSERTD(k >= 0); - if (MPFR_LIKELY(cnt)) - mpn_lshift(ap+len, ap, k, cnt); /* Normalize the High Limb*/ + if (cnt) + mpn_lshift (ap + len, ap, k, cnt); /* Normalize the High Limb*/ else { - /* Must use DECR since src and dest may overlap & dest>=src*/ - MPN_COPY_DECR(ap+len, ap, k); + /* Must use copyd since src and dst may overlap & dst>=src */ + mpn_copyd (ap+len, ap, k); } MPN_ZERO(ap, len); /* Zeroing the last limbs */ bx -= cnt + len*GMP_NUMB_BITS; /* Update Expo */ - /* Last limb should be ok */ - MPFR_ASSERTD(!(ap[len]&MPFR_LIMB_MASK((unsigned int) (-p) - % GMP_NUMB_BITS))); + /* Last limb should be OK */ + MPFR_ASSERTD(!(ap[len] & MPFR_LIMB_MASK((unsigned int) (-p) + % GMP_NUMB_BITS))); } /* Check expo underflow */ if (MPFR_UNLIKELY(bx < __gmpfr_emin)) { MPFR_TMP_FREE(marker); - /* inexact=0 */ - DEBUG( printf("(D==0 Underflow)\n") ); + /* since b and c have same sign, exponent and precision, the + subtraction is exact */ + /* printf("(D==0 Underflow)\n"); */ + /* for MPFR_RNDN, mpfr_underflow always rounds away from zero, + thus for |a| <= 2^(emin-2) we change to RNDZ. */ if (rnd_mode == MPFR_RNDN && - (bx < __gmpfr_emin - 1 || - (/*inexact >= 0 &&*/ mpfr_powerof2_raw (a)))) + (bx < __gmpfr_emin - 1 || mpfr_powerof2_raw (a))) rnd_mode = MPFR_RNDZ; return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a)); } @@ -296,41 +1278,48 @@ cp = MPFR_MANT(c); k = n-1; limb = bp[k] - cp[k]/2; + /* we have |b|-|c| >= limb*W^k - (2*W^k-1)/2 >= limb*W^k - W^k + 1/2 + thus if limb > W^k/2, |b|-|c| >= 1/2*W^n. + Moreover if trunc(|c|) represents the first p-1 bits of |c|, + minus the last significant bit called c0 below, then we have + |b|-trunc(|c|) >= 1/2*W^n+1, thus the two mpn_sub_n calls + below necessarily yield a > 1/2*W^n. */ if (limb > MPFR_LIMB_HIGHBIT) { - /* We can't lose precision: compute b-c/2 */ + /* The exponent cannot decrease: compute b-c/2 */ /* Shift c in the allocated temporary block */ SubD1NoLose: - c0 = cp[0] & (MPFR_LIMB_ONE< ~ap[n-1]); if (MPFR_LIKELY(c0 == 0)) { /* Result is exact: no need of rounding! */ - ap = MPFR_MANT(a); - mpn_sub_n (ap, bp, cp, n); - MPFR_SET_EXP(a, bx); /* No expo overflow! */ - /* No truncate or normalize is needed */ - MPFR_ASSERTD(ap[n-1] > ~ap[n-1]); - /* No rounding is necessary since the result is exact */ MPFR_TMP_FREE(marker); return 0; } - ap = MPFR_MANT(a); - mask = ~MPFR_LIMB_MASK(sh); - cp[0] &= mask; /* Delete last bit of c */ - mpn_sub_n (ap, bp, cp, n); - MPFR_SET_EXP(a, bx); /* No expo overflow! */ MPFR_ASSERTD( !(ap[0] & ~mask) ); /* Check last bits */ /* No normalize is needed */ - MPFR_ASSERTD(ap[n-1] > ~ap[n-1]); - /* Rounding is necessary since c0 = 1*/ + /* Rounding is necessary since c0 = 1 */ /* Cp =-1 and C'p+1=0 */ bcp = 1; bcp1 = 0; - if (MPFR_LIKELY(rnd_mode == MPFR_RNDN)) + + if (rnd_mode == MPFR_RNDF) + goto truncate; /* low(b) = 0 and low(c) is 0 or 1/2 ulp(b), thus + low(b) - low(c) = 0 or -1/2 ulp(b) */ + else if (rnd_mode == MPFR_RNDN) { - /* Even Rule apply: Check Ap-1 */ - if (MPFR_LIKELY( (ap[0] & (MPFR_LIMB_ONE< HAVE___GMPN_RSBLSH_Nxxx). */ +#if defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_RSBLSH_Nxxx) + /* {ap, n} = 2*{bp, n} - {cp, n} */ + __gmpn_rsblsh_n (ap, MPFR_MANT(c), MPFR_MANT(b), n, 1); +#else bp = MPFR_TMP_LIMBS_ALLOC (n); + /* Shift b in the allocated temporary block */ mpn_lshift (bp, MPFR_MANT(b), n, 1); - ap = MPFR_MANT(a); mpn_sub_n (ap, bp, cp, n); +#endif bx--; goto ExactNormalize; } @@ -363,42 +1361,55 @@ /* If k==-1 => We don't lose any bit AND the result is 100000000000 0000000000 00000000000 */ mp_limb_t carry; - do { - carry = cp[k]&MPFR_LIMB_ONE; - k--; - } while (k>=0 && - bp[k]==(carry=cp[k]/2+(carry<<(GMP_NUMB_BITS-1)))); - if (MPFR_UNLIKELY(k<0)) + do { - /*If carry then (sh==0 and Virtual c'[-1] > Virtual b[-1]) */ - if (MPFR_UNLIKELY(carry)) /* carry = cp[0]&MPFR_LIMB_ONE */ + carry = cp[k] << (GMP_NUMB_BITS - 1); + if (--k < 0) + break; + carry += cp[k] >> 1; + } + while (bp[k] == carry); + if (MPFR_UNLIKELY(k < 0)) + { + ap = MPFR_MANT (a); + if (MPFR_UNLIKELY(carry)) { - /* FIXME: Can be faster? */ - MPFR_ASSERTD(sh == 0); - goto SubD1Lose; + /* If carry then necessarily the precision is an exact + multiple of GMP_NUMB_BITS, and we lose one bit, + thus the (exact) result is a power of 2 minus 1. */ + memset (ap, -1, n * MPFR_BYTES_PER_MP_LIMB); + MPFR_SET_EXP (a, bx - 1); + /* No underflow is possible since cx = bx-1 is a valid + exponent. */ } - /* Result is a power of 2 */ - ap = MPFR_MANT (a); - MPN_ZERO (ap, n); - ap[n-1] = MPFR_LIMB_HIGHBIT; - MPFR_SET_EXP (a, bx); /* No expo overflow! */ - /* No Normalize is needed*/ + else + { + /* No carry: result is a power of 2. */ + MPN_ZERO (ap, n - 1); + ap[n-1] = MPFR_LIMB_HIGHBIT; + MPFR_SET_EXP (a, bx); /* No expo overflow! */ + } + /* No Normalize is needed */ /* No Rounding is needed */ MPFR_TMP_FREE (marker); return 0; } /* carry = cp[k]/2+(cp[k-1]&1)<<(GMP_NUMB_BITS-1) = c'[k]*/ else if (bp[k] > carry) - goto SubD1NoLose; + goto SubD1NoLose; /* |b|-|c| >= 1/2*W^n */ else { - MPFR_ASSERTD(bp[k]= p)) + else if (MPFR_UNLIKELY(d >= p)) /* the difference of exponents is larger + than the precision of all operands, thus + the result is either b or b - 1 ulp, + with a possible exact result when + d = p, b = 2^e and c = 1/2 ulp(b) */ { ap = MPFR_MANT(a); MPFR_UNSIGNED_MINUS_MODULO(sh, p); @@ -419,24 +1430,31 @@ if (MPFR_UNLIKELY(cp[n-1] == MPFR_LIMB_HIGHBIT)) { mp_size_t k = n-1; - do { + do k--; - } while (k>=0 && cp[k]==0); - bcp1 = (k>=0); + while (k >= 0 && cp[k] == 0); + bcp1 = (k >= 0); } else bcp1 = 1; } - DEBUG( printf("(D=P) Cp=-1 Cp+1=%d C'p+1=%d \n", bbcp!=0, bcp1!=0) ); + /* printf("(D=P) Cp=-1 Cp+1=%d C'p+1=%d \n", bbcp!=0, bcp1!=0); */ bp = MPFR_MANT (b); - /* Even if src and dest overlap, it is ok using MPN_COPY */ - if (MPFR_LIKELY(rnd_mode == MPFR_RNDN)) + /* Even if src and dest overlap, it is OK using MPN_COPY */ + if (MPFR_LIKELY(rnd_mode == MPFR_RNDF)) + /* then d = p, and subtracting one ulp of b is ok even in the + exact case b = 2^e and c = 1/2 ulp(b) */ + { + MPN_COPY(ap, bp, n); + goto sub_one_ulp; + } + else if (rnd_mode == MPFR_RNDN) { - if (MPFR_UNLIKELY( bcp && bcp1==0 )) + if (MPFR_UNLIKELY (bcp != 0 && bcp1 == 0)) /* Cp=-1 and C'p+1=0: Even rule Apply! */ /* Check Ap-1 = Bp-1 */ - if ((bp[0] & (MPFR_LIMB_ONE<P) Cp=%d Cp+1=%d C'p+1=%d\n", bcp!=0,bbcp!=0,bcp1!=0) ); + /* printf("(D>P) Cp=%d Cp+1=%d C'p+1=%d\n", bcp!=0,bbcp!=0,bcp1!=0); */ /* Need to compute C'p+2 if d==p+1 and if rnd_mode=NEAREST (Because of a very improbable case) */ if (MPFR_UNLIKELY(d==p+1 && rnd_mode==MPFR_RNDN)) @@ -469,19 +1487,19 @@ if (MPFR_UNLIKELY(cp[n-1] == MPFR_LIMB_HIGHBIT)) { mp_size_t k = n-1; - do { + do k--; - } while (k>=0 && cp[k]==0); - bbcp1 = (k>=0); + while (k >= 0 && cp[k] == 0); + bbcp1 = (k >= 0); } else bbcp1 = 1; - DEBUG( printf("(D>P) C'p+2=%d\n", bbcp1!=0) ); + /* printf("(D>P) C'p+2=%d\n", bbcp1!=0); */ } /* Copy mantissa B in A */ MPN_COPY(ap, MPFR_MANT(b), n); /* Round */ - if (MPFR_LIKELY(rnd_mode == MPFR_RNDN)) + if (rnd_mode == MPFR_RNDF || rnd_mode == MPFR_RNDN) goto truncate; MPFR_UPDATE_RND_MODE(rnd_mode, MPFR_IS_NEG(a)); if (rnd_mode == MPFR_RNDZ) @@ -490,13 +1508,12 @@ goto truncate; } } - else + else /* case 2 <= d < p */ { mpfr_uexp_t dm; mp_size_t m; mp_limb_t mask; - /* General case: 2 <= d < p */ MPFR_UNSIGNED_MINUS_MODULO(sh, p); cp = MPFR_TMP_LIMBS_ALLOC (n); @@ -506,7 +1523,7 @@ if (MPFR_UNLIKELY(dm == 0)) { /* dm = 0 and m > 0: Just copy */ - MPFR_ASSERTD(m!=0); + MPFR_ASSERTD(m != 0); MPN_COPY(cp, MPFR_MANT(c)+m, n-m); MPN_ZERO(cp+n-m, m); } @@ -523,16 +1540,16 @@ MPN_ZERO(cp+n-m, m); } - DEBUG( mpfr_print_mant_binary("Before", MPFR_MANT(c), p) ); - DEBUG( mpfr_print_mant_binary("B= ", MPFR_MANT(b), p) ); - DEBUG( mpfr_print_mant_binary("After ", cp, p) ); + /* mpfr_print_mant_binary("Before", MPFR_MANT(c), p); */ + /* mpfr_print_mant_binary("B= ", MPFR_MANT(b), p); */ + /* mpfr_print_mant_binary("After ", cp, p); */ /* Compute bcp=Cp and bcp1=C'p+1 */ if (MPFR_LIKELY(sh)) { /* Try to compute them from C' rather than C (FIXME: Faster?) */ bcp = (cp[0] & (MPFR_LIMB_ONE<<(sh-1))) ; - if (MPFR_LIKELY( cp[0] & MPFR_LIMB_MASK(sh-1) )) + if (cp[0] & MPFR_LIMB_MASK(sh-1)) bcp1 = 1; else { @@ -540,7 +1557,7 @@ /* Start from bit x=p-d+sh in mantissa C (+sh since we have already looked sh bits in C'!) */ mpfr_prec_t x = p-d+sh-1; - if (MPFR_LIKELY(x>p)) + if (x > p) /* We are already looked at all the bits of c, so C'p+1 = 0*/ bcp1 = 0; else @@ -548,9 +1565,8 @@ mp_limb_t *tp = MPFR_MANT(c); mp_size_t kx = n-1 - (x / GMP_NUMB_BITS); mpfr_prec_t sx = GMP_NUMB_BITS-1-(x%GMP_NUMB_BITS); - DEBUG (printf ("(First) x=%lu Kx=%ld Sx=%lu\n", - (unsigned long) x, (long) kx, - (unsigned long) sx)); + /* printf ("(First) x=%lu Kx=%ld Sx=%lu\n", + (unsigned long) x, (long) kx, (unsigned long) sx); */ /* Looks at the last bits of limb kx (if sx=0 does nothing)*/ if (tp[kx] & MPFR_LIMB_MASK(sx)) bcp1 = 1; @@ -558,9 +1574,9 @@ { /*kx += (sx==0);*/ /*If sx==0, tp[kx] hasn't been checked*/ - do { + do kx--; - } while (kx>=0 && tp[kx]==0); + while (kx >= 0 && tp[kx] == 0); bcp1 = (kx >= 0); } } @@ -582,17 +1598,17 @@ else { /*kx += (sx==0);*/ /*If sx==0, tp[kx] hasn't been checked*/ - do { + do kx--; - } while (kx>=0 && tp[kx]==0); - bcp1 = (kx>=0); + while (kx >= 0 && tp[kx] == 0); + bcp1 = (kx >= 0); } } - DEBUG( printf("sh=%lu Cp=%d C'p+1=%d\n", sh, bcp!=0, bcp1!=0) ); + /* printf("sh=%lu Cp=%d C'p+1=%d\n", sh, bcp!=0, bcp1!=0); */ /* Check if we can lose a bit, and if so compute Cp+1 and C'p+2 */ bp = MPFR_MANT(b); - if (MPFR_UNLIKELY((bp[n-1]-cp[n-1]) <= MPFR_LIMB_HIGHBIT)) + if (MPFR_UNLIKELY (bp[n-1] - cp[n-1] <= MPFR_LIMB_HIGHBIT)) { /* We can lose a bit so we precompute Cp+1 and C'p+2 */ /* Test for trivial case: since C'p+1=0, Cp+1=0 and C'p+2 =0 */ @@ -608,28 +1624,28 @@ mp_limb_t *tp = MPFR_MANT(c); /* Start from bit x=(p+1)-d in mantissa C */ mpfr_prec_t x = p+1-d; - mp_size_t kx = n-1 - (x/GMP_NUMB_BITS); - mpfr_prec_t sx = GMP_NUMB_BITS-1-(x%GMP_NUMB_BITS); + mp_size_t kx = n-1 - (x / GMP_NUMB_BITS); + mpfr_prec_t sx = GMP_NUMB_BITS-1 - (x % GMP_NUMB_BITS); + MPFR_ASSERTD(p > d); - DEBUG (printf ("(pre) x=%lu Kx=%ld Sx=%lu\n", - (unsigned long) x, (long) kx, - (unsigned long) sx)); + /* printf ("(pre) x=%lu Kx=%ld Sx=%lu\n", + (unsigned long) x, (long) kx, (unsigned long) sx); */ bbcp = (tp[kx] & (MPFR_LIMB_ONE<=0 && tp[kx]==0); - bbcp1 = (kx>=0); - DEBUG (printf ("(Pre) Scan done for %ld\n", (long) kx)); + while (kx >= 0 && tp[kx] == 0); + bbcp1 = (kx >= 0); + /* printf ("(Pre) Scan done for %ld\n", (long) kx); */ } } /*End of Bcp1 != 0*/ - DEBUG( printf("(Pre) Cp+1=%d C'p+2=%d\n", bbcp!=0, bbcp1!=0) ); + /* printf("(Pre) Cp+1=%d C'p+2=%d\n", bbcp!=0, bbcp1!=0); */ } /* End of "can lose a bit" */ /* Clean shifted C' */ @@ -639,7 +1655,7 @@ /* Subtract the mantissa c from b in a */ ap = MPFR_MANT(a); mpn_sub_n (ap, bp, cp, n); - DEBUG( mpfr_print_mant_binary("Sub= ", ap, p) ); + /* mpfr_print_mant_binary("Sub= ", ap, p); */ /* Normalize: we lose at max one bit*/ if (MPFR_UNLIKELY(MPFR_LIMB_MSB(ap[n-1]) == 0)) @@ -648,8 +1664,8 @@ /* Ap >= 010000xxx001 */ mpn_lshift(ap, ap, n, 1); /* Ap >= 100000xxx010 */ - if (MPFR_UNLIKELY(bcp!=0)) /* Check if Cp = -1 */ - /* Since Cp == -1, we have to substract one more */ + if (MPFR_UNLIKELY(bcp != 0)) /* Check if Cp = -1 */ + /* Since Cp == -1, we have to subtract one more */ { mpn_sub_1(ap, ap, n, MPFR_LIMB_ONE<= 100000xxx001, the final sub can't unnormalize!*/ } MPFR_ASSERTD( !(ap[0] & ~mask) ); /* Rounding */ - if (MPFR_LIKELY(rnd_mode == MPFR_RNDN)) + if (MPFR_LIKELY(rnd_mode == MPFR_RNDF)) + goto truncate; + else if (MPFR_LIKELY(rnd_mode == MPFR_RNDN)) { - if (MPFR_LIKELY(bcp==0)) + if (MPFR_LIKELY(bcp == 0)) goto truncate; - else if ((bcp1) || ((ap[0] & (MPFR_LIMB_ONE<= 1/2*W^n, thus round(|b|-|c|) >= 1/2*W^n, and ap[n-1] + cannot go below MPFR_LIMB_HIGHBIT. */ + /* printf("(SubOneUlp)Cp=%d, Cp+1=%d C'p+1=%d\n", bcp!=0,bbcp!=0,bcp1!=0); */ /* Compute the last bit (Since we have shifted the mantissa) - we need one more bit!*/ - MPFR_ASSERTN(bbcp != (mp_limb_t) -1); - if ( (rnd_mode == MPFR_RNDZ && bcp==0) - || (rnd_mode==MPFR_RNDN && bbcp==0) - || (bcp && bcp1==0) ) /*Exact result*/ + we need one more bit! */ + MPFR_ASSERTD(bbcp != MPFR_LIMB_MAX); + if ((rnd_mode == MPFR_RNDZ && bcp == 0) || + (rnd_mode == MPFR_RNDN && bbcp == 0) || + (bcp != 0 && bcp1 == 0)) /* Exact result */ { - ap[0] |= MPFR_LIMB_ONE<=0 && ap[k]==0); - if (MPFR_UNLIKELY(k<0)) + while (k >= 0 && ap[k] == 0); + if (MPFR_UNLIKELY (k < 0)) { /* It is a power of 2! */ /* Compute Cp+1 if it isn't already compute (ie d==1) */ - /* FIXME: Is this case possible? */ - if (d == 1) - bbcp=0; - DEBUG( printf("(Truncate) Cp=%d, Cp+1=%d C'p+1=%d C'p+2=%d\n", \ - bcp!=0, bbcp!=0, bcp1!=0, bbcp1!=0) ); - MPFR_ASSERTN(bbcp != (mp_limb_t) -1); - MPFR_ASSERTN((rnd_mode != MPFR_RNDN) || (bcp != 0) || (bbcp == 0) || (bbcp1 != (mp_limb_t) -1)); - if (((rnd_mode != MPFR_RNDZ) && bcp) - || - ((rnd_mode == MPFR_RNDN) && (bcp == 0) && (bbcp) && (bbcp1))) + /* Note: if d=1, we have {a, n} > 1/2*W^n, thus we cannot have k < 0. */ + /* printf("(Truncate) Cp=%d, Cp+1=%d C'p+1=%d C'p+2=%d\n", + bcp!=0, bbcp!=0, bcp1!=0, bbcp1!=0); */ + MPFR_ASSERTD(bbcp != MPFR_LIMB_MAX); + MPFR_ASSERTD(rnd_mode != MPFR_RNDN || bcp != 0 || + bbcp == 0 || bbcp1 != MPFR_LIMB_MAX); + if ((rnd_mode != MPFR_RNDZ && bcp != 0) || + (rnd_mode == MPFR_RNDN && bcp == 0 && bbcp != 0 && bbcp1 != 0)) { - DEBUG( printf("(Truncate) Do sub\n") ); + /* printf("(Truncate) Do sub\n"); */ mpn_sub_1 (ap, ap, n, MPFR_LIMB_ONE << sh); - mpn_lshift(ap, ap, n, 1); - ap[0] |= MPFR_LIMB_ONE<= emin. Proof: If d==0 : Exact case. This is never called. if 1 < d < p : bx=MPFR_EXP(b) or MPFR_EXP(b)-1 > MPFR_EXP(c) > emin if d == 1 : bx=MPFR_EXP(b). If we could lose any bits, the exact - normalisation is called. + normalization is called. if d >= p : bx=MPFR_EXP(b) >= MPFR_EXP(c) + p > emin After SubOneUlp, we could have one bit less. if 1 < d < p : bx >= MPFR_EXP(b)-2 >= MPFR_EXP(c) > emin @@ -791,18 +1809,6 @@ if d >= p : bx >= MPFR_EXP(b)-1 > emin since p>=2. */ MPFR_ASSERTD( bx >= __gmpfr_emin); - /* - if (MPFR_UNLIKELY(bx < __gmpfr_emin)) - { - DEBUG( printf("(Final Underflow)\n") ); - if (rnd_mode == MPFR_RNDN && - (bx < __gmpfr_emin - 1 || - (inexact >= 0 && mpfr_powerof2_raw (a)))) - rnd_mode = MPFR_RNDZ; - MPFR_TMP_FREE(marker); - return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a)); - } - */ MPFR_SET_EXP (a, bx); MPFR_TMP_FREE(marker); diff -Nru mpfr4-3.1.4/src/sub.c mpfr4-4.0.2/src/sub.c --- mpfr4-3.1.4/src/sub.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/sub.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_sub -- subtract two floating-point numbers -Copyright 2001-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2001-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,12 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" -int +MPFR_HOT_FUNCTION_ATTR int mpfr_sub (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) { MPFR_LOG_FUNC @@ -31,7 +31,7 @@ mpfr_get_prec (c), mpfr_log_prec, c, rnd_mode), ("a[%Pu]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a)); - if (MPFR_ARE_SINGULAR (b,c)) + if (MPFR_ARE_SINGULAR_OR_UBF (b,c)) { if (MPFR_IS_NAN (b) || MPFR_IS_NAN (c)) { @@ -72,11 +72,29 @@ else return mpfr_neg (a, c, rnd_mode); } - else + else if (MPFR_IS_ZERO (c)) { - MPFR_ASSERTD (MPFR_IS_ZERO (c)); return mpfr_set (a, b, rnd_mode); } + else + { + MPFR_ASSERTD (MPFR_IS_PURE_UBF (b)); + MPFR_ASSERTD (MPFR_IS_PURE_UBF (c)); + /* mpfr_sub1sp and mpfr_add1sp are not intended to support UBF, + for which optimization is less important. */ + if (MPFR_SIGN(b) == MPFR_SIGN(c)) + return mpfr_sub1 (a, b, c, rnd_mode); + else if (MPFR_UBF_EXP_LESS_P (b, c)) + { + int inexact; + rnd_mode = MPFR_INVERT_RND (rnd_mode); + inexact = mpfr_add1 (a, c, b, rnd_mode); + MPFR_CHANGE_SIGN (a); + return -inexact; + } + else + return mpfr_add1 (a, b, c, rnd_mode); + } } MPFR_ASSERTD (MPFR_IS_PURE_FP (b)); diff -Nru mpfr4-3.1.4/src/sub_d.c mpfr4-4.0.2/src/sub_d.c --- mpfr4-3.1.4/src/sub_d.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/sub_d.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_sub_d -- subtract a machine double precision float from a multiple precision floating-point number -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -28,6 +28,7 @@ { int inexact; mpfr_t d; + mp_limb_t tmp_man[MPFR_LIMBS_PER_DOUBLE]; MPFR_SAVE_EXPO_DECL (expo); MPFR_LOG_FUNC @@ -37,15 +38,14 @@ MPFR_SAVE_EXPO_MARK (expo); - mpfr_init2 (d, IEEE_DBL_MANT_DIG); + MPFR_TMP_INIT1(tmp_man, d, IEEE_DBL_MANT_DIG); inexact = mpfr_set_d (d, c, rnd_mode); - MPFR_ASSERTN (inexact == 0); + MPFR_ASSERTD (inexact == 0); - mpfr_clear_flags (); + MPFR_CLEAR_FLAGS (); inexact = mpfr_sub (a, b, d, rnd_mode); MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); - mpfr_clear(d); MPFR_SAVE_EXPO_FREE (expo); return mpfr_check_range (a, inexact, rnd_mode); } diff -Nru mpfr4-3.1.4/src/subnormal.c mpfr4-4.0.2/src/subnormal.c --- mpfr4-3.1.4/src/subnormal.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/subnormal.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_subnormalize -- Subnormalize a floating point number emulating sub-normal numbers. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -54,7 +54,7 @@ __gmpfr_emin + (mpfr_exp_t) MPFR_PREC (y) - 1))) MPFR_RET (old_inexact); - mpfr_set_underflow (); + MPFR_SET_UNDERFLOW (); sign = MPFR_SIGN (y); /* We have to emulate one bit rounding if EXP(y) = emin */ @@ -112,7 +112,7 @@ MPFR_RET (sign); } } - else /* Hard case: It is more or less the same problem than mpfr_cache */ + else /* Hard case: It is more or less the same problem as mpfr_cache */ { mpfr_t dest; mpfr_prec_t q; @@ -144,8 +144,11 @@ { if (SAME_SIGN (inexact, MPFR_INT_SIGN (y))) mpfr_nexttozero (dest); - else - mpfr_nexttoinf (dest); + else /* subnormal range, thus no overflow */ + { + mpfr_nexttoinf (dest); + MPFR_ASSERTD(!MPFR_IS_INF (dest)); + } inexact = -inexact; } } diff -Nru mpfr4-3.1.4/src/sub_ui.c mpfr4-4.0.2/src/sub_ui.c --- mpfr4-3.1.4/src/sub_ui.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/sub_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_sub_ui -- subtract a floating-point number and a machine integer -Copyright 2000-2016 Free Software Foundation, Inc. +Copyright 2000-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ @@ -27,34 +27,55 @@ int mpfr_sub_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mpfr_rnd_t rnd_mode) { - if (MPFR_LIKELY (u != 0)) /* if u=0, do nothing */ + MPFR_LOG_FUNC + (("x[%Pu]=%.*Rg u=%lu rnd=%d", + mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode), + ("y[%Pu]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y)); + + /* (unsigned long) 0 is assumed to be a real 0 (unsigned) */ + if (MPFR_UNLIKELY (u == 0)) + return mpfr_set (y, x, rnd_mode); + + /* This block is actually useless, but this is a minor optimization. */ + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) { - mpfr_t uu; - mp_limb_t up[1]; - unsigned long cnt; - int inex; - - MPFR_SAVE_EXPO_DECL (expo); - - MPFR_LOG_FUNC - (("x[%Pu]=%.*Rg u=%lu rnd=%d", - mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode), - ("y[%Pu]=%.*Rg inexact=%d", - mpfr_get_prec(y), mpfr_log_prec, y, inex)); - - MPFR_TMP_INIT1 (up, uu, GMP_NUMB_BITS); - MPFR_ASSERTN (u == (mp_limb_t) u); - count_leading_zeros (cnt, (mp_limb_t) u); - *up = (mp_limb_t) u << cnt; - - /* Optimization note: Exponent save/restore operations may be - removed if mpfr_sub works even when uu is out-of-range. */ - MPFR_SAVE_EXPO_MARK (expo); - MPFR_SET_EXP (uu, GMP_NUMB_BITS - cnt); - inex = mpfr_sub (y, x, uu, rnd_mode); - MPFR_SAVE_EXPO_FREE (expo); - return mpfr_check_range (y, inex, rnd_mode); + if (MPFR_IS_NAN (x)) + { + MPFR_SET_NAN (y); + MPFR_RET_NAN; + } + if (MPFR_IS_INF (x)) + { + MPFR_SET_INF (y); + MPFR_SET_SAME_SIGN (y, x); + MPFR_RET (0); /* +/-infinity is exact */ + } + /* The case x being zero is handled below: we can't use mpfr_set_si + as the opposite of u does not necessarily fit in a long. */ } - else - return mpfr_set (y, x, rnd_mode); + + /* Main code */ + { + mpfr_t uu; + mp_limb_t up[1]; + int cnt; + int inex; + MPFR_SAVE_EXPO_DECL (expo); + + MPFR_TMP_INIT1 (up, uu, GMP_NUMB_BITS); + MPFR_STAT_STATIC_ASSERT (MPFR_LIMB_MAX >= ULONG_MAX); + /* So, u fits in a mp_limb_t, which justifies the casts below. */ + MPFR_ASSERTD (u != 0); + count_leading_zeros (cnt, (mp_limb_t) u); + *up = (mp_limb_t) u << cnt; + + /* Optimization note: Exponent save/restore operations may be + removed if mpfr_sub works even when uu is out-of-range. */ + 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); + } } diff -Nru mpfr4-3.1.4/src/sum.c mpfr4-4.0.2/src/sum.c --- mpfr4-3.1.4/src/sum.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/sum.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Sum -- efficiently sum a list of floating-point numbers -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2014-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,311 +17,1369 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* Reference: James Demmel and Yozo Hida, Fast and accurate floating-point - summation with application to computational geometry, Numerical Algorithms, - volume 37, number 1-4, pages 101--112, 2004. */ - #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" -/* I would really like to use "mpfr_srcptr const []" but the norm is buggy: - it doesn't automaticaly cast a "mpfr_ptr []" to "mpfr_srcptr const []" - if necessary. So the choice are: - mpfr_s ** : ok - mpfr_s *const* : ok - mpfr_s **const : ok - mpfr_s *const*const : ok - const mpfr_s *const* : no - const mpfr_s **const : no - const mpfr_s *const*const: no - VL: this is not a bug, but a feature. See the reason here: - http://c-faq.com/ansi/constmismatch.html -*/ -static void heap_sort (mpfr_srcptr *const, unsigned long, mpfr_srcptr *); -static void count_sort (mpfr_srcptr *const, unsigned long, mpfr_srcptr *, - mpfr_exp_t, mpfr_uexp_t); - -/* Either sort the tab in perm and returns 0 - Or returns 1 for +INF, -1 for -INF and 2 for NAN. - Also set *maxprec to the maximal precision of tab[0..n-1] and of the - initial value of *maxprec. +/* Note: In the prototypes, one uses + * + * const mpfr_ptr *x i.e.: __mpfr_struct *const *x + * + * instead of + * + * const mpfr_srcptr *x i.e.: const __mpfr_struct *const *x + * + * because here one has a double indirection and the type matching rules + * from the C standard in such a case are stricter and they would yield + * annoying errors for the user in practice. See: + * + * Why can't I pass a char ** to a function which expects a const char **? + * + * in the comp.lang.c FAQ: + * + * http://c-faq.com/ansi/constmismatch.html + */ + +/* See the doc/sum.txt file for the algorithm and a part of its proof +(this will later go into algorithms.tex). + +TODO [VL, after a discussion with James Demmel]: Compared to + James Demmel and Yozo Hida, Fast and accurate floating-point summation + with application to computational geometry, Numerical Algorithms, + volume 37, number 1-4, pages 101--112, 2004. +sorting is not necessary here. It is not done because in the most common +cases (where big cancellations are rare), it would take time and be +useless. However the lack of sorting increases the worst case complexity. +For instance, consider many inputs that cancel one another (two by two). +One would need n/2 iterations, where each iteration reads the exponent +of each input, therefore n*n/2 read operations. Using a worst-case sort +in O(n log n) could give a O(n log n) worst-case complexity. As we don't +want to slow down the most common cases, this could be done at the 3rd +iteration. But are there practical applications which would be used as +tests? + +Note: see the following paper and its references: +http://www.eecs.berkeley.edu/~hdnguyen/public/papers/ARITH21_Fast_Sum.pdf +VL: This is very different: + In MPFR In the paper & references + arbitrary precision fixed precision + correct rounding just reproducible rounding + integer operations floating-point operations + sequential parallel (& sequential) */ -int -mpfr_sum_sort (mpfr_srcptr *const tab, unsigned long n, mpfr_srcptr *perm, - mpfr_prec_t *maxprec) + +#ifdef MPFR_COV_CHECK +int __gmpfr_cov_sum_tmd[MPFR_RND_MAX][2][2][3][2][2] = { 0 }; +#endif + +/* Update minexp (V) after detecting a potential integer overflow in + extreme cases (only a 32-bit ABI may be concerned in practice). + Instead of an assertion failure below, we could + 1. check that the ulp of each regular input has an exponent >= MPFR_EXP_MIN + (with an assertion failure if this is not the case); + 2. set minexp to MPFR_EXP_MIN and shift the accumulator accordingly + (the sum will then be exact). + However, such cases, which involve huge precisions, will probably + never occur in practice (at least with a 64-bit ABI) and are not + easily testable due to these huge precisions. Moreover, switching + to a 64-bit ABI would be a better solution for such computations. + So, let's leave this unimplemented. */ +#define SAFE_SUB(V,E,SH) \ + do \ + { \ + mpfr_prec_t sh = (SH); \ + MPFR_ASSERTN ((E) >= MPFR_EXP_MIN + sh); \ + V = (E) - sh; \ + } \ + while (0) + +/* Function sum_raw + * ================ + * + * Accumulate a new [minexp,maxexp[ block into (wp,ws). If e and err denote + * the exponents of the computed result and of the error bound respectively, + * while e - err is less than some given bound (due to cancellation), shift + * the accumulator and reiterate. + * + * Inputs: + * wp: pointer to the accumulator (least significant limb first). + * ws: size of the accumulator (in limbs). + * wq: precision of the accumulator (ws * GMP_NUMB_BITS). + * x: array of the input numbers. + * n: size of this array (number of inputs, regular or not). + * minexp: exponent of the least significant bit of the first block. + * maxexp: exponent of the first block (exponent of its MSB + 1). + * tp: pointer to a temporary area (pre-allocated). + * ts: size of this temporary area. + * logn: ceil(log2(rn)), where rn is the number of regular inputs. + * prec: lower bound for e - err (as described above). + * ep: pointer to mpfr_exp_t (see below), or a null pointer. + * minexpp: pointer to mpfr_exp_t (see below), or a null pointer. + * maxexpp: pointer to mpfr_exp_t (see below), or a null pointer. + * + * Preconditions: + * prec >= 1 + * wq >= logn + prec + 2 + * + * This function returns 0 if the accumulator is 0 (which implies that + * the exact sum for this sum_raw invocation is 0), otherwise the number + * of cancelled bits (>= 1), defined as the number of identical bits on + * the most significant part of the accumulator. In the latter case, it + * also returns the following data in variables passed by reference, if + * the pointers are not NULL: + * - in ep: the exponent e of the computed result; + * - in minexpp: the last value of minexp; + * - in maxexpp: the new value of maxexp (for the next iteration after + * the first invocation of sum_raw in the main code). + * + * Notes: + * - minexp is also the exponent of the least significant bit of the + * accumulator; + * - the temporary area must be large enough to hold a shifted input + * block, and the value of ts is used only when the full assertions + * are checked (i.e. with the --enable-assert configure option), to + * check that a buffer overflow doesn't occur; + * - contrary to the returned value of minexp (the value in the last + * iteration), the returned value of maxexp is the one for the next + * iteration (= maxexp2 of the last iteration). + */ +static mpfr_prec_t +sum_raw (mp_limb_t *wp, mp_size_t ws, mpfr_prec_t wq, const mpfr_ptr *x, + unsigned long n, mpfr_exp_t minexp, mpfr_exp_t maxexp, + mp_limb_t *tp, mp_size_t ts, int logn, mpfr_prec_t prec, + mpfr_exp_t *ep, mpfr_exp_t *minexpp, mpfr_exp_t *maxexpp) { - mpfr_exp_t min, max; - mpfr_uexp_t exp_num; - unsigned long i; - int sign_inf; - - sign_inf = 0; - min = MPFR_EMIN_MAX; - max = MPFR_EMAX_MIN; - for (i = 0; i < n; i++) + MPFR_LOG_FUNC + (("ws=%Pd ts=%Pd prec=%Pd", (mpfr_prec_t) ws, (mpfr_prec_t) ts, prec), + ("", 0)); + + /* The C code below requires prec >= 0 due to the use of unsigned + integer arithmetic on it. Actually the computation makes sense + only with prec >= 1 (otherwise one can't even know the sign of + the result), hence the following assertion. */ + MPFR_ASSERTD (prec >= 1); + + /* Consistency check. */ + MPFR_ASSERTD (wq == (mpfr_prec_t) ws * GMP_NUMB_BITS); + + /* The following precondition together with prec >= 1 will imply: + minexp - shiftq < maxexp2, as required by the algorithm. */ + MPFR_ASSERTD (wq >= logn + prec + 2); + + while (1) { - if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (tab[i]))) - { - if (MPFR_IS_NAN (tab[i])) - return 2; /* Return NAN code */ - else if (MPFR_IS_INF (tab[i])) + mpfr_exp_t maxexp2 = MPFR_EXP_MIN; + unsigned long i; + + MPFR_LOG_MSG (("sum_raw loop: " + "maxexp=%" MPFR_EXP_FSPEC "d " + "minexp=%" MPFR_EXP_FSPEC "d\n", + (mpfr_eexp_t) maxexp, (mpfr_eexp_t) minexp)); + + MPFR_ASSERTD (maxexp > minexp); + + for (i = 0; i < n; i++) + if (! MPFR_IS_SINGULAR (x[i])) /* Step 1 (see sum_raw in sum.txt) */ + { + mp_limb_t *dp, *vp; + mp_size_t ds, vs, vds; + mpfr_exp_t xe, vd; + mpfr_prec_t xq; + int tr; + + xe = MPFR_GET_EXP (x[i]); + xq = MPFR_GET_PREC (x[i]); + + vp = MPFR_MANT (x[i]); + vs = MPFR_PREC2LIMBS (xq); + vd = xe - vs * GMP_NUMB_BITS - minexp; + /* vd is the exponent of the least significant represented bit of + x[i] (including the trailing bits, whose value is 0) minus the + exponent of the least significant bit of the accumulator. To + make the code simpler, we won't try to filter out the trailing + bits of x[i]. */ + + /* Steps 2, 3, 4 (see sum_raw in sum.txt) */ + + if (vd < 0) + { + /* This covers the following cases: + * [-+- accumulator ---] + * [---|----- x[i] ------|--] + * | [----- x[i] --|--] + * | |[----- x[i] -----] + * | | [----- x[i] -----] + * maxexp minexp + */ + + /* Step 2 for subcase vd < 0 */ + + if (xe <= minexp) + { + /* x[i] is entirely after the LSB of the accumulator, + so that it will be ignored at this iteration. */ + if (xe > maxexp2) + { + maxexp2 = xe; + /* And since the exponent of x[i] is valid... */ + MPFR_ASSERTD (maxexp2 >= MPFR_EMIN_MIN); + } + continue; + } + + /* Step 3 for subcase vd < 0 */ + + /* If some significant bits of x[i] are after the LSB of the + accumulator, then maxexp2 will necessarily be minexp. */ + if (MPFR_LIKELY (xe - xq < minexp)) + maxexp2 = minexp; + + /* Step 4 for subcase vd < 0 */ + + /* We need to ignore the least |vd| significant bits of x[i]. + First, let's ignore the least vds = |vd| / GMP_NUMB_BITS + limbs. */ + vd = - vd; + vds = vd / GMP_NUMB_BITS; + vs -= vds; + MPFR_ASSERTD (vs > 0); /* see xe <= minexp test above */ + vp += vds; + vd -= vds * GMP_NUMB_BITS; + MPFR_ASSERTD (vd >= 0 && vd < GMP_NUMB_BITS); + + if (xe > maxexp) + { + vs -= (xe - maxexp) / GMP_NUMB_BITS; + MPFR_ASSERTD (vs > 0); + tr = (xe - maxexp) % GMP_NUMB_BITS; + } + else + tr = 0; + + if (vd != 0) + { + MPFR_ASSERTD (vs <= ts); + mpn_rshift (tp, vp, vs, vd); + vp = tp; + tr += vd; + if (tr >= GMP_NUMB_BITS) + { + vs--; + tr -= GMP_NUMB_BITS; + } + MPFR_ASSERTD (vs >= 1); + MPFR_ASSERTD (tr >= 0 && tr < GMP_NUMB_BITS); + if (tr != 0) + { + tp[vs-1] &= MPFR_LIMB_MASK (GMP_NUMB_BITS - tr); + tr = 0; + } + /* Truncation has now been taken into account. */ + MPFR_ASSERTD (tr == 0); + } + + dp = wp; + ds = ws; + } + else /* vd >= 0 */ + { + /* This covers the following cases: + * [-+- accumulator ---] + * [- x[i] -] | | + * [---|-- x[i] ------] | + * [------|-- x[i] ---------] + * | [- x[i] -] | + * maxexp minexp + */ + + /* Steps 2 and 3 for subcase vd >= 0 */ + + MPFR_ASSERTD (xe - xq >= minexp); /* see definition of vd */ + + /* Step 4 for subcase vd >= 0 */ + + /* We need to ignore the least vd significant bits + of the accumulator. First, let's ignore the least + vds = vd / GMP_NUMB_BITS limbs. -> (dp,ds) */ + vds = vd / GMP_NUMB_BITS; + ds = ws - vds; + if (ds <= 0) + continue; + dp = wp + vds; + vd -= vds * GMP_NUMB_BITS; + MPFR_ASSERTD (vd >= 0 && vd < GMP_NUMB_BITS); + + /* The low part of x[i] (to be determined) will have to be + shifted vd bits to the left if vd != 0. */ + + if (xe > maxexp) + { + vs -= (xe - maxexp) / GMP_NUMB_BITS; + if (vs <= 0) + continue; + tr = (xe - maxexp) % GMP_NUMB_BITS; + } + else + tr = 0; + + MPFR_ASSERTD (tr >= 0 && tr < GMP_NUMB_BITS && vs > 0); + + /* We need to consider the least significant vs limbs of x[i] + except the most significant tr bits. */ + + if (vd != 0) + { + mp_limb_t carry; + + MPFR_ASSERTD (vs <= ts); + carry = mpn_lshift (tp, vp, vs, vd); + tr -= vd; + if (tr < 0) + { + tr += GMP_NUMB_BITS; + MPFR_ASSERTD (vs + 1 <= ts); + tp[vs++] = carry; + } + MPFR_ASSERTD (tr >= 0 && tr < GMP_NUMB_BITS); + vp = tp; + } + } /* vd >= 0 */ + + MPFR_ASSERTD (vs > 0 && vs <= ds); + + /* We can't truncate the most significant limb of the input + (in case it hasn't been shifted to the temporary area). + So, let's ignore it now. It will be taken into account + via carry propagation after the addition. */ + if (tr != 0) + vs--; + + /* Step 5 (see sum_raw in sum.txt) */ + + if (MPFR_IS_POS (x[i])) + { + mp_limb_t carry; + + carry = vs > 0 ? mpn_add_n (dp, dp, vp, vs) : 0; + MPFR_ASSERTD (carry <= 1); + if (tr != 0) + carry += vp[vs] & MPFR_LIMB_MASK (GMP_NUMB_BITS - tr); + if (ds > vs) + mpn_add_1 (dp + vs, dp + vs, ds - vs, carry); + } + else + { + mp_limb_t borrow; + + borrow = vs > 0 ? mpn_sub_n (dp, dp, vp, vs) : 0; + MPFR_ASSERTD (borrow <= 1); + if (tr != 0) + borrow += vp[vs] & MPFR_LIMB_MASK (GMP_NUMB_BITS - tr); + if (ds > vs) + mpn_sub_1 (dp + vs, dp + vs, ds - vs, borrow); + } + } + + { + mpfr_prec_t cancel; /* number of cancelled bits */ + mp_size_t wi; /* index in the accumulator */ + mp_limb_t a, b; + int cnt; + + cancel = 0; + wi = ws - 1; + MPFR_ASSERTD (wi >= 0); + a = wp[wi] >> (GMP_NUMB_BITS - 1) ? MPFR_LIMB_MAX : MPFR_LIMB_ZERO; + + while (wi >= 0) + if ((b = wp[wi]) == a) { - if (sign_inf == 0) /* No previous INF */ - sign_inf = MPFR_SIGN (tab[i]); - else if (sign_inf != MPFR_SIGN (tab[i])) - return 2; /* Return NAN */ + cancel += GMP_NUMB_BITS; + wi--; + } + else + { + b ^= a; + MPFR_ASSERTD (b != 0); + count_leading_zeros (cnt, b); + cancel += cnt; + break; } - } - else - { - MPFR_ASSERTD (MPFR_IS_PURE_FP (tab[i])); - if (MPFR_GET_EXP (tab[i]) < min) - min = MPFR_GET_EXP(tab[i]); - if (MPFR_GET_EXP (tab[i]) > max) - max = MPFR_GET_EXP(tab[i]); - } - if (MPFR_PREC (tab[i]) > *maxprec) - *maxprec = MPFR_PREC (tab[i]); - } - if (MPFR_UNLIKELY (sign_inf != 0)) - return sign_inf; - exp_num = max - min + 1; - /* FIXME : better test */ - if (exp_num > n * MPFR_INT_CEIL_LOG2 (n)) - heap_sort (tab, n, perm); - else - count_sort (tab, n, perm, min, exp_num); - return 0; + if (wi >= 0 || a != MPFR_LIMB_ZERO) /* accumulator != 0 */ + { + mpfr_exp_t e; /* exponent of the computed result */ + mpfr_exp_t err; /* exponent of the error bound */ + + MPFR_LOG_MSG (("accumulator %s 0, cancel=%Pd\n", + a != MPFR_LIMB_ZERO ? "<" : ">", cancel)); + + MPFR_ASSERTD (cancel > 0); + e = minexp + wq - cancel; + MPFR_ASSERTD (e >= minexp); + err = maxexp2 + logn; /* OK even if maxexp2 == MPFR_EXP_MIN */ + + /* The absolute value of the truncated sum is in the binade + [2^(e-1),2^e] (closed on both ends due to two's complement). + The error is strictly less than 2^err (and is 0 if + maxexp2 == MPFR_EXP_MIN). */ + + /* This basically tests whether err <= e - prec without + potential integer overflow (since prec >= 0)... + Note that the maxexp2 == MPFR_EXP_MIN test is there just for + the potential corner case e - prec < MPFR_EXP_MIN + logn. + Such corner cases, involving specific huge-precision numbers, + are probably not supported in many places in MPFR, but this + test doesn't hurt... */ + if (maxexp2 == MPFR_EXP_MIN || + (err <= e && SAFE_DIFF (mpfr_uexp_t, e, err) >= prec)) + { + MPFR_LOG_MSG (("(err=%" MPFR_EXP_FSPEC "d) <= (e=%" + MPFR_EXP_FSPEC "d) - (prec=%Pd)\n", + (mpfr_eexp_t) err, (mpfr_eexp_t) e, prec)); + /* To avoid tests or copies, we consider the only two cases + that will occur in sum_aux. */ + MPFR_ASSERTD ((ep != NULL && + minexpp != NULL && + maxexpp != NULL) || + (ep == NULL && + minexpp == NULL && + maxexpp == NULL)); + if (ep != NULL) + { + *ep = e; + *minexpp = minexp; + *maxexpp = maxexp2; + } + MPFR_LOG_MSG (("return with minexp=%" MPFR_EXP_FSPEC + "d maxexp2=%" MPFR_EXP_FSPEC "d%s\n", + (mpfr_eexp_t) minexp, (mpfr_eexp_t) maxexp2, + maxexp2 == MPFR_EXP_MIN ? + " (MPFR_EXP_MIN)" : "")); + return cancel; + } + else + { + mpfr_exp_t diffexp; + mpfr_prec_t shiftq; + mpfr_size_t shifts; + int shiftc; + + MPFR_LOG_MSG (("e=%" MPFR_EXP_FSPEC "d err=%" MPFR_EXP_FSPEC + "d maxexp2=%" MPFR_EXP_FSPEC "d%s\n", + (mpfr_eexp_t) e, (mpfr_eexp_t) err, + (mpfr_eexp_t) maxexp2, + maxexp2 == MPFR_EXP_MIN ? + " (MPFR_EXP_MIN)" : "")); + + diffexp = err - e; + if (diffexp < 0) + diffexp = 0; + /* diffexp = max(0, err - e) */ + + MPFR_LOG_MSG (("diffexp=%" MPFR_EXP_FSPEC "d\n", + (mpfr_eexp_t) diffexp)); + + MPFR_ASSERTD (diffexp < cancel - 2); + shiftq = cancel - 2 - (mpfr_prec_t) diffexp; + /* equivalent to: minexp + wq - 2 - max(e,err) */ + MPFR_ASSERTD (shiftq > 0); + shifts = shiftq / GMP_NUMB_BITS; + shiftc = shiftq % GMP_NUMB_BITS; + MPFR_LOG_MSG (("shiftq = %Pd = %Pd * GMP_NUMB_BITS + %d\n", + shiftq, (mpfr_prec_t) shifts, shiftc)); + if (MPFR_LIKELY (shiftc != 0)) + mpn_lshift (wp + shifts, wp, ws - shifts, shiftc); + else + mpn_copyd (wp + shifts, wp, ws - shifts); + MPN_ZERO (wp, shifts); + /* Compute minexp = minexp - shiftq safely. */ + SAFE_SUB (minexp, minexp, shiftq); + MPFR_ASSERTD (minexp < maxexp2); + } + } + else if (maxexp2 == MPFR_EXP_MIN) + { + MPFR_LOG_MSG (("accumulator = 0, maxexp2 = MPFR_EXP_MIN\n", 0)); + return 0; + } + else + { + MPFR_LOG_MSG (("accumulator = 0, reiterate\n", 0)); + /* Compute minexp = maxexp2 - (wq - (logn + 1)) safely. */ + SAFE_SUB (minexp, maxexp2, wq - (logn + 1)); + /* Note: the logn + 1 corresponds to cq in the main code. */ + } + } + + maxexp = maxexp2; + } } -#define GET_EXP1(x) (MPFR_IS_ZERO (x) ? min : MPFR_GET_EXP (x)) -/* Performs a count sort of the entries */ -static void -count_sort (mpfr_srcptr *const tab, unsigned long n, - mpfr_srcptr *perm, mpfr_exp_t min, mpfr_uexp_t exp_num) +/**********************************************************************/ + +/* Generic case: all the inputs are finite numbers, + with at least 3 regular numbers. */ +static int +sum_aux (mpfr_ptr sum, const mpfr_ptr *x, unsigned long n, mpfr_rnd_t rnd, + mpfr_exp_t maxexp, unsigned long rn) { - unsigned long *account; - unsigned long target_rank, i; - MPFR_TMP_DECL(marker); - - /* Reserve a place for potential 0 (with EXP min-1) - If there is no zero, we only lose one unused entry */ - min--; - exp_num++; + mp_limb_t *sump; + mp_limb_t *tp; /* pointer to a temporary area */ + mp_limb_t *wp; /* pointer to the accumulator */ + mp_size_t ts; /* size of the temporary area, in limbs */ + mp_size_t ws; /* size of the accumulator, in limbs */ + mp_size_t zs; /* size of the TMD accumulator, in limbs */ + mpfr_prec_t wq; /* size of the accumulator, in bits */ + int logn; /* ceil(log2(rn)) */ + int cq; + mpfr_prec_t sq; + int inex; + MPFR_TMP_DECL (marker); + + MPFR_LOG_FUNC + (("n=%lu rnd=%d maxexp=%" MPFR_EXP_FSPEC "d rn=%lu", + n, rnd, (mpfr_eexp_t) maxexp, rn), + ("sum[%Pu]=%.*Rg", mpfr_get_prec (sum), mpfr_log_prec, sum)); + + MPFR_ASSERTD (rn >= 3 && rn <= n); + + /* In practice, no integer overflow on the exponent. */ + MPFR_STAT_STATIC_ASSERT (MPFR_EXP_MAX - MPFR_EMAX_MAX >= + sizeof (unsigned long) * CHAR_BIT); + + /* Set up some variables and the accumulator. */ + + sump = MPFR_MANT (sum); + + /* rn is the number of regular inputs (the singular ones will be + ignored). Compute logn = ceil(log2(rn)). */ + logn = MPFR_INT_CEIL_LOG2 (rn); + MPFR_ASSERTD (logn >= 2); + + MPFR_LOG_MSG (("logn=%d maxexp=%" MPFR_EXP_FSPEC "d\n", + logn, (mpfr_eexp_t) maxexp)); + + sq = MPFR_GET_PREC (sum); + cq = logn + 1; + + /* First determine the size of the accumulator. + * cq + sq + logn + 2 >= logn + sq + 5, which will be used later. + * The assertion wq - cq - sq >= 4 is another way to check that. + */ + ws = MPFR_PREC2LIMBS (cq + sq + logn + 2); + wq = (mpfr_prec_t) ws * GMP_NUMB_BITS; + MPFR_ASSERTD (wq - cq - sq >= 4); + + /* TODO: timings, comparing with a larger zs. */ + zs = MPFR_PREC2LIMBS (wq - sq); + + MPFR_LOG_MSG (("cq=%d sq=%Pd logn=%d wq=%Pd\n", cq, sq, logn, wq)); + + /* An input block will have up to wq - cq bits, and its shifted value + (to be correctly aligned) may take GMP_NUMB_BITS - 1 additional bits. */ + ts = MPFR_PREC2LIMBS (wq - cq + GMP_NUMB_BITS - 1); - /* Performs a counting sort of the entries */ MPFR_TMP_MARK (marker); - account = (unsigned long *) MPFR_TMP_ALLOC (exp_num * sizeof *account); - for (i = 0; i < exp_num; i++) - account[i] = 0; - for (i = 0; i < n; i++) - account[GET_EXP1 (tab[i]) - min]++; - for (i = exp_num - 1; i >= 1; i--) - account[i - 1] += account[i]; - for (i = 0; i < n; i++) - { - target_rank = --account[GET_EXP1 (tab[i]) - min]; - perm[target_rank] = tab[i]; - } + + /* Note: If the TMD does not occur, which should be the case for most + sums, allocating zs limbs is not necessary. However, we choose to + do this now (thus in all cases) because zs is very small, so that + the difference on the memory footprint will not be noticeable. + More precisely, zs is at most 2 in practice with the current code; + we may want to increase it in order to avoid performance issues in + some unlikely corner cases, but even in this case, it will remain + small. + One will have: + [------ ts ------][------ ws ------][- zs -] + The following would probably be better: + [------ ts ------] [------ ws ------] + [- zs -] + i.e. where the TMD accumulator (partially or completely) takes + some unneeded part of the temporary area in order to improve + data locality. But + * in low precision, data locality is regarded as ensured even + with the actual choice; + * in high precision, data locality for TMD resolution may not + be that important. + */ + tp = MPFR_TMP_LIMBS_ALLOC (ts + ws + zs); + wp = tp + ts; + + MPN_ZERO (wp, ws); /* zero the accumulator */ + + { + mpfr_exp_t minexp; /* exponent of the LSB of the block for sum_raw */ + mpfr_prec_t cancel; /* number of cancelled bits */ + mpfr_exp_t e; /* temporary exponent of the result */ + mpfr_exp_t u; /* temporary exponent of the ulp (quantum) */ + mp_limb_t lbit; /* last bit (useful if even rounding) */ + mp_limb_t rbit; /* rounding bit (corrected in halfway case) */ + int corr; /* correction term (from -1 to 2) */ + int sd, sh; /* shift counts */ + mp_size_t sn; /* size of the output number */ + int tmd; /* 0: the TMD does not occur + 1: the TMD occurs on a machine number + 2: the TMD occurs on a midpoint */ + int neg; /* 0 if positive sum, 1 if negative */ + int sgn; /* +1 if positive sum, -1 if negative */ + + MPFR_LOG_MSG (("Compute an approximation with sum_raw...\n", 0)); + + /* Compute minexp = maxexp - (wq - cq) safely. */ + SAFE_SUB (minexp, maxexp, wq - cq); + MPFR_ASSERTD (wq >= logn + sq + 5); + cancel = sum_raw (wp, ws, wq, x, n, minexp, maxexp, tp, ts, + logn, sq + 3, &e, &minexp, &maxexp); + + if (MPFR_UNLIKELY (cancel == 0)) + { + /* The exact sum is zero. Since not all inputs are 0, the sum + * is +0 except in MPFR_RNDD, as specified according to the + * IEEE 754 rules for the addition of two numbers. + */ + MPFR_SET_SIGN (sum, (rnd != MPFR_RNDD ? + MPFR_SIGN_POS : MPFR_SIGN_NEG)); + MPFR_SET_ZERO (sum); + MPFR_TMP_FREE (marker); + MPFR_RET (0); + } + + /* The absolute value of the truncated sum is in the binade + [2^(e-1),2^e] (closed on both ends due to two's complement). + The error is strictly less than 2^(maxexp + logn) (and is 0 + if maxexp == MPFR_EXP_MIN). */ + + u = e - sq; /* e being the exponent, u is the ulp of the target */ + + /* neg = 1 if negative, 0 if positive. */ + neg = wp[ws-1] >> (GMP_NUMB_BITS - 1); + MPFR_ASSERTD (neg == 0 || neg == 1); + + sgn = neg ? -1 : 1; + MPFR_ASSERTN (sgn == (neg ? MPFR_SIGN_NEG : MPFR_SIGN_POS)); + + MPFR_LOG_MSG (("neg=%d sgn=%d cancel=%Pd" + " e=%" MPFR_EXP_FSPEC "d" + " u=%" MPFR_EXP_FSPEC "d" + " maxexp=%" MPFR_EXP_FSPEC "d%s\n", + neg, sgn, cancel, (mpfr_eexp_t) e, (mpfr_eexp_t) u, + (mpfr_eexp_t) maxexp, + maxexp == MPFR_EXP_MIN ? " (MPFR_EXP_MIN)" : "")); + + if (rnd == MPFR_RNDF) + { + /* Rounding the approximate value to nearest (ties don't matter) is + sufficient. We need to get the rounding bit; the code is similar + to a part from the generic code (here, corr = rbit). */ + if (MPFR_LIKELY (u > minexp)) + { + mpfr_prec_t tq; + mp_size_t wi; + int td; + + tq = u - minexp; + MPFR_ASSERTD (tq > 0); /* number of trailing bits */ + MPFR_LOG_MSG (("tq=%Pd\n", tq)); + + wi = tq / GMP_NUMB_BITS; + td = tq % GMP_NUMB_BITS; + corr = td >= 1 ? ((wp[wi] >> (td - 1)) & MPFR_LIMB_ONE) : + (MPFR_ASSERTD (wi >= 1), wp[wi-1] >> (GMP_NUMB_BITS - 1)); + } + else + corr = 0; + inex = 0; /* not meaningful, but needs to have a value */ + } + else /* rnd != MPFR_RNDF */ + { + if (MPFR_LIKELY (u > minexp)) + { + mpfr_prec_t tq; + mp_size_t wi; + int td; + + tq = u - minexp; + MPFR_ASSERTD (tq > 0); /* number of trailing bits */ + MPFR_LOG_MSG (("tq=%Pd\n", tq)); + + wi = tq / GMP_NUMB_BITS; + + /* Determine the rounding bit, which is represented. */ + td = tq % GMP_NUMB_BITS; + lbit = (wp[wi] >> td) & MPFR_LIMB_ONE; + rbit = td >= 1 ? ((wp[wi] >> (td - 1)) & MPFR_LIMB_ONE) : + (MPFR_ASSERTD (wi >= 1), wp[wi-1] >> (GMP_NUMB_BITS - 1)); + MPFR_ASSERTD (rbit == 0 || rbit == 1); + MPFR_LOG_MSG (("rbit=%d\n", (int) rbit)); + + if (maxexp == MPFR_EXP_MIN) + { + /* The sum in the accumulator is exact. Determine inex: + inex = 0 if the final sum is exact, else 1, i.e. + inex = rounding bit || sticky bit. In round to nearest, + also determine the rounding direction: obtained from + the rounding bit possibly except in halfway cases. + Halfway cases are rounded toward -inf iff the last bit + of the truncated significand in two's complement is 0 + (in precision > 1, because the parity after rounding is + the same in two's complement and sign + magnitude; in + precision 1, one checks that the rule works for both + positive (lbit == 1) and negative (lbit == 0) numbers, + rounding halfway cases away from zero). */ + if (MPFR_LIKELY (rbit == 0 || (rnd == MPFR_RNDN && lbit == 0))) + { + /* We need to determine the sticky bit, either to set inex + (if the rounding bit is 0) or to possibly "correct" rbit + (round to nearest, halfway case rounded downward) from + which the rounding direction will be determined. */ + MPFR_LOG_MSG (("Determine the sticky bit...\n", 0)); + + inex = td >= 2 ? (wp[wi] & MPFR_LIMB_MASK (td - 1)) != 0 + : td == 0 ? + (MPFR_ASSERTD (wi >= 1), + (wp[--wi] & MPFR_LIMB_MASK (GMP_NUMB_BITS - 1)) != 0) + : 0; + + if (!inex) + { + while (!inex && wi > 0) + inex = wp[--wi] != 0; + if (!inex && rbit != 0) + { + /* sticky bit = 0, rounding bit = 1, + i.e. halfway case, which will be + rounded downward (see earlier if). */ + MPFR_ASSERTD (rnd == MPFR_RNDN); + inex = 1; + rbit = 0; /* even rounding downward */ + MPFR_LOG_MSG (("Halfway case rounded downward;" + " set inex=1 rbit=0\n", 0)); + } + } + } + else + inex = 1; + tmd = 0; /* We can round correctly -> no TMD. */ + } + else /* maxexp > MPFR_EXP_MIN */ + { + mpfr_exp_t d; + mp_limb_t limb, mask; + int nbits; + + /* Since maxexp was set to either the exponent of a x[i] or + to minexp... */ + MPFR_ASSERTD (maxexp >= MPFR_EMIN_MIN || maxexp == minexp); + + inex = 1; /* We do not know whether the sum is exact. */ + + MPFR_ASSERTD (u <= MPFR_EMAX_MAX && u <= minexp + wq); + d = u - (maxexp + logn); /* representable */ + MPFR_ASSERTD (d >= 3); /* due to prec = sq + 3 in sum_raw */ + + /* Let's see whether the TMD occurs by looking at the d bits + following the ulp bit, or the d-1 bits after the rounding + bit. */ + + /* First chunk after the rounding bit... It starts at: + (wi,td-2) if td >= 2, + (wi-1,td-2+GMP_NUMB_BITS) if td < 2. */ + if (td == 0) + { + MPFR_ASSERTD (wi >= 1); + limb = wp[--wi]; + mask = MPFR_LIMB_MASK (GMP_NUMB_BITS - 1); + nbits = GMP_NUMB_BITS; + } + else if (td == 1) + { + limb = wi >= 1 ? wp[--wi] : MPFR_LIMB_ZERO; + mask = MPFR_LIMB_MAX; + nbits = GMP_NUMB_BITS + 1; + } + else /* td >= 2 */ + { + MPFR_ASSERTD (td >= 2); + limb = wp[wi]; + mask = MPFR_LIMB_MASK (td - 1); + nbits = td; + } + + /* nbits: number of bits of the first chunk + 1 + (the +1 is for the rounding bit). */ + + if (nbits > d) + { + /* Some low significant bits must be ignored. */ + limb >>= nbits - d; + mask >>= nbits - d; + d = 0; + } + else + { + d -= nbits; + MPFR_ASSERTD (d >= 0); + } + + limb &= mask; + tmd = + limb == MPFR_LIMB_ZERO ? + (rbit == 0 ? 1 : rnd == MPFR_RNDN ? 2 : 0) : + limb == mask ? + (limb = MPFR_LIMB_MAX, + rbit != 0 ? 1 : rnd == MPFR_RNDN ? 2 : 0) : 0; + + while (tmd != 0 && d != 0) + { + mp_limb_t limb2; + + MPFR_ASSERTD (d > 0); + if (wi == 0) + { + /* The non-represented bits are 0's. */ + if (limb != MPFR_LIMB_ZERO) + tmd = 0; + break; + } + MPFR_ASSERTD (wi > 0); + limb2 = wp[--wi]; + if (d < GMP_NUMB_BITS) + { + int c = GMP_NUMB_BITS - d; + MPFR_ASSERTD (c > 0 && c < GMP_NUMB_BITS); + if ((limb2 >> c) != (limb >> c)) + tmd = 0; + break; + } + if (limb2 != limb) + tmd = 0; + d -= GMP_NUMB_BITS; + } + } + } + else /* u <= minexp */ + { + /* The exact value of the accumulator will be copied. + * The TMD occurs if and only if there are bits still + * not taken into account, and if it occurs, this is + * necessarily on a machine number (-> tmd = 1). + */ + lbit = u == minexp ? wp[0] & MPFR_LIMB_ONE : 0; + rbit = 0; + inex = tmd = maxexp != MPFR_EXP_MIN; + } + + MPFR_ASSERTD (rbit == 0 || rbit == 1); + + MPFR_LOG_MSG (("tmd=%d lbit=%d rbit=%d inex=%d neg=%d\n", + tmd, (int) lbit, (int) rbit, inex, neg)); + + /* Here, if the final sum is known to be exact, inex = 0, otherwise + * inex = 1. We have a truncated significand, a trailing term t such + * that 0 <= t < 1 ulp, and an error on the trailing term bounded by + * t' in absolute value. Thus the error e on the truncated significand + * satisfies -t' <= e < 1 ulp + t'. Thus one has 4 correction cases + * denoted by a corr value between -1 and 2 depending on e, neg, rbit, + * and the rounding mode: + * -1: equivalent to nextbelow; + * 0: the truncated significand is not corrected; + * 1: add 1 ulp; + * 2: add 1 ulp, then nextabove. + * The nextbelow and nextabove are used here since there may be a + * change of the binade. + */ + + if (tmd == 0) /* no TMD */ + { + switch (rnd) + { + case MPFR_RNDD: + corr = 0; + break; + case MPFR_RNDU: + corr = inex; + break; + case MPFR_RNDZ: + corr = inex && neg; + break; + case MPFR_RNDA: + corr = inex && !neg; + break; + default: + MPFR_ASSERTN (rnd == MPFR_RNDN); + /* Note: for halfway cases (maxexp == MPFR_EXP_MIN) that are + rounded downward, rbit has been changed to 0 so that corr + is set correctly. */ + corr = rbit; + } + MPFR_ASSERTD (corr == 0 || corr == 1); + if (inex && + corr == 0) /* two's complement significand decreased */ + inex = -1; + } + else /* tmd */ + { + mpfr_exp_t minexp2; + mpfr_prec_t cancel2; + mpfr_exp_t err; /* exponent of the error bound */ + mp_size_t zz; /* nb of limbs to zero in the TMD accumulator */ + mp_limb_t *zp; /* pointer to the TMD accumulator */ + mpfr_prec_t zq; /* size of the TMD accumulator, in bits */ + int sst; /* sign of the secondary term */ + + /* TMD case. Here we use a new variable minexp2, with the same + meaning as minexp, as we want to keep the minexp value for + the copy to the destination. */ + + MPFR_ASSERTD (maxexp > MPFR_EXP_MIN); + MPFR_ASSERTD (tmd == 1 || tmd == 2); + + /* TMD accumulator */ + zp = wp + ws; + zq = (mpfr_prec_t) zs * GMP_NUMB_BITS; + + err = maxexp + logn; + + MPFR_LOG_MSG (("TMD with" + " maxexp=%" MPFR_EXP_FSPEC "d" + " err=%" MPFR_EXP_FSPEC "d" + " zs=%Pd" + " zq=%Pd\n", + (mpfr_eexp_t) maxexp, (mpfr_eexp_t) err, + (mpfr_prec_t) zs, zq)); + + /* The d-1 bits from u-2 to u-d (= err) are identical. */ + + if (err >= minexp) + { + mpfr_prec_t tq; + mp_size_t wi; + int td; + + /* Let's keep the last 2 over the d-1 identical bits and the + following bits, i.e. the bits from err+1 to minexp. */ + tq = err - minexp + 2; /* tq = number of such bits */ + MPFR_LOG_MSG (("[TMD] tq=%Pd\n", tq)); + MPFR_ASSERTD (tq >= 2); + + wi = tq / GMP_NUMB_BITS; + td = tq % GMP_NUMB_BITS; + + if (td != 0) + { + wi++; /* number of words with represented bits */ + td = GMP_NUMB_BITS - td; + zz = zs - wi; + MPFR_ASSERTD (zz >= 0 && zz < zs); + mpn_lshift (zp + zz, wp, wi, td); + } + else + { + MPFR_ASSERTD (wi > 0); + zz = zs - wi; + MPFR_ASSERTD (zz >= 0 && zz < zs); + if (zz > 0) + MPN_COPY (zp + zz, wp, wi); + } + + /* Compute minexp2 = minexp - (zs * GMP_NUMB_BITS + td) + safely. */ + SAFE_SUB (minexp2, minexp, zz * GMP_NUMB_BITS + td); + MPFR_ASSERTD (minexp2 == err + 2 - zq); + } + else /* err < minexp */ + { + /* At least one of the identical bits is not represented, + meaning that it is 0 and all these bits are 0's. Thus + the accumulator will be 0. The new minexp is determined + from maxexp, with cq bits reserved to avoid an overflow + (as in the early steps). */ + MPFR_LOG_MSG (("[TMD] err < minexp\n", 0)); + zz = zs; + + /* Compute minexp2 = maxexp - (zq - cq) safely. */ + SAFE_SUB (minexp2, maxexp, zq - cq); + MPFR_ASSERTD (minexp2 == err + 1 - zq); + } + + MPN_ZERO (zp, zz); + + /* We need to determine the sign sst of the secondary term. + In sum_raw, since the truncated sum corresponding to this + secondary term will be in [2^(e-1),2^e] and the error + strictly less than 2^err, we can stop the iterations when + e - err >= 1 (this bound is the 11th argument of sum_raw). */ + cancel2 = sum_raw (zp, zs, zq, x, n, minexp2, maxexp, tp, ts, + logn, 1, NULL, NULL, NULL); + + if (cancel2 != 0) + sst = MPFR_LIMB_MSB (zp[zs-1]) == 0 ? 1 : -1; + else if (tmd == 1) + sst = 0; + else + { + /* For halfway cases, let's virtually eliminate them + by setting a sst equivalent to a non-halfway case, + which depends on the last bit of the pre-rounded + result. */ + MPFR_ASSERTD (rnd == MPFR_RNDN && tmd == 2); + sst = lbit != 0 ? 1 : -1; + } + + MPFR_LOG_MSG (("[TMD] tmd=%d rbit=%d sst=%d\n", + tmd, (int) rbit, sst)); + + /* Do not consider the corrected sst for MPFR_COV_SET */ + MPFR_COV_SET (sum_tmd[(int) rnd][tmd-1][rbit] + [cancel2 == 0 ? 1 : sst+1][neg][sq > MPFR_PREC_MIN]); + + inex = + MPFR_IS_LIKE_RNDD (rnd, sgn) ? (sst ? -1 : 0) : + MPFR_IS_LIKE_RNDU (rnd, sgn) ? (sst ? 1 : 0) : + (MPFR_ASSERTD (rnd == MPFR_RNDN), + tmd == 1 ? - sst : sst); + + if (tmd == 2 && sst == (rbit != 0 ? -1 : 1)) + corr = 1 - (int) rbit; + else if (MPFR_IS_LIKE_RNDD (rnd, sgn) && sst == -1) + corr = (int) rbit - 1; + else if (MPFR_IS_LIKE_RNDU (rnd, sgn) && sst == +1) + corr = (int) rbit + 1; + else + corr = (int) rbit; + } /* tmd */ + } /* rnd != MPFR_RNDF */ + + MPFR_LOG_MSG (("neg=%d corr=%d inex=%d\n", neg, corr, inex)); + + /* Sign handling (-> absolute value and sign), together with + rounding. The most common cases are corr = 0 and corr = 1 + as this is necessarily the case when the TMD did not occur. */ + + MPFR_ASSERTD (corr >= -1 && corr <= 2); + + MPFR_SIGN (sum) = sgn; + + /* Let's copy/shift the bits [max(u,minexp),e) to the + most significant part of the destination, and zero + the least significant part (there can be one only if + u < minexp). The trailing bits of the destination may + contain garbage at this point. */ + + sn = MPFR_PREC2LIMBS (sq); + sd = (mpfr_prec_t) sn * GMP_NUMB_BITS - sq; + sh = cancel % GMP_NUMB_BITS; + + MPFR_ASSERTD (sd >= 0 && sd < GMP_NUMB_BITS); + + if (MPFR_LIKELY (u > minexp)) + { + mp_size_t wi; + + /* Recompute the initial value of wi. */ + wi = (u - minexp) / GMP_NUMB_BITS; + if (MPFR_LIKELY (sh != 0)) + { + mp_size_t fi; + + fi = (e - minexp) / GMP_NUMB_BITS - (sn - 1); + MPFR_ASSERTD (fi == wi || fi == wi + 1); + mpn_lshift (sump, wp + fi, sn, sh); + if (fi != wi) + sump[0] |= wp[wi] >> (GMP_NUMB_BITS - sh); + } + else + { + MPFR_ASSERTD ((mpfr_prec_t) (ws - (wi + sn)) * GMP_NUMB_BITS + == cancel); + MPN_COPY (sump, wp + wi, sn); + } + } + else /* u <= minexp */ + { + mp_size_t en; + + en = (e - minexp + (GMP_NUMB_BITS - 1)) / GMP_NUMB_BITS; + if (MPFR_LIKELY (sh != 0)) + mpn_lshift (sump + sn - en, wp, en, sh); + else if (MPFR_UNLIKELY (en > 0)) + MPN_COPY (sump + sn - en, wp, en); + if (sn > en) + MPN_ZERO (sump, sn - en); + } + + /* Let's take the complement if the result is negative, and at + the same time, do the rounding and zero the trailing bits. + As this is valid only for precisions >= 2, there is special + code for precision 1 first. */ + + if (MPFR_UNLIKELY (sq == 1)) /* precision 1 */ + { + sump[0] = MPFR_LIMB_HIGHBIT; + e += neg ? 1 - corr : corr; + } + else if (neg) /* negative result with sq > 1 */ + { + MPFR_ASSERTD (MPFR_LIMB_MSB (sump[sn-1]) == 0); + + /* abs(x + corr) = - (x + corr) = com(x) + (1 - corr) */ + + /* We want to avoid separate mpn_com (or mpn_neg) and mpn_add_1 + (or mpn_sub_1) operations, as they could yield two loops in + some particular cases involving a long sequence of 0's in + the low significant bits (except the least significant bit, + which doesn't matter). */ + + if (corr <= 1) + { + mp_limb_t corr2; + + /* Here we can just do the correction operation on the + least significant limb, then do either a mpn_com or + a mpn_neg on the remaining limbs, depending on the + carry (BTW, mpn_neg is just a mpn_com with an initial + carry propagation: after some point, mpn_neg does a + complement). */ + + corr2 = (mp_limb_t) (1 - corr) << sd; + /* Note: If corr = -1, this can overflow to corr2 = 0. + This case is taken into account below. */ + + sump[0] = (~ (sump[0] | MPFR_LIMB_MASK (sd))) + corr2; + + if (sump[0] < corr2 || (corr2 == 0 && corr < 0)) + { + if (sn == 1 || ! mpn_neg (sump + 1, sump + 1, sn - 1)) + { + /* Note: The | is important when sump[sn-1] is not 0 + (this can occur with sn = 1 and corr = -1). TODO: + Add something to make sure that this is tested. */ + sump[sn-1] |= MPFR_LIMB_HIGHBIT; + e++; + } + } + else if (sn > 1) + mpn_com (sump + 1, sump + 1, sn - 1); + } + else /* corr == 2 */ + { + mp_limb_t corr2, c; + mp_size_t i = 1; + + /* We want to compute com(x) - 1, but GMP doesn't have an + operation for that. The fact is that a sequence of low + significant bits 1 is invariant. Starting at the first + low significant bit 0, we can do the complement with + mpn_com. */ + + corr2 = MPFR_LIMB_ONE << sd; + c = ~ (sump[0] | MPFR_LIMB_MASK (sd)); + sump[0] = c - corr2; + + if (c == 0) + { + while (MPFR_ASSERTD (i < sn), sump[i] == MPFR_LIMB_MAX) + i++; + sump[i] = (~ sump[i]) - 1; + i++; + } + + if (i < sn) + mpn_com (sump + i, sump + i, sn - i); + else if (MPFR_UNLIKELY (MPFR_LIMB_MSB (sump[sn-1]) == 0)) + { + /* Happens on 01111...111, whose complement is + 10000...000, and com(x) - 1 is 01111...111. */ + sump[sn-1] |= MPFR_LIMB_HIGHBIT; + e--; + } + } + } + else /* positive result with sq > 1 */ + { + MPFR_ASSERTD (MPFR_LIMB_MSB (sump[sn-1]) != 0); + sump[0] &= ~ MPFR_LIMB_MASK (sd); + + if (corr > 0) + { + mp_limb_t corr2, carry_out; + + corr2 = (mp_limb_t) corr << sd; + /* If corr == 2 && sd == GMP_NUMB_BITS - 1, this overflows + to corr2 = 0. This case is taken into account below. */ + + carry_out = corr2 != 0 ? mpn_add_1 (sump, sump, sn, corr2) : + (MPFR_ASSERTD (sn > 1), + mpn_add_1 (sump + 1, sump + 1, sn - 1, MPFR_LIMB_ONE)); + + MPFR_ASSERTD (sump[sn-1] >> (GMP_NUMB_BITS - 1) == !carry_out); + + if (MPFR_UNLIKELY (carry_out)) + { + /* Note: The | is important when sump[sn-1] is not 0 + (this can occur with sn = 1 and corr = 2). TODO: + Add something to make sure that this is tested. */ + sump[sn-1] |= MPFR_LIMB_HIGHBIT; + e++; + } + } + + if (corr < 0) + { + mpn_sub_1 (sump, sump, sn, MPFR_LIMB_ONE << sd); + + if (MPFR_UNLIKELY (MPFR_LIMB_MSB (sump[sn-1]) == 0)) + { + sump[sn-1] |= MPFR_LIMB_HIGHBIT; + e--; + } + } + } + + MPFR_ASSERTD (MPFR_LIMB_MSB (sump[sn-1]) != 0); + MPFR_LOG_MSG (("Set exponent e=%" MPFR_EXP_FSPEC "d\n", (mpfr_eexp_t) e)); + /* e may be outside the current exponent range, but this will be checked + with mpfr_check_range below. */ + MPFR_EXP (sum) = e; + } /* main block */ + MPFR_TMP_FREE (marker); + return mpfr_check_range (sum, inex, rnd); } +/**********************************************************************/ -#define GET_EXP2(x) (MPFR_IS_ZERO (x) ? MPFR_EMIN_MIN : MPFR_GET_EXP (x)) - -/* Performs a heap sort of the entries */ -static void -heap_sort (mpfr_srcptr *const tab, unsigned long n, mpfr_srcptr *perm) +int +mpfr_sum (mpfr_ptr sum, const mpfr_ptr *x, unsigned long n, mpfr_rnd_t rnd) { - unsigned long dernier_traite; - unsigned long i, pere; - mpfr_srcptr tmp; - unsigned long fils_gauche, fils_droit, fils_indigne; - /* Reminder of a heap structure : - node(i) has for left son node(2i +1) and right son node(2i) - and father(node(i)) = node((i - 1) / 2) - */ - - /* initialize the permutation to identity */ - for (i = 0; i < n; i++) - perm[i] = tab[i]; + MPFR_LOG_FUNC + (("n=%lu rnd=%d", n, rnd), + ("sum[%Pu]=%.*Rg", mpfr_get_prec (sum), mpfr_log_prec, sum)); - /* insertion phase */ - for (dernier_traite = 1; dernier_traite < n; dernier_traite++) + if (MPFR_UNLIKELY (n <= 2)) { - i = dernier_traite; - while (i > 0) + if (n == 0) { - pere = (i - 1) / 2; - if (GET_EXP2 (perm[pere]) > GET_EXP2 (perm[i])) - { - tmp = perm[pere]; - perm[pere] = perm[i]; - perm[i] = tmp; - i = pere; - } - else - break; + MPFR_SET_ZERO (sum); + MPFR_SET_POS (sum); + MPFR_RET (0); } + else if (n == 1) + return mpfr_set (sum, x[0], rnd); + else + return mpfr_add (sum, x[0], x[1], rnd); } - - /* extraction phase */ - for (dernier_traite = n - 1; dernier_traite > 0; dernier_traite--) + else { - tmp = perm[0]; - perm[0] = perm[dernier_traite]; - perm[dernier_traite] = tmp; + mpfr_exp_t maxexp = MPFR_EXP_MIN; /* max(Empty) */ + unsigned long i; + unsigned long rn = 0; /* will be the number of regular inputs */ + /* sign of infinities and zeros (0: currently unknown) */ + int sign_inf = 0, sign_zero = 0; - i = 0; - while (1) + MPFR_LOG_MSG (("Check for special inputs (n = %lu >= 3)\n", n)); + + for (i = 0; i < n; i++) { - fils_gauche = 2 * i + 1; - fils_droit = fils_gauche + 1; - if (fils_gauche < dernier_traite) + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x[i]))) { - if (fils_droit < dernier_traite) + if (MPFR_IS_NAN (x[i])) + { + /* The current value x[i] is NaN. Then the sum is NaN. */ + nan: + MPFR_SET_NAN (sum); + MPFR_RET_NAN; + } + else if (MPFR_IS_INF (x[i])) { - if (GET_EXP2(perm[fils_droit]) < GET_EXP2(perm[fils_gauche])) - fils_indigne = fils_droit; - else - fils_indigne = fils_gauche; - - if (GET_EXP2 (perm[i]) > GET_EXP2 (perm[fils_indigne])) - { - tmp = perm[i]; - perm[i] = perm[fils_indigne]; - perm[fils_indigne] = tmp; - i = fils_indigne; - } - else - break; + /* The current value x[i] is an infinity. + There are two cases: + 1. This is the first infinity value (sign_inf == 0). + Then set sign_inf to its sign, and go on. + 2. All the infinities found until now have the same + sign sign_inf. If this new infinity has a different + sign, then return NaN immediately, else go on. */ + if (sign_inf == 0) + sign_inf = MPFR_SIGN (x[i]); + else if (MPFR_SIGN (x[i]) != sign_inf) + goto nan; } - else /* on a un fils gauche, pas de fils droit */ + else if (MPFR_UNLIKELY (rn == 0)) { - if (GET_EXP2 (perm[i]) > GET_EXP2 (perm[fils_gauche])) - { - tmp = perm[i]; - perm[i] = perm[fils_gauche]; - perm[fils_gauche] = tmp; - } - break; + /* The current value x[i] is a zero. The code below matters + only when all values found until now are zeros, otherwise + it is harmless (the test rn == 0 above is just a minor + optimization). + Here we track the sign of the zero result when all inputs + are zeros: if all zeros have the same sign, the result + will have this sign, otherwise (i.e. if there is at least + a zero of each sign), the sign of the zero result depends + only on the rounding mode (note that this choice is + sticky when new zeros are considered). */ + MPFR_ASSERTD (MPFR_IS_ZERO (x[i])); + if (sign_zero == 0) + sign_zero = MPFR_SIGN (x[i]); + else if (MPFR_SIGN (x[i]) != sign_zero) + sign_zero = rnd == MPFR_RNDD ? -1 : 1; } } - else /* on n'a pas de fils */ - break; + else + { + /* The current value x[i] is a regular number. */ + mpfr_exp_t e = MPFR_GET_EXP (x[i]); + if (e > maxexp) + maxexp = e; /* maximum exponent found until now */ + rn++; /* current number of regular inputs */ + } } - } -} + MPFR_LOG_MSG (("rn=%lu sign_inf=%d sign_zero=%d\n", + rn, sign_inf, sign_zero)); -/* Sum a list of float with order given by permutation perm, - * intermediate size set to F. Return non-zero if at least one of - * the operations is inexact (thus 0 implies that the sum is exact). - * Internal use function. - */ -static int -sum_once (mpfr_ptr ret, mpfr_srcptr *const tab, unsigned long n, mpfr_prec_t F) -{ - mpfr_t sum; - unsigned long i; - int error_trap; - - MPFR_ASSERTD (n >= 2); - - mpfr_init2 (sum, F); - error_trap = mpfr_set (sum, tab[0], MPFR_RNDN); - for (i = 1; i < n - 1; i++) - { - MPFR_ASSERTD (!MPFR_IS_NAN (sum) && !MPFR_IS_INF (sum)); - if (mpfr_add (sum, sum, tab[i], MPFR_RNDN)) - error_trap = 1; - } - if (mpfr_add (ret, sum, tab[n - 1], MPFR_RNDN)) - error_trap = 1; - mpfr_clear (sum); - return error_trap; -} + /* At this point the result cannot be NaN (this case has already + been filtered out). */ -/* Sum a list of floating-point numbers. - * If the return value is 0, then the sum is exact. - * Otherwise the return value gives no information. - */ -int -mpfr_sum (mpfr_ptr ret, mpfr_ptr *const tab_p, unsigned long n, mpfr_rnd_t rnd) -{ - mpfr_t cur_sum; - mpfr_prec_t prec; - mpfr_srcptr *perm, *const tab = (mpfr_srcptr *) tab_p; - int k, error_trap; - MPFR_ZIV_DECL (loop); - MPFR_SAVE_EXPO_DECL (expo); - MPFR_TMP_DECL (marker); + if (MPFR_UNLIKELY (sign_inf != 0)) + { + /* At least one infinity, and all of them have the same sign + sign_inf. The sum is the infinity of this sign. */ + MPFR_SET_INF (sum); + MPFR_SET_SIGN (sum, sign_inf); + MPFR_RET (0); + } - if (MPFR_UNLIKELY (n <= 1)) - { - if (n < 1) + /* At this point, all the inputs are finite numbers. */ + + if (MPFR_UNLIKELY (rn == 0)) { - MPFR_SET_ZERO (ret); - MPFR_SET_POS (ret); - return 0; + /* All the numbers were zeros (and there is at least one). + The sum is zero with sign sign_zero. */ + MPFR_ASSERTD (sign_zero != 0); + MPFR_SET_ZERO (sum); + MPFR_SET_SIGN (sum, sign_zero); + MPFR_RET (0); } - else - return mpfr_set (ret, tab[0], rnd); - } - /* Sort and treat special cases */ - MPFR_TMP_MARK (marker); - perm = (mpfr_srcptr *) MPFR_TMP_ALLOC (n * sizeof *perm); - prec = MPFR_PREC (ret); - error_trap = mpfr_sum_sort (tab, n, perm, &prec); - /* Check if there was a NAN or a INF */ - if (MPFR_UNLIKELY (error_trap != 0)) - { - MPFR_TMP_FREE (marker); - if (error_trap == 2) + /* Optimize the case where there are only two regular numbers. */ + if (MPFR_UNLIKELY (rn <= 2)) { - MPFR_SET_NAN (ret); - MPFR_RET_NAN; + unsigned long h = ULONG_MAX; + + for (i = 0; i < n; i++) + if (! MPFR_IS_SINGULAR (x[i])) + { + if (rn == 1) + return mpfr_set (sum, x[i], rnd); + if (h != ULONG_MAX) + return mpfr_add (sum, x[h], x[i], rnd); + h = i; + } + MPFR_RET_NEVER_GO_HERE(); } - MPFR_SET_INF (ret); - MPFR_SET_SIGN (ret, error_trap); - MPFR_RET (0); - } - /* Initial precision is max(prec(ret),prec(tab[0]),...,prec(tab[n-1])) */ - k = MPFR_INT_CEIL_LOG2 (n) + 1; - prec += k + 2; - mpfr_init2 (cur_sum, prec); - - /* Ziv Loop */ - MPFR_SAVE_EXPO_MARK (expo); - MPFR_ZIV_INIT (loop, prec); - for (;;) - { - error_trap = sum_once (cur_sum, perm, n, prec + k); - if (MPFR_LIKELY (error_trap == 0 || - (!MPFR_IS_ZERO (cur_sum) && - mpfr_can_round (cur_sum, prec - 2, - MPFR_RNDN, rnd, MPFR_PREC (ret))))) - break; - MPFR_ZIV_NEXT (loop, prec); - mpfr_set_prec (cur_sum, prec); + return sum_aux (sum, x, n, rnd, maxexp, rn); } - MPFR_ZIV_FREE (loop); - MPFR_TMP_FREE (marker); - - if (mpfr_set (ret, cur_sum, rnd)) - error_trap = 1; - mpfr_clear (cur_sum); - - MPFR_SAVE_EXPO_FREE (expo); - if (mpfr_check_range (ret, 0, rnd)) - error_trap = 1; - return error_trap; /* It doesn't return the ternary value */ } - -/* __END__ */ diff -Nru mpfr4-3.1.4/src/swap.c mpfr4-4.0.2/src/swap.c --- mpfr4-3.1.4/src/swap.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/swap.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_swap (U, V) -- Swap U and V. -Copyright 2000-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2000-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/tan.c mpfr4-4.0.2/src/tan.c --- mpfr4-3.1.4/src/tan.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/tan.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_tan -- tangent of a floating-point number -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H diff -Nru mpfr4-3.1.4/src/tanh.c mpfr4-4.0.2/src/tanh.c --- mpfr4-3.1.4/src/tanh.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/tanh.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_tanh -- hyperbolic tangent -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -84,7 +84,7 @@ For x > 0, exp(2*x) > 2^(2*x) If 2 ^(2*x) > 2^emax or x>emax/2, there is an overflow */ if (MPFR_UNLIKELY (mpfr_cmp_si (x, __gmpfr_emax/2) >= 0)) { - /* initialise of intermediary variables + /* initialize of intermediary variables since 'set_one' label assumes the variables have been initialize */ MPFR_GROUP_INIT_2 (group, MPFR_PREC_MIN, t, te); @@ -98,50 +98,62 @@ if (MPFR_GET_EXP (x) < 0) Nt += -MPFR_GET_EXP (x); - /* initialise of intermediary variable */ + /* The error analysis in algorithms.tex assumes that x is exactly + representable with working precision Nt. + FIXME: adapt the error analysis for the case Nt < PREC(x). */ + if (Nt < MPFR_PREC(x)) + Nt = MPFR_PREC(x); + + /* initialize of intermediary variable */ MPFR_GROUP_INIT_2 (group, Nt, t, te); MPFR_ZIV_INIT (loop, Nt); - for (;;) { - /* tanh = (exp(2x)-1)/(exp(2x)+1) */ - mpfr_mul_2ui (te, x, 1, MPFR_RNDN); /* 2x */ - /* since x > 0, we can only have an overflow */ - mpfr_exp (te, te, MPFR_RNDN); /* exp(2x) */ - if (MPFR_UNLIKELY (MPFR_IS_INF (te))) { - set_one: - inexact = MPFR_FROM_SIGN_TO_INT (sign); - mpfr_set4 (y, __gmpfr_one, MPFR_RNDN, sign); - if (MPFR_IS_LIKE_RNDZ (rnd_mode, MPFR_IS_NEG_SIGN (sign))) + for (;;) + { + /* tanh = (exp(2x)-1)/(exp(2x)+1) */ + inexact = mpfr_mul_2ui (te, x, 1, MPFR_RNDN); /* 2x */ + MPFR_ASSERTD(inexact == 0); /* see FIXME above */ + /* since x > 0, we can only have an overflow */ + mpfr_exp (te, te, MPFR_RNDN); /* exp(2x) */ + if (MPFR_UNLIKELY (MPFR_IS_INF (te))) { - inexact = -inexact; - mpfr_nexttozero (y); + set_one: + inexact = MPFR_FROM_SIGN_TO_INT (sign); + mpfr_set4 (y, __gmpfr_one, MPFR_RNDN, sign); + if (MPFR_IS_LIKE_RNDZ (rnd_mode, MPFR_IS_NEG_SIGN (sign))) + { + inexact = -inexact; + mpfr_nexttozero (y); + } + break; + } + d = MPFR_GET_EXP (te); /* For Error calculation */ + mpfr_add_ui (t, te, 1, MPFR_RNDD); /* exp(2x) + 1 */ + mpfr_sub_ui (te, te, 1, MPFR_RNDU); /* exp(2x) - 1 */ + d = d - MPFR_GET_EXP (te); + mpfr_div (t, te, t, MPFR_RNDN); /* (exp(2x)-1)/(exp(2x)+1) */ + + /* Calculation of the error, see algorithms.tex; the current value + of d is k in algorithms.tex. */ + d = MAX(3, d + 1); /* d = exponent in 2^(max(3,k+1)) */ + err = Nt - (d + 1); + + /* The inequality is the condition max(3,k+1) <= floor(p/2). */ + if (MPFR_LIKELY (d <= Nt / 2 && + MPFR_CAN_ROUND (t, err, Ny, rnd_mode))) + { + inexact = mpfr_set4 (y, t, rnd_mode, sign); + break; } - break; - } - d = MPFR_GET_EXP (te); /* For Error calculation */ - mpfr_add_ui (t, te, 1, MPFR_RNDD); /* exp(2x) + 1*/ - mpfr_sub_ui (te, te, 1, MPFR_RNDU); /* exp(2x) - 1*/ - d = d - MPFR_GET_EXP (te); - mpfr_div (t, te, t, MPFR_RNDN); /* (exp(2x)-1)/(exp(2x)+1)*/ - - /* Calculation of the error */ - d = MAX(3, d + 1); - err = Nt - (d + 1); - - if (MPFR_LIKELY ((d <= Nt / 2) && MPFR_CAN_ROUND (t, err, Ny, rnd_mode))) - { - inexact = mpfr_set4 (y, t, rnd_mode, sign); - break; - } - /* if t=1, we still can round since |sinh(x)| < 1 */ - if (MPFR_GET_EXP (t) == 1) - goto set_one; - - /* Actualisation of the precision */ - MPFR_ZIV_NEXT (loop, Nt); - MPFR_GROUP_REPREC_2 (group, Nt, t, te); - } + /* if t=1, we still can round since |sinh(x)| < 1 */ + if (MPFR_GET_EXP (t) == 1) + goto set_one; + + /* Actualisation of the precision */ + MPFR_ZIV_NEXT (loop, Nt); + MPFR_GROUP_REPREC_2 (group, Nt, t, te); + } MPFR_ZIV_FREE (loop); MPFR_GROUP_CLEAR (group); } diff -Nru mpfr4-3.1.4/src/ubf.c mpfr4-4.0.2/src/ubf.c --- mpfr4-3.1.4/src/ubf.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/src/ubf.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,242 @@ +/* Functions to work with unbounded floats (limited low-level interface). + +Copyright 2016-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define MPFR_NEED_LONGLONG_H +#include "mpfr-impl.h" + +/* Note: In MPFR math functions, even if UBF code is not called first, + we may still need to handle special values NaN and infinities here. + Indeed, for MAXR * MAXR + (-inf), even though this is a special case, + the computation will also generate an overflow due to MAXR * MAXR, + so that UBF code will be called anyway (except if special cases are + detected and handled separately, but for polynomial, this should not + be needed). */ + +/* This function does not change the flags. */ +static void +mpfr_init_get_zexp (mpz_ptr ez, mpfr_srcptr x) +{ + mpz_init (ez); + + if (MPFR_IS_UBF (x)) + mpz_set (ez, MPFR_ZEXP (x)); + else + { + mp_limb_t e_limb[MPFR_EXP_LIMB_SIZE]; + mpfr_t e; + int inex; + MPFR_SAVE_EXPO_DECL (expo); + + /* TODO: Once this has been tested, optimize based on whether + _MPFR_EXP_FORMAT <= 3. */ + MPFR_TMP_INIT1 (e_limb, e, sizeof (mpfr_exp_t) * CHAR_BIT); + MPFR_SAVE_EXPO_MARK (expo); + MPFR_DBGRES (inex = mpfr_set_exp_t (e, MPFR_GET_EXP (x), MPFR_RNDN)); + MPFR_ASSERTD (inex == 0); + MPFR_DBGRES (inex = mpfr_get_z (ez, e, MPFR_RNDN)); + MPFR_ASSERTD (inex == 0); + MPFR_SAVE_EXPO_FREE (expo); + } +} + +/* Exact product. The number a is assumed to have enough allocated memory, + where the trailing bits are regarded as being part of the input numbers + (no reallocation is attempted and no check is performed as MPFR_TMP_INIT + could have been used). The arguments b and c may actually be UBF numbers + (mpfr_srcptr can be seen a bit like void *, but is stronger). + This function does not change the flags, except in case of NaN. */ +void +mpfr_ubf_mul_exact (mpfr_ubf_ptr a, mpfr_srcptr b, mpfr_srcptr c) +{ + MPFR_LOG_FUNC + (("b[%Pu]=%.*Rg c[%Pu]=%.*Rg", + mpfr_get_prec (b), mpfr_log_prec, b, + mpfr_get_prec (c), mpfr_log_prec, c), + ("a[%Pu]=%.*Rg", + mpfr_get_prec (a), mpfr_log_prec, a)); + + MPFR_ASSERTD ((mpfr_ptr) a != b); + MPFR_ASSERTD ((mpfr_ptr) a != c); + MPFR_SIGN (a) = MPFR_MULT_SIGN (MPFR_SIGN (b), MPFR_SIGN (c)); + + if (MPFR_ARE_SINGULAR (b, c)) + { + if (MPFR_IS_NAN (b) || MPFR_IS_NAN (c)) + MPFR_SET_NAN (a); + else if (MPFR_IS_INF (b)) + { + if (MPFR_NOTZERO (c)) + MPFR_SET_INF (a); + else + MPFR_SET_NAN (a); + } + else if (MPFR_IS_INF (c)) + { + if (!MPFR_IS_ZERO (b)) + MPFR_SET_INF (a); + else + MPFR_SET_NAN (a); + } + else + { + MPFR_ASSERTD (MPFR_IS_ZERO(b) || MPFR_IS_ZERO(c)); + MPFR_SET_ZERO (a); + } + } + else + { + mpfr_exp_t e; + mp_size_t bn, cn; + mpfr_limb_ptr ap; + mp_limb_t u, v; + int m; + + /* Note about the code below: For the choice of the precision of + * the result a, one could choose PREC(b) + PREC(c), instead of + * taking whole limbs into account, but in most cases where one + * would gain one limb, one would need to copy the significand + * instead of a no-op (see the mul.c code). + * But in the case MPFR_LIMB_MSB (u) == 0, if the result fits in + * an-1 limbs, one could actually do + * mpn_rshift (ap, ap, k, GMP_NUMB_BITS - 1) + * instead of + * mpn_lshift (ap, ap, k, 1) + * to gain one limb (and reduce the precision), replacing a shift + * by another one. Would this be interesting? + */ + + bn = MPFR_LIMB_SIZE (b); + cn = MPFR_LIMB_SIZE (c); + + ap = MPFR_MANT (a); + + if (bn == 1 && cn == 1) + { + umul_ppmm (ap[1], ap[0], MPFR_MANT(b)[0], MPFR_MANT(c)[0]); + if (ap[1] & MPFR_LIMB_HIGHBIT) + m = 0; + else + { + ap[1] = (ap[1] << 1) | (ap[0] >> (GMP_NUMB_BITS - 1)); + ap[0] = ap[0] << 1; + m = 1; + } + } + else + { + u = (bn >= cn) ? + mpn_mul (ap, MPFR_MANT (b), bn, MPFR_MANT (c), cn) : + mpn_mul (ap, MPFR_MANT (c), cn, MPFR_MANT (b), bn); + if (MPFR_LIMB_MSB (u) == 0) + { + m = 1; + MPFR_DBGRES (v = mpn_lshift (ap, ap, bn + cn, 1)); + MPFR_ASSERTD (v == 0); + } + else + m = 0; + } + + if (! MPFR_IS_UBF (b) && ! MPFR_IS_UBF (c) && + (e = MPFR_GET_EXP (b) + MPFR_GET_EXP (c) - m, + MPFR_EXP_IN_RANGE (e))) + { + MPFR_SET_EXP (a, e); + } + else + { + mpz_t be, ce; + + mpz_init (MPFR_ZEXP (a)); + + /* This may involve copies of mpz_t, but exponents should not be + very large integers anyway. */ + mpfr_init_get_zexp (be, b); + mpfr_init_get_zexp (ce, c); + mpz_add (MPFR_ZEXP (a), be, ce); + mpz_clear (be); + mpz_clear (ce); + mpz_sub_ui (MPFR_ZEXP (a), MPFR_ZEXP (a), m); + MPFR_SET_UBF (a); + } + } +} + +int +mpfr_ubf_exp_less_p (mpfr_srcptr x, mpfr_srcptr y) +{ + mpz_t xe, ye; + int c; + + mpfr_init_get_zexp (xe, x); + mpfr_init_get_zexp (ye, y); + c = mpz_cmp (xe, ye) < 0; + mpz_clear (xe); + mpz_clear (ye); + return c; +} + +/* Convert an mpz_t to an mpfr_exp_t, restricted to + the interval [MPFR_EXP_MIN,MPFR_EXP_MAX]. */ +mpfr_exp_t +mpfr_ubf_zexp2exp (mpz_ptr ez) +{ + mp_size_t n; + mpfr_eexp_t e; + mpfr_t d; + int inex; + MPFR_SAVE_EXPO_DECL (expo); + + n = ABSIZ (ez); /* limb size of ez */ + if (n == 0) + return 0; + + MPFR_SAVE_EXPO_MARK (expo); + mpfr_init2 (d, n * GMP_NUMB_BITS); + MPFR_DBGRES (inex = mpfr_set_z (d, ez, MPFR_RNDN)); + MPFR_ASSERTD (inex == 0); + e = mpfr_get_exp_t (d, MPFR_RNDZ); + mpfr_clear (d); + MPFR_SAVE_EXPO_FREE (expo); + if (MPFR_UNLIKELY (e < MPFR_EXP_MIN)) + return MPFR_EXP_MIN; + if (MPFR_UNLIKELY (e > MPFR_EXP_MAX)) + return MPFR_EXP_MAX; + return e; +} + +/* Return the difference of the exponents of x and y, restricted to + the interval [MPFR_EXP_MIN,MPFR_EXP_MAX]. */ +mpfr_exp_t +mpfr_ubf_diff_exp (mpfr_srcptr x, mpfr_srcptr y) +{ + mpz_t xe, ye; + mpfr_exp_t e; + + mpfr_init_get_zexp (xe, x); + mpfr_init_get_zexp (ye, y); + mpz_sub (xe, xe, ye); + mpz_clear (ye); + e = mpfr_ubf_zexp2exp (xe); + mpz_clear (xe); + return e; +} diff -Nru mpfr4-3.1.4/src/uceil_exp2.c mpfr4-4.0.2/src/uceil_exp2.c --- mpfr4-3.1.4/src/uceil_exp2.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/uceil_exp2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* __gmpfr_ceil_exp2 - returns y >= 2^d -Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -29,8 +29,8 @@ __gmpfr_ceil_exp2 (double d) { long exp; -#if _GMP_IEEE_FLOATS - union ieee_double_extract x; +#if _MPFR_IEEE_FLOATS + union mpfr_ieee_double_extract x; #else struct {double d;} x; #endif @@ -41,7 +41,7 @@ exp++; /* now exp = ceil(d) */ x.d = 1.0; -#if _GMP_IEEE_FLOATS +#if _MPFR_IEEE_FLOATS x.s.exp = exp <= -1022 ? 1 : 1023 + exp; #else if (exp >= 0) @@ -60,6 +60,6 @@ exp++; } } -#endif +#endif /* _MPFR_IEEE_FLOATS */ return x.d; } diff -Nru mpfr4-3.1.4/src/uceil_log2.c mpfr4-4.0.2/src/uceil_log2.c --- mpfr4-3.1.4/src/uceil_log2.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/uceil_log2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* __gmpfr_ceil_log2 - returns ceil(log(d)/log(2)) -Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,47 +17,51 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" /* returns ceil(log(d)/log(2)) if d > 0, -1023 if d = +0, - and floor(log(-d)/log(2))+1 if d < 0*/ + and floor(log(-d)/log(2))+1 if d < 0 +*/ long __gmpfr_ceil_log2 (double d) { long exp; -#if _GMP_IEEE_FLOATS - union ieee_double_extract x; +#if _MPFR_IEEE_FLOATS + union mpfr_ieee_double_extract x; x.d = d; - exp = x.s.exp - 1023; + /* The cast below is useless in theory, but let us not depend on the + integer promotion rules (for instance, tcc is currently wrong). */ + exp = (long) x.s.exp - 1023; + MPFR_ASSERTN (exp < 1023); /* fail on infinities */ x.s.exp = 1023; /* value for 1 <= d < 2 */ if (x.d != 1.0) /* d: not a power of two? */ exp++; return exp; -#else +#else /* _MPFR_IEEE_FLOATS */ double m; if (d < 0.0) - return __gmpfr_floor_log2(-d)+1; + return __gmpfr_floor_log2 (-d) + 1; else if (d == 0.0) return -1023; else if (d >= 1.0) { exp = 0; - for( m= 1.0 ; m < d ; m *=2.0 ) + for (m = 1.0; m < d; m *= 2.0) exp++; } else { exp = 1; - for( m= 1.0 ; m >= d ; m *= (1.0/2.0) ) + for (m = 1.0; m >= d; m *= 0.5) exp--; } -#endif +#endif /* _MPFR_IEEE_FLOATS */ return exp; } diff -Nru mpfr4-3.1.4/src/ufloor_log2.c mpfr4-4.0.2/src/ufloor_log2.c --- mpfr4-3.1.4/src/ufloor_log2.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/ufloor_log2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* __gmpfr_floor_log2 - returns floor(log(d)/log(2)) -Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -26,28 +26,32 @@ long __gmpfr_floor_log2 (double d) { -#if _GMP_IEEE_FLOATS - union ieee_double_extract x; + long exp; +#if _MPFR_IEEE_FLOATS + union mpfr_ieee_double_extract x; x.d = d; - return (long) x.s.exp - 1023; -#else - long exp; + /* The cast below is useless in theory, but let us not depend on the + integer promotion rules (for instance, tcc is currently wrong). */ + exp = (long) x.s.exp - 1023; + MPFR_ASSERTN (exp < 1023); /* fail on infinities */ + return exp; +#else /* _MPFR_IEEE_FLOATS */ double m; MPFR_ASSERTD (d >= 0); if (d >= 1.0) { exp = -1; - for( m= 1.0 ; m <= d ; m *=2.0 ) + for (m = 1.0; m <= d; m *= 2.0) exp++; } else { exp = 0; - for( m= 1.0 ; m > d ; m *= (1.0/2.0) ) + for (m = 1.0; m > d; m *= 0.5) exp--; } return exp; -#endif +#endif /* _MPFR_IEEE_FLOATS */ } diff -Nru mpfr4-3.1.4/src/ui_div.c mpfr4-4.0.2/src/ui_div.c --- mpfr4-3.1.4/src/ui_div.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/ui_div.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,6 @@ /* mpfr_ui_div -- divide a machine integer by a floating-point number - mpfr_si_div -- divide a machine number by a floating-point number -Copyright 2000-2016 Free Software Foundation, Inc. +Copyright 2000-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ @@ -54,7 +53,7 @@ /* u > 0, so y = sign(x) * Inf */ MPFR_SET_SAME_SIGN(y, x); MPFR_SET_INF(y); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); MPFR_RET(0); } else @@ -95,20 +94,3 @@ MPFR_RET(0); } } - - -int -mpfr_si_div (mpfr_ptr y, long int u, mpfr_srcptr x, mpfr_rnd_t rnd_mode) -{ - int res; - - if (u >= 0) - res = mpfr_ui_div (y, u, x, rnd_mode); - else - { - res = - mpfr_ui_div (y, - (unsigned long) u, x, - MPFR_INVERT_RND(rnd_mode)); - MPFR_CHANGE_SIGN (y); - } - return res; -} diff -Nru mpfr4-3.1.4/src/ui_pow.c mpfr4-4.0.2/src/ui_pow.c --- mpfr4-3.1.4/src/ui_pow.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/ui_pow.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_ui_pow -- power of n function n^x -Copyright 2001-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2001-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -27,14 +27,14 @@ { mpfr_t t; int inexact; + mp_limb_t tmp_mant[(sizeof (n) - 1) / sizeof (mp_limb_t) + 1]; MPFR_SAVE_EXPO_DECL (expo); MPFR_SAVE_EXPO_MARK (expo); - mpfr_init2 (t, sizeof(n) * CHAR_BIT); + MPFR_TMP_INIT1(tmp_mant, t, sizeof(n) * CHAR_BIT); inexact = mpfr_set_ui (t, n, MPFR_RNDN); - MPFR_ASSERTN (!inexact); + MPFR_ASSERTD (inexact == 0); inexact = mpfr_pow (y, t, x, rnd_mode); - mpfr_clear (t); MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); MPFR_SAVE_EXPO_FREE (expo); return mpfr_check_range (y, inexact, rnd_mode); diff -Nru mpfr4-3.1.4/src/ui_pow_ui.c mpfr4-4.0.2/src/ui_pow_ui.c --- mpfr4-3.1.4/src/ui_pow_ui.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/ui_pow_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ -/* mpfr_ui_pow_ui -- compute the power beetween two machine integer +/* mpfr_ui_pow_ui -- compute the power between two machine integers -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/ui_sub.c mpfr4-4.0.2/src/ui_sub.c --- mpfr4-3.1.4/src/ui_sub.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/ui_sub.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_ui_sub -- subtract a floating-point number from an integer -Copyright 2000-2016 Free Software Foundation, Inc. +Copyright 2000-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -31,48 +31,52 @@ u, mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode), ("y[%Pu]=%.*Rg", mpfr_get_prec(y), mpfr_log_prec, y)); + /* (unsigned long) 0 is assumed to be a real 0 (unsigned) */ if (MPFR_UNLIKELY (u == 0)) return mpfr_neg (y, x, rnd_mode); - if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x))) + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) { - if (MPFR_IS_NAN(x)) + if (MPFR_IS_NAN (x)) { - MPFR_SET_NAN(y); + MPFR_SET_NAN (y); MPFR_RET_NAN; } - else if (MPFR_IS_INF(x)) + if (MPFR_IS_INF (x)) { /* u - Inf = -Inf and u - -Inf = +Inf */ - MPFR_SET_INF(y); - MPFR_SET_OPPOSITE_SIGN(y,x); - MPFR_RET(0); /* +/-infinity is exact */ + MPFR_SET_INF (y); + MPFR_SET_OPPOSITE_SIGN (y, x); + MPFR_RET (0); /* +/-infinity is exact */ } - else /* x is zero */ - /* u - 0 = u */ - return mpfr_set_ui(y, u, rnd_mode); - } - else - { - mpfr_t uu; - mp_limb_t up[1]; - int cnt; - int inex; - - MPFR_SAVE_EXPO_DECL (expo); - - MPFR_TMP_INIT1 (up, uu, GMP_NUMB_BITS); - MPFR_ASSERTN(u == (mp_limb_t) u); - count_leading_zeros (cnt, (mp_limb_t) u); - up[0] = (mp_limb_t) u << cnt; - - /* Optimization note: Exponent save/restore operations may be - removed if mpfr_sub works even when uu is out-of-range. */ - MPFR_SAVE_EXPO_MARK (expo); - MPFR_SET_EXP (uu, GMP_NUMB_BITS - cnt); - inex = mpfr_sub (y, uu, x, rnd_mode); - MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); - MPFR_SAVE_EXPO_FREE (expo); - return mpfr_check_range(y, inex, rnd_mode); + MPFR_ASSERTD (MPFR_IS_ZERO (x) && u != 0); + /* Note: the fact that u != 0 is important due to signed zeros. */ + /* u - 0 = u */ + return mpfr_set_ui (y, u, rnd_mode); } + + /* Main code */ + { + mpfr_t uu; + mp_limb_t up[1]; + int cnt; + int inex; + MPFR_SAVE_EXPO_DECL (expo); + + MPFR_TMP_INIT1 (up, uu, GMP_NUMB_BITS); + MPFR_STAT_STATIC_ASSERT (MPFR_LIMB_MAX >= ULONG_MAX); + /* So, u fits in a mp_limb_t, which justifies the casts below. */ + MPFR_ASSERTD (u != 0); + count_leading_zeros (cnt, (mp_limb_t) u); + up[0] = (mp_limb_t) u << cnt; + + /* Optimization note: Exponent save/restore operations may be + removed if mpfr_sub works even when uu is out-of-range. */ + MPFR_SAVE_EXPO_MARK (expo); + MPFR_SET_EXP (uu, GMP_NUMB_BITS - cnt); + inex = mpfr_sub (y, uu, x, rnd_mode); + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); + MPFR_SAVE_EXPO_FREE (expo); + return mpfr_check_range (y, inex, rnd_mode); + } } diff -Nru mpfr4-3.1.4/src/urandomb.c mpfr4-4.0.2/src/urandomb.c --- mpfr4-3.1.4/src/urandomb.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/urandomb.c 2019-01-07 13:53:20.000000000 +0000 @@ -3,7 +3,7 @@ using STATE as the random state previously initialized by a call to gmp_randinit_lc_2exp_size(). -Copyright 2000-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2000-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -20,7 +20,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ @@ -36,16 +36,14 @@ mpz_t z; MPFR_ASSERTN (nbits >= 1); - /* To be sure to avoid the potential allocation of mpz_urandomb */ - ALLOC(z) = SIZ(z) = MPFR_PREC2LIMBS (nbits); - PTR(z) = mp; -#if __MPFR_GMP(5,0,0) /* Check for integer overflow (unless mp_bitcnt_t is signed, but according to the GMP manual, this shouldn't happen). Note: mp_bitcnt_t has been introduced in GMP 5.0.0. */ MPFR_ASSERTN ((mp_bitcnt_t) -1 < 0 || nbits <= (mp_bitcnt_t) -1); -#endif + mpz_init (z); mpz_urandomb (z, rstate, nbits); + MPN_COPY(mp, PTR(z), MPFR_PREC2LIMBS (nbits)); + mpz_clear (z); } int @@ -85,7 +83,8 @@ { count_leading_zeros (cnt, rp[nlimbs - 1]); /* Normalization */ - if (mpfr_set_exp (rop, exp - cnt)) + exp -= cnt; + if (MPFR_UNLIKELY (! MPFR_EXP_IN_RANGE (exp))) { /* If the exponent is not in the current exponent range, we choose to return a NaN as this is probably a user error. @@ -96,10 +95,11 @@ __gmpfr_flags |= MPFR_FLAGS_NAN; /* Can't use MPFR_RET_NAN */ return 1; } + MPFR_SET_EXP (rop, exp); if (cnt != 0) mpn_lshift (rp + k, rp, nlimbs, cnt); else if (k != 0) - MPN_COPY (rp + k, rp, nlimbs); + mpn_copyd (rp + k, rp, nlimbs); if (k != 0) MPN_ZERO (rp, k); } diff -Nru mpfr4-3.1.4/src/urandom.c mpfr4-4.0.2/src/urandom.c --- mpfr4-3.1.4/src/urandom.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/urandom.c 2019-01-07 13:53:20.000000000 +0000 @@ -2,7 +2,7 @@ real number between 0 and 1 (exclusive) and round it to the precision of rop according to the given rounding mode. -Copyright 2000-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2000-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -19,7 +19,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ @@ -27,16 +27,28 @@ #include "mpfr-impl.h" -/* generate one random bit */ -static int -random_rounding_bit (gmp_randstate_t rstate) -{ - mp_limb_t r; - - mpfr_rand_raw (&r, rstate, 1); - return r & MPFR_LIMB_ONE; -} - +/* The mpfr_urandom() function is implemented in the following way, + so that the exact number (the random value to be rounded) and the + final status of the random generator do not depend on the current + exponent range and on the rounding mode. However, they depend on + the target precision: from the same state of the random generator, + if the precision of the destination is changed, then the value may + be completely different (and the state of the random generator is + different too). + 1. One determines the exponent exp: 0 with probability 1/2, -1 with + probability 1/4, -2 with probability 1/8, etc. + 2. One draws a 1-ulp interval ]a,b[ containing the exact result (the + interval can be regarded as open since it has the same measure as + the closed interval). + One also draws the rounding bit. This is currently done with a + separate call to mpfr_rand_raw(), but it should be better to draw + the rounding bit as part of the significand; there is space for it + since the MSB is always 1. + 3. Rounding is done. For the directed rounding modes, the rounded value + is uniquely determined. For rounding to nearest, ]a,m[ and ]m,b[, + where m = (a+b)/2, have the same measure, so that one gets a or b + with equal probabilities. +*/ int mpfr_urandom (mpfr_ptr rop, gmp_randstate_t rstate, mpfr_rnd_t rnd_mode) @@ -46,37 +58,28 @@ mp_size_t nlimbs; mp_size_t n; mpfr_exp_t exp; - mpfr_exp_t emin; + mp_limb_t rbit; int cnt; int inex; + MPFR_SAVE_EXPO_DECL (expo); + + /* We need to extend the exponent range in order to simplify + the case where one rounds upward (we would not be able to + use mpfr_nextabove() in the case emin = max). It could be + partly reimplemented under a simpler form here, but it is + better to make the code shorter and more readable. */ + MPFR_SAVE_EXPO_MARK (expo); rp = MPFR_MANT (rop); nbits = MPFR_PREC (rop); - nlimbs = MPFR_LIMB_SIZE (rop); + MPFR_SET_EXP (rop, 0); MPFR_SET_POS (rop); exp = 0; - emin = mpfr_get_emin (); - if (MPFR_UNLIKELY (emin > 0)) - { - if (rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDA - || (emin == 1 && rnd_mode == MPFR_RNDN - && random_rounding_bit (rstate))) - { - mpfr_set_ui_2exp (rop, 1, emin - 1, rnd_mode); - return +1; - } - else - { - MPFR_SET_ZERO (rop); - return -1; - } - } - /* Exponent */ + /* Step 1 (exponent). */ #define DRAW_BITS 8 /* we draw DRAW_BITS at a time */ - cnt = DRAW_BITS; - MPFR_ASSERTN(DRAW_BITS <= GMP_NUMB_BITS); - while (cnt == DRAW_BITS) + MPFR_STAT_STATIC_ASSERT (DRAW_BITS <= GMP_NUMB_BITS); + do { /* generate DRAW_BITS in rp[0] */ mpfr_rand_raw (rp, rstate, DRAW_BITS); @@ -87,61 +90,49 @@ count_leading_zeros (cnt, rp[0]); cnt -= GMP_NUMB_BITS - DRAW_BITS; } - - if (MPFR_UNLIKELY (exp < emin + cnt)) - { - /* To get here, we have been drawing more than -emin zeros - in a row, then return 0 or the smallest representable - positive number. - - The rounding to nearest mode is subtle: - If exp - cnt == emin - 1, the rounding bit is set, except - if cnt == DRAW_BITS in which case the rounding bit is - outside rp[0] and must be generated. */ - if (rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDA - || (rnd_mode == MPFR_RNDN && cnt == exp - emin - 1 - && (cnt != DRAW_BITS || random_rounding_bit (rstate)))) - { - mpfr_set_ui_2exp (rop, 1, emin - 1, rnd_mode); - return +1; - } - else - { - MPFR_SET_ZERO (rop); - return -1; - } - } - exp -= cnt; + /* Any value of exp < MPFR_EMIN_MIN - 1 are equivalent. So, we can + avoid a theoretical integer overflow in the following way. */ + if (MPFR_LIKELY (exp >= MPFR_EMIN_MIN - 1)) + exp -= cnt; /* no integer overflow */ + } + while (cnt == DRAW_BITS); + /* We do not want the random generator to depend on the ABI or on the + exponent range. Therefore we do not use MPFR_EMIN_MIN or __gmpfr_emin + in the stop condition. */ + + /* Step 2 (significand): we need generate only nbits-1 bits, since the + most significant bit is 1. */ + if (MPFR_UNLIKELY (nbits == 1)) + { + rp[0] = MPFR_LIMB_HIGHBIT; + } + else + { + mpfr_rand_raw (rp, rstate, nbits - 1); + nlimbs = MPFR_LIMB_SIZE (rop); + n = nlimbs * GMP_NUMB_BITS - nbits; + if (MPFR_LIKELY (n != 0)) /* this will put the low bits to zero */ + mpn_lshift (rp, rp, nlimbs, n); + rp[nlimbs - 1] |= MPFR_LIMB_HIGHBIT; } - MPFR_EXP (rop) = exp; /* Warning: may be outside the current - exponent range */ - - - /* Significand: we need generate only nbits-1 bits, since the most - significant is 1 */ - mpfr_rand_raw (rp, rstate, nbits - 1); - n = nlimbs * GMP_NUMB_BITS - nbits; - if (MPFR_LIKELY (n != 0)) /* this will put the low bits to zero */ - mpn_lshift (rp, rp, nlimbs, n); - /* Set the msb to 1 since it was fixed by the exponent choice */ - rp[nlimbs - 1] |= MPFR_LIMB_HIGHBIT; + /* Rounding bit */ + mpfr_rand_raw (&rbit, rstate, 1); + MPFR_ASSERTD (rbit == 0 || rbit == 1); - /* Rounding */ + /* Step 3 (rounding). */ if (rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDA - || (rnd_mode == MPFR_RNDN && random_rounding_bit (rstate))) + || (rnd_mode == MPFR_RNDN && rbit != 0)) { - /* Take care of the exponent range: it may have been reduced */ - if (exp < emin) - mpfr_set_ui_2exp (rop, 1, emin - 1, rnd_mode); - else if (exp > mpfr_get_emax ()) - mpfr_set_inf (rop, +1); /* overflow, flag set by mpfr_check_range */ - else - mpfr_nextabove (rop); + mpfr_nextabove (rop); inex = +1; } else - inex = -1; + { + inex = -1; + } + MPFR_EXP (rop) += exp; /* may be smaller than emin */ + MPFR_SAVE_EXPO_FREE (expo); return mpfr_check_range (rop, inex, rnd_mode); } diff -Nru mpfr4-3.1.4/src/vasprintf.c mpfr4-4.0.2/src/vasprintf.c --- mpfr4-3.1.4/src/vasprintf.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/vasprintf.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ -/* mpfr_vasprintf -- main function for the printf functions family - plus helper macros & functions. +/* mpfr_vasnprintf_aux -- helper function for the formatted output functions + (printf functions family). -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,15 +18,45 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* If the number of output characters is larger than INT_MAX, the + ISO C99 standard is silent, but POSIX says concerning the snprintf() + function: + "[EOVERFLOW] The value of n is greater than {INT_MAX} or the + number of bytes needed to hold the output excluding the + terminating null is greater than {INT_MAX}." See: + http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html + But it doesn't say anything concerning the other printf-like functions. + A defect report has been submitted to austin-review-l (item 2532). + So, for the time being, we return a negative value and set the erange + flag, and set errno to EOVERFLOW in POSIX system. */ + +/* Notes about limitations on some platforms: + + Due to limitations from the C standard and GMP, if size_t < unsigned int + (which is allowed by the C standard but unlikely to occur on any + platform), the behavior is undefined for output that would reach + SIZE_MAX = (size_t) -1 (if the result cannot be delivered, there should + be an assertion failure, but this could not be tested). + + The stdarg(3) Linux man page says: + On some systems, va_end contains a closing '}' matching a '{' in + va_start, so that both macros must occur in the same function, + and in a way that allows this. + However, the only requirement from ISO C is that both macros must be + invoked in the same function (MPFR uses va_copy instead of va_start, + but the requirement is the same). Here, MPFR just follows ISO C. +*/ + #ifdef HAVE_CONFIG_H -#include "config.h" +# include "config.h" #endif -/* The mpfr_printf-like functions are defined only if exists */ -#ifdef HAVE_STDARG +/* The mpfr_printf-like functions are defined only if exists. + Since they use mpf_t, they cannot be defined with mini-gmp. */ +#if defined(HAVE_STDARG) && !defined(MPFR_USE_MINI_GMP) #include @@ -47,11 +77,12 @@ #if defined (__cplusplus) #include -#define __STDC_LIMIT_MACROS /* SIZE_MAX defined with inclusion */ #else #include /* for ptrdiff_t */ #endif +#include + #define MPFR_NEED_LONGLONG_H #include "mpfr-intmax.h" #include "mpfr-impl.h" @@ -157,9 +188,10 @@ int width; /* Width */ int prec; /* Precision */ + size_t size; /* Wanted size (0 iff snprintf with size=0) */ enum arg_t arg_type; /* Type of argument */ - mpfr_rnd_t rnd_mode; /* Rounding mode */ + mpfr_rnd_t rnd_mode; /* Rounding mode */ char spec; /* Conversion specifier */ char pad; /* Padding character */ @@ -175,6 +207,7 @@ specinfo->group = 0; specinfo->width = 0; specinfo->prec = 0; + specinfo->size = 1; specinfo->arg_type = NONE; specinfo->rnd_mode = MPFR_RNDN; specinfo->spec = '\0'; @@ -226,6 +259,8 @@ } } +/* Note: additional flags should be added to the MPFR_PREC_ARG code + for gmp_asprintf (when supported). */ static const char * parse_flags (const char *format, struct printf_spec *specinfo) { @@ -274,14 +309,10 @@ break; case 'h': if (*++format == 'h') -#ifndef NPRINTF_HH { ++format; specinfo->arg_type = CHAR_ARG; } -#else - specinfo->arg_type = UNSUPPORTED; -#endif else specinfo->arg_type = SHORT_ARG; break; @@ -289,7 +320,7 @@ if (*++format == 'l') { ++format; -#if defined (HAVE_LONG_LONG) && !defined(NPRINTF_LL) +#if defined (HAVE_LONG_LONG) specinfo->arg_type = LONG_LONG_ARG; #else specinfo->arg_type = UNSUPPORTED; @@ -303,7 +334,7 @@ } case 'j': ++format; -#if defined(_MPFR_H_HAVE_INTMAX_T) && !defined(NPRINTF_J) +#if defined(_MPFR_H_HAVE_INTMAX_T) specinfo->arg_type = INTMAX_ARG; #else specinfo->arg_type = UNSUPPORTED; @@ -315,19 +346,11 @@ break; case 't': ++format; -#ifndef NPRINTF_T specinfo->arg_type = PTRDIFF_ARG; -#else - specinfo->arg_type = UNSUPPORTED; -#endif break; case 'L': ++format; -#ifndef NPRINTF_L specinfo->arg_type = LONG_DOUBLE_ARG; -#else - specinfo->arg_type = UNSUPPORTED; -#endif break; case 'F': ++format; @@ -383,9 +406,9 @@ #endif #define CASE_LONG_ARG(specinfo, ap) \ case LONG_ARG: \ - if (((specinfo).spec == 'd') || ((specinfo).spec == 'i') \ - || ((specinfo).spec == 'o') || ((specinfo).spec == 'u') \ - || ((specinfo).spec == 'x') || ((specinfo).spec == 'X')) \ + if ((specinfo).spec == 'd' || (specinfo).spec == 'i' \ + || (specinfo).spec == 'o' || (specinfo).spec == 'u' \ + || (specinfo).spec == 'x' || (specinfo).spec == 'X') \ (void) va_arg ((ap), long); \ else if ((specinfo).spec == 'c') \ (void) va_arg ((ap), mpfr_va_wint); \ @@ -485,7 +508,10 @@ } while (0) /* process the format part which does not deal with mpfr types, - jump to external label 'error' if gmp_asprintf return -1. */ + jump to external label 'error' if gmp_asprintf return -1. + Note: start and end are pointers to the format string, so that + size_t is the best type to express the difference. + */ #define FLUSH(flag, start, end, ap, buf_ptr) \ do { \ const size_t n = (end) - (start); \ @@ -493,16 +519,21 @@ /* previous specifiers are understood by gmp_printf */ \ { \ MPFR_TMP_DECL (marker); \ - char *fmt_copy; \ + char *fmt_copy, *s; \ + int length; \ + \ MPFR_TMP_MARK (marker); \ fmt_copy = (char*) MPFR_TMP_ALLOC (n + 1); \ strncpy (fmt_copy, (start), n); \ fmt_copy[n] = '\0'; \ - if (sprntf_gmp ((buf_ptr), (fmt_copy), (ap)) == -1) \ + length = gmp_vasprintf (&s, fmt_copy, (ap)); \ + if (length < 0) \ { \ MPFR_TMP_FREE (marker); \ goto error; \ } \ + buffer_cat ((buf_ptr), s, length); \ + mpfr_free_str (s); \ (flag) = 0; \ MPFR_TMP_FREE (marker); \ } \ @@ -511,20 +542,56 @@ buffer_cat ((buf_ptr), (start), n); \ } while (0) +/* Note: in case some form of %n is used in the format string, + we may need the maximum signed integer type for len. */ struct string_buffer { char *start; /* beginning of the buffer */ char *curr; /* null terminating character */ size_t size; /* buffer capacity */ + mpfr_intmax_t len; /* string length or -1 if overflow */ }; static void buffer_init (struct string_buffer *b, size_t s) { - b->start = (char *) (*__gmp_allocate_func) (s); - b->start[0] = '\0'; - b->curr = b->start; + if (s != 0) + { + b->start = (char *) mpfr_allocate_func (s); + b->start[0] = '\0'; + b->curr = b->start; + } b->size = s; + b->len = 0; +} + +/* Increase the len field of the buffer. Return non-zero iff overflow. */ +static int +buffer_incr_len (struct string_buffer *b, size_t len) +{ + if (b->len == -1) + return 1; + else + { + /* We need to take mpfr_uintmax_t as the type must be as large + as both size_t (which is unsigned) and mpfr_intmax_t (which + is used for the 'n' format specifier). */ + mpfr_uintmax_t newlen = (mpfr_uintmax_t) b->len + len; + + /* mpfr_uintmax_t is unsigned, thus the above is valid, but one + has newlen < len in case of overflow. */ + + if (MPFR_UNLIKELY (newlen < len || newlen > MPFR_INTMAX_MAX)) + { + b->len = -1; + return 1; + } + else + { + b->len = newlen; + return 0; + } + } } /* Increase buffer size by a number of character being the least multiple of @@ -534,13 +601,19 @@ { const size_t pos = b->curr - b->start; const size_t n = 0x1000 + (len & ~((size_t) 0xfff)); + + /* There are currently limitations here. We would need to switch to + the null-size behavior once there is an overflow in the buffer. */ + + MPFR_ASSERTN (n >= 0x1000 && n >= len); + + MPFR_ASSERTD (*b->curr == '\0'); MPFR_ASSERTD (pos < b->size); - MPFR_ASSERTN ((len & ~((size_t) 4095)) <= (size_t)(SIZE_MAX - 4096)); - MPFR_ASSERTN (b->size < SIZE_MAX - n); + MPFR_ASSERTN (b->size < ((size_t) -1) - n); b->start = - (char *) (*__gmp_reallocate_func) (b->start, b->size, b->size + n); + (char *) mpfr_reallocate_func (b->start, b->size, b->size + n); b->size += n; b->curr = b->start + pos; @@ -549,121 +622,166 @@ } /* Concatenate the LEN first characters of the string S to the buffer B and - expand it if needed. */ -static void + expand it if needed. Return non-zero if overflow. */ +static int buffer_cat (struct string_buffer *b, const char *s, size_t len) { - MPFR_ASSERTD (len != 0); + MPFR_ASSERTD (len > 0); MPFR_ASSERTD (len <= strlen (s)); - if (MPFR_UNLIKELY ((b->curr + len) >= (b->start + b->size))) - buffer_widen (b, len); + if (buffer_incr_len (b, len)) + return 1; - strncat (b->curr, s, len); - b->curr += len; + if (b->size != 0) + { + MPFR_ASSERTD (*b->curr == '\0'); + MPFR_ASSERTN (b->size < ((size_t) -1) - len); + if (MPFR_UNLIKELY (b->curr + len >= b->start + b->size)) + buffer_widen (b, len); + + /* strncat is similar to strncpy here, except that strncat ensures + that the buffer will be null-terminated. */ + strncat (b->curr, s, len); + b->curr += len; - MPFR_ASSERTD (b->curr < b->start + b->size); - MPFR_ASSERTD (*b->curr == '\0'); + MPFR_ASSERTD (b->curr < b->start + b->size); + MPFR_ASSERTD (*b->curr == '\0'); + } + + return 0; } -/* Add N characters C to the end of buffer B */ -static void +/* Add N characters C to the end of buffer B. Return non-zero if overflow. */ +static int buffer_pad (struct string_buffer *b, const char c, const size_t n) { - MPFR_ASSERTD (n != 0); + MPFR_ASSERTD (n > 0); - MPFR_ASSERTN (b->size < SIZE_MAX - n - 1); - if (MPFR_UNLIKELY ((b->curr + n + 1) > (b->start + b->size))) - buffer_widen (b, n); + if (buffer_incr_len (b, n)) + return 1; - if (n == 1) - *b->curr = c; - else - memset (b->curr, c, n); - b->curr += n; - *b->curr = '\0'; + if (b->size != 0) + { + MPFR_ASSERTD (*b->curr == '\0'); + MPFR_ASSERTN (b->size < ((size_t) -1) - n); + if (MPFR_UNLIKELY (b->curr + n >= b->start + b->size)) + buffer_widen (b, n); + + if (n == 1) + *b->curr = c; + else + memset (b->curr, c, n); + b->curr += n; + *b->curr = '\0'; + + MPFR_ASSERTD (b->curr < b->start + b->size); + } - MPFR_ASSERTD (b->curr < b->start + b->size); + return 0; } /* Form a string by concatenating the first LEN characters of STR to TZ zero(s), insert into one character C each 3 characters starting from end - to begining and concatenate the result to the buffer B. */ -static void + to beginning and concatenate the result to the buffer B. */ +static int buffer_sandwich (struct string_buffer *b, char *str, size_t len, const size_t tz, const char c) { - const size_t step = 3; - const size_t size = len + tz; - const size_t r = size % step == 0 ? step : size % step; - const size_t q = size % step == 0 ? size / step - 1 : size / step; - size_t i; + MPFR_ASSERTD (len <= strlen (str)); - MPFR_ASSERTD (size != 0); if (c == '\0') - { - buffer_cat (b, str, len); + return + buffer_cat (b, str, len) || buffer_pad (b, '0', tz); - return; - } + else + { + const size_t step = 3; + size_t size, q, r, fullsize; - MPFR_ASSERTN (b->size < SIZE_MAX - size - 1 - q); - MPFR_ASSERTD (len <= strlen (str)); - if (MPFR_UNLIKELY ((b->curr + size + 1 + q) > (b->start + b->size))) - buffer_widen (b, size + q); + /* check that len + tz does not overflow */ + if (len > (size_t) -1 - tz) + return 1; - /* first R significant digits */ - memcpy (b->curr, str, r); - b->curr += r; - str += r; - len -= r; + size = len + tz; /* number of digits */ + MPFR_ASSERTD (size > 0); - /* blocks of thousands. Warning: STR might end in the middle of a block */ - for (i = 0; i < q; ++i) - { - *b->curr++ = c; - if (MPFR_LIKELY (len > 0)) + q = (size - 1) / step; /* number of separators C */ + r = ((size - 1) % step) + 1; /* number of digits in the leftmost block */ + + /* check that size + q does not overflow */ + if (size > (size_t) -1 - q) + return 1; + + fullsize = size + q; /* number of digits and separators */ + + if (buffer_incr_len (b, fullsize)) + return 1; + + if (b->size != 0) { - if (MPFR_LIKELY (len >= step)) - /* step significant digits */ + char *oldcurr; + size_t i; + + MPFR_ASSERTD (*b->curr == '\0'); + MPFR_ASSERTN (b->size < ((size_t) -1) - fullsize); + if (MPFR_UNLIKELY (b->curr + fullsize >= b->start + b->size)) + buffer_widen (b, fullsize); + + MPFR_DBGRES (oldcurr = b->curr); + + /* first r significant digits (leftmost block) */ + if (r <= len) { - memcpy (b->curr, str, step); - len -= step; + memcpy (b->curr, str, r); + str += r; + len -= r; } else - /* last digits in STR, fill up thousand block with zeros */ { + MPFR_ASSERTD (r > len); memcpy (b->curr, str, len); - memset (b->curr + len, '0', step - len); + memset (b->curr + len, '0', r - len); len = 0; } - } - else - /* trailing zeros */ - memset (b->curr, '0', step); + b->curr += r; - b->curr += step; - str += step; - } + /* blocks of thousands. Warning: STR might end in the middle of a block */ + for (i = 0; i < q; ++i) + { + *b->curr++ = c; + if (MPFR_LIKELY (len > 0)) + { + if (MPFR_LIKELY (len >= step)) + /* step significant digits */ + { + memcpy (b->curr, str, step); + len -= step; + str += step; + } + else + /* last digits in STR, fill up thousand block with zeros */ + { + memcpy (b->curr, str, len); + memset (b->curr + len, '0', step - len); + len = 0; + } + } + else + /* trailing zeros */ + memset (b->curr, '0', step); - *b->curr = '\0'; + b->curr += step; + } - MPFR_ASSERTD (b->curr < b->start + b->size); -} + MPFR_ASSERTD (b->curr - oldcurr == fullsize); -/* let gmp_xprintf process the part it can understand */ -static int -sprntf_gmp (struct string_buffer *b, const char *fmt, va_list ap) -{ - int length; - char *s; + *b->curr = '\0'; - length = gmp_vasprintf (&s, fmt, ap); - if (length > 0) - buffer_cat (b, s, length); + MPFR_ASSERTD (b->curr < b->start + b->size); + } - mpfr_free_str (s); - return length; + return 0; + } } /* Helper struct and functions for temporary strings management */ @@ -674,7 +792,7 @@ struct string_list *next; /* NULL in last node */ }; -/* initialisation */ +/* initialization */ static void init_string_list (struct string_list *sl) { @@ -693,7 +811,7 @@ if (sl->string) mpfr_free_str (sl->string); n = sl->next; - (*__gmp_free_func) (sl, sizeof(struct string_list)); + mpfr_free_func (sl, sizeof(struct string_list)); sl = n; } } @@ -707,7 +825,7 @@ sl = sl->next; sl->next = (struct string_list*) - (*__gmp_allocate_func) (sizeof (struct string_list)); + mpfr_allocate_func (sizeof (struct string_list)); sl = sl->next; sl->next = NULL; @@ -830,6 +948,52 @@ return exp; } +#define NDIGITS 8 + +static char* +mpfr_get_str_aux (mpfr_exp_t *exp, int base, size_t n, const mpfr_t op, + const struct printf_spec spec) +{ + size_t ndigits; + char *str, *s, nine; + int neg; + + if (spec.size != 0) + return mpfr_get_str (NULL, exp, base, n, op, spec.rnd_mode); + + /* Special case size = 0, i.e., xxx_snprintf with size = 0: we only want + to compute the number of printed characters. Try to deduce it from + a small number of significant digits. */ + nine = (base <= 10) ? '0' + base - 1 + : (base <= 36) ? 'a' + base - 11 + : 'a' + base - 37; + for (ndigits = NDIGITS; ; ndigits *= 2) + { + mpfr_rnd_t rnd = MPFR_RNDZ; + /* when ndigits > n, we reduce it to the target size n, and then we use + the wanted rounding mode, to avoid errors for example when n=1 and + x = 9.5 with spec.rnd_mode = RNDU */ + if (ndigits >= n) + { + ndigits = n; + rnd = spec.rnd_mode; + } + str = mpfr_get_str (NULL, exp, base, ndigits, op, rnd); + if (ndigits == n) + break; + neg = str[0] == '-'; + s = str + neg; + while (*s == nine) + s ++; + if (s < str + neg + ndigits) /* we don't have ndigits 'nines' */ + break; + mpfr_free_str (str); + MPFR_ASSERTN (ndigits <= ((size_t) -1) / 2); + /* to make sure that the product by 2 is representable. */ + } + return str; +} + /* Determine the different parts of the string representation of the regular number P when SPEC.SPEC is 'a', 'A', or 'b'. @@ -855,7 +1019,7 @@ /* prefix part */ { np->prefix_size = 2; - str = (char *) (*__gmp_allocate_func) (1 + np->prefix_size); + str = (char *) mpfr_allocate_func (1 + np->prefix_size); str[0] = '0'; str[1] = uppercase ? 'X' : 'x'; str[2] = '\0'; @@ -873,9 +1037,11 @@ /* Number of significant digits: - if no given precision, let mpfr_get_str determine it; - if a non-zero precision is specified, then one digit before decimal - point plus SPEC.PREC after it. */ - nsd = spec.prec < 0 ? 0 : spec.prec + np->ip_size; - str = mpfr_get_str (0, &exp, base, nsd, p, spec.rnd_mode); + point plus SPEC.PREC after it (which will give nsd > 1 below). */ + MPFR_ASSERTD (np->ip_size == 1); /* thus no integer overflow below */ + nsd = spec.prec < 0 ? 0 : (size_t) spec.prec + np->ip_size; + MPFR_ASSERTD (nsd != 1); + str = mpfr_get_str_aux (&exp, base, nsd, p, spec); register_string (np->sl, str); np->ip_ptr = MPFR_IS_NEG (p) ? ++str : str; /* skip sign if any */ @@ -901,7 +1067,7 @@ } else if (next_base_power_p (p, base, spec.rnd_mode)) { - str = (char *)(*__gmp_allocate_func) (2); + str = (char *)mpfr_allocate_func (2); str[0] = '1'; str[1] = '\0'; np->ip_ptr = register_string (np->sl, str); @@ -910,7 +1076,7 @@ } else if (base == 2) { - str = (char *)(*__gmp_allocate_func) (2); + str = (char *)mpfr_allocate_func (2); str[0] = '1'; str[1] = '\0'; np->ip_ptr = register_string (np->sl, str); @@ -931,9 +1097,9 @@ || (spec.rnd_mode == MPFR_RNDN && (msl & (MPFR_LIMB_ONE << rnd_bit)))) digit++; - MPFR_ASSERTD ((0 <= digit) && (digit <= 15)); + MPFR_ASSERTD (0 <= digit && digit <= 15); - str = (char *)(*__gmp_allocate_func) (1 + np->ip_size); + str = (char *)mpfr_allocate_func (1 + np->ip_size); str[0] = num_to_text [digit]; str[1] = '\0'; np->ip_ptr = register_string (np->sl, str); @@ -986,7 +1152,7 @@ if (spec.prec < 0) /* remove trailing zeros, if any */ { - while ((*ptr == '0') && (str_len != 0)) + while (*ptr == '0' && str_len != 0) { --ptr; --str_len; @@ -1002,13 +1168,14 @@ { np->fp_ptr = str; np->fp_size = str_len; + MPFR_ASSERTD (str_len > 0 && str_len <= INT_MAX); if ((int) str_len < spec.prec) np->fp_trailing_zeros = spec.prec - str_len; } } /* decimal point */ - if ((np->fp_size != 0) || spec.alt) + if (np->fp_size != 0 || spec.alt) np->point = MPFR_DECIMAL_POINT; /* the exponent part contains the character 'p', or 'P' plus the sign @@ -1026,7 +1193,7 @@ x /= 10; } } - str = (char *) (*__gmp_allocate_func) (1 + np->exp_size); + str = (char *) mpfr_allocate_func (1 + np->exp_size); np->exp_ptr = register_string (np->sl, str); { char exp_fmt[8]; /* contains at most 7 characters like in "p%+.1i", @@ -1045,7 +1212,7 @@ /* Determine the different parts of the string representation of the regular number P when spec.spec is 'e', 'E', 'g', or 'G'. - DEC_INFO contains the previously computed exponent and string or is NULL. + dec_info contains the previously computed exponent and string or is NULL. return -1 if some field > INT_MAX */ static int @@ -1078,8 +1245,9 @@ plus SPEC.PREC after it. We use the fact here that mpfr_get_str allows us to ask for only one significant digit when the base is not a power of 2. */ - nsd = (spec.prec < 0) ? 0 : spec.prec + np->ip_size; - str = mpfr_get_str (0, &exp, 10, nsd, p, spec.rnd_mode); + MPFR_ASSERTD (np->ip_size == 1); /* thus no integer overflow below */ + nsd = spec.prec < 0 ? 0 : (size_t) spec.prec + np->ip_size; + str = mpfr_get_str_aux (&exp, 10, nsd, p, spec); register_string (np->sl, str); } else @@ -1103,7 +1271,7 @@ if (!keep_trailing_zeros) /* remove trailing zeros, if any */ { - while ((*ptr == '0') && (str_len != 0)) + while (*ptr == '0' && str_len != 0) { --ptr; --str_len; @@ -1119,8 +1287,9 @@ { np->fp_ptr = str; np->fp_size = str_len; - if ((!spec_g || spec.alt) && (spec.prec > 0) - && ((int)str_len < spec.prec)) + MPFR_ASSERTD (str_len > 0 && str_len <= INT_MAX); + if ((!spec_g || spec.alt) && spec.prec > 0 + && (int) str_len < spec.prec) /* add missing trailing zeros */ np->fp_trailing_zeros = spec.prec - str_len; } @@ -1153,7 +1322,7 @@ if (np->exp_size < 4) np->exp_size = 4; - str = (char *) (*__gmp_allocate_func) (1 + np->exp_size); + str = (char *) mpfr_allocate_func (1 + np->exp_size); np->exp_ptr = register_string (np->sl, str); { @@ -1199,7 +1368,7 @@ { /* Most of the time, integral part is 0 */ np->ip_size = 1; - str = (char *) (*__gmp_allocate_func) (1 + np->ip_size); + str = (char *) mpfr_allocate_func (1 + np->ip_size); str[0] = '0'; str[1] = '\0'; np->ip_ptr = register_string (np->sl, str); @@ -1232,20 +1401,28 @@ switch (spec.rnd_mode) { case MPFR_RNDA: + case MPFR_RNDF: /* round_away = 1 needed for spec_g */ round_away = 1; break; + case MPFR_RNDZ: + round_away = 0; + break; case MPFR_RNDD: round_away = MPFR_IS_NEG (p); break; case MPFR_RNDU: round_away = MPFR_IS_POS (p); break; - case MPFR_RNDN: + default: { /* compare |p| to y = 0.5*10^(-spec.prec) */ mpfr_t y; mpfr_exp_t e = MAX (MPFR_PREC (p), 56); + int cmp; + + MPFR_ASSERTN (spec.rnd_mode == MPFR_RNDN); mpfr_init2 (y, e + 8); + do { /* find a lower approximation of @@ -1255,14 +1432,14 @@ mpfr_set_si (y, -spec.prec, MPFR_RNDN); mpfr_exp10 (y, y, MPFR_RNDD); mpfr_div_2ui (y, y, 1, MPFR_RNDN); - } while (mpfr_cmpabs (y, p) == 0); + cmp = mpfr_cmpabs (y, p); + } + while (cmp == 0); - round_away = mpfr_cmpabs (y, p) < 0; + round_away = cmp < 0; mpfr_clear (y); } break; - default: - round_away = 0; } if (round_away) @@ -1272,7 +1449,7 @@ np->fp_size = 1; str = - (char *) (*__gmp_allocate_func) (1 + np->fp_size); + (char *) mpfr_allocate_func (1 + np->fp_size); str[0] = '1'; str[1] = '\0'; np->fp_ptr = register_string (np->sl, str); @@ -1284,21 +1461,31 @@ np->fp_leading_zeros = spec.prec; } } - else + else /* exp >= -spec.prec */ /* the most significant digits are the last spec.prec + exp + 1 digits in fractional part */ { char *ptr; size_t str_len; + + MPFR_ASSERTD (exp >= -spec.prec); if (dec_info == NULL) { - size_t nsd = spec.prec + exp + 1; + size_t nsd; + + /* Consequences of earlier assertions (in r11307). + They guarantee that the integers are representable + (i.e., no integer overflow), assuming size_t >= int + as usual. */ + MPFR_ASSERTD (exp <= -1); + MPFR_ASSERTD (spec.prec + (exp + 1) >= 0); + nsd = spec.prec + (exp + 1); /* WARNING: nsd may equal 1, but here we use the fact that mpfr_get_str can return one digit with base ten (undocumented feature, see comments in get_str.c) */ - str = mpfr_get_str (NULL, &exp, 10, nsd, p, spec.rnd_mode); + str = mpfr_get_str_aux (&exp, 10, nsd, p, spec); register_string (np->sl, str); } else @@ -1329,7 +1516,7 @@ if (!keep_trailing_zeros) /* remove trailing zeros, if any */ { - while ((*ptr == '0') && str_len) + while (*ptr == '0' && str_len != 0) { --ptr; --str_len; @@ -1371,8 +1558,7 @@ if (dec_info == NULL) { /* this case occurs with mpfr_printf ("%.0RUf", x) with x=9.5 */ - str = - mpfr_get_str (NULL, &exp, 10, spec.prec+exp+1, p, spec.rnd_mode); + str = mpfr_get_str_aux (&exp, 10, spec.prec+exp+1, p, spec); register_string (np->sl, str); } else @@ -1406,7 +1592,7 @@ { char *ptr = str + str_len - 1; /* pointer to the last digit of str */ - while ((*ptr == '0') && (str_len != 0)) + while (*ptr == '0' && str_len != 0) { --ptr; --str_len; @@ -1445,14 +1631,14 @@ partition_number initializes the given structure np, so all previous information in that variable is lost. return the total number of characters to be written. - return -1 if an error occured, in that case np's fields are in an undefined + return -1 if an error occurred, in that case np's fields are in an undefined state but all string buffers have been freed. */ -static int +static mpfr_intmax_t partition_number (struct number_parts *np, mpfr_srcptr p, struct printf_spec spec) { char *str; - long total; + unsigned int total; /* can hold the sum of two non-negative int's + 1 */ int uppercase; /* WARNING: left justification means right space padding */ @@ -1473,7 +1659,7 @@ np->exp_ptr = NULL; np->exp_size = 0; np->sl = (struct string_list *) - (*__gmp_allocate_func) (sizeof (struct string_list)); + mpfr_allocate_func (sizeof (struct string_list)); init_string_list (np->sl); uppercase = spec.spec == 'A' || spec.spec == 'E' || spec.spec == 'F' @@ -1488,20 +1674,10 @@ with left spaces instead */ np->pad_type = LEFT; - if (uppercase) - { - np->ip_size = MPFR_NAN_STRING_LENGTH; - str = (char *) (*__gmp_allocate_func) (1 + np->ip_size); - strcpy (str, MPFR_NAN_STRING_UC); - np->ip_ptr = register_string (np->sl, str); - } - else - { - np->ip_size = MPFR_NAN_STRING_LENGTH; - str = (char *) (*__gmp_allocate_func) (1 + np->ip_size); - strcpy (str, MPFR_NAN_STRING_LC); - np->ip_ptr = register_string (np->sl, str); - } + np->ip_size = MPFR_NAN_STRING_LENGTH; + str = (char *) mpfr_allocate_func (1 + np->ip_size); + strcpy (str, uppercase ? MPFR_NAN_STRING_UC : MPFR_NAN_STRING_LC); + np->ip_ptr = register_string (np->sl, str); } else if (MPFR_IS_INF (p)) { @@ -1513,24 +1689,14 @@ if (MPFR_IS_NEG (p)) np->sign = '-'; - if (uppercase) - { - np->ip_size = MPFR_INF_STRING_LENGTH; - str = (char *) (*__gmp_allocate_func) (1 + np->ip_size); - strcpy (str, MPFR_INF_STRING_UC); - np->ip_ptr = register_string (np->sl, str); - } - else - { - np->ip_size = MPFR_INF_STRING_LENGTH; - str = (char *) (*__gmp_allocate_func) (1 + np->ip_size); - strcpy (str, MPFR_INF_STRING_LC); - np->ip_ptr = register_string (np->sl, str); - } + np->ip_size = MPFR_INF_STRING_LENGTH; + str = (char *) mpfr_allocate_func (1 + np->ip_size); + strcpy (str, uppercase ? MPFR_INF_STRING_UC : MPFR_INF_STRING_LC); + np->ip_ptr = register_string (np->sl, str); } else - /* p == 0 */ { + MPFR_ASSERTD (MPFR_IS_ZERO (p)); /* note: for 'g' spec, zero is always displayed with 'f'-style with precision spec.prec - 1 and the trailing zeros are removed unless the flag '#' is used. */ @@ -1544,7 +1710,7 @@ /* prefix part */ { np->prefix_size = 2; - str = (char *) (*__gmp_allocate_func) (1 + np->prefix_size); + str = (char *) mpfr_allocate_func (1 + np->prefix_size); str[0] = '0'; str[1] = uppercase ? 'X' : 'x'; str[2] = '\0'; @@ -1553,7 +1719,7 @@ /* integral part */ np->ip_size = 1; - str = (char *) (*__gmp_allocate_func) (1 + np->ip_size); + str = (char *) mpfr_allocate_func (1 + np->ip_size); str[0] = '0'; str[1] = '\0'; np->ip_ptr = register_string (np->sl, str); @@ -1574,7 +1740,7 @@ /* exponent part */ { np->exp_size = (spec.spec == 'e' || spec.spec == 'E') ? 4 : 3; - str = (char *) (*__gmp_allocate_func) (1 + np->exp_size); + str = (char *) mpfr_allocate_func (1 + np->exp_size); if (spec.spec == 'e' || spec.spec == 'E') strcpy (str, uppercase ? "E+00" : "e+00"); else @@ -1583,9 +1749,27 @@ } } } + else if (MPFR_UNLIKELY (MPFR_IS_UBF (p))) + { + /* mpfr_get_str does not support UBF, so that UBF numbers are regarded + as special cases here. This is not much a problem since UBF numbers + are internal to MPFR and here, they only for logging. */ + if (np->pad_type == LEADING_ZEROS) + /* change to right justification padding with left spaces */ + np->pad_type = LEFT; + + if (MPFR_IS_NEG (p)) + np->sign = '-'; + + np->ip_size = 3; + str = (char *) mpfr_allocate_func (1 + np->ip_size); + strcpy (str, uppercase ? "UBF" : "ubf"); + np->ip_ptr = register_string (np->sl, str); + /* TODO: output more information (e.g. the exponent) if need be. */ + } else - /* regular p, p != 0 */ { + MPFR_ASSERTD (MPFR_IS_PURE_FP (p)); if (spec.spec == 'a' || spec.spec == 'A' || spec.spec == 'b') { if (regular_ab (np, p, spec) == -1) @@ -1593,7 +1777,7 @@ } else if (spec.spec == 'f' || spec.spec == 'F') { - if (spec.prec == -1) + if (spec.prec < 0) spec.prec = 6; if (regular_fg (np, p, spec, NULL) == -1) goto error; @@ -1614,12 +1798,38 @@ where T is the threshold computed below and X is the exponent that would be displayed with style 'e' and precision T-1. */ int threshold; - mpfr_exp_t x; + mpfr_exp_t x, e, k; struct decimal_info dec_info; threshold = (spec.prec < 0) ? 6 : (spec.prec == 0) ? 1 : spec.prec; - dec_info.str = mpfr_get_str (NULL, &dec_info.exp, 10, threshold, - p, spec.rnd_mode); + + /* Here we cannot call mpfr_get_str_aux since we need the full + significand in dec_info.str. + Moreover, threshold may be huge while one can know that the + number of digits that are not trailing zeros remains limited; + such a limit occurs in practical cases, e.g. with numbers + representable in the IEEE 754-2008 basic formats. Since the + trailing zeros are not necessarily output, we do not want to + waste time and memory by making mpfr_get_str generate them. + So, let us try to find a smaller threshold for mpfr_get_str. + |p| < 2^EXP(p) = 10^(EXP(p)*log10(2)). So, the integer part + takes at most ceil(EXP(p)*log10(2)) digits (unless p rounds + to the next power of 10, but in this case any threshold will + be OK). So, for the integer part, we will take: + max(0,floor((EXP(p)+2)/3)). + Let k = PREC(p) - EXP(p), so that the last bit of p has + weight 2^(-k). If k <= 0, then p is an integer, otherwise + the fractional part in base 10 may have up to k digits + (this bound is reached if the last bit is 1). + Note: The bound could be improved, but this is not critical. */ + e = MPFR_GET_EXP (p); + k = MPFR_PREC (p) - e; + e = e <= 0 ? k : (e + 2) / 3 + (k <= 0 ? 0 : k); + MPFR_ASSERTD (e >= 1); + + dec_info.str = mpfr_get_str (NULL, &dec_info.exp, 10, + e < threshold ? e : threshold, + p, spec.rnd_mode); register_string (np->sl, dec_info.str); /* mpfr_get_str corresponds to a significand between 0.1 and 1, whereas here we want a significand between 1 and 10. */ @@ -1645,43 +1855,43 @@ /* compute the number of characters to be written verifying it is not too much */ + +#define INCR_TOTAL(v) \ + do { \ + MPFR_ASSERTD ((v) >= 0); \ + if (MPFR_UNLIKELY ((v) > MPFR_INTMAX_MAX)) \ + goto error; \ + total += (v); \ + if (MPFR_UNLIKELY (total > MPFR_INTMAX_MAX)) \ + goto error; \ + } while (0) + total = np->sign ? 1 : 0; - total += np->prefix_size; - total += np->ip_size; - if (MPFR_UNLIKELY (total < 0 || total > INT_MAX)) - goto error; - total += np->ip_trailing_zeros; - if (MPFR_UNLIKELY (total < 0 || total > INT_MAX)) - goto error; + INCR_TOTAL (np->prefix_size); + INCR_TOTAL (np->ip_size); + INCR_TOTAL (np->ip_trailing_zeros); + MPFR_ASSERTD (np->ip_size + np->ip_trailing_zeros >= 1); if (np->thousands_sep) /* ' flag, style f and the thousands separator in current locale is not reduced to the null character */ - total += (np->ip_size + np->ip_trailing_zeros) / 3; - if (MPFR_UNLIKELY (total < 0 || total > INT_MAX)) - goto error; + INCR_TOTAL ((np->ip_size + np->ip_trailing_zeros - 1) / 3); if (np->point) ++total; - total += np->fp_leading_zeros; - if (MPFR_UNLIKELY (total < 0 || total > INT_MAX)) - goto error; - total += np->fp_size; - if (MPFR_UNLIKELY (total < 0 || total > INT_MAX)) - goto error; - total += np->fp_trailing_zeros; - if (MPFR_UNLIKELY (total < 0 || total > INT_MAX)) - goto error; - total += np->exp_size; - if (MPFR_UNLIKELY (total < 0 || total > INT_MAX)) - goto error; + INCR_TOTAL (np->fp_leading_zeros); + INCR_TOTAL (np->fp_size); + INCR_TOTAL (np->fp_trailing_zeros); + INCR_TOTAL (np->exp_size); if (spec.width > total) /* pad with spaces or zeros depending on np->pad_type */ { np->pad_size = spec.width - total; total += np->pad_size; /* here total == spec.width, - so 0 < total < INT_MAX */ + so 0 < total <= INT_MAX */ + MPFR_ASSERTD (total == spec.width); } + MPFR_ASSERTD (total > 0 && total <= MPFR_INTMAX_MAX); return total; error: @@ -1697,17 +1907,33 @@ return the size of the string (not counting the terminating '\0') return -1 if the built string is too long (i.e. has more than - INT_MAX characters). */ + INT_MAX or MPFR_INTMAX_MAX characters). + + If spec.size is 0, we only want the size of the string. +*/ static int sprnt_fp (struct string_buffer *buf, mpfr_srcptr p, const struct printf_spec spec) { - int length; + mpfr_intmax_t length, start; struct number_parts np; length = partition_number (&np, p, spec); if (length < 0) - return -1; + { + buf->len = -1; + return -1; + } + + if (spec.size == 0) + { + /* This is equivalent to the following code (no need to fill the buffer + and length is known). */ + buffer_incr_len (buf, length); + goto clear_and_exit; + } + + MPFR_DBGRES (start = buf->len); /* right justification padding with left spaces */ if (np.pad_type == LEFT && np.pad_size != 0) @@ -1728,8 +1954,14 @@ /* integral part (may also be "nan" or "inf") */ MPFR_ASSERTN (np.ip_ptr != NULL); /* never empty */ if (MPFR_UNLIKELY (np.thousands_sep)) - buffer_sandwich (buf, np.ip_ptr, np.ip_size, np.ip_trailing_zeros, - np.thousands_sep); + { + if (buffer_sandwich (buf, np.ip_ptr, np.ip_size, np.ip_trailing_zeros, + np.thousands_sep)) + { + buf->len = -1; + goto clear_and_exit; + } + } else { buffer_cat (buf, np.ip_ptr, np.ip_size); @@ -1759,21 +1991,34 @@ if (np.exp_ptr) buffer_cat (buf, np.exp_ptr, np.exp_size); - /* left justication padding with right spaces */ + /* left justification padding with right spaces */ if (np.pad_type == RIGHT && np.pad_size != 0) buffer_pad (buf, ' ', np.pad_size); + MPFR_ASSERTD (buf->len == -1 || buf->len - start == length); + + clear_and_exit: clear_string_list (np.sl); - return length; + return buf->len == -1 ? -1 : length; } +/* The following internal function implements both mpfr_vasprintf and + mpfr_vsnprintf: + (a) either ptr <> NULL, and then Buf and size are not used, and it + implements mpfr_vasprintf (ptr, fmt, ap) + (b) or ptr = NULL, and it implements mpfr_vsnprintf (Buf, size, fmt, ap) + It returns the number of characters that would have been written had 'size' + been sufficiently large, not counting the terminating null character, or -1 + if this number is too large for the return type 'int' (overflow). +*/ int -mpfr_vasprintf (char **ptr, const char *fmt, va_list ap) +mpfr_vasnprintf_aux (char **ptr, char *Buf, size_t size, const char *fmt, + va_list ap) { struct string_buffer buf; - size_t nbchar; + int nbchar; - /* informations on the conversion specification filled by the parser */ + /* information on the conversion specification filled by the parser */ struct printf_spec spec; /* flag raised when previous part of fmt need to be processed by gmp_vsnprintf */ @@ -1786,15 +2031,14 @@ MPFR_SAVE_EXPO_DECL (expo); MPFR_SAVE_EXPO_MARK (expo); - nbchar = 0; - buffer_init (&buf, 4096); + buffer_init (&buf, ptr != NULL || size != 0 ? 4096 : 0); xgmp_fmt_flag = 0; va_copy (ap2, ap); start = fmt; - while (*fmt) + while (*fmt != '\0') { /* Look for the next format specification */ - while ((*fmt) && (*fmt != '%')) + while (*fmt != '\0' && *fmt != '%') ++fmt; if (*fmt == '\0') @@ -1837,10 +2081,12 @@ fmt = parse_arg_type (fmt, &spec); if (spec.arg_type == UNSUPPORTED) - /* the current architecture doesn't support this type */ - { - goto error; - } + /* the current architecture doesn't support the type corresponding to + the format specifier; according to the ISO C99 standard, the + behavior is undefined. We choose to print the format specifier as a + literal string, what may be printed after this string is + undefined. */ + continue; else if (spec.arg_type == MPFR_ARG) { switch (*fmt) @@ -1876,9 +2122,13 @@ spec.spec = *fmt; if (!specinfo_is_valid (spec)) - goto error; + /* the format specifier is invalid; according to the ISO C99 standard, + the behavior is undefined. We choose to print the invalid format + specifier as a literal string, what may be printed after this + string is undefined. */ + continue; - if (*fmt) + if (*fmt != '\0') fmt++; /* Format processing */ @@ -1892,49 +2142,47 @@ so as to be able to accept the same format strings. */ { void *p; - size_t nchar; p = va_arg (ap, void *); FLUSH (xgmp_fmt_flag, start, end, ap2, &buf); va_end (ap2); start = fmt; - nchar = buf.curr - buf.start; switch (spec.arg_type) { case CHAR_ARG: - *(char *) p = (char) nchar; + *(char *) p = (char) buf.len; break; case SHORT_ARG: - *(short *) p = (short) nchar; + *(short *) p = (short) buf.len; break; case LONG_ARG: - *(long *) p = (long) nchar; + *(long *) p = (long) buf.len; break; #ifdef HAVE_LONG_LONG case LONG_LONG_ARG: - *(long long *) p = (long long) nchar; + *(long long *) p = (long long) buf.len; break; #endif #ifdef _MPFR_H_HAVE_INTMAX_T case INTMAX_ARG: - *(intmax_t *) p = (intmax_t) nchar; + *(intmax_t *) p = (intmax_t) buf.len; break; #endif case SIZE_ARG: - *(size_t *) p = nchar; + *(size_t *) p = buf.len; break; case PTRDIFF_ARG: - *(ptrdiff_t *) p = (ptrdiff_t) nchar; + *(ptrdiff_t *) p = (ptrdiff_t) buf.len; break; case MPF_ARG: - mpf_set_ui ((mpf_ptr) p, (unsigned long) nchar); + mpf_set_ui ((mpf_ptr) p, (unsigned long) buf.len); break; case MPQ_ARG: - mpq_set_ui ((mpq_ptr) p, (unsigned long) nchar, 1L); + mpq_set_ui ((mpq_ptr) p, (unsigned long) buf.len, 1L); break; case MP_LIMB_ARG: - *(mp_limb_t *) p = (mp_limb_t) nchar; + *(mp_limb_t *) p = (mp_limb_t) buf.len; break; case MP_LIMB_ARRAY_ARG: { @@ -1947,25 +2195,25 @@ break; /* we assume here that mp_limb_t is wider than int */ - *q = (mp_limb_t) nchar; + *q = (mp_limb_t) buf.len; while (--n != 0) { q++; - *q = (mp_limb_t) 0; + *q = MPFR_LIMB_ZERO; } } break; case MPZ_ARG: - mpz_set_ui ((mpz_ptr) p, (unsigned long) nchar); + mpz_set_ui ((mpz_ptr) p, (unsigned long) buf.len); break; case MPFR_ARG: - mpfr_set_ui ((mpfr_ptr) p, (unsigned long) nchar, + mpfr_set_ui ((mpfr_ptr) p, (unsigned long) buf.len, spec.rnd_mode); break; default: - *(int *) p = (int) nchar; + *(int *) p = (int) buf.len; } va_copy (ap2, ap); /* after the switch, due to MP_LIMB_ARRAY_ARG case */ @@ -1974,9 +2222,10 @@ /* output mpfr_prec_t variable */ { char *s; - char format[MPFR_PREC_FORMAT_SIZE + 6]; /* see examples below */ + char format[MPFR_PREC_FORMAT_SIZE + 12]; /* e.g. "%0#+ -'*.*ld\0" */ size_t length; mpfr_prec_t prec; + prec = va_arg (ap, mpfr_prec_t); FLUSH (xgmp_fmt_flag, start, end, ap2, &buf); @@ -1985,31 +2234,34 @@ start = fmt; /* construct format string, like "%*.*hd" "%*.*d" or "%*.*ld" */ - format[0] = '%'; - format[1] = '*'; - format[2] = '.'; - format[3] = '*'; - format[4] = '\0'; - strcat (format, MPFR_PREC_FORMAT_TYPE); - format[4 + MPFR_PREC_FORMAT_SIZE] = spec.spec; - format[5 + MPFR_PREC_FORMAT_SIZE] = '\0'; + sprintf (format, "%%%s%s%s%s%s%s*.*" MPFR_PREC_FORMAT_TYPE "%c", + spec.pad == '0' ? "0" : "", + spec.alt ? "#" : "", + spec.showsign ? "+" : "", + spec.space ? " " : "", + spec.left ? "-" : "", + spec.group ? "'" : "", + spec.spec); length = gmp_asprintf (&s, format, spec.width, spec.prec, prec); - if (buf.size <= INT_MAX - length) - { - buffer_cat (&buf, s, length); - mpfr_free_str (s); - } - else - { - mpfr_free_str (s); - goto overflow_error; - } + MPFR_ASSERTN (length >= 0); /* guaranteed by GMP 6 */ + buffer_cat (&buf, s, length); + mpfr_free_str (s); } else if (spec.arg_type == MPFR_ARG) /* output a mpfr_t variable */ { mpfr_srcptr p; + if (spec.spec != 'a' && spec.spec != 'A' + && spec.spec != 'b' + && spec.spec != 'e' && spec.spec != 'E' + && spec.spec != 'f' && spec.spec != 'F' + && spec.spec != 'g' && spec.spec != 'G') + /* the format specifier is invalid; skip the invalid format + specifier so as to print it as a literal string. What may be + printed after this string is undefined. */ + continue; + p = va_arg (ap, mpfr_srcptr); FLUSH (xgmp_fmt_flag, start, end, ap2, &buf); @@ -2017,25 +2269,9 @@ va_copy (ap2, ap); start = fmt; - switch (spec.spec) - { - case 'a': - case 'A': - case 'b': - case 'e': - case 'E': - case 'f': - case 'F': - case 'g': - case 'G': - if (sprnt_fp (&buf, p, spec) < 0) - goto overflow_error; - break; - - default: - /* unsupported specifier */ - goto error; - } + if (ptr == NULL) + spec.size = size; + sprnt_fp (&buf, p, spec); } else /* gmp_printf specification, step forward in the va_list */ @@ -2049,42 +2285,63 @@ FLUSH (xgmp_fmt_flag, start, fmt, ap2, &buf); va_end (ap2); - nbchar = buf.curr - buf.start; - MPFR_ASSERTD (nbchar == strlen (buf.start)); - buf.start = - (char *) (*__gmp_reallocate_func) (buf.start, buf.size, nbchar + 1); - buf.size = nbchar + 1; /* update needed for __gmp_free_func below when - nbchar is too large (overflow_error) */ - *ptr = buf.start; - - /* If nbchar is larger than INT_MAX, the ISO C99 standard is silent, but - POSIX says concerning the snprintf() function: - "[EOVERFLOW] The value of n is greater than {INT_MAX} or the - number of bytes needed to hold the output excluding the - terminating null is greater than {INT_MAX}." See: - http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html - But it doesn't say anything concerning the other printf-like functions. - A defect report has been submitted to austin-review-l (item 2532). - So, for the time being, we return a negative value and set the erange - flag, and set errno to EOVERFLOW in POSIX system. */ - if (nbchar <= INT_MAX) + + if (buf.len == -1 || buf.len > INT_MAX) /* overflow */ + goto overflow; + + nbchar = buf.len; + MPFR_ASSERTD (nbchar >= 0); + + if (ptr != NULL) /* implement mpfr_vasprintf */ { - MPFR_SAVE_EXPO_FREE (expo); - return nbchar; + MPFR_ASSERTD (nbchar == strlen (buf.start)); + *ptr = (char *) mpfr_reallocate_func (buf.start, buf.size, nbchar + 1); } + else if (size != 0) /* implement mpfr_vsnprintf */ + { + if (nbchar < size) + { + strncpy (Buf, buf.start, nbchar); + Buf[nbchar] = '\0'; + } + else + { + strncpy (Buf, buf.start, size - 1); + Buf[size-1] = '\0'; + } + mpfr_free_func (buf.start, buf.size); + } + + MPFR_SAVE_EXPO_FREE (expo); + return nbchar; /* return the number of characters that would have + been written had 'size' been sufficiently large, + not counting the terminating null character */ - overflow_error: - MPFR_SAVE_EXPO_UPDATE_FLAGS(expo, MPFR_FLAGS_ERANGE); + error: + va_end (ap2); + if (buf.len == -1) /* overflow */ + { + overflow: + MPFR_LOG_MSG (("Overflow\n", 0)); + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_ERANGE); #ifdef EOVERFLOW - errno = EOVERFLOW; + MPFR_LOG_MSG (("Setting errno to EOVERFLOW\n", 0)); + errno = EOVERFLOW; #endif + } - error: MPFR_SAVE_EXPO_FREE (expo); - *ptr = NULL; - (*__gmp_free_func) (buf.start, buf.size); + if (ptr != NULL) /* implement mpfr_vasprintf */ + *ptr = NULL; + if (ptr != NULL || size != 0) + mpfr_free_func (buf.start, buf.size); return -1; } +#else /* HAVE_STDARG */ + +/* Avoid an empty translation unit (see ISO C99, 6.9) */ +typedef int foo; + #endif /* HAVE_STDARG */ diff -Nru mpfr4-3.1.4/src/version.c mpfr4-4.0.2/src/version.c --- mpfr4-3.1.4/src/version.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/version.c 2019-01-31 20:29:48.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_get_version -- MPFR version -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" @@ -25,5 +25,5 @@ const char * mpfr_get_version (void) { - return "3.1.4"; + return "4.0.2"; } diff -Nru mpfr4-3.1.4/src/volatile.c mpfr4-4.0.2/src/volatile.c --- mpfr4-3.1.4/src/volatile.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/volatile.c 2019-01-07 13:53:20.000000000 +0000 @@ -4,7 +4,7 @@ CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN FUTURE MPFR RELEASES. -Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2003-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -21,7 +21,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" diff -Nru mpfr4-3.1.4/src/x86/core2/mparam.h mpfr4-4.0.2/src/x86/core2/mparam.h --- mpfr4-3.1.4/src/x86/core2/mparam.h 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/x86/core2/mparam.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Generated by MPFR's tuneup.c, 2011-07-31, gcc 4.3.2 */ @@ -89,7 +89,7 @@ 824,808,831,824,824,824,832,823,832,824,832,831,832,832,829,830, \ 831,832,832,832,831,831,832,832,830,832,832,832,832,831,831,832, \ 879,832,832,880,832,831,832,831,832,832,832,832,832,832,832,831 \ - + #define MPFR_SQRHIGH_TAB \ -1,0,0,0,-1,-1,-1,-1,-1,-1,-1,8,8,8,9,9, \ 10,10,11,13,13,14,15,16,14,16,17,16,18,17,19,18, \ @@ -155,7 +155,7 @@ 696,696,696,696,696,694,695,696,696,695,696,694,727,696,696,688, \ 695,696,696,695,696,695,695,696,696,727,696,696,695,696,695,696, \ 696,695,696,695,696,696,696,728,728,696,720,728,728,728,726,728 \ - + #define MPFR_DIVHIGH_TAB \ 0,1,2,3,4,5,6,7,8,9,10,9,10,11,14,13, \ 14,11,16,17,13,14,15,16,16,14,16,16,16,19,20,18, \ @@ -221,7 +221,7 @@ 607,608,608,608,608,608,607,607,608,607,608,608,608,607,608,608, \ 608,608,609,609,608,608,609,608,608,608,606,606,608,608,609,607, \ 606,607,608,608,610,608,608,609,608,608,608,608,608,608,607,608 \ - + #define MPFR_MUL_THRESHOLD 15 /* limbs */ #define MPFR_SQR_THRESHOLD 18 /* limbs */ #define MPFR_DIV_THRESHOLD 22 /* limbs */ diff -Nru mpfr4-3.1.4/src/x86/mparam.h mpfr4-4.0.2/src/x86/mparam.h --- mpfr4-3.1.4/src/x86/mparam.h 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/x86/mparam.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Generated by MPFR's tuneup.c, 2011-07-31, gcc 4.4.2 */ @@ -88,7 +88,7 @@ 784,784,784,784,784,784,784,784,784,784,784,832,784,784,784,784, \ 832,784,832,831,832,831,832,832,832,832,832,784,784,784,784,784, \ 832,784,832,784,832,832,832,832,832,832,832,832,832,832,832,832 \ - + #define MPFR_SQRHIGH_TAB \ -1,0,0,-1,-1,-1,-1,5,6,6,7,7,8,8,9,9, \ 10,11,12,11,12,13,14,13,14,15,16,15,16,16,17,17, \ @@ -154,7 +154,7 @@ 584,584,584,584,584,584,584,568,568,568,568,616,568,568,616,568, \ 600,584,600,600,600,632,616,600,584,616,616,632,632,584,632,616, \ 616,616,616,616,616,632,632,616,616,632,632,616,616,632,616,616 \ - + #define MPFR_DIVHIGH_TAB \ 0,1,2,3,4,5,6,7,8,7,10,9,10,11,12,13, \ 14,15,16,17,18,16,14,16,16,19,19,18,20,19,20,18, \ @@ -220,7 +220,7 @@ 501,500,552,497,516,511,503,513,497,511,502,509,564,509,504,512, \ 503,504,512,504,504,500,512,512,512,511,512,504,557,504,564,564, \ 512,564,514,512,516,512,560,564,560,564,564,512,564,564,564,560 \ - + #define MPFR_MUL_THRESHOLD 15 /* limbs */ #define MPFR_SQR_THRESHOLD 14 /* limbs */ #define MPFR_DIV_THRESHOLD 27 /* limbs */ diff -Nru mpfr4-3.1.4/src/x86_64/core2/mparam.h mpfr4-4.0.2/src/x86_64/core2/mparam.h --- mpfr4-3.1.4/src/x86_64/core2/mparam.h 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/x86_64/core2/mparam.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Generated by MPFR's tuneup.c, 2011-07-31, gcc 4.3.2 */ @@ -91,7 +91,7 @@ 736,736,736,736,736,736,736,736,736,736,736,736,736,736,735,736, \ 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \ 824,824,832,832,832,832,824,832,832,832,832,832,824,831,832,832 \ - + #define MPFR_SQRHIGH_TAB \ -1,0,0,0,0,0,0,5,6,6,7,8,8,8,10,9, \ 10,11,11,11,12,13,13,13,14,16,16,17,17,17,17,17, \ @@ -157,7 +157,7 @@ 628,627,630,631,632,663,632,631,632,630,632,631,632,626,632,632, \ 632,663,631,631,632,632,632,664,632,632,600,632,632,600,632,632, \ 600,600,632,632,632,662,663,663,663,600,664,632,664,663,664,632 \ - + #define MPFR_DIVHIGH_TAB \ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,12,13, \ 14,15,16,13,14,14,14,15,15,17,17,17,19,19,19,19, \ @@ -223,7 +223,7 @@ 552,561,564,564,560,564,561,564,564,564,564,564,564,564,564,560, \ 561,560,564,564,560,564,564,552,564,564,564,552,564,564,564,564, \ 564,563,564,564,564,564,560,564,564,564,564,552,564,564,560,564 \ - + #define MPFR_MUL_THRESHOLD 7 /* limbs */ #define MPFR_SQR_THRESHOLD 12 /* limbs */ #define MPFR_DIV_THRESHOLD 20 /* limbs */ diff -Nru mpfr4-3.1.4/src/x86_64/pentium4/mparam.h mpfr4-4.0.2/src/x86_64/pentium4/mparam.h --- mpfr4-3.1.4/src/x86_64/pentium4/mparam.h 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/x86_64/pentium4/mparam.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Generated by MPFR's tuneup.c, 2009-02-09, gcc 4.3 */ diff -Nru mpfr4-3.1.4/src/yn.c mpfr4-4.0.2/src/yn.c --- mpfr4-3.1.4/src/yn.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/yn.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_y0, mpfr_y1, mpfr_yn -- Bessel functions of 2nd kind, integer order. http://www.opengroup.org/onlinepubs/009695399/functions/y0.html -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -170,7 +170,7 @@ 0. We choose to return +0 in that case. */ else if (MPFR_IS_INF (z)) { - if (MPFR_SIGN(z) > 0) + if (MPFR_IS_POS (z)) return mpfr_set_ui (res, 0, r); else /* y(n,-Inf) = NaN */ { @@ -186,14 +186,14 @@ MPFR_SET_NEG(res); else MPFR_SET_POS(res); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); MPFR_RET(0); } } /* for z < 0, y(n,z) is imaginary except when j(n,|z|) = 0, which we assume does not happen for a rational z. */ - if (MPFR_SIGN(z) < 0) + if (MPFR_IS_NEG (z)) { MPFR_SET_NAN (res); MPFR_RET_NAN; diff -Nru mpfr4-3.1.4/src/zeta.c mpfr4-4.0.2/src/zeta.c --- mpfr4-3.1.4/src/zeta.c 2016-03-06 11:33:05.000000000 +0000 +++ mpfr4-4.0.2/src/zeta.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_zeta -- compute the Riemann Zeta function -Copyright 2003-2016 Free Software Foundation, Inc. +Copyright 2003-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,9 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include /* for DBL_MAX */ + #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" @@ -201,8 +203,7 @@ where gamma is Euler's constant */ { dint = MAX (d + 3, precs); - MPFR_TRACE (printf ("branch 1\ninternal precision=%lu\n", - (unsigned long) dint)); + /* branch 1, with internal precision dint */ MPFR_GROUP_REPREC_4 (group, dint, b, c, z_pre, f); mpfr_div (z_pre, __gmpfr_one, s1, MPFR_RNDN); mpfr_const_euler (f, MPFR_RNDN); @@ -212,12 +213,12 @@ { size_t size; - MPFR_TRACE (printf ("branch 2\n")); + /* branch 2 */ /* Computation of parameters n, p and working precision */ dnep = (double) d * LOG2; sd = mpfr_get_d (s, MPFR_RNDN); /* beta = dnep + 0.61 + sd * log (6.2832 / sd); - but a larger value is ok */ + but a larger value is OK */ #define LOG6dot2832 1.83787940484160805532 beta = dnep + 0.61 + sd * (LOG6dot2832 - LOG2 * __gmpfr_floor_log2 (sd)); @@ -232,7 +233,6 @@ p = 1 + (int) beta / 2; n = 1 + (int) ((sd + 2.0 * (double) p - 1.0) / 6.2832); } - MPFR_TRACE (printf ("\nn=%d\np=%d\n",n,p)); /* add = 4 + floor(1.5 * log(d) / log (2)). We should have add >= 10, which is always fulfilled since d = precz + 11 >= 12, thus ceil(log2(d)) >= 4 */ @@ -242,37 +242,33 @@ if (dint < precs) dint = precs; - MPFR_TRACE (printf ("internal precision=%lu\n", - (unsigned long) dint)); + /* internal precision is dint */ size = (p + 1) * sizeof(mpfr_t); - tc1 = (mpfr_t*) (*__gmp_allocate_func) (size); + tc1 = (mpfr_t*) mpfr_allocate_func (size); for (l=1; l<=p; l++) mpfr_init2 (tc1[l], dint); MPFR_GROUP_REPREC_4 (group, dint, b, c, z_pre, f); - MPFR_TRACE (printf ("precision of z = %lu\n", - (unsigned long) precz)); + /* precision of z is precz */ /* Computation of the coefficients c_k */ mpfr_zeta_c (p, tc1); - /* Computation of the 3 parts of the fonction Zeta. */ + /* Computation of the 3 parts of the function Zeta. */ mpfr_zeta_part_a (z_pre, s, n); mpfr_zeta_part_b (b, s, n, p, tc1); /* s1 = s-1 is already computed above */ mpfr_div (c, __gmpfr_one, s1, MPFR_RNDN); mpfr_ui_pow (f, n, s1, MPFR_RNDN); mpfr_div (c, c, f, MPFR_RNDN); - MPFR_TRACE (MPFR_DUMP (c)); mpfr_add (z_pre, z_pre, c, MPFR_RNDN); mpfr_add (z_pre, z_pre, b, MPFR_RNDN); for (l=1; l<=p; l++) mpfr_clear (tc1[l]); - (*__gmp_free_func) (tc1, size); + mpfr_free_func (tc1, size); /* End branch 2 */ } - MPFR_TRACE (MPFR_DUMP (z_pre)); if (MPFR_LIKELY (MPFR_CAN_ROUND (z_pre, d-3, precz, rnd_mode))) break; MPFR_ZIV_NEXT (loop, d); @@ -287,11 +283,141 @@ return inex; } +/* return add = 1 + floor(log(c^3*(13+m1))/log(2)) + where c = (1+eps)*(1+eps*max(8,m1)), + m1 = 1 + max(1/eps,2*sd)*(1+eps), + eps = 2^(-precz-14) + sd = abs(s-1) + */ +static long +compute_add (mpfr_srcptr s, mpfr_prec_t precz) +{ + mpfr_t t, u, m1; + long add; + + mpfr_inits2 (64, t, u, m1, (mpfr_ptr) 0); + if (mpfr_cmp_ui (s, 1) >= 0) + mpfr_sub_ui (t, s, 1, MPFR_RNDU); + else + mpfr_ui_sub (t, 1, s, MPFR_RNDU); + /* now t = sd = abs(s-1), rounded up */ + mpfr_set_ui_2exp (u, 1, - precz - 14, MPFR_RNDU); + /* u = eps */ + /* since 1/eps = 2^(precz+14), if EXP(sd) >= precz+14, then + sd >= 1/2*2^(precz+14) thus 2*sd >= 2^(precz+14) >= 1/eps */ + if (mpfr_get_exp (t) >= precz + 14) + mpfr_mul_2exp (t, t, 1, MPFR_RNDU); + else + mpfr_set_ui_2exp (t, 1, precz + 14, MPFR_RNDU); + /* now t = max(1/eps,2*sd) */ + mpfr_add_ui (u, u, 1, MPFR_RNDU); /* u = 1+eps, rounded up */ + mpfr_mul (t, t, u, MPFR_RNDU); /* t = max(1/eps,2*sd)*(1+eps) */ + mpfr_add_ui (m1, t, 1, MPFR_RNDU); + if (mpfr_get_exp (m1) <= 3) + mpfr_set_ui (t, 8, MPFR_RNDU); + else + mpfr_set (t, m1, MPFR_RNDU); + /* now t = max(8,m1) */ + mpfr_div_2exp (t, t, precz + 14, MPFR_RNDU); /* eps*max(8,m1) */ + mpfr_add_ui (t, t, 1, MPFR_RNDU); /* 1+eps*max(8,m1) */ + mpfr_mul (t, t, u, MPFR_RNDU); /* t = c */ + mpfr_add_ui (u, m1, 13, MPFR_RNDU); /* 13+m1 */ + mpfr_mul (u, u, t, MPFR_RNDU); /* c*(13+m1) */ + mpfr_sqr (t, t, MPFR_RNDU); /* c^2 */ + mpfr_mul (u, u, t, MPFR_RNDU); /* c^3*(13+m1) */ + add = mpfr_get_exp (u); + mpfr_clears (t, u, m1, (mpfr_ptr) 0); + return add; +} + +/* return in z a lower bound (for rnd = RNDD) or upper bound (for rnd = RNDU) + of |zeta(s)|/2, using: + log(|zeta(s)|/2) = (s-1)*log(2*Pi) + lngamma(1-s) + + log(|sin(Pi*s/2)| * zeta(1-s)). + Assumes s < 1/2 and s1 = 1-s exactly, thus s1 > 1/2. + y and p are temporary variables. + At input, p is Pi rounded down. + The comments in the code are for rnd = RNDD. */ +static void +mpfr_reflection_overflow (mpfr_t z, mpfr_t s1, const mpfr_t s, mpfr_t y, + mpfr_t p, mpfr_rnd_t rnd) +{ + mpz_t sint; + + MPFR_ASSERTD (rnd == MPFR_RNDD || rnd == MPFR_RNDU); + + /* Since log is increasing, we want lower bounds on |sin(Pi*s/2)| and + zeta(1-s). */ + mpz_init (sint); + mpfr_get_z (sint, s, MPFR_RNDD); /* sint = floor(s) */ + /* We first compute a lower bound of |sin(Pi*s/2)|, which is a periodic + function of period 2. Thus: + if 2k < s < 2k+1, then |sin(Pi*s/2)| is increasing; + if 2k-1 < s < 2k, then |sin(Pi*s/2)| is decreasing. + These cases are distinguished by testing bit 0 of floor(s) as if + represented in two's complement (or equivalently, as an unsigned + integer mod 2): + 0: sint = 0 mod 2, thus 2k < s < 2k+1 and |sin(Pi*s/2)| is increasing; + 1: sint = 1 mod 2, thus 2k-1 < s < 2k and |sin(Pi*s/2)| is decreasing. + Let's recall that the comments are for rnd = RNDD. */ + if (mpz_tstbit (sint, 0) == 0) /* |sin(Pi*s/2)| is increasing: round down + Pi*s to get a lower bound. */ + { + mpfr_mul (y, p, s, rnd); + if (rnd == MPFR_RNDD) + mpfr_nextabove (p); /* we will need p rounded above afterwards */ + } + else /* |sin(Pi*s/2)| is decreasing: round up Pi*s to get a lower bound. */ + { + if (rnd == MPFR_RNDD) + mpfr_nextabove (p); + mpfr_mul (y, p, s, MPFR_INVERT_RND(rnd)); + } + mpfr_div_2ui (y, y, 1, MPFR_RNDN); /* exact, rounding mode doesn't matter */ + /* The rounding direction of sin depends on its sign. We have: + if -4k-2 < s < -4k, then -2k-1 < s/2 < -2k, thus sin(Pi*s/2) < 0; + if -4k < s < -4k+2, then -2k < s/2 < -2k+1, thus sin(Pi*s/2) > 0. + These cases are distinguished by testing bit 1 of floor(s) as if + represented in two's complement (or equivalently, as an unsigned + integer mod 4): + 0: sint = {0,1} mod 4, thus -2k < s/2 < -2k+1 and sin(Pi*s/2) > 0; + 1: sint = {2,3} mod 4, thus -2k-1 < s/2 < -2k and sin(Pi*s/2) < 0. + Let's recall that the comments are for rnd = RNDD. */ + if (mpz_tstbit (sint, 1) == 0) /* -2k < s/2 < -2k+1; sin(Pi*s/2) > 0 */ + { + /* Round sin down to get a lower bound of |sin(Pi*s/2)|. */ + mpfr_sin (y, y, rnd); + } + else /* -2k-1 < s/2 < -2k; sin(Pi*s/2) < 0 */ + { + /* Round sin up to get a lower bound of |sin(Pi*s/2)|. */ + mpfr_sin (y, y, MPFR_INVERT_RND(rnd)); + mpfr_abs (y, y, MPFR_RNDN); /* exact, rounding mode doesn't matter */ + } + mpz_clear (sint); + /* now y <= |sin(Pi*s/2)| when rnd=RNDD, y >= |sin(Pi*s/2)| when rnd=RNDU */ + mpfr_zeta_pos (z, s1, rnd); /* zeta(1-s) */ + mpfr_mul (z, z, y, rnd); + /* now z <= |sin(Pi*s/2)|*zeta(1-s) */ + mpfr_log (z, z, rnd); + /* now z <= log(|sin(Pi*s/2)|*zeta(1-s)) */ + mpfr_lngamma (y, s1, rnd); + mpfr_add (z, z, y, rnd); + /* z <= lngamma(1-s) + log(|sin(Pi*s/2)|*zeta(1-s)) */ + /* since s-1 < 0, we want to round log(2*pi) upwards */ + mpfr_mul_2ui (y, p, 1, MPFR_INVERT_RND(rnd)); + mpfr_log (y, y, MPFR_INVERT_RND(rnd)); + mpfr_mul (y, y, s1, MPFR_INVERT_RND(rnd)); + mpfr_sub (z, z, y, rnd); + mpfr_exp (z, z, rnd); + if (rnd == MPFR_RNDD) + mpfr_nextbelow (p); /* restore original p */ +} + int mpfr_zeta (mpfr_t z, mpfr_srcptr s, mpfr_rnd_t rnd_mode) { mpfr_t z_pre, s1, y, p; - double sd, eps, m1, c; long add; mpfr_prec_t precz, prec1, precs, precs1; int inex; @@ -328,10 +454,9 @@ /* s is neither Nan, nor Inf, nor Zero */ /* check tiny s: we have zeta(s) = -1/2 - 1/2 log(2 Pi) s + ... around s=0, - and for |s| <= 0.074, we have |zeta(s) + 1/2| <= |s|. - Thus if |s| <= 1/4*ulp(1/2), we can deduce the correct rounding - (the 1/4 covers the case where |zeta(s)| < 1/2 and rounding to nearest). - A sufficient condition is that EXP(s) + 1 < -PREC(z). */ + and for |s| <= 2^(-4), we have |zeta(s) + 1/2| <= |s|. + EXP(s) + 1 < -PREC(z) is a sufficient condition to be able to round + correctly, for any PREC(z) >= 1 (see algorithms.tex for details). */ if (MPFR_GET_EXP (s) + 1 < - (mpfr_exp_t) MPFR_PREC(z)) { int signs = MPFR_SIGN(s); @@ -382,7 +507,7 @@ { MPFR_SET_INF (z); MPFR_SET_POS (z); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); MPFR_RET (0); } @@ -402,39 +527,96 @@ /* Precision precs1 needed to represent 1 - s, and s + 2, without any truncation */ precs1 = precs + 2 + MAX (0, - MPFR_GET_EXP (s)); - sd = mpfr_get_d (s, MPFR_RNDN) - 1.0; - if (sd < 0.0) - sd = -sd; /* now sd = abs(s-1.0) */ /* Precision prec1 is the precision on elementary computations; it ensures a final precision prec1 - add for zeta(s) */ - /* eps = pow (2.0, - (double) precz - 14.0); */ - eps = __gmpfr_ceil_exp2 (- (double) precz - 14.0); - m1 = 1.0 + MAX(1.0 / eps, 2.0 * sd) * (1.0 + eps); - c = (1.0 + eps) * (1.0 + eps * MAX(8.0, m1)); - /* add = 1 + floor(log(c*c*c*(13 + m1))/log(2)); */ - add = __gmpfr_ceil_log2 (c * c * c * (13.0 + m1)); + add = compute_add (s, precz); prec1 = precz + add; + /* FIXME: To avoid that the working precision (prec1) depends on the + input precision, one would need to take into account the error made + when s1 is not exactly 1-s when computing zeta(s1) and gamma(s1) + below, and also in the case y=Inf (i.e. when gamma(s1) overflows). + Make sure that underflows do not occur in intermediate computations. + Due to the limited precision, they are probably not possible + in practice; add some MPFR_ASSERTN's to be sure that problems + do not remain undetected? */ prec1 = MAX (prec1, precs1) + 10; MPFR_GROUP_INIT_4 (group, prec1, z_pre, s1, y, p); MPFR_ZIV_INIT (loop, prec1); for (;;) { + mpfr_exp_t ey; + mpfr_t z_up; + + mpfr_const_pi (p, MPFR_RNDD); /* p is Pi */ + mpfr_sub (s1, __gmpfr_one, s, MPFR_RNDN); /* s1 = 1-s */ - mpfr_zeta_pos (z_pre, s1, MPFR_RNDN); /* zeta(1-s) */ mpfr_gamma (y, s1, MPFR_RNDN); /* gamma(1-s) */ - if (MPFR_IS_INF (y)) /* Zeta(s) < 0 for -4k-2 < s < -4k, - Zeta(s) > 0 for -4k < s < -4k+2 */ + if (MPFR_IS_INF (y)) /* zeta(s) < 0 for -4k-2 < s < -4k, + zeta(s) > 0 for -4k < s < -4k+2 */ { - mpfr_div_2ui (s1, s, 2, MPFR_RNDN); /* s/4, exact */ - mpfr_frac (s1, s1, MPFR_RNDN); /* exact, -1 < s1 < 0 */ - overflow = (mpfr_cmp_si_2exp (s1, -1, -1) > 0) ? -1 : 1; - break; + /* FIXME: An overflow in gamma(s1) does not imply that + zeta(s) will overflow. A solution: + 1. Compute + log(|zeta(s)|/2) = (s-1)*log(2*pi) + lngamma(1-s) + + log(abs(sin(Pi*s/2)) * zeta(1-s)) + (possibly sharing computations with the normal case) + with a rather good accuracy (see (2)). + Memorize the sign of sin(...) for the final sign. + 2. Take the exponential, ~= |zeta(s)|/2. If there is an + overflow, then this means an overflow on the final result + (due to the multiplication by 2, which has not been done + yet). + 3. Ziv test. + 4. Correct the sign from the sign of sin(...). + 5. Round then multiply by 2. Here, an overflow in either + operation means a real overflow. */ + mpfr_reflection_overflow (z_pre, s1, s, y, p, MPFR_RNDD); + /* z_pre is a lower bound of |zeta(s)|/2, thus if it overflows, + or has exponent emax, then |zeta(s)| overflows too. */ + if (MPFR_IS_INF (z_pre) || MPFR_GET_EXP(z_pre) == __gmpfr_emax) + { /* determine the sign of overflow */ + mpfr_div_2ui (s1, s, 2, MPFR_RNDN); /* s/4, exact */ + mpfr_frac (s1, s1, MPFR_RNDN); /* exact, -1 < s1 < 0 */ + overflow = (mpfr_cmp_si_2exp (s1, -1, -1) > 0) ? -1 : 1; + break; + } + else /* EXP(z_pre) < __gmpfr_emax */ + { + int ok = 0; + mpfr_t z_down; + mpfr_init2 (z_up, mpfr_get_prec (z_pre)); + mpfr_reflection_overflow (z_up, s1, s, y, p, MPFR_RNDU); + /* if the lower approximation z_pre does not overflow, but + z_up does, we need more precision */ + if (MPFR_IS_INF (z_up) || MPFR_GET_EXP(z_up) == __gmpfr_emax) + goto next_loop; + /* check if z_pre and z_up round to the same number */ + mpfr_init2 (z_down, precz); + mpfr_set (z_down, z_pre, rnd_mode); + /* Note: it might be that EXP(z_down) = emax here, in that + case we will have overflow below when we multiply by 2 */ + mpfr_prec_round (z_up, precz, rnd_mode); + ok = mpfr_cmp (z_down, z_up) == 0; + mpfr_clear (z_up); + mpfr_clear (z_down); + if (ok) + { + /* get correct sign and multiply by 2 */ + mpfr_div_2ui (s1, s, 2, MPFR_RNDN); /* s/4, exact */ + mpfr_frac (s1, s1, MPFR_RNDN); /* exact, -1 < s1 < 0 */ + if (mpfr_cmp_si_2exp (s1, -1, -1) > 0) + mpfr_neg (z_pre, z_pre, rnd_mode); + mpfr_mul_2ui (z_pre, z_pre, 1, rnd_mode); + break; + } + else + goto next_loop; + } } + mpfr_zeta_pos (z_pre, s1, MPFR_RNDN); /* zeta(1-s) */ mpfr_mul (z_pre, z_pre, y, MPFR_RNDN); /* gamma(1-s)*zeta(1-s) */ - mpfr_const_pi (p, MPFR_RNDD); /* p is Pi */ - /* multiply z_pre by 2^s*Pi^(s-1) where p=Pi, s1=1-s */ mpfr_mul_2ui (y, p, 1, MPFR_RNDN); /* 2*Pi */ mpfr_neg (s1, s1, MPFR_RNDN); /* s-1 */ @@ -445,11 +627,19 @@ /* multiply z_pre by sin(Pi*s/2) */ mpfr_mul (y, s, p, MPFR_RNDN); mpfr_div_2ui (p, y, 1, MPFR_RNDN); /* p = s*Pi/2 */ + /* FIXME: sinpi will be available, we should replace the mpfr_sin + call below by mpfr_sinpi(s/2), where s/2 will be exact. + Can mpfr_sin underflow? Moreover, the code below should be + improved so that the "if" condition becomes unlikely, e.g. + by taking a slightly larger working precision. */ mpfr_sin (y, p, MPFR_RNDN); /* y = sin(Pi*s/2) */ - if (MPFR_GET_EXP(y) < 0) /* take account of cancellation in sin(p) */ + ey = MPFR_GET_EXP (y); + if (ey < 0) /* take account of cancellation in sin(p) */ { mpfr_t t; - mpfr_init2 (t, prec1 - MPFR_GET_EXP(y)); + + MPFR_ASSERTN (- ey < MPFR_PREC_MAX - prec1); + mpfr_init2 (t, prec1 - ey); mpfr_const_pi (t, MPFR_RNDD); mpfr_mul (t, s, t, MPFR_RNDN); mpfr_div_2ui (t, t, 1, MPFR_RNDN); @@ -462,6 +652,7 @@ rnd_mode))) break; + next_loop: MPFR_ZIV_NEXT (loop, prec1); MPFR_GROUP_REPREC_4 (group, prec1, z_pre, s1, y, p); } diff -Nru mpfr4-3.1.4/src/zeta_ui.c mpfr4-4.0.2/src/zeta_ui.c --- mpfr4-3.1.4/src/zeta_ui.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/src/zeta_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_zeta_ui -- compute the Riemann Zeta function for integer argument. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define MPFR_NEED_LONGLONG_H @@ -32,15 +32,13 @@ (("m=%lu rnd=%d prec=%Pu", m, r, mpfr_get_prec (z)), ("z[%Pu]=%.*Rg", mpfr_get_prec (z), mpfr_log_prec, z)); - if (m == 0) - { - return mpfr_set_si_2exp (z, -1, -1, r); - } + if (m == 0) /* zeta(0) = -1/2 */ + return mpfr_set_si_2exp (z, -1, -1, r); else if (m == 1) { MPFR_SET_INF (z); MPFR_SET_POS (z); - mpfr_set_divby0 (); + MPFR_SET_DIVBY0 (); return 0; } else /* m >= 2 */ diff -Nru mpfr4-3.1.4/test-driver mpfr4-4.0.2/test-driver --- mpfr4-3.1.4/test-driver 2016-03-06 11:33:18.000000000 +0000 +++ mpfr4-4.0.2/test-driver 2019-01-31 20:43:20.000000000 +0000 @@ -1,9 +1,9 @@ #! /bin/sh # test-driver - basic testsuite driver script. -scriptversion=2013-07-13.22; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 2011-2014 Free Software Foundation, Inc. +# Copyright (C) 2011-2018 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -140,9 +140,9 @@ # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff -Nru mpfr4-3.1.4/tests/cmp_str.c mpfr4-4.0.2/tests/cmp_str.c --- mpfr4-3.1.4/tests/cmp_str.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/cmp_str.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_cmp_str -- compare a floating-point number with a string. -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-test.h" diff -Nru mpfr4-3.1.4/tests/inp_str.dat mpfr4-4.0.2/tests/inp_str.dat --- mpfr4-3.1.4/tests/inp_str.dat 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/inp_str.dat 2016-05-22 22:27:26.000000000 +0000 @@ -0,0 +1,65 @@ +-17e2 +3.1415E4 +3.14160000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E4 +this_is_an_invalid_float +1.0010010100001110100101001110011010111011100001110010e226 +2.0120022122100022221001012120111010e142 +1.02110032211032122323201302e113 +1.43422433221034224112212e97 +2.245023334051130112541e87 +3.0214031231425640423e80 +2.224164516327341620e75 +2.16278308831176433e71 +1.2344999999999999e68 +2.5768519130417743@65 +1.326a50b3b9b311a@63 +1.4ca424800281ca0@61 +2.d44d2c475c1617@59 +b.4e8eae45eec494@57 +4.943a539aee1c8@56 +2.a69b19309ce43@55 +2.08b6320agf513@54 +2.18igbef497b79@53 +2.eg92a193d6jib@52 +4.bcj53i4dg133i@51 +9.7aee6ife1hgc@50 +1.065g326jbmm6@50 +2.l9dfn9kk1l6k@49 +9.jcnhb3me6c6m@48 +1.ci74dmge82kb@48 +6.f8h98p15fd2p@47 +1.57pn1af15bcb@47 +6.i3h3gqn3sp0@46 +1.bnhlsj9haq1@46 +9.h60jmhep7e9@45 +2.98eijjbn1p0@45 +i.u9r3j72f706@44 +5.2vxma61rnia@44 +1.epbr7wcjrks@44 +e.t2lm57i7hol@43 +4.KOJ1KXDLOD4@43 +1.H11SSC49aK9@43 +I.IWc1P7E0LQ8@42 +6.FBLVIEPHDc@42 +2.AV3VN4CK5A@42 +Y.MLABZPIMQ8@41 +D.6dIaKL16KV@41 +5.5RIZ3BGFbB@41 +2.1bIDPOihRN@41 +c.5SPGTF1gcJ@40 +G.60Khc9JPg1@40 +6.jNOlekhHB9@40 +3.2B39MUfSUI@40 +1.HhIJK7WJnh@40 +V.HkOThmcRf8@39 +E.aOdo3XbWH0@39 +6.qaNNZOE7Dd@39 +3.KAITW0C2kr@39 +1.ZdacKp9sIh@39 +j.ff6t2aeHht@38 +N.Jl6DgUeeZA@38 +C.3GakhvVNYH@38 +6.HTqomOD3Rh@38 +3.JSeUbAAtE@38 +1.lD6kuqhV0@38 +x.I7kYxn4IR@37 diff -Nru mpfr4-3.1.4/tests/inp_str.data mpfr4-4.0.2/tests/inp_str.data --- mpfr4-3.1.4/tests/inp_str.data 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/inp_str.data 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -3.1415E4 -3.14160000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E4 -this_is_an_invalid_float -1.0010010100001110100101001110011010111011100001110010e226 -2.0120022122100022221001012120111010e142 -1.02110032211032122323201302e113 -1.43422433221034224112212e97 -2.245023334051130112541e87 -3.0214031231425640423e80 -2.224164516327341620e75 -2.16278308831176433e71 -1.2344999999999999e68 -2.5768519130417743@65 -1.326a50b3b9b311a@63 -1.4ca424800281ca0@61 -2.d44d2c475c1617@59 -b.4e8eae45eec494@57 -4.943a539aee1c8@56 -2.a69b19309ce43@55 -2.08b6320agf513@54 -2.18igbef497b79@53 -2.eg92a193d6jib@52 -4.bcj53i4dg133i@51 -9.7aee6ife1hgc@50 -1.065g326jbmm6@50 -2.l9dfn9kk1l6k@49 -9.jcnhb3me6c6m@48 -1.ci74dmge82kb@48 -6.f8h98p15fd2p@47 -1.57pn1af15bcb@47 -6.i3h3gqn3sp0@46 -1.bnhlsj9haq1@46 -9.h60jmhep7e9@45 -2.98eijjbn1p0@45 -i.u9r3j72f706@44 -5.2vxma61rnia@44 -1.epbr7wcjrks@44 -e.t2lm57i7hol@43 -4.KOJ1KXDLOD4@43 -1.H11SSC49aK9@43 -I.IWc1P7E0LQ8@42 -6.FBLVIEPHDc@42 -2.AV3VN4CK5A@42 -Y.MLABZPIMQ8@41 -D.6dIaKL16KV@41 -5.5RIZ3BGFbB@41 -2.1bIDPOihRN@41 -c.5SPGTF1gcJ@40 -G.60Khc9JPg1@40 -6.jNOlekhHB9@40 -3.2B39MUfSUI@40 -1.HhIJK7WJnh@40 -V.HkOThmcRf8@39 -E.aOdo3XbWH0@39 -6.qaNNZOE7Dd@39 -3.KAITW0C2kr@39 -1.ZdacKp9sIh@39 -j.ff6t2aeHht@38 -N.Jl6DgUeeZA@38 -C.3GakhvVNYH@38 -6.HTqomOD3Rh@38 -3.JSeUbAAtE@38 -1.lD6kuqhV0@38 -x.I7kYxn4IR@37 diff -Nru mpfr4-3.1.4/tests/Makefile.am mpfr4-4.0.2/tests/Makefile.am --- mpfr4-3.1.4/tests/Makefile.am 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/Makefile.am 2019-01-07 16:11:57.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright 2000-2016 Free Software Foundation, Inc. +# Copyright 2000-2019 Free Software Foundation, Inc. # This Makefile.am is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,28 +11,30 @@ AUTOMAKE_OPTIONS = 1.6 gnu -check_PROGRAMS = tversion tinternals tinits tisqrt tsgn tcheck \ - tisnan texceptions tset_exp tset mpf_compat mpfr_compat \ - reuse tabs tacos tacosh tadd tadd1sp tadd_d tadd_ui tagm \ - tai tasin tasinh tatan tatanh taway tbuildopt tcan_round \ - tcbrt tcmp tcmp2 tcmp_d tcmp_ld tcmp_ui tcmpabs \ - tcomparisons tconst_catalan tconst_euler tconst_log2 \ - tconst_pi tcopysign tcos tcosh tcot tcoth tcsc tcsch \ - td_div td_sub tdigamma tdim tdiv tdiv_d tdiv_ui teint teq \ - terf texp texp10 texp2 texpm1 tfactorial tfits tfma tfmod \ - tfms tfprintf tfrac tfrexp tgamma tget_flt tget_d tget_d_2exp \ - tget_f tget_ld_2exp tget_set_d64 tget_sj tget_str tget_z \ - tgmpop tgrandom thyperbolic thypot tinp_str tj0 tj1 tjn tl2b \ - tlgamma tli2 tlngamma tlog tlog10 tlog1p tlog2 tmin_prec \ - tminmax tmodf tmul tmul_2exp tmul_d tmul_ui tnext \ - tout_str toutimpl tpow tpow3 tpow_all tpow_z tprintf \ - trandom trec_sqrt tremquo trint troot tround_prec tsec \ - tsech tset_d tset_f tset_ld tset_q tset_si tset_sj \ - tset_str tset_z tset_z_exp tsi_op tsin tsin_cos tsinh \ - tsinh_cosh tsprintf tsqr tsqrt tsqrt_ui tstckintc tstdint tstrtofr \ - tsub tsub1sp tsub_d tsub_ui tsubnormal tsum tswap ttan \ - ttanh ttrunc tui_div tui_pow tui_sub turandom \ - tvalist ty0 ty1 tyn tzeta tzeta_ui +check_PROGRAMS = tversion tabort_prec_max tassert tabort_defalloc1 \ + tabort_defalloc2 talloc tinternals tinits tisqrt tsgn tcheck \ + tisnan texceptions tset_exp tset mpf_compat mpfr_compat reuse \ + tabs tacos tacosh tadd tadd1sp tadd_d tadd_ui tagm tai \ + talloc-cache tasin tasinh tatan tatanh taway tbeta tbuildopt \ + tcan_round tcbrt tcmp tcmp2 tcmp_d tcmp_ld tcmp_ui tcmpabs \ + tcomparisons tconst_catalan tconst_euler tconst_log2 tconst_pi \ + tcopysign tcos tcosh tcot tcoth tcsc tcsch td_div td_sub tdigamma \ + tdim tdiv tdiv_d tdiv_ui teint teq terandom terandom_chisq terf \ + texp texp10 texp2 texpm1 tfactorial tfits tfma tfmma tfmod tfms \ + tfpif tfprintf tfrac tfrexp tgamma tgamma_inc tget_d tget_d_2exp \ + tget_f tget_flt tget_ld_2exp tget_q tget_set_d64 tget_sj \ + tget_str tget_z tgmpop tgrandom thyperbolic thypot tinp_str \ + tj0 tj1 tjn tl2b tlgamma tli2 tlngamma tlog tlog10 tlog1p tlog2 \ + tlog_ui tmin_prec tminmax tmodf tmul tmul_2exp tmul_d tmul_ui \ + tnext tnrandom tnrandom_chisq tout_str toutimpl tpow tpow3 \ + tpow_all tpow_z tprintf trandom trandom_deviate trec_sqrt \ + tremquo trint trndna troot trootn_ui tround_prec tsec tsech \ + tset_d tset_f tset_float128 tset_ld tset_q tset_si tset_sj \ + tset_str tset_z tset_z_exp tsi_op tsin tsin_cos tsinh tsinh_cosh \ + tsprintf tsqr tsqrt tsqrt_ui tstckintc tstdint tstrtofr \ + tsub tsub1sp tsub_d tsub_ui tsubnormal tsum tswap ttan ttanh \ + ttrunc tui_div tui_pow tui_sub turandom tvalist ty0 ty1 tyn \ + tzeta tzeta_ui # Before Automake 1.13, we ran tversion at the beginning and at the end # of the tests, and output from tversion appeared at the same place as @@ -41,15 +43,25 @@ # of the make output, so that the user could no longer see information # from tversion. To mimic the old behavior, we now output the contents # of the tversion log file if this file exists (i.e. if the Makefile -# has been generated with Automake 1.13+). +# has been generated with Automake 1.13+); but this is done only when +# no tests fail. check: - cat tversion.log 2> /dev/null || true + @if [ -d $(top_srcdir)/.svn ]; then \ + output=`svnversion $(top_srcdir) 2> /dev/null`; \ + if [ -n "$$output" ]; then \ + echo "[svnversion] $$output"; \ + fi; \ + fi + @grep -v '^PASS ' tversion.log 2> /dev/null || true AM_CPPFLAGS = -DSRCDIR='"$(srcdir)"' -EXTRA_DIST = tgeneric.c tgeneric_ui.c mpf_compat.h inp_str.data tmul.dat +EXTRA_DIST = tgeneric.c tgeneric_ui.c mpf_compat.h inp_str.dat tmul.dat \ + tfpif_r1.dat tfpif_r2.dat -LDADD = libfrtests.la $(MPFR_LIBM) $(top_builddir)/src/libmpfr.la +CLEANFILES = tfpif_rw.dat tfprintf_out.txt tout_str_out.txt toutimpl_out.txt tprintf_out.txt + +LDADD = libfrtests.la $(MPFR_LIBM) $(MPFR_LIBQUADMATH) $(top_builddir)/src/libmpfr.la AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_builddir)/src # LOADLIBES (documented in the "GNU make" manual and equivalent to LDLIBS) @@ -70,7 +82,21 @@ cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) libmpfr.la TESTS = $(check_PROGRAMS) -TESTS_ENVIRONMENT = MPFR_QUIET=1 $(VALGRIND) + +# Set DISPLAY='' as it is not needed and it can yield error messages when +# running the tests with LOG_COMPILER=wine (for builds with MinGW). See: +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914822 +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914949 +# $(VALGRIND) is still there to be able to use a wrapper such as valgrind +# in case old Automake. With Automake 1.13+, where a parallel test harness +# is generated, use LOG_COMPILER instead. For additional information, see: +# https://www.gnu.org/software/automake/manual/automake.html#Parallel-Test-Harness +# +# Note: We do not use "env -u DISPLAY" as the -u option is a GNU extension +# and not supported by NetBSD. Setting DISPLAY='' is not equivalent, but +# it also avoids the bogus "Invalid MIT-MAGIC-COOKIE-1 key" error message +# that can make the parsing of the output fail. +TESTS_ENVIRONMENT = env DISPLAY='' MPFR_QUIET=1 $(VALGRIND) # The -no-install option prevents libtool from generating wrapper scripts # for the tests. @@ -91,5 +117,6 @@ # https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00065.html # and # http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9728 +# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18662 # AM_LDFLAGS = -no-install -L$(top_builddir)/src/.libs diff -Nru mpfr4-3.1.4/tests/Makefile.in mpfr4-4.0.2/tests/Makefile.in --- mpfr4-3.1.4/tests/Makefile.in 2016-03-06 11:33:18.000000000 +0000 +++ mpfr4-4.0.2/tests/Makefile.in 2019-01-31 20:43:20.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,7 +14,7 @@ @SET_MAKE@ -# Copyright 2000-2016 Free Software Foundation, Inc. +# Copyright 2000-2019 Free Software Foundation, Inc. # This Makefile.am is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -97,14 +97,17 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -check_PROGRAMS = tversion$(EXEEXT) tinternals$(EXEEXT) tinits$(EXEEXT) \ - tisqrt$(EXEEXT) tsgn$(EXEEXT) tcheck$(EXEEXT) tisnan$(EXEEXT) \ - texceptions$(EXEEXT) tset_exp$(EXEEXT) tset$(EXEEXT) \ - mpf_compat$(EXEEXT) mpfr_compat$(EXEEXT) reuse$(EXEEXT) \ - tabs$(EXEEXT) tacos$(EXEEXT) tacosh$(EXEEXT) tadd$(EXEEXT) \ - tadd1sp$(EXEEXT) tadd_d$(EXEEXT) tadd_ui$(EXEEXT) \ - tagm$(EXEEXT) tai$(EXEEXT) tasin$(EXEEXT) tasinh$(EXEEXT) \ - tatan$(EXEEXT) tatanh$(EXEEXT) taway$(EXEEXT) \ +check_PROGRAMS = tversion$(EXEEXT) tabort_prec_max$(EXEEXT) \ + tassert$(EXEEXT) tabort_defalloc1$(EXEEXT) \ + tabort_defalloc2$(EXEEXT) talloc$(EXEEXT) tinternals$(EXEEXT) \ + tinits$(EXEEXT) tisqrt$(EXEEXT) tsgn$(EXEEXT) tcheck$(EXEEXT) \ + tisnan$(EXEEXT) texceptions$(EXEEXT) tset_exp$(EXEEXT) \ + tset$(EXEEXT) mpf_compat$(EXEEXT) mpfr_compat$(EXEEXT) \ + reuse$(EXEEXT) tabs$(EXEEXT) tacos$(EXEEXT) tacosh$(EXEEXT) \ + tadd$(EXEEXT) tadd1sp$(EXEEXT) tadd_d$(EXEEXT) \ + tadd_ui$(EXEEXT) tagm$(EXEEXT) tai$(EXEEXT) \ + talloc-cache$(EXEEXT) tasin$(EXEEXT) tasinh$(EXEEXT) \ + tatan$(EXEEXT) tatanh$(EXEEXT) taway$(EXEEXT) tbeta$(EXEEXT) \ tbuildopt$(EXEEXT) tcan_round$(EXEEXT) tcbrt$(EXEEXT) \ tcmp$(EXEEXT) tcmp2$(EXEEXT) tcmp_d$(EXEEXT) tcmp_ld$(EXEEXT) \ tcmp_ui$(EXEEXT) tcmpabs$(EXEEXT) tcomparisons$(EXEEXT) \ @@ -113,26 +116,31 @@ tcos$(EXEEXT) tcosh$(EXEEXT) tcot$(EXEEXT) tcoth$(EXEEXT) \ tcsc$(EXEEXT) tcsch$(EXEEXT) td_div$(EXEEXT) td_sub$(EXEEXT) \ tdigamma$(EXEEXT) tdim$(EXEEXT) tdiv$(EXEEXT) tdiv_d$(EXEEXT) \ - tdiv_ui$(EXEEXT) teint$(EXEEXT) teq$(EXEEXT) terf$(EXEEXT) \ - texp$(EXEEXT) texp10$(EXEEXT) texp2$(EXEEXT) texpm1$(EXEEXT) \ + tdiv_ui$(EXEEXT) teint$(EXEEXT) teq$(EXEEXT) terandom$(EXEEXT) \ + terandom_chisq$(EXEEXT) terf$(EXEEXT) texp$(EXEEXT) \ + texp10$(EXEEXT) texp2$(EXEEXT) texpm1$(EXEEXT) \ tfactorial$(EXEEXT) tfits$(EXEEXT) tfma$(EXEEXT) \ - tfmod$(EXEEXT) tfms$(EXEEXT) tfprintf$(EXEEXT) tfrac$(EXEEXT) \ - tfrexp$(EXEEXT) tgamma$(EXEEXT) tget_flt$(EXEEXT) \ - tget_d$(EXEEXT) tget_d_2exp$(EXEEXT) tget_f$(EXEEXT) \ - tget_ld_2exp$(EXEEXT) tget_set_d64$(EXEEXT) tget_sj$(EXEEXT) \ - tget_str$(EXEEXT) tget_z$(EXEEXT) tgmpop$(EXEEXT) \ - tgrandom$(EXEEXT) thyperbolic$(EXEEXT) thypot$(EXEEXT) \ - tinp_str$(EXEEXT) tj0$(EXEEXT) tj1$(EXEEXT) tjn$(EXEEXT) \ - tl2b$(EXEEXT) tlgamma$(EXEEXT) tli2$(EXEEXT) tlngamma$(EXEEXT) \ - tlog$(EXEEXT) tlog10$(EXEEXT) tlog1p$(EXEEXT) tlog2$(EXEEXT) \ + tfmma$(EXEEXT) tfmod$(EXEEXT) tfms$(EXEEXT) tfpif$(EXEEXT) \ + tfprintf$(EXEEXT) tfrac$(EXEEXT) tfrexp$(EXEEXT) \ + tgamma$(EXEEXT) tgamma_inc$(EXEEXT) tget_d$(EXEEXT) \ + tget_d_2exp$(EXEEXT) tget_f$(EXEEXT) tget_flt$(EXEEXT) \ + tget_ld_2exp$(EXEEXT) tget_q$(EXEEXT) tget_set_d64$(EXEEXT) \ + tget_sj$(EXEEXT) tget_str$(EXEEXT) tget_z$(EXEEXT) \ + tgmpop$(EXEEXT) tgrandom$(EXEEXT) thyperbolic$(EXEEXT) \ + thypot$(EXEEXT) tinp_str$(EXEEXT) tj0$(EXEEXT) tj1$(EXEEXT) \ + tjn$(EXEEXT) tl2b$(EXEEXT) tlgamma$(EXEEXT) tli2$(EXEEXT) \ + tlngamma$(EXEEXT) tlog$(EXEEXT) tlog10$(EXEEXT) \ + tlog1p$(EXEEXT) tlog2$(EXEEXT) tlog_ui$(EXEEXT) \ tmin_prec$(EXEEXT) tminmax$(EXEEXT) tmodf$(EXEEXT) \ tmul$(EXEEXT) tmul_2exp$(EXEEXT) tmul_d$(EXEEXT) \ - tmul_ui$(EXEEXT) tnext$(EXEEXT) tout_str$(EXEEXT) \ - toutimpl$(EXEEXT) tpow$(EXEEXT) tpow3$(EXEEXT) \ - tpow_all$(EXEEXT) tpow_z$(EXEEXT) tprintf$(EXEEXT) \ - trandom$(EXEEXT) trec_sqrt$(EXEEXT) tremquo$(EXEEXT) \ - trint$(EXEEXT) troot$(EXEEXT) tround_prec$(EXEEXT) \ - tsec$(EXEEXT) tsech$(EXEEXT) tset_d$(EXEEXT) tset_f$(EXEEXT) \ + tmul_ui$(EXEEXT) tnext$(EXEEXT) tnrandom$(EXEEXT) \ + tnrandom_chisq$(EXEEXT) tout_str$(EXEEXT) toutimpl$(EXEEXT) \ + tpow$(EXEEXT) tpow3$(EXEEXT) tpow_all$(EXEEXT) tpow_z$(EXEEXT) \ + tprintf$(EXEEXT) trandom$(EXEEXT) trandom_deviate$(EXEEXT) \ + trec_sqrt$(EXEEXT) tremquo$(EXEEXT) trint$(EXEEXT) \ + trndna$(EXEEXT) troot$(EXEEXT) trootn_ui$(EXEEXT) \ + tround_prec$(EXEEXT) tsec$(EXEEXT) tsech$(EXEEXT) \ + tset_d$(EXEEXT) tset_f$(EXEEXT) tset_float128$(EXEEXT) \ tset_ld$(EXEEXT) tset_q$(EXEEXT) tset_si$(EXEEXT) \ tset_sj$(EXEEXT) tset_str$(EXEEXT) tset_z$(EXEEXT) \ tset_z_exp$(EXEEXT) tsi_op$(EXEEXT) tsin$(EXEEXT) \ @@ -151,8 +159,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -172,802 +179,902 @@ mpf_compat_LDADD = $(LDADD) am__DEPENDENCIES_1 = mpf_compat_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la mpfr_compat_SOURCES = mpfr_compat.c mpfr_compat_OBJECTS = mpfr_compat.$(OBJEXT) mpfr_compat_LDADD = $(LDADD) mpfr_compat_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la reuse_SOURCES = reuse.c reuse_OBJECTS = reuse.$(OBJEXT) reuse_LDADD = $(LDADD) reuse_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +tabort_defalloc1_SOURCES = tabort_defalloc1.c +tabort_defalloc1_OBJECTS = tabort_defalloc1.$(OBJEXT) +tabort_defalloc1_LDADD = $(LDADD) +tabort_defalloc1_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +tabort_defalloc2_SOURCES = tabort_defalloc2.c +tabort_defalloc2_OBJECTS = tabort_defalloc2.$(OBJEXT) +tabort_defalloc2_LDADD = $(LDADD) +tabort_defalloc2_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +tabort_prec_max_SOURCES = tabort_prec_max.c +tabort_prec_max_OBJECTS = tabort_prec_max.$(OBJEXT) +tabort_prec_max_LDADD = $(LDADD) +tabort_prec_max_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tabs_SOURCES = tabs.c tabs_OBJECTS = tabs.$(OBJEXT) tabs_LDADD = $(LDADD) tabs_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tacos_SOURCES = tacos.c tacos_OBJECTS = tacos.$(OBJEXT) tacos_LDADD = $(LDADD) tacos_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tacosh_SOURCES = tacosh.c tacosh_OBJECTS = tacosh.$(OBJEXT) tacosh_LDADD = $(LDADD) tacosh_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tadd_SOURCES = tadd.c tadd_OBJECTS = tadd.$(OBJEXT) tadd_LDADD = $(LDADD) tadd_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tadd1sp_SOURCES = tadd1sp.c tadd1sp_OBJECTS = tadd1sp.$(OBJEXT) tadd1sp_LDADD = $(LDADD) tadd1sp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tadd_d_SOURCES = tadd_d.c tadd_d_OBJECTS = tadd_d.$(OBJEXT) tadd_d_LDADD = $(LDADD) tadd_d_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tadd_ui_SOURCES = tadd_ui.c tadd_ui_OBJECTS = tadd_ui.$(OBJEXT) tadd_ui_LDADD = $(LDADD) tadd_ui_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tagm_SOURCES = tagm.c tagm_OBJECTS = tagm.$(OBJEXT) tagm_LDADD = $(LDADD) tagm_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tai_SOURCES = tai.c tai_OBJECTS = tai.$(OBJEXT) tai_LDADD = $(LDADD) tai_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +talloc_SOURCES = talloc.c +talloc_OBJECTS = talloc.$(OBJEXT) +talloc_LDADD = $(LDADD) +talloc_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +talloc_cache_SOURCES = talloc-cache.c +talloc_cache_OBJECTS = talloc-cache.$(OBJEXT) +talloc_cache_LDADD = $(LDADD) +talloc_cache_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tasin_SOURCES = tasin.c tasin_OBJECTS = tasin.$(OBJEXT) tasin_LDADD = $(LDADD) tasin_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tasinh_SOURCES = tasinh.c tasinh_OBJECTS = tasinh.$(OBJEXT) tasinh_LDADD = $(LDADD) tasinh_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +tassert_SOURCES = tassert.c +tassert_OBJECTS = tassert.$(OBJEXT) +tassert_LDADD = $(LDADD) +tassert_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tatan_SOURCES = tatan.c tatan_OBJECTS = tatan.$(OBJEXT) tatan_LDADD = $(LDADD) tatan_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tatanh_SOURCES = tatanh.c tatanh_OBJECTS = tatanh.$(OBJEXT) tatanh_LDADD = $(LDADD) tatanh_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la taway_SOURCES = taway.c taway_OBJECTS = taway.$(OBJEXT) taway_LDADD = $(LDADD) taway_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +tbeta_SOURCES = tbeta.c +tbeta_OBJECTS = tbeta.$(OBJEXT) +tbeta_LDADD = $(LDADD) +tbeta_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tbuildopt_SOURCES = tbuildopt.c tbuildopt_OBJECTS = tbuildopt.$(OBJEXT) tbuildopt_LDADD = $(LDADD) tbuildopt_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcan_round_SOURCES = tcan_round.c tcan_round_OBJECTS = tcan_round.$(OBJEXT) tcan_round_LDADD = $(LDADD) tcan_round_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcbrt_SOURCES = tcbrt.c tcbrt_OBJECTS = tcbrt.$(OBJEXT) tcbrt_LDADD = $(LDADD) tcbrt_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcheck_SOURCES = tcheck.c tcheck_OBJECTS = tcheck.$(OBJEXT) tcheck_LDADD = $(LDADD) tcheck_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcmp_SOURCES = tcmp.c tcmp_OBJECTS = tcmp.$(OBJEXT) tcmp_LDADD = $(LDADD) tcmp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcmp2_SOURCES = tcmp2.c tcmp2_OBJECTS = tcmp2.$(OBJEXT) tcmp2_LDADD = $(LDADD) tcmp2_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcmp_d_SOURCES = tcmp_d.c tcmp_d_OBJECTS = tcmp_d.$(OBJEXT) tcmp_d_LDADD = $(LDADD) tcmp_d_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcmp_ld_SOURCES = tcmp_ld.c tcmp_ld_OBJECTS = tcmp_ld.$(OBJEXT) tcmp_ld_LDADD = $(LDADD) tcmp_ld_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcmp_ui_SOURCES = tcmp_ui.c tcmp_ui_OBJECTS = tcmp_ui.$(OBJEXT) tcmp_ui_LDADD = $(LDADD) tcmp_ui_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcmpabs_SOURCES = tcmpabs.c tcmpabs_OBJECTS = tcmpabs.$(OBJEXT) tcmpabs_LDADD = $(LDADD) tcmpabs_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcomparisons_SOURCES = tcomparisons.c tcomparisons_OBJECTS = tcomparisons.$(OBJEXT) tcomparisons_LDADD = $(LDADD) tcomparisons_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tconst_catalan_SOURCES = tconst_catalan.c tconst_catalan_OBJECTS = tconst_catalan.$(OBJEXT) tconst_catalan_LDADD = $(LDADD) tconst_catalan_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tconst_euler_SOURCES = tconst_euler.c tconst_euler_OBJECTS = tconst_euler.$(OBJEXT) tconst_euler_LDADD = $(LDADD) tconst_euler_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tconst_log2_SOURCES = tconst_log2.c tconst_log2_OBJECTS = tconst_log2.$(OBJEXT) tconst_log2_LDADD = $(LDADD) tconst_log2_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tconst_pi_SOURCES = tconst_pi.c tconst_pi_OBJECTS = tconst_pi.$(OBJEXT) tconst_pi_LDADD = $(LDADD) tconst_pi_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcopysign_SOURCES = tcopysign.c tcopysign_OBJECTS = tcopysign.$(OBJEXT) tcopysign_LDADD = $(LDADD) tcopysign_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcos_SOURCES = tcos.c tcos_OBJECTS = tcos.$(OBJEXT) tcos_LDADD = $(LDADD) tcos_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcosh_SOURCES = tcosh.c tcosh_OBJECTS = tcosh.$(OBJEXT) tcosh_LDADD = $(LDADD) tcosh_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcot_SOURCES = tcot.c tcot_OBJECTS = tcot.$(OBJEXT) tcot_LDADD = $(LDADD) tcot_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcoth_SOURCES = tcoth.c tcoth_OBJECTS = tcoth.$(OBJEXT) tcoth_LDADD = $(LDADD) tcoth_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcsc_SOURCES = tcsc.c tcsc_OBJECTS = tcsc.$(OBJEXT) tcsc_LDADD = $(LDADD) tcsc_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tcsch_SOURCES = tcsch.c tcsch_OBJECTS = tcsch.$(OBJEXT) tcsch_LDADD = $(LDADD) tcsch_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la td_div_SOURCES = td_div.c td_div_OBJECTS = td_div.$(OBJEXT) td_div_LDADD = $(LDADD) td_div_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la td_sub_SOURCES = td_sub.c td_sub_OBJECTS = td_sub.$(OBJEXT) td_sub_LDADD = $(LDADD) td_sub_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tdigamma_SOURCES = tdigamma.c tdigamma_OBJECTS = tdigamma.$(OBJEXT) tdigamma_LDADD = $(LDADD) tdigamma_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tdim_SOURCES = tdim.c tdim_OBJECTS = tdim.$(OBJEXT) tdim_LDADD = $(LDADD) tdim_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tdiv_SOURCES = tdiv.c tdiv_OBJECTS = tdiv.$(OBJEXT) tdiv_LDADD = $(LDADD) tdiv_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tdiv_d_SOURCES = tdiv_d.c tdiv_d_OBJECTS = tdiv_d.$(OBJEXT) tdiv_d_LDADD = $(LDADD) tdiv_d_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tdiv_ui_SOURCES = tdiv_ui.c tdiv_ui_OBJECTS = tdiv_ui.$(OBJEXT) tdiv_ui_LDADD = $(LDADD) tdiv_ui_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la teint_SOURCES = teint.c teint_OBJECTS = teint.$(OBJEXT) teint_LDADD = $(LDADD) teint_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la teq_SOURCES = teq.c teq_OBJECTS = teq.$(OBJEXT) teq_LDADD = $(LDADD) teq_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +terandom_SOURCES = terandom.c +terandom_OBJECTS = terandom.$(OBJEXT) +terandom_LDADD = $(LDADD) +terandom_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +terandom_chisq_SOURCES = terandom_chisq.c +terandom_chisq_OBJECTS = terandom_chisq.$(OBJEXT) +terandom_chisq_LDADD = $(LDADD) +terandom_chisq_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la terf_SOURCES = terf.c terf_OBJECTS = terf.$(OBJEXT) terf_LDADD = $(LDADD) terf_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la texceptions_SOURCES = texceptions.c texceptions_OBJECTS = texceptions.$(OBJEXT) texceptions_LDADD = $(LDADD) texceptions_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la texp_SOURCES = texp.c texp_OBJECTS = texp.$(OBJEXT) texp_LDADD = $(LDADD) texp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la texp10_SOURCES = texp10.c texp10_OBJECTS = texp10.$(OBJEXT) texp10_LDADD = $(LDADD) texp10_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la texp2_SOURCES = texp2.c texp2_OBJECTS = texp2.$(OBJEXT) texp2_LDADD = $(LDADD) texp2_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la texpm1_SOURCES = texpm1.c texpm1_OBJECTS = texpm1.$(OBJEXT) texpm1_LDADD = $(LDADD) texpm1_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tfactorial_SOURCES = tfactorial.c tfactorial_OBJECTS = tfactorial.$(OBJEXT) tfactorial_LDADD = $(LDADD) tfactorial_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tfits_SOURCES = tfits.c tfits_OBJECTS = tfits.$(OBJEXT) tfits_LDADD = $(LDADD) tfits_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tfma_SOURCES = tfma.c tfma_OBJECTS = tfma.$(OBJEXT) tfma_LDADD = $(LDADD) tfma_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +tfmma_SOURCES = tfmma.c +tfmma_OBJECTS = tfmma.$(OBJEXT) +tfmma_LDADD = $(LDADD) +tfmma_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tfmod_SOURCES = tfmod.c tfmod_OBJECTS = tfmod.$(OBJEXT) tfmod_LDADD = $(LDADD) tfmod_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tfms_SOURCES = tfms.c tfms_OBJECTS = tfms.$(OBJEXT) tfms_LDADD = $(LDADD) tfms_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +tfpif_SOURCES = tfpif.c +tfpif_OBJECTS = tfpif.$(OBJEXT) +tfpif_LDADD = $(LDADD) +tfpif_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tfprintf_SOURCES = tfprintf.c tfprintf_OBJECTS = tfprintf.$(OBJEXT) tfprintf_LDADD = $(LDADD) tfprintf_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tfrac_SOURCES = tfrac.c tfrac_OBJECTS = tfrac.$(OBJEXT) tfrac_LDADD = $(LDADD) tfrac_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tfrexp_SOURCES = tfrexp.c tfrexp_OBJECTS = tfrexp.$(OBJEXT) tfrexp_LDADD = $(LDADD) tfrexp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tgamma_SOURCES = tgamma.c tgamma_OBJECTS = tgamma.$(OBJEXT) tgamma_LDADD = $(LDADD) tgamma_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +tgamma_inc_SOURCES = tgamma_inc.c +tgamma_inc_OBJECTS = tgamma_inc.$(OBJEXT) +tgamma_inc_LDADD = $(LDADD) +tgamma_inc_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tget_d_SOURCES = tget_d.c tget_d_OBJECTS = tget_d.$(OBJEXT) tget_d_LDADD = $(LDADD) tget_d_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tget_d_2exp_SOURCES = tget_d_2exp.c tget_d_2exp_OBJECTS = tget_d_2exp.$(OBJEXT) tget_d_2exp_LDADD = $(LDADD) tget_d_2exp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tget_f_SOURCES = tget_f.c tget_f_OBJECTS = tget_f.$(OBJEXT) tget_f_LDADD = $(LDADD) tget_f_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tget_flt_SOURCES = tget_flt.c tget_flt_OBJECTS = tget_flt.$(OBJEXT) tget_flt_LDADD = $(LDADD) tget_flt_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tget_ld_2exp_SOURCES = tget_ld_2exp.c tget_ld_2exp_OBJECTS = tget_ld_2exp.$(OBJEXT) tget_ld_2exp_LDADD = $(LDADD) tget_ld_2exp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +tget_q_SOURCES = tget_q.c +tget_q_OBJECTS = tget_q.$(OBJEXT) +tget_q_LDADD = $(LDADD) +tget_q_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tget_set_d64_SOURCES = tget_set_d64.c tget_set_d64_OBJECTS = tget_set_d64.$(OBJEXT) tget_set_d64_LDADD = $(LDADD) tget_set_d64_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tget_sj_SOURCES = tget_sj.c tget_sj_OBJECTS = tget_sj.$(OBJEXT) tget_sj_LDADD = $(LDADD) tget_sj_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tget_str_SOURCES = tget_str.c tget_str_OBJECTS = tget_str.$(OBJEXT) tget_str_LDADD = $(LDADD) tget_str_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tget_z_SOURCES = tget_z.c tget_z_OBJECTS = tget_z.$(OBJEXT) tget_z_LDADD = $(LDADD) tget_z_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tgmpop_SOURCES = tgmpop.c tgmpop_OBJECTS = tgmpop.$(OBJEXT) tgmpop_LDADD = $(LDADD) tgmpop_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tgrandom_SOURCES = tgrandom.c tgrandom_OBJECTS = tgrandom.$(OBJEXT) tgrandom_LDADD = $(LDADD) tgrandom_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la thyperbolic_SOURCES = thyperbolic.c thyperbolic_OBJECTS = thyperbolic.$(OBJEXT) thyperbolic_LDADD = $(LDADD) thyperbolic_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la thypot_SOURCES = thypot.c thypot_OBJECTS = thypot.$(OBJEXT) thypot_LDADD = $(LDADD) thypot_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tinits_SOURCES = tinits.c tinits_OBJECTS = tinits.$(OBJEXT) tinits_LDADD = $(LDADD) tinits_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tinp_str_SOURCES = tinp_str.c tinp_str_OBJECTS = tinp_str.$(OBJEXT) tinp_str_LDADD = $(LDADD) tinp_str_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tinternals_SOURCES = tinternals.c tinternals_OBJECTS = tinternals.$(OBJEXT) tinternals_LDADD = $(LDADD) tinternals_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tisnan_SOURCES = tisnan.c tisnan_OBJECTS = tisnan.$(OBJEXT) tisnan_LDADD = $(LDADD) tisnan_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tisqrt_SOURCES = tisqrt.c tisqrt_OBJECTS = tisqrt.$(OBJEXT) tisqrt_LDADD = $(LDADD) tisqrt_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tj0_SOURCES = tj0.c tj0_OBJECTS = tj0.$(OBJEXT) tj0_LDADD = $(LDADD) tj0_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tj1_SOURCES = tj1.c tj1_OBJECTS = tj1.$(OBJEXT) tj1_LDADD = $(LDADD) tj1_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tjn_SOURCES = tjn.c tjn_OBJECTS = tjn.$(OBJEXT) tjn_LDADD = $(LDADD) tjn_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tl2b_SOURCES = tl2b.c tl2b_OBJECTS = tl2b.$(OBJEXT) tl2b_LDADD = $(LDADD) tl2b_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tlgamma_SOURCES = tlgamma.c tlgamma_OBJECTS = tlgamma.$(OBJEXT) tlgamma_LDADD = $(LDADD) tlgamma_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tli2_SOURCES = tli2.c tli2_OBJECTS = tli2.$(OBJEXT) tli2_LDADD = $(LDADD) tli2_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tlngamma_SOURCES = tlngamma.c tlngamma_OBJECTS = tlngamma.$(OBJEXT) tlngamma_LDADD = $(LDADD) tlngamma_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tlog_SOURCES = tlog.c tlog_OBJECTS = tlog.$(OBJEXT) tlog_LDADD = $(LDADD) tlog_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tlog10_SOURCES = tlog10.c tlog10_OBJECTS = tlog10.$(OBJEXT) tlog10_LDADD = $(LDADD) tlog10_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tlog1p_SOURCES = tlog1p.c tlog1p_OBJECTS = tlog1p.$(OBJEXT) tlog1p_LDADD = $(LDADD) tlog1p_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tlog2_SOURCES = tlog2.c tlog2_OBJECTS = tlog2.$(OBJEXT) tlog2_LDADD = $(LDADD) tlog2_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +tlog_ui_SOURCES = tlog_ui.c +tlog_ui_OBJECTS = tlog_ui.$(OBJEXT) +tlog_ui_LDADD = $(LDADD) +tlog_ui_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tmin_prec_SOURCES = tmin_prec.c tmin_prec_OBJECTS = tmin_prec.$(OBJEXT) tmin_prec_LDADD = $(LDADD) tmin_prec_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tminmax_SOURCES = tminmax.c tminmax_OBJECTS = tminmax.$(OBJEXT) tminmax_LDADD = $(LDADD) tminmax_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tmodf_SOURCES = tmodf.c tmodf_OBJECTS = tmodf.$(OBJEXT) tmodf_LDADD = $(LDADD) tmodf_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tmul_SOURCES = tmul.c tmul_OBJECTS = tmul.$(OBJEXT) tmul_LDADD = $(LDADD) tmul_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tmul_2exp_SOURCES = tmul_2exp.c tmul_2exp_OBJECTS = tmul_2exp.$(OBJEXT) tmul_2exp_LDADD = $(LDADD) tmul_2exp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tmul_d_SOURCES = tmul_d.c tmul_d_OBJECTS = tmul_d.$(OBJEXT) tmul_d_LDADD = $(LDADD) tmul_d_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tmul_ui_SOURCES = tmul_ui.c tmul_ui_OBJECTS = tmul_ui.$(OBJEXT) tmul_ui_LDADD = $(LDADD) tmul_ui_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tnext_SOURCES = tnext.c tnext_OBJECTS = tnext.$(OBJEXT) tnext_LDADD = $(LDADD) tnext_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +tnrandom_SOURCES = tnrandom.c +tnrandom_OBJECTS = tnrandom.$(OBJEXT) +tnrandom_LDADD = $(LDADD) +tnrandom_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +tnrandom_chisq_SOURCES = tnrandom_chisq.c +tnrandom_chisq_OBJECTS = tnrandom_chisq.$(OBJEXT) +tnrandom_chisq_LDADD = $(LDADD) +tnrandom_chisq_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tout_str_SOURCES = tout_str.c tout_str_OBJECTS = tout_str.$(OBJEXT) tout_str_LDADD = $(LDADD) tout_str_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la toutimpl_SOURCES = toutimpl.c toutimpl_OBJECTS = toutimpl.$(OBJEXT) toutimpl_LDADD = $(LDADD) toutimpl_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tpow_SOURCES = tpow.c tpow_OBJECTS = tpow.$(OBJEXT) tpow_LDADD = $(LDADD) tpow_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tpow3_SOURCES = tpow3.c tpow3_OBJECTS = tpow3.$(OBJEXT) tpow3_LDADD = $(LDADD) tpow3_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tpow_all_SOURCES = tpow_all.c tpow_all_OBJECTS = tpow_all.$(OBJEXT) tpow_all_LDADD = $(LDADD) tpow_all_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tpow_z_SOURCES = tpow_z.c tpow_z_OBJECTS = tpow_z.$(OBJEXT) tpow_z_LDADD = $(LDADD) tpow_z_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tprintf_SOURCES = tprintf.c tprintf_OBJECTS = tprintf.$(OBJEXT) tprintf_LDADD = $(LDADD) tprintf_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la trandom_SOURCES = trandom.c trandom_OBJECTS = trandom.$(OBJEXT) trandom_LDADD = $(LDADD) trandom_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +trandom_deviate_SOURCES = trandom_deviate.c +trandom_deviate_OBJECTS = trandom_deviate.$(OBJEXT) +trandom_deviate_LDADD = $(LDADD) +trandom_deviate_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la trec_sqrt_SOURCES = trec_sqrt.c trec_sqrt_OBJECTS = trec_sqrt.$(OBJEXT) trec_sqrt_LDADD = $(LDADD) trec_sqrt_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tremquo_SOURCES = tremquo.c tremquo_OBJECTS = tremquo.$(OBJEXT) tremquo_LDADD = $(LDADD) tremquo_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la trint_SOURCES = trint.c trint_OBJECTS = trint.$(OBJEXT) trint_LDADD = $(LDADD) trint_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +trndna_SOURCES = trndna.c +trndna_OBJECTS = trndna.$(OBJEXT) +trndna_LDADD = $(LDADD) +trndna_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la troot_SOURCES = troot.c troot_OBJECTS = troot.$(OBJEXT) troot_LDADD = $(LDADD) troot_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +trootn_ui_SOURCES = trootn_ui.c +trootn_ui_OBJECTS = trootn_ui.$(OBJEXT) +trootn_ui_LDADD = $(LDADD) +trootn_ui_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tround_prec_SOURCES = tround_prec.c tround_prec_OBJECTS = tround_prec.$(OBJEXT) tround_prec_LDADD = $(LDADD) tround_prec_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsec_SOURCES = tsec.c tsec_OBJECTS = tsec.$(OBJEXT) tsec_LDADD = $(LDADD) tsec_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsech_SOURCES = tsech.c tsech_OBJECTS = tsech.$(OBJEXT) tsech_LDADD = $(LDADD) tsech_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tset_SOURCES = tset.c tset_OBJECTS = tset.$(OBJEXT) tset_LDADD = $(LDADD) tset_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tset_d_SOURCES = tset_d.c tset_d_OBJECTS = tset_d.$(OBJEXT) tset_d_LDADD = $(LDADD) tset_d_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tset_exp_SOURCES = tset_exp.c tset_exp_OBJECTS = tset_exp.$(OBJEXT) tset_exp_LDADD = $(LDADD) tset_exp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tset_f_SOURCES = tset_f.c tset_f_OBJECTS = tset_f.$(OBJEXT) tset_f_LDADD = $(LDADD) tset_f_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la +tset_float128_SOURCES = tset_float128.c +tset_float128_OBJECTS = tset_float128.$(OBJEXT) +tset_float128_LDADD = $(LDADD) +tset_float128_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tset_ld_SOURCES = tset_ld.c tset_ld_OBJECTS = tset_ld.$(OBJEXT) tset_ld_LDADD = $(LDADD) tset_ld_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tset_q_SOURCES = tset_q.c tset_q_OBJECTS = tset_q.$(OBJEXT) tset_q_LDADD = $(LDADD) tset_q_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tset_si_SOURCES = tset_si.c tset_si_OBJECTS = tset_si.$(OBJEXT) tset_si_LDADD = $(LDADD) tset_si_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tset_sj_SOURCES = tset_sj.c tset_sj_OBJECTS = tset_sj.$(OBJEXT) tset_sj_LDADD = $(LDADD) tset_sj_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tset_str_SOURCES = tset_str.c tset_str_OBJECTS = tset_str.$(OBJEXT) tset_str_LDADD = $(LDADD) tset_str_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tset_z_SOURCES = tset_z.c tset_z_OBJECTS = tset_z.$(OBJEXT) tset_z_LDADD = $(LDADD) tset_z_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tset_z_exp_SOURCES = tset_z_exp.c tset_z_exp_OBJECTS = tset_z_exp.$(OBJEXT) tset_z_exp_LDADD = $(LDADD) tset_z_exp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsgn_SOURCES = tsgn.c tsgn_OBJECTS = tsgn.$(OBJEXT) tsgn_LDADD = $(LDADD) tsgn_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsi_op_SOURCES = tsi_op.c tsi_op_OBJECTS = tsi_op.$(OBJEXT) tsi_op_LDADD = $(LDADD) tsi_op_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsin_SOURCES = tsin.c tsin_OBJECTS = tsin.$(OBJEXT) tsin_LDADD = $(LDADD) tsin_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsin_cos_SOURCES = tsin_cos.c tsin_cos_OBJECTS = tsin_cos.$(OBJEXT) tsin_cos_LDADD = $(LDADD) tsin_cos_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsinh_SOURCES = tsinh.c tsinh_OBJECTS = tsinh.$(OBJEXT) tsinh_LDADD = $(LDADD) tsinh_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsinh_cosh_SOURCES = tsinh_cosh.c tsinh_cosh_OBJECTS = tsinh_cosh.$(OBJEXT) tsinh_cosh_LDADD = $(LDADD) tsinh_cosh_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsprintf_SOURCES = tsprintf.c tsprintf_OBJECTS = tsprintf.$(OBJEXT) tsprintf_LDADD = $(LDADD) tsprintf_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsqr_SOURCES = tsqr.c tsqr_OBJECTS = tsqr.$(OBJEXT) tsqr_LDADD = $(LDADD) tsqr_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsqrt_SOURCES = tsqrt.c tsqrt_OBJECTS = tsqrt.$(OBJEXT) tsqrt_LDADD = $(LDADD) tsqrt_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsqrt_ui_SOURCES = tsqrt_ui.c tsqrt_ui_OBJECTS = tsqrt_ui.$(OBJEXT) tsqrt_ui_LDADD = $(LDADD) tsqrt_ui_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tstckintc_SOURCES = tstckintc.c tstckintc_OBJECTS = tstckintc.$(OBJEXT) tstckintc_LDADD = $(LDADD) tstckintc_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tstdint_SOURCES = tstdint.c tstdint_OBJECTS = tstdint.$(OBJEXT) tstdint_LDADD = $(LDADD) tstdint_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tstrtofr_SOURCES = tstrtofr.c tstrtofr_OBJECTS = tstrtofr.$(OBJEXT) tstrtofr_LDADD = $(LDADD) tstrtofr_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsub_SOURCES = tsub.c tsub_OBJECTS = tsub.$(OBJEXT) tsub_LDADD = $(LDADD) tsub_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsub1sp_SOURCES = tsub1sp.c tsub1sp_OBJECTS = tsub1sp.$(OBJEXT) tsub1sp_LDADD = $(LDADD) tsub1sp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsub_d_SOURCES = tsub_d.c tsub_d_OBJECTS = tsub_d.$(OBJEXT) tsub_d_LDADD = $(LDADD) tsub_d_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsub_ui_SOURCES = tsub_ui.c tsub_ui_OBJECTS = tsub_ui.$(OBJEXT) tsub_ui_LDADD = $(LDADD) tsub_ui_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsubnormal_SOURCES = tsubnormal.c tsubnormal_OBJECTS = tsubnormal.$(OBJEXT) tsubnormal_LDADD = $(LDADD) tsubnormal_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tsum_SOURCES = tsum.c tsum_OBJECTS = tsum.$(OBJEXT) tsum_LDADD = $(LDADD) tsum_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tswap_SOURCES = tswap.c tswap_OBJECTS = tswap.$(OBJEXT) tswap_LDADD = $(LDADD) tswap_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la ttan_SOURCES = ttan.c ttan_OBJECTS = ttan.$(OBJEXT) ttan_LDADD = $(LDADD) ttan_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la ttanh_SOURCES = ttanh.c ttanh_OBJECTS = ttanh.$(OBJEXT) ttanh_LDADD = $(LDADD) ttanh_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la ttrunc_SOURCES = ttrunc.c ttrunc_OBJECTS = ttrunc.$(OBJEXT) ttrunc_LDADD = $(LDADD) ttrunc_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tui_div_SOURCES = tui_div.c tui_div_OBJECTS = tui_div.$(OBJEXT) tui_div_LDADD = $(LDADD) tui_div_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tui_pow_SOURCES = tui_pow.c tui_pow_OBJECTS = tui_pow.$(OBJEXT) tui_pow_LDADD = $(LDADD) tui_pow_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tui_sub_SOURCES = tui_sub.c tui_sub_OBJECTS = tui_sub.$(OBJEXT) tui_sub_LDADD = $(LDADD) tui_sub_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la turandom_SOURCES = turandom.c turandom_OBJECTS = turandom.$(OBJEXT) turandom_LDADD = $(LDADD) turandom_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tvalist_SOURCES = tvalist.c tvalist_OBJECTS = tvalist.$(OBJEXT) tvalist_LDADD = $(LDADD) tvalist_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tversion_SOURCES = tversion.c tversion_OBJECTS = tversion.$(OBJEXT) tversion_LDADD = $(LDADD) tversion_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la ty0_SOURCES = ty0.c ty0_OBJECTS = ty0.$(OBJEXT) ty0_LDADD = $(LDADD) ty0_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la ty1_SOURCES = ty1.c ty1_OBJECTS = ty1.$(OBJEXT) ty1_LDADD = $(LDADD) ty1_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tyn_SOURCES = tyn.c tyn_OBJECTS = tyn.$(OBJEXT) tyn_LDADD = $(LDADD) tyn_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tzeta_SOURCES = tzeta.c tzeta_OBJECTS = tzeta.$(OBJEXT) tzeta_LDADD = $(LDADD) tzeta_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la tzeta_ui_SOURCES = tzeta_ui.c tzeta_ui_OBJECTS = tzeta_ui.$(OBJEXT) tzeta_ui_LDADD = $(LDADD) tzeta_ui_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/libmpfr.la + $(am__DEPENDENCIES_1) $(top_builddir)/src/libmpfr.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -982,7 +1089,94 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/cmp_str.Plo ./$(DEPDIR)/memory.Plo \ + ./$(DEPDIR)/mpf_compat.Po ./$(DEPDIR)/mpfr_compat.Po \ + ./$(DEPDIR)/random2.Plo ./$(DEPDIR)/reuse.Po \ + ./$(DEPDIR)/rnd_mode.Plo ./$(DEPDIR)/tabort_defalloc1.Po \ + ./$(DEPDIR)/tabort_defalloc2.Po ./$(DEPDIR)/tabort_prec_max.Po \ + ./$(DEPDIR)/tabs.Po ./$(DEPDIR)/tacos.Po ./$(DEPDIR)/tacosh.Po \ + ./$(DEPDIR)/tadd.Po ./$(DEPDIR)/tadd1sp.Po \ + ./$(DEPDIR)/tadd_d.Po ./$(DEPDIR)/tadd_ui.Po \ + ./$(DEPDIR)/tagm.Po ./$(DEPDIR)/tai.Po \ + ./$(DEPDIR)/talloc-cache.Po ./$(DEPDIR)/talloc.Po \ + ./$(DEPDIR)/tasin.Po ./$(DEPDIR)/tasinh.Po \ + ./$(DEPDIR)/tassert.Po ./$(DEPDIR)/tatan.Po \ + ./$(DEPDIR)/tatanh.Po ./$(DEPDIR)/taway.Po \ + ./$(DEPDIR)/tbeta.Po ./$(DEPDIR)/tbuildopt.Po \ + ./$(DEPDIR)/tcan_round.Po ./$(DEPDIR)/tcbrt.Po \ + ./$(DEPDIR)/tcheck.Po ./$(DEPDIR)/tcmp.Po ./$(DEPDIR)/tcmp2.Po \ + ./$(DEPDIR)/tcmp_d.Po ./$(DEPDIR)/tcmp_ld.Po \ + ./$(DEPDIR)/tcmp_ui.Po ./$(DEPDIR)/tcmpabs.Po \ + ./$(DEPDIR)/tcomparisons.Po ./$(DEPDIR)/tconst_catalan.Po \ + ./$(DEPDIR)/tconst_euler.Po ./$(DEPDIR)/tconst_log2.Po \ + ./$(DEPDIR)/tconst_pi.Po ./$(DEPDIR)/tcopysign.Po \ + ./$(DEPDIR)/tcos.Po ./$(DEPDIR)/tcosh.Po ./$(DEPDIR)/tcot.Po \ + ./$(DEPDIR)/tcoth.Po ./$(DEPDIR)/tcsc.Po ./$(DEPDIR)/tcsch.Po \ + ./$(DEPDIR)/td_div.Po ./$(DEPDIR)/td_sub.Po \ + ./$(DEPDIR)/tdigamma.Po ./$(DEPDIR)/tdim.Po \ + ./$(DEPDIR)/tdiv.Po ./$(DEPDIR)/tdiv_d.Po \ + ./$(DEPDIR)/tdiv_ui.Po ./$(DEPDIR)/teint.Po ./$(DEPDIR)/teq.Po \ + ./$(DEPDIR)/terandom.Po ./$(DEPDIR)/terandom_chisq.Po \ + ./$(DEPDIR)/terf.Po ./$(DEPDIR)/tests.Plo \ + ./$(DEPDIR)/texceptions.Po ./$(DEPDIR)/texp.Po \ + ./$(DEPDIR)/texp10.Po ./$(DEPDIR)/texp2.Po \ + ./$(DEPDIR)/texpm1.Po ./$(DEPDIR)/tfactorial.Po \ + ./$(DEPDIR)/tfits.Po ./$(DEPDIR)/tfma.Po ./$(DEPDIR)/tfmma.Po \ + ./$(DEPDIR)/tfmod.Po ./$(DEPDIR)/tfms.Po ./$(DEPDIR)/tfpif.Po \ + ./$(DEPDIR)/tfprintf.Po ./$(DEPDIR)/tfrac.Po \ + ./$(DEPDIR)/tfrexp.Po ./$(DEPDIR)/tgamma.Po \ + ./$(DEPDIR)/tgamma_inc.Po ./$(DEPDIR)/tget_d.Po \ + ./$(DEPDIR)/tget_d_2exp.Po ./$(DEPDIR)/tget_f.Po \ + ./$(DEPDIR)/tget_flt.Po ./$(DEPDIR)/tget_ld_2exp.Po \ + ./$(DEPDIR)/tget_q.Po ./$(DEPDIR)/tget_set_d64.Po \ + ./$(DEPDIR)/tget_sj.Po ./$(DEPDIR)/tget_str.Po \ + ./$(DEPDIR)/tget_z.Po ./$(DEPDIR)/tgmpop.Po \ + ./$(DEPDIR)/tgrandom.Po ./$(DEPDIR)/thyperbolic.Po \ + ./$(DEPDIR)/thypot.Po ./$(DEPDIR)/tinits.Po \ + ./$(DEPDIR)/tinp_str.Po ./$(DEPDIR)/tinternals.Po \ + ./$(DEPDIR)/tisnan.Po ./$(DEPDIR)/tisqrt.Po ./$(DEPDIR)/tj0.Po \ + ./$(DEPDIR)/tj1.Po ./$(DEPDIR)/tjn.Po ./$(DEPDIR)/tl2b.Po \ + ./$(DEPDIR)/tlgamma.Po ./$(DEPDIR)/tli2.Po \ + ./$(DEPDIR)/tlngamma.Po ./$(DEPDIR)/tlog.Po \ + ./$(DEPDIR)/tlog10.Po ./$(DEPDIR)/tlog1p.Po \ + ./$(DEPDIR)/tlog2.Po ./$(DEPDIR)/tlog_ui.Po \ + ./$(DEPDIR)/tmin_prec.Po ./$(DEPDIR)/tminmax.Po \ + ./$(DEPDIR)/tmodf.Po ./$(DEPDIR)/tmul.Po \ + ./$(DEPDIR)/tmul_2exp.Po ./$(DEPDIR)/tmul_d.Po \ + ./$(DEPDIR)/tmul_ui.Po ./$(DEPDIR)/tnext.Po \ + ./$(DEPDIR)/tnrandom.Po ./$(DEPDIR)/tnrandom_chisq.Po \ + ./$(DEPDIR)/tout_str.Po ./$(DEPDIR)/toutimpl.Po \ + ./$(DEPDIR)/tpow.Po ./$(DEPDIR)/tpow3.Po \ + ./$(DEPDIR)/tpow_all.Po ./$(DEPDIR)/tpow_z.Po \ + ./$(DEPDIR)/tprintf.Po ./$(DEPDIR)/trandom.Po \ + ./$(DEPDIR)/trandom_deviate.Po ./$(DEPDIR)/trec_sqrt.Po \ + ./$(DEPDIR)/tremquo.Po ./$(DEPDIR)/trint.Po \ + ./$(DEPDIR)/trndna.Po ./$(DEPDIR)/troot.Po \ + ./$(DEPDIR)/trootn_ui.Po ./$(DEPDIR)/tround_prec.Po \ + ./$(DEPDIR)/tsec.Po ./$(DEPDIR)/tsech.Po ./$(DEPDIR)/tset.Po \ + ./$(DEPDIR)/tset_d.Po ./$(DEPDIR)/tset_exp.Po \ + ./$(DEPDIR)/tset_f.Po ./$(DEPDIR)/tset_float128.Po \ + ./$(DEPDIR)/tset_ld.Po ./$(DEPDIR)/tset_q.Po \ + ./$(DEPDIR)/tset_si.Po ./$(DEPDIR)/tset_sj.Po \ + ./$(DEPDIR)/tset_str.Po ./$(DEPDIR)/tset_z.Po \ + ./$(DEPDIR)/tset_z_exp.Po ./$(DEPDIR)/tsgn.Po \ + ./$(DEPDIR)/tsi_op.Po ./$(DEPDIR)/tsin.Po \ + ./$(DEPDIR)/tsin_cos.Po ./$(DEPDIR)/tsinh.Po \ + ./$(DEPDIR)/tsinh_cosh.Po ./$(DEPDIR)/tsprintf.Po \ + ./$(DEPDIR)/tsqr.Po ./$(DEPDIR)/tsqrt.Po \ + ./$(DEPDIR)/tsqrt_ui.Po ./$(DEPDIR)/tstckintc.Po \ + ./$(DEPDIR)/tstdint.Po ./$(DEPDIR)/tstrtofr.Po \ + ./$(DEPDIR)/tsub.Po ./$(DEPDIR)/tsub1sp.Po \ + ./$(DEPDIR)/tsub_d.Po ./$(DEPDIR)/tsub_ui.Po \ + ./$(DEPDIR)/tsubnormal.Po ./$(DEPDIR)/tsum.Po \ + ./$(DEPDIR)/tswap.Po ./$(DEPDIR)/ttan.Po ./$(DEPDIR)/ttanh.Po \ + ./$(DEPDIR)/ttrunc.Po ./$(DEPDIR)/tui_div.Po \ + ./$(DEPDIR)/tui_pow.Po ./$(DEPDIR)/tui_sub.Po \ + ./$(DEPDIR)/turandom.Po ./$(DEPDIR)/tvalist.Po \ + ./$(DEPDIR)/tversion.Po ./$(DEPDIR)/ty0.Po ./$(DEPDIR)/ty1.Po \ + ./$(DEPDIR)/tyn.Po ./$(DEPDIR)/tzeta.Po \ + ./$(DEPDIR)/tzeta_ui.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -1003,52 +1197,61 @@ am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libfrtests_la_SOURCES) mpf_compat.c mpfr_compat.c reuse.c \ - tabs.c tacos.c tacosh.c tadd.c tadd1sp.c tadd_d.c tadd_ui.c \ - tagm.c tai.c tasin.c tasinh.c tatan.c tatanh.c taway.c \ + tabort_defalloc1.c tabort_defalloc2.c tabort_prec_max.c tabs.c \ + tacos.c tacosh.c tadd.c tadd1sp.c tadd_d.c tadd_ui.c tagm.c \ + tai.c talloc.c talloc-cache.c tasin.c tasinh.c tassert.c \ + tatan.c tatanh.c taway.c tbeta.c tbuildopt.c tcan_round.c \ + tcbrt.c tcheck.c tcmp.c tcmp2.c tcmp_d.c tcmp_ld.c tcmp_ui.c \ + tcmpabs.c tcomparisons.c tconst_catalan.c tconst_euler.c \ + tconst_log2.c tconst_pi.c tcopysign.c tcos.c tcosh.c tcot.c \ + tcoth.c tcsc.c tcsch.c td_div.c td_sub.c tdigamma.c tdim.c \ + tdiv.c tdiv_d.c tdiv_ui.c teint.c teq.c terandom.c \ + terandom_chisq.c terf.c texceptions.c texp.c texp10.c texp2.c \ + texpm1.c tfactorial.c tfits.c tfma.c tfmma.c tfmod.c tfms.c \ + tfpif.c tfprintf.c tfrac.c tfrexp.c tgamma.c tgamma_inc.c \ + tget_d.c tget_d_2exp.c tget_f.c tget_flt.c tget_ld_2exp.c \ + tget_q.c tget_set_d64.c tget_sj.c tget_str.c tget_z.c tgmpop.c \ + tgrandom.c thyperbolic.c thypot.c tinits.c tinp_str.c \ + tinternals.c tisnan.c tisqrt.c tj0.c tj1.c tjn.c tl2b.c \ + tlgamma.c tli2.c tlngamma.c tlog.c tlog10.c tlog1p.c tlog2.c \ + tlog_ui.c tmin_prec.c tminmax.c tmodf.c tmul.c tmul_2exp.c \ + tmul_d.c tmul_ui.c tnext.c tnrandom.c tnrandom_chisq.c \ + tout_str.c toutimpl.c tpow.c tpow3.c tpow_all.c tpow_z.c \ + tprintf.c trandom.c trandom_deviate.c trec_sqrt.c tremquo.c \ + trint.c trndna.c troot.c trootn_ui.c tround_prec.c tsec.c \ + tsech.c tset.c tset_d.c tset_exp.c tset_f.c tset_float128.c \ + tset_ld.c tset_q.c tset_si.c tset_sj.c tset_str.c tset_z.c \ + tset_z_exp.c tsgn.c tsi_op.c tsin.c tsin_cos.c tsinh.c \ + tsinh_cosh.c tsprintf.c tsqr.c tsqrt.c tsqrt_ui.c tstckintc.c \ + tstdint.c tstrtofr.c tsub.c tsub1sp.c tsub_d.c tsub_ui.c \ + tsubnormal.c tsum.c tswap.c ttan.c ttanh.c ttrunc.c tui_div.c \ + tui_pow.c tui_sub.c turandom.c tvalist.c tversion.c ty0.c \ + ty1.c tyn.c tzeta.c tzeta_ui.c +DIST_SOURCES = $(libfrtests_la_SOURCES) mpf_compat.c mpfr_compat.c \ + reuse.c tabort_defalloc1.c tabort_defalloc2.c \ + tabort_prec_max.c tabs.c tacos.c tacosh.c tadd.c tadd1sp.c \ + tadd_d.c tadd_ui.c tagm.c tai.c talloc.c talloc-cache.c \ + tasin.c tasinh.c tassert.c tatan.c tatanh.c taway.c tbeta.c \ tbuildopt.c tcan_round.c tcbrt.c tcheck.c tcmp.c tcmp2.c \ tcmp_d.c tcmp_ld.c tcmp_ui.c tcmpabs.c tcomparisons.c \ tconst_catalan.c tconst_euler.c tconst_log2.c tconst_pi.c \ tcopysign.c tcos.c tcosh.c tcot.c tcoth.c tcsc.c tcsch.c \ td_div.c td_sub.c tdigamma.c tdim.c tdiv.c tdiv_d.c tdiv_ui.c \ - teint.c teq.c terf.c texceptions.c texp.c texp10.c texp2.c \ - texpm1.c tfactorial.c tfits.c tfma.c tfmod.c tfms.c tfprintf.c \ - tfrac.c tfrexp.c tgamma.c tget_d.c tget_d_2exp.c tget_f.c \ - tget_flt.c tget_ld_2exp.c tget_set_d64.c tget_sj.c tget_str.c \ - tget_z.c tgmpop.c tgrandom.c thyperbolic.c thypot.c tinits.c \ - tinp_str.c tinternals.c tisnan.c tisqrt.c tj0.c tj1.c tjn.c \ - tl2b.c tlgamma.c tli2.c tlngamma.c tlog.c tlog10.c tlog1p.c \ - tlog2.c tmin_prec.c tminmax.c tmodf.c tmul.c tmul_2exp.c \ - tmul_d.c tmul_ui.c tnext.c tout_str.c toutimpl.c tpow.c \ - tpow3.c tpow_all.c tpow_z.c tprintf.c trandom.c trec_sqrt.c \ - tremquo.c trint.c troot.c tround_prec.c tsec.c tsech.c tset.c \ - tset_d.c tset_exp.c tset_f.c tset_ld.c tset_q.c tset_si.c \ - tset_sj.c tset_str.c tset_z.c tset_z_exp.c tsgn.c tsi_op.c \ - tsin.c tsin_cos.c tsinh.c tsinh_cosh.c tsprintf.c tsqr.c \ - tsqrt.c tsqrt_ui.c tstckintc.c tstdint.c tstrtofr.c tsub.c \ - tsub1sp.c tsub_d.c tsub_ui.c tsubnormal.c tsum.c tswap.c \ - ttan.c ttanh.c ttrunc.c tui_div.c tui_pow.c tui_sub.c \ - turandom.c tvalist.c tversion.c ty0.c ty1.c tyn.c tzeta.c \ - tzeta_ui.c -DIST_SOURCES = $(libfrtests_la_SOURCES) mpf_compat.c mpfr_compat.c \ - reuse.c tabs.c tacos.c tacosh.c tadd.c tadd1sp.c tadd_d.c \ - tadd_ui.c tagm.c tai.c tasin.c tasinh.c tatan.c tatanh.c \ - taway.c tbuildopt.c tcan_round.c tcbrt.c tcheck.c tcmp.c \ - tcmp2.c tcmp_d.c tcmp_ld.c tcmp_ui.c tcmpabs.c tcomparisons.c \ - tconst_catalan.c tconst_euler.c tconst_log2.c tconst_pi.c \ - tcopysign.c tcos.c tcosh.c tcot.c tcoth.c tcsc.c tcsch.c \ - td_div.c td_sub.c tdigamma.c tdim.c tdiv.c tdiv_d.c tdiv_ui.c \ - teint.c teq.c terf.c texceptions.c texp.c texp10.c texp2.c \ - texpm1.c tfactorial.c tfits.c tfma.c tfmod.c tfms.c tfprintf.c \ - tfrac.c tfrexp.c tgamma.c tget_d.c tget_d_2exp.c tget_f.c \ - tget_flt.c tget_ld_2exp.c tget_set_d64.c tget_sj.c tget_str.c \ - tget_z.c tgmpop.c tgrandom.c thyperbolic.c thypot.c tinits.c \ - tinp_str.c tinternals.c tisnan.c tisqrt.c tj0.c tj1.c tjn.c \ - tl2b.c tlgamma.c tli2.c tlngamma.c tlog.c tlog10.c tlog1p.c \ - tlog2.c tmin_prec.c tminmax.c tmodf.c tmul.c tmul_2exp.c \ - tmul_d.c tmul_ui.c tnext.c tout_str.c toutimpl.c tpow.c \ - tpow3.c tpow_all.c tpow_z.c tprintf.c trandom.c trec_sqrt.c \ - tremquo.c trint.c troot.c tround_prec.c tsec.c tsech.c tset.c \ - tset_d.c tset_exp.c tset_f.c tset_ld.c tset_q.c tset_si.c \ + teint.c teq.c terandom.c terandom_chisq.c terf.c texceptions.c \ + texp.c texp10.c texp2.c texpm1.c tfactorial.c tfits.c tfma.c \ + tfmma.c tfmod.c tfms.c tfpif.c tfprintf.c tfrac.c tfrexp.c \ + tgamma.c tgamma_inc.c tget_d.c tget_d_2exp.c tget_f.c \ + tget_flt.c tget_ld_2exp.c tget_q.c tget_set_d64.c tget_sj.c \ + tget_str.c tget_z.c tgmpop.c tgrandom.c thyperbolic.c thypot.c \ + tinits.c tinp_str.c tinternals.c tisnan.c tisqrt.c tj0.c tj1.c \ + tjn.c tl2b.c tlgamma.c tli2.c tlngamma.c tlog.c tlog10.c \ + tlog1p.c tlog2.c tlog_ui.c tmin_prec.c tminmax.c tmodf.c \ + tmul.c tmul_2exp.c tmul_d.c tmul_ui.c tnext.c tnrandom.c \ + tnrandom_chisq.c tout_str.c toutimpl.c tpow.c tpow3.c \ + tpow_all.c tpow_z.c tprintf.c trandom.c trandom_deviate.c \ + trec_sqrt.c tremquo.c trint.c trndna.c troot.c trootn_ui.c \ + tround_prec.c tsec.c tsech.c tset.c tset_d.c tset_exp.c \ + tset_f.c tset_float128.c tset_ld.c tset_q.c tset_si.c \ tset_sj.c tset_str.c tset_z.c tset_z_exp.c tsgn.c tsi_op.c \ tsin.c tsin_cos.c tsinh.c tsinh_cosh.c tsprintf.c tsqr.c \ tsqrt.c tsqrt_ui.c tstckintc.c tstdint.c tstrtofr.c tsub.c \ @@ -1337,6 +1540,7 @@ MKDIR_P = @MKDIR_P@ MPFR_LDFLAGS = @MPFR_LDFLAGS@ MPFR_LIBM = @MPFR_LIBM@ +MPFR_LIBQUADMATH = @MPFR_LIBQUADMATH@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -1351,6 +1555,9 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -1370,6 +1577,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -1414,8 +1622,11 @@ AUTOMAKE_OPTIONS = 1.6 gnu AM_CPPFLAGS = -DSRCDIR='"$(srcdir)"' -I$(top_srcdir)/src \ -I$(top_builddir)/src -EXTRA_DIST = tgeneric.c tgeneric_ui.c mpf_compat.h inp_str.data tmul.dat -LDADD = libfrtests.la $(MPFR_LIBM) $(top_builddir)/src/libmpfr.la +EXTRA_DIST = tgeneric.c tgeneric_ui.c mpf_compat.h inp_str.dat tmul.dat \ + tfpif_r1.dat tfpif_r2.dat + +CLEANFILES = tfpif_rw.dat tfprintf_out.txt tout_str_out.txt toutimpl_out.txt tprintf_out.txt +LDADD = libfrtests.la $(MPFR_LIBM) $(MPFR_LIBQUADMATH) $(top_builddir)/src/libmpfr.la # LOADLIBES (documented in the "GNU make" manual and equivalent to LDLIBS) # enables to compile a program foo.c in the test directory by simply doing @@ -1430,7 +1641,21 @@ check_LTLIBRARIES = libfrtests.la libfrtests_la_SOURCES = mpfr-test.h memory.c rnd_mode.c tests.c cmp_str.c random2.c TESTS = $(check_PROGRAMS) -TESTS_ENVIRONMENT = MPFR_QUIET=1 $(VALGRIND) + +# Set DISPLAY='' as it is not needed and it can yield error messages when +# running the tests with LOG_COMPILER=wine (for builds with MinGW). See: +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914822 +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914949 +# $(VALGRIND) is still there to be able to use a wrapper such as valgrind +# in case old Automake. With Automake 1.13+, where a parallel test harness +# is generated, use LOG_COMPILER instead. For additional information, see: +# https://www.gnu.org/software/automake/manual/automake.html#Parallel-Test-Harness +# +# Note: We do not use "env -u DISPLAY" as the -u option is a GNU extension +# and not supported by NetBSD. Setting DISPLAY='' is not equivalent, but +# it also avoids the bogus "Invalid MIT-MAGIC-COOKIE-1 key" error message +# that can make the parsing of the output fail. +TESTS_ENVIRONMENT = env DISPLAY='' MPFR_QUIET=1 $(VALGRIND) # The -no-install option prevents libtool from generating wrapper scripts # for the tests. @@ -1451,6 +1676,7 @@ # https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00065.html # and # http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9728 +# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18662 # AM_LDFLAGS = -no-install -L$(top_builddir)/src/.libs all: all-am @@ -1474,8 +1700,8 @@ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -1487,6 +1713,15 @@ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + clean-checkLTLIBRARIES: -test -z "$(check_LTLIBRARIES)" || rm -f $(check_LTLIBRARIES) @list='$(check_LTLIBRARIES)'; \ @@ -1501,15 +1736,6 @@ libfrtests.la: $(libfrtests_la_OBJECTS) $(libfrtests_la_DEPENDENCIES) $(EXTRA_libfrtests_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libfrtests_la_OBJECTS) $(libfrtests_la_LIBADD) $(LIBS) -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - mpf_compat$(EXEEXT): $(mpf_compat_OBJECTS) $(mpf_compat_DEPENDENCIES) $(EXTRA_mpf_compat_DEPENDENCIES) @rm -f mpf_compat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mpf_compat_OBJECTS) $(mpf_compat_LDADD) $(LIBS) @@ -1522,6 +1748,18 @@ @rm -f reuse$(EXEEXT) $(AM_V_CCLD)$(LINK) $(reuse_OBJECTS) $(reuse_LDADD) $(LIBS) +tabort_defalloc1$(EXEEXT): $(tabort_defalloc1_OBJECTS) $(tabort_defalloc1_DEPENDENCIES) $(EXTRA_tabort_defalloc1_DEPENDENCIES) + @rm -f tabort_defalloc1$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tabort_defalloc1_OBJECTS) $(tabort_defalloc1_LDADD) $(LIBS) + +tabort_defalloc2$(EXEEXT): $(tabort_defalloc2_OBJECTS) $(tabort_defalloc2_DEPENDENCIES) $(EXTRA_tabort_defalloc2_DEPENDENCIES) + @rm -f tabort_defalloc2$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tabort_defalloc2_OBJECTS) $(tabort_defalloc2_LDADD) $(LIBS) + +tabort_prec_max$(EXEEXT): $(tabort_prec_max_OBJECTS) $(tabort_prec_max_DEPENDENCIES) $(EXTRA_tabort_prec_max_DEPENDENCIES) + @rm -f tabort_prec_max$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tabort_prec_max_OBJECTS) $(tabort_prec_max_LDADD) $(LIBS) + tabs$(EXEEXT): $(tabs_OBJECTS) $(tabs_DEPENDENCIES) $(EXTRA_tabs_DEPENDENCIES) @rm -f tabs$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tabs_OBJECTS) $(tabs_LDADD) $(LIBS) @@ -1558,6 +1796,14 @@ @rm -f tai$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tai_OBJECTS) $(tai_LDADD) $(LIBS) +talloc$(EXEEXT): $(talloc_OBJECTS) $(talloc_DEPENDENCIES) $(EXTRA_talloc_DEPENDENCIES) + @rm -f talloc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(talloc_OBJECTS) $(talloc_LDADD) $(LIBS) + +talloc-cache$(EXEEXT): $(talloc_cache_OBJECTS) $(talloc_cache_DEPENDENCIES) $(EXTRA_talloc_cache_DEPENDENCIES) + @rm -f talloc-cache$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(talloc_cache_OBJECTS) $(talloc_cache_LDADD) $(LIBS) + tasin$(EXEEXT): $(tasin_OBJECTS) $(tasin_DEPENDENCIES) $(EXTRA_tasin_DEPENDENCIES) @rm -f tasin$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tasin_OBJECTS) $(tasin_LDADD) $(LIBS) @@ -1566,6 +1812,10 @@ @rm -f tasinh$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tasinh_OBJECTS) $(tasinh_LDADD) $(LIBS) +tassert$(EXEEXT): $(tassert_OBJECTS) $(tassert_DEPENDENCIES) $(EXTRA_tassert_DEPENDENCIES) + @rm -f tassert$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tassert_OBJECTS) $(tassert_LDADD) $(LIBS) + tatan$(EXEEXT): $(tatan_OBJECTS) $(tatan_DEPENDENCIES) $(EXTRA_tatan_DEPENDENCIES) @rm -f tatan$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tatan_OBJECTS) $(tatan_LDADD) $(LIBS) @@ -1578,6 +1828,10 @@ @rm -f taway$(EXEEXT) $(AM_V_CCLD)$(LINK) $(taway_OBJECTS) $(taway_LDADD) $(LIBS) +tbeta$(EXEEXT): $(tbeta_OBJECTS) $(tbeta_DEPENDENCIES) $(EXTRA_tbeta_DEPENDENCIES) + @rm -f tbeta$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tbeta_OBJECTS) $(tbeta_LDADD) $(LIBS) + tbuildopt$(EXEEXT): $(tbuildopt_OBJECTS) $(tbuildopt_DEPENDENCIES) $(EXTRA_tbuildopt_DEPENDENCIES) @rm -f tbuildopt$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tbuildopt_OBJECTS) $(tbuildopt_LDADD) $(LIBS) @@ -1702,6 +1956,14 @@ @rm -f teq$(EXEEXT) $(AM_V_CCLD)$(LINK) $(teq_OBJECTS) $(teq_LDADD) $(LIBS) +terandom$(EXEEXT): $(terandom_OBJECTS) $(terandom_DEPENDENCIES) $(EXTRA_terandom_DEPENDENCIES) + @rm -f terandom$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(terandom_OBJECTS) $(terandom_LDADD) $(LIBS) + +terandom_chisq$(EXEEXT): $(terandom_chisq_OBJECTS) $(terandom_chisq_DEPENDENCIES) $(EXTRA_terandom_chisq_DEPENDENCIES) + @rm -f terandom_chisq$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(terandom_chisq_OBJECTS) $(terandom_chisq_LDADD) $(LIBS) + terf$(EXEEXT): $(terf_OBJECTS) $(terf_DEPENDENCIES) $(EXTRA_terf_DEPENDENCIES) @rm -f terf$(EXEEXT) $(AM_V_CCLD)$(LINK) $(terf_OBJECTS) $(terf_LDADD) $(LIBS) @@ -1738,6 +2000,10 @@ @rm -f tfma$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tfma_OBJECTS) $(tfma_LDADD) $(LIBS) +tfmma$(EXEEXT): $(tfmma_OBJECTS) $(tfmma_DEPENDENCIES) $(EXTRA_tfmma_DEPENDENCIES) + @rm -f tfmma$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tfmma_OBJECTS) $(tfmma_LDADD) $(LIBS) + tfmod$(EXEEXT): $(tfmod_OBJECTS) $(tfmod_DEPENDENCIES) $(EXTRA_tfmod_DEPENDENCIES) @rm -f tfmod$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tfmod_OBJECTS) $(tfmod_LDADD) $(LIBS) @@ -1746,6 +2012,10 @@ @rm -f tfms$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tfms_OBJECTS) $(tfms_LDADD) $(LIBS) +tfpif$(EXEEXT): $(tfpif_OBJECTS) $(tfpif_DEPENDENCIES) $(EXTRA_tfpif_DEPENDENCIES) + @rm -f tfpif$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tfpif_OBJECTS) $(tfpif_LDADD) $(LIBS) + tfprintf$(EXEEXT): $(tfprintf_OBJECTS) $(tfprintf_DEPENDENCIES) $(EXTRA_tfprintf_DEPENDENCIES) @rm -f tfprintf$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tfprintf_OBJECTS) $(tfprintf_LDADD) $(LIBS) @@ -1762,6 +2032,10 @@ @rm -f tgamma$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tgamma_OBJECTS) $(tgamma_LDADD) $(LIBS) +tgamma_inc$(EXEEXT): $(tgamma_inc_OBJECTS) $(tgamma_inc_DEPENDENCIES) $(EXTRA_tgamma_inc_DEPENDENCIES) + @rm -f tgamma_inc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tgamma_inc_OBJECTS) $(tgamma_inc_LDADD) $(LIBS) + tget_d$(EXEEXT): $(tget_d_OBJECTS) $(tget_d_DEPENDENCIES) $(EXTRA_tget_d_DEPENDENCIES) @rm -f tget_d$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tget_d_OBJECTS) $(tget_d_LDADD) $(LIBS) @@ -1782,6 +2056,10 @@ @rm -f tget_ld_2exp$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tget_ld_2exp_OBJECTS) $(tget_ld_2exp_LDADD) $(LIBS) +tget_q$(EXEEXT): $(tget_q_OBJECTS) $(tget_q_DEPENDENCIES) $(EXTRA_tget_q_DEPENDENCIES) + @rm -f tget_q$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tget_q_OBJECTS) $(tget_q_LDADD) $(LIBS) + tget_set_d64$(EXEEXT): $(tget_set_d64_OBJECTS) $(tget_set_d64_DEPENDENCIES) $(EXTRA_tget_set_d64_DEPENDENCIES) @rm -f tget_set_d64$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tget_set_d64_OBJECTS) $(tget_set_d64_LDADD) $(LIBS) @@ -1878,6 +2156,10 @@ @rm -f tlog2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tlog2_OBJECTS) $(tlog2_LDADD) $(LIBS) +tlog_ui$(EXEEXT): $(tlog_ui_OBJECTS) $(tlog_ui_DEPENDENCIES) $(EXTRA_tlog_ui_DEPENDENCIES) + @rm -f tlog_ui$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tlog_ui_OBJECTS) $(tlog_ui_LDADD) $(LIBS) + tmin_prec$(EXEEXT): $(tmin_prec_OBJECTS) $(tmin_prec_DEPENDENCIES) $(EXTRA_tmin_prec_DEPENDENCIES) @rm -f tmin_prec$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tmin_prec_OBJECTS) $(tmin_prec_LDADD) $(LIBS) @@ -1910,6 +2192,14 @@ @rm -f tnext$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tnext_OBJECTS) $(tnext_LDADD) $(LIBS) +tnrandom$(EXEEXT): $(tnrandom_OBJECTS) $(tnrandom_DEPENDENCIES) $(EXTRA_tnrandom_DEPENDENCIES) + @rm -f tnrandom$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tnrandom_OBJECTS) $(tnrandom_LDADD) $(LIBS) + +tnrandom_chisq$(EXEEXT): $(tnrandom_chisq_OBJECTS) $(tnrandom_chisq_DEPENDENCIES) $(EXTRA_tnrandom_chisq_DEPENDENCIES) + @rm -f tnrandom_chisq$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tnrandom_chisq_OBJECTS) $(tnrandom_chisq_LDADD) $(LIBS) + tout_str$(EXEEXT): $(tout_str_OBJECTS) $(tout_str_DEPENDENCIES) $(EXTRA_tout_str_DEPENDENCIES) @rm -f tout_str$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tout_str_OBJECTS) $(tout_str_LDADD) $(LIBS) @@ -1942,6 +2232,10 @@ @rm -f trandom$(EXEEXT) $(AM_V_CCLD)$(LINK) $(trandom_OBJECTS) $(trandom_LDADD) $(LIBS) +trandom_deviate$(EXEEXT): $(trandom_deviate_OBJECTS) $(trandom_deviate_DEPENDENCIES) $(EXTRA_trandom_deviate_DEPENDENCIES) + @rm -f trandom_deviate$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(trandom_deviate_OBJECTS) $(trandom_deviate_LDADD) $(LIBS) + trec_sqrt$(EXEEXT): $(trec_sqrt_OBJECTS) $(trec_sqrt_DEPENDENCIES) $(EXTRA_trec_sqrt_DEPENDENCIES) @rm -f trec_sqrt$(EXEEXT) $(AM_V_CCLD)$(LINK) $(trec_sqrt_OBJECTS) $(trec_sqrt_LDADD) $(LIBS) @@ -1954,10 +2248,18 @@ @rm -f trint$(EXEEXT) $(AM_V_CCLD)$(LINK) $(trint_OBJECTS) $(trint_LDADD) $(LIBS) +trndna$(EXEEXT): $(trndna_OBJECTS) $(trndna_DEPENDENCIES) $(EXTRA_trndna_DEPENDENCIES) + @rm -f trndna$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(trndna_OBJECTS) $(trndna_LDADD) $(LIBS) + troot$(EXEEXT): $(troot_OBJECTS) $(troot_DEPENDENCIES) $(EXTRA_troot_DEPENDENCIES) @rm -f troot$(EXEEXT) $(AM_V_CCLD)$(LINK) $(troot_OBJECTS) $(troot_LDADD) $(LIBS) +trootn_ui$(EXEEXT): $(trootn_ui_OBJECTS) $(trootn_ui_DEPENDENCIES) $(EXTRA_trootn_ui_DEPENDENCIES) + @rm -f trootn_ui$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(trootn_ui_OBJECTS) $(trootn_ui_LDADD) $(LIBS) + tround_prec$(EXEEXT): $(tround_prec_OBJECTS) $(tround_prec_DEPENDENCIES) $(EXTRA_tround_prec_DEPENDENCIES) @rm -f tround_prec$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tround_prec_OBJECTS) $(tround_prec_LDADD) $(LIBS) @@ -1986,6 +2288,10 @@ @rm -f tset_f$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tset_f_OBJECTS) $(tset_f_LDADD) $(LIBS) +tset_float128$(EXEEXT): $(tset_float128_OBJECTS) $(tset_float128_DEPENDENCIES) $(EXTRA_tset_float128_DEPENDENCIES) + @rm -f tset_float128$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tset_float128_OBJECTS) $(tset_float128_LDADD) $(LIBS) + tset_ld$(EXEEXT): $(tset_ld_OBJECTS) $(tset_ld_DEPENDENCIES) $(EXTRA_tset_ld_DEPENDENCIES) @rm -f tset_ld$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tset_ld_OBJECTS) $(tset_ld_LDADD) $(LIBS) @@ -2156,171 +2462,197 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_str.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpf_compat.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpfr_compat.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/random2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reuse.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rnd_mode.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tabs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tacos.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tacosh.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tadd.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tadd1sp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tadd_d.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tadd_ui.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tagm.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tai.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tasin.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tasinh.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tatan.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tatanh.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/taway.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tbuildopt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcan_round.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcbrt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcheck.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmp2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmp_d.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmp_ld.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmp_ui.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmpabs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcomparisons.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tconst_catalan.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tconst_euler.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tconst_log2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tconst_pi.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcopysign.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcos.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcosh.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcot.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcoth.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcsc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcsch.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/td_div.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/td_sub.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdigamma.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdim.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdiv.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdiv_d.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdiv_ui.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/teint.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/teq.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terf.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tests.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texceptions.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texp10.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texp2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texpm1.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfactorial.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfits.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfma.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfmod.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfms.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfprintf.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfrac.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfrexp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgamma.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_d.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_d_2exp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_f.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_flt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_ld_2exp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_set_d64.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_sj.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_str.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_z.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgmpop.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgrandom.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thyperbolic.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thypot.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tinits.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tinp_str.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tinternals.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tisnan.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tisqrt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tj0.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tj1.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tjn.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tl2b.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlgamma.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tli2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlngamma.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlog.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlog10.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlog1p.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlog2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmin_prec.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tminmax.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmodf.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmul.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmul_2exp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmul_d.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmul_ui.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnext.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tout_str.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/toutimpl.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tpow.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tpow3.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tpow_all.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tpow_z.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tprintf.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trandom.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trec_sqrt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tremquo.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trint.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/troot.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tround_prec.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsec.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsech.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_d.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_exp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_f.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_ld.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_q.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_si.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_sj.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_str.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_z.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_z_exp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsgn.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsi_op.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsin.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsin_cos.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsinh.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsinh_cosh.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsprintf.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsqr.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsqrt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsqrt_ui.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tstckintc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tstdint.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tstrtofr.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsub.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsub1sp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsub_d.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsub_ui.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsubnormal.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsum.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tswap.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttan.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttanh.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttrunc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tui_div.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tui_pow.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tui_sub.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/turandom.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tvalist.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tversion.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ty0.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ty1.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tyn.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tzeta.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tzeta_ui.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_str.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpf_compat.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpfr_compat.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/random2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reuse.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rnd_mode.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tabort_defalloc1.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tabort_defalloc2.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tabort_prec_max.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tabs.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tacos.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tacosh.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tadd.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tadd1sp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tadd_d.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tadd_ui.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tagm.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tai.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/talloc-cache.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/talloc.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tasin.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tasinh.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tassert.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tatan.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tatanh.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/taway.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tbeta.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tbuildopt.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcan_round.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcbrt.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcheck.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmp2.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmp_d.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmp_ld.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmp_ui.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmpabs.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcomparisons.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tconst_catalan.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tconst_euler.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tconst_log2.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tconst_pi.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcopysign.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcos.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcosh.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcot.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcoth.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcsc.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcsch.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/td_div.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/td_sub.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdigamma.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdim.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdiv.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdiv_d.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdiv_ui.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/teint.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/teq.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terandom.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terandom_chisq.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terf.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tests.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texceptions.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texp10.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texp2.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texpm1.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfactorial.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfits.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfma.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfmma.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfmod.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfms.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfpif.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfprintf.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfrac.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfrexp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgamma.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgamma_inc.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_d.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_d_2exp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_f.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_flt.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_ld_2exp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_q.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_set_d64.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_sj.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_str.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_z.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgmpop.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgrandom.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thyperbolic.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thypot.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tinits.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tinp_str.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tinternals.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tisnan.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tisqrt.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tj0.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tj1.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tjn.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tl2b.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlgamma.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tli2.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlngamma.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlog.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlog10.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlog1p.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlog2.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlog_ui.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmin_prec.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tminmax.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmodf.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmul.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmul_2exp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmul_d.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmul_ui.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnext.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnrandom.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnrandom_chisq.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tout_str.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/toutimpl.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tpow.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tpow3.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tpow_all.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tpow_z.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tprintf.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trandom.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trandom_deviate.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trec_sqrt.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tremquo.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trint.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trndna.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/troot.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trootn_ui.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tround_prec.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsec.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsech.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_d.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_exp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_f.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_float128.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_ld.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_q.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_si.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_sj.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_str.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_z.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_z_exp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsgn.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsi_op.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsin.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsin_cos.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsinh.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsinh_cosh.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsprintf.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsqr.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsqrt.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsqrt_ui.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tstckintc.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tstdint.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tstrtofr.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsub.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsub1sp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsub_d.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsub_ui.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsubnormal.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsum.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tswap.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttan.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttanh.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttrunc.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tui_div.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tui_pow.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tui_sub.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/turandom.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tvalist.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tversion.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ty0.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ty1.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tyn.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tzeta.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tzeta_ui.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -2521,7 +2853,7 @@ fi; \ $$success || exit 1 -check-TESTS: +check-TESTS: $(check_PROGRAMS) $(check_LTLIBRARIES) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @@ -2531,7 +2863,7 @@ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; -recheck: all $(check_LTLIBRARIES) $(check_PROGRAMS) +recheck: all $(check_PROGRAMS) $(check_LTLIBRARIES) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ @@ -2549,6 +2881,41 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +tabort_prec_max.log: tabort_prec_max$(EXEEXT) + @p='tabort_prec_max$(EXEEXT)'; \ + b='tabort_prec_max'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +tassert.log: tassert$(EXEEXT) + @p='tassert$(EXEEXT)'; \ + b='tassert'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +tabort_defalloc1.log: tabort_defalloc1$(EXEEXT) + @p='tabort_defalloc1$(EXEEXT)'; \ + b='tabort_defalloc1'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +tabort_defalloc2.log: tabort_defalloc2$(EXEEXT) + @p='tabort_defalloc2$(EXEEXT)'; \ + b='tabort_defalloc2'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +talloc.log: talloc$(EXEEXT) + @p='talloc$(EXEEXT)'; \ + b='talloc'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) tinternals.log: tinternals$(EXEEXT) @p='tinternals$(EXEEXT)'; \ b='tinternals'; \ @@ -2696,6 +3063,13 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +talloc-cache.log: talloc-cache$(EXEEXT) + @p='talloc-cache$(EXEEXT)'; \ + b='talloc-cache'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) tasin.log: tasin$(EXEEXT) @p='tasin$(EXEEXT)'; \ b='tasin'; \ @@ -2731,6 +3105,13 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +tbeta.log: tbeta$(EXEEXT) + @p='tbeta$(EXEEXT)'; \ + b='tbeta'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) tbuildopt.log: tbuildopt$(EXEEXT) @p='tbuildopt$(EXEEXT)'; \ b='tbuildopt'; \ @@ -2941,6 +3322,20 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +terandom.log: terandom$(EXEEXT) + @p='terandom$(EXEEXT)'; \ + b='terandom'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +terandom_chisq.log: terandom_chisq$(EXEEXT) + @p='terandom_chisq$(EXEEXT)'; \ + b='terandom_chisq'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) terf.log: terf$(EXEEXT) @p='terf$(EXEEXT)'; \ b='terf'; \ @@ -2997,6 +3392,13 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +tfmma.log: tfmma$(EXEEXT) + @p='tfmma$(EXEEXT)'; \ + b='tfmma'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) tfmod.log: tfmod$(EXEEXT) @p='tfmod$(EXEEXT)'; \ b='tfmod'; \ @@ -3011,6 +3413,13 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +tfpif.log: tfpif$(EXEEXT) + @p='tfpif$(EXEEXT)'; \ + b='tfpif'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) tfprintf.log: tfprintf$(EXEEXT) @p='tfprintf$(EXEEXT)'; \ b='tfprintf'; \ @@ -3039,9 +3448,9 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) -tget_flt.log: tget_flt$(EXEEXT) - @p='tget_flt$(EXEEXT)'; \ - b='tget_flt'; \ +tgamma_inc.log: tgamma_inc$(EXEEXT) + @p='tgamma_inc$(EXEEXT)'; \ + b='tgamma_inc'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ @@ -3067,6 +3476,13 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +tget_flt.log: tget_flt$(EXEEXT) + @p='tget_flt$(EXEEXT)'; \ + b='tget_flt'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) tget_ld_2exp.log: tget_ld_2exp$(EXEEXT) @p='tget_ld_2exp$(EXEEXT)'; \ b='tget_ld_2exp'; \ @@ -3074,6 +3490,13 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +tget_q.log: tget_q$(EXEEXT) + @p='tget_q$(EXEEXT)'; \ + b='tget_q'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) tget_set_d64.log: tget_set_d64$(EXEEXT) @p='tget_set_d64$(EXEEXT)'; \ b='tget_set_d64'; \ @@ -3214,6 +3637,13 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +tlog_ui.log: tlog_ui$(EXEEXT) + @p='tlog_ui$(EXEEXT)'; \ + b='tlog_ui'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) tmin_prec.log: tmin_prec$(EXEEXT) @p='tmin_prec$(EXEEXT)'; \ b='tmin_prec'; \ @@ -3270,6 +3700,20 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +tnrandom.log: tnrandom$(EXEEXT) + @p='tnrandom$(EXEEXT)'; \ + b='tnrandom'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +tnrandom_chisq.log: tnrandom_chisq$(EXEEXT) + @p='tnrandom_chisq$(EXEEXT)'; \ + b='tnrandom_chisq'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) tout_str.log: tout_str$(EXEEXT) @p='tout_str$(EXEEXT)'; \ b='tout_str'; \ @@ -3326,6 +3770,13 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +trandom_deviate.log: trandom_deviate$(EXEEXT) + @p='trandom_deviate$(EXEEXT)'; \ + b='trandom_deviate'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) trec_sqrt.log: trec_sqrt$(EXEEXT) @p='trec_sqrt$(EXEEXT)'; \ b='trec_sqrt'; \ @@ -3347,6 +3798,13 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +trndna.log: trndna$(EXEEXT) + @p='trndna$(EXEEXT)'; \ + b='trndna'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) troot.log: troot$(EXEEXT) @p='troot$(EXEEXT)'; \ b='troot'; \ @@ -3354,6 +3812,13 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +trootn_ui.log: trootn_ui$(EXEEXT) + @p='trootn_ui$(EXEEXT)'; \ + b='trootn_ui'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) tround_prec.log: tround_prec$(EXEEXT) @p='tround_prec$(EXEEXT)'; \ b='tround_prec'; \ @@ -3389,6 +3854,13 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +tset_float128.log: tset_float128$(EXEEXT) + @p='tset_float128$(EXEEXT)'; \ + b='tset_float128'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) tset_ld.log: tset_ld$(EXEEXT) @p='tset_ld$(EXEEXT)'; \ b='tset_ld'; \ @@ -3677,7 +4149,10 @@ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -3708,7 +4183,7 @@ fi; \ done check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_LTLIBRARIES) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile @@ -3738,6 +4213,7 @@ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -3752,7 +4228,191 @@ clean-libtool mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/cmp_str.Plo + -rm -f ./$(DEPDIR)/memory.Plo + -rm -f ./$(DEPDIR)/mpf_compat.Po + -rm -f ./$(DEPDIR)/mpfr_compat.Po + -rm -f ./$(DEPDIR)/random2.Plo + -rm -f ./$(DEPDIR)/reuse.Po + -rm -f ./$(DEPDIR)/rnd_mode.Plo + -rm -f ./$(DEPDIR)/tabort_defalloc1.Po + -rm -f ./$(DEPDIR)/tabort_defalloc2.Po + -rm -f ./$(DEPDIR)/tabort_prec_max.Po + -rm -f ./$(DEPDIR)/tabs.Po + -rm -f ./$(DEPDIR)/tacos.Po + -rm -f ./$(DEPDIR)/tacosh.Po + -rm -f ./$(DEPDIR)/tadd.Po + -rm -f ./$(DEPDIR)/tadd1sp.Po + -rm -f ./$(DEPDIR)/tadd_d.Po + -rm -f ./$(DEPDIR)/tadd_ui.Po + -rm -f ./$(DEPDIR)/tagm.Po + -rm -f ./$(DEPDIR)/tai.Po + -rm -f ./$(DEPDIR)/talloc-cache.Po + -rm -f ./$(DEPDIR)/talloc.Po + -rm -f ./$(DEPDIR)/tasin.Po + -rm -f ./$(DEPDIR)/tasinh.Po + -rm -f ./$(DEPDIR)/tassert.Po + -rm -f ./$(DEPDIR)/tatan.Po + -rm -f ./$(DEPDIR)/tatanh.Po + -rm -f ./$(DEPDIR)/taway.Po + -rm -f ./$(DEPDIR)/tbeta.Po + -rm -f ./$(DEPDIR)/tbuildopt.Po + -rm -f ./$(DEPDIR)/tcan_round.Po + -rm -f ./$(DEPDIR)/tcbrt.Po + -rm -f ./$(DEPDIR)/tcheck.Po + -rm -f ./$(DEPDIR)/tcmp.Po + -rm -f ./$(DEPDIR)/tcmp2.Po + -rm -f ./$(DEPDIR)/tcmp_d.Po + -rm -f ./$(DEPDIR)/tcmp_ld.Po + -rm -f ./$(DEPDIR)/tcmp_ui.Po + -rm -f ./$(DEPDIR)/tcmpabs.Po + -rm -f ./$(DEPDIR)/tcomparisons.Po + -rm -f ./$(DEPDIR)/tconst_catalan.Po + -rm -f ./$(DEPDIR)/tconst_euler.Po + -rm -f ./$(DEPDIR)/tconst_log2.Po + -rm -f ./$(DEPDIR)/tconst_pi.Po + -rm -f ./$(DEPDIR)/tcopysign.Po + -rm -f ./$(DEPDIR)/tcos.Po + -rm -f ./$(DEPDIR)/tcosh.Po + -rm -f ./$(DEPDIR)/tcot.Po + -rm -f ./$(DEPDIR)/tcoth.Po + -rm -f ./$(DEPDIR)/tcsc.Po + -rm -f ./$(DEPDIR)/tcsch.Po + -rm -f ./$(DEPDIR)/td_div.Po + -rm -f ./$(DEPDIR)/td_sub.Po + -rm -f ./$(DEPDIR)/tdigamma.Po + -rm -f ./$(DEPDIR)/tdim.Po + -rm -f ./$(DEPDIR)/tdiv.Po + -rm -f ./$(DEPDIR)/tdiv_d.Po + -rm -f ./$(DEPDIR)/tdiv_ui.Po + -rm -f ./$(DEPDIR)/teint.Po + -rm -f ./$(DEPDIR)/teq.Po + -rm -f ./$(DEPDIR)/terandom.Po + -rm -f ./$(DEPDIR)/terandom_chisq.Po + -rm -f ./$(DEPDIR)/terf.Po + -rm -f ./$(DEPDIR)/tests.Plo + -rm -f ./$(DEPDIR)/texceptions.Po + -rm -f ./$(DEPDIR)/texp.Po + -rm -f ./$(DEPDIR)/texp10.Po + -rm -f ./$(DEPDIR)/texp2.Po + -rm -f ./$(DEPDIR)/texpm1.Po + -rm -f ./$(DEPDIR)/tfactorial.Po + -rm -f ./$(DEPDIR)/tfits.Po + -rm -f ./$(DEPDIR)/tfma.Po + -rm -f ./$(DEPDIR)/tfmma.Po + -rm -f ./$(DEPDIR)/tfmod.Po + -rm -f ./$(DEPDIR)/tfms.Po + -rm -f ./$(DEPDIR)/tfpif.Po + -rm -f ./$(DEPDIR)/tfprintf.Po + -rm -f ./$(DEPDIR)/tfrac.Po + -rm -f ./$(DEPDIR)/tfrexp.Po + -rm -f ./$(DEPDIR)/tgamma.Po + -rm -f ./$(DEPDIR)/tgamma_inc.Po + -rm -f ./$(DEPDIR)/tget_d.Po + -rm -f ./$(DEPDIR)/tget_d_2exp.Po + -rm -f ./$(DEPDIR)/tget_f.Po + -rm -f ./$(DEPDIR)/tget_flt.Po + -rm -f ./$(DEPDIR)/tget_ld_2exp.Po + -rm -f ./$(DEPDIR)/tget_q.Po + -rm -f ./$(DEPDIR)/tget_set_d64.Po + -rm -f ./$(DEPDIR)/tget_sj.Po + -rm -f ./$(DEPDIR)/tget_str.Po + -rm -f ./$(DEPDIR)/tget_z.Po + -rm -f ./$(DEPDIR)/tgmpop.Po + -rm -f ./$(DEPDIR)/tgrandom.Po + -rm -f ./$(DEPDIR)/thyperbolic.Po + -rm -f ./$(DEPDIR)/thypot.Po + -rm -f ./$(DEPDIR)/tinits.Po + -rm -f ./$(DEPDIR)/tinp_str.Po + -rm -f ./$(DEPDIR)/tinternals.Po + -rm -f ./$(DEPDIR)/tisnan.Po + -rm -f ./$(DEPDIR)/tisqrt.Po + -rm -f ./$(DEPDIR)/tj0.Po + -rm -f ./$(DEPDIR)/tj1.Po + -rm -f ./$(DEPDIR)/tjn.Po + -rm -f ./$(DEPDIR)/tl2b.Po + -rm -f ./$(DEPDIR)/tlgamma.Po + -rm -f ./$(DEPDIR)/tli2.Po + -rm -f ./$(DEPDIR)/tlngamma.Po + -rm -f ./$(DEPDIR)/tlog.Po + -rm -f ./$(DEPDIR)/tlog10.Po + -rm -f ./$(DEPDIR)/tlog1p.Po + -rm -f ./$(DEPDIR)/tlog2.Po + -rm -f ./$(DEPDIR)/tlog_ui.Po + -rm -f ./$(DEPDIR)/tmin_prec.Po + -rm -f ./$(DEPDIR)/tminmax.Po + -rm -f ./$(DEPDIR)/tmodf.Po + -rm -f ./$(DEPDIR)/tmul.Po + -rm -f ./$(DEPDIR)/tmul_2exp.Po + -rm -f ./$(DEPDIR)/tmul_d.Po + -rm -f ./$(DEPDIR)/tmul_ui.Po + -rm -f ./$(DEPDIR)/tnext.Po + -rm -f ./$(DEPDIR)/tnrandom.Po + -rm -f ./$(DEPDIR)/tnrandom_chisq.Po + -rm -f ./$(DEPDIR)/tout_str.Po + -rm -f ./$(DEPDIR)/toutimpl.Po + -rm -f ./$(DEPDIR)/tpow.Po + -rm -f ./$(DEPDIR)/tpow3.Po + -rm -f ./$(DEPDIR)/tpow_all.Po + -rm -f ./$(DEPDIR)/tpow_z.Po + -rm -f ./$(DEPDIR)/tprintf.Po + -rm -f ./$(DEPDIR)/trandom.Po + -rm -f ./$(DEPDIR)/trandom_deviate.Po + -rm -f ./$(DEPDIR)/trec_sqrt.Po + -rm -f ./$(DEPDIR)/tremquo.Po + -rm -f ./$(DEPDIR)/trint.Po + -rm -f ./$(DEPDIR)/trndna.Po + -rm -f ./$(DEPDIR)/troot.Po + -rm -f ./$(DEPDIR)/trootn_ui.Po + -rm -f ./$(DEPDIR)/tround_prec.Po + -rm -f ./$(DEPDIR)/tsec.Po + -rm -f ./$(DEPDIR)/tsech.Po + -rm -f ./$(DEPDIR)/tset.Po + -rm -f ./$(DEPDIR)/tset_d.Po + -rm -f ./$(DEPDIR)/tset_exp.Po + -rm -f ./$(DEPDIR)/tset_f.Po + -rm -f ./$(DEPDIR)/tset_float128.Po + -rm -f ./$(DEPDIR)/tset_ld.Po + -rm -f ./$(DEPDIR)/tset_q.Po + -rm -f ./$(DEPDIR)/tset_si.Po + -rm -f ./$(DEPDIR)/tset_sj.Po + -rm -f ./$(DEPDIR)/tset_str.Po + -rm -f ./$(DEPDIR)/tset_z.Po + -rm -f ./$(DEPDIR)/tset_z_exp.Po + -rm -f ./$(DEPDIR)/tsgn.Po + -rm -f ./$(DEPDIR)/tsi_op.Po + -rm -f ./$(DEPDIR)/tsin.Po + -rm -f ./$(DEPDIR)/tsin_cos.Po + -rm -f ./$(DEPDIR)/tsinh.Po + -rm -f ./$(DEPDIR)/tsinh_cosh.Po + -rm -f ./$(DEPDIR)/tsprintf.Po + -rm -f ./$(DEPDIR)/tsqr.Po + -rm -f ./$(DEPDIR)/tsqrt.Po + -rm -f ./$(DEPDIR)/tsqrt_ui.Po + -rm -f ./$(DEPDIR)/tstckintc.Po + -rm -f ./$(DEPDIR)/tstdint.Po + -rm -f ./$(DEPDIR)/tstrtofr.Po + -rm -f ./$(DEPDIR)/tsub.Po + -rm -f ./$(DEPDIR)/tsub1sp.Po + -rm -f ./$(DEPDIR)/tsub_d.Po + -rm -f ./$(DEPDIR)/tsub_ui.Po + -rm -f ./$(DEPDIR)/tsubnormal.Po + -rm -f ./$(DEPDIR)/tsum.Po + -rm -f ./$(DEPDIR)/tswap.Po + -rm -f ./$(DEPDIR)/ttan.Po + -rm -f ./$(DEPDIR)/ttanh.Po + -rm -f ./$(DEPDIR)/ttrunc.Po + -rm -f ./$(DEPDIR)/tui_div.Po + -rm -f ./$(DEPDIR)/tui_pow.Po + -rm -f ./$(DEPDIR)/tui_sub.Po + -rm -f ./$(DEPDIR)/turandom.Po + -rm -f ./$(DEPDIR)/tvalist.Po + -rm -f ./$(DEPDIR)/tversion.Po + -rm -f ./$(DEPDIR)/ty0.Po + -rm -f ./$(DEPDIR)/ty1.Po + -rm -f ./$(DEPDIR)/tyn.Po + -rm -f ./$(DEPDIR)/tzeta.Po + -rm -f ./$(DEPDIR)/tzeta_ui.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -3798,7 +4458,191 @@ installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/cmp_str.Plo + -rm -f ./$(DEPDIR)/memory.Plo + -rm -f ./$(DEPDIR)/mpf_compat.Po + -rm -f ./$(DEPDIR)/mpfr_compat.Po + -rm -f ./$(DEPDIR)/random2.Plo + -rm -f ./$(DEPDIR)/reuse.Po + -rm -f ./$(DEPDIR)/rnd_mode.Plo + -rm -f ./$(DEPDIR)/tabort_defalloc1.Po + -rm -f ./$(DEPDIR)/tabort_defalloc2.Po + -rm -f ./$(DEPDIR)/tabort_prec_max.Po + -rm -f ./$(DEPDIR)/tabs.Po + -rm -f ./$(DEPDIR)/tacos.Po + -rm -f ./$(DEPDIR)/tacosh.Po + -rm -f ./$(DEPDIR)/tadd.Po + -rm -f ./$(DEPDIR)/tadd1sp.Po + -rm -f ./$(DEPDIR)/tadd_d.Po + -rm -f ./$(DEPDIR)/tadd_ui.Po + -rm -f ./$(DEPDIR)/tagm.Po + -rm -f ./$(DEPDIR)/tai.Po + -rm -f ./$(DEPDIR)/talloc-cache.Po + -rm -f ./$(DEPDIR)/talloc.Po + -rm -f ./$(DEPDIR)/tasin.Po + -rm -f ./$(DEPDIR)/tasinh.Po + -rm -f ./$(DEPDIR)/tassert.Po + -rm -f ./$(DEPDIR)/tatan.Po + -rm -f ./$(DEPDIR)/tatanh.Po + -rm -f ./$(DEPDIR)/taway.Po + -rm -f ./$(DEPDIR)/tbeta.Po + -rm -f ./$(DEPDIR)/tbuildopt.Po + -rm -f ./$(DEPDIR)/tcan_round.Po + -rm -f ./$(DEPDIR)/tcbrt.Po + -rm -f ./$(DEPDIR)/tcheck.Po + -rm -f ./$(DEPDIR)/tcmp.Po + -rm -f ./$(DEPDIR)/tcmp2.Po + -rm -f ./$(DEPDIR)/tcmp_d.Po + -rm -f ./$(DEPDIR)/tcmp_ld.Po + -rm -f ./$(DEPDIR)/tcmp_ui.Po + -rm -f ./$(DEPDIR)/tcmpabs.Po + -rm -f ./$(DEPDIR)/tcomparisons.Po + -rm -f ./$(DEPDIR)/tconst_catalan.Po + -rm -f ./$(DEPDIR)/tconst_euler.Po + -rm -f ./$(DEPDIR)/tconst_log2.Po + -rm -f ./$(DEPDIR)/tconst_pi.Po + -rm -f ./$(DEPDIR)/tcopysign.Po + -rm -f ./$(DEPDIR)/tcos.Po + -rm -f ./$(DEPDIR)/tcosh.Po + -rm -f ./$(DEPDIR)/tcot.Po + -rm -f ./$(DEPDIR)/tcoth.Po + -rm -f ./$(DEPDIR)/tcsc.Po + -rm -f ./$(DEPDIR)/tcsch.Po + -rm -f ./$(DEPDIR)/td_div.Po + -rm -f ./$(DEPDIR)/td_sub.Po + -rm -f ./$(DEPDIR)/tdigamma.Po + -rm -f ./$(DEPDIR)/tdim.Po + -rm -f ./$(DEPDIR)/tdiv.Po + -rm -f ./$(DEPDIR)/tdiv_d.Po + -rm -f ./$(DEPDIR)/tdiv_ui.Po + -rm -f ./$(DEPDIR)/teint.Po + -rm -f ./$(DEPDIR)/teq.Po + -rm -f ./$(DEPDIR)/terandom.Po + -rm -f ./$(DEPDIR)/terandom_chisq.Po + -rm -f ./$(DEPDIR)/terf.Po + -rm -f ./$(DEPDIR)/tests.Plo + -rm -f ./$(DEPDIR)/texceptions.Po + -rm -f ./$(DEPDIR)/texp.Po + -rm -f ./$(DEPDIR)/texp10.Po + -rm -f ./$(DEPDIR)/texp2.Po + -rm -f ./$(DEPDIR)/texpm1.Po + -rm -f ./$(DEPDIR)/tfactorial.Po + -rm -f ./$(DEPDIR)/tfits.Po + -rm -f ./$(DEPDIR)/tfma.Po + -rm -f ./$(DEPDIR)/tfmma.Po + -rm -f ./$(DEPDIR)/tfmod.Po + -rm -f ./$(DEPDIR)/tfms.Po + -rm -f ./$(DEPDIR)/tfpif.Po + -rm -f ./$(DEPDIR)/tfprintf.Po + -rm -f ./$(DEPDIR)/tfrac.Po + -rm -f ./$(DEPDIR)/tfrexp.Po + -rm -f ./$(DEPDIR)/tgamma.Po + -rm -f ./$(DEPDIR)/tgamma_inc.Po + -rm -f ./$(DEPDIR)/tget_d.Po + -rm -f ./$(DEPDIR)/tget_d_2exp.Po + -rm -f ./$(DEPDIR)/tget_f.Po + -rm -f ./$(DEPDIR)/tget_flt.Po + -rm -f ./$(DEPDIR)/tget_ld_2exp.Po + -rm -f ./$(DEPDIR)/tget_q.Po + -rm -f ./$(DEPDIR)/tget_set_d64.Po + -rm -f ./$(DEPDIR)/tget_sj.Po + -rm -f ./$(DEPDIR)/tget_str.Po + -rm -f ./$(DEPDIR)/tget_z.Po + -rm -f ./$(DEPDIR)/tgmpop.Po + -rm -f ./$(DEPDIR)/tgrandom.Po + -rm -f ./$(DEPDIR)/thyperbolic.Po + -rm -f ./$(DEPDIR)/thypot.Po + -rm -f ./$(DEPDIR)/tinits.Po + -rm -f ./$(DEPDIR)/tinp_str.Po + -rm -f ./$(DEPDIR)/tinternals.Po + -rm -f ./$(DEPDIR)/tisnan.Po + -rm -f ./$(DEPDIR)/tisqrt.Po + -rm -f ./$(DEPDIR)/tj0.Po + -rm -f ./$(DEPDIR)/tj1.Po + -rm -f ./$(DEPDIR)/tjn.Po + -rm -f ./$(DEPDIR)/tl2b.Po + -rm -f ./$(DEPDIR)/tlgamma.Po + -rm -f ./$(DEPDIR)/tli2.Po + -rm -f ./$(DEPDIR)/tlngamma.Po + -rm -f ./$(DEPDIR)/tlog.Po + -rm -f ./$(DEPDIR)/tlog10.Po + -rm -f ./$(DEPDIR)/tlog1p.Po + -rm -f ./$(DEPDIR)/tlog2.Po + -rm -f ./$(DEPDIR)/tlog_ui.Po + -rm -f ./$(DEPDIR)/tmin_prec.Po + -rm -f ./$(DEPDIR)/tminmax.Po + -rm -f ./$(DEPDIR)/tmodf.Po + -rm -f ./$(DEPDIR)/tmul.Po + -rm -f ./$(DEPDIR)/tmul_2exp.Po + -rm -f ./$(DEPDIR)/tmul_d.Po + -rm -f ./$(DEPDIR)/tmul_ui.Po + -rm -f ./$(DEPDIR)/tnext.Po + -rm -f ./$(DEPDIR)/tnrandom.Po + -rm -f ./$(DEPDIR)/tnrandom_chisq.Po + -rm -f ./$(DEPDIR)/tout_str.Po + -rm -f ./$(DEPDIR)/toutimpl.Po + -rm -f ./$(DEPDIR)/tpow.Po + -rm -f ./$(DEPDIR)/tpow3.Po + -rm -f ./$(DEPDIR)/tpow_all.Po + -rm -f ./$(DEPDIR)/tpow_z.Po + -rm -f ./$(DEPDIR)/tprintf.Po + -rm -f ./$(DEPDIR)/trandom.Po + -rm -f ./$(DEPDIR)/trandom_deviate.Po + -rm -f ./$(DEPDIR)/trec_sqrt.Po + -rm -f ./$(DEPDIR)/tremquo.Po + -rm -f ./$(DEPDIR)/trint.Po + -rm -f ./$(DEPDIR)/trndna.Po + -rm -f ./$(DEPDIR)/troot.Po + -rm -f ./$(DEPDIR)/trootn_ui.Po + -rm -f ./$(DEPDIR)/tround_prec.Po + -rm -f ./$(DEPDIR)/tsec.Po + -rm -f ./$(DEPDIR)/tsech.Po + -rm -f ./$(DEPDIR)/tset.Po + -rm -f ./$(DEPDIR)/tset_d.Po + -rm -f ./$(DEPDIR)/tset_exp.Po + -rm -f ./$(DEPDIR)/tset_f.Po + -rm -f ./$(DEPDIR)/tset_float128.Po + -rm -f ./$(DEPDIR)/tset_ld.Po + -rm -f ./$(DEPDIR)/tset_q.Po + -rm -f ./$(DEPDIR)/tset_si.Po + -rm -f ./$(DEPDIR)/tset_sj.Po + -rm -f ./$(DEPDIR)/tset_str.Po + -rm -f ./$(DEPDIR)/tset_z.Po + -rm -f ./$(DEPDIR)/tset_z_exp.Po + -rm -f ./$(DEPDIR)/tsgn.Po + -rm -f ./$(DEPDIR)/tsi_op.Po + -rm -f ./$(DEPDIR)/tsin.Po + -rm -f ./$(DEPDIR)/tsin_cos.Po + -rm -f ./$(DEPDIR)/tsinh.Po + -rm -f ./$(DEPDIR)/tsinh_cosh.Po + -rm -f ./$(DEPDIR)/tsprintf.Po + -rm -f ./$(DEPDIR)/tsqr.Po + -rm -f ./$(DEPDIR)/tsqrt.Po + -rm -f ./$(DEPDIR)/tsqrt_ui.Po + -rm -f ./$(DEPDIR)/tstckintc.Po + -rm -f ./$(DEPDIR)/tstdint.Po + -rm -f ./$(DEPDIR)/tstrtofr.Po + -rm -f ./$(DEPDIR)/tsub.Po + -rm -f ./$(DEPDIR)/tsub1sp.Po + -rm -f ./$(DEPDIR)/tsub_d.Po + -rm -f ./$(DEPDIR)/tsub_ui.Po + -rm -f ./$(DEPDIR)/tsubnormal.Po + -rm -f ./$(DEPDIR)/tsum.Po + -rm -f ./$(DEPDIR)/tswap.Po + -rm -f ./$(DEPDIR)/ttan.Po + -rm -f ./$(DEPDIR)/ttanh.Po + -rm -f ./$(DEPDIR)/ttrunc.Po + -rm -f ./$(DEPDIR)/tui_div.Po + -rm -f ./$(DEPDIR)/tui_pow.Po + -rm -f ./$(DEPDIR)/tui_sub.Po + -rm -f ./$(DEPDIR)/turandom.Po + -rm -f ./$(DEPDIR)/tvalist.Po + -rm -f ./$(DEPDIR)/tversion.Po + -rm -f ./$(DEPDIR)/ty0.Po + -rm -f ./$(DEPDIR)/ty1.Po + -rm -f ./$(DEPDIR)/tyn.Po + -rm -f ./$(DEPDIR)/tzeta.Po + -rm -f ./$(DEPDIR)/tzeta_ui.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -3819,20 +4663,20 @@ .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ - clean-checkLTLIBRARIES clean-checkPROGRAMS clean-generic \ - clean-libtool cscopelist-am ctags ctags-am distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am recheck tags tags-am uninstall \ - uninstall-am +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ + check-am clean clean-checkLTLIBRARIES clean-checkPROGRAMS \ + clean-generic clean-libtool cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + recheck tags tags-am uninstall uninstall-am .PRECIOUS: Makefile @@ -3844,9 +4688,16 @@ # of the make output, so that the user could no longer see information # from tversion. To mimic the old behavior, we now output the contents # of the tversion log file if this file exists (i.e. if the Makefile -# has been generated with Automake 1.13+). +# has been generated with Automake 1.13+); but this is done only when +# no tests fail. check: - cat tversion.log 2> /dev/null || true + @if [ -d $(top_srcdir)/.svn ]; then \ + output=`svnversion $(top_srcdir) 2> /dev/null`; \ + if [ -n "$$output" ]; then \ + echo "[svnversion] $$output"; \ + fi; \ + fi + @grep -v '^PASS ' tversion.log 2> /dev/null || true $(top_builddir)/src/libmpfr.la: cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) libmpfr.la diff -Nru mpfr4-3.1.4/tests/memory.c mpfr4-4.0.2/tests/memory.c --- mpfr4-3.1.4/tests/memory.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/tests/memory.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Memory allocation used during tests. -Copyright 2001-2003, 2006-2016 Free Software Foundation, Inc. +Copyright 2001-2003, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,15 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Note: this file comes from GMP's tests/memory.c */ -#include -#include /* for abort */ -#include - #include "mpfr-test.h" /* Each block allocated is a separate malloc, for the benefit of a redzoning @@ -38,16 +34,72 @@ when tests_memory_end() is called. Test programs must be sure to have "clear"s for all temporary variables used. */ +/* Note about error messages + ------------------------- + Error messages in MPFR are usually written to stdout. However, those + coming from the memory allocator need to be written to stderr in order + to be visible when the standard output is redirected, e.g. in the tests + of I/O functions (like tprintf). For consistency, all error messages in + this file should be written to stderr. */ + struct header { void *ptr; size_t size; struct header *next; }; +/* The memory limit can be changed with the MPFR_TESTS_MEMORY_LIMIT + environment variable. This is normally not necessary (a failure + would mean a bug), thus not recommended, for "make check". But + some test programs can take arguments for particular tests, which + may need more memory. This variable is exported, so that such + programs may also change the memory limit. */ +size_t tests_memory_limit = DEFAULT_MEMORY_LIMIT; + static struct header *tests_memory_list; +static size_t tests_total_size = 0; +MPFR_LOCK_DECL(mpfr_lock_memory) + +static void * +mpfr_default_allocate (size_t size) +{ + void *ret; + ret = malloc (size); + if (MPFR_UNLIKELY (ret == NULL)) + { + fprintf (stderr, "[MPFR] mpfr_default_allocate(): " + "can't allocate memory (size=%lu)\n", + (unsigned long) size); + abort (); + } + return ret; +} + +static void * +mpfr_default_reallocate (void *oldptr, size_t old_size, size_t new_size) +{ + void *ret; + ret = realloc (oldptr, new_size); + if (MPFR_UNLIKELY(ret == NULL)) + { + fprintf (stderr, "[MPFR] mpfr_default_reallocate(): " + "can't reallocate memory (old_size=%lu new_size=%lu)\n", + (unsigned long) old_size, (unsigned long) new_size); + abort (); + } + return ret; +} + +static void +mpfr_default_free (void *blk_ptr, size_t blk_size) +{ + free (blk_ptr); +} /* Return a pointer to a pointer to the found block (so it can be updated when unlinking). */ +/* FIXME: This is a O(n) search, while it could be done in nearly + constant time with a better data structure! */ static struct header ** tests_memory_find (void *ptr) { @@ -68,23 +120,46 @@ } */ +static void +tests_addsize (size_t size) +{ + tests_total_size += size; + if (tests_total_size > tests_memory_limit) + { + /* The total size taken by MPFR on the heap is more than 4 MB: + either a bug or a huge inefficiency. */ + fprintf (stderr, "[MPFR] tests_addsize(): " + "too much memory (%lu bytes)\n", + (unsigned long) tests_total_size); + abort (); + } +} + void * tests_allocate (size_t size) { struct header *h; + MPFR_LOCK_WRITE(mpfr_lock_memory); + if (size == 0) { - printf ("tests_allocate(): attempt to allocate 0 bytes\n"); + fprintf (stderr, "[MPFR] tests_allocate(): " + "attempt to allocate 0 bytes\n"); abort (); } - h = (struct header *) __gmp_default_allocate (sizeof (*h)); + tests_addsize (size); + + h = (struct header *) mpfr_default_allocate (sizeof (*h)); h->next = tests_memory_list; tests_memory_list = h; h->size = size; - h->ptr = __gmp_default_allocate (size); + h->ptr = mpfr_default_allocate (size); + + MPFR_UNLOCK_WRITE(mpfr_lock_memory); + return h->ptr; } @@ -93,9 +168,12 @@ { struct header **hp, *h; + MPFR_LOCK_WRITE(mpfr_lock_memory); + if (new_size == 0) { - printf ("tests_reallocate(): attempt to reallocate 0x%lX to 0 bytes\n", + fprintf (stderr, "[MPFR] tests_reallocate(): " + "attempt to reallocate 0x%lX to 0 bytes\n", (unsigned long) ptr); abort (); } @@ -103,7 +181,8 @@ hp = tests_memory_find (ptr); if (hp == NULL) { - printf ("tests_reallocate(): attempt to reallocate bad pointer 0x%lX\n", + fprintf (stderr, "[MPFR] tests_reallocate(): " + "attempt to reallocate bad pointer 0x%lX\n", (unsigned long) ptr); abort (); } @@ -113,13 +192,20 @@ { /* Note: we should use the standard %zu to print sizes, but this is not supported by old C implementations. */ - printf ("tests_reallocate(): bad old size %lu, should be %lu\n", + fprintf (stderr, "[MPFR] tests_reallocate(): " + "bad old size %lu, should be %lu\n", (unsigned long) old_size, (unsigned long) h->size); abort (); } + tests_total_size -= old_size; + tests_addsize (new_size); + h->size = new_size; - h->ptr = __gmp_default_reallocate (ptr, old_size, new_size); + h->ptr = mpfr_default_reallocate (ptr, old_size, new_size); + + MPFR_UNLOCK_WRITE(mpfr_lock_memory); + return h->ptr; } @@ -129,7 +215,8 @@ struct header **hp = tests_memory_find (ptr); if (hp == NULL) { - printf ("tests_free(): attempt to free bad pointer 0x%lX\n", + fprintf (stderr, "[MPFR] tests_free(): " + "attempt to free bad pointer 0x%lX\n", (unsigned long) ptr); abort (); } @@ -144,33 +231,51 @@ *hp = h->next; /* unlink */ - __gmp_default_free (ptr, h->size); - __gmp_default_free (h, sizeof (*h)); + mpfr_default_free (ptr, h->size); + mpfr_default_free (h, sizeof (*h)); } void tests_free (void *ptr, size_t size) { - struct header **hp = tests_free_find (ptr); - struct header *h = *hp; + struct header **hp; + struct header *h; + + MPFR_LOCK_WRITE(mpfr_lock_memory); + + hp = tests_free_find (ptr); + h = *hp; if (h->size != size) { /* Note: we should use the standard %zu to print sizes, but this is not supported by old C implementations. */ - printf ("tests_free(): bad size %lu, should be %lu\n", + fprintf (stderr, "[MPFR] tests_free(): bad size %lu, should be %lu\n", (unsigned long) size, (unsigned long) h->size); abort (); } + tests_total_size -= size; tests_free_nosize (ptr); + + MPFR_UNLOCK_WRITE(mpfr_lock_memory); } void tests_memory_start (void) { + char *p; + tests_memory_list = NULL; mp_set_memory_functions (tests_allocate, tests_reallocate, tests_free); + + p = getenv ("MPFR_TESTS_MEMORY_LIMIT"); + if (p != NULL) + { + tests_memory_limit = strtoul (p, NULL, 0); + if (tests_memory_limit == 0) + tests_memory_limit = (size_t) -1; /* no memory limit */ + } } void @@ -181,13 +286,13 @@ struct header *h; unsigned count; - printf ("tests_memory_end(): not all memory freed\n"); + fprintf (stderr, "[MPFR] tests_memory_end(): not all memory freed\n"); count = 0; for (h = tests_memory_list; h != NULL; h = h->next) count++; - printf (" %u blocks remaining\n", count); + fprintf (stderr, "[MPFR] %u blocks remaining\n", count); abort (); } } diff -Nru mpfr4-3.1.4/tests/mpf_compat.c mpfr4-4.0.2/tests/mpf_compat.c --- mpfr4-3.1.4/tests/mpf_compat.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/mpf_compat.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test compatibility mpf-mpfr. -Copyright 2003, 2005-2016 Free Software Foundation, Inc. +Copyright 2003, 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,9 +17,23 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "mpfr-test.h" + +#ifndef MPFR_USE_MINI_GMP + #define MPF #define mpf_free_str mpfr_free_str #include "mpf_compat.h" + +#else + +int +main (void) +{ + return 77; +} + +#endif diff -Nru mpfr4-3.1.4/tests/mpf_compat.h mpfr4-4.0.2/tests/mpf_compat.h --- mpfr4-3.1.4/tests/mpf_compat.h 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/mpf_compat.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test compatibility mpf-mpfr. -Copyright 2003-2016 Free Software Foundation, Inc. +Copyright 2003-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,19 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if defined (__cplusplus) -#include -#else -#include -#endif -#include -#include - -#include "gmp.h" -#include "mpfr.h" #ifdef MPFR #include "mpf2mpfr.h" #endif @@ -37,7 +27,14 @@ int main (void) { - unsigned long int prec; + +#if defined (MPFR) && _MPFR_EXP_FORMAT != 3 /* because exp is a long below */ + + return 77; + +#else + + unsigned long int prec, old_prec; unsigned long int prec2; mpf_t x, y; mpz_t z; @@ -51,6 +48,8 @@ FILE *f; gmp_randstate_t state; + tests_start_mpfr (); + /* Initialization Functions */ prec = 53; mpf_set_default_prec (prec); @@ -83,6 +82,7 @@ exit (1); } + old_prec = mpf_get_prec (x); mpf_set_prec_raw (x, prec); prec2 = mpf_get_prec (x); if (prec2 < prec) @@ -92,6 +92,7 @@ mpf_clear (x); exit (1); } + mpf_set_prec_raw (x, old_prec); /* needed with MPF (see GMP manual) */ /* Assignment Functions */ @@ -109,7 +110,7 @@ mpf_set_q (x, q); mpq_clear (q); - mpf_set_str (x, "3.1415e1", 10); + mpf_set_str (x, "31415e-3", 10); mpf_swap (x, y); /* Combined Initialization and Assignment Functions */ @@ -123,7 +124,7 @@ mpf_clear (x); mpf_init_set_d (x, 17.0); mpf_clear (x); - mpf_init_set_str (x, "3.1415e1", 10); + mpf_init_set_str (x, "31415e-3", 10); /* Conversion Functions */ @@ -132,7 +133,7 @@ l = mpf_get_si (x); u = mpf_get_ui (x); s = mpf_get_str (NULL, &exp, 10, 10, x); - /* MPF doen't have mpf_free_str */ + /* MPF doesn't have mpf_free_str */ mpfr_free_str (s); /* Use d, l and u to avoid a warning with -Wunused-but-set-variable @@ -181,20 +182,20 @@ mpf_set_prec (x, 15); mpf_set_prec (y, 15); - /* We may use src_fopen instead of fopen, but it is defined - in mpfr-test, and not in mpfr.h and gmp.h, and we want - to test theses includes files. */ - f = fopen ("inp_str.data", "r"); - if (f != NULL) + + f = src_fopen ("inp_str.dat", "r"); + if (f == NULL) { - i = mpf_inp_str (x, f, 10); - if ((i == 0) || mpf_cmp_ui (x, 31415)) - { - printf ("Error in reading 1st line from file inp_str.data\n"); - exit (1); - } - fclose (f); + printf ("cannot open file \"inp_str.dat\"\n"); + exit (1); + } + i = mpf_inp_str (x, f, 10); + if (i == 0 || mpf_cmp_si (x, -1700)) + { + printf ("Error in reading 1st line from file \"inp_str.dat\"\n"); + exit (1); } + fclose (f); /* Miscellaneous Functions */ @@ -223,14 +224,28 @@ mpz_clear (z); if (mpf_cmp_ui (x, 17) != 0) { - fprintf (stderr, "Error in conversion to/from mpz\n"); - fprintf (stderr, "expected 17, got %1.16e\n", mpf_get_d (x)); + printf ("Error in conversion to/from mpz\n"); + printf ("expected 17, got %1.16e\n", mpf_get_d (x)); exit (1); } + /* non-regression tests for bugs fixed in revision 11565 */ + mpf_set_si (x, -1); + MPFR_ASSERTN(mpf_fits_ulong_p (x) == 0); + MPFR_ASSERTN(mpf_fits_slong_p (x) != 0); + MPFR_ASSERTN(mpf_fits_uint_p (x) == 0); + MPFR_ASSERTN(mpf_fits_sint_p (x) != 0); + MPFR_ASSERTN(mpf_fits_ushort_p (x) == 0); + MPFR_ASSERTN(mpf_fits_sshort_p (x) != 0); + MPFR_ASSERTN(mpf_get_si (x) == -1); + /* clear all variables */ mpf_clear (y); mpf_clear (x); + tests_end_mpfr (); return 0; + +#endif + } diff -Nru mpfr4-3.1.4/tests/mpfr_compat.c mpfr4-4.0.2/tests/mpfr_compat.c --- mpfr4-3.1.4/tests/mpfr_compat.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/mpfr_compat.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test compatibility mpf-mpfr. -Copyright 2003, 2005-2016 Free Software Foundation, Inc. +Copyright 2003, 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,9 +17,23 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "mpfr-test.h" + +#ifndef MPFR_USE_MINI_GMP + #define MPFR #define mpf_free_str mpfr_free_str #include "mpf_compat.h" + +#else + +int +main (void) +{ + return 77; +} + +#endif diff -Nru mpfr4-3.1.4/tests/mpfr-test.h mpfr4-4.0.2/tests/mpfr-test.h --- mpfr4-3.1.4/tests/mpfr-test.h 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/mpfr-test.h 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* auxiliary functions for MPFR tests. -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,19 +17,36 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __MPFR_TEST_H__ #define __MPFR_TEST_H__ -#include +/* Include config.h before using ANY configure macros if needed. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +/* The no assertion request doesn't apply to the tests */ +#if defined(MPFR_WANT_ASSERT) +# if MPFR_WANT_ASSERT < 0 +# undef MPFR_WANT_ASSERT +# endif +#endif #include "mpfr-impl.h" +#define STRINGIZE(S) #S +#define MAKE_STR(S) STRINGIZE(S) + +#if defined (__cplusplus) +extern "C" { +#endif + /* generates a random long int, a random double, and corresponding seed initializing */ -#define DBL_RAND() ((double) randlimb() / (double) MP_LIMB_T_MAX) +#define DBL_RAND() ((double) randlimb() / (double) MPFR_LIMB_MAX) #define MINNORM 2.2250738585072013831e-308 /* 2^(-1022), smallest normalized */ #define MAXNORM 1.7976931348623157081e308 /* 2^(1023)*(2-2^(-52)) */ @@ -37,12 +54,19 @@ /* Generates a random rounding mode */ #define RND_RAND() ((mpfr_rnd_t) (randlimb() % MPFR_RND_MAX)) +/* Ditto, excluding RNDF, assumed to be the last rounding mode */ +#define RND_RAND_NO_RNDF() ((mpfr_rnd_t) (randlimb() % MPFR_RNDF)) + /* Generates a random sign */ -#define SIGN_RAND() ( (randlimb()%2) ? MPFR_SIGN_POS : MPFR_SIGN_NEG) +#define RAND_SIGN() (randlimb() % 2 ? MPFR_SIGN_POS : MPFR_SIGN_NEG) /* Loop for all rounding modes */ #define RND_LOOP(_r) for((_r) = 0 ; (_r) < MPFR_RND_MAX ; (_r)++) +/* Loop for all rounding modes except RNDF (assumed to be the last one), + which must be excluded from tests that rely on deterministic results. */ +#define RND_LOOP_NO_RNDF(_r) for((_r) = 0 ; (_r) < MPFR_RNDF ; (_r)++) + /* Test whether two floating-point data have the same value, seen as an element of the set of the floating-point data (Level 2 in the IEEE 754-2008 standard). */ @@ -61,59 +85,70 @@ #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define ABS(x) (((x)>0) ? (x) : -(x)) -#define FLIST mpfr_ptr, mpfr_srcptr, mpfr_rnd_t - -#if defined (__cplusplus) -extern "C" { +/* In the tests, mpfr_sgn was sometimes used incorrectly, for instance: + * + * if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) + * + * to check that y is +0. This does not make sense since on 0, mpfr_sgn + * yields 0, so that -0 would not be detected as an error. To make sure + * that mpfr_sgn is not used incorrectly, we choose to fail when this + * macro is used on a datum whose mathematical sign is not +1 or -1. + * This feature is disabled when MPFR_TESTS_TSGN is defined, typically + * in tsgn (to test mpfr_sgn itself). + */ +#ifndef MPFR_TESTS_TSGN +# undef mpfr_sgn +# define mpfr_sgn(x) \ + (MPFR_ASSERTN (! MPFR_IS_NAN (x)), \ + MPFR_ASSERTN (! MPFR_IS_ZERO (x)), \ + MPFR_SIGN (x)) #endif -int test_version _MPFR_PROTO ((void)); - -void tests_memory_start _MPFR_PROTO ((void)); -void tests_memory_end _MPFR_PROTO ((void)); +#define FLIST mpfr_ptr, mpfr_srcptr, mpfr_rnd_t -void tests_start_mpfr _MPFR_PROTO ((void)); -void tests_end_mpfr _MPFR_PROTO ((void)); +int test_version (void); -int mpfr_set_machine_rnd_mode _MPFR_PROTO ((mpfr_rnd_t)); -void mpfr_test_init _MPFR_PROTO ((void)); -mp_limb_t randlimb _MPFR_PROTO ((void)); -void randseed _MPFR_PROTO ((unsigned int)); -void mpfr_random2 _MPFR_PROTO ((mpfr_ptr, mp_size_t, mpfr_exp_t, gmp_randstate_t)); -int ulp _MPFR_PROTO ((double, double)); -double dbl _MPFR_PROTO ((double, int)); -double Ulp _MPFR_PROTO ((double)); -int Isnan _MPFR_PROTO ((double)); -void d_trace _MPFR_PROTO ((const char *, double)); -void ld_trace _MPFR_PROTO ((const char *, long double)); - -FILE *src_fopen _MPFR_PROTO ((const char *, const char *)); -void set_emin _MPFR_PROTO ((mpfr_exp_t)); -void set_emax _MPFR_PROTO ((mpfr_exp_t)); -void tests_default_random _MPFR_PROTO ((mpfr_ptr, int, mpfr_exp_t, mpfr_exp_t, - int)); -void data_check _MPFR_PROTO ((const char *, int (*) (FLIST), const char *)); -void bad_cases _MPFR_PROTO ((int (*)(FLIST), int (*)(FLIST), - const char *, int, mpfr_exp_t, mpfr_exp_t, - mpfr_prec_t, mpfr_prec_t, mpfr_prec_t, int)); -void flags_out _MPFR_PROTO ((unsigned int)); +/* Memory handling */ +#define DEFAULT_MEMORY_LIMIT (1UL << 22) +extern size_t tests_memory_limit; +void tests_memory_start (void); +void tests_memory_end (void); + +void tests_start_mpfr (void); +void tests_end_mpfr (void); + +void tests_expect_abort (void); + +int mpfr_set_machine_rnd_mode (mpfr_rnd_t); +void mpfr_test_init (void); +mp_limb_t randlimb (void); +void randseed (unsigned int); +void mpfr_random2 (mpfr_ptr, mp_size_t, mpfr_exp_t, gmp_randstate_t); +int ulp (double, double); +double dbl (double, int); +double Ulp (double); +int Isnan (double); +void d_trace (const char *, double); +void ld_trace (const char *, long double); + +FILE *src_fopen (const char *, const char *); +void set_emin (mpfr_exp_t); +void set_emax (mpfr_exp_t); +void tests_default_random (mpfr_ptr, int, mpfr_exp_t, mpfr_exp_t, + int); +void data_check (const char *, int (*) (FLIST), const char *); +void bad_cases (int (*)(FLIST), int (*)(FLIST), + const char *, int, mpfr_exp_t, mpfr_exp_t, + mpfr_prec_t, mpfr_prec_t, mpfr_prec_t, int); +void flags_out (unsigned int); -int mpfr_cmp_str _MPFR_PROTO ((mpfr_srcptr x, const char *, int, mpfr_rnd_t)); +int mpfr_cmp_str (mpfr_srcptr x, const char *, int, mpfr_rnd_t); #define mpfr_cmp_str1(x,s) mpfr_cmp_str(x,s,10,MPFR_RNDN) #define mpfr_set_str1(x,s) mpfr_set_str(x,s,10,MPFR_RNDN) #define mpfr_cmp0(x,y) (MPFR_ASSERTN (!MPFR_IS_NAN (x) && !MPFR_IS_NAN (y)), mpfr_cmp (x,y)) #define mpfr_cmp_ui0(x,i) (MPFR_ASSERTN (!MPFR_IS_NAN (x)), mpfr_cmp_ui (x,i)) -/* Allocation */ -void *tests_allocate _MPFR_PROTO ((size_t)); -void *tests_reallocate _MPFR_PROTO ((void *, size_t, size_t)); -void tests_free _MPFR_PROTO ((void *, size_t)); - -#if defined (__cplusplus) -} -#endif - /* define CHECK_EXTERNAL if you want to check mpfr against another library with correct rounding. You'll probably have to modify mpfr_print_raw() and/or test_add() below: @@ -136,7 +171,7 @@ return; } - if (MPFR_SIGN (x) < 0) + if (MPFR_IS_NEG (x)) printf ("-"); if (MPFR_IS_INF (x)) @@ -176,4 +211,37 @@ } #endif +extern char *locale; + +/* Random */ +extern char mpfr_rands_initialized; +extern gmp_randstate_t mpfr_rands; + +#undef RANDS +#define RANDS \ + ((mpfr_rands_initialized ? 0 \ + : (mpfr_rands_initialized = 1, \ + gmp_randinit_default (mpfr_rands), 0)), \ + mpfr_rands) + +#undef RANDS_CLEAR +#define RANDS_CLEAR() \ + do { \ + if (mpfr_rands_initialized) \ + { \ + mpfr_rands_initialized = 0; \ + gmp_randclear (mpfr_rands); \ + } \ + } while (0) + +/* Memory Allocation */ +extern int tests_memory_disabled; +void *tests_allocate (size_t); +void *tests_reallocate (void *, size_t, size_t); +void tests_free (void *, size_t); + +#if defined (__cplusplus) +} +#endif + #endif diff -Nru mpfr4-3.1.4/tests/random2.c mpfr4-4.0.2/tests/random2.c --- mpfr4-3.1.4/tests/random2.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/random2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* mpfr_random2 -- Generate a positive random mpfr_t of specified size, with long runs of consecutive ones and zeros in the binary representation. -Copyright 1999, 2001-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-test.h" @@ -30,6 +30,7 @@ #define BITS_PER_RANDCALL 32 #endif +/* exp is the maximum exponent in absolute value */ void mpfr_random2 (mpfr_ptr x, mp_size_t size, mpfr_exp_t exp, gmp_randstate_t rstate) @@ -97,7 +98,7 @@ xp[ri--] = acc | (((mp_limb_t) 2 << bit_pos) - 1); bit_pos += GMP_NUMB_BITS; bit_pos -= nb; - acc = ((~(mp_limb_t) 1) << bit_pos) & GMP_NUMB_MASK; + acc = (~MPFR_LIMB_ONE) << bit_pos; } else { @@ -137,8 +138,9 @@ /* Generate random exponent. */ mpfr_rand_raw (&elimb, RANDS, GMP_NUMB_BITS); - exp = ABS (exp); - MPFR_SET_EXP (x, elimb % (2 * exp + 1) - exp); + MPFR_ASSERTN (exp >= 0 && exp <= MPFR_EMAX_MAX); + exp = (mpfr_exp_t) (elimb % (2 * exp + 1)) - exp; + MPFR_SET_EXP (x, exp); return ; } diff -Nru mpfr4-3.1.4/tests/reuse.c mpfr4-4.0.2/tests/reuse.c --- mpfr4-3.1.4/tests/reuse.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/reuse.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for in-place operations. -Copyright 2000-2016 Free Software Foundation, Inc. +Copyright 2000-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,16 +17,20 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" -#define DISP(s, t) {printf(s); mpfr_out_str(stdout, 2, 0, t, MPFR_RNDN); } -#define DISP2(s,t) {DISP(s,t); putchar('\n');} +#define DISP(s,t) \ + do \ + { \ + printf (s); \ + mpfr_out_str (stdout, 2, 0, t, MPFR_RNDN); \ + } \ + while (0) + +#define DISP2(s,t) do { DISP(s,t); putchar ('\n'); } while (0) #define SPECIAL_MAX 12 @@ -97,8 +101,8 @@ mpfr_t res1; int i; -#ifdef DEBUG - printf("checking %s\n", foo); +#ifdef MPFR_DEBUG + printf ("checking %s\n", foo); #endif mpfr_init2 (ref1, prec); mpfr_init2 (ref2, prec); @@ -121,10 +125,11 @@ if (mpfr_compare (res1, ref1)) { - printf ("Error for %s(a, a, c) for ", foo); + printf ("Error for %s(a, a, c) with %s for ", foo, + mpfr_print_rnd_mode (rnd)); DISP("a=",ref2); DISP2(", c=",ref3); - printf ("expected "); mpfr_print_binary (ref1); puts (""); - printf ("got "); mpfr_print_binary (res1); puts (""); + printf ("expected "); mpfr_dump (ref1); + printf ("got "); mpfr_dump (res1); exit (1); } @@ -149,7 +154,7 @@ { printf ("Error for %s(a, a, a) for ", foo); DISP2("a=",ref2); - DISP("expected ", ref1); DISP2(", got", res1); + DISP("expected ", ref1); DISP2(", got ", res1); exit (1); } } @@ -169,8 +174,8 @@ mpfr_t res; int i, j, k; -#ifdef DEBUG - printf("checking %s\n", foo); +#ifdef MPFR_DEBUG + printf ("checking %s\n", foo); #endif mpfr_init2 (ref, prec); mpfr_init2 (op1, prec); @@ -202,7 +207,7 @@ { printf ("Error for %s(a, a, b, c) for ", foo); DISP("a=", op1); DISP(", b=", op2); DISP2(", c=", op3); - DISP("expected ", ref); DISP2(", got", res); + DISP("expected ", ref); DISP2(", got ", res); exit (1); } @@ -214,7 +219,7 @@ { printf ("Error for %s(a, a, b, c) for ", foo); DISP("a=", op1); DISP(", b=", op2); DISP2(", c=", op3); - DISP("expected ", ref); DISP2(", got", res); + DISP("expected ", ref); DISP2(", got ", res); exit (1); } @@ -226,7 +231,7 @@ { printf ("Error for %s(a, a, b, c) for ", foo); DISP("a=", op1); DISP(", b=", op2); DISP2(", c=", op3); - DISP("expected ", ref); DISP2(", got", res); + DISP("expected ", ref); DISP2(", got ", res); exit (1); } @@ -238,7 +243,7 @@ { printf ("Error for %s(a, a, b, c) for ", foo); DISP("a=", op1); DISP(", a=", op2); DISP2(", c=", op3); - DISP("expected ", ref); DISP2(", got", res); + DISP("expected ", ref); DISP2(", got ", res); exit (1); } @@ -250,7 +255,7 @@ { printf ("Error for %s(a, a, b, c) for ", foo); DISP("a=", op1); DISP(", a=", op2); DISP2(", c=", op3); - DISP("expected ", ref); DISP2(", got", res); + DISP("expected ", ref); DISP2(", got ", res); exit (1); } @@ -262,7 +267,7 @@ { printf ("Error for %s(a, a, b, c) for ", foo); DISP("a=", op1); DISP(", a=", op2); DISP2(", c=", op3); - DISP("expected ", ref); DISP2(", got", res); + DISP("expected ", ref); DISP2(", got ", res); exit (1); } @@ -274,7 +279,7 @@ { printf ("Error for %s(a, a, a, a) for ", foo); DISP2("a=", op1); - DISP("expected ", ref); DISP2(", got", res); + DISP("expected ", ref); DISP2(", got ", res); exit (1); } } @@ -298,8 +303,8 @@ mpfr_t res1; int i; -#ifdef DEBUG - printf("checking %s\n", foo); +#ifdef MPFR_DEBUG + printf ("checking %s\n", foo); #endif mpfr_init2 (ref1, prec); mpfr_init2 (ref2, prec); @@ -323,8 +328,8 @@ { printf ("Error for %s(a, a, c) for c=%u\n", foo, ref3); DISP2("a=",ref2); - printf ("expected "); mpfr_print_binary (ref1); puts (""); - printf ("got "); mpfr_print_binary (res1); puts (""); + printf ("expected "); mpfr_dump (ref1); + printf ("got "); mpfr_dump (res1); exit (1); } } @@ -343,8 +348,8 @@ mpfr_t res1; int i; -#ifdef DEBUG - printf("checking %s\n", foo); +#ifdef MPFR_DEBUG + printf ("checking %s\n", foo); #endif mpfr_init2 (ref1, prec); mpfr_init2 (ref3, prec); @@ -384,8 +389,8 @@ mpfr_t res1; int i; -#ifdef DEBUG - printf("checking %s\n", foo); +#ifdef MPFR_DEBUG + printf ("checking %s\n", foo); #endif mpfr_init2 (ref1, prec); mpfr_init2 (ref2, prec); @@ -424,7 +429,7 @@ mpfr_t res1; int i; -#ifdef DEBUG +#ifdef MPFR_DEBUG printf ("checking %s\n", foo); #endif mpfr_init2 (ref1, prec); @@ -464,7 +469,7 @@ mpfr_t res1, res2; int i; -#ifdef DEBUG +#ifdef MPFR_DEBUG printf ("checking %s\n", foo); #endif mpfr_init2 (ref1, prec); @@ -527,8 +532,8 @@ mpfr_t res1; int i; -#ifdef DEBUG - printf("pow_int\n"); +#ifdef MPFR_DEBUG + printf ("pow_int\n"); #endif mpfr_inits2 ((randlimb () % 200) + MPFR_PREC_MIN, ref1, ref2, res1, (mpfr_ptr) 0); @@ -559,8 +564,8 @@ { printf ("Error for pow_int(a, a, c) for "); DISP("a=",ref2); DISP2(", c=",ref3); - printf ("expected "); mpfr_print_binary (ref1); puts (""); - printf ("got "); mpfr_print_binary (res1); puts (""); + printf ("expected "); mpfr_dump (ref1); + printf ("got "); mpfr_dump (res1); exit (1); } } @@ -571,114 +576,125 @@ int main (void) { - int rnd; + int i, rnd; mpfr_prec_t p; + tests_start_mpfr (); - p = (randlimb () % 200) + MPFR_PREC_MIN; - RND_LOOP (rnd) - { - test2a (mpfr_round, "mpfr_round", p); - test2a (mpfr_ceil, "mpfr_ceil", p); - test2a (mpfr_floor, "mpfr_floor", p); - test2a (mpfr_trunc, "mpfr_trunc", p); - - test2ui (mpfr_add_ui, "mpfr_add_ui", p, (mpfr_rnd_t) rnd); - test2ui (mpfr_div_2exp, "mpfr_div_2exp", p, (mpfr_rnd_t) rnd); - test2ui (mpfr_div_ui, "mpfr_div_ui", p, (mpfr_rnd_t) rnd); - test2ui (mpfr_mul_2exp, "mpfr_mul_2exp", p, (mpfr_rnd_t) rnd); - test2ui (mpfr_mul_ui, "mpfr_mul_ui", p, (mpfr_rnd_t) rnd); - test2ui (mpfr_pow_ui, "mpfr_pow_ui", p, (mpfr_rnd_t) rnd); - test2ui (mpfr_sub_ui, "mpfr_sub_ui", p, (mpfr_rnd_t) rnd); - - testui2 (mpfr_ui_div, "mpfr_ui_div", p, (mpfr_rnd_t) rnd); - testui2 (mpfr_ui_sub, "mpfr_ui_sub", p, (mpfr_rnd_t) rnd); - testui2 (mpfr_ui_pow, "mpfr_ui_pow", p, (mpfr_rnd_t) rnd); - - test2 (mpfr_sqr, "mpfr_sqr", p, (mpfr_rnd_t) rnd); - test2 (mpfr_sqrt, "mpfr_sqrt", p, (mpfr_rnd_t) rnd); - test2 (mpfr_abs, "mpfr_abs", p, (mpfr_rnd_t) rnd); - test2 (mpfr_neg, "mpfr_neg", p, (mpfr_rnd_t) rnd); - - test2 (mpfr_log, "mpfr_log", p, (mpfr_rnd_t) rnd); - test2 (mpfr_log2, "mpfr_log2", p, (mpfr_rnd_t) rnd); - test2 (mpfr_log10, "mpfr_log10", p, (mpfr_rnd_t) rnd); - test2 (mpfr_log1p, "mpfr_log1p", p, (mpfr_rnd_t) rnd); - - test2 (mpfr_exp, "mpfr_exp", p, (mpfr_rnd_t) rnd); - test2 (mpfr_exp2, "mpfr_exp2", p, (mpfr_rnd_t) rnd); - test2 (mpfr_exp10, "mpfr_exp10", p, (mpfr_rnd_t) rnd); - test2 (mpfr_expm1, "mpfr_expm1", p, (mpfr_rnd_t) rnd); - test2 (mpfr_eint, "mpfr_eint", p, (mpfr_rnd_t) rnd); - - test2 (mpfr_sinh, "mpfr_sinh", p, (mpfr_rnd_t) rnd); - test2 (mpfr_cosh, "mpfr_cosh", p, (mpfr_rnd_t) rnd); - test2 (mpfr_tanh, "mpfr_tanh", p, (mpfr_rnd_t) rnd); - test2 (mpfr_asinh, "mpfr_asinh", p, (mpfr_rnd_t) rnd); - test2 (mpfr_acosh, "mpfr_acosh", p, (mpfr_rnd_t) rnd); - test2 (mpfr_atanh, "mpfr_atanh", p, (mpfr_rnd_t) rnd); - test2 (mpfr_sech, "mpfr_sech", p, (mpfr_rnd_t) rnd); - test2 (mpfr_csch, "mpfr_csch", p, (mpfr_rnd_t) rnd); - test2 (mpfr_coth, "mpfr_coth", p, (mpfr_rnd_t) rnd); - - test2 (mpfr_asin, "mpfr_asin", p, (mpfr_rnd_t) rnd); - test2 (mpfr_acos, "mpfr_acos", p, (mpfr_rnd_t) rnd); - test2 (mpfr_atan, "mpfr_atan", p, (mpfr_rnd_t) rnd); - test2 (mpfr_cos, "mpfr_cos", p, (mpfr_rnd_t) rnd); - test2 (mpfr_sin, "mpfr_sin", p, (mpfr_rnd_t) rnd); - test2 (mpfr_tan, "mpfr_tan", p, (mpfr_rnd_t) rnd); - test2 (mpfr_sec, "mpfr_sec", p, (mpfr_rnd_t) rnd); - test2 (mpfr_csc, "mpfr_csc", p, (mpfr_rnd_t) rnd); - test2 (mpfr_cot, "mpfr_cot", p, (mpfr_rnd_t) rnd); - - test2 (mpfr_erf, "mpfr_erf", p, (mpfr_rnd_t) rnd); - test2 (mpfr_erfc, "mpfr_erfc", p, (mpfr_rnd_t) rnd); - test2 (mpfr_j0, "mpfr_j0", p, (mpfr_rnd_t) rnd); - test2 (mpfr_j1, "mpfr_j1", p, (mpfr_rnd_t) rnd); - test2 (mpfr_y0, "mpfr_y0", p, (mpfr_rnd_t) rnd); - test2 (mpfr_y1, "mpfr_y1", p, (mpfr_rnd_t) rnd); - test2 (mpfr_zeta, "mpfr_zeta", p, (mpfr_rnd_t) rnd); - test2 (mpfr_gamma, "mpfr_gamma", p, (mpfr_rnd_t) rnd); - test2 (mpfr_lngamma, "mpfr_lngamma", p, (mpfr_rnd_t) rnd); - - test2 (mpfr_rint, "mpfr_rint", p, (mpfr_rnd_t) rnd); - test2 (mpfr_rint_ceil, "mpfr_rint_ceil", p, (mpfr_rnd_t) rnd); - test2 (mpfr_rint_floor, "mpfr_rint_floor", p, (mpfr_rnd_t) rnd); - test2 (mpfr_rint_round, "mpfr_rint_round", p, (mpfr_rnd_t) rnd); - test2 (mpfr_rint_trunc, "mpfr_rint_trunc", p, (mpfr_rnd_t) rnd); - test2 (mpfr_frac, "mpfr_frac", p, (mpfr_rnd_t) rnd); - - test3 (mpfr_add, "mpfr_add", p, (mpfr_rnd_t) rnd); - test3 (mpfr_sub, "mpfr_sub", p, (mpfr_rnd_t) rnd); - test3 (mpfr_mul, "mpfr_mul", p, (mpfr_rnd_t) rnd); - test3 (mpfr_div, "mpfr_div", p, (mpfr_rnd_t) rnd); - - test3 (mpfr_agm, "mpfr_agm", p, (mpfr_rnd_t) rnd); - test3 (mpfr_min, "mpfr_min", p, (mpfr_rnd_t) rnd); - test3 (mpfr_max, "mpfr_max", p, (mpfr_rnd_t) rnd); - - test3 (reldiff_wrapper, "mpfr_reldiff", p, (mpfr_rnd_t) rnd); - test3 (mpfr_dim, "mpfr_dim", p, (mpfr_rnd_t) rnd); - - test3 (mpfr_remainder, "mpfr_remainder", p, (mpfr_rnd_t) rnd); - test3 (mpfr_pow, "mpfr_pow", p, (mpfr_rnd_t) rnd); - pow_int ((mpfr_rnd_t) rnd); - test3 (mpfr_atan2, "mpfr_atan2", p, (mpfr_rnd_t) rnd); - test3 (mpfr_hypot, "mpfr_hypot", p, (mpfr_rnd_t) rnd); - - test3a (mpfr_sin_cos, "mpfr_sin_cos", p, (mpfr_rnd_t) rnd); - - test4 (mpfr_fma, "mpfr_fma", p, (mpfr_rnd_t) rnd); - test4 (mpfr_fms, "mpfr_fms", p, (mpfr_rnd_t) rnd); - -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) - test2 (mpfr_li2, "mpfr_li2", p, (mpfr_rnd_t) rnd); - test2 (mpfr_rec_sqrt, "mpfr_rec_sqrt", p, (mpfr_rnd_t) rnd); - test3 (mpfr_fmod, "mpfr_fmod", p, (mpfr_rnd_t) rnd); - test3a (mpfr_modf, "mpfr_modf", p, (mpfr_rnd_t) rnd); - test3a (mpfr_sinh_cosh, "mpfr_sinh_cosh", p, (mpfr_rnd_t) rnd); + for (i = 1; i <= 5; i++) + { + /* Test on i limb(s), with a random number of trailing bits. */ + p = GMP_NUMB_BITS * i - (randlimb () % GMP_NUMB_BITS); + if (p < MPFR_PREC_MIN) + p = MPFR_PREC_MIN; + + RND_LOOP (rnd) + { + test2a (mpfr_round, "mpfr_round", p); + test2a (mpfr_ceil, "mpfr_ceil", p); + test2a (mpfr_floor, "mpfr_floor", p); + test2a (mpfr_trunc, "mpfr_trunc", p); + + test2ui (mpfr_add_ui, "mpfr_add_ui", p, (mpfr_rnd_t) rnd); + test2ui (mpfr_div_2exp, "mpfr_div_2exp", p, (mpfr_rnd_t) rnd); + test2ui (mpfr_div_ui, "mpfr_div_ui", p, (mpfr_rnd_t) rnd); + test2ui (mpfr_mul_2exp, "mpfr_mul_2exp", p, (mpfr_rnd_t) rnd); + test2ui (mpfr_mul_ui, "mpfr_mul_ui", p, (mpfr_rnd_t) rnd); + test2ui (mpfr_pow_ui, "mpfr_pow_ui", p, (mpfr_rnd_t) rnd); + test2ui (mpfr_sub_ui, "mpfr_sub_ui", p, (mpfr_rnd_t) rnd); + + testui2 (mpfr_ui_div, "mpfr_ui_div", p, (mpfr_rnd_t) rnd); + testui2 (mpfr_ui_sub, "mpfr_ui_sub", p, (mpfr_rnd_t) rnd); + testui2 (mpfr_ui_pow, "mpfr_ui_pow", p, (mpfr_rnd_t) rnd); + + test2 (mpfr_sqr, "mpfr_sqr", p, (mpfr_rnd_t) rnd); + test2 (mpfr_sqrt, "mpfr_sqrt", p, (mpfr_rnd_t) rnd); + test2 (mpfr_abs, "mpfr_abs", p, (mpfr_rnd_t) rnd); + test2 (mpfr_neg, "mpfr_neg", p, (mpfr_rnd_t) rnd); + + test2 (mpfr_log, "mpfr_log", p, (mpfr_rnd_t) rnd); + test2 (mpfr_log2, "mpfr_log2", p, (mpfr_rnd_t) rnd); + test2 (mpfr_log10, "mpfr_log10", p, (mpfr_rnd_t) rnd); + test2 (mpfr_log1p, "mpfr_log1p", p, (mpfr_rnd_t) rnd); + + test2 (mpfr_exp, "mpfr_exp", p, (mpfr_rnd_t) rnd); + test2 (mpfr_exp2, "mpfr_exp2", p, (mpfr_rnd_t) rnd); + test2 (mpfr_exp10, "mpfr_exp10", p, (mpfr_rnd_t) rnd); + test2 (mpfr_expm1, "mpfr_expm1", p, (mpfr_rnd_t) rnd); + test2 (mpfr_eint, "mpfr_eint", p, (mpfr_rnd_t) rnd); + + test2 (mpfr_sinh, "mpfr_sinh", p, (mpfr_rnd_t) rnd); + test2 (mpfr_cosh, "mpfr_cosh", p, (mpfr_rnd_t) rnd); + test2 (mpfr_tanh, "mpfr_tanh", p, (mpfr_rnd_t) rnd); + test2 (mpfr_asinh, "mpfr_asinh", p, (mpfr_rnd_t) rnd); + test2 (mpfr_acosh, "mpfr_acosh", p, (mpfr_rnd_t) rnd); + test2 (mpfr_atanh, "mpfr_atanh", p, (mpfr_rnd_t) rnd); + test2 (mpfr_sech, "mpfr_sech", p, (mpfr_rnd_t) rnd); + test2 (mpfr_csch, "mpfr_csch", p, (mpfr_rnd_t) rnd); + test2 (mpfr_coth, "mpfr_coth", p, (mpfr_rnd_t) rnd); + + test2 (mpfr_asin, "mpfr_asin", p, (mpfr_rnd_t) rnd); + test2 (mpfr_acos, "mpfr_acos", p, (mpfr_rnd_t) rnd); + test2 (mpfr_atan, "mpfr_atan", p, (mpfr_rnd_t) rnd); + test2 (mpfr_cos, "mpfr_cos", p, (mpfr_rnd_t) rnd); + test2 (mpfr_sin, "mpfr_sin", p, (mpfr_rnd_t) rnd); + test2 (mpfr_tan, "mpfr_tan", p, (mpfr_rnd_t) rnd); + test2 (mpfr_sec, "mpfr_sec", p, (mpfr_rnd_t) rnd); + test2 (mpfr_csc, "mpfr_csc", p, (mpfr_rnd_t) rnd); + test2 (mpfr_cot, "mpfr_cot", p, (mpfr_rnd_t) rnd); + + test2 (mpfr_erf, "mpfr_erf", p, (mpfr_rnd_t) rnd); + test2 (mpfr_erfc, "mpfr_erfc", p, (mpfr_rnd_t) rnd); + test2 (mpfr_j0, "mpfr_j0", p, (mpfr_rnd_t) rnd); + test2 (mpfr_j1, "mpfr_j1", p, (mpfr_rnd_t) rnd); + test2 (mpfr_y0, "mpfr_y0", p, (mpfr_rnd_t) rnd); + test2 (mpfr_y1, "mpfr_y1", p, (mpfr_rnd_t) rnd); + test2 (mpfr_zeta, "mpfr_zeta", p, (mpfr_rnd_t) rnd); + test2 (mpfr_gamma, "mpfr_gamma", p, (mpfr_rnd_t) rnd); + test2 (mpfr_lngamma, "mpfr_lngamma", p, (mpfr_rnd_t) rnd); + + test2 (mpfr_rint, "mpfr_rint", p, (mpfr_rnd_t) rnd); + test2 (mpfr_rint_ceil, "mpfr_rint_ceil", p, (mpfr_rnd_t) rnd); + test2 (mpfr_rint_floor, "mpfr_rint_floor", p, (mpfr_rnd_t) rnd); + test2 (mpfr_rint_round, "mpfr_rint_round", p, (mpfr_rnd_t) rnd); + test2 (mpfr_rint_trunc, "mpfr_rint_trunc", p, (mpfr_rnd_t) rnd); + test2 (mpfr_frac, "mpfr_frac", p, (mpfr_rnd_t) rnd); + + test3 (mpfr_add, "mpfr_add", p, (mpfr_rnd_t) rnd); + test3 (mpfr_sub, "mpfr_sub", p, (mpfr_rnd_t) rnd); + test3 (mpfr_mul, "mpfr_mul", p, (mpfr_rnd_t) rnd); + test3 (mpfr_div, "mpfr_div", p, (mpfr_rnd_t) rnd); + + test3 (mpfr_agm, "mpfr_agm", p, (mpfr_rnd_t) rnd); + test3 (mpfr_min, "mpfr_min", p, (mpfr_rnd_t) rnd); + test3 (mpfr_max, "mpfr_max", p, (mpfr_rnd_t) rnd); + + test3 (reldiff_wrapper, "mpfr_reldiff", p, (mpfr_rnd_t) rnd); + test3 (mpfr_dim, "mpfr_dim", p, (mpfr_rnd_t) rnd); + + test3 (mpfr_remainder, "mpfr_remainder", p, (mpfr_rnd_t) rnd); + test3 (mpfr_pow, "mpfr_pow", p, (mpfr_rnd_t) rnd); + pow_int ((mpfr_rnd_t) rnd); + test3 (mpfr_atan2, "mpfr_atan2", p, (mpfr_rnd_t) rnd); + test3 (mpfr_hypot, "mpfr_hypot", p, (mpfr_rnd_t) rnd); + + test3a (mpfr_sin_cos, "mpfr_sin_cos", p, (mpfr_rnd_t) rnd); + + test4 (mpfr_fma, "mpfr_fma", p, (mpfr_rnd_t) rnd); + test4 (mpfr_fms, "mpfr_fms", p, (mpfr_rnd_t) rnd); + + test2 (mpfr_li2, "mpfr_li2", p, (mpfr_rnd_t) rnd); + test2 (mpfr_rec_sqrt, "mpfr_rec_sqrt", p, (mpfr_rnd_t) rnd); + test3 (mpfr_fmod, "mpfr_fmod", p, (mpfr_rnd_t) rnd); + test3a (mpfr_modf, "mpfr_modf", p, (mpfr_rnd_t) rnd); + test3a (mpfr_sinh_cosh, "mpfr_sinh_cosh", p, (mpfr_rnd_t) rnd); + +#if MPFR_VERSION >= MPFR_VERSION_NUM(3,0,0) + test2 (mpfr_ai, "mpfr_ai", p, (mpfr_rnd_t) rnd); + test2 (mpfr_digamma, "mpfr_digamma", p, (mpfr_rnd_t) rnd); #endif - } + } + } tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/rnd_mode.c mpfr4-4.0.2/tests/rnd_mode.c --- mpfr4-3.1.4/tests/rnd_mode.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/rnd_mode.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_set_machine_rnd_mode -- set the rounding mode for machine floats -Copyright 1999, 2001-2002, 2006-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2002, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-test.h" diff -Nru mpfr4-3.1.4/tests/tabort_defalloc1.c mpfr4-4.0.2/tests/tabort_defalloc1.c --- mpfr4-3.1.4/tests/tabort_defalloc1.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/tabort_defalloc1.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,58 @@ +/* tabort_defalloc1 -- Test for abort due to reaching out of memory + +Copyright 2012-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define MPFR_NEED_LONGLONG_H +#include "mpfr-test.h" + +/* Don't test with mini-gmp, which does not fully implement GMP + * memory functions. + * + * Don't test if GCC's AddressSanitizer is used because it reports + * the error before GMP can do the abort. + */ + +#if !defined(__SANITIZE_ADDRESS__) + +int +main (int argc, char **argv) +{ + tests_start_mpfr (); + tests_expect_abort (); + + printf ("[tabort_defalloc1] Check for good handling of abort" + " in memory function.\n"); + mpfr_allocate_func ((size_t) -1); + + tests_end_mpfr (); + return -1; /* Should not be executed */ +} + +#else /* don't test with mini-gmp, which does not fully implement GMP + memory functions */ + +int +main (void) +{ + return 77; +} + +#endif diff -Nru mpfr4-3.1.4/tests/tabort_defalloc2.c mpfr4-4.0.2/tests/tabort_defalloc2.c --- mpfr4-3.1.4/tests/tabort_defalloc2.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/tabort_defalloc2.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,60 @@ +/* tabort_defalloc2 -- Test for abort due to reaching out of memory + +Copyright 2012-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define MPFR_NEED_LONGLONG_H +#include "mpfr-test.h" + +/* Don't test with mini-gmp, which does not fully implement GMP + * memory functions. + * + * Don't test if GCC's AddressSanitizer is used because it reports + * the error before GMP can do the abort. + */ + +#if !defined(__SANITIZE_ADDRESS__) + +int +main (int argc, char **argv) +{ + void *ptr; + + tests_start_mpfr (); + tests_expect_abort (); + + printf ("[tabort_defalloc2] Check for good handling of abort" + " in memory function.\n"); + ptr = mpfr_allocate_func (128); + ptr = mpfr_reallocate_func (ptr, 128, (size_t) -1); + + tests_end_mpfr (); + return -1; /* Should not be executed */ +} + +#else + +int +main (void) +{ + return 77; +} + +#endif diff -Nru mpfr4-3.1.4/tests/tabort_prec_max.c mpfr4-4.0.2/tests/tabort_prec_max.c --- mpfr4-3.1.4/tests/tabort_prec_max.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/tabort_prec_max.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,39 @@ +/* tabort_prec_max -- Test for abort termination due to reaching prec max + +Copyright 2012-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define MPFR_NEED_LONGLONG_H +#include "mpfr-test.h" + +int +main (int argc, char **argv) +{ + tests_start_mpfr (); + tests_expect_abort (); + + printf ("[tabort_prec_max] Check for good handling of abort" + " in memory function.\n"); + + mpfr_abort_prec_max (); + + tests_end_mpfr (); + return -1; /* Should not be executed */ +} diff -Nru mpfr4-3.1.4/tests/tabs.c mpfr4-4.0.2/tests/tabs.c --- mpfr4-3.1.4/tests/tabs.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tabs.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_abs. -Copyright 2000-2016 Free Software Foundation, Inc. +Copyright 2000-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include #include "mpfr-test.h" @@ -53,7 +51,7 @@ for (q=2; q<2*p; q++) { mpfr_set_prec (y, q); - RND_LOOP (rnd) + RND_LOOP_NO_RNDF (rnd) { inexact = mpfr_abs (y, x, (mpfr_rnd_t) rnd); cmp = mpfr_cmp (y, absx); @@ -61,11 +59,12 @@ ((inexact > 0) && (cmp <= 0)) || ((inexact < 0) && (cmp >= 0))) { - printf ("Wrong inexact flag: expected %d, got %d\n", - cmp, inexact); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("absx="); mpfr_print_binary (absx); puts (""); - printf ("y="); mpfr_print_binary (y); puts (""); + printf ("Wrong inexact flag for %s: expected %d, got %d\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), cmp, + inexact); + printf ("x="); mpfr_dump (x); + printf ("absx="); mpfr_dump (absx); + printf ("y="); mpfr_dump (y); exit (1); } } @@ -81,62 +80,144 @@ check_cmp (int argc, char *argv[]) { mpfr_t x, y; + mpfr_ptr p[2]; + int inexact; int n, k; mpfr_inits2 (53, x, y, (mpfr_ptr) 0); - mpfr_set_ui(x, 1, MPFR_RNDN); - (mpfr_abs) (x, x, MPFR_RNDN); - if (mpfr_cmp_ui (x, 1)) - { - printf ("Error in mpfr_abs(1.0)\n"); - exit (1); - } + /* will test with DEST != SRC and with DEST == SRC */ + p[0] = y; /* y first */ + p[1] = x; /* x last since it may be modified */ + + for (k = 0; k <= 1; k++) + { + mpfr_set_nan (p[k]); + mpfr_set_ui (x, 1, MPFR_RNDN); + inexact = mpfr_abs (p[k], x, MPFR_RNDN); + if (mpfr_cmp_ui (p[k], 1) || inexact != 0) + { + printf ("Error in mpfr_abs(1.0) for k = %d\n", k); + exit (1); + } - mpfr_set_si(x, -1, MPFR_RNDN); - mpfr_abs(x, x, MPFR_RNDN); - if (mpfr_cmp_ui (x, 1)) - { - printf ("Error in mpfr_abs(1.0)\n"); - exit (1); - } + mpfr_set_nan (p[k]); + mpfr_set_ui (x, 1, MPFR_RNDN); + inexact = (mpfr_abs) (p[k], x, MPFR_RNDN); + if (mpfr_cmp_ui (p[k], 1) || inexact != 0) + { + printf ("Error in (mpfr_abs)(1.0) for k = %d\n", k); + exit (1); + } - mpfr_set_si(x, -1, MPFR_RNDN); - mpfr_abs(x, x, MPFR_RNDN); - if (mpfr_cmp_ui (x, 1)) - { - printf ("Error in mpfr_abs(-1.0)\n"); - exit (1); - } + mpfr_set_nan (p[k]); + mpfr_set_si (x, -1, MPFR_RNDN); + inexact = mpfr_abs (p[k], x, MPFR_RNDN); + if (mpfr_cmp_ui (p[k], 1) || inexact != 0) + { + printf ("Error in mpfr_abs(-1.0) for k = %d\n", k); + exit (1); + } - mpfr_set_inf (x, 1); - mpfr_abs (x, x, MPFR_RNDN); - if (!mpfr_inf_p(x) || (mpfr_sgn(x) <= 0)) - { - printf ("Error in mpfr_abs(Inf).\n"); - exit (1); - } - mpfr_set_inf (x, -1); - mpfr_abs (x, x, MPFR_RNDN); - if (!mpfr_inf_p(x) || (mpfr_sgn(x) <= 0)) - { - printf ("Error in mpfr_abs(-Inf).\n"); - exit (1); - } + mpfr_set_nan (p[k]); + mpfr_set_si (x, -1, MPFR_RNDN); + inexact = (mpfr_abs) (p[k], x, MPFR_RNDN); + if (mpfr_cmp_ui (p[k], 1) || inexact != 0) + { + printf ("Error in (mpfr_abs)(-1.0) for k = %d\n", k); + exit (1); + } - MPFR_SET_NAN(x); - mpfr_abs (x, x, MPFR_RNDN); - if (!MPFR_IS_NAN(x)) - { - printf ("Error in mpfr_abs(NAN).\n"); - exit (1); + mpfr_set_nan (p[k]); + mpfr_set_inf (x, 1); + inexact = mpfr_abs (p[k], x, MPFR_RNDN); + if (! mpfr_inf_p (p[k]) || mpfr_sgn (p[k]) <= 0 || inexact != 0) + { + printf ("Error in mpfr_abs(Inf) for k = %d\n", k); + exit (1); + } + + mpfr_set_nan (p[k]); + mpfr_set_inf (x, 1); + inexact = (mpfr_abs) (p[k], x, MPFR_RNDN); + if (! mpfr_inf_p (p[k]) || mpfr_sgn (p[k]) <= 0 || inexact != 0) + { + printf ("Error in (mpfr_abs)(Inf) for k = %d\n", k); + exit (1); + } + + mpfr_set_nan (p[k]); + mpfr_set_inf (x, -1); + inexact = mpfr_abs (p[k], x, MPFR_RNDN); + if (! mpfr_inf_p (p[k]) || mpfr_sgn (p[k]) <= 0 || inexact != 0) + { + printf ("Error in mpfr_abs(-Inf) for k = %d\n", k); + exit (1); + } + + mpfr_set_nan (p[k]); + mpfr_set_inf (x, -1); + inexact = (mpfr_abs) (p[k], x, MPFR_RNDN); + if (! mpfr_inf_p (p[k]) || mpfr_sgn (p[k]) <= 0 || inexact != 0) + { + printf ("Error in (mpfr_abs)(-Inf) for k = %d\n", k); + exit (1); + } + + mpfr_set_zero (p[k], 1); + MPFR_SET_NAN (x); + MPFR_SET_POS (x); + mpfr_clear_nanflag (); + inexact = mpfr_abs (p[k], x, MPFR_RNDN); + if (! MPFR_IS_NAN (p[k]) || ! mpfr_nanflag_p () || + mpfr_signbit (p[k]) || inexact != 0) + { + printf ("Error in mpfr_abs(+NaN).\n"); + exit (1); + } + + mpfr_set_zero (p[k], 1); + MPFR_SET_NAN (x); + MPFR_SET_POS (x); + mpfr_clear_nanflag (); + inexact = (mpfr_abs) (p[k], x, MPFR_RNDN); + if (! MPFR_IS_NAN (p[k]) || ! mpfr_nanflag_p () || + mpfr_signbit (p[k]) || inexact != 0) + { + printf ("Error in (mpfr_abs)(+NaN).\n"); + exit (1); + } + + mpfr_set_zero (p[k], 1); + MPFR_SET_NAN (x); + MPFR_SET_NEG (x); + mpfr_clear_nanflag (); + inexact = mpfr_abs (p[k], x, MPFR_RNDN); + if (! MPFR_IS_NAN (p[k]) || ! mpfr_nanflag_p () || + mpfr_signbit (p[k]) || inexact != 0) + { + printf ("Error in mpfr_abs(-NaN).\n"); + exit (1); + } + + mpfr_set_zero (p[k], 1); + MPFR_SET_NAN (x); + MPFR_SET_NEG (x); + mpfr_clear_nanflag (); + inexact = (mpfr_abs) (p[k], x, MPFR_RNDN); + if (! MPFR_IS_NAN (p[k]) || ! mpfr_nanflag_p () || + mpfr_signbit (p[k]) || inexact != 0) + { + printf ("Error in (mpfr_abs)(-NaN).\n"); + exit (1); + } } n = (argc==1) ? 25000 : atoi(argv[1]); for (k = 1; k <= n; k++) { mpfr_rnd_t rnd; - int sign = SIGN_RAND (); + int sign = RAND_SIGN (); mpfr_urandomb (x, RANDS); MPFR_SET_SIGN (x, sign); @@ -146,10 +227,9 @@ if (mpfr_cmp (x, y)) { printf ("Mismatch for sign=%d and x=", sign); - mpfr_print_binary (x); - printf ("\nResults="); - mpfr_print_binary (y); - putchar ('\n'); + mpfr_dump (x); + printf ("Results="); + mpfr_dump (y); exit (1); } } @@ -163,13 +243,12 @@ int main (int argc, char *argv[]) { - mpfr_test_init (); tests_start_mpfr (); check_inexact (); check_cmp (argc, argv); - test_generic (2, 1000, 10); + test_generic (MPFR_PREC_MIN, 1000, 10); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tacos.c mpfr4-4.0.2/tests/tacos.c --- mpfr4-3.1.4/tests/tacos.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tacos.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_acos. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_acos @@ -52,7 +49,7 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_acos (2)\n"); - mpfr_print_binary (y); printf ("\n"); + mpfr_dump (y); exit (1); } @@ -139,7 +136,7 @@ /* acos (1) = 0 */ mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_acos (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) + if (MPFR_NOTZERO (y) || MPFR_IS_NEG (y)) { printf ("Error: acos(1) != +0.0\n"); exit (1); @@ -174,7 +171,7 @@ } } - test_generic (2, 100, 7); + test_generic (MPFR_PREC_MIN, 100, 7); mpfr_clear (x); mpfr_clear (y); diff -Nru mpfr4-3.1.4/tests/tacosh.c mpfr4-4.0.2/tests/tacosh.c --- mpfr4-3.1.4/tests/tacosh.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tacosh.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_acosh. -Copyright 2001-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2001-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_acosh @@ -207,8 +204,8 @@ bug20070831 (); huge (); - test_generic (2, 100, 25); - test_generic_huge (2, 100, 5); + test_generic (MPFR_PREC_MIN, 100, 25); + test_generic_huge (MPFR_PREC_MIN, 100, 5); data_check ("data/acosh", mpfr_acosh, "mpfr_acosh"); bad_cases (mpfr_acosh, mpfr_cosh, "mpfr_acosh", 0, -128, 29, diff -Nru mpfr4-3.1.4/tests/tadd1sp.c mpfr4-4.0.2/tests/tadd1sp.c --- mpfr4-3.1.4/tests/tadd1sp.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tadd1sp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_add1sp. -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void check_special (void); @@ -57,6 +54,170 @@ set_emax (emax); } +static void +bug20171217 (void) +{ + mpfr_t a, b, c; + + mpfr_init2 (a, 137); + mpfr_init2 (b, 137); + mpfr_init2 (c, 137); + mpfr_set_str_binary (b, "0.11111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000E-66"); + mpfr_set_str_binary (c, "0.11111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000110000E-2"); + mpfr_add (a, b, c, MPFR_RNDN); + mpfr_set_str_binary (b, "0.10000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000001000E-1"); + MPFR_ASSERTN(mpfr_equal_p (a, b)); + mpfr_clear (a); + mpfr_clear (b); + mpfr_clear (c); +} + +/* Check corner case b = 1, c = 2^(-p) for MPFR_PREC_MIN <= p <= pmax. + With RNDN, result is 1, except for p=1, where it is 2. */ +static void +test_corner_1 (mpfr_prec_t pmax) +{ + mpfr_prec_t p; + + for (p = MPFR_PREC_MIN; p <= pmax; p++) + { + mpfr_t a, b, c; + int inex; + mpfr_init2 (a, p); + mpfr_init2 (b, p); + mpfr_init2 (c, p); + mpfr_set_ui (b, 1, MPFR_RNDN); + mpfr_set_ui_2exp (c, 1, -p, MPFR_RNDN); + inex = mpfr_add (a, b, c, MPFR_RNDN); + if (p == 1) /* special case, since 2^(p-1) is odd */ + { + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui (a, 2) == 0); + } + else + { + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_cmp_ui (a, 1) == 0); + } + mpfr_clear (a); + mpfr_clear (b); + mpfr_clear (c); + } +} + +static void +coverage (void) +{ + mpfr_t a, b, c; + int inex; + mpfr_exp_t emax; + + /* coverage test in mpfr_add1sp1n: case round away, where add_one_ulp + gives a carry, and the new exponent is below emax */ + mpfr_init2 (a, GMP_NUMB_BITS); + mpfr_init2 (b, GMP_NUMB_BITS); + mpfr_init2 (c, GMP_NUMB_BITS); + mpfr_set_ui (b, 1, MPFR_RNDN); + mpfr_nextbelow (b); /* b = 1 - 2^(-p) */ + mpfr_set_ui_2exp (c, 1, -GMP_NUMB_BITS-1, MPFR_RNDN); + /* c = 2^(-p-1) thus b+c = 1 - 2^(-p-1) should be rounded to 1 */ + inex = mpfr_add (a, b, c, MPFR_RNDU); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui (a, 1) == 0); + + /* coverage test in mpfr_add1sp2: case GMP_NUMB_BITS <= d < 2*GMP_NUMB_BITS + and a1 = 0 */ + mpfr_set_prec (a, GMP_NUMB_BITS + 2); + mpfr_set_prec (b, GMP_NUMB_BITS + 2); + mpfr_set_prec (c, GMP_NUMB_BITS + 2); + mpfr_set_ui (b, 1, MPFR_RNDN); + mpfr_nextbelow (b); /* b = 1 - 2^(-p) with p = GMP_NUMB_BITS+2 */ + mpfr_set_ui_2exp (c, 1, -GMP_NUMB_BITS-1, MPFR_RNDN); + mpfr_nextbelow (c); /* c = 2^(1-p) - 2^(1-2p) */ + /* a = 1 + 2^(-p) - 2^(1-2p) should be rounded to 1 with RNDN */ + inex = mpfr_add (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_cmp_ui (a, 1) == 0); + + /* coverage test in mpfr_add1sp2: case round away, where add_one_ulp + gives a carry, and the new exponent is below emax */ + mpfr_set_prec (a, GMP_NUMB_BITS + 1); + mpfr_set_prec (b, GMP_NUMB_BITS + 1); + mpfr_set_prec (c, GMP_NUMB_BITS + 1); + mpfr_set_ui (b, 1, MPFR_RNDN); + mpfr_nextbelow (b); /* b = 1 - 2^(-p) */ + mpfr_set_ui_2exp (c, 1, -GMP_NUMB_BITS-2, MPFR_RNDN); + /* c = 2^(-p-1) */ + inex = mpfr_add (a, b, c, MPFR_RNDU); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui (a, 1) == 0); + + /* coverage test in mpfr_add1sp3: case GMP_NUMB_BITS <= d < 2*GMP_NUMB_BITS + and a2 == 0 */ + mpfr_set_prec (a, 2 * GMP_NUMB_BITS + 2); + mpfr_set_prec (b, 2 * GMP_NUMB_BITS + 2); + mpfr_set_prec (c, 2 * GMP_NUMB_BITS + 2); + mpfr_set_ui (b, 1, MPFR_RNDN); + mpfr_nextbelow (b); /* b = 1 - 2^(-p) with p = 2*GMP_NUMB_BITS+2 */ + mpfr_set_ui_2exp (c, 1, -2*GMP_NUMB_BITS-1, MPFR_RNDN); + mpfr_nextbelow (c); /* c = 2^(1-p) - 2^(1-2p) */ + /* a = 1 + 2^(-p) - 2^(1-2p) should be rounded to 1 with RNDN */ + inex = mpfr_add (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_cmp_ui (a, 1) == 0); + + /* coverage test in mpfr_add1sp3: case bx > emax */ + emax = mpfr_get_emax (); + mpfr_set_emax (1); + mpfr_set_prec (a, 2 * GMP_NUMB_BITS + 1); + mpfr_set_prec (b, 2 * GMP_NUMB_BITS + 1); + mpfr_set_prec (c, 2 * GMP_NUMB_BITS + 1); + mpfr_set_ui_2exp (b, 1, mpfr_get_emax () - 1, MPFR_RNDN); + mpfr_nextbelow (b); + mpfr_mul_2exp (b, b, 1, MPFR_RNDN); + /* now b is the largest number < +Inf */ + mpfr_div_2exp (c, b, GMP_NUMB_BITS - 1, MPFR_RNDN); + /* we are in the case d < GMP_NUMB_BITS of mpfr_add1sp3 */ + inex = mpfr_add (a, b, b, MPFR_RNDU); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_inf_p (a) && mpfr_sgn (a) > 0); + mpfr_set_emax (emax); + + /* coverage test in mpfr_add1sp3: case round away, where add_one_ulp gives + a carry, no overflow */ + mpfr_set_prec (a, 2 * GMP_NUMB_BITS + 1); + mpfr_set_prec (b, 2 * GMP_NUMB_BITS + 1); + mpfr_set_prec (c, 2 * GMP_NUMB_BITS + 1); + mpfr_set_ui (b, 1, MPFR_RNDN); + mpfr_nextbelow (b); /* b = 1 - 2^(-p) */ + mpfr_set_ui_2exp (c, 1, -2 * GMP_NUMB_BITS - 2, MPFR_RNDN); + /* c = 2^(-p-1) */ + inex = mpfr_add (a, b, c, MPFR_RNDU); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui (a, 1) == 0); + + /* coverage test in mpfr_add1sp3: case round away, where add_one_ulp gives + a carry, with overflow */ + emax = mpfr_get_emax (); + mpfr_set_emax (1); + mpfr_set_prec (a, 2 * GMP_NUMB_BITS + 1); + mpfr_set_prec (b, 2 * GMP_NUMB_BITS + 1); + mpfr_set_prec (c, 2 * GMP_NUMB_BITS + 1); + mpfr_set_ui_2exp (b, 1, mpfr_get_emax () - 1, MPFR_RNDN); + mpfr_nextbelow (b); + mpfr_mul_2exp (b, b, 1, MPFR_RNDN); + /* now b is the largest number < +Inf */ + mpfr_set_ui_2exp (c, 1, mpfr_get_emin () - 1, MPFR_RNDN); + inex = mpfr_add (a, b, c, MPFR_RNDU); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_inf_p (a) && mpfr_sgn (a) > 0); + mpfr_set_emax (emax); + + mpfr_clear (a); + mpfr_clear (b); + mpfr_clear (c); +} + int main (void) { @@ -64,8 +225,11 @@ tests_start_mpfr (); + coverage (); + test_corner_1 (1024); + bug20171217 (); check_special (); - for(p = 2 ; p < 200 ; p++) + for(p = MPFR_PREC_MIN; p < 200 ; p++) check_random (p); check_overflow (); @@ -78,11 +242,10 @@ { \ printf("ERROR: for %s and p=%lu and i=%d:\nB=", \ mpfr_print_rnd_mode ((mpfr_rnd_t) r), (unsigned long) p, i); \ - mpfr_print_binary(b); \ - printf("\nC="); mpfr_print_binary(c); \ - printf("\nadd1 : "); mpfr_print_binary(a1); \ - printf("\nadd1sp: "); mpfr_print_binary(a2); \ - putchar('\n'); \ + mpfr_dump (b); \ + printf ("C="); mpfr_dump (c); \ + printf ("add1 : "); mpfr_dump (a1); \ + printf ("add1sp: "); mpfr_dump (a2); \ exit(1); \ } \ while (0) @@ -92,49 +255,75 @@ { \ printf("ERROR: Wrong inexact flag for %s and p=%lu and i=%d:\nB=", \ mpfr_print_rnd_mode ((mpfr_rnd_t) r), (unsigned long) p, i); \ - mpfr_print_binary(b); \ - printf("\nC="); mpfr_print_binary(c); \ - printf("\nA="); mpfr_print_binary(a1); \ - printf("\nAdd1: %d. Add1sp: %d\n", \ - inexact1, inexact2); \ + mpfr_dump (b); \ + printf ("C="); mpfr_dump (c); \ + printf ("A="); mpfr_dump (a1); \ + printf ("Add1: %d. Add1sp: %d\n", inexact1, inexact2); \ exit(1); \ } \ while (0) -#define SET_PREC(_p) \ - { \ - p = _p; \ - mpfr_set_prec(a1, _p); mpfr_set_prec(a2, _p); \ - mpfr_set_prec(b, _p); mpfr_set_prec(c, _p); \ - } +#define SET_PREC(_p) \ + do \ + { \ + p = _p; \ + mpfr_set_prec(a1, _p); mpfr_set_prec(a2, _p); \ + mpfr_set_prec(b, _p); mpfr_set_prec(c, _p); \ + } \ + while (0) static void check_random (mpfr_prec_t p) { - mpfr_t a1,b,c,a2; + mpfr_t a1, a2, b, bs, c, cs; int r; int i, inexact1, inexact2; - mpfr_inits2 (p, a1, b, c, a2, (mpfr_ptr) 0); + mpfr_inits2 (p, a1, a2, b, c, (mpfr_ptr) 0); for (i = 0 ; i < 500 ; i++) { - mpfr_urandomb (b, RANDS); - mpfr_urandomb (c, RANDS); + mpfr_urandom (b, RANDS, MPFR_RNDA); + mpfr_urandom (c, RANDS, MPFR_RNDA); if (MPFR_IS_PURE_FP(b) && MPFR_IS_PURE_FP(c)) { + if (randlimb () & 1) + mpfr_neg (b, b, MPFR_RNDN); + if (randlimb () & 1) + mpfr_neg (c, c, MPFR_RNDN); if (MPFR_GET_EXP(b) < MPFR_GET_EXP(c)) - mpfr_swap(b, c); - if (MPFR_IS_PURE_FP(b) && MPFR_IS_PURE_FP(c)) - for (r = 0 ; r < MPFR_RND_MAX ; r++) - { - inexact1 = mpfr_add1(a1, b, c, (mpfr_rnd_t) r); - inexact2 = mpfr_add1sp(a2, b, c, (mpfr_rnd_t) r); - if (mpfr_cmp(a1, a2)) - STD_ERROR; - if (inexact1 != inexact2) - STD_ERROR2; - } + { + /* Exchange b and c, except the signs (actually, the sign + of cs doesn't matter). */ + MPFR_ALIAS (bs, c, MPFR_SIGN (b), MPFR_EXP (c)); + MPFR_ALIAS (cs, b, MPFR_SIGN (c), MPFR_EXP (b)); + } + else + { + MPFR_ALIAS (bs, b, MPFR_SIGN (b), MPFR_EXP (b)); + MPFR_ALIAS (cs, c, MPFR_SIGN (c), MPFR_EXP (c)); + } + for (r = 0 ; r < MPFR_RND_MAX ; r++) + { + mpfr_flags_t flags1, flags2; + + if (r == MPFR_RNDF) /* inexact makes no sense, moreover + mpfr_add1 and mpfr_add1sp could + return different values */ + continue; + + mpfr_clear_flags (); + inexact1 = mpfr_add1 (a1, bs, cs, (mpfr_rnd_t) r); + flags1 = __gmpfr_flags; + mpfr_clear_flags (); + inexact2 = mpfr_add1sp (a2, b, c, (mpfr_rnd_t) r); + flags2 = __gmpfr_flags; + if (! mpfr_equal_p (a1, a2)) + STD_ERROR; + if (inexact1 != inexact2) + STD_ERROR2; + MPFR_ASSERTN (flags1 == flags2); + } } } @@ -144,7 +333,7 @@ static void check_special (void) { - mpfr_t a1,a2,b,c; + mpfr_t a1, a2, b, c; int r; mpfr_prec_t p; int i = -1, inexact1, inexact2; @@ -153,6 +342,9 @@ for (r = 0 ; r < MPFR_RND_MAX ; r++) { + if (r == MPFR_RNDF) + continue; /* inexact makes no sense, mpfr_add1 and mpfr_add1sp + could differ */ SET_PREC(53); mpfr_set_str1 (b, "1@100"); mpfr_set_str1 (c, "1@1"); @@ -185,5 +377,14 @@ exit (1); } + mpfr_set_prec (a1, 63); + mpfr_set_prec (b, 63); + mpfr_set_prec (c, 63); + mpfr_set_str_binary (b, "0.111111101010110111010100110101010110000101111011011011100011001E-3"); + mpfr_set_str_binary (c, "0.101111111101110000001100001000011000011011010001010011111100111E-4"); + mpfr_clear_inexflag (); + mpfr_add1sp (a1, b, c, MPFR_RNDN); + MPFR_ASSERTN (mpfr_inexflag_p ()); + mpfr_clears (a1, a2, b, c, (mpfr_ptr) 0); } diff -Nru mpfr4-3.1.4/tests/tadd.c mpfr4-4.0.2/tests/tadd.c --- mpfr4-3.1.4/tests/tadd.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tadd.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_add and mpfr_sub. -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #define N 30000 -#include -#include #include #include "mpfr-test.h" @@ -31,6 +29,8 @@ /* If the precisions are the same, we want to test both mpfr_add1sp and mpfr_add1. */ +/* FIXME: modify check() to test the ternary value and the flags. */ + static int usesp; static int @@ -83,8 +83,8 @@ if (mpfr_cmp_str1 (zz, zs) ) { printf ("expected sum is %s, got ", zs); - mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN); - printf ("mpfr_add failed for x=%s y=%s with rnd_mode=%s\n", + mpfr_out_str (stdout, 10, 0, zz, MPFR_RNDN); + printf ("\nmpfr_add failed for x=%s y=%s with rnd_mode=%s\n", xs, ys, mpfr_print_rnd_mode (rnd_mode)); exit (1); } @@ -109,9 +109,9 @@ { printf ("(2) x=%s,%d y=%s,%d pz=%d,rnd=%s\n", xs, px, ys, py, pz, mpfr_print_rnd_mode (rnd_mode)); - printf ("got "); mpfr_print_binary(zz); puts (""); + printf ("got "); mpfr_dump (zz); mpfr_set_str(zz, rs, 2, MPFR_RNDN); - printf ("instead of "); mpfr_print_binary(zz); puts (""); + printf ("instead of "); mpfr_dump (zz); exit (1); } mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz); @@ -152,7 +152,7 @@ if (MPFR_MANT(u)[0] << 2) { printf ("result not normalized for prec=2\n"); - mpfr_print_binary (u); puts (""); + mpfr_dump (u); exit (1); } mpfr_set_str_binary (t, "-1.0e-1"); @@ -207,7 +207,7 @@ mpfr_set_str_binary(t, "0.1011000101110010000101111111011100111111101010011011110110101011101000000100"); if (mpfr_cmp(u,t)) { - printf ("expect "); mpfr_print_binary(t); puts (""); + printf ("expect "); mpfr_dump (t); printf ("mpfr_add failed for precisions 53-76\n"); exit (1); } @@ -218,7 +218,7 @@ mpfr_set_str_binary(t, "0.101100010111001000010111111101110011111110101001101111011010101110100000001011000010101110011000000000111111"); if (mpfr_cmp(u,t)) { - printf ("expect "); mpfr_print_binary(t); puts (""); + printf ("expect "); mpfr_dump (t); printf ("mpfr_add failed for precisions 53-108\n"); exit (1); } @@ -250,8 +250,7 @@ printf ("Error in mpfr_sub: u=x-t and x=x-t give different results\n"); exit (1); } - if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] & - ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0) + if (! MPFR_IS_NORMALIZED (u)) { printf ("Error in mpfr_sub: result is not msb-normalized (1)\n"); exit (1); @@ -273,9 +272,9 @@ if ((MPFR_MANT(u)[0] & 1) != 1) { printf ("error in mpfr_add with rnd_mode=MPFR_RNDU\n"); - printf ("b= "); mpfr_print_binary(x); puts (""); - printf ("c= "); mpfr_print_binary(t); puts (""); - printf ("b+c="); mpfr_print_binary(u); puts (""); + printf ("b= "); mpfr_dump (x); + printf ("c= "); mpfr_dump (t); + printf ("b+c="); mpfr_dump (u); exit (1); } @@ -308,8 +307,7 @@ mpfr_set_str_binary(x, "0.10000000000000000000000000000000E1"); mpfr_set_str_binary(t, "0.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000110001110100000100011110000101110110011101110100110110111111011010111100100000000000000000000000000E0"); mpfr_sub(u, x, t, MPFR_RNDN); - if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] & - ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0) + if (! MPFR_IS_NORMALIZED (u)) { printf ("Error in mpfr_sub: result is not msb-normalized (2)\n"); exit (1); @@ -322,8 +320,7 @@ mpfr_set_str_binary (x, "0.11100100101101001100111011111111110001101001000011101001001010010E-35"); mpfr_set_str_binary (t, "0.10000000000000000000000000000000000001110010010110100110011110000E1"); mpfr_sub (u, t, x, MPFR_RNDU); - if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] & - ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0) + if (! MPFR_IS_NORMALIZED (u)) { printf ("Error in mpfr_sub: result is not msb-normalized (3)\n"); exit (1); @@ -336,8 +333,7 @@ mpfr_set_str_binary (x, "0.10111001001111010010001000000010111111011011011101000001001000101000000000000000000000000000000000000000000E315"); mpfr_set_str_binary (t, "0.10000000000000000000000000000000000101110100100101110110000001100101011111001000011101111100100100111011000E350"); mpfr_sub (u, x, t, MPFR_RNDU); - if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] & - ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0) + if (! MPFR_IS_NORMALIZED (u)) { printf ("Error in mpfr_sub: result is not msb-normalized (4)\n"); exit (1); @@ -396,9 +392,9 @@ { printf ("case (1b) failed for prec_a=%u, prec_b=%u," " prec_c=%u\n", prec_a, prec_b, prec_c); - printf ("b="); mpfr_print_binary(b); puts (""); - printf ("c="); mpfr_print_binary(c); puts (""); - printf ("a="); mpfr_print_binary(a); puts (""); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); exit (1); } } @@ -481,9 +477,11 @@ mpfr_set_prec (u, 33); mpfr_set_str_binary (u, "0.101110100101101100000000111100000E-1"); mpfr_set_prec (y, 31); - if ((inexact = test_add (y, x, u, MPFR_RNDN))) + inexact = test_add (y, x, u, MPFR_RNDN); + + if (inexact != 0) { - printf ("Wrong inexact flag (2): expected 0, got %d\n", inexact); + printf ("Wrong ternary value (2): expected 0, got %d\n", inexact); exit (1); } @@ -492,64 +490,70 @@ mpfr_set_prec (u, 33); mpfr_set_str_binary (u, "0.101110100101101100000000111100000E-1"); mpfr_set_prec (y, 28); - if ((inexact = test_add (y, x, u, MPFR_RNDN))) + inexact = test_add (y, x, u, MPFR_RNDN); + + if (inexact != 0) { - printf ("Wrong inexact flag (1): expected 0, got %d\n", inexact); + printf ("Wrong ternary value (1): expected 0, got %d\n", inexact); exit (1); } - for (px=2; px= 0) ? MPFR_EXP(x) - MPFR_EXP(u) - : MPFR_EXP(u) - MPFR_EXP(x); - /* x + u is exactly representable with precision - abs(EXP(x)-EXP(u)) + max(prec(x), prec(u)) + 1 */ - pz = pz + MAX(MPFR_PREC(x), MPFR_PREC(u)) + 1; - mpfr_set_prec (z, pz); - rnd = RND_RAND (); - if (test_add (z, x, u, rnd)) - { - printf ("z <- x + u should be exact\n"); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("u="); mpfr_print_binary (u); puts (""); - printf ("z="); mpfr_print_binary (z); puts (""); - exit (1); - } - { - rnd = RND_RAND (); - inexact = test_add (y, x, u, rnd); - cmp = mpfr_cmp (y, z); - if (((inexact == 0) && (cmp != 0)) || - ((inexact > 0) && (cmp <= 0)) || - ((inexact < 0) && (cmp >= 0))) - { - printf ("Wrong inexact flag for rnd=%s\n", - mpfr_print_rnd_mode(rnd)); - printf ("expected %d, got %d\n", cmp, inexact); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("u="); mpfr_print_binary (u); puts (""); - printf ("y= "); mpfr_print_binary (y); puts (""); - printf ("x+u="); mpfr_print_binary (z); puts (""); - exit (1); - } - } + + py = MPFR_PREC_MIN + (randlimb () % (MAX_PREC - 1)); + mpfr_set_prec (y, py); + pz = mpfr_cmpabs (x, u) >= 0 ? + MPFR_EXP(x) - MPFR_EXP(u) : + MPFR_EXP(u) - MPFR_EXP(x); + /* x + u is exactly representable with precision + abs(EXP(x)-EXP(u)) + max(prec(x), prec(u)) + 1 */ + pz = pz + MAX(MPFR_PREC(x), MPFR_PREC(u)) + 1; + mpfr_set_prec (z, pz); + + rnd = RND_RAND_NO_RNDF (); + inexact = test_add (z, x, u, rnd); + if (inexact != 0) + { + printf ("z <- x + u should be exact\n"); + printf ("x="); mpfr_dump (x); + printf ("u="); mpfr_dump (u); + printf ("z="); mpfr_dump (z); + exit (1); + } + + rnd = RND_RAND_NO_RNDF (); + inexact = test_add (y, x, u, rnd); + cmp = mpfr_cmp (y, z); + if ((inexact == 0 && cmp != 0) || + (inexact > 0 && cmp <= 0) || + (inexact < 0 && cmp >= 0)) + { + printf ("Wrong ternary value for rnd=%s\n", + mpfr_print_rnd_mode (rnd)); + printf ("expected %d, got %d\n", cmp, inexact); + printf ("x="); mpfr_dump (x); + printf ("u="); mpfr_dump (u); + printf ("y= "); mpfr_dump (y); + printf ("x+u="); mpfr_dump (z); + exit (1); } } } @@ -627,37 +631,76 @@ check_overflow (void) { mpfr_t a, b, c; - mpfr_prec_t prec_a; - int r; + mpfr_prec_t prec_a, prec_b, prec_c; + int r, up; - mpfr_init2 (a, 256); - mpfr_init2 (b, 256); - mpfr_init2 (c, 256); + mpfr_init (a); + mpfr_init (b); + mpfr_init (c); - mpfr_set_ui (b, 1, MPFR_RNDN); - mpfr_setmax (b, mpfr_get_emax ()); - mpfr_set_ui (c, 1, MPFR_RNDN); - mpfr_set_exp (c, mpfr_get_emax () - 192); - RND_LOOP(r) - for (prec_a = 128; prec_a < 512; prec_a += 64) - { - mpfr_set_prec (a, prec_a); - mpfr_clear_overflow (); - test_add (a, b, c, (mpfr_rnd_t) r); - if (!mpfr_overflow_p ()) + RND_LOOP_NO_RNDF (r) + for (prec_a = 2; prec_a <= 128; prec_a += 2) + for (prec_b = 2; prec_b <= 128; prec_b += 2) + for (prec_c = 2; prec_c <= 128; prec_c += 2) { - printf ("No overflow in check_overflow\n"); - exit (1); + mpfr_set_prec (a, prec_a); + mpfr_set_prec (b, prec_b); + mpfr_set_prec (c, prec_c); + + mpfr_setmax (b, mpfr_get_emax ()); + + up = r == MPFR_RNDA || r == MPFR_RNDU || r == MPFR_RNDN; + + /* set c with overlap with bits of b: will always overflow */ + mpfr_set_ui_2exp (c, 1, mpfr_get_emax () - prec_b / 2, MPFR_RNDN); + mpfr_nextbelow (c); + mpfr_clear_overflow (); + test_add (a, b, c, (mpfr_rnd_t) r); + if (!mpfr_overflow_p () || (up && !mpfr_inf_p (a))) + { + printf ("No overflow (1) in check_overflow for rnd=%s\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); + exit (1); + } + + if (r == MPFR_RNDZ || r == MPFR_RNDD || prec_a >= prec_b + prec_c) + continue; + + /* set c to 111...111 so that ufp(c) = 1/2 ulp(b): will only overflow + when prec_a < prec_b + prec_c, and rounding up or to nearest */ + mpfr_set_ui_2exp (c, 1, mpfr_get_emax () - prec_b, MPFR_RNDN); + mpfr_nextbelow (c); + mpfr_clear_overflow (); + test_add (a, b, c, (mpfr_rnd_t) r); + /* b + c is exactly representable iff prec_a >= prec_b + prec_c */ + if (!mpfr_overflow_p () || !mpfr_inf_p (a)) + { + printf ("No overflow (2) in check_overflow for rnd=%s\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); + exit (1); + } } - } + mpfr_set_prec (b, 256); + mpfr_setmax (b, mpfr_get_emax ()); + mpfr_set_prec (c, 256); + mpfr_set_ui (c, 1, MPFR_RNDN); mpfr_set_exp (c, mpfr_get_emax () - 512); mpfr_set_prec (a, 256); mpfr_clear_overflow (); - test_add (a, b, c, MPFR_RNDU); + mpfr_add (a, b, c, MPFR_RNDU); if (!mpfr_overflow_p ()) { - printf ("No overflow in check_overflow\n"); + printf ("No overflow (3) in check_overflow\n"); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); exit (1); } @@ -686,11 +729,13 @@ prec_a = MPFR_PREC_MIN + (randlimb () % m); prec_b = MPFR_PREC_MIN + (randlimb () % m); - prec_c = MPFR_PREC_MIN + (randlimb () % m); + /* we need prec_c > 1 so that % (prec_c - 1) is well defined below */ + do prec_c = MPFR_PREC_MIN + (randlimb () % m); while (prec_c == 1); mpfr_init2 (a, prec_a); mpfr_init2 (b, prec_b); mpfr_init2 (c, prec_c); - sb = randlimb () % 3; + /* we need prec_b - (sb != 2) > 0 below */ + do sb = randlimb () % 3; while (prec_b - (sb != 2) == 0); if (sb != 0) { tb = 1 + (randlimb () % (prec_b - (sb != 2))); @@ -709,7 +754,7 @@ test_add (c, c, one, MPFR_RNDN); diff = (randlimb () % (2*m)) - m; mpfr_mul_2si (c, c, diff, MPFR_RNDN); - rnd_mode = RND_RAND (); + rnd_mode = RND_RAND_NO_RNDF (); inex_a = test_add (a, b, c, rnd_mode); mpfr_init2 (s, MPFR_PREC_MIN + 2*m); inex_s = test_add (s, b, c, MPFR_RNDN); /* exact */ @@ -731,8 +776,8 @@ (int) tb, (int) tc, (int) diff, mpfr_print_rnd_mode (rnd_mode)); printf ("sb = %d, sc = %d\n", sb, sc); - printf ("a = "); mpfr_print_binary (a); puts (""); - printf ("s = "); mpfr_print_binary (s); puts (""); + printf ("a = "); mpfr_dump (a); + printf ("s = "); mpfr_dump (s); printf ("inex_a = %d, inex_s = %d\n", inex_a, inex_s); exit (1); } @@ -759,7 +804,7 @@ mpfr_init2 (c, MPFR_PREC_MIN); for (ia = 0; ia < numberof (prec_a); ia++) - for (ib = 0; ib < numberof(supp_b); ib++) + for (ib = 0; ib < numberof (supp_b); ib++) { mpfr_prec_t prec_b; int rnd_mode; @@ -773,12 +818,15 @@ mpfr_div_ui (b, c, prec_a[ia], MPFR_RNDN); mpfr_sub (b, c, b, MPFR_RNDN); /* b = 1 - 2^(-prec_a) */ - for (ic = 0; ic < numberof(supp_b); ic++) + for (ic = 0; ic < numberof (supp_b); ic++) for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX; rnd_mode++) { mpfr_t s; int inex_a, inex_s; + if (rnd_mode == MPFR_RNDF) + continue; /* inex_a, inex_s make no sense */ + mpfr_set_ui (c, 1, MPFR_RNDN); mpfr_div_ui (c, c, prec_a[ia] + supp_b[ic], MPFR_RNDN); inex_a = test_add (a, b, c, (mpfr_rnd_t) rnd_mode); @@ -1035,6 +1083,14 @@ "1e0",128, "100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e0",256, MPFR_RNDN); + check2b("0.10000000000000000011101111111110110110001100010110100011010000110101101101010010000110110011100110001101110010111011011110010101e1",128, + "0.11110011001100100001111011100010010100011011011111111110101001101001101011100101011110101111111100010010100010100111110110011001e-63",128, + "0.10000000000000000011101111111110110110001100010110100011010001000100111010000100001110100001101111011111100000111011011000111100e1",128, + MPFR_RNDN); + check2b("0.101000111001110100111100000010110010011101001011101001001101101000010100010000011100110110110011011000001110110101100111010110011101000111010011110001010001110110110011111011011100101011111100e-2",192, + "0.101101100000111110011110000110001000110110010010110000111101110010111010100110000000000110010100010001000001011011101010111010101011010110011011011110110111001000111001101000010101111010010010e-130",192, + "0.101000111001110100111100000010110010011101001011101001001101101000010100010000011100110110110011011000001110110101100111010110101000011111100011011000110011011001000001100000001000111011011001e-2",192, + MPFR_RNDN); /* Checking double precision (53 bits) */ check53("-8.22183238641455905806e-19", "7.42227178769761587878e-19",MPFR_RNDD, @@ -1096,6 +1152,172 @@ check_1minuseps (); } +static void +check_extreme (void) +{ + mpfr_t u, v, w, x, y; + int i, inex, r; + + mpfr_inits2 (32, u, v, w, x, y, (mpfr_ptr) 0); + mpfr_setmin (u, mpfr_get_emax ()); + mpfr_setmax (v, mpfr_get_emin ()); + mpfr_setmin (w, mpfr_get_emax () - 40); + RND_LOOP (r) + for (i = 0; i < 2; i++) + { + mpfr_add (x, u, v, (mpfr_rnd_t) r); + mpfr_set_prec (y, 64); + inex = mpfr_add (y, u, w, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + mpfr_prec_round (y, 32, (mpfr_rnd_t) r); + /* for RNDF, the rounding directions are not necessarily consistent */ + if (! mpfr_equal_p (x, y) && r != MPFR_RNDF) + { + printf ("Error in u + v (%s)\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("u = "); + mpfr_dump (u); + printf ("v = "); + mpfr_dump (v); + printf ("Expected "); + mpfr_dump (y); + printf ("Got "); + mpfr_dump (x); + exit (1); + } + mpfr_neg (v, v, MPFR_RNDN); + mpfr_neg (w, w, MPFR_RNDN); + } + mpfr_clears (u, v, w, x, y, (mpfr_ptr) 0); +} + +static void +testall_rndf (mpfr_prec_t pmax) +{ + mpfr_t a, b, c, d; + mpfr_prec_t pa, pb, pc; + mpfr_exp_t eb; + + for (pa = MPFR_PREC_MIN; pa <= pmax; pa++) + { + mpfr_init2 (a, pa); + mpfr_init2 (d, pa); + for (pb = MPFR_PREC_MIN; pb <= pmax; pb++) + { + mpfr_init2 (b, pb); + for (eb = 0; eb <= pmax + 3; eb ++) + { + mpfr_set_ui_2exp (b, 1, eb, MPFR_RNDN); + while (mpfr_cmp_ui_2exp (b, 1, eb + 1) < 0) + { + for (pc = MPFR_PREC_MIN; pc <= pmax; pc++) + { + mpfr_init2 (c, pc); + mpfr_set_ui (c, 1, MPFR_RNDN); + while (mpfr_cmp_ui (c, 2) < 0) + { + mpfr_add (a, b, c, MPFR_RNDF); + mpfr_add (d, b, c, MPFR_RNDD); + if (!mpfr_equal_p (a, d)) + { + mpfr_add (d, b, c, MPFR_RNDU); + if (!mpfr_equal_p (a, d)) + { + printf ("Error: mpfr_add(a,b,c,RNDF) does not " + "match RNDD/RNDU\n"); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); + exit (1); + } + } + mpfr_nextabove (c); + } + mpfr_clear (c); + } + mpfr_nextabove (b); + } + } + mpfr_clear (b); + } + mpfr_clear (a); + mpfr_clear (d); + } +} + +static void +test_rndf_exact (mp_size_t pmax) +{ + mpfr_t a, b, c, d; + mpfr_prec_t pa, pb, pc; + mpfr_exp_t eb; + + for (pa = MPFR_PREC_MIN; pa <= pmax; pa++) + { + /* only check pa mod GMP_NUMB_BITS = -2, -1, 0, 1, 2 */ + if ((pa + 2) % GMP_NUMB_BITS > 4) + continue; + mpfr_init2 (a, pa); + mpfr_init2 (d, pa); + for (pb = MPFR_PREC_MIN; pb <= pmax; pb++) + { + if ((pb + 2) % GMP_NUMB_BITS > 4) + continue; + mpfr_init2 (b, pb); + for (eb = 0; eb <= pmax + 3; eb ++) + { + mpfr_urandomb (b, RANDS); + mpfr_mul_2exp (b, b, eb, MPFR_RNDN); + for (pc = MPFR_PREC_MIN; pc <= pmax; pc++) + { + if ((pc + 2) % GMP_NUMB_BITS > 4) + continue; + mpfr_init2 (c, pc); + mpfr_urandomb (c, RANDS); + mpfr_add (a, b, c, MPFR_RNDF); + mpfr_add (d, b, c, MPFR_RNDD); + if (!mpfr_equal_p (a, d)) + { + mpfr_add (d, b, c, MPFR_RNDU); + if (!mpfr_equal_p (a, d)) + { + printf ("Error: mpfr_add(a,b,c,RNDF) does not " + "match RNDD/RNDU\n"); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); + exit (1); + } + } + + /* now make the low bits from c match those from b */ + mpfr_sub (c, b, d, MPFR_RNDN); + mpfr_add (a, b, c, MPFR_RNDF); + mpfr_add (d, b, c, MPFR_RNDD); + if (!mpfr_equal_p (a, d)) + { + mpfr_add (d, b, c, MPFR_RNDU); + if (!mpfr_equal_p (a, d)) + { + printf ("Error: mpfr_add(a,b,c,RNDF) does not " + "match RNDD/RNDU\n"); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); + exit (1); + } + } + + mpfr_clear (c); + } + } + mpfr_clear (b); + } + mpfr_clear (a); + mpfr_clear (d); + } +} + #define TEST_FUNCTION test_add #define TWO_ARGS #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS) @@ -1113,7 +1335,12 @@ usesp = 1; tests (); #endif - test_generic (2, 1000, 100); + + test_rndf_exact (200); + testall_rndf (7); + check_extreme (); + + test_generic (MPFR_PREC_MIN, 1000, 100); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tadd_d.c mpfr4-4.0.2/tests/tadd_d.c --- mpfr4-3.1.4/tests/tadd_d.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tadd_d.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_add_d -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,17 +17,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include #include "mpfr-test.h" -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) - static void check_regulars (void) { @@ -104,7 +100,7 @@ mpfr_clear_flags (); inexact = mpfr_add_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); - MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0); + MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN); MPFR_ASSERTN (mpfr_nan_p (y)); /* +inf + 1.0 == +inf */ @@ -143,19 +139,8 @@ check_nans (); check_regulars (); - test_generic (2, 1000, 100); + test_generic (MPFR_PREC_MIN, 1000, 100); tests_end_mpfr (); return 0; } - -#else - -int -main (void) -{ - printf ("Warning! Test disabled for this MPFR version.\n"); - return 0; -} - -#endif diff -Nru mpfr4-3.1.4/tests/tadd_ui.c mpfr4-4.0.2/tests/tadd_ui.c --- mpfr4-3.1.4/tests/tadd_ui.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tadd_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_add_ui -Copyright 2000-2016 Free Software Foundation, Inc. +Copyright 2000-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include #include "mpfr-test.h" @@ -69,7 +67,9 @@ /* nan + 2394875 == nan */ mpfr_set_nan (x); + mpfr_clear_nanflag (); mpfr_add_ui (y, x, 2394875L, MPFR_RNDN); + MPFR_ASSERTN (mpfr_nanflag_p ()); MPFR_ASSERTN (mpfr_nan_p (y)); /* +inf + 2394875 == +inf */ @@ -110,7 +110,7 @@ check3 ("-2.0769715792901673e-5", 880524, MPFR_RNDN, "8.8052399997923023e5"); - test_generic (2, 1000, 100); + test_generic (MPFR_PREC_MIN, 1000, 100); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tagm.c mpfr4-4.0.2/tests/tagm.c --- mpfr4-3.1.4/tests/tagm.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tagm.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_agm. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define check(a,b,r) check4(a,b,r,0.0) @@ -81,7 +78,7 @@ newflags = __gmpfr_flags; expflags |= MPFR_FLAGS_INEXACT; - if (SIGN (inex2) != inex || newflags != expflags || + if (VSIGN (inex2) != inex || newflags != expflags || ! mpfr_equal_p (tres, tc)) { printf ("mpfr_agm failed in rnd_mode=%s for\n", @@ -208,7 +205,7 @@ } static void -check_nans (void) +check_special (void) { mpfr_t x, y, m; @@ -216,11 +213,13 @@ mpfr_init2 (y, 123L); mpfr_init2 (m, 123L); - /* agm(1,nan) == nan */ + /* agm(1,nan) is NaN */ mpfr_set_ui (x, 1L, MPFR_RNDN); mpfr_set_nan (y); mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (m)); + mpfr_agm (m, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_nan_p (m)); /* agm(1,+inf) == +inf */ mpfr_set_ui (x, 1L, MPFR_RNDN); @@ -228,6 +227,9 @@ mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (m)); MPFR_ASSERTN (mpfr_sgn (m) > 0); + mpfr_agm (m, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_inf_p (m)); + MPFR_ASSERTN (mpfr_sgn (m) > 0); /* agm(+inf,+inf) == +inf */ mpfr_set_inf (x, 1); @@ -236,23 +238,55 @@ MPFR_ASSERTN (mpfr_inf_p (m)); MPFR_ASSERTN (mpfr_sgn (m) > 0); - /* agm(-inf,+inf) == nan */ + /* agm(-inf,+inf) is NaN */ mpfr_set_inf (x, -1); mpfr_set_inf (y, 1); mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (m)); + mpfr_agm (m, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_nan_p (m)); + + /* agm(+0,+inf) is NaN */ + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_set_inf (y, 1); + mpfr_agm (m, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_nan_p (m)); + mpfr_agm (m, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_nan_p (m)); - /* agm(+0,+inf) == nan */ + /* agm(-0,+inf) is NaN */ mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); mpfr_set_inf (y, 1); mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (m)); + mpfr_agm (m, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_nan_p (m)); + + /* agm(+0,-inf) is NaN */ + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_set_inf (y, -1); + mpfr_agm (m, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_nan_p (m)); + mpfr_agm (m, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_nan_p (m)); + + /* agm(-0,-inf) is NaN */ + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_set_inf (y, -1); + mpfr_agm (m, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_nan_p (m)); + mpfr_agm (m, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_nan_p (m)); /* agm(+0,1) == +0 */ mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_set_ui (y, 1, MPFR_RNDN); mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m)); + mpfr_agm (m, y, x, MPFR_RNDN); + MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m)); /* agm(-0,1) == +0 */ mpfr_set_ui (x, 0, MPFR_RNDN); @@ -260,6 +294,25 @@ mpfr_set_ui (y, 1, MPFR_RNDN); mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m)); + mpfr_agm (m, y, x, MPFR_RNDN); + MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m)); + + /* agm(+0,-1) == +0 */ + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_set_si (y, -1, MPFR_RNDN); + mpfr_agm (m, x, y, MPFR_RNDN); + MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m)); + mpfr_agm (m, y, x, MPFR_RNDN); + MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m)); + + /* agm(-0,-1) == +0 */ + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_neg (x, x, MPFR_RNDN); + mpfr_set_si (y, -1, MPFR_RNDN); + mpfr_agm (m, x, y, MPFR_RNDN); + MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m)); + mpfr_agm (m, y, x, MPFR_RNDN); + MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m)); /* agm(-0,+0) == +0 */ mpfr_set_ui (x, 0, MPFR_RNDN); @@ -267,6 +320,8 @@ mpfr_set_ui (y, 0, MPFR_RNDN); mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m)); + mpfr_agm (m, y, x, MPFR_RNDN); + MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m)); /* agm(1,1) == 1 */ mpfr_set_ui (x, 1, MPFR_RNDN); @@ -274,11 +329,13 @@ mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (m ,1) == 0); - /* agm(-1,-2) == NaN */ + /* agm(-1,-2) is NaN */ mpfr_set_si (x, -1, MPFR_RNDN); mpfr_set_si (y, -2, MPFR_RNDN); mpfr_agm (m, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (m)); + mpfr_agm (m, y, x, MPFR_RNDN); + MPFR_ASSERTN (mpfr_nan_p (m)); mpfr_clear (x); mpfr_clear (y); @@ -296,8 +353,7 @@ { tests_start_mpfr (); - check_nans (); - + check_special (); check_large (); check_eq (); check4 ("2.0", "1.0", MPFR_RNDN, "1.456791031046906869", -1); @@ -310,7 +366,7 @@ check4 ("1.0", "44.0", MPFR_RNDU, "13.3658354512981243907", 1); check4 ("1.0", "3.7252902984619140625e-9", MPFR_RNDU, "0.07553933569711989657765", 1); - test_generic (2, 300, 17); + test_generic (MPFR_PREC_MIN, 300, 17); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tai.c mpfr4-4.0.2/tests/tai.c --- mpfr4-3.1.4/tests/tai.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tai.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_ai. -Copyright 2010-2016 Free Software Foundation, Inc. +Copyright 2010-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_ai @@ -94,15 +90,153 @@ mpfr_clear (r); } +static void +bug20180107 (void) +{ + mpfr_t x, y, z; + mpfr_exp_t emin; + int inex; + mpfr_flags_t flags; + + mpfr_init2 (x, 152); + mpfr_init2 (y, 11); + mpfr_init2 (z, 11); + mpfr_set_str_binary (x, "0.11010101100111000111001001010110101001100001011110101111000010100111011101011110000100111011101100100100001010000110100011001000111010010001110000011100E5"); + emin = mpfr_get_emin (); + mpfr_set_emin (-134); + mpfr_clear_flags (); + inex = mpfr_ai (y, x, MPFR_RNDA); + flags = __gmpfr_flags; + /* result should be 0.10011100000E-135 with unlimited exponent range, + and thus should be rounded to 0.1E-134 */ + mpfr_set_str_binary (z, "0.1E-134"); + MPFR_ASSERTN (mpfr_equal_p (y, z)); + MPFR_ASSERTN (inex > 0); + MPFR_ASSERTN (flags == (MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT)); + + mpfr_set_prec (x, 2); + mpfr_set_str_binary (x, "0.11E7"); + mpfr_set_prec (y, 2); + mpfr_clear_flags (); + inex = mpfr_ai (y, x, MPFR_RNDA); + flags = __gmpfr_flags; + /* result should be 1.0E-908 with unlimited exponent range, + and thus should be rounded to 0.1E-134 */ + mpfr_set_str_binary (z, "0.1E-134"); + MPFR_ASSERTN (mpfr_equal_p (y, z)); + MPFR_ASSERTN (inex > 0); + MPFR_ASSERTN (flags == (MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT)); + + mpfr_set_emin (emin); + mpfr_clear (x); + mpfr_clear (y); + mpfr_clear (z); +} + +/* exercise mpfr_ai near m*2^e, for precision p */ +static void +test_near_m2e (long m, mpfr_exp_t e, mpfr_prec_t pmax) +{ + mpfr_t x, xx, y, yy; + mpfr_prec_t p; + int inex; + + mpfr_clear_flags (); + + /* first determine the smallest precision for which m*2^e is exact */ + for (p = MPFR_PREC_MIN; p <= pmax; p++) + { + mpfr_init2 (x, p); + inex = mpfr_set_si_2exp (x, m, e, MPFR_RNDN); + mpfr_clear (x); + if (inex == 0) + break; + } + + mpfr_init2 (x, p); + inex = mpfr_set_si_2exp (x, m, e, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + + for (; p <= pmax; p++) + { + mpfr_init2 (y, p); + mpfr_init2 (xx, p); + mpfr_init2 (yy, p); + mpfr_prec_round (x, p, MPFR_RNDN); + mpfr_ai (y, x, MPFR_RNDN); + while (1) + { + mpfr_set (xx, x, MPFR_RNDN); + mpfr_nextbelow (xx); + mpfr_ai (yy, xx, MPFR_RNDN); + if (mpfr_cmpabs (yy, y) >= 0) + break; + else + { + mpfr_set (x, xx, MPFR_RNDN); + mpfr_set (y, yy, MPFR_RNDN); + } + } + while (1) + { + mpfr_set (xx, x, MPFR_RNDN); + mpfr_nextabove (xx); + mpfr_ai (yy, xx, MPFR_RNDN); + if (mpfr_cmpabs (yy, y) >= 0) + break; + else + { + mpfr_set (x, xx, MPFR_RNDN); + mpfr_set (y, yy, MPFR_RNDN); + } + } + mpfr_clear (y); + mpfr_clear (xx); + mpfr_clear (yy); + } + + mpfr_clear (x); + + /* Since some tests don't really check that the result is not NaN... */ + MPFR_ASSERTN (! mpfr_nanflag_p ()); +} + +/* example provided by Sylvain Chevillard, which exercises the case + wprec < err + 1, and thus correct_bits = 0, in src/ai.c */ +static void +coverage (void) +{ + mpfr_t x, y; + int inex; + + mpfr_init2 (x, 800); + mpfr_init2 (y, 20); + mpfr_set_str (x, "-2.3381074104597670384891972524467354406385401456723878524838544372136680027002836477821640417313293202847600938532659527752254668583598667448688987168197275409731526749911127480659996456283534915503672", 10, MPFR_RNDN); + inex = mpfr_ai (y, x, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (y, 593131, -682) == 0); + + mpfr_clear (x); + mpfr_clear (y); +} + int main (int argc, char *argv[]) { tests_start_mpfr (); + coverage (); + test_near_m2e (-5, -1, 100); /* exercise near -2.5 */ + test_near_m2e (-4, 0, 100); /* exercise near -4 */ + test_near_m2e (-11, -1, 100); /* exercise near -5.5 */ + test_near_m2e (-27, -2, 100); /* exercise near -6.75 */ + test_near_m2e (-31, -2, 100); /* exercise near -7.75 */ + test_near_m2e (-15, -1, 100); /* exercise near -7.5 */ + bug20180107 (); check_large (); check_zero (); - test_generic (2, 100, 5); + test_generic (MPFR_PREC_MIN, 100, 5); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/talloc.c mpfr4-4.0.2/tests/talloc.c --- mpfr4-3.1.4/tests/talloc.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/talloc.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,72 @@ +/* talloc -- test file concerning memory allocation + +Copyright 2015-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-test.h" + +/* We enable the test only when MPFR_ALLOCA_MAX is not greater than the + default value: we do not want to make the test fail if the user has + redefined MPFR_ALLOCA_MAX to a very large value. */ + +/* Needed with --with-gmp-build */ +#ifndef MPFR_ALLOCA_MAX +# define MPFR_ALLOCA_MAX 16384 +#endif + +/* ISO C99 is needed by MPFR_DECL_INIT. */ +#if __MPFR_STDC (199901L) && MPFR_ALLOCA_MAX <= 16384 + +int +main (void) +{ + MPFR_DECL_INIT (x, 4 + MPFR_ALLOCA_MAX * CHAR_BIT); + MPFR_DECL_INIT (y, 8 + MPFR_ALLOCA_MAX * CHAR_BIT); + + tests_start_mpfr (); + + /* We do not want to use mpfr_add1sp because if MPFR_WANT_ASSERT >= 2, + mpfr_init is used. The following test is based on the fact that + MPFR_TMP_LIMBS_ALLOC is used in mpfr_add1 before any other form + of memory allocation. In r9454, this crashes because the memory + allocation function used by this macro (under the condition that + the size is > MPFR_ALLOCA_MAX) isn't defined yet. This bug comes + from r8813. + WARNING! Do not add MPFR calls before this test. Otherwise the + mentioned problem may no longer be actually tested, making this + test useless. For other allocation tests, it is better to use a + different test file. */ + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_set_ui (y, 2, MPFR_RNDN); + mpfr_add (x, x, y, MPFR_RNDN); + + tests_end_mpfr (); + return 0; +} + +#else + +int +main (void) +{ + return 77; +} + +#endif diff -Nru mpfr4-3.1.4/tests/talloc-cache.c mpfr4-4.0.2/tests/talloc-cache.c --- mpfr4-3.1.4/tests/talloc-cache.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/talloc-cache.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,120 @@ +/* talloc-cache -- test file concerning memory allocation and cache + +Copyright 2016-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +#include "mpfr-test.h" + +#define A 4096 +#define I 10000 + +/* Variable v is used to check that the allocator is the current GMP one. + The assertions on v in would typically fail with MPFR 3.1.6, where the + allocation functions are memorized the first time they are seen. */ +static int v = 0; + +static void * +my_alloc1 (size_t s) +{ + void *p = malloc (s + A); + MPFR_ASSERTN (v == 1); + *(int *) p = 1; + return (void *) ((char *) p + A); +} + +static void * +my_realloc1 (void *p, size_t t, size_t s) +{ + p = (void *) ((char *) p - A); + MPFR_ASSERTN (v == 1); + MPFR_ASSERTN (*(int *) p == 1); + return (void *) ((char *) realloc (p, s + A) + A); +} + +static void +my_free1 (void *p, size_t t) +{ + p = (void *) ((char *) p - A); + MPFR_ASSERTN (v == 1); + MPFR_ASSERTN (*(int *) p == 1); + free (p); +} + +static void * +my_alloc2 (size_t s) +{ + void *p = malloc (s + A); + MPFR_ASSERTN (v == 2); + *(int *) p = 2; + return (void *) ((char *) p + A); +} + +static void * +my_realloc2 (void *p, size_t t, size_t s) +{ + p = (void *) ((char *) p - A); + MPFR_ASSERTN (v == 2); + MPFR_ASSERTN (*(int *) p == 2); + return (void *) ((char *) realloc (p, s + A) + A); +} + +static void +my_free2 (void *p, size_t t) +{ + p = (void *) ((char *) p - A); + MPFR_ASSERTN (v == 2); + MPFR_ASSERTN (*(int *) p == 2); + free (p); +} + +int +main (void) +{ + mpfr_t x; + int err; + + tests_memory_disabled = 2; + tests_start_mpfr (); + + err = mpfr_mp_memory_cleanup (); + MPFR_ASSERTN (err == 0); + mp_set_memory_functions (my_alloc1, my_realloc1, my_free1); + v = 1; + + mpfr_init2 (x, 53); + mpfr_set_ui (x, I, MPFR_RNDN); + mpfr_sin (x, x, MPFR_RNDN); + mpfr_clear (x); + + err = mpfr_mp_memory_cleanup (); + MPFR_ASSERTN (err == 0); + mp_set_memory_functions (my_alloc2, my_realloc2, my_free2); + v = 2; + + mpfr_init2 (x, 1000); + mpfr_set_ui (x, I, MPFR_RNDN); + mpfr_sin (x, x, MPFR_RNDN); + mpfr_clear (x); + + tests_end_mpfr (); + return 0; +} diff -Nru mpfr4-3.1.4/tests/tasin.c mpfr4-4.0.2/tests/tasin.c --- mpfr4-3.1.4/tests/tasin.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tasin.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_asin. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_asin @@ -82,14 +79,14 @@ /* asin(+/-0) = +/-0 */ mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_asin (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) + if (MPFR_NOTZERO (y) || MPFR_IS_NEG (y)) { printf ("Error: mpfr_asin (+0) <> +0\n"); exit (1); } mpfr_neg (x, x, MPFR_RNDN); mpfr_asin (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0) + if (MPFR_NOTZERO (y) || MPFR_IS_POS (y)) { printf ("Error: mpfr_asin (-0) <> -0\n"); exit (1); @@ -144,8 +141,8 @@ if (mpfr_cmp (x, y)) { printf ("Error: mpfr_asin (2)\n"); - mpfr_print_binary (x); printf ("\n"); - mpfr_print_binary (y); printf ("\n"); + mpfr_dump (x); + mpfr_dump (y); exit (1); } @@ -245,7 +242,7 @@ ex_inex = -1; ex_flags = MPFR_FLAGS_INEXACT; - if (SIGN (inex) != ex_inex || flags != ex_flags || + if (VSIGN (inex) != ex_inex || flags != ex_flags || ! mpfr_equal_p (y, ex_y)) { printf ("Error in reduced_expo_range\non x = "); @@ -255,7 +252,7 @@ printf ("\n inex = %d, flags = %u\n", ex_inex, ex_flags); printf ("Got y = "); mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); - printf ("\n inex = %d, flags = %u\n", SIGN (inex), flags); + printf ("\n inex = %d, flags = %u\n", VSIGN (inex), flags); exit (1); } @@ -271,7 +268,7 @@ special_overflow (); reduced_expo_range (); - test_generic (2, 100, 15); + test_generic (MPFR_PREC_MIN, 100, 15); tests_end_mpfr (); diff -Nru mpfr4-3.1.4/tests/tasinh.c mpfr4-4.0.2/tests/tasinh.c --- mpfr4-3.1.4/tests/tasinh.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tasinh.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_asinh. -Copyright 2001-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2001-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_asinh @@ -56,14 +53,14 @@ /* asinh(+0) = +0, asinh(-0) = -0 */ mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_asinh (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) + if (MPFR_NOTZERO (y) || MPFR_IS_NEG (y)) { printf ("Error: mpfr_asinh(+0) <> +0\n"); exit (1); } mpfr_neg (x, x, MPFR_RNDN); mpfr_asinh (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0) + if (MPFR_NOTZERO (y) || MPFR_IS_POS (y)) { printf ("Error: mpfr_asinh(-0) <> -0\n"); exit (1); @@ -150,7 +147,7 @@ special (); - test_generic (2, 100, 25); + test_generic (MPFR_PREC_MIN, 100, 25); data_check ("data/asinh", mpfr_asinh, "mpfr_asinh"); bad_cases (mpfr_asinh, mpfr_sinh, "mpfr_asinh", 256, -128, 29, diff -Nru mpfr4-3.1.4/tests/tassert.c mpfr4-4.0.2/tests/tassert.c --- mpfr4-3.1.4/tests/tassert.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/tassert.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,37 @@ +/* tassert -- Test for assertions. + +Copyright 2012-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define MPFR_NEED_LONGLONG_H +#include "mpfr-test.h" + +int +main (int argc, char **argv) +{ + tests_start_mpfr (); + tests_expect_abort (); + + printf ("[tassert] Check for good handling of assertions.\n"); + MPFR_ASSERTN (0); + + tests_end_mpfr (); + return -1; /* Should not be executed */ +} diff -Nru mpfr4-3.1.4/tests/tatan.c mpfr4-4.0.2/tests/tatan.c --- mpfr4-3.1.4/tests/tatan.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tatan.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_atan. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void @@ -142,8 +139,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_atan (2)\n"); - mpfr_print_binary (x); printf ("\n"); - mpfr_print_binary (y); printf ("\n"); + mpfr_dump (x); + mpfr_dump (y); exit (1); } @@ -156,8 +153,8 @@ if (mpfr_cmp (z, y)) { printf ("Error in mpfr_atan (3)\n"); - printf ("Expected "); mpfr_print_binary (y); printf ("\n"); - printf ("Got "); mpfr_print_binary (z); printf ("\n"); + printf ("Expected "); mpfr_dump (y); + printf ("Got "); mpfr_dump (z); exit (1); } @@ -541,7 +538,7 @@ mpfr_t x, y, r, g; int i; int d[] = { 0, -1, 1 }; - int ntests = sizeof (d) / sizeof (int); + int ntests = numberof (d); mpfr_init2 (x, 53); mpfr_init2 (y, 53); @@ -560,8 +557,8 @@ if (mpfr_equal_p (r, g) == 0) { printf ("Error in mpfr_atan2 (5)\n"); - printf ("Expected "); mpfr_print_binary (g); printf ("\n"); - printf ("Got "); mpfr_print_binary (r); printf ("\n"); + printf ("Expected "); mpfr_dump (g); + printf ("Got "); mpfr_dump (r); exit (1); } } @@ -588,19 +585,19 @@ mpfr_inits2 (12, x, y, ex_y, (mpfr_ptr) 0); mpfr_set_str (x, "0.1e-5", 2, MPFR_RNDN); - mpfr_set_emin (-5); - mpfr_set_emax (-5); + set_emin (-5); + set_emax (-5); mpfr_clear_flags (); inex = mpfr_atan (y, x, MPFR_RNDN); flags = __gmpfr_flags; - mpfr_set_emin (emin); - mpfr_set_emax (emax); + set_emin (emin); + set_emax (emax); mpfr_set_str (ex_y, "0.1e-5", 2, MPFR_RNDN); ex_inex = 1; ex_flags = MPFR_FLAGS_INEXACT; - if (SIGN (inex) != ex_inex || flags != ex_flags || + if (VSIGN (inex) != ex_inex || flags != ex_flags || ! mpfr_equal_p (y, ex_y)) { printf ("Error in reduced_expo_range\non x = "); @@ -610,7 +607,7 @@ printf ("\n inex = %d, flags = %u\n", ex_inex, ex_flags); printf ("Got y = "); mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); - printf ("\n inex = %d, flags = %u\n", SIGN (inex), flags); + printf ("\n inex = %d, flags = %u\n", VSIGN (inex), flags); exit (1); } @@ -630,9 +627,9 @@ atan2_different_prec (); reduced_expo_range (); - test_generic_atan (2, 200, 17); - test_generic_atan2 (2, 200, 17); - test_generic_atan2_neg (2, 200, 17); + test_generic_atan (MPFR_PREC_MIN, 200, 17); + test_generic_atan2 (MPFR_PREC_MIN, 200, 17); + test_generic_atan2_neg (MPFR_PREC_MIN, 200, 17); data_check ("data/atan", mpfr_atan, "mpfr_atan"); bad_cases (mpfr_atan, mpfr_tan, "mpfr_atan", 256, -40, 1, 4, 128, 800, 40); diff -Nru mpfr4-3.1.4/tests/tatanh.c mpfr4-4.0.2/tests/tatanh.c --- mpfr4-3.1.4/tests/tatanh.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tatanh.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_atanh. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_atanh @@ -78,14 +75,14 @@ /* atanh(+0) = +0, atanh(-0) = -0 */ mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_atanh (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) + if (MPFR_NOTZERO (y) || MPFR_IS_NEG (y)) { printf ("Error: mpfr_atanh(+0) <> +0\n"); exit (1); } mpfr_neg (x, x, MPFR_RNDN); mpfr_atanh (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0) + if (MPFR_NOTZERO (y) || MPFR_IS_POS (y)) { printf ("Error: mpfr_atanh(-0) <> -0\n"); exit (1); @@ -104,7 +101,7 @@ if (!mpfr_nan_p (y)) { printf ("Error: mpfr_atanh(+Inf) <> NaN\n"); - mpfr_print_binary (y); printf ("\n"); + mpfr_dump (y); exit (1); } @@ -162,7 +159,7 @@ if (mpfr_cmp (y, z)) { printf ("Error: mpfr_atanh (3)\n"); - mpfr_print_binary (y); printf ("\n"); + mpfr_dump (y); exit (1); } @@ -178,7 +175,7 @@ special (); - test_generic (2, 100, 25); + test_generic (MPFR_PREC_MIN, 100, 25); data_check ("data/atanh", mpfr_atanh, "mpfr_atanh"); bad_cases (mpfr_atanh, mpfr_tanh, "mpfr_atanh", 256, -128, 9, diff -Nru mpfr4-3.1.4/tests/taway.c mpfr4-4.0.2/tests/taway.c --- mpfr4-3.1.4/tests/taway.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/taway.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for round away. -Copyright 2000-2016 Free Software Foundation, Inc. +Copyright 2000-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,16 +17,20 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" -#define DISP(s, t) {printf(s); mpfr_out_str(stdout, 2, 0, t, MPFR_RNDN); } -#define DISP2(s,t) {DISP(s,t); putchar('\n');} +#define DISP(s,t) \ + do \ + { \ + printf (s); \ + mpfr_out_str (stdout, 2, 0, t, MPFR_RNDN); \ + } \ + while (0) + +#define DISP2(s,t) do { DISP(s,t); putchar ('\n'); } while (0) #define SPECIAL_MAX 12 @@ -114,7 +118,7 @@ set_special (ref3, i/SPECIAL_MAX); inexa = testfunc (res1, ref2, ref3, MPFR_RNDA); - r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD; + r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, ref3, r); if (mpfr_compare (res1, ref1) || inexa != inexd) @@ -122,8 +126,8 @@ printf ("Error with RNDA for %s with ", foo); DISP("x=",ref2); DISP2(", y=",ref3); printf ("inexa=%d inexd=%d\n", inexa, inexd); - printf ("expected "); mpfr_print_binary (ref1); puts (""); - printf ("got "); mpfr_print_binary (res1); puts (""); + printf ("expected "); mpfr_dump (ref1); + printf ("got "); mpfr_dump (res1); exit (1); } } @@ -169,7 +173,7 @@ set_special (op3, k); inexa = testfunc (res, op1, op2, op3, MPFR_RNDA); - r = MPFR_SIGN(res) > 0 ? MPFR_RNDU : MPFR_RNDD; + r = MPFR_IS_POS (res) ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref, op1, op2, op3, r); if (mpfr_compare (res, ref) || inexa != inexd) @@ -217,7 +221,7 @@ ref3 = i / SPECIAL_MAX == 0 ? 0 : randlimb (); inexa = testfunc (res1, ref2, ref3, MPFR_RNDA); - r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD; + r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, ref3, r); if (mpfr_compare (res1, ref1) || inexa != inexd) @@ -225,8 +229,8 @@ printf ("Error with RNDA for %s for c=%u\n", foo, ref3); DISP2("a=",ref2); printf ("inexa=%d inexd=%d\n", inexa, inexd); - printf ("expected "); mpfr_print_binary (ref1); puts (""); - printf ("got "); mpfr_print_binary (res1); puts (""); + printf ("expected "); mpfr_dump (ref1); + printf ("got "); mpfr_dump (res1); exit (1); } } @@ -260,7 +264,7 @@ ref2 = i / SPECIAL_MAX == 0 ? 0 : randlimb (); inexa = testfunc (res1, ref2, ref3, MPFR_RNDA); - r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD; + r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, ref3, r); if (mpfr_compare (res1, ref1) || inexa != inexd) @@ -302,7 +306,7 @@ /* first round to away */ inexa = testfunc (res1, ref2, MPFR_RNDA); - r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD; + r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, r); if (mpfr_compare (res1, ref1) || inexa != inexd) { @@ -347,7 +351,7 @@ inexa = testfunc (res1, res2, ref3, MPFR_RNDA); /* first check wrt the first operand */ - r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD; + r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, ref3, r); /* the low 2 bits of the inexact flag concern the 1st operand */ if (mpfr_compare (res1, ref1) || (inexa & 3) != (inexd & 3)) @@ -361,7 +365,7 @@ } /* now check wrt the second operand */ - r = MPFR_SIGN(res2) > 0 ? MPFR_RNDU : MPFR_RNDD; + r = MPFR_IS_POS (res2) ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, ref3, r); /* bits 2..3 of the inexact flag concern the 2nd operand */ if (mpfr_compare (res2, ref2) || (inexa >> 2) != (inexd >> 2)) @@ -483,12 +487,15 @@ test4 (mpfr_fma, "mpfr_fma"); test4 (mpfr_fms, "mpfr_fms"); -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) test2 (mpfr_li2, "mpfr_li2"); test2 (mpfr_rec_sqrt, "mpfr_rec_sqrt"); test3 (mpfr_fmod, "mpfr_fmod"); test3a (mpfr_modf, "mpfr_modf"); test3a (mpfr_sinh_cosh, "mpfr_sinh_cosh"); + +#if MPFR_VERSION >= MPFR_VERSION_NUM(3,0,0) + test2 (mpfr_ai, "mpfr_ai"); + test2 (mpfr_digamma, "mpfr_digamma"); #endif } diff -Nru mpfr4-3.1.4/tests/tbeta.c mpfr4-4.0.2/tests/tbeta.c --- mpfr4-3.1.4/tests/tbeta.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/tbeta.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,356 @@ +/* Test file for the beta function + +Copyright 2017-2019 Free Software Foundation, Inc. +Contributed by ChemicalDevelopment. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-test.h" + +/* TODO: Test the ternary value and the flags. Add tgeneric tests. */ + +#define FAILED(p, r, z, w, expected, rnd_mode) do { \ + printf ("prec=%d, rnd=%s case failed for:", \ + (int) p, mpfr_print_rnd_mode (rnd_mode)); \ + printf("\n z ="); \ + mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN); \ + printf("\n w ="); \ + mpfr_out_str (stdout, 2, 0, w, MPFR_RNDN); \ + printf("\n ex.="); \ + mpfr_out_str (stdout, 2, 0, expected, MPFR_RNDN); \ + printf("\n ac.="); \ + mpfr_out_str (stdout, 2, 0, r, MPFR_RNDN); \ + printf("\n\n"); \ + } while (0) + +#define TEST(p, r, z, w, expected) TESTRND(p, r, z, w, expected, MPFR_RNDN) + +#define TESTRND(p, r, z, w, expected, rnd_mode) do { \ + mpfr_beta (r, z, w, rnd_mode); \ + if (! SAME_VAL (r, expected)) \ + FAILED(p, r, z, w, expected, rnd_mode); \ + } while (0) + +static void +test_beta_special (mpfr_prec_t prec) +{ + mpfr_t z, w, r, expect; + + mpfr_init2 (r, prec); + mpfr_init2 (z, prec); + mpfr_init2 (w, prec); + mpfr_init2 (expect, prec); + + mpfr_set_inf (z, 1); + mpfr_set_inf (w, 1); + mpfr_set_zero (expect, 1); + TEST(prec, r, z, w, expect); + + mpfr_set_inf (z, 1); + mpfr_set_zero (w, 1); + mpfr_set_nan (expect); + TEST(prec, r, z, w, expect); + + mpfr_set_inf (z, 1); + mpfr_set_zero (w, -1); + mpfr_set_nan (expect); + TEST(prec, r, z, w, expect); + + mpfr_set_inf (z, 1); + mpfr_set_str (w, "-.1e0", 2, MPFR_RNDN); + mpfr_set_inf (expect, 1); + TEST(prec, r, z, w, expect); + + mpfr_set_inf (z, 1); + mpfr_set_str (w, "-1.1e0", 2, MPFR_RNDN); + mpfr_set_inf (expect, -1); + TEST(prec, r, z, w, expect); + + mpfr_set_inf (z, 1); + mpfr_set_str (w, "-1e0", 2, MPFR_RNDN); + mpfr_set_nan (expect); + TEST(prec, r, z, w, expect); + + mpfr_set_inf (z, 1); + mpfr_set_str (w, "-2e0", 2, MPFR_RNDN); + mpfr_set_nan (expect); + TEST(prec, r, z, w, expect); + + if (prec > 81) + { + mpfr_set_inf (z, 1); + mpfr_set_str (w, "-1e80", 2, MPFR_RNDN); + mpfr_set_nan (expect); + TEST(prec, r, z, w, expect); + + mpfr_set_inf (z, 1); + mpfr_set_str (w, "-1e80", 2, MPFR_RNDN); + mpfr_sub_d (w, w, .1, MPFR_RNDN); + mpfr_set_inf (expect, 1); + TEST(prec, r, z, w, expect); + + mpfr_set_str (w, "-1e80", 2, MPFR_RNDN); + mpfr_sub_d (w, w, 1.1, MPFR_RNDN); + mpfr_set_inf (expect, -1); + TEST(prec, r, z, w, expect); + } + + mpfr_set_str (z, "1.1e0", 2, MPFR_RNDN); + mpfr_set_inf (w, -1); + mpfr_set_nan (expect); + TEST(prec, r, z, w, expect); + + mpfr_set_str (z, "11e0", 2, MPFR_RNDN); + mpfr_set_inf (w, -1); + mpfr_set_zero (expect, -1); + TEST(prec, r, z, w, expect); + + mpfr_set_str (z, "10e0", 2, MPFR_RNDN); + mpfr_set_inf (w, -1); + mpfr_set_zero (expect, 1); + TEST(prec, r, z, w, expect); + + mpfr_set_inf (z, -1); + mpfr_set_inf (w, -1); + mpfr_set_nan (expect); + TEST(prec, r, z, w, expect); + + mpfr_clear (r); + mpfr_clear (z); + mpfr_clear (w); + mpfr_clear (expect); +} + +static void +test_beta_2exp (mpfr_prec_t prec, int trials, int spread) +{ + mpfr_t r, z, w, expect; + int i; + + mpfr_init2 (r, prec); + mpfr_init2 (z, prec); + mpfr_init2 (w, prec); + mpfr_init2 (expect, prec); + for (i = -(spread*trials)/2; spread*i < trials / 2; i += spread) + { + mpfr_set_si_2exp (z, 1, i, MPFR_RNDN); + mpfr_set_ui (w, 1, MPFR_RNDN); + mpfr_set_si_2exp (expect, 1, -i, MPFR_RNDN); + + TEST(prec, r, z, w, expect); + } + + mpfr_clear (r); + mpfr_clear (z); + mpfr_clear (w); + mpfr_clear (expect); +} + +/* +Tests values such that z and w are not integers, but (z+w) is. + +An example that was given: +beta(-.3, -1.7) = gamma(-0.3)*gamma(-1.7)/gamma(-2) + +Sage gives this as 0, and Lefevre said that we should return +0 + +*/ +static void +test_beta_zw_sum_int (mpfr_prec_t prec) +{ + mpfr_t r, z, w, expect; + int sum; + + if (prec < 4) + prec = 4; + + mpfr_init2 (r, prec); + mpfr_init2 (z, prec); + mpfr_init2 (w, prec); + mpfr_init2 (expect, prec); + + sum = -3; + mpfr_set_str (z, "-1.1e0", 2, MPFR_RNDN); + mpfr_si_sub (w, sum, z, MPFR_RNDN); + mpfr_set_zero (expect, 1); + TEST(prec, r, z, w, expect); + + sum = -12; + mpfr_set_str (z, "-1.101e0", 2, MPFR_RNDN); + mpfr_si_sub (w, sum, z, MPFR_RNDN); + mpfr_set_zero (expect, 1); + TEST(prec, r, z, w, expect); + + sum = -1; + mpfr_set_str (z, "-.11e0", 2, MPFR_RNDN); + mpfr_si_sub (w, sum, z, MPFR_RNDN); + mpfr_set_zero (expect, 1); + TEST(prec, r, z, w, expect); + + sum = -13; + mpfr_set_str (z, "-.001e0", 2, MPFR_RNDN); + mpfr_si_sub (w, sum, z, MPFR_RNDN); + mpfr_set_zero (expect, 1); + TEST(prec, r, z, w, expect); + + mpfr_clear (r); + mpfr_clear (z); + mpfr_clear (w); + mpfr_clear (expect); +} + + +static void +test_beta_hardcoded (mpfr_prec_t prec) +{ + mpfr_t r, z, w, expect; + mpfr_prec_t oprec = 1; + + if (prec < 10) + prec = 10; + + mpfr_init2 (z, prec); + mpfr_init2 (w, prec); + mpfr_init2 (r, oprec); + mpfr_init2 (expect, oprec); + + mpfr_set_ui (z, 3, MPFR_RNDN); + mpfr_set_ui (w, 3, MPFR_RNDN); + mpfr_set_str (expect, "1e-5", 2, MPFR_RNDN); + TESTRND(prec, r, z, w, expect, MPFR_RNDN); + + mpfr_set_str (expect, "1.1e-5", 2, MPFR_RNDN); + TESTRND(prec, r, z, w, expect, MPFR_RNDU); + + mpfr_set_str (expect, "1e-5", 2, MPFR_RNDN); + TESTRND(prec, r, z, w, expect, MPFR_RNDD); + + mpfr_set_ui (z, 5, MPFR_RNDN); + mpfr_set_ui (w, 27, MPFR_RNDN); + mpfr_set_str (expect, "1e-20", 2, MPFR_RNDN); + TESTRND(prec, r, z, w, expect, MPFR_RNDN); + + mpfr_set_str (expect, "1e-19", 2, MPFR_RNDN); + TESTRND(prec, r, z, w, expect, MPFR_RNDU); + + mpfr_set_ui (z, 5, MPFR_RNDN); + mpfr_set_ui (w, 27, MPFR_RNDN); + mpfr_set_str (expect, "1e-20", 2, MPFR_RNDN); + TESTRND(prec, r, z, w, expect, MPFR_RNDN); + + + mpfr_set_ui (z, 121, MPFR_RNDN); + mpfr_set_ui (w, 2, MPFR_RNDN); + mpfr_set_str (expect, "1e-14", 2, MPFR_RNDN); + TESTRND(prec, r, z, w, expect, MPFR_RNDN); + + mpfr_set_ui (z, 121, MPFR_RNDN); + mpfr_set_ui (w, 151, MPFR_RNDN); + mpfr_set_str (expect, "1e-271", 2, MPFR_RNDN); + TESTRND(prec, r, z, w, expect, MPFR_RNDN); + + mpfr_set_str (expect, "1e-272", 2, MPFR_RNDN); + TESTRND(prec, r, z, w, expect, MPFR_RNDD); + + mpfr_set_str (expect, "1e-271", 2, MPFR_RNDN); + TESTRND(prec, r, z, w, expect, MPFR_RNDU); + + mpfr_clear (r); + mpfr_clear (z); + mpfr_clear (w); + mpfr_clear (expect); +} + +/* makes sure beta(a, b) = beta(b, a) */ +static void +test_beta_refl (mpfr_prec_t prec, mpfr_rnd_t rnd_mode) +{ + mpfr_t r, z, w, expect; + + mpfr_init2 (z, prec); + mpfr_init2 (w, prec); + mpfr_init2 (r, prec); + mpfr_init2 (expect, prec); + + mpfr_set_ui (z, 3, MPFR_RNDN); + mpfr_set_ui (w, 3, MPFR_RNDN); + mpfr_beta (expect, w, z, rnd_mode); + TESTRND(prec, r, z, w, expect, rnd_mode); + + mpfr_set_ui (z, 5, MPFR_RNDN); + mpfr_set_ui (w, 100, MPFR_RNDN); + mpfr_beta (expect, w, z, rnd_mode); + TESTRND(prec, r, z, w, expect, rnd_mode); + + mpfr_set_nan (z); + mpfr_set_ui (w, 100, MPFR_RNDN); + mpfr_beta (expect, w, z, rnd_mode); + TESTRND(prec, r, z, w, expect, rnd_mode); + + mpfr_set_nan (z); + mpfr_set_ui (w, 1, MPFR_RNDN); + mpfr_beta (expect, w, z, rnd_mode); + TESTRND(prec, r, z, w, expect, rnd_mode); + + mpfr_set_nan (z); + mpfr_set_nan (w); + mpfr_beta (expect, w, z, rnd_mode); + TESTRND(prec, r, z, w, expect, rnd_mode); + mpfr_set_nan (z); + mpfr_set_nan (w); + mpfr_beta (expect, w, z, rnd_mode); + TESTRND(prec, r, z, w, expect, rnd_mode); + + mpfr_clear (r); + mpfr_clear (z); + mpfr_clear (w); + mpfr_clear (expect); +} + +#define TEST_FUNCTION mpfr_beta +#define TWO_ARGS +#define TEST_RANDOM_EMIN -16 +#define TEST_RANDOM_EMAX 16 +#include "tgeneric.c" + +int +main (void) +{ + tests_start_mpfr (); + + test_beta_special (10); + test_beta_special (100); + test_beta_special (1000); + + test_beta_2exp (1, 10, 1); + test_beta_2exp (100, 40, 3); + + test_beta_hardcoded (10); + test_beta_hardcoded (100); + + test_beta_refl (1, MPFR_RNDN); + test_beta_refl (100, MPFR_RNDD); + + test_beta_zw_sum_int (10); + test_beta_zw_sum_int (100); + + test_generic (MPFR_PREC_MIN, 100, 20); + + tests_end_mpfr (); + return 0; +} diff -Nru mpfr4-3.1.4/tests/tbuildopt.c mpfr4-4.0.2/tests/tbuildopt.c --- mpfr4-3.1.4/tests/tbuildopt.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tbuildopt.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* tbuildopt.c -- test file for mpfr_buildopt_tls_p and mpfr_buildopt_decimal_p. -Copyright 2009-2016 Free Software Foundation, Inc. +Copyright 2009-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,10 +18,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include #include "mpfr-test.h" static void @@ -61,6 +60,24 @@ } static void +check_float128_p (void) +{ +#ifdef MPFR_WANT_FLOAT128 + if (!mpfr_buildopt_float128_p()) + { + printf ("Error: mpfr_buildopt_float128_p should return true\n"); + exit (1); + } +#else + if (mpfr_buildopt_float128_p()) + { + printf ("Error: mpfr_buildopt_float128_p should return false\n"); + exit (1); + } +#endif +} + +static void check_gmpinternals_p (void) { #if defined(MPFR_HAVE_GMP_IMPL) || defined(WANT_GMP_INTERNALS) @@ -81,9 +98,17 @@ int main (void) { + tests_start_mpfr (); + check_tls_p(); check_decimal_p(); + check_float128_p(); check_gmpinternals_p(); + { + const char *s = mpfr_buildopt_tune_case (); + (void) strlen (s); + } + tests_end_mpfr (); return 0; } diff -Nru mpfr4-3.1.4/tests/tcan_round.c mpfr4-4.0.2/tests/tcan_round.c --- mpfr4-3.1.4/tests/tcan_round.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tcan_round.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_can_round and mpfr_round_p. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,14 +17,52 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" +/* Simple cases where err - prec is large enough. + One can get failures as a consequence of r9883. */ +static void +test_simple (void) +{ + int t[4] = { 2, 3, -2, -3 }; /* test powers of 2 and non-powers of 2 */ + int i; + int r1, r2; + + for (i = 0; i < 4; i++) + RND_LOOP (r1) + RND_LOOP (r2) + { + mpfr_t b; + int p, err, prec, inex, c; + + if (r2 == MPFR_RNDF) + continue; + p = 12 + (randlimb() % (2 * GMP_NUMB_BITS)); + err = p - 3; + prec = 4; + mpfr_init2 (b, p); + inex = mpfr_set_si (b, t[i], MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + c = mpfr_can_round (b, err, (mpfr_rnd_t) r1, (mpfr_rnd_t) r2, prec); + /* If r1 == r2, we can round. + Note: For r1, RNDF is equivalent to RNDN. + TODO: complete this test for r1 != r2. */ + if ((r1 == MPFR_RNDF ? MPFR_RNDN : r1) == r2 && !c) + { + printf ("Error in test_simple for i=%d," + " err=%d r1=%s, r2=%s, p=%d\n", i, err, + mpfr_print_rnd_mode ((mpfr_rnd_t) r1), + mpfr_print_rnd_mode ((mpfr_rnd_t) r2), p); + printf ("b="); mpfr_dump (b); + exit (1); + } + mpfr_clear (b); + } +} + #define MAX_LIMB_SIZE 100 static void @@ -50,10 +88,57 @@ MPFR_RNDN, MPFR_RNDZ, p); if (r1 != r2) { - printf ("mpfr_round_p(%d) != mpfr_can_round(%d)!\n" + printf ("mpfr_round_p(%d) != mpfr_can_round(%d,RNDZ)!\n" + "bn = %ld, err0 = %ld, prec = %lu\nbp = ", + r1, r2, (long) n, (long) err, (unsigned long) p); +#ifndef MPFR_USE_MINI_GMP + gmp_printf ("%NX\n", buf, n); +#endif + exit (1); + } + /* Same with RNDF: with rnd1=RNDN, rnd2=RNDF is converted to RNDN. */ + r1 = mpfr_can_round_raw (buf, n, MPFR_SIGN_POS, err, + MPFR_RNDN, MPFR_RNDN, p); + r2 = mpfr_can_round_raw (buf, n, MPFR_SIGN_POS, err, + MPFR_RNDN, MPFR_RNDF, p); + if (r1 != r2) + { + printf ("mpfr_can_round(%d,RNDN) != mpfr_can_round(%d,RNDF)!\n" + "bn = %ld, err0 = %ld, prec = %lu\nbp = ", + r1, r2, (long) n, (long) err, (unsigned long) p); +#ifndef MPFR_USE_MINI_GMP + gmp_printf ("%NX\n", buf, n); +#endif + exit (1); + } + /* Same with RNDF: with rnd1=RNDZ, rnd2=RNDF is converted to RNDA. */ + r1 = mpfr_can_round_raw (buf, n, MPFR_SIGN_POS, err, + MPFR_RNDZ, MPFR_RNDA, p); + r2 = mpfr_can_round_raw (buf, n, MPFR_SIGN_POS, err, + MPFR_RNDZ, MPFR_RNDF, p); + if (r1 != r2) + { + printf ("mpfr_can_round(%d,RNDA) != mpfr_can_round(%d,RNDF)!\n" + "bn = %ld, err0 = %ld, prec = %lu\nbp = ", + r1, r2, (long) n, (long) err, (unsigned long) p); +#ifndef MPFR_USE_MINI_GMP + gmp_printf ("%NX\n", buf, n); +#endif + exit (1); + } + /* Same with RNDF: with rnd1=RNDA, rnd2=RNDF is converted to RNDZ. */ + r1 = mpfr_can_round_raw (buf, n, MPFR_SIGN_POS, err, + MPFR_RNDA, MPFR_RNDZ, p); + r2 = mpfr_can_round_raw (buf, n, MPFR_SIGN_POS, err, + MPFR_RNDA, MPFR_RNDF, p); + if (r1 != r2) + { + printf ("mpfr_can_round(%d,RNDZ) != mpfr_can_round(%d,RNDF)!\n" "bn = %ld, err0 = %ld, prec = %lu\nbp = ", - r1, r2, n, (long) err, (unsigned long) p); + r1, r2, (long) n, (long) err, (unsigned long) p); +#ifndef MPFR_USE_MINI_GMP gmp_printf ("%NX\n", buf, n); +#endif exit (1); } } @@ -69,6 +154,8 @@ mpfr_init2 (x, px); mpfr_set_ui_2exp (x, 1, i, MPFR_RNDN); + /* for mpfr_can_round, r1=RNDF is equivalent to r1=RNDN (the sign of the + error is not known) */ b = !!mpfr_can_round (x, i+1, r1, r2, prec); /* Note: If mpfr_can_round succeeds for both (r1,r2) = (MPFR_RNDD,MPFR_RNDN) and @@ -87,12 +174,7 @@ MPFR_IS_LIKE_RNDU (r1, MPFR_SIGN_POS) ? (MPFR_IS_LIKE_RNDD (r2, MPFR_SIGN_POS) ? 0 : prec < i) : (r2 != MPFR_RNDN ? 0 : prec < i); - /* We only require mpfr_can_round to return 1 when we can really - round, it is allowed to return 0 in some rare boundary cases, - for example when x = 2^k and the error is 0.25 ulp. - Note: if this changes in the future, the test could be improved by - removing the "&& expected_b == 0" below. */ - if (b != expected_b && expected_b == 0) + if (b != expected_b) { printf ("Error for x=2^%d, px=%lu, err=%d, r1=%s, r2=%s, prec=%d\n", (int) i, (unsigned long) px, (int) i + 1, @@ -118,6 +200,112 @@ mpfr_clear (x); } +static void +check_can_round (void) +{ + mpfr_t x, xinf, xsup, yinf, ysup; + int precx, precy, err; + int rnd1, rnd2; + int i, u[3] = { 0, 1, 256 }; + int inex; + int expected, got; + + mpfr_inits2 (4 * GMP_NUMB_BITS, x, xinf, xsup, yinf, ysup, (mpfr_ptr) 0); + + for (precx = 3 * GMP_NUMB_BITS - 3; precx <= 3 * GMP_NUMB_BITS + 3; precx++) + { + mpfr_set_prec (x, precx); + for (precy = precx - 4; precy <= precx + 4; precy++) + { + mpfr_set_prec (yinf, precy); + mpfr_set_prec (ysup, precy); + + for (i = 0; i <= 3; i++) + { + if (i <= 2) + { + /* Test x = 2^(precx - 1) + u */ + mpfr_set_ui_2exp (x, 1, precx - 1, MPFR_RNDN); + mpfr_add_ui (x, x, u[i], MPFR_RNDN); + } + else + { + /* Test x = 2^precx - 1 */ + mpfr_set_ui_2exp (x, 1, precx, MPFR_RNDN); + mpfr_sub_ui (x, x, 1, MPFR_RNDN); + } + MPFR_ASSERTN (mpfr_get_exp (x) == precx); + + for (err = precy; err <= precy + 3; err++) + { + mpfr_set_ui_2exp (xinf, 1, precx - err, MPFR_RNDN); + inex = mpfr_add (xsup, x, xinf, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + inex = mpfr_sub (xinf, x, xinf, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + RND_LOOP (rnd1) + RND_LOOP (rnd2) + { + if (rnd2 == MPFR_RNDF) + continue; + mpfr_set (yinf, MPFR_IS_LIKE_RNDD (rnd1, 1) ? + x : xinf, (mpfr_rnd_t) rnd2); + mpfr_set (ysup, MPFR_IS_LIKE_RNDU (rnd1, 1) ? + x : xsup, (mpfr_rnd_t) rnd2); + expected = !! mpfr_equal_p (yinf, ysup); + got = !! mpfr_can_round (x, err, (mpfr_rnd_t) rnd1, + (mpfr_rnd_t) rnd2, precy); + if (got != expected) + { + printf ("Error in check_can_round on:\n" + "precx=%d, precy=%d, i=%d, err=%d, " + "rnd1=%s, rnd2=%s: got %d\n", + precx, precy, i, err, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd1), + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd2), + got); + printf ("x="); mpfr_dump (x); + exit (1); + } + } + } + } + } + } + + mpfr_clears (x, xinf, xsup, yinf, ysup, (mpfr_ptr) 0); +} + +/* test of RNDNA (nearest with ties to away) */ +static void +test_rndna (void) +{ + mpfr_t x; + int inex; + + mpfr_init2 (x, 10); + mpfr_set_str_binary (x, "1111111101"); /* 1021 */ + inex = mpfr_prec_round (x, 9, MPFR_RNDNA); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui (x, 1022) == 0); + mpfr_set_prec (x, 10); + mpfr_set_str_binary (x, "1111111101"); /* 1021 */ + inex = mpfr_prec_round (x, 9, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_cmp_ui (x, 1020) == 0); + mpfr_set_prec (x, 10); + mpfr_set_str_binary (x, "1111111011"); /* 1019 */ + inex = mpfr_prec_round (x, 9, MPFR_RNDNA); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui (x, 1020) == 0); + mpfr_set_prec (x, 10); + mpfr_set_str_binary (x, "1111111011"); /* 1019 */ + inex = mpfr_prec_round (x, 9, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui (x, 1020) == 0); + mpfr_clear (x); +} + int main (void) { @@ -128,18 +316,21 @@ tests_start_mpfr (); + test_rndna (); + test_simple (); + /* checks that rounds to nearest sets the last bit to zero in case of equal distance */ mpfr_init2 (x, 59); mpfr_set_str_binary (x, "-0.10010001010111000011110010111010111110000000111101100111111E663"); - if (mpfr_can_round (x, 54, MPFR_RNDZ, MPFR_RNDZ, 53) != 0) + if (mpfr_can_round (x, 54, MPFR_RNDZ, MPFR_RNDZ, 53)) { printf ("Error (1) in mpfr_can_round\n"); exit (1); } mpfr_set_str_binary (x, "-Inf"); - if (mpfr_can_round (x, 2000, MPFR_RNDZ, MPFR_RNDZ, 2000) != 0) + if (mpfr_can_round (x, 2000, MPFR_RNDZ, MPFR_RNDZ, 2000)) { printf ("Error (2) in mpfr_can_round\n"); exit (1); @@ -155,7 +346,7 @@ mpfr_set_prec (x, 137); mpfr_set_str_binary (x, "-0.10111001101001010110011000110100111010011101101010010100101100001110000100111111011101010110001010111100100101110111100001000010000000000E-97"); - if (mpfr_can_round (x, 132, MPFR_RNDU, MPFR_RNDZ, 128) == 0) + if (! mpfr_can_round (x, 132, MPFR_RNDU, MPFR_RNDZ, 128)) { printf ("Error (4) in mpfr_can_round\n"); exit (1); @@ -164,7 +355,7 @@ /* in the following, we can round but cannot determine the inexact flag */ mpfr_set_prec (x, 86); mpfr_set_str_binary (x, "-0.11100100010011001111011010100111101010011000000000000000000000000000000000000000000000E-80"); - if (mpfr_can_round (x, 81, MPFR_RNDU, MPFR_RNDZ, 44) == 0) + if (! mpfr_can_round (x, 81, MPFR_RNDU, MPFR_RNDZ, 44)) { printf ("Error (5) in mpfr_can_round\n"); exit (1); @@ -174,12 +365,13 @@ mpfr_set_str (x, "0.ff4ca619c76ba69", 16, MPFR_RNDZ); for (i = 30; i < 99; i++) for (j = 30; j < 99; j++) - for (r1 = 0; r1 < MPFR_RND_MAX; r1++) - for (r2 = 0; r2 < MPFR_RND_MAX; r2++) - { - /* test for assertions */ - mpfr_can_round (x, i, (mpfr_rnd_t) r1, (mpfr_rnd_t) r2, j); - } + RND_LOOP (r1) + RND_LOOP (r2) + if (r2 != MPFR_RNDF) + { + /* test for assertions */ + mpfr_can_round (x, i, (mpfr_rnd_t) r1, (mpfr_rnd_t) r2, j); + } test_pow2 (32, 32, MPFR_RNDN, MPFR_RNDN, 32); test_pow2 (174, 174, MPFR_RNDN, MPFR_RNDN, 174); @@ -193,14 +385,17 @@ { i = (randlimb() % 200) + 4; for (j = i - 2; j < i + 2; j++) - for (r1 = 0; r1 < MPFR_RND_MAX; r1++) - for (r2 = 0; r2 < MPFR_RND_MAX; r2++) - for (k = MPFR_PREC_MIN; k <= i + 2; k++) - test_pow2 (i, k, (mpfr_rnd_t) r1, (mpfr_rnd_t) r2, j); + RND_LOOP (r1) + RND_LOOP (r2) + if (r2 != MPFR_RNDF) + for (k = MPFR_PREC_MIN; k <= i + 2; k++) + test_pow2 (i, k, (mpfr_rnd_t) r1, (mpfr_rnd_t) r2, j); } mpfr_clear (x); + check_can_round (); + check_round_p (); tests_end_mpfr (); diff -Nru mpfr4-3.1.4/tests/tcbrt.c mpfr4-4.0.2/tests/tcbrt.c --- mpfr4-3.1.4/tests/tcbrt.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tcbrt.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_cbrt. -Copyright 2002-2016 Free Software Foundation, Inc. +Copyright 2002-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void @@ -63,14 +60,14 @@ /* cbrt(+/-0) = +/-0 */ mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_cbrt (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) + if (MPFR_NOTZERO (y) || MPFR_IS_NEG (y)) { printf ("Error: cbrt(+0) <> +0\n"); exit (1); } mpfr_neg (x, x, MPFR_RNDN); mpfr_cbrt (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0) + if (MPFR_NOTZERO (y) || MPFR_IS_POS (y)) { printf ("Error: cbrt(-0) <> -0\n"); exit (1); @@ -210,7 +207,7 @@ } mpfr_clear (x); - test_generic (2, 200, 10); + test_generic (MPFR_PREC_MIN, 200, 10); data_check ("data/cbrt", mpfr_cbrt, "mpfr_cbrt"); diff -Nru mpfr4-3.1.4/tests/tcheck.c mpfr4-4.0.2/tests/tcheck.c --- mpfr4-3.1.4/tests/tcheck.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tcheck.c 2019-01-13 15:39:13.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_check. -Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2003-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,15 +17,12 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" -#define ERROR(s) \ +#define PRINT_ERROR(s) \ (printf ("mpfr_check failed " s " Prec=%lu\n", (unsigned long) pr), \ exit(1)) @@ -39,86 +36,108 @@ int max; tests_start_mpfr (); - for(pr = MPFR_PREC_MIN ; pr < 500 ; pr++) + for (pr = MPFR_PREC_MIN ; pr < 500 ; pr++) { mpfr_init2 (a, pr); - if (!mpfr_check(a)) ERROR("for init"); + if (!mpfr_check (a)) + PRINT_ERROR ("for init"); /* Check special cases */ - MPFR_SET_NAN(a); - if (!mpfr_check(a)) ERROR("for nan"); - MPFR_SET_POS(a); - MPFR_SET_INF(a); - if (!mpfr_check(a)) ERROR("for inf"); - MPFR_SET_ZERO(a); - if (!mpfr_check(a)) ERROR("for zero"); + MPFR_SET_NAN (a); + if (!mpfr_check (a)) + PRINT_ERROR ("for nan"); + MPFR_SET_POS (a); + MPFR_SET_INF (a); + if (!mpfr_check (a)) + PRINT_ERROR ("for inf"); + MPFR_SET_ZERO (a); + if (!mpfr_check (a)) + PRINT_ERROR ("for zero"); + MPFR_EXP (a) = MPFR_EXP_MIN; + if (mpfr_check (a)) + PRINT_ERROR ("for EXP = MPFR_EXP_MIN"); /* Check var */ - mpfr_set_ui(a, 2, MPFR_RNDN); - if (!mpfr_check(a)) ERROR("for set_ui"); - mpfr_clear_overflow(); + mpfr_set_ui (a, 2, MPFR_RNDN); + if (!mpfr_check (a)) + PRINT_ERROR ("for set_ui"); + mpfr_clear_overflow (); max = 1000; /* Allows max 2^1000 bits for the exponent */ - while ((!mpfr_overflow_p()) && (max>0)) + while (!mpfr_overflow_p () && max > 0) { - mpfr_mul(a, a, a, MPFR_RNDN); - if (!mpfr_check(a)) ERROR("for mul"); + mpfr_mul (a, a, a, MPFR_RNDN); + if (!mpfr_check (a)) + PRINT_ERROR ("for mul"); max--; } - if (max==0) ERROR("can't reach overflow"); - mpfr_set_ui(a, 2137, MPFR_RNDN); + if (max == 0) + PRINT_ERROR ("for overflow"); + mpfr_set_ui (a, 2137, MPFR_RNDN); /* Corrupt a and check for it */ - MPFR_SIGN(a) = 2; - if (mpfr_check(a)) ERROR("sgn"); - MPFR_SET_POS(a); + MPFR_SIGN (a) = 2; + if (mpfr_check (a)) + PRINT_ERROR ("sgn"); + MPFR_SET_POS (a); /* Check prec */ - MPFR_PREC(a) = 1; - if (mpfr_check(a)) ERROR("precmin"); + MPFR_PREC (a) = MPFR_PREC_MIN - 1; + if (mpfr_check (a)) PRINT_ERROR ("precmin"); #if MPFR_VERSION_MAJOR < 3 /* Disable the test with MPFR >= 3 since mpfr_prec_t is now signed. The "if" below is sufficient, but the MPFR_PREC_MAX+1 generates a warning with GCC 4.4.4 even though the test is always false. */ if ((mpfr_prec_t) 0 - 1 > 0) { - MPFR_PREC(a) = MPFR_PREC_MAX+1; - if (mpfr_check(a)) ERROR("precmax"); + MPFR_PREC (a) = MPFR_PREC_MAX + 1; + if (mpfr_check (a)) + PRINT_ERROR ("precmax"); } #endif - MPFR_PREC(a) = pr; - if (!mpfr_check(a)) ERROR("prec"); + MPFR_PREC (a) = pr; + if (!mpfr_check (a)) + PRINT_ERROR ("prec"); /* Check exponent */ - MPFR_EXP(a) = MPFR_EXP_INVALID; - if (mpfr_check(a)) ERROR("exp invalid"); - MPFR_EXP(a) = -MPFR_EXP_INVALID; - if (mpfr_check(a)) ERROR("-exp invalid"); + MPFR_EXP (a) = MPFR_EXP_INVALID; + if (mpfr_check(a)) + PRINT_ERROR ("exp invalid"); + MPFR_EXP (a) = -MPFR_EXP_INVALID; + if (mpfr_check(a)) + PRINT_ERROR ("-exp invalid"); MPFR_EXP(a) = 0; - if (!mpfr_check(a)) ERROR("exp 0"); + if (!mpfr_check(a)) PRINT_ERROR ("exp 0"); /* Check Mantissa */ p = MPFR_MANT(a); - MPFR_MANT(a) = NULL; - if (mpfr_check(a)) ERROR("Mantissa Null Ptr"); - MPFR_MANT(a) = p; + MPFR_MANT (a) = NULL; + if (mpfr_check (a)) + PRINT_ERROR ("Mantissa Null Ptr"); + MPFR_MANT (a) = p; /* Check size */ - s = MPFR_GET_ALLOC_SIZE(a); - MPFR_SET_ALLOC_SIZE(a, 0); - if (mpfr_check(a)) ERROR("0 size"); - MPFR_SET_ALLOC_SIZE(a, MP_SIZE_T_MIN); - if (mpfr_check(a)) ERROR("min size"); - MPFR_SET_ALLOC_SIZE(a, MPFR_LIMB_SIZE(a)-1 ); - if (mpfr_check(a)) ERROR("size < prec"); - MPFR_SET_ALLOC_SIZE(a, s); + s = MPFR_GET_ALLOC_SIZE (a); + MPFR_SET_ALLOC_SIZE (a, 0); + if (mpfr_check (a)) + PRINT_ERROR ("0 size"); + MPFR_SET_ALLOC_SIZE (a, MP_SIZE_T_MIN); + if (mpfr_check (a)) PRINT_ERROR ("min size"); + MPFR_SET_ALLOC_SIZE (a, MPFR_LIMB_SIZE (a) - 1); + if (mpfr_check (a)) + PRINT_ERROR ("size < prec"); + MPFR_SET_ALLOC_SIZE (a, s); /* Check normal form */ - tmp = MPFR_MANT(a)[0]; + tmp = MPFR_MANT (a)[0]; if ((pr % GMP_NUMB_BITS) != 0) { - MPFR_MANT(a)[0] = ~0; - if (mpfr_check(a)) ERROR("last bits non 0"); + MPFR_MANT(a)[0] = MPFR_LIMB_MAX; + if (mpfr_check (a)) + PRINT_ERROR ("last bits non 0"); } MPFR_MANT(a)[0] = tmp; MPFR_MANT(a)[MPFR_LIMB_SIZE(a)-1] &= MPFR_LIMB_MASK (GMP_NUMB_BITS-1); - if (mpfr_check(a)) ERROR("last bits non 0"); + if (mpfr_check (a)) + PRINT_ERROR ("last bits non 0"); /* Final */ - mpfr_set_ui(a, 2137, MPFR_RNDN); - if (!mpfr_check(a)) ERROR("after last set"); + mpfr_set_ui (a, 2137, MPFR_RNDN); + if (!mpfr_check (a)) + PRINT_ERROR ("after last set"); mpfr_clear (a); - if (mpfr_check(a)) ERROR("after clear"); + if (mpfr_check (a)) + PRINT_ERROR ("after clear"); } tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tcmp2.c mpfr4-4.0.2/tests/tcmp2.c --- mpfr4-3.1.4/tests/tcmp2.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tcmp2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_cmp2. -Copyright 1999-2003, 2006-2016 Free Software Foundation, Inc. +Copyright 1999-2003, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" /* set bit n of x to b, where bit 0 is the most significant one */ @@ -37,9 +34,9 @@ n %= mp_bits_per_limb; n = mp_bits_per_limb - 1 - n; if (b) - MPFR_MANT(x)[xn - l] |= (mp_limb_t) 1 << n; + MPFR_MANT(x)[xn - l] |= MPFR_LIMB_ONE << n; else - MPFR_MANT(x)[xn - l] &= ~((mp_limb_t) 1 << n); + MPFR_MANT(x)[xn - l] &= ~(MPFR_LIMB_ONE << n); } /* check that for x = 1.u 1 v 0^k low(x) @@ -199,11 +196,9 @@ { printf ("Error in mpfr_cmp2:\n"); printf ("x="); - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); printf ("y="); - mpfr_print_binary (y); - puts (""); + mpfr_dump (y); printf ("got %lu, expected 1\n", (unsigned long) j); exit (1); } @@ -215,8 +210,8 @@ if (mpfr_cmp2(x, y, &j) <= 0 || j != 32) { printf ("Error in mpfr_cmp2:\n"); - printf ("x="); mpfr_print_binary(x); puts (""); - printf ("y="); mpfr_print_binary(y); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); printf ("got %lu, expected 32\n", (unsigned long) j); exit (1); } @@ -228,8 +223,8 @@ if (mpfr_cmp2(x, y, &j) <= 0 || j != 164) { printf ("Error in mpfr_cmp2:\n"); - printf ("x="); mpfr_print_binary(x); puts (""); - printf ("y="); mpfr_print_binary(y); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); printf ("got %lu, expected 164\n", (unsigned long) j); exit (1); } @@ -242,8 +237,8 @@ if (mpfr_cmp2(x, y, &j) <= 0 || j != 127) { printf ("Error in mpfr_cmp2:\n"); - printf ("x="); mpfr_print_binary(x); puts (""); - printf ("y="); mpfr_print_binary(y); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); printf ("got %lu, expected 127\n", (unsigned long) j); exit (1); } @@ -256,8 +251,8 @@ if (mpfr_cmp2(x, y, &j) <= 0 || j != 63) { printf ("Error in mpfr_cmp2:\n"); - printf ("x="); mpfr_print_binary(x); puts (""); - printf ("y="); mpfr_print_binary(y); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); printf ("got %lu, expected 63\n", (unsigned long) j); exit (1); } @@ -270,8 +265,8 @@ if (mpfr_cmp2(x, y, &j) <= 0 || j != 63) { printf ("Error in mpfr_cmp2:\n"); - printf ("x="); mpfr_print_binary(x); puts (""); - printf ("y="); mpfr_print_binary(y); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); printf ("got %lu, expected 63\n", (unsigned long) j); exit (1); } @@ -302,6 +297,51 @@ mpfr_clear (y); } +/* Compare (m,kx) and (m,ky), where (m,k) means m fixed limbs followed by + k zero limbs. */ +static void +test_equal (void) +{ + mpfr_t w, x, y; + int m, kx, ky, inex; + mpfr_prec_t j; + + for (m = 1; m <= 4; m++) + { + mpfr_init2 (w, m * GMP_NUMB_BITS); + for (kx = 0; kx <= 4; kx++) + for (ky = 0; ky <= 4; ky++) + { + do mpfr_urandomb (w, RANDS); while (mpfr_zero_p (w)); + mpfr_init2 (x, (m + kx) * GMP_NUMB_BITS + - (kx == 0 ? 0 : randlimb () % GMP_NUMB_BITS)); + mpfr_init2 (y, (m + ky) * GMP_NUMB_BITS + - (ky == 0 ? 0 : randlimb () % GMP_NUMB_BITS)); + inex = mpfr_set (x, w, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + inex = mpfr_set (y, w, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + MPFR_ASSERTN (mpfr_equal_p (x, y)); + if (randlimb () & 1) + mpfr_neg (x, x, MPFR_RNDN); + if (randlimb () & 1) + mpfr_neg (y, y, MPFR_RNDN); + if (mpfr_cmp2 (x, y, &j) != 0) + { + printf ("Error in test_equal for m = %d, kx = %d, ky = %d\n", + m, kx, ky); + printf (" x = "); + mpfr_dump (x); + printf (" y = "); + mpfr_dump (y); + exit (1); + } + mpfr_clears (x, y, (mpfr_ptr) 0); + } + mpfr_clear (w); + } +} + int main (void) { @@ -342,6 +382,8 @@ tcmp2 (x, y, -1); } + test_equal (); + tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tcmpabs.c mpfr4-4.0.2/tests/tcmpabs.c --- mpfr4-3.1.4/tests/tcmpabs.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tcmpabs.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_cmpabs. -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,15 +17,12 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" -#define ERROR(s) do { printf(s); exit(1); } while (0) +#define PRINT_ERROR(s) do { printf ("%s", s); exit (1); } while (0) int main (void) @@ -42,67 +39,67 @@ MPFR_SET_NAN (xx); MPFR_SET_NAN (yy); if (mpfr_cmpabs (xx, yy) != 0) - ERROR ("mpfr_cmpabs (NAN,NAN) returns non-zero\n"); + PRINT_ERROR ("mpfr_cmpabs (NAN,NAN) returns non-zero\n"); if (!mpfr_erangeflag_p ()) - ERROR ("mpfr_cmpabs (NAN,NAN) doesn't set erange flag\n"); + PRINT_ERROR ("mpfr_cmpabs (NAN,NAN) doesn't set erange flag\n"); mpfr_set_str_binary (xx, "0.10E0"); mpfr_set_str_binary (yy, "-0.10E0"); if (mpfr_cmpabs (xx, yy) != 0) - ERROR ("mpfr_cmpabs (xx, yy) returns non-zero for prec=2\n"); + PRINT_ERROR ("mpfr_cmpabs (xx, yy) returns non-zero for prec=2\n"); mpfr_set_prec (xx, 65); mpfr_set_prec (yy, 65); mpfr_set_str_binary (xx, "-0.10011010101000110101010000000011001001001110001011101011111011101E623"); mpfr_set_str_binary (yy, "0.10011010101000110101010000000011001001001110001011101011111011100E623"); if (mpfr_cmpabs (xx, yy) <= 0) - ERROR ("Error (1) in mpfr_cmpabs\n"); + PRINT_ERROR ("Error (1) in mpfr_cmpabs\n"); mpfr_set_str_binary (xx, "-0.10100010001110110111000010001000010011111101000100011101000011100"); mpfr_set_str_binary (yy, "-0.10100010001110110111000010001000010011111101000100011101000011011"); if (mpfr_cmpabs (xx, yy) <= 0) - ERROR ("Error (2) in mpfr_cmpabs\n"); + PRINT_ERROR ("Error (2) in mpfr_cmpabs\n"); mpfr_set_prec (xx, 160); mpfr_set_prec (yy, 160); mpfr_set_str_binary (xx, "0.1E1"); mpfr_set_str_binary (yy, "-0.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000110001110100"); if (mpfr_cmpabs (xx, yy) <= 0) - ERROR ("Error (3) in mpfr_cmpabs\n"); + PRINT_ERROR ("Error (3) in mpfr_cmpabs\n"); mpfr_set_prec(xx, 53); mpfr_set_prec(yy, 200); mpfr_set_ui (xx, 1, (mpfr_rnd_t) 0); mpfr_set_ui (yy, 1, (mpfr_rnd_t) 0); if (mpfr_cmpabs(xx, yy) != 0) - ERROR ("Error in mpfr_cmpabs: 1.0 != 1.0\n"); + PRINT_ERROR ("Error in mpfr_cmpabs: 1.0 != 1.0\n"); mpfr_set_prec (yy, 31); mpfr_set_str (xx, "-1.0000000002", 10, (mpfr_rnd_t) 0); mpfr_set_ui (yy, 1, (mpfr_rnd_t) 0); if (!(mpfr_cmpabs(xx,yy)>0)) - ERROR ("Error in mpfr_cmpabs: not 1.0000000002 > 1.0\n"); + PRINT_ERROR ("Error in mpfr_cmpabs: not 1.0000000002 > 1.0\n"); mpfr_set_prec(yy, 53); mpfr_set_ui(xx, 0, MPFR_RNDN); mpfr_set_str (yy, "-0.1", 10, MPFR_RNDN); if (mpfr_cmpabs(xx, yy) >= 0) - ERROR ("Error in mpfr_cmpabs(0.0, 0.1)\n"); + PRINT_ERROR ("Error in mpfr_cmpabs(0.0, 0.1)\n"); mpfr_set_inf (xx, -1); mpfr_set_str (yy, "23489745.0329", 10, MPFR_RNDN); if (mpfr_cmpabs(xx, yy) <= 0) - ERROR ("Error in mpfr_cmp(-Inf, 23489745.0329)\n"); + PRINT_ERROR ("Error in mpfr_cmp(-Inf, 23489745.0329)\n"); mpfr_set_inf (xx, 1); mpfr_set_inf (yy, -1); if (mpfr_cmpabs(xx, yy) != 0) - ERROR ("Error in mpfr_cmpabs(Inf, -Inf)\n"); + PRINT_ERROR ("Error in mpfr_cmpabs(Inf, -Inf)\n"); mpfr_set_inf (yy, -1); mpfr_set_str (xx, "2346.09234", 10, MPFR_RNDN); if (mpfr_cmpabs (xx, yy) >= 0) - ERROR ("Error in mpfr_cmpabs(-Inf, 2346.09234)\n"); + PRINT_ERROR ("Error in mpfr_cmpabs(-Inf, 2346.09234)\n"); mpfr_set_prec (xx, 2); mpfr_set_prec (yy, 128); @@ -111,10 +108,10 @@ "0.100000000000000000000000000000000000000000000000" "00000000000000000000000000000000000000000000001E10"); if (mpfr_cmpabs (xx, yy) >= 0) - ERROR ("Error in mpfr_cmpabs(10.235, 2346.09234)\n"); + PRINT_ERROR ("Error in mpfr_cmpabs(10.235, 2346.09234)\n"); mpfr_swap (xx, yy); if (mpfr_cmpabs(xx, yy) <= 0) - ERROR ("Error in mpfr_cmpabs(2346.09234, 10.235)\n"); + PRINT_ERROR ("Error in mpfr_cmpabs(2346.09234, 10.235)\n"); mpfr_swap (xx, yy); /* Check for NAN */ diff -Nru mpfr4-3.1.4/tests/tcmp.c mpfr4-4.0.2/tests/tcmp.c --- mpfr4-3.1.4/tests/tcmp.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tcmp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_cmp. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" int diff -Nru mpfr4-3.1.4/tests/tcmp_d.c mpfr4-4.0.2/tests/tcmp_d.c --- mpfr4-3.1.4/tests/tcmp_d.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tcmp_d.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_cmp_d. -Copyright 1999, 2001-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" int @@ -34,32 +31,36 @@ tests_start_mpfr (); emin = mpfr_get_emin (); - mpfr_init2(x, IEEE_DBL_MANT_DIG); + mpfr_init2 (x, IEEE_DBL_MANT_DIG); mpfr_set_d (x, 2.34763465, MPFR_RNDN); - if (mpfr_cmp_d(x, 2.34763465)!=0) { - printf("Error in mpfr_cmp_d 2.34763465 and "); - mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); - exit(1); - } - if (mpfr_cmp_d(x, 2.345)<=0) { - printf("Error in mpfr_cmp_d 2.345 and "); - mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); - exit(1); - } - if (mpfr_cmp_d(x, 2.4)>=0) { - printf("Error in mpfr_cmp_d 2.4 and "); - mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); - exit(1); - } + if (mpfr_cmp_d (x, 2.34763465) != 0) + { + printf ("Error in mpfr_cmp_d 2.34763465 and "); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); + exit (1); + } + if (mpfr_cmp_d (x, 2.345) <= 0) + { + printf ("Error in mpfr_cmp_d 2.345 and "); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); + exit (1); + } + if (mpfr_cmp_d (x, 2.4) >= 0) + { + printf ("Error in mpfr_cmp_d 2.4 and "); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); + exit (1); + } mpfr_set_ui (x, 0, MPFR_RNDZ); mpfr_neg (x, x, MPFR_RNDZ); - if (mpfr_cmp_d (x, 0.0)) { - printf("Error in mpfr_cmp_d 0.0 and "); - mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); - exit(1); - } + if (mpfr_cmp_d (x, 0.0)) + { + printf ("Error in mpfr_cmp_d 0.0 and "); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); + exit (1); + } mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_ui_div (x, 1, x, MPFR_RNDU); @@ -123,7 +124,7 @@ } #endif /* MPFR_ERRDIVZERO */ - mpfr_clear(x); + mpfr_clear (x); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tcmp_ld.c mpfr4-4.0.2/tests/tcmp_ld.c --- mpfr4-3.1.4/tests/tcmp_ld.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tcmp_ld.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_cmp_ld. -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,10 +17,10 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include + +#include #include "mpfr-test.h" @@ -36,29 +36,33 @@ mpfr_init2(x, MPFR_LDBL_MANT_DIG); mpfr_set_ld (x, 2.34763465L, MPFR_RNDN); - if (mpfr_cmp_ld(x, 2.34763465L)!=0) { - printf("Error in mpfr_cmp_ld 2.34763465 and "); - mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); - exit(1); - } - if (mpfr_cmp_ld(x, 2.345L)<=0) { - printf("Error in mpfr_cmp_ld 2.345 and "); - mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); - exit(1); - } - if (mpfr_cmp_ld(x, 2.4L)>=0) { - printf("Error in mpfr_cmp_ld 2.4 and "); - mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); - exit(1); - } + if (mpfr_cmp_ld (x, 2.34763465L) != 0) + { + printf ("Error in mpfr_cmp_ld 2.34763465 and "); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); + exit (1); + } + if (mpfr_cmp_ld (x, 2.345L) <= 0) + { + printf ("Error in mpfr_cmp_ld 2.345 and "); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); + exit (1); + } + if (mpfr_cmp_ld (x, 2.4L) >= 0) + { + printf ("Error in mpfr_cmp_ld 2.4 and "); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); + exit (1); + } mpfr_set_ui (x, 0, MPFR_RNDZ); mpfr_neg (x, x, MPFR_RNDZ); - if (mpfr_cmp_ld (x, 0.0)) { - printf("Error in mpfr_cmp_ld 0.0 and "); - mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); - exit(1); - } + if (mpfr_cmp_ld (x, 0.0)) + { + printf ("Error in mpfr_cmp_ld 0.0 and "); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); + exit (1); + } mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_ui_div (x, 1, x, MPFR_RNDU); @@ -122,7 +126,7 @@ } #endif /* MPFR_ERRDIVZERO */ - mpfr_clear(x); + mpfr_clear (x); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tcmp_ui.c mpfr4-4.0.2/tests/tcmp_ui.c --- mpfr4-3.1.4/tests/tcmp_ui.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/tests/tcmp_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_cmp_ui and mpfr_cmp_si. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef TCMP_UI_CHECK_NAN @@ -56,9 +56,6 @@ #else -#include -#include - #include "mpfr-test.h" static void diff -Nru mpfr4-3.1.4/tests/tcomparisons.c mpfr4-4.0.2/tests/tcomparisons.c --- mpfr4-3.1.4/tests/tcomparisons.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tcomparisons.c 2019-01-07 13:53:20.000000000 +0000 @@ -2,7 +2,7 @@ mpfr_lessequal_p, mpfr_lessgreater_p, mpfr_equal_p, mpfr_unordered_p functions. -Copyright 2003, 2006-2016 Free Software Foundation, Inc. +Copyright 2003, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -19,12 +19,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void diff -Nru mpfr4-3.1.4/tests/tconst_catalan.c mpfr4-4.0.2/tests/tconst_catalan.c --- mpfr4-3.1.4/tests/tconst_catalan.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/tests/tconst_catalan.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_const_catalan. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include "mpfr-test.h" /* Wrapper for tgeneric */ @@ -52,7 +50,7 @@ } mpfr_clear (x); - test_generic (2, 200, 1); + test_generic (MPFR_PREC_MIN, 200, 1); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tconst_euler.c mpfr4-4.0.2/tests/tconst_euler.c --- mpfr4-3.1.4/tests/tconst_euler.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tconst_euler.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_const_euler. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" /* Wrapper for tgeneric */ @@ -77,11 +74,14 @@ mpfr_set_prec (t, prec); yprec = prec + 10; - for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) + RND_LOOP_NO_RNDF (rnd) { mpfr_set_prec (y, yprec); mpfr_const_euler (y, (mpfr_rnd_t) rnd); err = (rnd == MPFR_RNDN) ? yprec + 1 : yprec; + /* Note: for rnd = RNDF, rnd1 = RNDF is equivalent to rnd1 = RNDN + in mpfr_can_round, thus rnd2 = RNDF reduces to rnd2 = RNDN in that + case, we are duplicating the test for rnd = RNDN. */ if (mpfr_can_round (y, err, (mpfr_rnd_t) rnd, (mpfr_rnd_t) rnd, prec)) { mpfr_set (t, y, (mpfr_rnd_t) rnd); @@ -97,8 +97,7 @@ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); puts (""); printf (" approximation was "); - mpfr_print_binary (y); - puts (""); + mpfr_dump (y); exit (1); } } @@ -109,7 +108,7 @@ mpfr_clear (z); mpfr_clear (t); - test_generic (2, 200, 1); + test_generic (MPFR_PREC_MIN, 200, 1); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tconst_log2.c mpfr4-4.0.2/tests/tconst_log2.c --- mpfr4-3.1.4/tests/tconst_log2.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tconst_log2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_const_log2. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" /* tlog2 [prec] [rnd] [0 = no print] */ @@ -31,8 +28,7 @@ check (mpfr_prec_t p0, mpfr_prec_t p1) { mpfr_t x, y, z; - mpfr_rnd_t rnd; - int dif; + int i, inex, inex_ref; mpfr_init (x); mpfr_init (y); @@ -40,22 +36,28 @@ mpfr_const_log2 (z, MPFR_RNDN); mpfr_clear_cache (__gmpfr_cache_const_log2); - for (; p0<=p1; p0++) + for (; p0 <= p1; p0++) { mpfr_set_prec (x, p0); mpfr_set_prec (y, p0); + RND_LOOP_NO_RNDF (i) { - rnd = RND_RAND (); - mpfr_const_log2 (x, rnd); - mpfr_set (y, z, rnd); - if ((dif = mpfr_cmp (x, y)) - && mpfr_can_round (z, mpfr_get_prec(z), MPFR_RNDN, - rnd, p0)) + mpfr_rnd_t rnd = (mpfr_rnd_t) i; + inex = mpfr_const_log2 (x, rnd); + inex_ref = mpfr_set (y, z, rnd); + if (! mpfr_can_round (z, mpfr_get_prec (z), MPFR_RNDN, rnd, p0)) + { + printf ("increase guard precision in check()\n"); + exit (1); + } + if (mpfr_cmp (x, y) || inex != inex_ref) { - printf ("mpfr_const_log2 fails for prec=%u, rnd=%s Diff=%d\n", - (unsigned int) p0, mpfr_print_rnd_mode (rnd), dif); + printf ("mpfr_const_log2 fails for prec=%u, rnd=%s\n", + (unsigned int) p0, mpfr_print_rnd_mode (rnd)); printf ("expected "), mpfr_dump (y); printf ("got "), mpfr_dump (x); + printf ("expected inex = %d\n", inex_ref); + printf ("got inex = %d\n", inex); exit (1); } } @@ -69,15 +71,27 @@ static void check_large (void) { - mpfr_t x, y; + mpfr_t x, y, z; + mpfr_init2 (x, 25000); mpfr_init2 (y, 26000); + mpfr_init2 (z, 26000); (mpfr_const_log2) (x, MPFR_RNDN); /* First one ! */ (mpfr_const_log2) (y, MPFR_RNDN); /* Then the other - cache - */ + mpfr_set (z, y, MPFR_RNDN); mpfr_prec_round (y, 25000, MPFR_RNDN); - if (mpfr_cmp (x, y)) + if (mpfr_cmp (x, y) != 0) { printf ("const_log2: error for large prec\n"); + printf ("x = "); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); + printf ("\n"); + printf ("y = "); + mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN); + printf ("\n"); + printf ("z = "); + mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN); + printf ("\n"); exit (1); } @@ -86,7 +100,7 @@ mpfr_set_prec (x, 26249); mpfr_const_log2 (x, MPFR_RNDZ); - mpfr_clears (x, y, (mpfr_ptr) 0); + mpfr_clears (x, y, z, (mpfr_ptr) 0); } static void @@ -146,11 +160,13 @@ tests_start_mpfr (); p = (argc>1) ? atoi(argv[1]) : 53; - rnd = (argc>2) ? (mpfr_rnd_t) atoi(argv[2]) : MPFR_RNDZ; + rnd = (argc>2) ? (mpfr_rnd_t) atoi(argv[2]) : MPFR_RNDN; mpfr_init (x); - check (2, 1000); + /* increase the 2nd argument to say 300000 to perform the exhaustive search + in src/const_log2.c */ + check (MPFR_PREC_MIN, 1000); /* check precision of 2 bits */ mpfr_set_prec (x, 2); @@ -164,11 +180,10 @@ exit (1); } - if (argc>=2) + if (argc >= 2) { mpfr_set_prec (x, p); mpfr_const_log2 (x, rnd); - printf ("log(2)="); mpfr_out_str (stdout, 10, 0, x, rnd); puts (""); } @@ -189,12 +204,12 @@ exit (1); } - mpfr_clear(x); + mpfr_clear (x); - check_large(); + check_large (); check_cache (); - test_generic (2, 200, 1); + test_generic (MPFR_PREC_MIN, 200, 1); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tconst_pi.c mpfr4-4.0.2/tests/tconst_pi.c --- mpfr4-3.1.4/tests/tconst_pi.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tconst_pi.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_const_pi. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,14 +17,77 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" +#if defined(MPFR_WANT_SHARED_CACHE) && defined(HAVE_PTHREAD) + +# include + +#define MAX_THREAD 100 + +static void * +start_routine (void *arg) +{ + mpfr_prec_t p; + mpfr_t x; + mpfr_prec_t inc = *(int *) arg; + mp_limb_t *m; + + for (p = 100; p < 20000; p += 64 + 100 * (inc % 10)) + { + mpfr_init2 (x, p); + m = MPFR_MANT (x); + mpfr_const_pi (x, MPFR_RNDD); + mpfr_prec_round (x, 53, MPFR_RNDD); + if (mpfr_cmp_str1 (x, "3.141592653589793116")) + { + printf ("mpfr_const_pi failed with threading\n"); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); + exit (1); + } + /* Check that no reallocation has been performed */ + MPFR_ASSERTN (m == MPFR_MANT (x)); + mpfr_clear (x); + } + + pthread_exit (NULL); +} + +static void +run_pthread_test (void) +{ + int i; + int error_code; + pthread_t thread_id[MAX_THREAD]; + int table[MAX_THREAD]; + + for (i = 0; i < MAX_THREAD; i++) + { + table[i] = i; + error_code = pthread_create(&thread_id[i], + NULL, start_routine, &table[i]); + MPFR_ASSERTN (error_code == 0); + } + + for (i = 0; i < MAX_THREAD; i++) + { + error_code = pthread_join (thread_id[i], NULL); + MPFR_ASSERTN (error_code == 0); + } +} + +# define RUN_PTHREAD_TEST() \ + (MPFR_ASSERTN(mpfr_buildopt_sharedcache_p() == 1), run_pthread_test()) + +#else + +# define RUN_PTHREAD_TEST() ((void) 0) + +#endif + /* tconst_pi [prec] [rnd] [0 = no print] */ static void @@ -109,11 +172,13 @@ mpfr_set_prec (x_ref, p); for (r = 0; r < MPFR_RND_MAX; r++) { + if (r == MPFR_RNDF) + continue; /* the test below makes no sense */ inex = mpfr_const_pi (x, (mpfr_rnd_t) r); inex_ref = mpfr_const_pi_internal (x_ref, (mpfr_rnd_t) r); if (inex != inex_ref || mpfr_cmp (x, x_ref) != 0) { - printf ("mpfr_const_pi and mpfr_const_pi_internal disagree\n"); + printf ("mpfr_const_pi and mpfr_const_pi_internal disagree for rnd=%s\n", mpfr_print_rnd_mode ((mpfr_rnd_t) r)); printf ("mpfr_const_pi gives "); mpfr_dump (x); printf ("mpfr_const_pi_internal gives "); @@ -140,7 +205,7 @@ if (argc > 1) { long a = atol (argv[1]); - if (a >= MPFR_PREC_MIN && a <= MPFR_PREC_MAX) + if (MPFR_PREC_COND (a)) p = a; } @@ -178,9 +243,20 @@ check_large (); - test_generic (2, 200, 1); + test_generic (MPFR_PREC_MIN, 200, 1); + + RUN_PTHREAD_TEST(); + + /* the following is just to test mpfr_free_cache2 with MPFR_FREE_LOCAL_CACHE, + it should not hurt, since the call to mpfr_free_cache in tests_end_mpfr + will do nothing */ + mpfr_free_cache2 (MPFR_FREE_LOCAL_CACHE); tests_end_mpfr (); + /* another test of mpfr_free_cache2 with MPFR_FREE_LOCAL_CACHE, to check + that we can call it when the caches are already freed */ + mpfr_free_cache2 (MPFR_FREE_LOCAL_CACHE); + return 0; } diff -Nru mpfr4-3.1.4/tests/tcopysign.c mpfr4-4.0.2/tests/tcopysign.c --- mpfr4-3.1.4/tests/tcopysign.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tcopysign.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_copysign, mpfr_setsign and mpfr_signbit. -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void diff -Nru mpfr4-3.1.4/tests/tcos.c mpfr4-4.0.2/tests/tcos.c --- mpfr4-3.1.4/tests/tcos.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/tests/tcos.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_cos. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #ifdef CHECK_EXTERNAL @@ -181,55 +178,57 @@ /* and if emax < 0, 1 - eps is not representable either. */ for (i = -1; i <= 1; i++) RND_LOOP (rnd) - { - mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN); - mpfr_clear_flags (); - inex = mpfr_cos (x, x, (mpfr_rnd_t) rnd); - if ((i == 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) && - ! mpfr_overflow_p ()) - { - printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n" - " The overflow flag is not set.\n", - i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - err = 1; - } - if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD) - { - if (inex >= 0) - { - printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n" - " The inexact value must be negative.\n", - i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - err = 1; - } - if (! mpfr_equal_p (x, y)) - { - printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of 0.11111111E%d.\n", emax); - err = 1; - } - } - else - { - if (inex <= 0) - { - printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n" - " The inexact value must be positive.\n", - i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - err = 1; - } - if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0)) - { - printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of +Inf.\n"); - err = 1; - } - } - } + { + mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN); + mpfr_clear_flags (); + inex = mpfr_cos (x, x, (mpfr_rnd_t) rnd); + if ((i == 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) && + ! mpfr_overflow_p ()) + { + printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n" + " The overflow flag is not set.\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + err = 1; + } + if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD) + { + if (inex >= 0) + { + printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n" + " The inexact value must be negative.\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + err = 1; + } + if (! mpfr_equal_p (x, y)) + { + printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n" + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of 0.11111111E%d.\n", emax); + err = 1; + } + } + else if (rnd != MPFR_RNDF) + { + if (inex <= 0) + { + printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n" + " The inexact value must be positive.\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + err = 1; + } + if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) + { + printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n" + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of +Inf.\n"); + err = 1; + } + } + } set_emax (old_emax); } @@ -279,8 +278,8 @@ if (mpfr_cmp (y, x)) { printf ("Error for prec=30, rnd=MPFR_RNDU\n"); - printf ("expected "); mpfr_print_binary (x); puts (""); - printf (" got "); mpfr_print_binary (y); puts (""); + printf ("expected "); mpfr_dump (x); + printf (" got "); mpfr_dump (y); exit (1); } @@ -292,8 +291,8 @@ if (mpfr_cmp (y, x)) { printf ("Error for prec=59, rnd=MPFR_RNDU\n"); - printf ("expected "); mpfr_print_binary (x); puts (""); - printf (" got "); mpfr_print_binary (y); puts (""); + printf ("expected "); mpfr_dump (x); + printf (" got "); mpfr_dump (y); exit (1); } @@ -305,7 +304,7 @@ if (mpfr_cmp (y, x)) { printf ("Error for x=1.1100e-2, rnd=MPFR_RNDD\n"); - printf ("expected 1.1100e-1, got "); mpfr_print_binary (y); puts (""); + printf ("expected 1.1100e-1, got "); mpfr_dump (y); exit (1); } @@ -359,7 +358,7 @@ check53 ("1.00591265847407274059", "0.53531755997839769456", MPFR_RNDN); overflowed_cos0 (); - test_generic (2, 100, 15); + test_generic (MPFR_PREC_MIN, 100, 15); /* check inexact flag */ mpfr_set_prec (x, 3); diff -Nru mpfr4-3.1.4/tests/tcosh.c mpfr4-4.0.2/tests/tcosh.c --- mpfr4-3.1.4/tests/tcosh.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tcosh.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_cosh. -Copyright 2001-2002, 2004-2016 Free Software Foundation, Inc. +Copyright 2001-2002, 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_cosh @@ -104,28 +101,28 @@ mpfr_clear_flags (); mpfr_set_str_binary (x, "1E1000000000"); i = mpfr_cosh (x, x, MPFR_RNDN); - MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_IS_POS (x)); MPFR_ASSERTN (mpfr_overflow_p ()); MPFR_ASSERTN (i == 1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); i = mpfr_cosh (x, x, MPFR_RNDN); - MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_IS_POS (x)); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == 1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); i = mpfr_cosh (x, x, MPFR_RNDD); - MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_IS_POS (x)); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == -1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); i = mpfr_cosh (x, x, MPFR_RNDU); - MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_IS_POS (x)); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == 1); @@ -194,7 +191,7 @@ special_overflow (); special (); - test_generic (2, 100, 100); + test_generic (MPFR_PREC_MIN, 100, 100); data_check ("data/cosh", mpfr_cosh, "mpfr_cosh"); bad_cases (mpfr_cosh, mpfr_acosh, "mpfr_cosh", 0, 1, 255, 4, 128, 800, 100); diff -Nru mpfr4-3.1.4/tests/tcot.c mpfr4-4.0.2/tests/tcot.c --- mpfr4-3.1.4/tests/tcot.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tcot.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_cot. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_cot @@ -110,7 +107,7 @@ mpfr_div (y, y, x, (mpfr_rnd_t) rnd); /* 1/x - SIGN(x).epsilon */ mpfr_set_si_2exp (x, i, -e, MPFR_RNDN); mpfr_cot (x, x, (mpfr_rnd_t) rnd); - if (! mpfr_equal_p (x, y)) + if (! mpfr_equal_p (x, y) && rnd != MPFR_RNDF) { printf ("Error in two2emin for i = %d and rnd = %s\n", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); @@ -137,7 +134,7 @@ two2emin (MPFR_EMAX_DEFAULT); if (MPFR_EMAX_MAX != MPFR_EMAX_DEFAULT) two2emin (MPFR_EMAX_MAX); - test_generic (2, 200, 5); + test_generic (MPFR_PREC_MIN, 200, 5); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tcoth.c mpfr4-4.0.2/tests/tcoth.c --- mpfr4-3.1.4/tests/tcoth.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tcoth.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_coth. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_coth @@ -63,14 +60,14 @@ /* coth(+/-0) = +/-Inf */ mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_coth (y, x, MPFR_RNDN); - if (! (mpfr_inf_p (y) && MPFR_SIGN (y) > 0)) + if (! (mpfr_inf_p (y) && MPFR_IS_POS (y))) { printf ("Error: coth(+0) != +Inf\n"); exit (1); } mpfr_neg (x, x, MPFR_RNDN); mpfr_coth (y, x, MPFR_RNDN); - if (! (mpfr_inf_p (y) && MPFR_SIGN (y) < 0)) + if (! (mpfr_inf_p (y) && MPFR_IS_NEG (y))) { printf ("Error: coth(-0) != -Inf\n"); exit (1); @@ -144,7 +141,7 @@ mpfr_init2 (y, 8); for (i = -1; i <= 1; i += 2) - RND_LOOP (rnd) + RND_LOOP_NO_RNDF (rnd) { mpfr_set_inf (x, i); mpfr_clear_flags (); @@ -167,11 +164,11 @@ MPFR_MULT_SIGN (MPFR_SIGN (x), MPFR_SIGN (y)) > 0)) { printf ("Error in underflowed_cothinf (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of "); - mpfr_print_binary (y); - printf (".\n"); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of "); + mpfr_dump (y); err = 1; } if ((rnd == MPFR_RNDD || @@ -205,7 +202,7 @@ check_specials (); check_bugs (); - test_generic (2, 200, 10); + test_generic (MPFR_PREC_MIN, 200, 10); underflowed_cothinf (); tests_end_mpfr (); diff -Nru mpfr4-3.1.4/tests/tcsc.c mpfr4-4.0.2/tests/tcsc.c --- mpfr4-3.1.4/tests/tcsc.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tcsc.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_csc. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_csc @@ -88,7 +85,7 @@ check_specials (); - test_generic (2, 100, 10); + test_generic (MPFR_PREC_MIN, 100, 10); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tcsch.c mpfr4-4.0.2/tests/tcsch.c --- mpfr4-3.1.4/tests/tcsch.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tcsch.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_csch. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_csch @@ -47,7 +44,7 @@ mpfr_set_inf (x, 1); mpfr_csch (y, x, MPFR_RNDN); - if (! (mpfr_zero_p (y) && MPFR_SIGN (y) >0)) + if (! (mpfr_zero_p (y) && MPFR_IS_POS (y))) { printf ("Error: csch(+Inf) != +0\n"); exit (1); @@ -55,7 +52,7 @@ mpfr_set_inf (x, -1); mpfr_csch (y, x, MPFR_RNDN); - if (! (mpfr_zero_p (y) && MPFR_SIGN (y) <0)) + if (! (mpfr_zero_p (y) && MPFR_IS_NEG (y))) { printf ("Error: csch(-0) != -0\n"); exit (1); @@ -80,14 +77,14 @@ /* check huge x */ mpfr_set_str (x, "8e8", 10, MPFR_RNDN); mpfr_csch (y, x, MPFR_RNDN); - if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0)) + if (! (mpfr_zero_p (y) && MPFR_IS_POS (y))) { printf ("Error: csch(8e8) != +0\n"); exit (1); } mpfr_set_str (x, "-8e8", 10, MPFR_RNDN); mpfr_csch (y, x, MPFR_RNDN); - if (! (mpfr_zero_p (y) && MPFR_SIGN (y) < 0)) + if (! (mpfr_zero_p (y) && MPFR_IS_NEG (y))) { printf ("Error: csch(-8e8) != -0\n"); exit (1); @@ -103,7 +100,7 @@ tests_start_mpfr (); check_specials (); - test_generic (2, 200, 10); + test_generic (MPFR_PREC_MIN, 200, 10); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/td_div.c mpfr4-4.0.2/tests/td_div.c --- mpfr4-3.1.4/tests/td_div.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/td_div.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_d_div -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,17 +17,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include #include "mpfr-test.h" -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) - static void check_nans (void) { @@ -191,19 +187,8 @@ check_nans (); - test_generic (2, 1000, 100); + test_generic (MPFR_PREC_MIN, 1000, 100); tests_end_mpfr (); return 0; } - -#else - -int -main (void) -{ - printf ("Warning! Test disabled for this MPFR version.\n"); - return 0; -} - -#endif diff -Nru mpfr4-3.1.4/tests/tdigamma.c mpfr4-4.0.2/tests/tdigamma.c --- mpfr4-3.1.4/tests/tdigamma.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tdigamma.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* test file for digamma function -Copyright 2009-2016 Free Software Foundation, Inc. +Copyright 2009-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_digamma @@ -59,7 +56,7 @@ special (); - test_generic (2, 100, 2); + test_generic (MPFR_PREC_MIN, 100, 2); data_check ("data/digamma", mpfr_digamma, "mpfr_digamma"); diff -Nru mpfr4-3.1.4/tests/tdim.c mpfr4-4.0.2/tests/tdim.c --- mpfr4-3.1.4/tests/tdim.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tdim.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_dim. -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_dim @@ -67,7 +64,7 @@ mpfr_set_inf (x, -1); mpfr_set_ui (y, 0, MPFR_RNDN); mpfr_dim (z, x, y, MPFR_RNDN); - if (mpfr_cmp_ui (z, 0) || mpfr_sgn (z) < 0) + if (MPFR_NOTZERO (z) || MPFR_IS_NEG (z)) { printf ("Error in mpfr_dim (-Inf, 0)\n"); exit (1); @@ -77,7 +74,7 @@ mpfr_set_inf (x, 1); mpfr_set_inf (y, 1); mpfr_dim (z, x, y, MPFR_RNDN); - if (mpfr_cmp_ui (z, 0) || mpfr_sgn (z) < 0) + if (MPFR_NOTZERO (z) || MPFR_IS_NEG (z)) { printf ("Error in mpfr_dim (+Inf, +Inf)\n"); exit (1); @@ -107,7 +104,7 @@ mpfr_clear (y); mpfr_clear (z); - test_generic (2, 220, 42); + test_generic (MPFR_PREC_MIN, 220, 42); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tdiv.c mpfr4-4.0.2/tests/tdiv.c --- mpfr4-3.1.4/tests/tdiv.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/tests/tdiv.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_div (and some mpfr_div_ui, etc. tests). -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,20 +17,18 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void check_equal (mpfr_srcptr a, mpfr_srcptr a2, char *s, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t r) { - if ((MPFR_IS_NAN (a) && MPFR_IS_NAN (a2)) || - mpfr_equal_p (a, a2)) + if (SAME_VAL (a, a2)) + return; + if (r == MPFR_RNDF) /* RNDF might return different values */ return; printf ("Error in %s\n", mpfr_print_rnd_mode (r)); printf ("b = "); @@ -54,7 +52,9 @@ oldflags = __gmpfr_flags; inex = mpfr_div (a, b, c, r); - if (a == b || a == c) + /* this test makes no sense for RNDF, since it compares the ternary value + and the flags */ + if (a == b || a == c || r == MPFR_RNDF) return inex; newflags = __gmpfr_flags; @@ -163,10 +163,11 @@ { printf ("mpfr_div failed for n=%s, d=%s, p=%d, rnd_mode=%s\n", Ns, Ds, p, mpfr_print_rnd_mode (rnd_mode)); - printf ("got ");mpfr_print_binary(q); + printf ("got "); + mpfr_dump (q); mpfr_set_str (q, Qs, ((p==53) ? 10 : 2), MPFR_RNDN); - printf("\nexpected "); mpfr_print_binary(q); - putchar('\n'); + printf ("expected "); + mpfr_dump (q); exit (1); } mpfr_clears (q, n, d, (mpfr_ptr) 0); @@ -292,14 +293,14 @@ test_div(z, x, y, MPFR_RNDU); if (mpfr_cmp_str (z, "0.1001001001101101010010100101011110000010111001001010100000000000E-529", 2, MPFR_RNDN)) { - printf("Error for tdiv for MPFR_RNDU and p=64\nx="); - mpfr_print_binary(x); - printf("\ny="); - mpfr_print_binary(y); - printf("\ngot "); - mpfr_print_binary(z); - printf("\nexpected 0.1001001001101101010010100101011110000010111001001010100000000000E-529\n"); - exit(1); + printf ("Error for tdiv for MPFR_RNDU and p=64\nx="); + mpfr_dump (x); + printf ("y="); + mpfr_dump (y); + printf ("got "); + mpfr_dump (z); + printf ("expected 0.1001001001101101010010100101011110000010111001001010100000000000E-529\n"); + exit (1); } mpfr_clears (x, y, z, (mpfr_ptr) 0); @@ -325,8 +326,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_div for prec=64, rnd=MPFR_RNDN\n"); - printf ("got "); mpfr_print_binary(x); puts (""); - printf ("instead of "); mpfr_print_binary(y); puts (""); + printf ("got "); mpfr_dump (x); + printf ("instead of "); mpfr_dump (y); exit(1); } @@ -343,7 +344,7 @@ { printf ("mpfr_div failed for x=1.0, y=1.0, prec=%d rnd=%s\n", i, mpfr_print_rnd_mode ((mpfr_rnd_t) j)); - printf ("got "); mpfr_print_binary(y); puts (""); + printf ("got "); mpfr_dump (y); exit (1); } } @@ -413,7 +414,7 @@ mpfr_nextbelow (u); for (i = 0; i <= 2; i++) { - RND_LOOP(rnd) + RND_LOOP_NO_RNDF (rnd) { inex = test_div (q, u, v, (mpfr_rnd_t) rnd); inex2 = get_inexact (q, u, v); @@ -475,8 +476,8 @@ if (c || mpfr_cmp (z2, z)) { printf ("Error in mpfr_div rnd=MPFR_RNDN\n"); - printf ("got "); mpfr_print_binary(z2); puts (""); - printf ("instead of "); mpfr_print_binary(z); puts (""); + printf ("got "); mpfr_dump (z2); + printf ("instead of "); mpfr_dump (z); printf ("inex flag = %d, expected 0\n", c); exit (1); } @@ -501,8 +502,8 @@ if ((mpfr_cmp (z2, z) == 0 && c) || inex_cmp (c, c2)) { printf ("Error in mpfr_div rnd=MPFR_RNDN\n"); - printf ("got "); mpfr_print_binary(z2); puts (""); - printf ("instead of "); mpfr_print_binary(z); puts (""); + printf ("got "); mpfr_dump (z2); + printf ("instead of "); mpfr_dump (z); printf ("inex flag = %d, expected %d\n", c, c2); exit (1); } @@ -513,8 +514,8 @@ { printf ("Error in mpfr_div [even rnd?] rnd=MPFR_RNDN\n"); printf ("Dividing "); - printf ("got "); mpfr_print_binary(z2); puts (""); - printf ("instead of "); mpfr_print_binary(z); puts (""); + printf ("got "); mpfr_dump (z2); + printf ("instead of "); mpfr_dump (z); printf ("inex flag = %d\n", 1); exit (1); } @@ -526,8 +527,8 @@ { printf ("Error in mpfr_div [even rnd?] rnd=MPFR_RNDN\n"); printf ("Dividing "); - printf ("got "); mpfr_print_binary(z2); puts (""); - printf ("instead of "); mpfr_print_binary(z); puts (""); + printf ("got "); mpfr_dump (z2); + printf ("instead of "); mpfr_dump (z); printf ("inex flag = %d\n", 1); exit (1); } @@ -564,8 +565,8 @@ if (c != -1 || mpfr_cmp(z2, z)) { printf ("Error in mpfr_div rnd=MPFR_RNDD\n"); - printf ("got "); mpfr_print_binary(z2); puts (""); - printf ("instead of "); mpfr_print_binary(z); puts (""); + printf ("got "); mpfr_dump (z2); + printf ("instead of "); mpfr_dump (z); printf ("inex flag = %d\n", c); exit (1); } @@ -579,8 +580,8 @@ printf ("Error in mpfr_div rnd=MPFR_RNDU\n"); printf ("u="); mpfr_dump (x); printf ("v="); mpfr_dump (y); - printf ("got "); mpfr_print_binary (z2); puts (""); - printf ("instead of "); mpfr_print_binary (z); puts (""); + printf ("got "); mpfr_dump (z2); + printf ("instead of "); mpfr_dump (z); printf ("inex flag = %d\n", c); exit (1); } @@ -644,7 +645,8 @@ mpfr_set_prec (u, 2); mpfr_set_str_binary (u, "0.1E0"); mpfr_set_prec (y, 28); - if ((inexact = test_div (y, x, u, MPFR_RNDN) >= 0)) + inexact = test_div (y, x, u, MPFR_RNDN); + if (inexact >= 0) { printf ("Wrong inexact flag (1): expected -1, got %d\n", inexact); @@ -656,7 +658,8 @@ mpfr_set_prec (u, 15); mpfr_set_str_binary (u, "0.101101000001100E-1"); mpfr_set_prec (y, 92); - if ((inexact = test_div (y, x, u, MPFR_RNDN)) <= 0) + inexact = test_div (y, x, u, MPFR_RNDN); + if (inexact <= 0) { printf ("Wrong inexact flag for rnd=MPFR_RNDN(1): expected 1, got %d\n", inexact); @@ -679,7 +682,8 @@ mpfr_set_prec (y, py); mpfr_set_prec (z, py + pu); { - rnd = RND_RAND (); + /* inexact is undefined for RNDF */ + rnd = RND_RAND_NO_RNDF (); inexact = test_div (y, x, u, rnd); if (mpfr_mul (z, y, u, rnd)) { @@ -694,10 +698,10 @@ printf ("Wrong inexact flag for rnd=%s\n", mpfr_print_rnd_mode(rnd)); printf ("expected %d, got %d\n", cmp, inexact); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("u="); mpfr_print_binary (u); puts (""); - printf ("y="); mpfr_print_binary (y); puts (""); - printf ("y*u="); mpfr_print_binary (z); puts (""); + printf ("x="); mpfr_dump (x); + printf ("u="); mpfr_dump (u); + printf ("y="); mpfr_dump (y); + printf ("y*u="); mpfr_dump (z); exit (1); } } @@ -782,8 +786,7 @@ MPFR_SET_POS (d); mpfr_clear_flags (); MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ - MPFR_ASSERTN (mpfr_number_p (q)); - MPFR_ASSERTN (mpfr_sgn (q) == 0); + MPFR_ASSERTN (MPFR_IS_ZERO (q)); MPFR_ASSERTN (MPFR_IS_POS (q)); MPFR_ASSERTN (__gmpfr_flags == 0); @@ -793,8 +796,7 @@ MPFR_SET_NEG (d); mpfr_clear_flags (); MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ - MPFR_ASSERTN (mpfr_number_p (q)); - MPFR_ASSERTN (mpfr_sgn (q) == 0); + MPFR_ASSERTN (MPFR_IS_ZERO (q)); MPFR_ASSERTN (MPFR_IS_NEG (q)); MPFR_ASSERTN (__gmpfr_flags == 0); @@ -804,8 +806,7 @@ MPFR_SET_POS (d); mpfr_clear_flags (); MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ - MPFR_ASSERTN (mpfr_number_p (q)); - MPFR_ASSERTN (mpfr_sgn (q) == 0); + MPFR_ASSERTN (MPFR_IS_ZERO (q)); MPFR_ASSERTN (MPFR_IS_NEG (q)); MPFR_ASSERTN (__gmpfr_flags == 0); @@ -815,8 +816,7 @@ MPFR_SET_NEG (d); mpfr_clear_flags (); MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */ - MPFR_ASSERTN (mpfr_number_p (q)); - MPFR_ASSERTN (mpfr_sgn (q) == 0); + MPFR_ASSERTN (MPFR_IS_ZERO (q)); MPFR_ASSERTN (MPFR_IS_POS (q)); MPFR_ASSERTN (__gmpfr_flags == 0); @@ -978,7 +978,8 @@ mpfr_prec_t px, py, pz, p; int inex1, inex2; - rnd = RND_RAND (); + /* inex is undefined for RNDF */ + rnd = RND_RAND_NO_RNDF (); px = (randlimb () % 256) + 2; py = (randlimb () % 128) + 2; pz = (randlimb () % 256) + 2; @@ -1003,7 +1004,11 @@ MPFR_ASSERTN (!MPFR_IS_NAN (z2)); if (inex1 != inex2 || mpfr_cmp (z1, z2) != 0) { - printf ("Consistency error for i = %d\n", i); + printf ("Consistency error for i = %d, rnd = %s\n", i, + mpfr_print_rnd_mode (rnd)); + printf ("inex1=%d inex2=%d\n", inex1, inex2); + printf ("z1="); mpfr_dump (z1); + printf ("z2="); mpfr_dump (z2); exit (1); } } @@ -1079,7 +1084,7 @@ mpfr_set_si_2exp (y, 1, -256, MPFR_RNDN); mpfr_clear_flags (); inex = mpfr_div (x, x, y, MPFR_RNDD); - if (MPFR_SIGN (x) >= 0 || ! mpfr_inf_p (x)) + if (MPFR_IS_POS (x) || ! mpfr_inf_p (x)) { printf ("Error in test_20070628: expected -Inf, got\n"); mpfr_dump (x); @@ -1106,7 +1111,8 @@ Reported by Ricky Farr To get a failure, a MPFR_DIVHIGH_TAB entry below the MPFR_DIV_THRESHOLD - limit must have a value 0. With most mparam.h files, this cannot occur. */ + limit must have a value 0. With most mparam.h files, this cannot occur. To + make the bug appear, one can configure MPFR with -DMPFR_TUNE_COVERAGE. */ static void test_20151023 (void) { @@ -1122,9 +1128,13 @@ mpfr_init2 (q0, GMP_NUMB_BITS); /* generate a random divisor of p bits */ - mpfr_urandomb (d, RANDS); - /* generate a random quotient of GMP_NUMB_BITS bits */ - mpfr_urandomb (q0, RANDS); + do + mpfr_urandomb (d, RANDS); + while (mpfr_zero_p (d)); + /* generate a random non-zero quotient of GMP_NUMB_BITS bits */ + do + mpfr_urandomb (q0, RANDS); + while (mpfr_zero_p (q0)); /* zero-pad the quotient to p bits */ inex = mpfr_prec_round (q0, p, MPFR_RNDN); MPFR_ASSERTN(inex == 0); @@ -1146,7 +1156,16 @@ MPFR_ASSERTN(inex == 0); mpfr_nextabove (n); mpfr_div (q, n, d, MPFR_RNDN); - MPFR_ASSERTN(mpfr_cmp (q, q0) == 0); + if (! mpfr_equal_p (q, q0)) + { + printf ("Error in test_20151023 for p=%ld, rnd=RNDN, i=%d\n", + (long) p, i); + printf ("n="); mpfr_dump (n); + printf ("d="); mpfr_dump (d); + printf ("expected q0="); mpfr_dump (q0); + printf ("got q="); mpfr_dump (q); + exit (1); + } inex = mpfr_mul (n, d, q0, MPFR_RNDN); MPFR_ASSERTN(inex == 0); @@ -1162,6 +1181,55 @@ } } +/* test a random division of p+extra bits divided by p+extra bits, + with quotient of p bits only, where the p+extra bit approximation + of the quotient is very near a rounding frontier. */ +static void +test_bad_aux (mpfr_prec_t p, mpfr_prec_t extra) +{ + mpfr_t u, v, w, q0, q; + + mpfr_init2 (u, p + extra); + mpfr_init2 (v, p + extra); + mpfr_init2 (w, p + extra); + mpfr_init2 (q0, p); + mpfr_init2 (q, p); + do mpfr_urandomb (q0, RANDS); while (mpfr_zero_p (q0)); + do mpfr_urandomb (v, RANDS); while (mpfr_zero_p (v)); + + mpfr_set (w, q0, MPFR_RNDN); /* exact */ + mpfr_nextabove (w); /* now w > q0 */ + mpfr_mul (u, v, w, MPFR_RNDU); /* thus u > v*q0 */ + mpfr_div (q, u, v, MPFR_RNDU); /* should have q > q0 */ + MPFR_ASSERTN (mpfr_cmp (q, q0) > 0); + mpfr_div (q, u, v, MPFR_RNDZ); /* should have q = q0 */ + MPFR_ASSERTN (mpfr_cmp (q, q0) == 0); + + mpfr_set (w, q0, MPFR_RNDN); /* exact */ + mpfr_nextbelow (w); /* now w < q0 */ + mpfr_mul (u, v, w, MPFR_RNDZ); /* thus u < v*q0 */ + mpfr_div (q, u, v, MPFR_RNDZ); /* should have q < q0 */ + MPFR_ASSERTN (mpfr_cmp (q, q0) < 0); + mpfr_div (q, u, v, MPFR_RNDU); /* should have q = q0 */ + MPFR_ASSERTN (mpfr_cmp (q, q0) == 0); + + mpfr_clear (u); + mpfr_clear (v); + mpfr_clear (w); + mpfr_clear (q0); + mpfr_clear (q); +} + +static void +test_bad (void) +{ + mpfr_prec_t p, extra; + + for (p = MPFR_PREC_MIN; p <= 1024; p += 17) + for (extra = 2; extra <= 64; extra++) + test_bad_aux (p, extra); +} + #define TEST_FUNCTION test_div #define TWO_ARGS #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS) @@ -1257,11 +1325,422 @@ set_emax (emax); } +static void +testall_rndf (mpfr_prec_t pmax) +{ + mpfr_t a, b, c, d; + mpfr_prec_t pa, pb, pc; + + for (pa = MPFR_PREC_MIN; pa <= pmax; pa++) + { + mpfr_init2 (a, pa); + mpfr_init2 (d, pa); + for (pb = MPFR_PREC_MIN; pb <= pmax; pb++) + { + mpfr_init2 (b, pb); + mpfr_set_ui (b, 1, MPFR_RNDN); + while (mpfr_cmp_ui (b, 2) < 0) + { + for (pc = MPFR_PREC_MIN; pc <= pmax; pc++) + { + mpfr_init2 (c, pc); + mpfr_set_ui (c, 1, MPFR_RNDN); + while (mpfr_cmp_ui (c, 2) < 0) + { + mpfr_div (a, b, c, MPFR_RNDF); + mpfr_div (d, b, c, MPFR_RNDD); + if (!mpfr_equal_p (a, d)) + { + mpfr_div (d, b, c, MPFR_RNDU); + if (!mpfr_equal_p (a, d)) + { + printf ("Error: mpfr_div(a,b,c,RNDF) does not " + "match RNDD/RNDU\n"); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); + exit (1); + } + } + mpfr_nextabove (c); + } + mpfr_clear (c); + } + mpfr_nextabove (b); + } + mpfr_clear (b); + } + mpfr_clear (a); + mpfr_clear (d); + } +} + +static void +test_mpfr_divsp2 (void) +{ + mpfr_t u, v, q; + + /* test to exercise r2 = v1 in mpfr_divsp2 */ + mpfr_init2 (u, 128); + mpfr_init2 (v, 128); + mpfr_init2 (q, 83); + + mpfr_set_str (u, "286677858044426991425771529092412636160", 10, MPFR_RNDN); + mpfr_set_str (v, "241810647971575979588130185988987264768", 10, MPFR_RNDN); + mpfr_div (q, u, v, MPFR_RNDN); + mpfr_set_str (u, "5732952910203749289426944", 10, MPFR_RNDN); + mpfr_div_2exp (u, u, 82, MPFR_RNDN); + MPFR_ASSERTN(mpfr_equal_p (q, u)); + + mpfr_clear (u); + mpfr_clear (v); + mpfr_clear (q); +} + +/* Assertion failure in r10769 with --enable-assert --enable-gmp-internals + (same failure in tatan on a similar example). */ +static void +test_20160831 (void) +{ + mpfr_t u, v, q; + + mpfr_inits2 (124, u, v, q, (mpfr_ptr) 0); + + mpfr_set_ui (u, 1, MPFR_RNDN); + mpfr_set_str (v, "0x40000000000000005", 16, MPFR_RNDN); + mpfr_div (q, u, v, MPFR_RNDN); + mpfr_set_str (u, "0xfffffffffffffffecp-134", 16, MPFR_RNDN); + MPFR_ASSERTN (mpfr_equal_p (q, u)); + + mpfr_set_prec (u, 128); + mpfr_set_prec (v, 128); + mpfr_set_str (u, "186127091671619245460026015088243485690", 10, MPFR_RNDN); + mpfr_set_str (v, "205987256581218236405412302590110119580", 10, MPFR_RNDN); + mpfr_div (q, u, v, MPFR_RNDN); + mpfr_set_str (u, "19217137613667309953639458782352244736", 10, MPFR_RNDN); + mpfr_div_2exp (u, u, 124, MPFR_RNDN); + MPFR_ASSERTN (mpfr_equal_p (q, u)); + + mpfr_clears (u, v, q, (mpfr_ptr) 0); +} + +/* With r11138, on a 64-bit machine: + div.c:128: MPFR assertion failed: qx >= __gmpfr_emin +*/ +static void +test_20170104 (void) +{ + mpfr_t u, v, q; + mpfr_exp_t emin; + + emin = mpfr_get_emin (); + set_emin (-42); + + mpfr_init2 (u, 12); + mpfr_init2 (v, 12); + mpfr_init2 (q, 11); + mpfr_set_str_binary (u, "0.111111111110E-29"); + mpfr_set_str_binary (v, "0.111111111111E14"); + mpfr_div (q, u, v, MPFR_RNDN); + mpfr_clears (u, v, q, (mpfr_ptr) 0); + + set_emin (emin); +} + +/* With r11140, on a 64-bit machine with GMP_CHECK_RANDOMIZE=1484406128: + Consistency error for i = 2577 +*/ +static void +test_20170105 (void) +{ + mpfr_t x, y, z, t; + + mpfr_init2 (x, 138); + mpfr_init2 (y, 6); + mpfr_init2 (z, 128); + mpfr_init2 (t, 128); + mpfr_set_str_binary (x, "0.100110111001001000101111010010011101111110111111110001110100000001110111010100111010100011101010110000010100000011100100110101101011000000E-6"); + mpfr_set_str_binary (y, "0.100100E-2"); + /* up to exponents, x/y is exactly 367625553447399614694201910705139062483, + which has 129 bits, thus we are in the round-to-nearest-even case, and since + the penultimate bit of x/y is 1, we should round upwards */ + mpfr_set_str_binary (t, "0.10001010010010010000110110010110111111111100011011101010000000000110101000010001011110011011010000111010000000001100101101101010E-3"); + mpfr_div (z, x, y, MPFR_RNDN); + MPFR_ASSERTN(mpfr_equal_p (z, t)); + mpfr_clears (x, y, z, t, (mpfr_ptr) 0); +} + +/* The real cause of the mpfr_ttanh failure from the non-regression test + added in tests/ttanh.c@11993 was actually due to a bug in mpfr_div, as + this can be seen by comparing the logs of the 3.1 branch and the trunk + r11992 with MPFR_LOG_ALL=1 MPFR_LOG_PREC=50 on this particular test + (this was noticed because adding this test to the 3.1 branch did not + yield a failure like in the trunk, though the mpfr_ttanh code did not + change until r11993). This was the bug actually fixed in r12002. +*/ +static void +test_20171219 (void) +{ + mpfr_t x, y, z, t; + + mpfr_inits2 (126, x, y, z, t, (mpfr_ptr) 0); + mpfr_set_str_binary (x, "0.111000000000000111100000000000011110000000000001111000000000000111100000000000011110000000000001111000000000000111100000000000E1"); + /* x = 36347266450315671364380109803814927 / 2^114 */ + mpfr_add_ui (y, x, 2, MPFR_RNDN); + /* y = 77885641318594292392624080437575695 / 2^114 */ + mpfr_div (z, x, y, MPFR_RNDN); + mpfr_set_ui_2exp (t, 3823, -13, MPFR_RNDN); + MPFR_ASSERTN (mpfr_equal_p (z, t)); + mpfr_clears (x, y, z, t, (mpfr_ptr) 0); +} + +#if !defined(MPFR_GENERIC_ABI) && GMP_NUMB_BITS == 64 +/* exercise mpfr_div2_approx */ +static void +test_mpfr_div2_approx (unsigned long n) +{ + mpfr_t x, y, z; + + mpfr_init2 (x, 113); + mpfr_init2 (y, 113); + mpfr_init2 (z, 113); + while (n--) + { + mpfr_urandomb (x, RANDS); + mpfr_urandomb (y, RANDS); + mpfr_div (z, x, y, MPFR_RNDN); + } + mpfr_clear (x); + mpfr_clear (y); + mpfr_clear (z); +} +#endif + +/* bug found in ttan with GMP_CHECK_RANDOMIZE=1514257254 */ +static void +bug20171218 (void) +{ + mpfr_t s, c; + mpfr_init2 (s, 124); + mpfr_init2 (c, 124); + mpfr_set_str_binary (s, "-0.1110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110E0"); + mpfr_set_str_binary (c, "0.1111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111E-1"); + mpfr_div (c, s, c, MPFR_RNDN); + mpfr_set_str_binary (s, "-1.111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); + MPFR_ASSERTN(mpfr_equal_p (c, s)); + mpfr_clear (s); + mpfr_clear (c); +} + +/* Extended test based on a bug found with flint-arb test suite with a + 32-bit ABI: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=888459 + Division of the form: (1 - 2^(-pa)) / (1 - 2^(-pb)). + The result is compared to the one obtained by increasing the precision of + the divisor (without changing its value, so that both results should be + equal). For all of these tests, a failure may occur in r12126 only with + pb=GMP_NUMB_BITS and MPFR_RNDN (and some particular values of pa and pc). + This bug was introduced by r9086, where mpfr_div uses mpfr_div_ui when + the divisor has only one limb. +*/ +static void +bug20180126 (void) +{ + mpfr_t a, b1, b2, c1, c2; + int pa, i, j, pc, sa, sb, r, inex1, inex2; + + for (pa = 100; pa < 800; pa += 11) + for (i = 1; i <= 4; i++) + for (j = -2; j <= 2; j++) + { + int pb = GMP_NUMB_BITS * i + j; + + if (pb > pa) + continue; + + mpfr_inits2 (pa, a, b1, (mpfr_ptr) 0); + mpfr_inits2 (pb, b2, (mpfr_ptr) 0); + + mpfr_set_ui (a, 1, MPFR_RNDN); + mpfr_nextbelow (a); /* 1 - 2^(-pa) */ + mpfr_set_ui (b2, 1, MPFR_RNDN); + mpfr_nextbelow (b2); /* 1 - 2^(-pb) */ + inex1 = mpfr_set (b1, b2, MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + + for (pc = 32; pc <= 320; pc += 32) + { + mpfr_inits2 (pc, c1, c2, (mpfr_ptr) 0); + + for (sa = 0; sa < 2; sa++) + { + for (sb = 0; sb < 2; sb++) + { + RND_LOOP_NO_RNDF (r) + { + MPFR_ASSERTN (mpfr_equal_p (b1, b2)); + inex1 = mpfr_div (c1, a, b1, (mpfr_rnd_t) r); + inex2 = mpfr_div (c2, a, b2, (mpfr_rnd_t) r); + + if (! mpfr_equal_p (c1, c2) || + ! SAME_SIGN (inex1, inex2)) + { + printf ("Error in bug20180126 for " + "pa=%d pb=%d pc=%d sa=%d sb=%d %s\n", + pa, pb, pc, sa, sb, + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("inex1 = %d, c1 = ", inex1); + mpfr_dump (c1); + printf ("inex2 = %d, c2 = ", inex2); + mpfr_dump (c2); + exit (1); + } + } + + mpfr_neg (b1, b1, MPFR_RNDN); + mpfr_neg (b2, b2, MPFR_RNDN); + } /* sb */ + + mpfr_neg (a, a, MPFR_RNDN); + } /* sa */ + + mpfr_clears (c1, c2, (mpfr_ptr) 0); + } /* pc */ + + mpfr_clears (a, b1, b2, (mpfr_ptr) 0); + } /* j */ +} + +static void +coverage (mpfr_prec_t pmax) +{ + mpfr_prec_t p; + + for (p = MPFR_PREC_MIN; p <= pmax; p++) + { + int inex; + mpfr_t q, u, v; + + mpfr_init2 (q, p); + mpfr_init2 (u, p); + mpfr_init2 (v, p); + + /* exercise case qx < emin */ + mpfr_set_ui_2exp (u, 1, mpfr_get_emin (), MPFR_RNDN); + mpfr_set_ui (v, 4, MPFR_RNDN); + + mpfr_clear_flags (); + /* u/v = 2^(emin-2), should be rounded to +0 for RNDN */ + inex = mpfr_div (q, u, v, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_zero_p (q) && mpfr_signbit (q) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + mpfr_clear_flags (); + /* u/v = 2^(emin-2), should be rounded to 2^(emin-1) for RNDU */ + inex = mpfr_div (q, u, v, MPFR_RNDU); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (q, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + mpfr_clear_flags (); + /* u/v = 2^(emin-2), should be rounded to +0 for RNDZ */ + inex = mpfr_div (q, u, v, MPFR_RNDZ); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_zero_p (q) && mpfr_signbit (q) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + if (p == 1) + goto end_of_loop; + + mpfr_set_ui_2exp (u, 1, mpfr_get_emin (), MPFR_RNDN); + mpfr_nextbelow (u); /* u = (1-2^(-p))*2^emin */ + mpfr_set_ui (v, 2, MPFR_RNDN); + + mpfr_clear_flags (); + /* u/v = (1-2^(-p))*2^(emin-1), will round to 2^(emin-1) for RNDN */ + inex = mpfr_div (q, u, v, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (q, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + mpfr_clear_flags (); + /* u/v should round to 2^(emin-1) for RNDU */ + inex = mpfr_div (q, u, v, MPFR_RNDU); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (q, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + mpfr_clear_flags (); + /* u/v should round to +0 for RNDZ */ + inex = mpfr_div (q, u, v, MPFR_RNDZ); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_zero_p (q) && mpfr_signbit (q) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + end_of_loop: + mpfr_clear (q); + mpfr_clear (u); + mpfr_clear (v); + } +} + +/* coverage for case usize >= n + n in Mulders' algorithm */ +static void +coverage2 (void) +{ + mpfr_prec_t p; + mpfr_t q, u, v, t, w; + int inex, inex2; + + p = MPFR_DIV_THRESHOLD * GMP_NUMB_BITS; + mpfr_init2 (q, p); + mpfr_init2 (u, 2 * p + 3 * GMP_NUMB_BITS); + mpfr_init2 (v, p); + do mpfr_urandomb (u, RANDS); while (mpfr_zero_p (u)); + do mpfr_urandomb (v, RANDS); while (mpfr_zero_p (v)); + inex = mpfr_div (q, u, v, MPFR_RNDN); + mpfr_init2 (t, mpfr_get_prec (u)); + mpfr_init2 (w, mpfr_get_prec (u)); + inex2 = mpfr_mul (t, q, v, MPFR_RNDN); + MPFR_ASSERTN(inex2 == 0); + if (inex == 0) /* check q*v = u */ + MPFR_ASSERTN(mpfr_equal_p (u, t)); + else + { + if (inex > 0) + mpfr_nextbelow (q); + else + mpfr_nextabove (q); + inex2 = mpfr_mul (w, q, v, MPFR_RNDN); + MPFR_ASSERTN(inex2 == 0); + inex2 = mpfr_sub (t, t, u, MPFR_RNDN); + MPFR_ASSERTN(inex2 == 0); + inex2 = mpfr_sub (w, w, u, MPFR_RNDN); + MPFR_ASSERTN(inex2 == 0); + MPFR_ASSERTN(mpfr_cmpabs (t, w) <= 0); + if (mpfr_cmpabs (t, w) == 0) /* even rule: significand of q should now + be odd */ + MPFR_ASSERTN(mpfr_min_prec (q) == mpfr_get_prec (q)); + } + + mpfr_clear (q); + mpfr_clear (u); + mpfr_clear (v); + mpfr_clear (t); + mpfr_clear (w); +} + int main (int argc, char *argv[]) { tests_start_mpfr (); + coverage (1024); + coverage2 (); + bug20180126 (); + bug20171218 (); + testall_rndf (9); + test_20170105 (); check_inexact (); check_hard (); check_special (); @@ -1283,8 +1762,16 @@ test_20070603 (); test_20070628 (); test_20151023 (); - test_generic (2, 800, 50); + test_20160831 (); + test_20170104 (); + test_20171219 (); + test_generic (MPFR_PREC_MIN, 800, 50); + test_bad (); test_extreme (); + test_mpfr_divsp2 (); +#if !defined(MPFR_GENERIC_ABI) && GMP_NUMB_BITS == 64 + test_mpfr_div2_approx (1000000); +#endif tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tdiv_d.c mpfr4-4.0.2/tests/tdiv_d.c --- mpfr4-3.1.4/tests/tdiv_d.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tdiv_d.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_div_d -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,17 +17,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include #include "mpfr-test.h" -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) - static void check_nans (void) { @@ -42,7 +38,7 @@ mpfr_clear_flags (); inexact = mpfr_div_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); - MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0); + MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN); MPFR_ASSERTN (mpfr_nan_p (y)); /* +inf / 1.0 == +inf */ @@ -137,19 +133,8 @@ check_nans (); - test_generic (2, 1000, 100); + test_generic (MPFR_PREC_MIN, 1000, 100); tests_end_mpfr (); return 0; } - -#else - -int -main (void) -{ - printf ("Warning! Test disabled for this MPFR version.\n"); - return 0; -} - -#endif diff -Nru mpfr4-3.1.4/tests/tdiv_ui.c mpfr4-4.0.2/tests/tdiv_ui.c --- mpfr4-3.1.4/tests/tdiv_ui.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tdiv_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_div_ui. -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include #include "mpfr-test.h" @@ -97,6 +95,8 @@ mpfr_nextabove (x); mpfr_div_ui (y, x, 2, MPFR_RNDN); /* exactly in the middle */ MPFR_ASSERTN(mpfr_cmp_ui (y, 2) == 0); + (mpfr_div_ui) (y, x, 2, MPFR_RNDN); /* exactly in the middle */ + MPFR_ASSERTN(mpfr_cmp_ui (y, 2) == 0); mpfr_set_prec (x, 3 * mp_bits_per_limb); mpfr_set_prec (y, 2); @@ -104,6 +104,8 @@ mpfr_nextabove (x); mpfr_div_ui (y, x, 2, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); + (mpfr_div_ui) (y, x, 2, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); mpfr_set_prec (x, 3 * mp_bits_per_limb); mpfr_set_prec (y, 2); @@ -111,6 +113,8 @@ mpfr_nextbelow (x); mpfr_div_ui (y, x, 2, MPFR_RNDD); MPFR_ASSERTN(mpfr_cmp_si (y, -3) == 0); + (mpfr_div_ui) (y, x, 2, MPFR_RNDD); + MPFR_ASSERTN(mpfr_cmp_si (y, -3) == 0); for (xprec = 53; xprec <= 128; xprec++) { @@ -123,8 +127,8 @@ if (mpfr_cmp(x,y)) { printf ("division by 1.0 fails for xprec=%u, yprec=%u\n", xprec, yprec); - printf ("expected "); mpfr_print_binary (x); puts (""); - printf ("got "); mpfr_print_binary (y); puts (""); + printf ("expected "); mpfr_dump (x); + printf ("got "); mpfr_dump (y); exit (1); } } @@ -135,6 +139,8 @@ mpfr_set_si (y, -1, MPFR_RNDN); mpfr_div_ui (y, x, 4, MPFR_RNDN); MPFR_ASSERTN(MPFR_IS_ZERO(y) && MPFR_IS_POS(y)); + (mpfr_div_ui) (y, x, 4, MPFR_RNDN); + MPFR_ASSERTN(MPFR_IS_ZERO(y) && MPFR_IS_POS(y)); mpfr_clear (x); mpfr_clear (y); @@ -172,8 +178,8 @@ if (mpfr_mul_ui (z, y, u, (mpfr_rnd_t) rnd)) { printf ("z <- y * u should be exact for u=%lu\n", u); - printf ("y="); mpfr_print_binary (y); puts (""); - printf ("z="); mpfr_print_binary (z); puts (""); + printf ("y="); mpfr_dump (y); + printf ("z="); mpfr_dump (z); exit (1); } cmp = mpfr_cmp (z, x); @@ -183,8 +189,8 @@ { printf ("Wrong inexact flag for u=%lu, rnd=%s\n", u, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("y="); mpfr_print_binary (y); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); exit (1); } } @@ -196,6 +202,302 @@ mpfr_clear (z); } +#if GMP_NUMB_BITS == 64 +/* With r11140, on a 64-bit machine with GMP_CHECK_RANDOMIZE=1484406128: + Consistency error for i = 2577 +*/ +static void +test_20170105 (void) +{ + mpfr_t x,z, t; + + if (sizeof (unsigned long) * CHAR_BIT == 64) + { + mpfr_init2 (x, 138); + mpfr_init2 (z, 128); + mpfr_init2 (t, 128); + mpfr_set_str_binary (x, "100110111001001000101111010010011101111110111111110001110100000001110111010100111010100011101010110000010100000011100100110101101011000000"); + /* up to exponents, x/y is exactly + 367625553447399614694201910705139062483, which has 129 bits, + thus we are in the round-to-nearest-even case, and since the + penultimate bit of x/y is 1, we should round upwards */ + mpfr_set_str_binary (t, "10001010010010010000110110010110111111111100011011101010000000000110101000010001011110011011010000111010000000001100101101101010E-53"); + mpfr_div_ui (z, x, 36UL << 58, MPFR_RNDN); + MPFR_ASSERTN(mpfr_equal_p (z, t)); + + mpfr_set_prec (x, 189); + mpfr_set_prec (z, 185); + mpfr_set_prec (t, 185); + mpfr_set_str_binary (x, "100001010000111100011110111010000011110000000110100010001010101011110001110000110111101000100100001101010011000111110100011111110110011011101000000000001010010010111011001100111111111101001"); + mpfr_set_str_binary (t, "10011000000100010100011111100100110101101110001011100101010101011010011010010110010000100111001010000101111011111111001011011010101111101100000000000000101111000100001110101001001001000E-60"); + mpfr_div_ui (z, x, 7UL << 61, MPFR_RNDN); + MPFR_ASSERTN(mpfr_equal_p (z, t)); + + mpfr_clears (x, z, t, (mpfr_ptr) 0); + } +} +#endif + +static void +bug20180126 (void) +{ + mpfr_t w, x, y, z, t; + unsigned long u, v; + int i, k, m, n, p, pmax, q, r; + int inex; + + /* Let m = n * q + r, with 0 <= r < v. + (2^m-1) / (2^n-1) = 2^r * (2^(n*q)-1) / (2^n-1) + (2^r-1) / (2^n-1) + = sum(i=0,q-1,2^(r+n*i)) + sum(i=1,inf,(2^r-1)*2^(-n*i)) + */ + n = 1; + for (u = 1; u != ULONG_MAX; u = (u << 1) + 1) + n++; + pmax = 6 * n; + mpfr_init2 (t, n); + for (m = n; m < 4 * n; m++) + { + q = m / n; + r = m % n; + mpfr_init2 (w, pmax + n + 1); + mpfr_set_zero (w, 1); + for (i = 0; i < q; i++) + { + inex = mpfr_set_ui_2exp (t, 1, r + n * i, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + inex = mpfr_add (w, w, t, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + } + v = (1UL << r) - 1; + for (i = 1; n * (q - 1 + i) <= MPFR_PREC (w); i++) + { + inex = mpfr_set_ui_2exp (t, v, - n * i, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + mpfr_add (w, w, t, MPFR_RNDN); + } + for (p = pmax; p >= MPFR_PREC_MIN; p--) + { + mpfr_inits2 (p, y, z, (mpfr_ptr) 0); + mpfr_set (z, w, MPFR_RNDN); /* the sticky bit is not 0 */ + mpfr_init2 (x, m); + inex = mpfr_set_ui_2exp (x, 1, m, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + inex = mpfr_sub_ui (x, x, 1, MPFR_RNDN); /* x = 2^m-1 */ + MPFR_ASSERTN (inex == 0); + for (k = 0; k < 2; k++) + { + if (k) + { + inex = mpfr_prec_round (x, 6 * n, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + } + inex = mpfr_div_ui (y, x, u, MPFR_RNDN); + if (! mpfr_equal_p (y, z)) + { + printf ("Error in bug20180126 for (2^%d-1)/(2^%d-1)" + " with px=%d py=%d\n", m, n, + (int) MPFR_PREC (x), p); + printf ("Expected "); + mpfr_dump (z); + printf ("Got "); + mpfr_dump (y); + exit (1); + } + } + mpfr_clears (x, y, z, (mpfr_ptr) 0); + } + mpfr_clear (w); + } + mpfr_clear (t); + + /* This test expects that a limb fits in an unsigned long. + One failing case from function bug20180126() in tdiv.c, + for GMP_NUMB_BITS == 64. */ +#if ULONG_MAX > 4294967295 + if (GMP_NUMB_BITS == 64 && MPFR_LIMB_MAX <= ULONG_MAX) + { + mpfr_init2 (x, 133); + mpfr_init2 (y, 64); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_nextbelow (x); /* 1 - 2^(-133) = (2^133-1)/2^133 */ + u = MPFR_LIMB_MAX; /* 2^64 - 1 */ + inex = mpfr_div_ui (y, x, u, MPFR_RNDN); + /* 2^133*x/u = (2^133-1)/(2^64-1) = (2^64+1)*2^5 + 31/(2^64-1) + and should be rounded to 2^69+2^6, thus x/u should be rounded + to 2^(-133)*(2^69+2^6). */ + MPFR_ASSERTN (inex > 0); + mpfr_nextbelow (y); + MPFR_ASSERTN (mpfr_cmp_ui_2exp (y, 1, -64) == 0); + + mpfr_set_prec (x, 49); + mpfr_set_str_binary (x, "0.1000000000000000000111111111111111111111100000000E0"); + /* x = 281476050452224/2^49 */ + /* let X = 2^256*x = q*u+r, then q has 192 bits, and + r = 8222597979955926678 > u/2 thus we should round to (q+1)/2^256 */ + mpfr_set_prec (y, 192); + /* The cast below avoid spurious warnings from GCC with a 32-bit ABI. */ + u = (mp_limb_t) 10865468317030705979U; + inex = mpfr_div_ui (y, x, u, MPFR_RNDN); + mpfr_init2 (z, 192); + mpfr_set_str_binary (z, "0.110110010100111111000100101011011110010101010010001101100110101111001010100011010111010011100001101000110100011101001010000001010000001001011100000100000110101111110100100101011000000110011111E-64"); + MPFR_ASSERTN (inex > 0); + MPFR_ASSERTN (mpfr_equal_p (y, z)); + mpfr_clear (x); + mpfr_clear (y); + mpfr_clear (z); + } +#endif +} + +/* check corner cases where the round bit is located in the upper bit of r */ +static void +corner_cases (int n) +{ + mpfr_t x, y, t; + unsigned long u, v; + int i, xn; + + if (MPFR_LIMB_MAX <= ULONG_MAX) + { + /* We need xn > yn + 1, thus we take xn = 3 and yn = 1. + Also take xn = 4 to 6 to cover more code. */ + for (xn = 3; xn < 6; xn++) + { + mpfr_init2 (x, xn * GMP_NUMB_BITS); + mpfr_init2 (y, GMP_NUMB_BITS); + mpfr_init2 (t, 2 * GMP_NUMB_BITS); + for (i = 0; i < n; i++) + { + do + u = randlimb (); + while (u == 0); + do + v = randlimb (); + while (v <= MPFR_LIMB_HIGHBIT); + mpfr_set_ui (t, v, MPFR_RNDN); + mpfr_sub_d (t, t, 0.5, MPFR_RNDN); + /* t = v-1/2 */ + mpfr_mul_ui (x, t, u, MPFR_RNDN); + + /* when x = (v-1/2)*u, x/u should give v-1/2, which should + round to either v (if v is even) or v-1 (if v is odd) */ + mpfr_div_ui (y, x, u, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui (y, v - (v & 1)) == 0); + + /* when x = (v-1/2)*u - epsilon, x/u should round to v-1 */ + mpfr_nextbelow (x); + mpfr_div_ui (y, x, u, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui (y, v - 1) == 0); + + /* when x = (v-1/2)*u + epsilon, x/u should round to v */ + mpfr_nextabove (x); + mpfr_nextabove (x); + mpfr_div_ui (y, x, u, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui (y, v) == 0); + } + mpfr_clear (x); + mpfr_clear (y); + mpfr_clear (t); + } + } +} + +static void +midpoint_exact (void) +{ + mpfr_t x, y1, y2; + unsigned long j; + int i, kx, ky, px, pxmin, py, pymin, r; + int inex1, inex2; + + pymin = 1; + for (i = 3; i < 32; i += 2) + { + if ((i & (i-2)) == 1) + pymin++; + for (j = 1; j != 0; j++) + { + if (j == 31) + j = ULONG_MAX; + /* Test of (i*j) / j with various precisions. The target precisions + include: large, length(i), and length(i)-1; the latter case + corresponds to a midpoint. */ + mpfr_init2 (x, 5 + sizeof(long) * CHAR_BIT); + inex1 = mpfr_set_ui (x, j, MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + inex1 = mpfr_mul_ui (x, x, i, MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + /* x = (i*j) */ + pxmin = mpfr_min_prec (x); + if (pxmin < MPFR_PREC_MIN) + pxmin = MPFR_PREC_MIN; + for (kx = 0; kx < 8; kx++) + { + px = pxmin; + if (kx != 0) + px += randlimb () % (4 * GMP_NUMB_BITS); + inex1 = mpfr_prec_round (x, px, MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + for (ky = 0; ky < 8; ky++) + { + py = pymin; + if (ky == 0) + py--; + else if (ky > 1) + py += randlimb () % (4 * GMP_NUMB_BITS); + mpfr_inits2 (py, y1, y2, (mpfr_ptr) 0); + RND_LOOP_NO_RNDF (r) + { + inex1 = mpfr_set_ui (y1, i, (mpfr_rnd_t) r); + inex2 = mpfr_div_ui (y2, x, j, (mpfr_rnd_t) r); + if (! mpfr_equal_p (y1, y2) || + ! SAME_SIGN (inex1, inex2)) + { + printf ("Error in midpoint_exact for " + "i=%d j=%lu px=%d py=%d %s\n", i, j, px, py, + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("Expected "); + mpfr_dump (y1); + printf ("with inex = %d\n", inex1); + printf ("Got "); + mpfr_dump (y2); + printf ("with inex = %d\n", inex2); + exit (1); + } + } + mpfr_clears (y1, y2, (mpfr_ptr) 0); + } + } + mpfr_clear (x); + } + } +} + +static void +check_coverage (void) +{ +#ifdef MPFR_COV_CHECK + int i, j; + int err = 0; + + if (MPFR_LIMB_MAX <= ULONG_MAX) + { + for (i = 0; i < numberof (__gmpfr_cov_div_ui_sb); i++) + for (j = 0; j < 2; j++) + if (!__gmpfr_cov_div_ui_sb[i][j]) + { + printf ("mpfr_div_ui not tested on case %d, sb=%d\n", i, j); + err = 1; + } + + if (err) + exit (1); + } + else /* e.g. mips64 with the n32 ABI */ + printf ("Warning! Value coverage disabled (mp_limb_t > unsigned long).\n"); +#endif +} + #define TEST_FUNCTION mpfr_div_ui #define ULONG_ARG2 #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS) @@ -208,6 +510,10 @@ tests_start_mpfr (); + corner_cases (100); + + bug20180126 (); + special (); check_inexact (); @@ -218,6 +524,9 @@ check("1.0", 3, MPFR_RNDD, "3.3333333333333331483e-1"); check("1.0", 2116118, MPFR_RNDN, "4.7256343927890600483e-7"); check("1.098612288668109782", 5, MPFR_RNDN, "0.21972245773362195087"); +#if GMP_NUMB_BITS == 64 + test_20170105 (); +#endif mpfr_init2 (x, 53); mpfr_set_ui (x, 3, MPFR_RNDD); @@ -230,8 +539,10 @@ } mpfr_clear (x); - test_generic (2, 200, 100); + test_generic (MPFR_PREC_MIN, 200, 100); + midpoint_exact (); + check_coverage (); tests_end_mpfr (); return 0; } diff -Nru mpfr4-3.1.4/tests/td_sub.c mpfr4-4.0.2/tests/td_sub.c --- mpfr4-3.1.4/tests/td_sub.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/td_sub.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_d_sub -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,17 +17,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include #include "mpfr-test.h" -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) - static void check_nans (void) { @@ -42,7 +38,7 @@ mpfr_clear_flags (); inexact = mpfr_d_sub (y, 1.0, x, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); - MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0); + MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN); MPFR_ASSERTN (mpfr_nan_p (y)); /* 1.0 - +inf == -inf */ @@ -111,19 +107,8 @@ check_nans (); - test_generic (2, 1000, 100); + test_generic (MPFR_PREC_MIN, 1000, 100); tests_end_mpfr (); return 0; } - -#else - -int -main (void) -{ - printf ("Warning! Test disabled for this MPFR version.\n"); - return 0; -} - -#endif diff -Nru mpfr4-3.1.4/tests/teint.c mpfr4-4.0.2/tests/teint.c --- mpfr4-3.1.4/tests/teint.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/teint.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_eint. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,17 +17,12 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_eint -#define TEST_RANDOM_POS 8 -#define TEST_RANDOM_EMAX 40 #include "tgeneric.c" static void @@ -56,9 +51,9 @@ mpfr_set_inf (x, -1); mpfr_eint (y, x, MPFR_RNDN); - if (! mpfr_nan_p (y)) + if (! (mpfr_zero_p (y) && MPFR_IS_NEG (y))) { - printf ("Error: eint(-Inf) != NaN\n"); + printf ("Error: eint(-Inf) != -0\n"); exit (1); } @@ -78,15 +73,6 @@ exit (1); } - /* eint(x) = NaN for x < 0 */ - mpfr_set_si (x, -1, MPFR_RNDN); - mpfr_eint (y, x, MPFR_RNDN); - if (! mpfr_nan_p (y)) - { - printf ("Error: eint(-1) != NaN\n"); - exit (1); - } - mpfr_set_prec (x, 17); mpfr_set_prec (y, 17); mpfr_set_str_binary (x, "1.0111110100100110e-2"); @@ -126,6 +112,31 @@ exit (1); } + mpfr_set_prec (x, 2); + mpfr_set_prec (y, 2); + mpfr_set_si (x, -1, MPFR_RNDN); + mpfr_eint (x, x, MPFR_RNDN); /* eint1(1) = 0.219383934395520 */ + mpfr_set_str_binary (y, "-1e-2"); + if (mpfr_cmp (x, y) != 0) + { + printf ("Error for x=-1, MPFR_RNDN\n"); + printf ("expected "); mpfr_dump (y); + printf ("got "); mpfr_dump (x); + exit (1); + } + + mpfr_set_prec (x, 10); + mpfr_set_prec (y, 10); + mpfr_set_si (x, -2, MPFR_RNDN); + mpfr_eint (y, x, MPFR_RNDN); /* eint1(2) = 0.0489005107080611 */ + if (mpfr_cmp_si_2exp (y, -801, -14) != 0) + { + printf ("Error for x=-2, MPFR_RNDN\n"); + printf ("expected -801/2^14\n"); + printf ("got "); mpfr_dump (y); + exit (1); + } + /* check large x */ mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); @@ -180,6 +191,25 @@ exit (1); } + /* Runtime error at si_op.c:42:31 with r9996 on an x86-64 Linux machine, + using CFLAGS="-fsanitize=undefined -fno-sanitize-recover". */ + mpfr_set_prec (x, 32); + mpfr_set_prec (y, 46); + mpfr_set_si_2exp (x, -1, -1, MPFR_RNDN); + mpfr_eint (y, x, MPFR_RNDN); + + mpfr_set_prec (x, 10); + mpfr_set_prec (y, 6); + mpfr_set_str (x, "-7.875", 10, MPFR_RNDN); + mpfr_eint (y, x, MPFR_RNDN); + if (mpfr_cmp_si_2exp (y, -45, -20) != 0) + { + printf ("Error for x=-7.875, MPFR_RNDN\n"); + printf ("expected -45/2^20\n"); + printf ("got "); mpfr_dump (y); + exit (1); + } + mpfr_clear (x); mpfr_clear (y); } @@ -208,7 +238,7 @@ { check_specials (); - test_generic (2, 100, 100); + test_generic (MPFR_PREC_MIN, 100, 100); } tests_end_mpfr (); diff -Nru mpfr4-3.1.4/tests/teq.c mpfr4-4.0.2/tests/teq.c --- mpfr4-3.1.4/tests/teq.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/teq.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_eq. -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void @@ -40,13 +37,13 @@ { mpfr_set (y, x, MPFR_RNDN); - MPFR_MANT(y) [mx] ^= (mp_limb_t) 1 << px; + MPFR_MANT(y) [mx] ^= MPFR_LIMB_ONE << px; if (mpfr_eq(y, x, k) || !mpfr_eq(y, x, k - 1)) { printf ("Error in eq.\n"); - printf ("x = "); mpfr_print_binary (x); printf ("\n"); - printf ("y = "); mpfr_print_binary (y); printf ("\n"); + printf ("x = "); mpfr_dump (x); + printf ("y = "); mpfr_dump (y); printf ("k = %lu\n", k); printf ("mpfr_eq(y, x, k) = %d\nmpfr_eq(y, x, k - 1) = %d\n", mpfr_eq (y, x, k), mpfr_eq (y, x, k - 1)); diff -Nru mpfr4-3.1.4/tests/terandom.c mpfr4-4.0.2/tests/terandom.c --- mpfr4-3.1.4/tests/terandom.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/terandom.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,127 @@ +/* Test file for mpfr_erandom + +Copyright 2011-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-test.h" + +static void +test_special (mpfr_prec_t p) +{ + mpfr_t x; + int inexact; + + mpfr_init2 (x, p); + + inexact = mpfr_erandom (x, RANDS, MPFR_RNDN); + if (inexact == 0) + { + printf ("Error: mpfr_erandom() returns a zero ternary value.\n"); + exit (1); + } + + mpfr_clear(x); +} + + +static void +test_erandom (long nbtests, mpfr_prec_t prec, mpfr_rnd_t rnd, + int verbose) +{ + mpfr_t *t; + int i, inexact; + + t = (mpfr_t *) tests_allocate (nbtests * sizeof (mpfr_t)); + + for (i = 0; i < nbtests; ++i) + mpfr_init2 (t[i], prec); + + for (i = 0; i < nbtests; i++) + { + inexact = mpfr_erandom (t[i], RANDS, MPFR_RNDN); + if (inexact == 0) + { + /* one call in the loop pretended to return an exact number! */ + printf ("Error: mpfr_erandom() returns a zero ternary value.\n"); + exit (1); + } + } + +#if defined(HAVE_STDARG) && !defined(MPFR_USE_MINI_GMP) + if (verbose) + { + mpfr_t av, va, tmp; + + mpfr_init2 (av, prec); + mpfr_init2 (va, prec); + mpfr_init2 (tmp, prec); + + mpfr_set_ui (av, 0, MPFR_RNDN); + mpfr_set_ui (va, 0, MPFR_RNDN); + for (i = 0; i < nbtests; ++i) + { + mpfr_add (av, av, t[i], MPFR_RNDN); + mpfr_sqr (tmp, t[i], MPFR_RNDN); + mpfr_add (va, va, tmp, MPFR_RNDN); + } + mpfr_div_ui (av, av, nbtests, MPFR_RNDN); + mpfr_div_ui (va, va, nbtests, MPFR_RNDN); + mpfr_sqr (tmp, av, MPFR_RNDN); + mpfr_sub (va, va, av, MPFR_RNDN); + + mpfr_printf ("Average = %.5Rf\nVariance = %.5Rf\n", av, va); + mpfr_clear (av); + mpfr_clear (va); + mpfr_clear (tmp); + } +#endif /* HAVE_STDARG */ + + for (i = 0; i < nbtests; ++i) + mpfr_clear (t[i]); + tests_free (t, nbtests * sizeof (mpfr_t)); + return; +} + + +int +main (int argc, char *argv[]) +{ + long nbtests; + int verbose; + + tests_start_mpfr (); + + verbose = 0; + nbtests = 10; + if (argc > 1) + { + long a = atol (argv[1]); + verbose = 1; + if (a != 0) + nbtests = a; + } + + test_erandom (nbtests, 420, MPFR_RNDN, verbose); + test_special (2); + test_special (42000); + + tests_end_mpfr (); + return 0; +} diff -Nru mpfr4-3.1.4/tests/terandom_chisq.c mpfr4-4.0.2/tests/terandom_chisq.c --- mpfr4-3.1.4/tests/terandom_chisq.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/terandom_chisq.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,353 @@ +/* Chi-squared test for mpfr_erandom + +Copyright 2011-2019 Free Software Foundation, Inc. +Contributed by Charles Karney , SRI International. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-test.h" + +/* Return Phi(x) = 1 - exp(-x), the cumulative probability function for the + * exponential distribution. We only take differences of this function so the + * offset doesn't matter; here Phi(0) = 0. */ +static void +exponential_cumulative (mpfr_t z, mpfr_t x, mpfr_rnd_t rnd) +{ + mpfr_neg (z, x, rnd); + mpfr_expm1 (z, z, rnd); + mpfr_neg (z, z, rnd); +} + +/* Given nu and chisqp, compute probability that chisq > chisqp. This uses, + * A&S 26.4.16, + * + * Q(nu,chisqp) = + * erfc( (3/2)*sqrt(nu) * ( cbrt(chisqp/nu) - 1 + 2/(9*nu) ) ) / 2 + * + * which is valid for nu > 30. This is the basis for the formula in Knuth, + * TAOCP, Vol 2, 3.3.1, Table 1. It more accurate than the similar formula, + * DLMF 8.11.10. */ +static void +chisq_prob (mpfr_t q, long nu, mpfr_t chisqp) +{ + mpfr_t t; + mpfr_rnd_t rnd; + + rnd = MPFR_RNDN; /* This uses an approx formula. Might as well use RNDN. */ + mpfr_init2 (t, mpfr_get_prec (q)); + + mpfr_div_si (q, chisqp, nu, rnd); /* chisqp/nu */ + mpfr_cbrt (q, q, rnd); /* (chisqp/nu)^(1/3) */ + mpfr_sub_ui (q, q, 1, rnd); /* (chisqp/nu)^(1/3) - 1 */ + mpfr_set_ui (t, 2, rnd); + mpfr_div_si (t, t, 9*nu, rnd); /* 2/(9*nu) */ + mpfr_add (q, q, t, rnd); /* (chisqp/nu)^(1/3) - 1 + 2/(9*nu) */ + mpfr_sqrt_ui (t, nu, rnd); /* sqrt(nu) */ + mpfr_mul_d (t, t, 1.5, rnd); /* (3/2)*sqrt(nu) */ + mpfr_mul (q, q, t, rnd); /* arg to erfc */ + mpfr_erfc (q, q, rnd); /* erfc(...) */ + mpfr_div_ui (q, q, 2, rnd); /* erfc(...)/2 */ + + mpfr_clear (t); +} + +/* The continuous chi-squared test on with a set of bins of equal width. + * + * A single precision is picked for sampling and the chi-squared calculation. + * This should picked high enough so that binning in test doesn't need to be + * accurately aligned with possible values of the deviates. Also we need the + * precision big enough that chi-squared calculation itself is reliable. + * + * There's no particular benefit is testing with at very higher precisions; + * because of the way terandom samples, this just adds additional barely + * significant random bits to the deviates. So this chi-squared test with + * continuous equal width bins isn't a good tool for finding problems here. + * + * The testing of low precision exponential deviates is done by + * test_erandom_chisq_disc. */ +static double +test_erandom_chisq_cont (long num, mpfr_prec_t prec, int nu, + double xmin, double xmax, int verbose) +{ + mpfr_t x, a, b, dx, z, pa, pb, ps, t; + long *counts; + int i, inexact; + long k; + mpfr_rnd_t rnd, rndd; + double Q, chisq; + + rnd = MPFR_RNDN; /* For chi-squared calculation */ + rndd = MPFR_RNDD; /* For sampling and figuring the bins */ + mpfr_inits2 (prec, x, a, b, dx, z, pa, pb, ps, t, (mpfr_ptr) 0); + + counts = (long *) tests_allocate ((nu + 1) * sizeof (long)); + for (i = 0; i <= nu; i++) + counts[i] = 0; + + /* a and b are bounds of nu equally spaced bins. Set dx = (b-a)/nu */ + mpfr_set_d (a, xmin, rnd); + mpfr_set_d (b, xmax, rnd); + + mpfr_sub (dx, b, a, rnd); + mpfr_div_si (dx, dx, nu, rnd); + + for (k = 0; k < num; ++k) + { + inexact = mpfr_erandom (x, RANDS, rndd); + if (inexact == 0) + { + /* one call in the loop pretended to return an exact number! */ + printf ("Error: mpfr_erandom() returns a zero ternary value.\n"); + exit (1); + } + if (mpfr_signbit (x)) + { + printf ("Error: mpfr_erandom() returns a negative deviate.\n"); + exit (1); + } + mpfr_sub (x, x, a, rndd); + mpfr_div (x, x, dx, rndd); + i = mpfr_get_si (x, rndd); + ++counts[i >= 0 && i < nu ? i : nu]; + } + + mpfr_set (x, a, rnd); + exponential_cumulative (pa, x, rnd); + mpfr_add_ui (ps, pa, 1, rnd); + mpfr_set_zero (t, 1); + for (i = 0; i <= nu; ++i) + { + if (i < nu) + { + mpfr_add (x, x, dx, rnd); + exponential_cumulative (pb, x, rnd); + mpfr_sub (pa, pb, pa, rnd); /* prob for this bin */ + } + else + mpfr_sub (pa, ps, pa, rnd); /* prob for last bin, i = nu */ + + /* Compute z = counts[i] - num * p; t += z * z / (num * p) */ + mpfr_mul_ui (pa, pa, num, rnd); + mpfr_ui_sub (z, counts[i], pa, rnd); + mpfr_sqr (z, z, rnd); + mpfr_div (z, z, pa, rnd); + mpfr_add (t, t, z, rnd); + mpfr_swap (pa, pb); /* i.e., pa = pb */ + } + + chisq = mpfr_get_d (t, rnd); + chisq_prob (t, nu, t); + Q = mpfr_get_d (t, rnd); + if (verbose) + { + printf ("num = %ld, equal bins in [%.2f, %.2f], nu = %d: chisq = %.2f\n", + num, xmin, xmax, nu, chisq); + if (Q < 0.05) + printf (" WARNING: probability (less than 5%%) = %.2e\n", Q); + } + + tests_free (counts, (nu + 1) * sizeof (long)); + mpfr_clears (x, a, b, dx, z, pa, pb, ps, t, (mpfr_ptr) 0); + return Q; +} + +/* Return a sequential number for a positive low-precision x. x is altered by + * this function. low precision means prec = 2, 3, or 4. High values of + * precision will result in integer overflow. */ +static long +sequential (mpfr_t x) +{ + long expt, prec; + + prec = mpfr_get_prec (x); + expt = mpfr_get_exp (x); + mpfr_mul_2si (x, x, prec - expt, MPFR_RNDN); + + return expt * (1 << (prec - 1)) + mpfr_get_si (x, MPFR_RNDN); +} + +/* The chi-squared test on low precision exponential deviates. wprec is the + * working precision for the chi-squared calculation. prec is the precision + * for the sampling; choose this in [2,5]. The bins consist of all the + * possible deviate values in the range [xmin, xmax] coupled with the value of + * inexact. Thus with prec = 2, the bins are + * ... + * (7/16, 1/2) x = 1/2, inexact = +1 + * (1/2 , 5/8) x = 1/2, inexact = -1 + * (5/8 , 3/4) x = 3/4, inexact = +1 + * (3/4 , 7/8) x = 3/4, inexact = -1 + * (7/8 , 1 ) x = 1 , inexact = +1 + * (1 , 5/4) x = 1 , inexact = -1 + * (5/4 , 3/2) x = 3/2, inexact = +1 + * (3/2 , 7/4) x = 3/2, inexact = -1 + * ... + * In addition, two bins are allocated for [0,xmin) and (xmax,inf). + * + * The sampling is with MPFR_RNDN. This is the rounding mode which elicits the + * most information. trandom_deviate includes checks on the consistency of the + * results extracted from a random_deviate with other rounding modes. */ +static double +test_erandom_chisq_disc (long num, mpfr_prec_t wprec, int prec, + double xmin, double xmax, int verbose) +{ + mpfr_t x, v, pa, pb, z, t; + mpfr_rnd_t rnd; + int i, inexact, nu; + long *counts; + long k, seqmin, seqmax, seq; + double Q, chisq; + + rnd = MPFR_RNDN; + mpfr_init2 (x, prec); + mpfr_init2 (v, prec+1); + mpfr_inits2 (wprec, pa, pb, z, t, (mpfr_ptr) 0); + + mpfr_set_d (x, xmin, rnd); + xmin = mpfr_get_d (x, rnd); + mpfr_set (v, x, rnd); + seqmin = sequential (x); + mpfr_set_d (x, xmax, rnd); + xmax = mpfr_get_d (x, rnd); + seqmax = sequential (x); + + /* Two bins for each sequential number (for inexact = +/- 1), plus 1 for u < + * umin and 1 for u > umax, minus 1 for degrees of freedom */ + nu = 2 * (seqmax - seqmin + 1) + 2 - 1; + counts = (long *) tests_allocate ((nu + 1) * sizeof (long)); + for (i = 0; i <= nu; i++) + counts[i] = 0; + + for (k = 0; k < num; ++k) + { + inexact = mpfr_erandom (x, RANDS, rnd); + if (mpfr_signbit (x)) + { + printf ("Error: mpfr_erandom() returns a negative deviate.\n"); + exit (1); + } + /* Don't call sequential with small args to avoid undefined behavior with + * zero and possibility of overflow. */ + seq = mpfr_greaterequal_p (x, v) ? sequential (x) : seqmin - 1; + ++counts[seq < seqmin ? 0 : + seq <= seqmax ? 2 * (seq - seqmin) + 1 + (inexact > 0 ? 0 : 1) : + nu]; + } + + mpfr_set_zero (v, 1); + exponential_cumulative (pa, v, rnd); + /* Cycle through all the bin boundaries using mpfr_nextabove at precision + * prec + 1 starting at mpfr_nextbelow (xmin) */ + mpfr_set_d (x, xmin, rnd); + mpfr_set (v, x, rnd); + mpfr_nextbelow (v); + mpfr_nextbelow (v); + mpfr_set_zero (t, 1); + for (i = 0; i <= nu; ++i) + { + if (i < nu) + mpfr_nextabove (v); + else + mpfr_set_inf (v, 1); + exponential_cumulative (pb, v, rnd); + mpfr_sub (pa, pb, pa, rnd); + + /* Compute z = counts[i] - num * p; t += z * z / (num * p). */ + mpfr_mul_ui (pa, pa, num, rnd); + mpfr_ui_sub (z, counts[i], pa, rnd); + mpfr_sqr (z, z, rnd); + mpfr_div (z, z, pa, rnd); + mpfr_add (t, t, z, rnd); + mpfr_swap (pa, pb); /* i.e., pa = pb */ + } + + chisq = mpfr_get_d (t, rnd); + chisq_prob (t, nu, t); + Q = mpfr_get_d (t, rnd); + if (verbose) + { + printf ("num = %ld, discrete (prec = %d) bins in [%.6f, %.2f], " + "nu = %d: chisq = %.2f\n", num, prec, xmin, xmax, nu, chisq); + if (Q < 0.05) + printf (" WARNING: probability (less than 5%%) = %.2e\n", Q); + } + + tests_free (counts, (nu + 1) * sizeof (long)); + mpfr_clears (x, v, pa, pb, z, t, (mpfr_ptr) 0); + return Q; +} + +static void +run_chisq (double (*f)(long, mpfr_prec_t, int, double, double, int), + long num, mpfr_prec_t prec, int bin, + double xmin, double xmax, int verbose) +{ + double Q, Qcum, Qbad, Qthresh; + int i; + + Qcum = 1; + Qbad = 1.e-9; + Qthresh = 0.01; + for (i = 0; i < 3; ++i) + { + Q = (*f)(num, prec, bin, xmin, xmax, verbose); + Qcum *= Q; + if (Q > Qthresh) + return; + else if (Q < Qbad) + { + printf ("Error: mpfr_erandom chi-squared failure " + "(prob = %.2e)\n", Q); + exit (1); + } + num *= 10; + Qthresh /= 10; + } + if (Qcum < Qbad) /* Presumably this is true */ + { + printf ("Error: mpfr_erandom combined chi-squared failure " + "(prob = %.2e)\n", Qcum); + exit (1); + } +} + +int +main (int argc, char *argv[]) +{ + long nbtests; + int verbose; + + tests_start_mpfr (); + + verbose = 0; + nbtests = 100000; + if (argc > 1) + { + long a = atol (argv[1]); + verbose = 1; + if (a != 0) + nbtests = a; + } + + run_chisq (test_erandom_chisq_cont, nbtests, 64, 60, 0, 7, verbose); + run_chisq (test_erandom_chisq_disc, nbtests, 64, 2, 0.002, 6, verbose); + run_chisq (test_erandom_chisq_disc, nbtests, 64, 3, 0.02, 7, verbose); + run_chisq (test_erandom_chisq_disc, nbtests, 64, 4, 0.04, 8, verbose); + + tests_end_mpfr (); + return 0; +} diff -Nru mpfr4-3.1.4/tests/terf.c mpfr4-4.0.2/tests/terf.c --- mpfr4-3.1.4/tests/terf.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/terf.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_erf and mpfr_erfc. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_erf @@ -78,7 +74,7 @@ /* erf(+0) = +0 */ mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_erf (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) + if (MPFR_NOTZERO (y) || MPFR_IS_NEG (y)) { printf ("mpfr_erf failed for x=+0\n"); exit (1); @@ -87,7 +83,7 @@ /* erf(-0) = -0 */ mpfr_neg (x, x, MPFR_RNDN); mpfr_erf (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0) + if (MPFR_NOTZERO (y) || MPFR_IS_POS (y)) { printf ("mpfr_erf failed for x=-0\n"); exit (1); @@ -235,7 +231,7 @@ if (mpfr_cmp (x, y)) { printf ("Error: erf for prec=32 (2)\n"); - mpfr_print_binary (x); printf ("\n"); + mpfr_dump (x); exit (1); } @@ -479,7 +475,7 @@ mpfr_set_prec (y, 85); mpfr_set_str_binary (x, "0.111110111111010011101011001100001010011110101010011111010010111101010001011E15"); mpfr_erfc (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) + if (MPFR_NOTZERO (y) || MPFR_IS_NEG (y)) { printf ("mpfr_erfc failed for large x (3b)\n"); exit (1); @@ -623,7 +619,7 @@ mpfr_set_str (ex_y, "1.fffffffffffffffffffffe607440", 16, MPFR_RNDN); ex_inex = -1; ex_flags = MPFR_FLAGS_INEXACT; - if (SIGN (inex) != ex_inex || flags != ex_flags || + if (VSIGN (inex) != ex_inex || flags != ex_flags || ! mpfr_equal_p (y, ex_y)) { printf ("Error in reduced_expo_range\non x = "); @@ -633,13 +629,27 @@ printf ("\n inex = %d, flags = %u\n", ex_inex, ex_flags); printf ("Got y = "); mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN); - printf ("\n inex = %d, flags = %u\n", SIGN (inex), flags); + printf ("\n inex = %d, flags = %u\n", VSIGN (inex), flags); exit (1); } mpfr_clears (x, y, ex_y, (mpfr_ptr) 0); mpfr_set_emax (emax); } +/* Similar to a bug reported by Naoki Shibata: + https://sympa.inria.fr/sympa/arc/mpfr/2018-07/msg00028.html +*/ +static void +bug20180723 (void) +{ + mpfr_t x; + + mpfr_init2 (x, 256); + mpfr_set_ui (x, 28, MPFR_RNDN); + mpfr_erfc (x, x, MPFR_RNDN); + mpfr_clear (x); +} + int main (int argc, char *argv[]) { @@ -650,9 +660,10 @@ large_arg (); test_erfc (); reduced_expo_range (); + bug20180723 (); - test_generic_erf (2, 100, 15); - test_generic_erfc (2, 100, 15); + test_generic_erf (MPFR_PREC_MIN, 300, 150); + test_generic_erfc (MPFR_PREC_MIN, 300, 150); data_check ("data/erf", mpfr_erf, "mpfr_erf"); data_check ("data/erfc", mpfr_erfc, "mpfr_erfc"); diff -Nru mpfr4-3.1.4/tests/tests.c mpfr4-4.0.2/tests/tests.c --- mpfr4-3.1.4/tests/tests.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tests.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Miscellaneous support for test programs. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,16 +17,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -# if HAVE_CONFIG_H -# include "config.h" /* for a build within gmp */ -# endif +# include "config.h" #endif -#include #include #include @@ -34,7 +31,10 @@ #include #endif -#ifdef MPFR_TEST_DIVBYZERO +#ifdef MPFR_TESTS_FPE_DIV +# ifdef MPFR_TESTS_FPE_TRAP +# define _GNU_SOURCE /* for feenableexcept */ +# endif # include #endif @@ -57,6 +57,10 @@ #include #endif +#if defined(HAVE_SIGNAL) || defined(HAVE_SIGACTION) +# include +#endif + #include "mpfr-test.h" #ifdef MPFR_FPU_PREC @@ -98,6 +102,20 @@ #endif +char mpfr_rands_initialized = 0; +gmp_randstate_t mpfr_rands; + +char *locale = NULL; + +/* Programs that test GMP's mp_set_memory_functions() need to set + tests_memory_disabled = 2 before calling tests_start_mpfr(). */ +#ifdef MPFR_USE_MINI_GMP +/* disable since mini-gmp does not keep track of old_size in realloc/free */ +int tests_memory_disabled = 1; +#else +int tests_memory_disabled = 0; +#endif + static mpfr_exp_t default_emin, default_emax; static void tests_rand_start (void); @@ -119,7 +137,8 @@ of "make check") but a different library that is already installed, i.e. any test result would be meaningless; in such a case, we exit immediately with an error (exit status = 1). - Return value: 0 for no errors, 1 in case of any non-fatal error. */ + Return value: 0 for no errors, 1 in case of any non-fatal error. + Note: If the return value is 0, no data must be sent to stdout. */ int test_version (void) { @@ -127,6 +146,7 @@ char buffer[256]; int err = 0; +#ifndef MPFR_USE_MINI_GMP sprintf (buffer, "%d.%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL); if (strcmp (buffer, gmp_version) != 0 && @@ -134,6 +154,7 @@ (sprintf (buffer, "%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR), strcmp (buffer, gmp_version) != 0))) err = 1; +#endif /* In some cases, it may be acceptable to have different versions for the header and the library, in particular when shared libraries are @@ -153,7 +174,7 @@ printf (" * A bad configuration in your include/library search paths.\n" " * An inconsistency in the include/library search paths of\n" " your development environment; an example:\n" - " http://gcc.gnu.org/ml/gcc-help/2010-11/msg00359.html\n" + " https://gcc.gnu.org/ml/gcc-help/2010-11/msg00359.html\n" " * GMP has been upgraded after the first \"make check\".\n" " In such a case, try again after a \"make clean\".\n" " * A new or non-standard version naming is used in GMP.\n" @@ -167,7 +188,6 @@ /* VL: I get the following error on an OpenSUSE machine, and changing the value of shlibpath_overrides_runpath in the libtool file from 'no' to 'yes' fixes the problem. */ - version = mpfr_get_version (); if (strcmp (MPFR_VERSION_STRING, version) == 0) { @@ -197,9 +217,16 @@ " * On some platforms such as Solaris, $LD_LIBRARY_PATH overrides\n" " the rpath, and if the MPFR library is already installed in a\n" " $LD_LIBRARY_PATH directory, you typically get this error. Do\n" - " not use $LD_LIBRARY_PATH on such platforms; it may also break\n" - " other things.\n" - " * Then look at http://www.mpfr.org/mpfr-current/ for any update.\n" + " not use $LD_LIBRARY_PATH permanently on such platforms; it may\n" + " also break other things.\n" + " * You may have an ld option that specifies a library search path\n" + " where MPFR can be found, taking the precedence over the path\n" + " added by libtool. Check your environment variables, such as\n" + " LD_OPTIONS under Solaris. Moreover, under Solaris, the run path\n" + " generated by libtool 2.4.6 may be incorrect: the build directory\n" + " may not appear first in the run path; set $LD_LIBRARY_PATH to\n" + " /path/to/builddir/src/.libs for the tests as a workaround.\n" + " * Then look at https://www.mpfr.org/mpfr-current/ for any update.\n" " * Try again on a completely clean source (some errors might come\n" " from a previous build or previous source changes).\n" " * If the error still occurs, you can try to change the value of\n" @@ -211,36 +238,63 @@ /* Note about $LD_LIBRARY_PATH under Solaris: * https://en.wikipedia.org/wiki/Rpath#Solaris_ld.so * This cause has been confirmed by a user who got this error. + * And about the libtool 2.4.6 bug also concerning Solaris: + * https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30222 + * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=888059 */ exit (1); } +/* The inexact exception occurs very often, and is normal. + The underflow exception also might occur, for example in test_generic + for mpfr_xxx_d functions. Same for overflow. Thus we only check for + the division-by-zero and invalid exceptions, which should not occur + inside MPFR. */ +#define FPE_FLAGS (FE_DIVBYZERO | FE_INVALID) + void tests_start_mpfr (void) { - test_version (); - - /* don't buffer, so output is not lost if a test causes a segv etc */ + /* Don't buffer, so output is not lost if a test causes a segv, etc. + For stdout, this is important as it will typically be fully buffered + by default with "make check". For stderr, the C standard just says + that it is not fully buffered (it may be line buffered by default); + disabling buffering completely might be useful in some cases. + Warning! No operations must have already been done on stdout/stderr + (this is a requirement of ISO C, and this is important on AIX). + Thus tests_start_mpfr should be called at the beginning of main(), + possibly after some variable settings. */ setbuf (stdout, NULL); + setbuf (stderr, NULL); + + test_version (); #if defined HAVE_LOCALE_H && defined HAVE_SETLOCALE /* Added on 2005-07-09. This allows to test MPFR under various locales. New bugs will probably be found, in particular with LC_ALL="tr_TR.ISO8859-9" because of the i/I character... */ - setlocale (LC_ALL, ""); + locale = setlocale (LC_ALL, ""); #endif #ifdef MPFR_FPU_PREC set_fpu_prec (); #endif -#ifdef MPFR_TEST_DIVBYZERO +#ifdef MPFR_TESTS_FPE_DIV /* Define to test the use of MPFR_ERRDIVZERO */ feclearexcept (FE_ALL_EXCEPT); +# ifdef MPFR_TESTS_FPE_TRAP + /* to trap the corresponding FP exceptions */ + feenableexcept (FPE_FLAGS); +# endif #endif - tests_memory_start (); - tests_rand_start (); + if (tests_memory_disabled != 2) + { + if (tests_memory_disabled == 0) + tests_memory_start (); + tests_rand_start (); + } tests_limit_start (); default_emin = mpfr_get_emin (); @@ -265,20 +319,28 @@ } mpfr_free_cache (); - tests_rand_end (); - tests_memory_end (); + mpfr_free_cache2 (MPFR_FREE_GLOBAL_CACHE); + if (tests_memory_disabled != 2) + { + tests_rand_end (); + if (tests_memory_disabled == 0) + tests_memory_end (); + } -#ifdef MPFR_TEST_DIVBYZERO +#ifdef MPFR_TESTS_FPE_DIV /* Define to test the use of MPFR_ERRDIVZERO */ - if (fetestexcept (FE_DIVBYZERO|FE_INVALID)) + if (fetestexcept (FPE_FLAGS)) { - printf ("A floating-point division by 0 or an invalid operation" - " occurred!\n"); -#ifdef MPFR_ERRDIVZERO - /* This should never occur because the purpose of defining - MPFR_ERRDIVZERO is to avoid all the FP divisions by 0. */ + /* With MPFR_ERRDIVZERO, such exceptions should never occur + because the purpose of defining MPFR_ERRDIVZERO is to avoid + all the FP divisions by 0. */ + printf ("Some floating-point exception(s) occurred:"); + if (fetestexcept (FE_DIVBYZERO)) + printf (" DIVBYZERO"); /* e.g. from 1.0 / 0.0 to generate an inf */ + if (fetestexcept (FE_INVALID)) + printf (" INVALID"); /* e.g. from 0.0 / 0.0 to generate a NaN */ + printf ("\n"); err = 1; -#endif } #endif @@ -321,21 +383,19 @@ static void tests_rand_start (void) { - gmp_randstate_ptr rands; char *perform_seed; unsigned long seed; - if (__gmp_rands_initialized) + if (mpfr_rands_initialized) { printf ( - "Please let tests_start() initialize the global __gmp_rands, i.e.\n" + "Please let tests_start() initialize the global mpfr_rands, i.e.\n" "ensure that function is called before the first use of RANDS.\n"); exit (1); } - gmp_randinit_default (__gmp_rands); - __gmp_rands_initialized = 1; - rands = __gmp_rands; + gmp_randinit_default (mpfr_rands); + mpfr_rands_initialized = 1; perform_seed = getenv ("GMP_CHECK_RANDOMIZE"); if (perform_seed != NULL) @@ -344,7 +404,7 @@ if (! (seed == 0 || seed == 1)) { printf ("Re-seeding with GMP_CHECK_RANDOMIZE=%lu\n", seed); - gmp_randseed_ui (rands, seed); + gmp_randseed_ui (mpfr_rands, seed); } else { @@ -357,13 +417,13 @@ time (&tv); seed = tv; #endif - gmp_randseed_ui (rands, seed); + gmp_randseed_ui (mpfr_rands, seed); printf ("Seed GMP_CHECK_RANDOMIZE=%lu " "(include this in bug reports)\n", seed); } } else - gmp_randseed_ui (rands, 0x2143FEDC); + gmp_randseed_ui (mpfr_rands, 0x2143FEDC); } static void @@ -528,7 +588,10 @@ printf ("] %.20Lg\n", ld); } -/* Open a file in the src directory - can't use fopen directly */ +/* Open a file in the SRCDIR directory, i.e. the "tests" source directory, + which is different from the current directory when objdir is different + from srcdir. One should generally use this function instead of fopen + directly. */ FILE * src_fopen (const char *filename, const char *mode) { @@ -587,17 +650,17 @@ MPFR_ASSERTN (emax <= MPFR_EMAX_MAX); /* but it isn't required that emin and emax are in the current exponent range (see below), so that underflow/overflow checks - can be done on 64-bit machines. */ + can be done on 64-bit machines without a manual change of the + exponent range (well, this is a bit ugly...). */ mpfr_urandomb (x, RANDS); if (MPFR_IS_PURE_FP (x) && (emin >= 1 || always_scale || (randlimb () & 1))) { mpfr_exp_t e; - e = MPFR_GET_EXP (x) + - (emin + (mpfr_exp_t) (randlimb () % (emax - emin + 1))); + e = emin + (mpfr_exp_t) (randlimb () % (emax - emin + 1)); /* Note: There should be no overflow here because both terms are - between MPFR_EMIN_MIN and MPFR_EMAX_MAX, but the sum e isn't - necessarily between MPFR_EMIN_MIN and MPFR_EMAX_MAX. */ + between MPFR_EMIN_MIN and MPFR_EMAX_MAX. */ + MPFR_ASSERTD (e >= emin && e <= emax); if (mpfr_set_exp (x, e)) { /* The random number doesn't fit in the current exponent range. @@ -641,7 +704,7 @@ MPFR_ASSERTN (rnd != MPFR_RND_MAX); inex = fct (z, x, rnd); - if (! (mpfr_equal_p (y, z) || (mpfr_nan_p (y) && mpfr_nan_p (z)))) + if (! SAME_VAL (y, z)) { printf ("Error for %s with xprec=%lu, yprec=%lu, rnd=%s\nx = ", name, (unsigned long) MPFR_PREC (x), (unsigned long) yprec, @@ -797,8 +860,8 @@ ungetc (c, fp); c = fscanf (fp, "%ld %ld %c", &xprec, &yprec, &r); - MPFR_ASSERTN (xprec >= MPFR_PREC_MIN && xprec <= MPFR_PREC_MAX); - MPFR_ASSERTN (yprec >= MPFR_PREC_MIN && yprec <= MPFR_PREC_MAX); + MPFR_ASSERTN (MPFR_PREC_COND (xprec)); + MPFR_ASSERTN (MPFR_PREC_COND (yprec)); if (c == EOF) { perror ("data_check"); @@ -881,6 +944,11 @@ * mode for some lower precision: see data_check). * fct, inv, name: data related to the function. * pos, emin, emax: arguments for tests_default_random. + * For debugging purpose (e.g. in case of crash or infinite loop), + * you can set the MPFR_DEBUG_BADCASES environment variable to 1 in + * order to output information about the tested worst cases. You can + * also enable logging (when supported), but this may give too much + * information. */ void bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), const char *name, @@ -1021,3 +1089,35 @@ printf (" none"); printf (" (%u)\n", flags); } + +static void +abort_called (int x) +{ + /* Ok, abort has been called */ + exit (0); +} + +/* This function has to be called for a test + that will call the abort function */ +void +tests_expect_abort (void) +{ +#if defined(HAVE_SIGACTION) + struct sigaction act; + int ret; + + memset (&act, 0, sizeof act); + act.sa_handler = abort_called; + ret = sigaction (SIGABRT, &act, NULL); + if (ret != 0) + { + /* Can't register error handler: Skip test */ + exit (77); + } +#elif defined(HAVE_SIGNAL) + signal (SIGABRT, abort_called); +#else + /* Can't register error handler: Skip test */ + exit (77); +#endif +} diff -Nru mpfr4-3.1.4/tests/texceptions.c mpfr4-4.0.2/tests/texceptions.c --- mpfr4-3.1.4/tests/texceptions.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/texceptions.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ -/* Test file for exceptions. +/* Test file for features related to exceptions. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,15 +17,12 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" -#define ERROR(s) do { printf(s"\n"); exit(1); } while(0) +#define PRINT_ERROR(s) do { printf ("%s\n", s); exit (1); } while (0) /* Test powerof2 */ static void @@ -55,15 +52,15 @@ { printf ("%s %s\n", mpfr_print_rnd_mode ((mpfr_rnd_t) r), mpfr_print_rnd_mode (t)); - ERROR("ERROR in setting / getting default rounding mode (1)"); + PRINT_ERROR ("ERROR in setting / getting default rounding mode (1)"); } } mpfr_set_default_rounding_mode ((mpfr_rnd_t) MPFR_RND_MAX); - if (mpfr_get_default_rounding_mode() != MPFR_RNDA) - ERROR("ERROR in setting / getting default rounding mode (2)"); + if (mpfr_get_default_rounding_mode() != MPFR_RNDF) + PRINT_ERROR ("ERROR in setting / getting default rounding mode (2)"); mpfr_set_default_rounding_mode((mpfr_rnd_t) -1); - if (mpfr_get_default_rounding_mode() != MPFR_RNDA) - ERROR("ERROR in setting / getting default rounding mode (3)"); + if (mpfr_get_default_rounding_mode() != MPFR_RNDF) + PRINT_ERROR ("ERROR in setting / getting default rounding mode (3)"); } static void @@ -76,40 +73,40 @@ /* Check the functions not the macros ! */ if ((mpfr_set_emin)(MPFR_EMIN_MIN) != 0) - ERROR("set_emin failed!"); + PRINT_ERROR ("set_emin failed!"); if ((mpfr_get_emin)() != MPFR_EMIN_MIN) - ERROR("get_emin FAILED!"); + PRINT_ERROR ("get_emin FAILED!"); if ((mpfr_set_emin)(MPFR_EMIN_MIN-1) == 0) - ERROR("set_emin failed! (2)"); + PRINT_ERROR ("set_emin failed! (2)"); if ((mpfr_set_emax)(MPFR_EMAX_MAX) != 0) - ERROR("set_emax failed!"); + PRINT_ERROR ("set_emax failed!"); if ((mpfr_get_emax)() != MPFR_EMAX_MAX) - ERROR("get_emax FAILED!"); + PRINT_ERROR ("get_emax FAILED!"); if ((mpfr_set_emax)(MPFR_EMAX_MAX+1) == 0) - ERROR("set_emax failed! (2)"); + PRINT_ERROR ("set_emax failed! (2)"); if ((mpfr_get_emin_min) () != MPFR_EMIN_MIN) - ERROR ("get_emin_min"); + PRINT_ERROR ("get_emin_min"); if ((mpfr_get_emin_max) () != MPFR_EMIN_MAX) - ERROR ("get_emin_max"); + PRINT_ERROR ("get_emin_max"); if ((mpfr_get_emax_min) () != MPFR_EMAX_MIN) - ERROR ("get_emax_min"); + PRINT_ERROR ("get_emax_min"); if ((mpfr_get_emax_max) () != MPFR_EMAX_MAX) - ERROR ("get_emax_max"); + PRINT_ERROR ("get_emax_max"); set_emin (old_emin); set_emax (old_emax); } static void -check_set_get_prec (void) +check_get_prec (void) { mpfr_t x; mpfr_init2 (x, 17); if (mpfr_get_prec (x) != 17 || (mpfr_get_prec)(x) != 17) - ERROR ("mpfr_get_prec"); + PRINT_ERROR ("mpfr_get_prec"); mpfr_clear (x); } @@ -118,10 +115,10 @@ { mpfr_set_default_prec (54); if (mpfr_get_default_prec () != 54) - ERROR ("get_default_prec failed (1)"); + PRINT_ERROR ("get_default_prec failed (1)"); mpfr_set_default_prec (53); if ((mpfr_get_default_prec) () != 53) - ERROR ("get_default_prec failed (2)"); + PRINT_ERROR ("get_default_prec failed (2)"); /* in double precision format, the unbiased exponent is between 0 and 2047, where 0 is used for subnormal numbers, and 2047 for special @@ -157,32 +154,32 @@ (mpfr_clear_overflow)(); mpfr_mul_2exp (x, x, 1024, MPFR_RNDN); if (!(mpfr_overflow_p)()) - ERROR("ERROR: No overflow detected!\n"); + PRINT_ERROR ("ERROR: No overflow detected!\n"); (mpfr_clear_underflow)(); mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_div_2exp (x, x, 1025, MPFR_RNDN); if (!(mpfr_underflow_p)()) - ERROR("ERROR: No underflow detected!\n"); + PRINT_ERROR ("ERROR: No underflow detected!\n"); (mpfr_clear_nanflag)(); MPFR_SET_NAN(x); mpfr_add (x, x, x, MPFR_RNDN); if (!(mpfr_nanflag_p)()) - ERROR("ERROR: No NaN flag!\n"); + PRINT_ERROR ("ERROR: No NaN flag!\n"); (mpfr_clear_inexflag)(); mpfr_set_ui(x, 2, MPFR_RNDN); mpfr_cos(x, x, MPFR_RNDN); if (!(mpfr_inexflag_p)()) - ERROR("ERROR: No inexact flag!\n"); + PRINT_ERROR ("ERROR: No inexact flag!\n"); (mpfr_clear_erangeflag) (); mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_mul_2exp (x, x, 1024, MPFR_RNDN); mpfr_get_ui (x, MPFR_RNDN); if (!(mpfr_erangeflag_p)()) - ERROR ("ERROR: No erange flag!\n"); + PRINT_ERROR ("ERROR: No erange flag!\n"); mpfr_clear (x); set_emin (old_emin); @@ -213,7 +210,25 @@ j = s < 0 && i > 1 ? 5 - i : i; inex = mpfr_underflow (x, (mpfr_rnd_t) i, s); - if (mpfr_cmp (x, r[j]) || inex * t[j] <= 0) + /* for RNDF, inex has no meaning, just check that x is either + min or zero */ + if (i == MPFR_RNDF) + { + if (mpfr_cmp (x, min) && mpfr_cmp (x, zero)) + { + printf ("Error in test_set_underflow, sign = %d," + " rnd_mode = %s\n", s, mpfr_print_rnd_mode ((mpfr_rnd_t) i)); + printf ("Got\n"); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); + printf ("\ninstead of\n"); + mpfr_out_str (stdout, 2, 0, zero, MPFR_RNDN); + printf ("\nor\n"); + mpfr_out_str (stdout, 2, 0, min, MPFR_RNDN); + printf ("\n"); + exit (1); + } + } + else if (mpfr_cmp (x, r[j]) || inex * t[j] <= 0) { printf ("Error in test_set_underflow, sign = %d," " rnd_mode = %s\n", s, mpfr_print_rnd_mode ((mpfr_rnd_t) i)); @@ -255,7 +270,25 @@ j = s < 0 && i > 1 ? 5 - i : i; inex = mpfr_overflow (x, (mpfr_rnd_t) i, s); - if (mpfr_cmp (x, r[j]) || inex * t[j] <= 0) + /* for RNDF, inex has no meaning, just check that x is either + max or inf */ + if (i == MPFR_RNDF) + { + if (mpfr_cmp (x, max) && mpfr_cmp (x, inf)) + { + printf ("Error in test_set_overflow, sign = %d," + " rnd_mode = %s\n", s, mpfr_print_rnd_mode ((mpfr_rnd_t) i)); + printf ("Got\n"); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); + printf ("\ninstead of\n"); + mpfr_out_str (stdout, 2, 0, max, MPFR_RNDN); + printf ("\nor\n"); + mpfr_out_str (stdout, 2, 0, inf, MPFR_RNDN); + printf ("\n"); + exit (1); + } + } + else if (mpfr_cmp (x, r[j]) || inex * t[j] <= 0) { printf ("Error in test_set_overflow, sign = %d," " rnd_mode = %s\n", s, mpfr_print_rnd_mode ((mpfr_rnd_t) i)); @@ -339,6 +372,83 @@ MPFR_ASSERTN (__gmpfr_flags == 0); } +/* Note: this test assumes that mpfr_flags_* can be implemented as both + a function and a macro. Thus in such a case, both implementations are + tested. */ +static void +check_groups (void) +{ + int i, j; + for (i = 0; i < 200; i++) + { + mpfr_flags_t f1, f2, mask; + + f1 = __gmpfr_flags; + MPFR_ASSERTN (mpfr_flags_save () == f1); + MPFR_ASSERTN ((mpfr_flags_save) () == f1); + MPFR_ASSERTN (__gmpfr_flags == f1); + mask = randlimb () & MPFR_FLAGS_ALL; + if (randlimb () & 1) + mpfr_flags_set (mask); + else + (mpfr_flags_set) (mask); + for (j = 1; j <= MPFR_FLAGS_ALL; j <<= 1) + if ((__gmpfr_flags & j) != ((mask & j) != 0 ? j : (f1 & j))) + { + printf ("mpfr_flags_set error: old = 0x%lx, group = 0x%lx, " + "new = 0x%lx, j = 0x%lx\n", + (unsigned long) f1, (unsigned long) mask, + (unsigned long) __gmpfr_flags, (unsigned long) j); + exit (1); + } + + f2 = __gmpfr_flags; + mask = randlimb () & MPFR_FLAGS_ALL; + if (randlimb () & 1) + mpfr_flags_clear (mask); + else + (mpfr_flags_clear) (mask); + for (j = 1; j <= MPFR_FLAGS_ALL; j <<= 1) + if ((__gmpfr_flags & j) != ((mask & j) != 0 ? 0 : (f2 & j))) + { + printf ("mpfr_flags_clear error: old = 0x%lx, group = 0x%lx, " + "new = 0x%lx, j = 0x%lx\n", + (unsigned long) f2, (unsigned long) mask, + (unsigned long) __gmpfr_flags, (unsigned long) j); + exit (1); + } + + mask = randlimb () & MPFR_FLAGS_ALL; + f2 = (randlimb () & 1) ? + mpfr_flags_test (mask) : (mpfr_flags_test) (mask); + for (j = 1; j <= MPFR_FLAGS_ALL; j <<= 1) + if ((f2 & j) != ((mask & j) != 0 ? (__gmpfr_flags & j) : 0)) + { + printf ("mpfr_flags_test error: current = 0x%lx, mask = 0x%lx, " + "res = 0x%lx, j = 0x%lx\n", + (unsigned long) __gmpfr_flags, (unsigned long) mask, + (unsigned long) f2, (unsigned long) j); + exit (1); + } + + f2 = __gmpfr_flags; + if (randlimb () & 1) + mpfr_flags_restore (f1, mask); + else + (mpfr_flags_restore) (f1, mask); + for (j = 1; j <= MPFR_FLAGS_ALL; j <<= 1) + if ((__gmpfr_flags & j) != (((mask & j) != 0 ? f1 : f2) & j)) + { + printf ("mpfr_flags_restore error: old = 0x%lx, flags = 0x%lx, " + "mask = 0x%lx, new = 0x%lx, j = 0x%lx\n", + (unsigned long) f2, (unsigned long) f1, + (unsigned long) mask, (unsigned long) __gmpfr_flags, + (unsigned long) j); + exit (1); + } + } +} + int main (int argc, char *argv[]) { @@ -390,7 +500,7 @@ { printf ("Error: x+x rounded to nearest for x=2^1023 should give +Inf\n"); printf ("emax = %ld\n", (long) mpfr_get_emax ()); - printf ("got "); mpfr_print_binary (x); puts (""); + printf ("got "); mpfr_dump (x); exit (1); } @@ -412,7 +522,7 @@ { printf ("Error: y-x rounded to zero should give 0" " for y=3/2*2^(-1022), x=2^(-1022)\n"); - printf ("y="); mpfr_print_binary (y); puts (""); + printf ("Got "); mpfr_dump (y); exit (1); } @@ -437,9 +547,10 @@ check_emin_emax(); check_flags(); - check_set_get_prec (); + check_get_prec (); check_powerof2 (); check_set (); + check_groups (); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/texp10.c mpfr4-4.0.2/tests/texp10.c --- mpfr4-3.1.4/tests/texp10.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/texp10.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_exp10. -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_exp10 @@ -158,13 +154,14 @@ if (! mpfr_equal_p (x, y)) { printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of 0.11111111E%d.\n", emax); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of 0.11111111E%d.\n", emax); err = 1; } } - else + else if (rnd != MPFR_RNDF) { if (inex <= 0) { @@ -173,12 +170,13 @@ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0)) + if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of +Inf.\n"); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of +Inf.\n"); err = 1; } } @@ -235,11 +233,11 @@ set_emin (-11); mpfr_set_si (x, -4, MPFR_RNDN); mpfr_exp10 (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) + if (MPFR_NOTZERO (y) || MPFR_IS_NEG (y)) { printf ("Error for emin = -11, x = -4, RNDN\n"); printf ("Expected +0\n"); - printf ("Got "); mpfr_print_binary (y); puts (""); + printf ("Got "); mpfr_dump (y); exit (1); } /* restore emin */ @@ -254,7 +252,7 @@ { printf ("Error for emax = 13, x = 4, RNDN\n"); printf ("Expected +inf\n"); - printf ("Got "); mpfr_print_binary (y); puts (""); + printf ("Got "); mpfr_dump (y); exit (1); } /* restore emax */ @@ -304,7 +302,7 @@ } } - test_generic (2, 100, 100); + test_generic (MPFR_PREC_MIN, 100, 100); mpfr_clear (x); mpfr_clear (y); diff -Nru mpfr4-3.1.4/tests/texp2.c mpfr4-4.0.2/tests/texp2.c --- mpfr4-3.1.4/tests/texp2.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/texp2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_exp2. -Copyright 2001-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2001-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_exp2 @@ -183,13 +179,14 @@ if (! mpfr_equal_p (x, y)) { printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of 0.11111111E%d.\n", emax); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of 0.11111111E%d.\n", emax); err = 1; } } - else + else if (rnd != MPFR_RNDF) { if (inex <= 0) { @@ -198,12 +195,13 @@ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0)) + if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of +Inf.\n"); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of +Inf.\n"); err = 1; } } @@ -217,6 +215,70 @@ mpfr_clear (y); } +static void +bug20171218 (void) +{ + mpfr_t x, y, z; + mpfr_exp_t emin; + int inex, i; + mpfr_flags_t flags, ex_flags; + + emin = mpfr_get_emin (); + + mpfr_init2 (x, 228); + mpfr_init2 (y, 11); + mpfr_init2 (z, 11); + mpfr_set_str_binary (x, "-0.110111010100001100000000000000111001100101011011101110101011000011011011001101111111110100110001110100111000111101010010100010001101100001010111101110100010000101011111001101011000011101000000001010001011110011110101010111000000E17"); + mpfr_set_emin (-113285); + mpfr_clear_flags (); + inex = mpfr_exp2 (y, x, MPFR_RNDA); + /* exact result is 0.11111111111110110000001011...E-113286, which rounded away + gives 0.10000000000E-113285, i.e., no underflow (after rounding) */ + mpfr_set_str_binary (z, "0.10000000000E-113285"); + MPFR_ASSERTN(mpfr_equal_p (y, z)); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_inexflag_p ()); + MPFR_ASSERTN(!mpfr_underflow_p ()); + mpfr_clear (x); + mpfr_clear (y); + mpfr_clear (z); + + mpfr_init2 (x, 256); + mpfr_init2 (y, 8); + mpfr_init2 (z, 8); + + for (i = 0; i < 3; i++) + { + mpfr_set_emin (i == 0 ? -17 : i == 1 ? emin : MPFR_EMIN_MIN); + mpfr_set_exp_t (x, __gmpfr_emin - 2, MPFR_RNDN); + mpfr_nextabove (x); + mpfr_set_ui_2exp (z, 1, __gmpfr_emin - 1, MPFR_RNDN); + ex_flags = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT; + mpfr_clear_flags (); + inex = mpfr_exp2 (y, x, MPFR_RNDN); + flags = __gmpfr_flags; + if (! (flags == ex_flags && SAME_SIGN (inex, 1) && mpfr_equal_p (y, z))) + { + printf ("Error in bug20171218 for i=%d\n", i); + printf ("Expected "); + mpfr_dump (z); + printf (" with inex = 1 and flags:"); + flags_out (ex_flags); + printf ("Got "); + mpfr_dump (y); + printf (" with inex = %d and flags:", inex); + flags_out (flags); + exit (1); + } + } + + mpfr_clear (x); + mpfr_clear (y); + mpfr_clear (z); + + mpfr_set_emin (emin); +} + int main (int argc, char *argv[]) { @@ -225,6 +287,7 @@ tests_start_mpfr (); + bug20171218 (); special_overflow (); emax_m_eps (); exp_range (); @@ -290,11 +353,11 @@ set_emin (-10); mpfr_set_si (x, -12, MPFR_RNDN); mpfr_exp2 (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) + if (MPFR_NOTZERO (y) || MPFR_IS_NEG (y)) { printf ("Error for x=emin-2, RNDN\n"); printf ("Expected +0\n"); - printf ("Got "); mpfr_print_binary (y); puts (""); + printf ("Got "); mpfr_dump (y); exit (1); } /* restore emin */ @@ -365,7 +428,7 @@ exit (1); } - test_generic (2, 100, 100); + test_generic (MPFR_PREC_MIN, 100, 100); mpfr_clear (x); mpfr_clear (y); diff -Nru mpfr4-3.1.4/tests/texp.c mpfr4-4.0.2/tests/texp.c --- mpfr4-3.1.4/tests/texp.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/texp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_exp. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include - #include "mpfr-test.h" #ifdef CHECK_EXTERNAL @@ -196,14 +192,11 @@ { printf ("mpfr_exp_2 and mpfr_exp_3 disagree for rnd=%s and\nx=", mpfr_print_rnd_mode (rnd)); - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); printf ("mpfr_exp_2 gives "); - mpfr_print_binary (y); - puts (""); + mpfr_dump (y); printf ("mpfr_exp_3 gives "); - mpfr_print_binary (z); - puts (""); + mpfr_dump (z); exit (1); } } @@ -270,7 +263,7 @@ /* check exp(-inf) = +0 */ mpfr_set_inf (x, -1); test_exp (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) + if (MPFR_NOTZERO (y) || MPFR_IS_NEG (y)) { printf ("Error for exp(-inf)\n"); exit (1); @@ -361,11 +354,11 @@ set_emin (-10); mpfr_set_si (x, -9, MPFR_RNDN); test_exp (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) + if (MPFR_NOTZERO (y) || MPFR_IS_NEG (y)) { printf ("Error for exp(-9) for emin=-10\n"); printf ("Expected +0\n"); - printf ("Got "); mpfr_print_binary (y); puts (""); + printf ("Got "); mpfr_dump (y); exit (1); } set_emin (emin); @@ -550,55 +543,57 @@ /* and if emax < 0, 1 - eps is not representable either. */ for (i = -1; i <= 1; i++) RND_LOOP (rnd) - { - mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN); - mpfr_clear_flags (); - inex = mpfr_exp (x, x, (mpfr_rnd_t) rnd); - if ((i >= 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) && - ! mpfr_overflow_p ()) - { - printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n" - " The overflow flag is not set.\n", - i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - err = 1; - } - if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD) - { - if (inex >= 0) - { - printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n" - " The inexact value must be negative.\n", - i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - err = 1; - } - if (! mpfr_equal_p (x, y)) - { - printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of 0.11111111E%d.\n", emax); - err = 1; - } - } - else - { - if (inex <= 0) - { - printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n" - " The inexact value must be positive.\n", - i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - err = 1; - } - if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0)) - { - printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of +Inf.\n"); - err = 1; - } - } - } + { + mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN); + mpfr_clear_flags (); + inex = mpfr_exp (x, x, (mpfr_rnd_t) rnd); + if ((i >= 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) && + ! mpfr_overflow_p ()) + { + printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n" + " The overflow flag is not set.\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + err = 1; + } + if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD) + { + if (inex >= 0) + { + printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n" + " The inexact value must be negative.\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + err = 1; + } + if (! mpfr_equal_p (x, y)) + { + printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n" + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of 0.11111111E%d.\n", emax); + err = 1; + } + } + else if (rnd != MPFR_RNDF) + { + if (inex <= 0) + { + printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n" + " The inexact value must be positive.\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + err = 1; + } + if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) + { + printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n" + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of +Inf.\n"); + err = 1; + } + } + } set_emax (old_emax); } @@ -724,7 +719,8 @@ mpfr_clear_flags (); inex = e3 ? exp_3 (y, x, (mpfr_rnd_t) rnd) : mpfr_exp (y, x, (mpfr_rnd_t) rnd); - if (__gmpfr_flags != MPFR_FLAGS_INEXACT) + /* for MPFR_RNDF, the inexact flag is undefined */ + if (__gmpfr_flags != MPFR_FLAGS_INEXACT && rnd != MPFR_RNDF) { printf ("Incorrect flags in underflow_up, eps > 0, %s", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); @@ -732,7 +728,10 @@ printf (" and extended emin"); printf ("\nfor precx = %d, precy = %d, %s\n", precx, precy, e3 ? "mpfr_exp_3" : "mpfr_exp"); - printf ("Got %u instead of %u.\n", __gmpfr_flags, + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); + printf ("Got %u instead of %u.\n", + (unsigned int) __gmpfr_flags, (unsigned int) MPFR_FLAGS_INEXACT); err = 1; } @@ -747,7 +746,9 @@ mpfr_dump (y); err = 1; } - MPFR_ASSERTN (inex != 0); + /* for MPFR_RNDF, the ternary value is undefined */ + if (rnd != MPFR_RNDF) + MPFR_ASSERTN (inex != 0); if (rnd == MPFR_RNDD || rnd == MPFR_RNDZ) MPFR_ASSERTN (inex < 0); if (rnd == MPFR_RNDU) @@ -856,9 +857,12 @@ precy + i, 1 - 2 * (precy + i)); printf (", %s\n", e3 ? "mpfr_exp_3" : "mpfr_exp"); printf ("Got %u instead of %u.\n", - __gmpfr_flags, flags); + (unsigned int) __gmpfr_flags, flags); err = 1; } + if (rnd == MPFR_RNDF) + continue; /* the test below makes no sense, since RNDF + does not give a deterministic result */ if (rnd == MPFR_RNDU || rnd == MPFR_RNDA || rnd == MPFR_RNDN ? mpfr_cmp0 (y, minpos) != 0 : MPFR_NOTZERO (y)) { @@ -968,6 +972,24 @@ } } +/* bug found with GMP_CHECK_RANDOMIZE=1514290185 */ +static void +bug20171223 (void) +{ + mpfr_t x, y; + int inex; + + mpfr_init2 (x, 372); + mpfr_init2 (y, 2); + mpfr_set_str (x, "-6.9314716128384587678466323621915206417385796077947874471662159283492445979241549847386366371775938082803907383582e-01", 10, MPFR_RNDN); + /* exp(x) = 0.500000009638..., should be rounded to 0.5 */ + inex = mpfr_exp (y, x, MPFR_RNDD); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (y, 1, -1) == 0); + MPFR_ASSERTN(inex < 0); + mpfr_clear (x); + mpfr_clear (y); +} + int main (int argc, char *argv[]) { @@ -976,10 +998,12 @@ if (argc > 1) check_large (); + bug20171223 (); + check_inexact (); check_special (); - test_generic (2, 100, 100); + test_generic (MPFR_PREC_MIN, 100, 100); compare_exp2_exp3 (20, 1000); check_worst_cases(); diff -Nru mpfr4-3.1.4/tests/texpm1.c mpfr4-4.0.2/tests/texpm1.c --- mpfr4-3.1.4/tests/texpm1.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/texpm1.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_expm1. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #ifdef CHECK_EXTERNAL @@ -88,7 +85,7 @@ mpfr_set_ui (x, 0, MPFR_RNDN); test_expm1 (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) + if (MPFR_NOTZERO (y) || MPFR_IS_NEG (y)) { printf ("Error for expm1(+0)\n"); exit (1); @@ -96,7 +93,7 @@ mpfr_neg (x, x, MPFR_RNDN); test_expm1 (y, x, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0) + if (MPFR_NOTZERO (y) || MPFR_IS_POS (y)) { printf ("Error for expm1(-0)\n"); exit (1); @@ -106,21 +103,21 @@ mpfr_clear_flags (); mpfr_set_str_binary (x, "1.1E1000000000"); i = test_expm1 (x, x, MPFR_RNDN); - MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_IS_POS (x)); MPFR_ASSERTN (mpfr_overflow_p ()); MPFR_ASSERTN (i == 1); mpfr_clear_flags (); mpfr_set_str_binary (x, "1.1E1000000000"); i = test_expm1 (x, x, MPFR_RNDU); - MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_IS_POS (x)); MPFR_ASSERTN (mpfr_overflow_p ()); MPFR_ASSERTN (i == 1); mpfr_clear_flags (); mpfr_set_str_binary (x, "1.1E1000000000"); i = test_expm1 (x, x, MPFR_RNDD); - MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_IS_POS (x)); MPFR_ASSERTN (mpfr_overflow_p ()); MPFR_ASSERTN (i == -1); @@ -162,7 +159,7 @@ special (); - test_generic (2, 100, 100); + test_generic (MPFR_PREC_MIN, 100, 100); data_check ("data/expm1", mpfr_expm1, "mpfr_expm1"); bad_cases (mpfr_expm1, mpfr_log1p, "mpfr_expm1", 256, -256, 255, diff -Nru mpfr4-3.1.4/tests/tfactorial.c mpfr4-4.0.2/tests/tfactorial.c --- mpfr4-3.1.4/tests/tfactorial.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tfactorial.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_factorial. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_fac_ui @@ -93,6 +90,8 @@ mpfr_set_prec (y, p); for (r = 0; r < MPFR_RND_MAX; r++) { + if ((mpfr_rnd_t) r == MPFR_RNDF) + continue; inex1 = mpfr_fac_ui (x, n, (mpfr_rnd_t) r); inex2 = mpfr_set_z (y, f, (mpfr_rnd_t) r); if (mpfr_cmp (x, y)) @@ -106,6 +105,7 @@ { printf ("Wrong inexact flag for n=%lu prec=%lu rnd=%s\n", n, (unsigned long) p, mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("Expected %d, got %d\n", inex2, inex1); exit (1); } } @@ -155,13 +155,14 @@ if (! mpfr_equal_p (x, y)) { printf ("Error in overflowed_fac0 (rnd = %s):\n" - " Got ", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of 0.11111111E0.\n"); + " Got ", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of 0.11111111E0.\n"); err = 1; } } - else + else if (rnd != MPFR_RNDF) { if (inex <= 0) { @@ -170,12 +171,13 @@ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0)) + if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overflowed_fac0 (rnd = %s):\n" - " Got ", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of +Inf.\n"); + " Got ", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of +Inf.\n"); err = 1; } } @@ -191,10 +193,12 @@ int main (int argc, char *argv[]) { - unsigned int prec, err, yprec, n, k, zeros; + unsigned int err, k, zeros; + unsigned long n; int rnd; mpfr_t x, y, z, t; int inexact; + unsigned long prec, yprec; tests_start_mpfr (); @@ -215,7 +219,7 @@ exit (1); } - for (prec = 2; prec <= 100; prec++) + for (prec = MPFR_PREC_MIN; prec <= 100; prec++) { mpfr_set_prec (x, prec); mpfr_set_prec (z, prec); @@ -226,6 +230,8 @@ for (n = 0; n < 50; n++) for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) { + if ((mpfr_rnd_t) rnd == MPFR_RNDF) + continue; inexact = mpfr_fac_ui (y, n, (mpfr_rnd_t) rnd); err = (rnd == MPFR_RNDN) ? yprec + 1 : yprec; if (mpfr_can_round (y, err, (mpfr_rnd_t) rnd, (mpfr_rnd_t) rnd, prec)) @@ -241,6 +247,9 @@ if (inexact) { printf ("Wrong inexact flag: expected exact\n"); + printf ("n=%lu prec=%lu rnd=%s\n", n, prec, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (z); exit (1); } } @@ -249,8 +258,9 @@ if (!inexact) { printf ("Wrong inexact flag: expected inexact\n"); - printf ("n=%u prec=%u\n", n, prec); - mpfr_print_binary(z); puts (""); + printf ("n=%lu prec=%lu rnd=%s\n", n, prec, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (z); exit (1); } } @@ -258,17 +268,14 @@ { printf ("results differ for x="); mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN); - printf (" prec=%u rnd_mode=%s\n", prec, + printf (" prec=%lu rnd_mode=%s\n", prec, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - printf (" got "); - mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); - puts (""); - printf (" expected "); - mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); - puts (""); + printf (" got "); + mpfr_dump (z); + printf (" expected "); + mpfr_dump (t); printf (" approximation was "); - mpfr_print_binary (y); - puts (""); + mpfr_dump (y); exit (1); } } diff -Nru mpfr4-3.1.4/tests/tfits.c mpfr4-4.0.2/tests/tfits.c --- mpfr4-3.1.4/tests/tfits.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tfits.c 2019-01-07 13:53:20.000000000 +0000 @@ -2,7 +2,7 @@ mpfr_fits_sint_p, mpfr_fits_slong_p, mpfr_fits_sshort_p, mpfr_fits_uint_p, mpfr_fits_ulong_p, mpfr_fits_ushort_p -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -19,17 +19,14 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* Needed due to the inclusion of mpfr-intmax.h */ #ifdef HAVE_CONFIG_H -# include "config.h" /* for a build within gmp */ +# include "config.h" #endif -#include -#include -#include - #include "mpfr-intmax.h" #include "mpfr-test.h" @@ -47,7 +44,7 @@ } \ if (__gmpfr_flags != ex_flags) \ { \ - unsigned int flags = __gmpfr_flags; \ + mpfr_flags_t flags = __gmpfr_flags; \ printf ("Flags error %d for %s, rnd = %s and x = ", \ N, #FCT, \ mpfr_print_rnd_mode ((mpfr_rnd_t) r)); \ @@ -123,7 +120,7 @@ { mpfr_exp_t emin, emax; mpfr_t x, y; - unsigned int flags[2] = { 0, MPFR_FLAGS_ALL }, ex_flags; + mpfr_flags_t flags[2] = { 0, MPFR_FLAGS_ALL }, ex_flags; int i, r, fi; tests_start_mpfr (); @@ -195,7 +192,8 @@ int inv; mpfr_set_si_2exp (x, -i, -2, MPFR_RNDN); - mpfr_rint (y, x, (mpfr_rnd_t) r); + /* for RNDF, it fits if it fits when rounding away from zero */ + mpfr_rint (y, x, r != MPFR_RNDF ? (mpfr_rnd_t) r : MPFR_RNDA); inv = MPFR_NOTZERO (y); FTEST (80, inv ^ !, mpfr_fits_ulong_p); FTEST (81, !, mpfr_fits_slong_p); @@ -261,7 +259,10 @@ mpfr_set_si_2exp (x, -i, -2, MPFR_RNDN); mpfr_rint (y, x, (mpfr_rnd_t) r); inv = MPFR_NOTZERO (y); - FTEST (80, inv ^ !, mpfr_fits_uintmax_p); + if (r != MPFR_RNDF) + FTEST (80, inv ^ !, mpfr_fits_uintmax_p); + else + FTEST (80, !!, mpfr_fits_uintmax_p); FTEST (81, !, mpfr_fits_intmax_p); } } diff -Nru mpfr4-3.1.4/tests/tfma.c mpfr4-4.0.2/tests/tfma.c --- mpfr4-3.1.4/tests/tfma.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tfma.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_fma. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" /* When a * b is exact, the FMA is equivalent to the separate operations. */ @@ -31,7 +28,7 @@ { const char *val[] = { "@NaN@", "-@Inf@", "-2", "-1", "-0", "0", "1", "2", "@Inf@" }; - int sv = sizeof (val) / sizeof (*val); + int sv = numberof (val); int i, j, k; int rnd; mpfr_t a, b, c, r1, r2; @@ -49,8 +46,10 @@ mpfr_mul (r1, a, b, (mpfr_rnd_t) rnd) || mpfr_add (r1, r1, c, (mpfr_rnd_t) rnd)) { - printf ("test_exact internal error for (%d,%d,%d,%d)\n", - i, j, k, rnd); + if (rnd == MPFR_RNDF) + break; + printf ("test_exact internal error for (%d,%d,%d,%d,%s)\n", + i, j, k, rnd, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); exit (1); } if (mpfr_fma (r2, a, b, c, (mpfr_rnd_t) rnd)) @@ -127,7 +126,7 @@ /* The intermediate multiplication x * y will overflow. */ for (i = -9; i <= 9; i++) - RND_LOOP (rnd) + RND_LOOP_NO_RNDF (rnd) { int inf, overflow; @@ -159,7 +158,7 @@ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - else if (MPFR_SIGN (r) >= 0) + else if (MPFR_IS_POS (r)) { printf ("Error in test_overflow2 (i = %d, %s): wrong sign " "(+ instead of -)\n", i, @@ -197,6 +196,238 @@ } static void +test_overflow3 (void) +{ + mpfr_t x, y, z, r; + int inex; + mpfr_prec_t p = 8; + mpfr_flags_t ex_flags = MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT, flags; + int i, j, k; + unsigned int neg; + + mpfr_inits2 (p, x, y, z, (mpfr_ptr) 0); + for (i = 0; i < 2; i++) + { + mpfr_init2 (r, 2 * p + i); + mpfr_set_ui_2exp (x, 1, mpfr_get_emax () - 1, MPFR_RNDN); + mpfr_set_ui (y, 2, MPFR_RNDN); /* y = 2 */ + for (j = 1; j <= 2; j++) + for (k = 0; k <= 1; k++) + { + mpfr_set_si_2exp (z, -1, mpfr_get_emax () - mpfr_get_prec (r) - j, + MPFR_RNDN); + if (k) + mpfr_nextabove (z); + for (neg = 0; neg <= 3; neg++) + { + mpfr_clear_flags (); + /* (The following applies for neg = 0 or 2, all the signs + need to be reversed for neg = 1 or 3.) + We have x*y = 2^emax and + z = - 2^(emax-2p-i-j) * (1-k*2^(-p)), thus + x*y+z = 2^emax - 2^(emax-2p-i-j) + k*2^(emax-3p-i-j) + should overflow. Indeed it is >= the midpoint of + 2^emax - 2^(emax-2p-i) and 2^emax, the midpoint + being obtained for j = 1 and k = 0. */ + inex = mpfr_fma (r, x, y, z, MPFR_RNDN); + flags = __gmpfr_flags; + if (! mpfr_inf_p (r) || flags != ex_flags || + ((neg & 1) == 0 ? + (inex <= 0 || MPFR_IS_NEG (r)) : + (inex >= 0 || MPFR_IS_POS (r)))) + { + printf ("Error in test_overflow3 for " + "i=%d j=%d k=%d neg=%u\n", i, j, k, neg); + printf ("Expected %c@Inf@\n with inex %c 0 and flags:", + (neg & 1) == 0 ? '+' : '-', + (neg & 1) == 0 ? '>' : '<'); + flags_out (ex_flags); + printf ("Got "); + mpfr_dump (r); + printf (" with inex = %d and flags:", inex); + flags_out (flags); + exit (1); + } + if (neg == 0 || neg == 2) + mpfr_neg (x, x, MPFR_RNDN); + if (neg == 1 || neg == 3) + mpfr_neg (y, y, MPFR_RNDN); + mpfr_neg (z, z, MPFR_RNDN); + } /* neg */ + } /* k */ + mpfr_clear (r); + } /* i */ + mpfr_clears (x, y, z, (mpfr_ptr) 0); +} + +static void +test_overflow4 (void) +{ + mpfr_t x, y, z, r1, r2; + mpfr_exp_t emax, e; + mpfr_prec_t px; + mpfr_flags_t flags1, flags2; + int inex1, inex2; + int ei, i, j; + int below; + unsigned int neg; + + emax = mpfr_get_emax (); + + mpfr_init2 (y, MPFR_PREC_MIN); + mpfr_set_ui (y, 2, MPFR_RNDN); /* y = 2 */ + + mpfr_init2 (z, 8); + + for (px = 17; px < 256; px *= 2) + { + mpfr_init2 (x, px); + mpfr_inits2 (px - 8, r1, r2, (mpfr_ptr) 0); + for (ei = 0; ei <= 1; ei++) + { + e = ei ? emax : 0; + mpfr_set_ui_2exp (x, 1, e - 1, MPFR_RNDN); + mpfr_nextabove (x); /* x = 2^(e - 1) + 2^(e - px) */ + /* x*y = 2^e + 2^(e - px + 1), which internally overflows + when e = emax. */ + for (i = -4; i <= 4; i++) + for (j = 2; j <= 3; j++) + { + mpfr_set_si_2exp (z, -j, e - px + i, MPFR_RNDN); + /* If |z| <= 2^(e - px + 1), then x*y + z >= 2^e and + RZ(x*y + z) = 2^e with an unbounded exponent range. + If |z| > 2^(e - px + 1), then RZ(x*y + z) is the + predecessor of 2^e (since |z| < ulp(r)/2); this + occurs when i > 0 and when i = 0 and j > 2 */ + mpfr_set_ui_2exp (r1, 1, e - 1, MPFR_RNDN); + below = i > 0 || (i == 0 && j > 2); + if (below) + mpfr_nextbelow (r1); + mpfr_clear_flags (); + inex1 = mpfr_mul_2ui (r1, r1, 1, MPFR_RNDZ); + if (below || e < emax) + { + inex1 = i == 0 && j == 2 ? 0 : -1; + flags1 = inex1 ? MPFR_FLAGS_INEXACT : 0; + } + else + { + MPFR_ASSERTN (inex1 < 0); + flags1 = MPFR_FLAGS_INEXACT | MPFR_FLAGS_OVERFLOW; + MPFR_ASSERTN (flags1 == __gmpfr_flags); + } + for (neg = 0; neg <= 3; neg++) + { + mpfr_clear_flags (); + inex2 = mpfr_fma (r2, x, y, z, MPFR_RNDZ); + flags2 = __gmpfr_flags; + if (! (mpfr_equal_p (r1, r2) && + SAME_SIGN (inex1, inex2) && + flags1 == flags2)) + { + printf ("Error in test_overflow4 for " + "px=%d ei=%d i=%d j=%d neg=%u\n", + (int) px, ei, i, j, neg); + printf ("Expected "); + mpfr_dump (r1); + printf ("with inex = %d and flags:", inex1); + flags_out (flags1); + printf ("Got "); + mpfr_dump (r2); + printf ("with inex = %d and flags:", inex2); + flags_out (flags2); + exit (1); + } + if (neg == 0 || neg == 2) + mpfr_neg (x, x, MPFR_RNDN); + if (neg == 1 || neg == 3) + mpfr_neg (y, y, MPFR_RNDN); + mpfr_neg (z, z, MPFR_RNDN); + mpfr_neg (r1, r1, MPFR_RNDN); + inex1 = - inex1; + } + } + } + mpfr_clears (x, r1, r2, (mpfr_ptr) 0); + } + + mpfr_clears (y, z, (mpfr_ptr) 0); +} + +static void +test_overflow5 (void) +{ + mpfr_t x, y, z, r1, r2; + mpfr_exp_t emax; + int inex1, inex2; + int i, rnd; + unsigned int neg, negr; + + emax = mpfr_get_emax (); + + mpfr_init2 (x, 123); + mpfr_init2 (y, 45); + mpfr_init2 (z, 67); + mpfr_inits2 (89, r1, r2, (mpfr_ptr) 0); + + mpfr_set_ui_2exp (x, 1, emax - 1, MPFR_RNDN); + + for (i = 3; i <= 17; i++) + { + mpfr_set_ui (y, i, MPFR_RNDN); + mpfr_set_ui_2exp (z, 1, emax - 1, MPFR_RNDN); + for (neg = 0; neg < 8; neg++) + { + mpfr_setsign (x, x, neg & 1, MPFR_RNDN); + mpfr_setsign (y, y, neg & 2, MPFR_RNDN); + mpfr_setsign (z, z, neg & 4, MPFR_RNDN); + + /* |x*y + z| = (i +/- 1) * 2^(emax - 1) >= 2^emax (overflow) + and x*y + z has the same sign as x*y. */ + negr = (neg ^ (neg >> 1)) & 1; + + RND_LOOP (rnd) + { + mpfr_set_inf (r1, 1); + if (MPFR_IS_LIKE_RNDZ ((mpfr_rnd_t) rnd, negr)) + { + mpfr_nextbelow (r1); + inex1 = -1; + } + else + inex1 = 1; + + if (negr) + { + mpfr_neg (r1, r1, MPFR_RNDN); + inex1 = - inex1; + } + + mpfr_clear_flags (); + inex2 = mpfr_fma (r2, x, y, z, (mpfr_rnd_t) rnd); + MPFR_ASSERTN (__gmpfr_flags == + (MPFR_FLAGS_INEXACT | MPFR_FLAGS_OVERFLOW)); + + if (! (mpfr_equal_p (r1, r2) && SAME_SIGN (inex1, inex2))) + { + printf ("Error in test_overflow5 for i=%d neg=%u %s\n", + i, neg, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + printf ("Expected "); + mpfr_dump (r1); + printf ("with inex = %d\n", inex1); + printf ("Got "); + mpfr_dump (r2); + printf ("with inex = %d\n", inex2); + exit (1); + } + } /* rnd */ + } /* neg */ + } /* i */ + + mpfr_clears (x, y, z, r1, r2, (mpfr_ptr) 0); +} + +static void test_underflow1 (void) { mpfr_t x, y, z, r; @@ -220,10 +451,10 @@ /* |z| = 1 or 2^emax - ulp */ mpfr_clear_flags (); inex = mpfr_fma (r, x, y, z, (mpfr_rnd_t) rnd); -#define ERRTU1 "Error in test_underflow1 (signy = %d, signz = %d, %s)\n " +#define STRTU1 "Error in test_underflow1 (signy = %d, signz = %d, %s)\n " if (mpfr_nanflag_p ()) { - printf (ERRTU1 "NaN flag is set\n", signy, signz, + printf (STRTU1 "NaN flag is set\n", signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } @@ -233,31 +464,30 @@ mpfr_nextabove (z); if ((mpfr_overflow_p () != 0) ^ (mpfr_inf_p (z) != 0)) { - printf (ERRTU1 "wrong overflow flag\n", signy, signz, + printf (STRTU1 "wrong overflow flag\n", signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } if (mpfr_underflow_p ()) { - printf (ERRTU1 "underflow flag is set\n", signy, signz, + printf (STRTU1 "underflow flag is set\n", signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } if (! mpfr_equal_p (r, z)) { - printf (ERRTU1 "got ", signy, signz, + printf (STRTU1 "got ", signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (r); - printf (" instead of "); - mpfr_print_binary (z); - printf ("\n"); + mpfr_dump (r); + printf (" instead of "); + mpfr_dump (z); err = 1; } if (inex >= 0 && (rnd == MPFR_RNDD || (rnd == MPFR_RNDZ && signz > 0) || (rnd == MPFR_RNDN && signy > 0))) { - printf (ERRTU1 "ternary value = %d instead of < 0\n", + printf (STRTU1 "ternary value = %d instead of < 0\n", signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), inex); err = 1; @@ -266,7 +496,7 @@ (rnd == MPFR_RNDZ && signz < 0) || (rnd == MPFR_RNDN && signy < 0))) { - printf (ERRTU1 "ternary value = %d instead of > 0\n", + printf (STRTU1 "ternary value = %d instead of > 0\n", signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), inex); err = 1; @@ -283,58 +513,128 @@ static void test_underflow2 (void) { - mpfr_t x, y, z, r; - int b, i, inex, same, err = 0; + mpfr_t x, y, z, r1, r2; + int e, b, i, prec = 32, pz, inex; + unsigned int neg; - mpfr_inits2 (32, x, y, z, r, (mpfr_ptr) 0); + mpfr_init2 (x, MPFR_PREC_MIN); + mpfr_inits2 (prec, y, z, r1, r2, (mpfr_ptr) 0); - mpfr_set_si_2exp (z, 1, mpfr_get_emin (), MPFR_RNDN); /* z = 2^emin */ - mpfr_set_si_2exp (x, 1, mpfr_get_emin (), MPFR_RNDN); /* x = 2^emin */ + mpfr_set_si_2exp (x, 1, mpfr_get_emin () - 1, MPFR_RNDN); + /* x = 2^(emin-1) */ - for (b = 0; b <= 1; b++) + for (e = -1; e <= prec + 2; e++) { - for (i = 15; i <= 17; i++) + mpfr_set (z, x, MPFR_RNDN); + /* z = x = 2^(emin+e) */ + for (b = 0; b <= 1; b++) { - mpfr_set_si_2exp (y, i, -4 - MPFR_PREC (z), MPFR_RNDN); - /* z = 1.000...00b - * xy = 01111 - * or 10000 - * or 10001 - */ - mpfr_clear_flags (); - inex = mpfr_fma (r, x, y, z, MPFR_RNDN); -#define ERRTU2 "Error in test_underflow2 (b = %d, i = %d)\n " - if (__gmpfr_flags != MPFR_FLAGS_INEXACT) - { - printf (ERRTU2 "flags = %u instead of %u\n", b, i, - __gmpfr_flags, (unsigned int) MPFR_FLAGS_INEXACT); - err = 1; - } - same = i == 15 || (i == 16 && b == 0); - if (same ? (inex >= 0) : (inex <= 0)) - { - printf (ERRTU2 "incorrect ternary value (%d instead of %c 0)\n", - b, i, inex, same ? '<' : '>'); - err = 1; - } - mpfr_set (y, z, MPFR_RNDN); - if (!same) - mpfr_nextabove (y); - if (! mpfr_equal_p (r, y)) + for (pz = prec - 4 * (b == 0); pz <= prec + 4; pz++) { - printf (ERRTU2 "expected ", b, i); - mpfr_dump (y); - printf (" got "); - mpfr_dump (r); - err = 1; - } - } - mpfr_nextabove (z); - } + inex = mpfr_prec_round (z, pz, MPFR_RNDZ); + MPFR_ASSERTN (inex == 0); + for (i = 15; i <= 17; i++) + { + mpfr_flags_t flags1, flags2; + int inex1, inex2; - if (err) - exit (1); - mpfr_clears (x, y, z, r, (mpfr_ptr) 0); + mpfr_set_si_2exp (y, i, -4 - prec, MPFR_RNDN); + + /* <--- r ---> + * z = 1.000...00b with b = 0 or 1 + * xy = 01111 (i = 15) + * or 10000 (i = 16) + * or 10001 (i = 17) + * + * x, y, and z will be modified to test the different sign + * combinations. In the case b = 0 (i.e. |z| is a power of + * 2) and x*y has a different sign from z, then y will be + * divided by 2, so that i = 16 corresponds to a midpoint. + */ + + for (neg = 0; neg < 8; neg++) + { + int xyneg, prev_binade; + + mpfr_setsign (x, x, neg & 1, MPFR_RNDN); + mpfr_setsign (y, y, neg & 2, MPFR_RNDN); + mpfr_setsign (z, z, neg & 4, MPFR_RNDN); + + xyneg = (neg ^ (neg >> 1)) & 1; /* true iff x*y < 0 */ + + /* If a change of binade occurs by adding x*y to z + exactly, then take into account the fact that the + midpoint has a different exponent. */ + prev_binade = b == 0 && (xyneg ^ MPFR_IS_NEG (z)); + if (prev_binade) + mpfr_div_2ui (y, y, 1, MPFR_RNDN); + + mpfr_set (r1, z, MPFR_RNDN); + flags1 = MPFR_FLAGS_INEXACT; + + if (e == -1 && i == 17 && b == 0 && + (xyneg ^ (neg >> 2)) != 0) + { + /* Special underflow case. */ + flags1 |= MPFR_FLAGS_UNDERFLOW; + inex1 = xyneg ? 1 : -1; + } + else if (i == 15 || (i == 16 && b == 0)) + { + /* round toward z */ + inex1 = xyneg ? 1 : -1; + } + else if (xyneg) + { + /* round away from z, with x*y < 0 */ + mpfr_nextbelow (r1); + inex1 = -1; + } + else + { + /* round away from z, with x*y > 0 */ + mpfr_nextabove (r1); + inex1 = 1; + } + + mpfr_clear_flags (); + inex2 = mpfr_fma (r2, x, y, z, MPFR_RNDN); + flags2 = __gmpfr_flags; + + if (! (mpfr_equal_p (r1, r2) && + SAME_SIGN (inex1, inex2) && + flags1 == flags2)) + { + printf ("Error in test_underflow2 for " + "e=%d b=%d pz=%d i=%d neg=%u\n", + e, b, pz, i, neg); + printf ("Expected "); + mpfr_dump (r1); + printf ("with inex = %d and flags:", inex1); + flags_out (flags1); + printf ("Got "); + mpfr_dump (r2); + printf ("with inex = %d and flags:", inex2); + flags_out (flags2); + exit (1); + } + + /* Restore y. */ + if (prev_binade) + mpfr_mul_2ui (y, y, 1, MPFR_RNDN); + } /* neg */ + } /* i */ + } /* pz */ + + inex = mpfr_prec_round (z, prec, MPFR_RNDZ); + MPFR_ASSERTN (inex == 0); + MPFR_SET_POS (z); + mpfr_nextabove (z); + } /* b */ + mpfr_mul_2ui (x, x, 1, MPFR_RNDN); + } /* e */ + + mpfr_clears (x, y, z, r1, r2, (mpfr_ptr) 0); } static void @@ -343,7 +643,7 @@ mpfr_t x, y, z, t1, t2; int sign, k, s, rnd, inex1, inex2; mpfr_exp_t e; - unsigned int flags1, flags2; + mpfr_flags_t flags1, flags2; mpfr_inits2 (4, x, z, t1, t2, (mpfr_ptr) 0); mpfr_init2 (y, 6); @@ -398,6 +698,185 @@ mpfr_clears (x, y, z, t1, t2, (mpfr_ptr) 0); } +/* Test s = x*y + z with PREC(z) > PREC(s) + 1, x*y underflows, where + z + x*y and z + sign(x*y) * 2^(emin-1) do not give the same result. + x = 2^emin + y = 2^(-8) + z = 2^emin * (2^PREC(s) + k - 2^(-1)) + with k = 3 for MPFR_RNDN and k = 2 for the directed rounding modes. + Also test the opposite versions with neg != 0. +*/ +static void +test_underflow4 (void) +{ + mpfr_t x, y, z, s1, s2; + mpfr_prec_t ps = 32; + int inex, rnd; + + mpfr_inits2 (MPFR_PREC_MIN, x, y, (mpfr_ptr) 0); + mpfr_inits2 (ps, s1, s2, (mpfr_ptr) 0); + mpfr_init2 (z, ps + 2); + + inex = mpfr_set_si_2exp (x, 1, mpfr_get_emin (), MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + inex = mpfr_set_si_2exp (y, 1, -8, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + + RND_LOOP_NO_RNDF (rnd) + { + mpfr_flags_t flags1, flags2; + int inex1, inex2; + unsigned int neg; + + inex = mpfr_set_si_2exp (z, 1 << 1, ps, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + inex = mpfr_sub_ui (z, z, 1, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + inex = mpfr_div_2ui (z, z, 1, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + inex = mpfr_add_ui (z, z, rnd == MPFR_RNDN ? 3 : 2, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + inex = mpfr_mul (z, z, x, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + + for (neg = 0; neg <= 3; neg++) + { + inex1 = mpfr_set (s1, z, (mpfr_rnd_t) rnd); + flags1 = MPFR_FLAGS_INEXACT; + + mpfr_clear_flags (); + inex2 = mpfr_fma (s2, x, y, z, (mpfr_rnd_t) rnd); + flags2 = __gmpfr_flags; + + if (! (mpfr_equal_p (s1, s2) && + SAME_SIGN (inex1, inex2) && + flags1 == flags2)) + { + printf ("Error in test_underflow4 for neg=%u %s\n", + neg, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + printf ("Expected "); + mpfr_dump (s1); + printf (" with inex ~ %d, flags =", inex1); + flags_out (flags1); + printf ("Got "); + mpfr_dump (s2); + printf (" with inex ~ %d, flags =", inex2); + flags_out (flags2); + exit (1); + } + + if (neg == 0 || neg == 2) + mpfr_neg (x, x, MPFR_RNDN); + if (neg == 1 || neg == 3) + mpfr_neg (y, y, MPFR_RNDN); + mpfr_neg (z, z, MPFR_RNDN); + } + } + + mpfr_clears (x, y, z, s1, s2, (mpfr_ptr) 0); +} + +/* Test s = x*y + z on: + x = +/- 2^emin + y = +/- 2^(-3) + z = +/- 2^(emin + PREC(s)) and MPFR numbers close to this value. + with PREC(z) from PREC(s) - 2 to PREC(s) + 8. +*/ +static void +test_underflow5 (void) +{ + mpfr_t w, x, y, z, s1, s2, t; + mpfr_exp_t emin; + mpfr_prec_t ps = 32; + int inex, i, j, rnd; + unsigned int neg; + + mpfr_inits2 (MPFR_PREC_MIN, w, x, y, (mpfr_ptr) 0); + mpfr_inits2 (ps, s1, s2, (mpfr_ptr) 0); + mpfr_init2 (t, ps + 9); + + emin = mpfr_get_emin (); + + inex = mpfr_set_si_2exp (w, 1, emin, MPFR_RNDN); /* w = 2^emin */ + MPFR_ASSERTN (inex == 0); + inex = mpfr_set_si (x, 1, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + inex = mpfr_set_si_2exp (y, 1, -3, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + + for (i = -2; i <= 8; i++) + { + mpfr_init2 (z, ps + i); + inex = mpfr_set_si_2exp (z, 1, ps, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + + for (j = 1; j <= 32; j++) + mpfr_nextbelow (z); + + for (j = -32; j <= 32; j++) + { + for (neg = 0; neg < 8; neg++) + { + mpfr_setsign (x, x, neg & 1, MPFR_RNDN); + mpfr_setsign (y, y, neg & 2, MPFR_RNDN); + mpfr_setsign (z, z, neg & 4, MPFR_RNDN); + + inex = mpfr_fma (t, x, y, z, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + + inex = mpfr_mul (x, x, w, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + inex = mpfr_mul (z, z, w, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + + RND_LOOP_NO_RNDF (rnd) + { + mpfr_flags_t flags1, flags2; + int inex1, inex2; + + mpfr_clear_flags (); + inex1 = mpfr_mul (s1, w, t, (mpfr_rnd_t) rnd); + flags1 = __gmpfr_flags; + + mpfr_clear_flags (); + inex2 = mpfr_fma (s2, x, y, z, (mpfr_rnd_t) rnd); + flags2 = __gmpfr_flags; + + if (! (mpfr_equal_p (s1, s2) && + SAME_SIGN (inex1, inex2) && + flags1 == flags2)) + { + printf ("Error in test_underflow5 on " + "i=%d j=%d neg=%u %s\n", i, j, neg, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + printf ("Expected "); + mpfr_dump (s1); + printf (" with inex ~ %d, flags =", inex1); + flags_out (flags1); + printf ("Got "); + mpfr_dump (s2); + printf (" with inex ~ %d, flags =", inex2); + flags_out (flags2); + exit (1); + } + } /* rnd */ + + inex = mpfr_div (x, x, w, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + inex = mpfr_div (z, z, w, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + } /* neg */ + + MPFR_SET_POS (z); /* restore the value before the loop on neg */ + mpfr_nextabove (z); + } /* j */ + + mpfr_clear (z); + } /* i */ + + mpfr_clears (w, x, y, s1, s2, t, (mpfr_ptr) 0); +} + static void bug20101018 (void) { @@ -486,17 +965,109 @@ mpfr_clear (u); } +/* bug found with GMP_CHECK_RANDOMIZE=1514407719 */ +static void +bug20171219 (void) +{ + mpfr_t x, y, z, t, u; + int i; + + mpfr_init2 (x, 60); + mpfr_init2 (y, 60); + mpfr_init2 (z, 60); + mpfr_init2 (t, 68); + mpfr_init2 (u, 68); + + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_set_ui (z, 1, MPFR_RNDN); + mpfr_set_ui (t, 2, MPFR_RNDN); + i = mpfr_fma (u, x, y, z, MPFR_RNDA); + if (! mpfr_equal_p (u, t)) + { + printf ("Wrong result in bug20171219 (a)\n"); + printf ("Expected "); + mpfr_out_str (stdout, 16, 0, t, MPFR_RNDN); + printf ("\nGot "); + mpfr_out_str (stdout, 16, 0, u, MPFR_RNDN); + printf ("\n"); + exit (1); + } + if (i != 0) + { + printf ("Wrong ternary value in bug20171219\n"); + printf ("Expected 0\n"); + printf ("Got %d\n", i); + exit (1); + } + + mpfr_clear (x); + mpfr_clear (y); + mpfr_clear (z); + mpfr_clear (t); + mpfr_clear (u); +} + +/* coverage test for mpfr_set_1_2, case prec < GMP_NUMB_BITS, + inex > 0, rb <> 0, sb = 0 */ +static void +coverage (void) +{ + mpfr_t x, y, z, s; + int inex; + mpfr_exp_t emax; + + mpfr_inits2 (GMP_NUMB_BITS - 1, x, y, z, s, (mpfr_ptr) 0); + + /* set x to 2^(GMP_NUMB_BITS/2) + 1, y to 2^(GMP_NUMB_BITS/2) - 1 */ + MPFR_ASSERTN((GMP_NUMB_BITS % 2) == 0); + mpfr_set_ui_2exp (x, 1, GMP_NUMB_BITS / 2, MPFR_RNDN); + mpfr_sub_ui (y, x, 1, MPFR_RNDN); + mpfr_add_ui (x, x, 1, MPFR_RNDN); + /* we have x*y = 2^GMP_NUMB_BITS - 1, thus has exponent GMP_NUMB_BITS */ + /* set z to 2^(1-GMP_NUMB_BITS), with exponent 2-GMP_NUMB_BITS */ + mpfr_set_ui_2exp (z, 1, 1 - GMP_NUMB_BITS, MPFR_RNDN); + inex = mpfr_fms (s, x, y, z, MPFR_RNDN); + /* s should be 2^GMP_NUMB_BITS-2 */ + MPFR_ASSERTN(inex < 0); + inex = mpfr_add_ui (s, s, 2, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (s, 1, GMP_NUMB_BITS) == 0); + + /* same example, but with overflow */ + emax = mpfr_get_emax (); + mpfr_set_emax (GMP_NUMB_BITS + 1); + mpfr_set_ui_2exp (z, 1, mpfr_get_emax () - 1, MPFR_RNDZ); + mpfr_clear_flags (); + inex = mpfr_fma (s, x, y, z, MPFR_RNDN); + /* x*y = 2^GMP_NUMB_BITS - 1, z = 2^GMP_NUMB_BITS, thus + x*y+z = 2^(GMP_NUMB_BITS+1) - 1 should round to 2^(GMP_NUMB_BITS+1), + thus give an overflow */ + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_inf_p (s) && mpfr_sgn (s) > 0); + MPFR_ASSERTN(mpfr_overflow_p ()); + mpfr_set_emax (emax); + + mpfr_clear (x); + mpfr_clear (y); + mpfr_clear (z); + mpfr_clear (s); +} + int main (int argc, char *argv[]) { mpfr_t x, y, z, s; mpfr_exp_t emin, emax; + int i; tests_start_mpfr (); + coverage (); + emin = mpfr_get_emin (); emax = mpfr_get_emax (); + bug20171219 (); bug20101018 (); mpfr_init (x); @@ -513,10 +1084,12 @@ mpfr_set_str (y, "0.5", 10, MPFR_RNDN); mpfr_set_str (z, "0.375", 10, MPFR_RNDN); mpfr_fma (s, x, y, z, MPFR_RNDU); /* result is 0 */ - if (mpfr_cmp_ui(s, 0)) + if (mpfr_cmp_ui (s, 0)) { - printf("Error: -0.75 * 0.5 + 0.375 should be equal to 0 for prec=2\n"); - exit(1); + printf ("Error: -0.75 * 0.5 + 0.375 should be equal to 0 for prec=2\n"); + printf ("got instead "); + mpfr_dump (s); + exit (1); } mpfr_set_prec (x, 27); @@ -538,7 +1111,7 @@ mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { - printf ("evaluation of function in x=NAN does not return NAN"); + printf ("evaluation of function in x=NAN does not return NAN\n"); exit (1); } @@ -548,7 +1121,7 @@ mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p(s)) { - printf ("evaluation of function in y=NAN does not return NAN"); + printf ("evaluation of function in y=NAN does not return NAN\n"); exit (1); } @@ -558,7 +1131,7 @@ mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { - printf ("evaluation of function in z=NAN does not return NAN"); + printf ("evaluation of function in z=NAN does not return NAN\n"); exit (1); } @@ -608,7 +1181,7 @@ mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { - printf ("evaluation of function in x=INF y=0 does not return NAN"); + printf ("evaluation of function in x=INF y=0 does not return NAN\n"); exit (1); } @@ -618,7 +1191,7 @@ mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { - printf ("evaluation of function in x=0 y=INF does not return NAN"); + printf ("evaluation of function in x=0 y=INF does not return NAN\n"); exit (1); } @@ -628,7 +1201,7 @@ mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { - printf ("evaluation of function in x=INF y>0 z=-INF does not return NAN"); + printf ("evaluation of function in x=INF y>0 z=-INF does not return NAN\n"); exit (1); } @@ -638,27 +1211,27 @@ mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { - printf ("evaluation of function in x>0 y=INF z=-INF does not return NAN"); + printf ("evaluation of function in x>0 y=INF z=-INF does not return NAN\n"); exit (1); } mpfr_set_inf (x, 1); - mpfr_urandomb (y, RANDS); + do mpfr_urandomb (y, RANDS); while (MPFR_IS_ZERO(y)); mpfr_urandomb (z, RANDS); mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0) { - printf ("evaluation of function in x=INF does not return INF"); + printf ("evaluation of function in x=INF does not return INF\n"); exit (1); } mpfr_set_inf (y, 1); - mpfr_urandomb (x, RANDS); + do mpfr_urandomb (x, RANDS); while (MPFR_IS_ZERO(x)); mpfr_urandomb (z, RANDS); mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0) { - printf ("evaluation of function in y=INF does not return INF"); + printf ("evaluation of function at y=INF does not return INF\n"); exit (1); } @@ -668,7 +1241,7 @@ mpfr_fma (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0) { - printf ("evaluation of function in z=INF does not return INF"); + printf ("evaluation of function in z=INF does not return INF\n"); exit (1); } @@ -727,7 +1300,7 @@ if (randlimb () % 2) mpfr_neg (z, z, MPFR_RNDN); - rnd = RND_RAND (); + rnd = RND_RAND_NO_RNDF (); mpfr_set_prec (slong, 2 * prec); if (mpfr_mul (slong, x, y, rnd)) { @@ -738,34 +1311,31 @@ inexact = mpfr_fma (s, x, y, z, rnd); if (! mpfr_equal_p (s, t)) { - printf ("results differ for x="); - mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN); + printf ("results differ for\n"); + printf (" x="); + mpfr_dump (x); printf (" y="); - mpfr_out_str (stdout, 2, prec, y, MPFR_RNDN); + mpfr_dump (y); printf (" z="); - mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); - printf (" prec=%u rnd_mode=%s\n", (unsigned int) prec, + mpfr_dump (z); + printf (" with prec=%u rnd_mode=%s\n", (unsigned int) prec, mpfr_print_rnd_mode (rnd)); printf ("got "); - mpfr_out_str (stdout, 2, prec, s, MPFR_RNDN); - puts (""); + mpfr_dump (s); printf ("expected "); - mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); - puts (""); - printf ("approx "); - mpfr_print_binary (slong); - puts (""); + mpfr_dump (t); + printf ("approx "); + mpfr_dump (slong); exit (1); } if (! SAME_SIGN (inexact, compare)) { printf ("Wrong inexact flag for rnd=%s: expected %d, got %d\n", mpfr_print_rnd_mode (rnd), compare, inexact); - printf (" x="); mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); - printf (" y="); mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); - printf (" z="); mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN); - printf (" s="); mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN); - printf ("\n"); + printf (" x="); mpfr_dump (x); + printf (" y="); mpfr_dump (y); + printf (" z="); mpfr_dump (z); + printf (" s="); mpfr_dump (s); exit (1); } } @@ -781,21 +1351,39 @@ test_exact (); - test_overflow1 (); - test_overflow2 (); - test_underflow1 (); - test_underflow2 (); - test_underflow3 (1); - - set_emin (MPFR_EMIN_MIN); - set_emax (MPFR_EMAX_MAX); - test_overflow1 (); - test_overflow2 (); - test_underflow1 (); - test_underflow2 (); - test_underflow3 (2); - set_emin (emin); - set_emax (emax); + for (i = 0; i <= 2; i++) + { + if (i == 0) + { + /* corresponds to the generic code + mpfr_check_range */ + set_emin (-1024); + set_emax (1024); + } + else if (i == 1) + { + set_emin (MPFR_EMIN_MIN); + set_emax (MPFR_EMAX_MAX); + } + else + { + MPFR_ASSERTN (i == 2); + if (emin == MPFR_EMIN_MIN && emax == MPFR_EMAX_MAX) + break; + set_emin (emin); + set_emax (emax); + } + + test_overflow1 (); + test_overflow2 (); + test_overflow3 (); + test_overflow4 (); + test_overflow5 (); + test_underflow1 (); + test_underflow2 (); + test_underflow3 (i); + test_underflow4 (); + test_underflow5 (); + } tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tfmma.c mpfr4-4.0.2/tests/tfmma.c --- mpfr4-3.1.4/tests/tfmma.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/tfmma.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,561 @@ +/* Test file for mpfr_fmma and mpfr_fmms. + +Copyright 2016-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-test.h" + +/* check both mpfr_fmma and mpfr_fmms */ +static void +random_test (mpfr_t a, mpfr_t b, mpfr_t c, mpfr_t d, mpfr_rnd_t rnd) +{ + mpfr_t ref, res, ab, cd; + int inex_ref, inex_res; + mpfr_prec_t p = MPFR_PREC(a); + + mpfr_init2 (res, p); + mpfr_init2 (ref, p); + mpfr_init2 (ab, mpfr_get_prec (a) + mpfr_get_prec (b)); + mpfr_init2 (cd, mpfr_get_prec (c) + mpfr_get_prec (d)); + + /* first check fmma */ + inex_res = mpfr_fmma (res, a, b, c, d, rnd); + mpfr_mul (ab, a, b, rnd); + mpfr_mul (cd, c, d, rnd); + inex_ref = mpfr_add (ref, ab, cd, rnd); + if (! SAME_SIGN (inex_res, inex_ref) || + mpfr_nan_p (res) || mpfr_nan_p (ref) || + ! mpfr_equal_p (res, ref)) + { + printf ("mpfr_fmma failed for p=%ld rnd=%s\n", + (long int) p, mpfr_print_rnd_mode (rnd)); + printf ("a="); mpfr_dump (a); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("d="); mpfr_dump (d); + printf ("Expected\n "); + mpfr_dump (ref); + printf (" with inex = %d\n", inex_ref); + printf ("Got\n "); + mpfr_dump (res); + printf (" with inex = %d\n", inex_res); + exit (1); + } + + /* then check fmms */ + inex_res = mpfr_fmms (res, a, b, c, d, rnd); + mpfr_mul (ab, a, b, rnd); + mpfr_mul (cd, c, d, rnd); + inex_ref = mpfr_sub (ref, ab, cd, rnd); + if (! SAME_SIGN (inex_res, inex_ref) || + mpfr_nan_p (res) || mpfr_nan_p (ref) || + ! mpfr_equal_p (res, ref)) + { + printf ("mpfr_fmms failed for p=%ld rnd=%s\n", + (long int) p, mpfr_print_rnd_mode (rnd)); + printf ("a="); mpfr_dump (a); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("d="); mpfr_dump (d); + printf ("Expected\n "); + mpfr_dump (ref); + printf (" with inex = %d\n", inex_ref); + printf ("Got\n "); + mpfr_dump (res); + printf (" with inex = %d\n", inex_res); + exit (1); + } + + mpfr_clear (ab); + mpfr_clear (cd); + mpfr_clear (res); + mpfr_clear (ref); +} + +static void +random_tests (void) +{ + mpfr_prec_t p; + int r; + mpfr_t a, b, c, d; + + for (p = MPFR_PREC_MIN; p <= 4096; p++) + { + mpfr_inits2 (p, a, b, c, d, (mpfr_ptr) 0); + mpfr_urandomb (a, RANDS); + mpfr_urandomb (b, RANDS); + mpfr_urandomb (c, RANDS); + mpfr_urandomb (d, RANDS); + RND_LOOP_NO_RNDF (r) + random_test (a, b, c, d, (mpfr_rnd_t) r); + mpfr_clears (a, b, c, d, (mpfr_ptr) 0); + } +} + +static void +zero_tests (void) +{ + mpfr_exp_t emin, emax; + mpfr_t a, b, c, d, res; + int i, r; + + emin = mpfr_get_emin (); + emax = mpfr_get_emax (); + set_emin (MPFR_EMIN_MIN); + set_emax (MPFR_EMAX_MAX); + + mpfr_inits2 (GMP_NUMB_BITS, a, b, c, d, (mpfr_ptr) 0); + for (i = 0; i <= 4; i++) + { + switch (i) + { + case 0: case 1: + mpfr_set_ui (a, i, MPFR_RNDN); + break; + case 2: + mpfr_setmax (a, MPFR_EMAX_MAX); + break; + case 3: + mpfr_setmin (a, MPFR_EMIN_MIN); + break; + case 4: + mpfr_setmin (a, MPFR_EMIN_MIN+1); + break; + } + RND_LOOP (r) + { + int j, inex; + mpfr_flags_t flags; + + mpfr_set (b, a, MPFR_RNDN); + mpfr_set (c, a, MPFR_RNDN); + mpfr_neg (d, a, MPFR_RNDN); + /* We also want to test cases where the precision of the + result is twice the precision of each input, in case + add1sp.c and/or sub1sp.c could be involved. */ + for (j = 1; j <= 2; j++) + { + mpfr_init2 (res, GMP_NUMB_BITS * j); + mpfr_clear_flags (); + inex = mpfr_fmma (res, a, b, c, d, (mpfr_rnd_t) r); + flags = __gmpfr_flags; + if (flags != 0 || inex != 0 || ! mpfr_zero_p (res) || + (r == MPFR_RNDD ? MPFR_IS_POS (res) : MPFR_IS_NEG (res))) + { + printf ("Error in zero_tests on i = %d, %s\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("Expected %c0, inex = 0\n", + r == MPFR_RNDD ? '-' : '+'); + printf ("Got "); + if (MPFR_IS_POS (res)) + printf ("+"); + mpfr_out_str (stdout, 16, 0, res, MPFR_RNDN); + printf (", inex = %d\n", inex); + printf ("Expected flags:"); + flags_out (0); + printf ("Got flags: "); + flags_out (flags); + exit (1); + } + mpfr_clear (res); + } /* j */ + } /* r */ + } /* i */ + mpfr_clears (a, b, c, d, (mpfr_ptr) 0); + + set_emin (emin); + set_emax (emax); +} + +static void +max_tests (void) +{ + mpfr_exp_t emin, emax; + mpfr_t x, y1, y2; + int r; + int i, inex1, inex2; + mpfr_flags_t flags1, flags2; + + emin = mpfr_get_emin (); + emax = mpfr_get_emax (); + set_emin (MPFR_EMIN_MIN); + set_emax (MPFR_EMAX_MAX); + + mpfr_init2 (x, GMP_NUMB_BITS); + mpfr_setmax (x, MPFR_EMAX_MAX); + flags1 = MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT; + RND_LOOP (r) + { + /* We also want to test cases where the precision of the + result is twice the precision of each input, in case + add1sp.c and/or sub1sp.c could be involved. */ + for (i = 1; i <= 2; i++) + { + mpfr_inits2 (GMP_NUMB_BITS * i, y1, y2, (mpfr_ptr) 0); + inex1 = mpfr_mul (y1, x, x, (mpfr_rnd_t) r); + mpfr_clear_flags (); + inex2 = mpfr_fmma (y2, x, x, x, x, (mpfr_rnd_t) r); + flags2 = __gmpfr_flags; + if (! (flags1 == flags2 && SAME_SIGN (inex1, inex2) && + mpfr_equal_p (y1, y2))) + { + printf ("Error in max_tests for %s\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("Expected "); + mpfr_dump (y1); + printf (" with inex = %d, flags =", inex1); + flags_out (flags1); + printf ("Got "); + mpfr_dump (y2); + printf (" with inex = %d, flags =", inex2); + flags_out (flags2); + exit (1); + } + mpfr_clears (y1, y2, (mpfr_ptr) 0); + } /* i */ + } /* r */ + mpfr_clear (x); + + set_emin (emin); + set_emax (emax); +} + +/* a^2 - (a+k)(a-k) = k^2 where a^2 overflows but k^2 usually doesn't. + * a^2 + cd where a^2 overflows and cd doesn't affect the overflow + * (and cd may even underflow). + */ +static void +overflow_tests (void) +{ + mpfr_exp_t old_emax; + int i; + + old_emax = mpfr_get_emax (); + + for (i = 0; i < 40; i++) + { + mpfr_exp_t emax, exp_a; + mpfr_t a, k, c, d, z1, z2; + mpfr_rnd_t rnd; + mpfr_prec_t prec_a, prec_z; + int add = i & 1, inex, inex1, inex2; + mpfr_flags_t flags1, flags2; + + /* In most cases, we do the test with the maximum exponent. */ + emax = i % 8 != 0 ? MPFR_EMAX_MAX : 64 + (randlimb () % 1); + set_emax (emax); + exp_a = emax/2 + 32; + + rnd = RND_RAND_NO_RNDF (); + prec_a = 64 + randlimb () % 100; + prec_z = MPFR_PREC_MIN + randlimb () % 160; + + mpfr_init2 (a, prec_a); + mpfr_urandom (a, RANDS, MPFR_RNDU); + mpfr_set_exp (a, exp_a); + + mpfr_init2 (k, prec_a - 32); + mpfr_urandom (k, RANDS, MPFR_RNDU); + mpfr_set_exp (k, exp_a - 32); + + mpfr_init2 (c, prec_a + 1); + inex = mpfr_add (c, a, k, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + + mpfr_init2 (d, prec_a); + inex = mpfr_sub (d, a, k, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + if (add) + mpfr_neg (d, d, MPFR_RNDN); + + mpfr_init2 (z1, prec_z); + mpfr_clear_flags (); + inex1 = mpfr_sqr (z1, k, rnd); + flags1 = __gmpfr_flags; + + mpfr_init2 (z2, prec_z); + mpfr_clear_flags (); + inex2 = add ? + mpfr_fmma (z2, a, a, c, d, rnd) : + mpfr_fmms (z2, a, a, c, d, rnd); + flags2 = __gmpfr_flags; + + if (! (flags1 == flags2 && SAME_SIGN (inex1, inex2) && + mpfr_equal_p (z1, z2))) + { + printf ("Error 1 in overflow_tests for %s\n", + mpfr_print_rnd_mode (rnd)); + printf ("Expected "); + mpfr_dump (z1); + printf (" with inex = %d, flags =", inex1); + flags_out (flags1); + printf ("Got "); + mpfr_dump (z2); + printf (" with inex = %d, flags =", inex2); + flags_out (flags2); + exit (1); + } + + /* c and d such that a^2 +/- cd ~= a^2 (overflow) */ + mpfr_urandom (c, RANDS, MPFR_RNDU); + mpfr_set_exp (c, randlimb () % 1 ? exp_a - 2 : __gmpfr_emin); + if (randlimb () % 1) + mpfr_neg (c, c, MPFR_RNDN); + mpfr_urandom (d, RANDS, MPFR_RNDU); + mpfr_set_exp (d, randlimb () % 1 ? exp_a - 2 : __gmpfr_emin); + if (randlimb () % 1) + mpfr_neg (d, d, MPFR_RNDN); + + mpfr_clear_flags (); + inex1 = mpfr_sqr (z1, a, rnd); + flags1 = __gmpfr_flags; + MPFR_ASSERTN (flags1 == (MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT)); + + mpfr_clear_flags (); + inex2 = add ? + mpfr_fmma (z2, a, a, c, d, rnd) : + mpfr_fmms (z2, a, a, c, d, rnd); + flags2 = __gmpfr_flags; + + if (! (flags1 == flags2 && SAME_SIGN (inex1, inex2) && + mpfr_equal_p (z1, z2))) + { + printf ("Error 2 in overflow_tests for %s\n", + mpfr_print_rnd_mode (rnd)); + printf ("Expected "); + mpfr_dump (z1); + printf (" with inex = %d, flags =", inex1); + flags_out (flags1); + printf ("Got "); + mpfr_dump (z2); + printf (" with inex = %d, flags =", inex2); + flags_out (flags2); + printf ("a="); mpfr_dump (a); + printf ("c="); mpfr_dump (c); + printf ("d="); mpfr_dump (d); + exit (1); + } + + mpfr_clears (a, k, c, d, z1, z2, (mpfr_ptr) 0); + } + + set_emax (old_emax); +} + +/* (1/2)x + (1/2)x = x tested near underflow */ +static void +half_plus_half (void) +{ + mpfr_exp_t emin; + mpfr_t h, x1, x2, y; + int neg, r, i, inex; + mpfr_flags_t flags; + + emin = mpfr_get_emin (); + set_emin (MPFR_EMIN_MIN); + mpfr_inits2 (4, h, x1, (mpfr_ptr) 0); + mpfr_init2 (x2, GMP_NUMB_BITS); + mpfr_set_ui_2exp (h, 1, -1, MPFR_RNDN); + + for (mpfr_setmin (x1, __gmpfr_emin); + MPFR_GET_EXP (x1) < __gmpfr_emin + 2; + mpfr_nextabove (x1)) + { + inex = mpfr_set (x2, x1, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + for (neg = 0; neg < 2; neg++) + { + RND_LOOP (r) + { + /* We also want to test cases where the precision of the + result is twice the precision of each input, in case + add1sp.c and/or sub1sp.c could be involved. */ + for (i = 1; i <= 2; i++) + { + mpfr_init2 (y, GMP_NUMB_BITS * i); + mpfr_clear_flags (); + inex = mpfr_fmma (y, h, x2, h, x2, (mpfr_rnd_t) r); + flags = __gmpfr_flags; + if (! (flags == 0 && inex == 0 && mpfr_equal_p (y, x2))) + { + printf ("Error in half_plus_half for %s\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("Expected "); + mpfr_dump (x2); + printf (" with inex = 0, flags ="); + flags_out (0); + printf ("Got "); + mpfr_dump (y); + printf (" with inex = %d, flags =", inex); + flags_out (flags); + exit (1); + } + mpfr_clear (y); + } + } + mpfr_neg (x2, x2, MPFR_RNDN); + } + } + + mpfr_clears (h, x1, x2, (mpfr_ptr) 0); + set_emin (emin); +} + +/* check that result has exponent in [emin, emax] + (see https://sympa.inria.fr/sympa/arc/mpfr/2017-04/msg00016.html) + Overflow detection in sub1.c was incorrect (only for UBF cases); + fixed in r11414. */ +static void +bug20170405 (void) +{ + mpfr_t x, y, z; + + mpfr_inits2 (866, x, y, z, (mpfr_ptr) 0); + + mpfr_set_str_binary (x, "-0.10010101110110001111000110010100011001111011110001010100010000111110001010111110100001000000011010001000010000101110000000001100001011000110010000100111001100000101110000000001001101101101010110000110100010010111011001101101010011111000101100000010001100010000011100000000011110100010111011101011000101101011110110001010011001101110011101100001111000011000000011000010101010000101001001010000111101100001000001011110011000110010001100001101101001001010000111100101000010111001001101010011001110110001000010101001100000101010110000100100100010101011111001001100010001010110011000000001011110011000110001000100101000111010010111111110010111001101110101010010101101010100111001011100101101010111010011001000001010011001010001101000111011010010100110011001111111000011101111001010111001001011011011110101101001100011010001010110011100001101100100001001100111010100010100E768635654"); + mpfr_set_str_binary (y, "-0.11010001010111110010110101010011000010010011010011011101100100110000110101100110111010001001110101110000011101100010110100100011001101111010100011111001011100111101110101101001000101011110101101101011010100110010111111010011011100101111110011001001010101011101111100011101100001010010011000110010110101001110010001101111111001100100000101010100110011101101101010011001000110100001001100000010110010101111000110110000111011000110001000100100100101111110001111100101011100100100110111010000010110110001110010001001101000000110111000101000110101111110000110001110100010101111010110001111010111111111010011001001100110011000110010110011000101110001010001101000100010000110011101010010010011110100000111100000101100110001111010000100011111000001101111110100000011011110010100010010011111111000010110000000011010011001100110001110111111010111110000111110010110011001000010E768635576"); + /* since emax = 1073741821, x^2-y^2 should overflow */ + mpfr_fmms (z, x, x, y, y, MPFR_RNDN); + MPFR_ASSERTN(mpfr_inf_p (z) && mpfr_sgn (z) > 0); + + /* same test when z has a different precision */ + mpfr_set_prec (z, 867); + mpfr_fmms (z, x, x, y, y, MPFR_RNDN); + MPFR_ASSERTN(mpfr_inf_p (z) && mpfr_sgn (z) > 0); + + mpfr_set_prec (x, 564); + mpfr_set_prec (y, 564); + mpfr_set_prec (z, 2256); + mpfr_set_str_binary (x, "1e-536870913"); + mpfr_set_str_binary (y, "-1e-536870913"); + mpfr_fmma (z, x, y, x, y, MPFR_RNDN); + /* we should get -0 as result */ + MPFR_ASSERTN(mpfr_zero_p (z) && mpfr_signbit (z)); + + mpfr_set_prec (x, 564); + mpfr_set_prec (y, 564); + mpfr_set_prec (z, 2256); + mpfr_set_str_binary (x, "1.10010000111100110011001101111111101000111001011000110100110010000101000100010001000000111100010000101001011011111001111000110101111100101111001100001100011101100100011110000000011000010110111100111000100101010001011111010111011001110010001011101111001011001110110000010000011100010001010001011100100110111110101001001111001011101111110011101110101010110100010010111011111100010101111100011110111001011111101110101101101110100101111010000101011110100000000110111101000001100001000100010110100111010011011010110011100111010000101110010101111001011100110101100001100e-737194993"); + mpfr_set_str_binary (y, "-1.00101000100001001101011110100010110011101010011011010111100110101011111100000100101000111010111101100100110010001110011011100100110110000001011001000111101111101111110101100110111000000011000001101001010100010010001110001000011010000100111001001100101111111100010101110101001101101101111010100011011110001000010000010100011000011000010110101100000111111110111001100100100001101011111011100101110111000100101010110100010011101010110010100110100111000000100111101101101000000011110000100110100100011000010011110010001010000110100011111101101101110001110001101101010e-737194903"); + mpfr_fmma (z, x, y, x, y, MPFR_RNDN); + /* we should get -0 as result */ + MPFR_ASSERTN(mpfr_zero_p (z) && mpfr_signbit (z)); + + mpfr_set_prec (x, 2); + mpfr_set_prec (y, 2); + mpfr_set_prec (z, 2); + /* (a+i*b)*(c+i*d) with: + a=0.10E1 + b=0.10E-536870912 + c=0.10E-536870912 + d=0.10E1 */ + mpfr_set_str_binary (x, "0.10E1"); /* x = a = d */ + mpfr_set_str_binary (y, "0.10E-536870912"); /* y = b = c */ + /* real part is a*c-b*d = x*y-y*x */ + mpfr_fmms (z, x, y, y, x, MPFR_RNDN); + MPFR_ASSERTN(mpfr_zero_p (z) && !mpfr_signbit (z)); + /* imaginary part is a*d+b*c = x*x+y*y */ + mpfr_fmma (z, x, x, y, y, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui (z, 1) == 0); + mpfr_fmma (z, y, y, x, x, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui (z, 1) == 0); + + mpfr_clears (x, y, z, (mpfr_ptr) 0); +} + +/* Test double-rounding cases in mpfr_set_1_2, which is called when + all the precisions are the same. With set.c before r13347, this + triggers errors for neg=0. */ +static void +double_rounding (void) +{ + int p; + + for (p = 4; p < 4 * GMP_NUMB_BITS; p++) + { + mpfr_t a, b, c, d, z1, z2; + int neg; + + mpfr_inits2 (p, a, b, c, d, z1, z2, (mpfr_ptr) 0); + /* Choose a, b, c, d such that a*b = 2^p and c*d = 1 + epsilon */ + mpfr_set_ui (a, 2, MPFR_RNDN); + mpfr_set_ui_2exp (b, 1, p - 1, MPFR_RNDN); + mpfr_set_ui (c, 1, MPFR_RNDN); + mpfr_nextabove (c); + /* c = 1 + ulp(1) = 1 + 2 * ulp(1/2) */ + + for (neg = 0; neg <= 1; neg++) + { + int inex1, inex2; + + /* Set d = 1 - (1 + neg) * ulp(1/2), thus + * c*d = 1 + (1 - neg) * ulp(1/2) - 2 * (1 + neg) * ulp(1/2)^2, + * so that a*b + c*d rounds to 2^p + 1 and epsilon has the + * same sign as (-1)^neg. + */ + mpfr_set_ui (d, 1, MPFR_RNDN); + mpfr_nextbelow (d); + mpfr_set_ui_2exp (z1, 1, p, MPFR_RNDN); + if (neg) + { + mpfr_nextbelow (d); + inex1 = -1; + } + else + { + mpfr_nextabove (z1); + inex1 = 1; + } + + inex2 = mpfr_fmma (z2, a, b, c, d, MPFR_RNDN); + if (!(mpfr_equal_p (z1, z2) && SAME_SIGN (inex1, inex2))) + { + printf ("Error in double_rounding for precision %d, neg=%d\n", + p, neg); + printf ("Expected "); + mpfr_dump (z1); + printf ("with inex = %d\n", inex1); + printf ("Got "); + mpfr_dump (z2); + printf ("with inex = %d\n", inex2); + exit (1); + } + } + + mpfr_clears (a, b, c, d, z1, z2, (mpfr_ptr) 0); + } +} + +int +main (int argc, char *argv[]) +{ + tests_start_mpfr (); + + random_tests (); + zero_tests (); + max_tests (); + overflow_tests (); + half_plus_half (); + bug20170405 (); + double_rounding (); + + tests_end_mpfr (); + return 0; +} diff -Nru mpfr4-3.1.4/tests/tfmod.c mpfr4-4.0.2/tests/tfmod.c --- mpfr4-3.1.4/tests/tfmod.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tfmod.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* tfmod -- test file for mpfr_fmod -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,16 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) - #define TEST_FUNCTION mpfr_fmod #define TWO_ARGS #include "tgeneric.c" @@ -416,7 +411,7 @@ bug20090519 (); bug20160217 (); - test_generic (2, 100, 100); + test_generic (MPFR_PREC_MIN, 100, 100); special (); regular (); @@ -424,14 +419,3 @@ tests_end_mpfr (); return 0; } - -#else - -int -main (void) -{ - printf ("Warning! Test disabled for this MPFR version.\n"); - return 0; -} - -#endif diff -Nru mpfr4-3.1.4/tests/tfms.c mpfr4-4.0.2/tests/tfms.c --- mpfr4-3.1.4/tests/tfms.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tfms.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_fms. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" /* When a * b is exact, the FMS is equivalent to the separate operations. */ @@ -31,7 +28,7 @@ { const char *val[] = { "@NaN@", "-@Inf@", "-2", "-1", "-0", "0", "1", "2", "@Inf@" }; - int sv = sizeof (val) / sizeof (*val); + int sv = numberof (val); int i, j, k; int rnd; mpfr_t a, b, c, r1, r2; @@ -49,8 +46,10 @@ mpfr_mul (r1, a, b, (mpfr_rnd_t) rnd) || mpfr_sub (r1, r1, c, (mpfr_rnd_t) rnd)) { - printf ("test_exact internal error for (%d,%d,%d,%d)\n", - i, j, k, rnd); + if (rnd == MPFR_RNDF) + break; + printf ("test_exact internal error for (%d,%d,%d,%d,%s)\n", + i, j, k, rnd, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); exit (1); } if (mpfr_fms (r2, a, b, c, (mpfr_rnd_t) rnd)) @@ -67,7 +66,7 @@ i, j, k, rnd); exit (1); } - if (mpfr_cmp (r1, r2) || MPFR_SIGN (r1) != MPFR_SIGN (r2)) + if (! mpfr_equal_p (r1, r2) || MPFR_SIGN (r1) != MPFR_SIGN (r2)) { printf ("test_exact(%d,%d,%d,%d):\nexpected ", i, j, k, rnd); mpfr_out_str (stdout, 10, 0, r1, MPFR_RNDN); @@ -127,7 +126,7 @@ /* The intermediate multiplication x * y will overflow. */ for (i = -9; i <= 9; i++) - RND_LOOP (rnd) + RND_LOOP_NO_RNDF (rnd) { int inf, overflow; @@ -159,7 +158,7 @@ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - else if (MPFR_SIGN (r) >= 0) + else if (MPFR_IS_POS (r)) { printf ("Error in test_overflow2 (i = %d, %s): wrong sign " "(+ instead of -)\n", i, @@ -220,10 +219,10 @@ /* |z| = 1 or 2^emax - ulp */ mpfr_clear_flags (); inex = mpfr_fms (r, x, y, z, (mpfr_rnd_t) rnd); -#define ERRTU1 "Error in test_underflow1 (signy = %d, signz = %d, %s)\n " +#define STRTU1 "Error in test_underflow1 (signy = %d, signz = %d, %s)\n " if (mpfr_nanflag_p ()) { - printf (ERRTU1 "NaN flag is set\n", signy, signz, + printf (STRTU1 "NaN flag is set\n", signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } @@ -234,31 +233,30 @@ mpfr_nextabove (z); if ((mpfr_overflow_p () != 0) ^ (mpfr_inf_p (z) != 0)) { - printf (ERRTU1 "wrong overflow flag\n", signy, signz, + printf (STRTU1 "wrong overflow flag\n", signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } if (mpfr_underflow_p ()) { - printf (ERRTU1 "underflow flag is set\n", signy, signz, + printf (STRTU1 "underflow flag is set\n", signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } if (! mpfr_equal_p (r, z)) { - printf (ERRTU1 "got ", signy, signz, + printf (STRTU1 "got ", signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (r); - printf (" instead of "); - mpfr_print_binary (z); - printf ("\n"); + mpfr_dump (r); + printf (" instead of "); + mpfr_dump (z); err = 1; } if (inex >= 0 && (rnd == MPFR_RNDD || (rnd == MPFR_RNDZ && signz < 0) || (rnd == MPFR_RNDN && signy > 0))) { - printf (ERRTU1 "ternary value = %d instead of < 0\n", + printf (STRTU1 "ternary value = %d instead of < 0\n", signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), inex); err = 1; @@ -267,7 +265,7 @@ (rnd == MPFR_RNDZ && signz > 0) || (rnd == MPFR_RNDN && signy < 0))) { - printf (ERRTU1 "ternary value = %d instead of > 0\n", + printf (STRTU1 "ternary value = %d instead of > 0\n", signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), inex); err = 1; @@ -304,17 +302,18 @@ */ mpfr_clear_flags (); inex = mpfr_fms (r, x, y, z, MPFR_RNDN); -#define ERRTU2 "Error in test_underflow2 (b = %d, i = %d)\n " +#define STRTU2 "Error in test_underflow2 (b = %d, i = %d)\n " if (__gmpfr_flags != MPFR_FLAGS_INEXACT) { - printf (ERRTU2 "flags = %u instead of %u\n", b, i, - __gmpfr_flags, (unsigned int) MPFR_FLAGS_INEXACT); + printf (STRTU2 "flags = %u instead of %u\n", b, i, + (unsigned int) __gmpfr_flags, + (unsigned int) MPFR_FLAGS_INEXACT); err = 1; } same = i == 15 || (i == 16 && b == 0); if (same ? (inex >= 0) : (inex <= 0)) { - printf (ERRTU2 "incorrect ternary value (%d instead of %c 0)\n", + printf (STRTU2 "incorrect ternary value (%d instead of %c 0)\n", b, i, inex, same ? '<' : '>'); err = 1; } @@ -323,7 +322,7 @@ mpfr_nextabove (y); if (! mpfr_equal_p (r, y)) { - printf (ERRTU2 "expected ", b, i); + printf (STRTU2 "expected ", b, i); mpfr_dump (y); printf (" got "); mpfr_dump (r); @@ -360,10 +359,12 @@ mpfr_set_str (y, "0.5", 10, MPFR_RNDN); mpfr_set_str (z, "-0.375", 10, MPFR_RNDN); mpfr_fms (s, x, y, z, MPFR_RNDU); /* result is 0 */ - if (mpfr_cmp_ui(s, 0)) + if (mpfr_cmp_ui (s, 0)) { - printf("Error: -0.75 * 0.5 - -0.375 should be equal to 0 for prec=2\n"); - exit(1); + printf ("Error: -0.75 * 0.5 - -0.375 should be equal to 0 for prec=2\n"); + printf ("got instead "); + mpfr_dump (s); + exit (1); } mpfr_set_prec (x, 27); @@ -385,7 +386,7 @@ mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { - printf ("evaluation of function in x=NAN does not return NAN"); + printf ("evaluation of function in x=NAN does not return NAN\n"); exit (1); } @@ -395,7 +396,7 @@ mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p(s)) { - printf ("evaluation of function in y=NAN does not return NAN"); + printf ("evaluation of function in y=NAN does not return NAN\n"); exit (1); } @@ -405,7 +406,7 @@ mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { - printf ("evaluation of function in z=NAN does not return NAN"); + printf ("evaluation of function in z=NAN does not return NAN\n"); exit (1); } @@ -455,7 +456,7 @@ mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { - printf ("evaluation of function in x=INF y=0 does not return NAN"); + printf ("evaluation of function in x=INF y=0 does not return NAN\n"); exit (1); } @@ -465,7 +466,7 @@ mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { - printf ("evaluation of function in x=0 y=INF does not return NAN"); + printf ("evaluation of function in x=0 y=INF does not return NAN\n"); exit (1); } @@ -475,7 +476,7 @@ mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { - printf ("evaluation of function in x=INF y>0 z=INF does not return NAN"); + printf ("evaluation of function in x=INF y>0 z=INF does not return NAN\n"); exit (1); } @@ -485,27 +486,27 @@ mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_nan_p (s)) { - printf ("evaluation of function in x>0 y=INF z=INF does not return NAN"); + printf ("evaluation of function in x>0 y=INF z=INF does not return NAN\n"); exit (1); } mpfr_set_inf (x, 1); - mpfr_urandomb (y, RANDS); + do mpfr_urandomb (y, RANDS); while (MPFR_IS_ZERO(y)); mpfr_urandomb (z, RANDS); mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0) { - printf ("evaluation of function in x=INF does not return INF"); + printf ("evaluation of function at x=INF does not return INF\n"); exit (1); } mpfr_set_inf (y, 1); - mpfr_urandomb (x, RANDS); + do mpfr_urandomb (x, RANDS); while (MPFR_IS_ZERO(x)); mpfr_urandomb (z, RANDS); mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0) { - printf ("evaluation of function in y=INF does not return INF"); + printf ("evaluation of function at y=INF does not return INF\n"); exit (1); } @@ -515,7 +516,7 @@ mpfr_fms (s, x, y, z, MPFR_RNDN); if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0) { - printf ("evaluation of function in z=-INF does not return INF"); + printf ("evaluation of function in z=-INF does not return INF\n"); exit (1); } @@ -524,7 +525,7 @@ mpfr_urandomb (z, RANDS); mpfr_fms (s, x, y, z, MPFR_RNDN); mpfr_neg (z, z, MPFR_RNDN); - if (mpfr_cmp (s, z)) + if (! mpfr_equal_p (s, z)) { printf ("evaluation of function in x=0 does not return -z\n"); exit (1); @@ -535,7 +536,7 @@ mpfr_urandomb (z, RANDS); mpfr_fms (s, x, y, z, MPFR_RNDN); mpfr_neg (z, z, MPFR_RNDN); - if (mpfr_cmp (s, z)) + if (! mpfr_equal_p (s, z)) { printf ("evaluation of function in y=0 does not return -z\n"); exit (1); @@ -548,81 +549,76 @@ int inexact, compare; unsigned int n; - mpfr_prec_t p0=2, p1=200; - unsigned int N=200; + mpfr_prec_t p0 = 2, p1 = 200; + unsigned int N = 200; mpfr_init (t); mpfr_init (slong); /* generic test */ for (prec = p0; prec <= p1; prec++) - { - mpfr_set_prec (x, prec); - mpfr_set_prec (y, prec); - mpfr_set_prec (z, prec); - mpfr_set_prec (s, prec); - mpfr_set_prec (t, prec); + { + mpfr_set_prec (x, prec); + mpfr_set_prec (y, prec); + mpfr_set_prec (z, prec); + mpfr_set_prec (s, prec); + mpfr_set_prec (t, prec); - for (n=0; n= 0)) || - ((inexact > 0) && (compare <= 0))) - { - printf ("Wrong inexact flag for rnd=%s: expected %d, got %d\n", - mpfr_print_rnd_mode (rnd), compare, inexact); - printf (" x="); mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); - printf (" y="); mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); - printf (" z="); mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN); - printf (" s="); mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN); - printf ("\n"); - exit (1); - } - } - } - mpfr_clear (t); - mpfr_clear (slong); + for (n = 0; n < N; n++) + { + mpfr_urandomb (x, RANDS); + mpfr_urandomb (y, RANDS); + mpfr_urandomb (z, RANDS); + + if (randlimb () % 2) + mpfr_neg (x, x, MPFR_RNDN); + if (randlimb () % 2) + mpfr_neg (y, y, MPFR_RNDN); + if (randlimb () % 2) + mpfr_neg (z, z, MPFR_RNDN); + + rnd = RND_RAND_NO_RNDF (); + mpfr_set_prec (slong, 2 * prec); + if (mpfr_mul (slong, x, y, rnd)) + { + printf ("x*y should be exact\n"); + exit (1); + } + compare = mpfr_sub (t, slong, z, rnd); + inexact = mpfr_fms (s, x, y, z, rnd); + if (! mpfr_equal_p (s, t)) + { + printf ("results differ for\n"); + printf (" x="); + mpfr_dump (x); + printf (" y="); + mpfr_dump (y); + printf (" z="); + mpfr_dump (z); + printf (" with prec=%u rnd_mode=%s\n", (unsigned int) prec, + mpfr_print_rnd_mode (rnd)); + printf ("got "); + mpfr_dump (s); + printf ("expected "); + mpfr_dump (t); + printf ("approx "); + mpfr_dump (slong); + exit (1); + } + if (! SAME_SIGN (inexact, compare)) + { + printf ("Wrong inexact flag for rnd=%s: expected %d, got %d\n", + mpfr_print_rnd_mode (rnd), compare, inexact); + printf (" x="); mpfr_dump (x); + printf (" y="); mpfr_dump (y); + printf (" z="); mpfr_dump (z); + printf (" s="); mpfr_dump (s); + exit (1); + } + } + } + mpfr_clear (t); + mpfr_clear (slong); } mpfr_clear (x); diff -Nru mpfr4-3.1.4/tests/tfpif.c mpfr4-4.0.2/tests/tfpif.c --- mpfr4-3.1.4/tests/tfpif.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/tfpif.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,383 @@ +/* Test file for mpfr_fpif. + +Copyright 2012-2019 Free Software Foundation, Inc. +Contributed by Olivier Demengeon. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-test.h" + +#define FILE_NAME_RW "tfpif_rw.dat" /* temporary name (written then read) */ +#define FILE_NAME_R "tfpif_r1.dat" /* fixed file name (read only) */ +#define FILE_NAME_R2 "tfpif_r2.dat" /* fixed file name (read only) with a + precision > MPFR_PREC_MAX */ + +static void +doit (int argc, char *argv[], mpfr_prec_t p1, mpfr_prec_t p2) +{ + char *filenameCompressed = FILE_NAME_RW; + char *data = FILE_NAME_R; + int status; + FILE *fh; + mpfr_t x[9]; + mpfr_t y; + int i, neg; + long pos; + + mpfr_init2 (x[0], p1); + mpfr_init2 (x[8], p1); + mpfr_inits2 (p2, x[1], x[2], x[3], x[4], x[5], x[6], x[7], (mpfr_ptr) 0); + mpfr_set_str1 (x[0], "45.2564215000000018562786863185465335845947265625"); + mpfr_set_str1 (x[1], "45.2564215000000018562786863185465335845947265625"); + mpfr_set_str1 (x[2], "45.2564215000000018562786863185465335845947265625"); + mpfr_set_exp (x[2], -48000); + mpfr_set_inf (x[3], 1); + mpfr_set_zero (x[4], 1); + mpfr_set_nan (x[5]); + mpfr_set_ui (x[6], 104348, MPFR_RNDN); + mpfr_set_ui (x[7], 33215, MPFR_RNDN); + mpfr_div (x[8], x[6], x[7], MPFR_RNDN); + mpfr_div (x[6], x[6], x[7], MPFR_RNDN); + + /* we first write to file FILE_NAME_RW the numbers x[i] */ + fh = fopen (filenameCompressed, "w"); + if (fh == NULL) + { + printf ("Failed to open for writing %s\n", filenameCompressed); + exit (1); + } + + for (neg = 0; neg < 2; neg++) + for (i = 0; i < 9; i++) + { + if (neg) + MPFR_CHANGE_SIGN (x[i]); + + status = mpfr_fpif_export (fh, x[i]); + if (status != 0) + { + fclose (fh); + printf ("Failed to export number %d, neg=%d\n", i, neg); + exit (1); + } + + if (neg) + MPFR_CHANGE_SIGN (x[i]); + } + + fclose (fh); + + /* we then read back FILE_NAME_RW and check we get the same numbers x[i] */ + fh = fopen (filenameCompressed, "r"); + if (fh == NULL) + { + printf ("Failed to open for reading %s\n", filenameCompressed); + exit (1); + } + + for (neg = 0; neg < 2; neg++) + for (i = 0; i < 9; i++) + { + mpfr_prec_t px, py; + + if (neg) + MPFR_CHANGE_SIGN (x[i]); + + mpfr_init2 (y, 2); + /* Set the sign bit of y to the opposite of the expected one. + Thus, if mpfr_fpif_import forgets to set the sign, this will + be detected. */ + MPFR_SET_SIGN (y, - MPFR_SIGN (x[i])); + mpfr_fpif_import (y, fh); + px = mpfr_get_prec (x[i]); + py = mpfr_get_prec (y); + if (px != py) + { + printf ("doit failed on written number %d, neg=%d:" + " bad precision\n", i, neg); + printf ("expected %ld\n", (long) px); + printf ("got %ld\n", (long) py); + exit (1); + } + if (MPFR_SIGN (x[i]) != MPFR_SIGN (y)) + { + printf ("doit failed on written number %d, neg=%d:" + " bad sign\n", i, neg); + printf ("expected %d\n", (int) MPFR_SIGN (x[i])); + printf ("got %d\n", (int) MPFR_SIGN (y)); + exit (1); + } + if (! SAME_VAL (x[i], y)) + { + printf ("doit failed on written number %d, neg=%d\n", i, neg); + printf ("expected "); mpfr_dump (x[i]); + printf ("got "); mpfr_dump (y); + exit (1); + } + mpfr_clear (y); + + if (neg) + MPFR_CHANGE_SIGN (x[i]); + } + fclose (fh); + + /* we do the same for the fixed file FILE_NAME_R, this ensures + we get same results with different word size or endianness */ + fh = src_fopen (data, "r"); + if (fh == NULL) + { + printf ("Failed to open for reading %s in srcdir\n", data); + exit (1); + } + + /* the fixed file FILE_NAME_R assumes p1=130 and p2=2048 */ + for (i = 0; i < 9 && (p1 == 130 && p2 == 2048); i++) + { + mpfr_prec_t px, py; + + mpfr_init2 (y, 2); + /* Set the sign bit of y to the opposite of the expected one. + Thus, if mpfr_fpif_import forgets to set the sign, this will + be detected. */ + MPFR_SET_SIGN (y, - MPFR_SIGN (x[i])); + pos = ftell (fh); + mpfr_fpif_import (y, fh); + px = mpfr_get_prec (x[i]); + py = mpfr_get_prec (y); + if (px != py) + { + printf ("doit failed on data number %d, neg=%d:" + " bad precision\n", i, neg); + printf ("expected %ld\n", (long) px); + printf ("got %ld\n", (long) py); + exit (1); + } + if (MPFR_SIGN (x[i]) != MPFR_SIGN (y)) + { + printf ("doit failed on data number %d, neg=%d:" + " bad sign\n", i, neg); + printf ("expected %d\n", (int) MPFR_SIGN (x[i])); + printf ("got %d\n", (int) MPFR_SIGN (y)); + exit (1); + } + if (! SAME_VAL (x[i], y)) + { + printf ("doit failed on data number %d, neg=%d, at offset 0x%lx\n", + i, neg, (unsigned long) pos); + printf ("expected "); mpfr_dump (x[i]); + printf ("got "); mpfr_dump (y); + exit (1); + } + mpfr_clear (y); + } + fclose (fh); + + for (i = 0; i < 9; i++) + mpfr_clear (x[i]); + + remove (filenameCompressed); +} + +#define BAD 10 + +static void +check_bad (void) +{ + char *filenameCompressed = FILE_NAME_RW; + int status; + FILE *fh; + mpfr_t x; + unsigned char badData[BAD][10] = + { { 7 }, { 16 }, { 23, 118 }, { 23, 95 }, { 23, 127 }, { 23, 47 }, + { 7, 0, 0, 0, 0, 0, 0, 0, 128, 119 }, /* +0 in a huge precision */ + /* precision 8-7=1, exponent on 98-94=4 bytes */ + { 8, 98, 255, 255, 255, 127 }, + /* precision 8-7=1, exponent on 102-94=8 bytes */ + { 8, 102, 255, 255, 255, 255, 255, 255, 255, 127 }, + { 8, 94 } + }; + int badDataSize[BAD] = { 1, 1, 2, 2, 2, 2, 10, 6, 10, 2 }; + int i; + + mpfr_init2 (x, 2); + status = mpfr_fpif_export (NULL, x); + if (status == 0) + { + printf ("mpfr_fpif_export did not fail with a NULL file\n"); + exit(1); + } + status = mpfr_fpif_import (x, NULL); + if (status == 0) + { + printf ("mpfr_fpif_import did not fail with a NULL file\n"); + exit(1); + } + + fh = fopen (filenameCompressed, "w+"); + if (fh == NULL) + { + printf ("Failed to open for reading/writing %s, exiting...\n", + filenameCompressed); + fclose (fh); + remove (filenameCompressed); + exit (1); + } + status = mpfr_fpif_import (x, fh); + if (status == 0) + { + printf ("mpfr_fpif_import did not fail on a empty file\n"); + fclose (fh); + remove (filenameCompressed); + exit(1); + } + + for (i = 0; i < BAD; i++) + { + mpfr_exp_t emax; + /* For i == 6, mpfr_prec_t needs at least a 65-bit precision + (64 value bits + 1 sign bit) to avoid a failure. */ + if (i == 6 && MPFR_PREC_BITS > 64) + break; + /* For i=9, we use a reduced exponent range */ + if (i == 9) + { + emax = mpfr_get_emax (); + mpfr_set_emax (46); + } + rewind (fh); + status = fwrite (&badData[i][0], badDataSize[i], 1, fh); + if (status != 1) + { + printf ("Write error on the test file\n"); + fclose (fh); + remove (filenameCompressed); + exit(1); + } + rewind (fh); + status = mpfr_fpif_import (x, fh); + if (status == 0) + { + printf ("mpfr_fpif_import did not fail on a bad imported data\n"); + switch (i) + { + case 0: + printf (" not enough precision data\n"); + break; + case 1: + printf (" no exponent data\n"); + break; + case 2: + printf (" too big exponent\n"); + break; + case 3: + printf (" not enough exponent data\n"); + break; + case 4: + printf (" exponent data wrong\n"); + break; + case 5: + printf (" no limb data\n"); + break; + case 6: + printf (" too large precision\n"); + break; + case 7: + case 8: + case 9: + printf (" too large exponent\n"); + break; + default: + printf ("Test fatal error, unknown case\n"); + break; + } + fclose (fh); + remove (filenameCompressed); + exit(1); + } + if (i == 9) + mpfr_set_emax (emax); + } + + fclose (fh); + mpfr_clear (x); + + fh = fopen (filenameCompressed, "r"); + if (fh == NULL) + { + printf ("Failed to open for reading %s, exiting...\n", + filenameCompressed); + exit (1); + } + + mpfr_init2 (x, 2); + status = mpfr_fpif_export (fh, x); + if (status == 0) + { + printf ("mpfr_fpif_export did not fail on a read only stream\n"); + exit(1); + } + fclose (fh); + remove (filenameCompressed); + mpfr_clear (x); +} + +/* exercise error when precision > MPFR_PREC_MAX */ +static void +extra (void) +{ + char *data = FILE_NAME_R2; + mpfr_t x; + FILE *fp; + int ret; + + mpfr_init2 (x, 17); + mpfr_set_ui (x, 42, MPFR_RNDN); + fp = src_fopen (data, "r"); + if (fp == NULL) + { + printf ("Failed to open for reading %s in srcdir, exiting...\n", data); + exit (1); + } + ret = mpfr_fpif_import (x, fp); + MPFR_ASSERTN (ret != 0); /* import failure */ + MPFR_ASSERTN (mpfr_get_prec (x) == 17); /* precision did not change */ + MPFR_ASSERTN (mpfr_cmp_ui0 (x, 42) == 0); /* value is still 42 */ + fclose (fp); + mpfr_clear (x); +} + +int +main (int argc, char *argv[]) +{ + if (argc != 1) + { + printf ("Usage: %s\n", argv[0]); + exit (1); + } + + tests_start_mpfr (); + + extra (); + doit (argc, argv, 130, 2048); + doit (argc, argv, 1, 53); + check_bad (); + + tests_end_mpfr (); + + return 0; +} Binary files /tmp/tmpczUUp3/IC9CgRTOre/mpfr4-3.1.4/tests/tfpif_r1.dat and /tmp/tmpczUUp3/ngqctyQIvU/mpfr4-4.0.2/tests/tfpif_r1.dat differ Binary files /tmp/tmpczUUp3/IC9CgRTOre/mpfr4-3.1.4/tests/tfpif_r2.dat and /tmp/tmpczUUp3/ngqctyQIvU/mpfr4-4.0.2/tests/tfpif_r2.dat differ diff -Nru mpfr4-3.1.4/tests/tfprintf.c mpfr4-4.0.2/tests/tfprintf.c --- mpfr4-3.1.4/tests/tfprintf.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tfprintf.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* tfprintf.c -- test file for mpfr_fprintf and mpfr_vfprintf -Copyright 2008-2016 Free Software Foundation, Inc. +Copyright 2008-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,22 +17,23 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_STDARG +/* Needed due to the tests on HAVE_STDARG and MPFR_USE_MINI_GMP */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#if defined(HAVE_STDARG) && !defined(MPFR_USE_MINI_GMP) #include -#include -#include #include #include #include "mpfr-intmax.h" #include "mpfr-test.h" -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) - #define QUOTE(X) NAME(X) #define NAME(X) #X @@ -149,11 +150,11 @@ unsigned long ulo = 1; float f = -1.25; double d = -1.25; -#if !defined(NPRINTF_T) || !defined(NPRINTF_L) +#if defined(PRINTF_T) || defined(PRINTF_L) long double ld = -1.25; #endif -#ifndef NPRINTF_T +#ifdef PRINTF_T ptrdiff_t p = 1, saved_p; #endif size_t sz = 1; @@ -179,7 +180,7 @@ mpfr_init2 (mpfr, prec); mpfr_set_f (mpfr, mpf, MPFR_RNDN); - limb[0] = limb[1] = limb[2] = ~ (mp_limb_t) 0; + limb[0] = limb[1] = limb[2] = MPFR_LIMB_MAX; check_vfprintf (fout, "a. %Ra, b. %u, c. %lx%n", mpfr, ui, ulo, &j); check_length (1, j, 22, d); @@ -199,15 +200,20 @@ (void *) &i); check_length_with_cmp (7, mpfr, 15, mpfr_cmp_ui (mpfr, 15), Rg); -#ifndef NPRINTF_T +#ifdef PRINTF_T saved_p = p; check_vfprintf (fout, "%% a. %RNg, b. %Qx, c. %td%tn", mpfr, mpq, p, &p); if (p != 20) - mpfr_fprintf (stderr, "Error in test 8, got '%% a. %RNg, b. %Qx, c. %td'\n", mpfr, mpq, saved_p); + { + mpfr_fprintf (stderr, "Error in test 8, got '%% a. %RNg, b. %Qx, c. %td'\n", mpfr, mpq, saved_p); + /* under MinGW, -D__USE_MINGW_ANSI_STDIO is required to support %td + see https://gcc.gnu.org/ml/gcc/2013-03/msg00103.html */ + fprintf (stderr, "Under MinGW, compiling GMP with -D__USE_MINGW_ANSI_STDIO might be required\n"); + } check_length (8, (long) p, 20, ld); /* no format specifier "%td" in C89 */ #endif -#ifndef NPRINTF_L +#ifdef PRINTF_L check_vfprintf (fout, "a. %RA, b. %Lf, c. %QX%zn", mpfr, ld, mpq, &sz); check_length (9, (unsigned long) sz, 30, lu); /* no format specifier "%zu" in C89 */ #endif @@ -220,21 +226,23 @@ #if (__GNU_MP_VERSION * 10 + __GNU_MP_VERSION_MINOR) >= 42 /* The 'M' specifier was added in gmp 4.2.0 */ check_vfprintf (fout, "a. %Mx b. %Re%Mn", limb[0], mpfr, &limb[0]); - if (limb[0] != 14 + GMP_NUMB_BITS / 4 || limb[1] != ~ (mp_limb_t) 0 - || limb[2] != ~ (mp_limb_t) 0) + if (limb[0] != 14 + GMP_NUMB_BITS / 4 || + limb[1] != MPFR_LIMB_MAX || + limb[2] != MPFR_LIMB_MAX) { printf ("Error in test #11: mpfr_vfprintf did not print %d characters" " as expected\n", 14 + (int) GMP_NUMB_BITS / 4); exit (1); } - limb[0] = ~ (mp_limb_t) 0; + limb[0] = MPFR_LIMB_MAX; /* we tell vfprintf that limb array is 2 cells wide and check it doesn't go through */ check_vfprintf (fout, "a. %Re .b %Nx%Nn", mpfr, limb, limb_size, limb, limb_size - 1); - if (limb[0] != 14 + 3 * GMP_NUMB_BITS / 4 || limb[1] != (mp_limb_t) 0 - || limb[2] != ~ (mp_limb_t) 0) + if (limb[0] != 14 + 3 * GMP_NUMB_BITS / 4 || + limb[1] != MPFR_LIMB_ZERO || + limb[2] != MPFR_LIMB_MAX) { printf ("Error in test #12: mpfr_vfprintf did not print %d characters" " as expected\n", 14 + (int) GMP_NUMB_BITS / 4); @@ -396,7 +404,7 @@ /* If we failed to open this device, try with a dummy file */ if (fout == NULL) { - fout = fopen ("mpfrtest.txt", "w"); + fout = fopen ("tfprintf_out.txt", "w"); if (fout == NULL) { @@ -422,17 +430,6 @@ return 0; } -#else /* MPFR_VERSION */ - -int -main (void) -{ - printf ("Warning! Test disabled for this MPFR version.\n"); - return 0; -} - -#endif /* MPFR_VERSION */ - #else /* HAVE_STDARG */ int diff -Nru mpfr4-3.1.4/tests/tfrac.c mpfr4-4.0.2/tests/tfrac.c --- mpfr4-3.1.4/tests/tfrac.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tfrac.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_frac. -Copyright 2002-2016 Free Software Foundation, Inc. +Copyright 2002-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define PIP 70 @@ -294,7 +291,7 @@ bug20090918 (); - test_generic (2, 1000, 10); + test_generic (MPFR_PREC_MIN, 1000, 10); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tfrexp.c mpfr4-4.0.2/tests/tfrexp.c --- mpfr4-3.1.4/tests/tfrexp.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/tests/tfrexp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_frexp. -Copyright 2011-2016 Free Software Foundation, Inc. +Copyright 2011-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,10 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include /* for exit */ #include "mpfr-test.h" static void @@ -157,7 +156,7 @@ { int inex1, inex2; mpfr_exp_t e1, e2; - unsigned int flags1, flags2; + mpfr_flags_t flags1, flags2; for (red = 0; red < 2; red++) { diff -Nru mpfr4-3.1.4/tests/tgamma.c mpfr4-4.0.2/tests/tgamma.c --- mpfr4-3.1.4/tests/tgamma.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tgamma.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ -/* mpfr_tgamma -- test file for gamma function +/* Test file for gamma function -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" /* Note: there could be an incorrect test about suspicious overflow @@ -111,9 +108,9 @@ { printf ("mpfr_lngamma("CHECK_X1") is wrong:\n" "expected "); - mpfr_print_binary (x); putchar ('\n'); + mpfr_dump (x); printf ("got "); - mpfr_print_binary (y); putchar ('\n'); + mpfr_dump (y); exit (1); } @@ -126,9 +123,9 @@ { printf ("mpfr_lngamma("CHECK_X2") is wrong:\n" "expected "); - mpfr_print_binary (x); putchar ('\n'); + mpfr_dump (x); printf ("got "); - mpfr_print_binary (y); putchar ('\n'); + mpfr_dump (y); exit (1); } @@ -153,8 +150,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_gamma (120)\n"); - printf ("Expected "); mpfr_print_binary (y); puts (""); - printf ("Got "); mpfr_print_binary (x); puts (""); + printf ("Expected "); mpfr_dump (y); + printf ("Got "); mpfr_dump (x); exit (1); } @@ -237,7 +234,7 @@ mpfr_set_prec (y, 29); mpfr_set_str (x, "-200000000.5", 10, MPFR_RNDN); /* exact */ mpfr_gamma (y, x, MPFR_RNDN); - if (!(mpfr_zero_p (y) && MPFR_SIGN (y) < 0)) + if (!(mpfr_zero_p (y) && MPFR_IS_NEG (y))) { printf ("Error for gamma(-200000000.5)\n"); printf ("expected -0"); @@ -250,7 +247,7 @@ mpfr_set_prec (y, 53); mpfr_set_str (x, "-200000000.1", 10, MPFR_RNDN); mpfr_gamma (y, x, MPFR_RNDN); - if (!(mpfr_zero_p (y) && MPFR_SIGN (y) < 0)) + if (!(mpfr_zero_p (y) && MPFR_IS_NEG (y))) { printf ("Error for gamma(-200000000.1), prec=53\n"); printf ("expected -0"); @@ -364,7 +361,7 @@ mpfr_set_prec (y, 71); mpfr_set_str (x, "-200000000.1", 10, MPFR_RNDN); mpfr_gamma (y, x, MPFR_RNDN); - if (!(mpfr_zero_p (y) && MPFR_SIGN (y) < 0)) + if (!(mpfr_zero_p (y) && MPFR_IS_NEG (y))) { printf ("Error for gamma (test 8)\n"); printf ("expected "); mpfr_dump (x); @@ -372,7 +369,7 @@ exit (1); } - set_emax (1073741823); + set_emax (1073741821); mpfr_set_prec (x, 29); mpfr_set_prec (y, 29); mpfr_set_str (x, "423786866", 10, MPFR_RNDN); @@ -539,7 +536,7 @@ mpfr_init2 (xa, 53); mpfr_init2 (xb, 53); - mpfr_set_d (xb, -168.5, MPFR_RNDN); + mpfr_set_si_2exp (xb, -337, -1, MPFR_RNDN); emin = mpfr_get_emin (); mpfr_set_emin (-1073); i = mpfr_gamma (xa, xb, MPFR_RNDN); @@ -549,9 +546,9 @@ { printf ("Error in test20120426, i=%d\n", i); printf ("expected "); - mpfr_print_binary (xb); putchar ('\n'); + mpfr_dump (xb); printf ("got "); - mpfr_print_binary (xa); putchar ('\n'); + mpfr_dump (xa); exit (1); } mpfr_set_emin (emin); @@ -589,9 +586,9 @@ printf ("Error in exprange (test1)\n"); printf ("x = "); mpfr_dump (x); - printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1); + printf ("Expected inex1 = %d, flags1 = %u, ", VSIGN (inex1), flags1); mpfr_dump (y); - printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2); + printf ("Got inex2 = %d, flags2 = %u, ", VSIGN (inex2), flags2); mpfr_dump (z); exit (1); } @@ -612,9 +609,9 @@ printf ("Error in exprange (test2)\n"); printf ("x = "); mpfr_dump (x); - printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1); + printf ("Expected inex1 = %d, flags1 = %u, ", VSIGN (inex1), flags1); mpfr_dump (y); - printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2); + printf ("Got inex2 = %d, flags2 = %u, ", VSIGN (inex2), flags2); mpfr_dump (z); exit (1); } @@ -634,9 +631,9 @@ printf ("Error in exprange (test3)\n"); printf ("x = "); mpfr_dump (x); - printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1); + printf ("Expected inex1 = %d, flags1 = %u, ", VSIGN (inex1), flags1); mpfr_dump (y); - printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2); + printf ("Got inex2 = %d, flags2 = %u, ", VSIGN (inex2), flags2); mpfr_dump (z); exit (1); } @@ -657,9 +654,9 @@ printf ("Error in exprange (test4)\n"); printf ("x = "); mpfr_dump (x); - printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1); + printf ("Expected inex1 = %d, flags1 = %u, ", VSIGN (inex1), flags1); mpfr_dump (y); - printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2); + printf ("Got inex2 = %d, flags2 = %u, ", VSIGN (inex2), flags2); mpfr_dump (z); exit (1); } @@ -682,9 +679,9 @@ printf ("Error in exprange (test5)\n"); printf ("x = "); mpfr_dump (x); - printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1); + printf ("Expected inex1 = %d, flags1 = %u, ", VSIGN (inex1), flags1); mpfr_dump (y); - printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2); + printf ("Got inex2 = %d, flags2 = %u, ", VSIGN (inex2), flags2); mpfr_dump (z); exit (1); } @@ -698,9 +695,9 @@ printf ("Error in exprange (test6)\n"); printf ("x = "); mpfr_dump (x); - printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1); + printf ("Expected inex1 = %d, flags1 = %u, ", VSIGN (inex1), flags1); mpfr_dump (y); - printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2); + printf ("Got inex2 = %d, flags2 = %u, ", VSIGN (inex2), flags2); mpfr_dump (z); exit (1); } @@ -716,9 +713,9 @@ printf ("Error in exprange (test7)\n"); printf ("x = "); mpfr_dump (x); - printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1); + printf ("Expected inex1 = %d, flags1 = %u, ", VSIGN (inex1), flags1); mpfr_dump (y); - printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2); + printf ("Got inex2 = %d, flags2 = %u, ", VSIGN (inex2), flags2); mpfr_dump (z); exit (1); } @@ -736,9 +733,9 @@ printf ("Error in exprange (test8)\n"); printf ("x = "); mpfr_dump (x); - printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1); + printf ("Expected inex1 = %d, flags1 = %u, ", VSIGN (inex1), flags1); mpfr_dump (y); - printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2); + printf ("Got inex2 = %d, flags2 = %u, ", VSIGN (inex2), flags2); mpfr_dump (z); exit (1); } @@ -752,9 +749,9 @@ printf ("Error in exprange (test9)\n"); printf ("x = "); mpfr_dump (x); - printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1); + printf ("Expected inex1 = %d, flags1 = %u, ", VSIGN (inex1), flags1); mpfr_dump (y); - printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2); + printf ("Got inex2 = %d, flags2 = %u, ", VSIGN (inex2), flags2); mpfr_dump (z); exit (1); } @@ -771,9 +768,9 @@ printf ("Error in exprange (test10)\n"); printf ("x = "); mpfr_dump (x); - printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1); + printf ("Expected inex1 = %d, flags1 = %u, ", VSIGN (inex1), flags1); mpfr_dump (y); - printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2); + printf ("Got inex2 = %d, flags2 = %u, ", VSIGN (inex2), flags2); mpfr_dump (z); exit (1); } @@ -800,7 +797,7 @@ spm = 1; for (s = 0; s < 2; s++) { - RND_LOOP(r) + RND_LOOP_NO_RNDF (r) { mpfr_rnd_t rr = (mpfr_rnd_t) r; mpfr_exp_t exponent, emax; @@ -839,12 +836,12 @@ { printf ("Error in tiny for s = %d, r = %s, emax = %" MPFR_EXP_FSPEC "d%s\n on ", - s, mpfr_print_rnd_mode (rr), emax, + s, mpfr_print_rnd_mode (rr), (mpfr_eexp_t) emax, exponent > emax ? " (overflow)" : ""); mpfr_dump (x); printf (" expected inex = %2d, ", expected_inex); mpfr_dump (z); - printf (" got inex = %2d, ", SIGN (inex)); + printf (" got inex = %2d, ", VSIGN (inex)); mpfr_dump (y); printf (" expected flags = %u, got %u\n", expected_flags, flags); @@ -1063,11 +1060,24 @@ { tests_start_mpfr (); + if (argc == 3) /* tgamma x prec: print gamma(x) to prec bits */ + { + mpfr_prec_t p = atoi (argv[2]); + mpfr_t x; + mpfr_init2 (x, p); + mpfr_set_str (x, argv[1], 10, MPFR_RNDN); + mpfr_gamma (x, x, MPFR_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); + printf ("\n"); + mpfr_clear (x); + return 0; + } + special (); special_overflow (); exprange (); tiny (argc == 1); - test_generic (2, 100, 2); + test_generic (MPFR_PREC_MIN, 100, 2); gamma_integer (); test20071231 (); test20100709 (); diff -Nru mpfr4-3.1.4/tests/tgamma_inc.c mpfr4-4.0.2/tests/tgamma_inc.c --- mpfr4-3.1.4/tests/tgamma_inc.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/tgamma_inc.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,267 @@ +/* Test file for mpfr_gamma_inc + +Copyright 2016-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-test.h" + +#define TEST_FUNCTION mpfr_gamma_inc +#define TWO_ARGS +#define TEST_RANDOM_POS2 0 /* the 2nd argument is never negative */ +#define TGENERIC_NOWARNING 1 +#define TEST_RANDOM_EMAX 8 +#define TEST_RANDOM_EMIN -32 +#define REDUCE_EMAX TEST_RANDOM_EMAX +#define REDUCE_EMIN TEST_RANDOM_EMIN +#include "tgeneric.c" + +/* do k random tests at precision p */ +static void +test_random (mpfr_prec_t p, int k) +{ + mpfr_t a, x, y, z, t; + + mpfr_inits2 (p, a, x, y, z, (mpfr_ptr) 0); + mpfr_init2 (t, p + 20); + while (k--) + { + do mpfr_urandomb (a, RANDS); while (mpfr_zero_p (a)); + if (randlimb () & 1) + mpfr_neg (a, a, MPFR_RNDN); + do mpfr_urandomb (x, RANDS); while (mpfr_zero_p (x)); + mpfr_gamma_inc (y, a, x, MPFR_RNDN); + mpfr_gamma_inc (t, a, x, MPFR_RNDN); + if (mpfr_can_round (t, mpfr_get_prec (z), MPFR_RNDN, MPFR_RNDN, p)) + { + mpfr_set (z, t, MPFR_RNDN); + if (mpfr_cmp (y, z)) + { + printf ("mpfr_gamma_inc failed for a="); + mpfr_out_str (stdout, 10, 0, a, MPFR_RNDN); + printf (" x="); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); + printf ("\nexpected "); + mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN); + printf ("\ngot "); + mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN); + printf ("\n"); + exit (1); + } + } + } + mpfr_clears (a, x, y, z, (mpfr_ptr) 0); + mpfr_clear (t); +} + +static void +specials (void) +{ + mpfr_t a, x; + int inex; + + mpfr_init2 (a, 2); + mpfr_init2 (x, 2); + + /* check gamma_inc(2,0) = 1 is exact */ + mpfr_set_ui (a, 2, MPFR_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDN); + mpfr_clear_inexflag (); + inex = mpfr_gamma_inc (a, a, x, MPFR_RNDN); + if (mpfr_cmp_ui (a, 1)) + { + printf ("Error for gamma_inc(2,0)\n"); + printf ("expected 1\n"); + printf ("got "); + mpfr_out_str (stdout, 10, 0, a, MPFR_RNDN); + printf ("\n"); + exit (1); + } + if (inex != 0) + { + printf ("Wrong ternary value for gamma_inc(2,0)\n"); + printf ("expected 0\n"); + printf ("got %d\n", inex); + exit (1); + } + if (mpfr_inexflag_p ()) + { + printf ("Wrong inexact flag for gamma_inc(2,0)\n"); + printf ("expected 0\n"); + printf ("got 1\n"); + exit (1); + } + + /* check gamma_inc(0,1) = 0.219383934395520 */ + mpfr_set_ui (a, 0, MPFR_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_gamma_inc (a, a, x, MPFR_RNDN); + if (mpfr_cmp_ui_2exp (a, 1, -2)) + { + printf ("Error for gamma_inc(0,1)\n"); + printf ("expected 0.25\n"); + printf ("got "); + mpfr_out_str (stdout, 10, 0, a, MPFR_RNDN); + printf ("\n"); + exit (1); + } + + /* check gamma_inc(-1,1) = 0.148495506775922 */ + mpfr_set_si (a, -1, MPFR_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_gamma_inc (a, a, x, MPFR_RNDN); + if (mpfr_cmp_ui_2exp (a, 1, -3)) + { + printf ("Error for gamma_inc(-1,1)\n"); + printf ("expected 0.125\n"); + printf ("got "); + mpfr_out_str (stdout, 10, 0, a, MPFR_RNDN); + printf ("\n"); + exit (1); + } + + /* check gamma_inc(-2,1) = 0.109691967197760 */ + mpfr_set_si (a, -2, MPFR_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_gamma_inc (a, a, x, MPFR_RNDN); + if (mpfr_cmp_ui_2exp (a, 1, -3)) + { + printf ("Error for gamma_inc(-2,1)\n"); + printf ("expected 0.125\n"); + printf ("got "); + mpfr_out_str (stdout, 10, 0, a, MPFR_RNDN); + printf ("\n"); + exit (1); + } + + /* check gamma_inc(-3,1) = 0.109691967197760 */ + mpfr_set_si (a, -3, MPFR_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_gamma_inc (a, a, x, MPFR_RNDN); + if (mpfr_cmp_ui_2exp (a, 3, -5)) + { + printf ("Error for gamma_inc(-3,1)\n"); + printf ("expected 3/32\n"); + printf ("got "); + mpfr_out_str (stdout, 10, 0, a, MPFR_RNDN); + printf ("\n"); + exit (1); + } + + /* check gamma_inc(-100,1) = 0.00364201018241046 */ + mpfr_set_si (a, -100, MPFR_RNDN); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_gamma_inc (a, a, x, MPFR_RNDN); + if (mpfr_cmp_ui_2exp (a, 1, -8)) + { + printf ("Error for gamma_inc(-100,1)\n"); + printf ("expected 1/256\n"); + printf ("got "); + mpfr_out_str (stdout, 10, 0, a, MPFR_RNDN); + printf ("\n"); + exit (1); + } + + /* TODO: Once internal overflow is supported, add new tests with + larger exponents, e.g. 64 (in addition to 25). */ + mpfr_set_prec (a, 1); + mpfr_set_prec (x, 1); + mpfr_set_ui_2exp (a, 1, 25, MPFR_RNDN); + mpfr_set_ui_2exp (x, 1, -25, MPFR_RNDN); + mpfr_gamma_inc (a, a, x, MPFR_RNDN); + + mpfr_clear (a); + mpfr_clear (x); +} + +/* tests for negative integer a: for -n <= a <= -1, perform k tests + with random x in 0..|a| and precision 'prec' */ +static void +test_negint (long n, unsigned long k, mpfr_prec_t prec) +{ + long i, j; + mpfr_t a, x, y; + + mpfr_init2 (a, prec); + mpfr_init2 (x, prec); + mpfr_init2 (y, prec); + for (i = 1; i <= n; i++) + { + mpfr_set_si (a, -i, MPFR_RNDN); + for (j = 1; j <= k; j++) + { + mpfr_urandomb (x, RANDS); + mpfr_mul_si (x, x, j, MPFR_RNDN); + mpfr_set_prec (y, prec + 20); + mpfr_gamma_inc (y, a, x, MPFR_RNDZ); + mpfr_gamma_inc (x, a, x, MPFR_RNDZ); + mpfr_prec_round (y, prec, MPFR_RNDZ); + if (mpfr_cmp (x, y)) + { + printf ("Error in mpfr_gamma_inc(%ld,%ld) with MPFR_RNDZ\n", + -i, j); + printf ("expected "); + mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN); + printf ("\ngot "); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); + printf ("\n"); + exit (1); + } + } + } + mpfr_clear (a); + mpfr_clear (x); + mpfr_clear (y); +} + +int +main (int argc, char *argv[]) +{ + mpfr_prec_t p; + + tests_start_mpfr (); + + if (argc == 4) /* tgamma_inc a x prec: print gamma_inc(a,x) to prec bits */ + { + mpfr_prec_t p = atoi (argv[3]); + mpfr_t a, x; + mpfr_init2 (a, p); + mpfr_init2 (x, p); + mpfr_set_str (a, argv[1], 10, MPFR_RNDN); + mpfr_set_str (x, argv[2], 10, MPFR_RNDN); + mpfr_gamma_inc (x, a, x, MPFR_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); + printf ("\n"); + mpfr_clear (a); + mpfr_clear (x); + return 0; + } + + specials (); + + test_negint (30, 10, 53); + + for (p = MPFR_PREC_MIN; p < 100; p++) + test_random (p, 10); + + test_generic (MPFR_PREC_MIN, 100, 5); + + tests_end_mpfr (); + return 0; +} diff -Nru mpfr4-3.1.4/tests/tgeneric.c mpfr4-4.0.2/tests/tgeneric.c --- mpfr4-3.1.4/tests/tgeneric.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tgeneric.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* Generic test file for functions with one or two arguments (the second being either mpfr_t or double or unsigned long). -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Define TWO_ARGS for two-argument functions like mpfr_pow. @@ -27,10 +27,19 @@ Define ULONG_ARG1 or ULONG_ARG2 for function with an unsigned long operand in first or second place like sub_ui or ui_sub. */ +/* TODO: Add support for type long and extreme integer values, as done + in tgeneric_ui.c; then tgeneric_ui.c could probably disappear. */ + +#ifndef ONE_ARG #if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2) || \ defined(ULONG_ARG1) || defined(ULONG_ARG2) #define TWO_ARGS_ALL #endif +#endif + +#if defined(TWO_ARGS_ALL) || defined(ULONG_ARG1) || defined(ULONG_ARG2) +#define NEED_U +#endif #ifndef TEST_RANDOM_POS /* For the random function: one number on two is negative. */ @@ -61,11 +70,8 @@ #define TGENERIC_SO_TEST 1 #endif -#define STR(F) #F -#define MAKE_STR(S) STR(S) - /* The (void *) below is needed to avoid a warning with gcc 4.2+ and functions - * with 2 arguments. See . + * with 2 arguments. See . */ #define TGENERIC_FAIL(S, X, U) \ do \ @@ -98,7 +104,7 @@ #define TGENERIC_CHECK(S, EXPR) TGENERIC_CHECK_AUX(S, EXPR, 0) #endif -#ifdef DEBUG_TGENERIC +#ifdef MPFR_DEBUG_TGENERIC #define TGENERIC_IAUX(F,P,X,U) \ do \ { \ @@ -119,7 +125,7 @@ #else #define TGENERIC_INFO(F,P) TGENERIC_IAUX(F,P,x,0) #endif -#endif /* DEBUG_TGENERIC */ +#endif /* MPFR_DEBUG_TGENERIC */ /* For some functions (for example cos), the argument reduction is too expensive when using mpfr_get_emax(). Then simply define REDUCE_EMAX @@ -128,12 +134,17 @@ #define REDUCE_EMAX mpfr_get_emax () #endif +/* same for mpfr_get_emin() */ +#ifndef REDUCE_EMIN +#define REDUCE_EMIN mpfr_get_emin () +#endif + static void test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax) { mpfr_prec_t prec, xprec, yprec; - mpfr_t x, y, z, t, w; -#if defined(TWO_ARGS_ALL) + mpfr_t x, y, z, t, w, yd, yu; +#ifdef NEED_U mpfr_t u; #endif #if defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2) @@ -146,31 +157,44 @@ int inexact, compare, compare2; unsigned int n; unsigned long ctrt = 0, ctrn = 0; - int test_of = 1, test_uf = 1; mpfr_exp_t old_emin, old_emax; old_emin = mpfr_get_emin (); old_emax = mpfr_get_emax (); - mpfr_inits2 (MPFR_PREC_MIN, x, y, z, t, w, (mpfr_ptr) 0); -#if defined(TWO_ARGS_ALL) + mpfr_inits2 (MPFR_PREC_MIN, x, y, yd, yu, z, t, w, (mpfr_ptr) 0); +#ifdef NEED_U mpfr_init2 (u, MPFR_PREC_MIN); #endif /* generic test */ for (prec = p0; prec <= p1; prec++) { + /* Number of overflow/underflow tests for each precision. + Since MPFR uses several algorithms and there may also be + early overflow/underflow detection, several tests may be + needed to detect a bug. */ + int test_of = 3, test_uf = 3; + mpfr_set_prec (z, prec); mpfr_set_prec (t, prec); yprec = prec + 10; mpfr_set_prec (y, yprec); + mpfr_set_prec (yd, yprec); + mpfr_set_prec (yu, yprec); mpfr_set_prec (w, yprec); - /* Note: in precision p1, we test 4 special cases. */ - for (n = 0; n < (prec == p1 ? nmax + 4 : nmax); n++) +#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2) +#define NSPEC 9 +#else +#define NSPEC 5 +#endif + + /* Note: in precision p1, we test NSPEC special cases. */ + for (n = 0; n < (prec == p1 ? nmax + NSPEC : nmax); n++) { int infinite_input = 0; - unsigned int flags; + mpfr_flags_t flags; mpfr_exp_t oemin, oemax; xprec = prec; @@ -181,7 +205,7 @@ take a larger input precision in general, else take a smaller precision. */ xprec *= (prec < 16 ? 256.0 : 1.0) * - (double) randlimb () / MP_LIMB_T_MAX; + (double) randlimb () / MPFR_LIMB_MAX; if (xprec < MPFR_PREC_MIN) xprec = MPFR_PREC_MIN; } @@ -194,7 +218,7 @@ mpfr_set_prec (u, sizeof (unsigned long) * CHAR_BIT); #endif - if (n > 3 || prec < p1) + if (n >= NSPEC || prec < p1) { #if defined(RAND_FUNCTION) RAND_FUNCTION (x); @@ -214,33 +238,68 @@ } else { - /* Special cases tested in precision p1 if n <= 3. They are + /* Special cases tested in precision p1 if n < NSPEC. They are useful really in the extended exponent range. */ #if (defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)) && defined(MPFR_ERRDIVZERO) goto next_n; #endif set_emin (MPFR_EMIN_MIN); set_emax (MPFR_EMAX_MAX); - if (n <= 1) + if (n == 0) { - mpfr_set_si (x, n == 0 ? 1 : -1, MPFR_RNDN); - mpfr_set_exp (x, mpfr_get_emin ()); + mpfr_set_nan (x); +#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2) +#if defined(RAND_FUNCTION) + RAND_FUNCTION (u); +#else + tests_default_random (u, TEST_RANDOM_POS2, + TEST_RANDOM_EMIN, TEST_RANDOM_EMAX, + TEST_RANDOM_ALWAYS_SCALE); +#endif +#endif + } + else if (n <= 2) + { + MPFR_ASSERTN (n == 1 || n == 2); + mpfr_set_si (x, n == 1 ? 1 : -1, MPFR_RNDN); + mpfr_set_exp (x, REDUCE_EMIN); #if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2) mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, MPFR_RNDN); - mpfr_set_exp (u, mpfr_get_emin ()); + mpfr_set_exp (u, REDUCE_EMIN); #endif } - else /* 2 <= n <= 3 */ + else if (n <= 4) { - if (getenv ("MPFR_CHECK_MAX") == NULL) - goto next_n; - mpfr_set_si (x, n == 0 ? 1 : -1, MPFR_RNDN); + MPFR_ASSERTN (n == 3 || n == 4); + mpfr_set_si (x, n == 3 ? 1 : -1, MPFR_RNDN); mpfr_setmax (x, REDUCE_EMAX); #if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2) mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, MPFR_RNDN); - mpfr_setmax (u, mpfr_get_emax ()); + mpfr_setmax (u, REDUCE_EMAX); +#endif + } +#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2) + else if (n <= 6) + { + MPFR_ASSERTN (n == 5 || n == 6); + mpfr_set_si (x, n == 5 ? 1 : -1, MPFR_RNDN); + mpfr_set_exp (x, REDUCE_EMIN); +#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2) + mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, MPFR_RNDN); + mpfr_setmax (u, REDUCE_EMAX); #endif } + else + { + MPFR_ASSERTN (n == 7 || n == 8); + mpfr_set_si (x, n == 7 ? 1 : -1, MPFR_RNDN); + mpfr_setmax (x, REDUCE_EMAX); +#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2) + mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, MPFR_RNDN); + mpfr_set_exp (u, REDUCE_EMIN); +#endif + } +#endif /* two arguments */ } #if defined(ULONG_ARG1) || defined(ULONG_ARG2) @@ -255,7 +314,7 @@ rnd = RND_RAND (); mpfr_clear_flags (); -#ifdef DEBUG_TGENERIC +#ifdef MPFR_DEBUG_TGENERIC TGENERIC_INFO (TEST_FUNCTION, MPFR_PREC (y)); #endif #if defined(TWO_ARGS) @@ -270,6 +329,8 @@ compare = TEST_FUNCTION (y, x, d, rnd); /* d can be infinite due to overflow in mpfr_get_d */ infinite_input |= DOUBLE_ISINF (d); +#elif defined(ULONG_ARG1) && defined(ONE_ARG) + compare = TEST_FUNCTION (y, i, rnd); #elif defined(ULONG_ARG1) compare = TEST_FUNCTION (y, i, x, rnd); #elif defined(ULONG_ARG2) @@ -285,13 +346,61 @@ " by the tested function!\n"); exit (1); } - TGENERIC_CHECK ("bad inexact flag", - (compare != 0) ^ (mpfr_inexflag_p () == 0)); + if (rnd != MPFR_RNDF) + TGENERIC_CHECK ("bad inexact flag", + (compare != 0) ^ (mpfr_inexflag_p () == 0)); ctrt++; + /* If rnd = RNDF, check that we obtain the same result as + RNDD or RNDU. */ + if (rnd == MPFR_RNDF) + { +#if defined(TWO_ARGS) + TEST_FUNCTION (yd, x, u, MPFR_RNDD); + TEST_FUNCTION (yu, x, u, MPFR_RNDU); +#elif defined(DOUBLE_ARG1) + d = mpfr_get_d (u, MPFR_RNDD); + TEST_FUNCTION (yd, d, x, MPFR_RNDD); + d = mpfr_get_d (u, MPFR_RNDU); + TEST_FUNCTION (yu, d, x, MPFR_RNDU); +#elif defined(DOUBLE_ARG2) + d = mpfr_get_d (u, MPFR_RNDD); + TEST_FUNCTION (yd, x, d, MPFR_RNDD); + d = mpfr_get_d (u, MPFR_RNDU); + TEST_FUNCTION (yu, x, d, MPFR_RNDU); +#elif defined(ULONG_ARG1) && defined(ONE_ARG) + TEST_FUNCTION (yd, i, MPFR_RNDD); + TEST_FUNCTION (yu, i, MPFR_RNDU); +#elif defined(ULONG_ARG1) + TEST_FUNCTION (yd, i, x, MPFR_RNDD); + TEST_FUNCTION (yu, i, x, MPFR_RNDU); +#elif defined(ULONG_ARG2) + TEST_FUNCTION (yd, x, i, MPFR_RNDD); + TEST_FUNCTION (yu, x, i, MPFR_RNDU); +#else + TEST_FUNCTION (yd, x, MPFR_RNDD); + TEST_FUNCTION (yu, x, MPFR_RNDU); +#endif + if (! (SAME_VAL (y, yd) || SAME_VAL (y, yu))) + { + printf ("For RNDF, result does not match RNDD nor RNDU\n"); + printf ("x = "); mpfr_dump (x); +#ifdef NEED_U + printf ("u = "); mpfr_dump (u); +#endif +#if defined(ULONG_ARG1) || defined(ULONG_ARG2) + printf ("i = %lu\n", i); +#endif + printf ("yd (RNDD) = "); mpfr_dump (yd); + printf ("yu (RNDU) = "); mpfr_dump (yu); + printf ("y (RNDF) = "); mpfr_dump (y); + exit (1); + } + } + /* Tests in a reduced exponent range. */ { - unsigned int oldflags = flags; + mpfr_flags_t oldflags = flags; mpfr_exp_t e, emin, emax; /* Determine the smallest exponent range containing the @@ -319,12 +428,21 @@ #endif if (MPFR_IS_PURE_FP (y)) { - e = MPFR_GET_EXP (y); - if (test_of && e - 1 >= emax) + e = MPFR_GET_EXP (y); /* exponent of the result */ + + if (test_of > 0 && e - 1 >= emax) /* overflow test */ { - unsigned int ex_flags; + mpfr_flags_t ex_flags; + /* Exponent e of the result > exponents of the inputs; + let's set emax to e - 1, so that one should get an + overflow. */ mpfr_set_emax (e - 1); +#ifdef MPFR_DEBUG_TGENERIC + printf ("tgeneric: overflow test (emax = %" + MPFR_EXP_FSPEC "d)\n", + (mpfr_eexp_t) __gmpfr_emax); +#endif mpfr_clear_flags (); #if defined(TWO_ARGS) inexact = TEST_FUNCTION (w, x, u, rnd); @@ -332,6 +450,8 @@ inexact = TEST_FUNCTION (w, d, x, rnd); #elif defined(DOUBLE_ARG2) inexact = TEST_FUNCTION (w, x, d, rnd); +#elif defined(ULONG_ARG1) && defined(ONE_ARG) + inexact = TEST_FUNCTION (w, i, rnd); #elif defined(ULONG_ARG1) inexact = TEST_FUNCTION (w, i, x, rnd); #elif defined(ULONG_ARG2) @@ -342,7 +462,11 @@ flags = __gmpfr_flags; mpfr_set_emax (oemax); ex_flags = MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT; - if (flags != ex_flags) + /* For RNDF, this test makes no sense, since RNDF + might return either the maximal floating-point + value or infinity, and the flags might differ in + those two cases. */ + if (flags != ex_flags && rnd != MPFR_RNDF) { printf ("tgeneric: error for " MAKE_STR(TEST_FUNCTION) ", reduced exponent range [%" @@ -351,7 +475,7 @@ (mpfr_eexp_t) oemin, (mpfr_eexp_t) e - 1); printf ("x = "); mpfr_dump (x); -#if defined(TWO_ARGS_ALL) +#ifdef NEED_U printf ("u = "); mpfr_dump (u); #endif @@ -366,13 +490,22 @@ mpfr_dump (w); exit (1); } - test_of = 0; /* Overflow is tested only once. */ + test_of--; } - if (test_uf && e + 1 <= emin) + + if (test_uf > 0 && e + 1 <= emin) /* underflow test */ { - unsigned int ex_flags; + mpfr_flags_t ex_flags; + /* Exponent e of the result < exponents of the inputs; + let's set emin to e + 1, so that one should get an + underflow. */ mpfr_set_emin (e + 1); +#ifdef MPFR_DEBUG_TGENERIC + printf ("tgeneric: underflow test (emin = %" + MPFR_EXP_FSPEC "d)\n", + (mpfr_eexp_t) __gmpfr_emin); +#endif mpfr_clear_flags (); #if defined(TWO_ARGS) inexact = TEST_FUNCTION (w, x, u, rnd); @@ -380,6 +513,8 @@ inexact = TEST_FUNCTION (w, d, x, rnd); #elif defined(DOUBLE_ARG2) inexact = TEST_FUNCTION (w, x, d, rnd); +#elif defined(ULONG_ARG1) && defined(ONE_ARG) + inexact = TEST_FUNCTION (w, i, rnd); #elif defined(ULONG_ARG1) inexact = TEST_FUNCTION (w, i, x, rnd); #elif defined(ULONG_ARG2) @@ -390,7 +525,11 @@ flags = __gmpfr_flags; mpfr_set_emin (oemin); ex_flags = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT; - if (flags != ex_flags) + /* For RNDF, this test makes no sense, since RNDF + might return either the maximal floating-point + value or infinity, and the flags might differ in + those two cases. */ + if (flags != ex_flags && rnd != MPFR_RNDF) { printf ("tgeneric: error for " MAKE_STR(TEST_FUNCTION) ", reduced exponent range [%" @@ -399,7 +538,7 @@ (mpfr_eexp_t) e + 1, (mpfr_eexp_t) oemax); printf ("x = "); mpfr_dump (x); -#if defined(TWO_ARGS_ALL) +#ifdef NEED_U printf ("u = "); mpfr_dump (u); #endif @@ -414,15 +553,18 @@ mpfr_dump (w); exit (1); } - test_uf = 0; /* Underflow is tested only once. */ + test_uf--; } + if (e < emin) emin = e; if (e > emax) emax = e; - } + } /* MPFR_IS_PURE_FP (y) */ + if (emin > emax) emin = emax; /* case where all values are singular */ + /* Consistency test in a reduced exponent range. Doing it for the first 10 samples and for prec == p1 (which has some special cases) should be sufficient. */ @@ -430,7 +572,7 @@ { mpfr_set_emin (emin); mpfr_set_emax (emax); -#ifdef DEBUG_TGENERIC +#ifdef MPFR_DEBUG_TGENERIC /* Useful information in case of assertion failure. */ printf ("tgeneric: reduced exponent range [%" MPFR_EXP_FSPEC "d,%" MPFR_EXP_FSPEC "d]\n", @@ -443,6 +585,8 @@ inexact = TEST_FUNCTION (w, d, x, rnd); #elif defined(DOUBLE_ARG2) inexact = TEST_FUNCTION (w, x, d, rnd); +#elif defined(ULONG_ARG1) && defined(ONE_ARG) + inexact = TEST_FUNCTION (w, i, rnd); #elif defined(ULONG_ARG1) inexact = TEST_FUNCTION (w, i, x, rnd); #elif defined(ULONG_ARG2) @@ -453,7 +597,8 @@ flags = __gmpfr_flags; mpfr_set_emin (oemin); mpfr_set_emax (oemax); - if (! (SAME_VAL (w, y) && + /* That test makes no sense for RNDF. */ + if (rnd != MPFR_RNDF && ! (SAME_VAL (w, y) && SAME_SIGN (inexact, compare) && flags == oldflags)) { @@ -463,7 +608,7 @@ (mpfr_eexp_t) emin, (mpfr_eexp_t) emax); printf ("x = "); mpfr_dump (x); -#if defined(TWO_ARGS_ALL) +#ifdef NEED_U printf ("u = "); mpfr_dump (u); #endif @@ -480,8 +625,9 @@ exit (1); } } + __gmpfr_flags = oldflags; /* restore the flags */ - } + } /* tests in a reduced exponent range */ if (MPFR_IS_SINGULAR (y)) { @@ -525,7 +671,8 @@ TGENERIC_CHECK ("should have been min MPFR number (underflow)", MPFR_IS_ZERO (y)); } - else if (mpfr_can_round (y, yprec, rnd, rnd, prec)) + else if (compare == 0 || rnd == MPFR_RNDF || + mpfr_can_round (y, yprec, rnd, rnd, prec)) { ctrn++; mpfr_set (t, y, rnd); @@ -536,7 +683,7 @@ test below). */ if (randlimb () & 1) __gmpfr_flags = MPFR_FLAGS_ALL ^ MPFR_FLAGS_ERANGE; -#ifdef DEBUG_TGENERIC +#ifdef MPFR_DEBUG_TGENERIC TGENERIC_INFO (TEST_FUNCTION, MPFR_PREC (z)); #endif /* Let's increase the precision of the inputs in a random way. @@ -552,6 +699,8 @@ inexact = TEST_FUNCTION (z, d, x, rnd); #elif defined(DOUBLE_ARG2) inexact = TEST_FUNCTION (z, x, d, rnd); +#elif defined(ULONG_ARG1) && defined(ONE_ARG) + inexact = TEST_FUNCTION (z, i, rnd); #elif defined(ULONG_ARG1) inexact = TEST_FUNCTION (z, i, x, rnd); #elif defined(ULONG_ARG2) @@ -561,12 +710,12 @@ #endif if (mpfr_erangeflag_p ()) goto next_n; - if (! mpfr_equal_p (t, z)) + if (! mpfr_equal_p (t, z) && rnd != MPFR_RNDF) { printf ("tgeneric: results differ for " MAKE_STR(TEST_FUNCTION) " on\n x = "); mpfr_dump (x); -#if defined(TWO_ARGS_ALL) +#ifdef NEED_U printf (" u = "); mpfr_dump (u); #endif @@ -587,13 +736,13 @@ compare = compare + compare2; else compare = inexact; /* cannot determine sign(t-f(x)) */ - if (! SAME_SIGN (inexact, compare)) + if (! SAME_SIGN (inexact, compare) && rnd != MPFR_RNDF) { printf ("Wrong inexact flag for rnd=%s: expected %d, got %d" "\n", mpfr_print_rnd_mode (rnd), compare, inexact); printf ("x = "); mpfr_dump (x); -#if defined(TWO_ARGS_ALL) +#ifdef NEED_U printf ("u = "); mpfr_dump (u); #endif @@ -619,7 +768,7 @@ mpfr_print_rnd_mode (rnd)); printf ("x = "); mpfr_dump (x); -#if defined(TWO_ARGS_ALL) +#ifdef NEED_U printf ("u = "); mpfr_dump (u); #endif @@ -641,8 +790,8 @@ ctrn, ctrt); #endif - mpfr_clears (x, y, z, t, w, (mpfr_ptr) 0); -#if defined(TWO_ARGS_ALL) + mpfr_clears (x, y, yd, yu, z, t, w, (mpfr_ptr) 0); +#ifdef NEED_U mpfr_clear (u); #endif } @@ -655,9 +804,11 @@ #undef RAND_FUNCTION #undef TWO_ARGS #undef TWO_ARGS_ALL +#undef NEED_U #undef DOUBLE_ARG1 #undef DOUBLE_ARG2 #undef ULONG_ARG1 #undef ULONG_ARG2 #undef TEST_FUNCTION #undef test_generic +#undef NSPEC diff -Nru mpfr4-3.1.4/tests/tgeneric_ui.c mpfr4-4.0.2/tests/tgeneric_ui.c --- mpfr4-3.1.4/tests/tgeneric_ui.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tgeneric_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Generic test file for functions with one mpfr_t argument and an integer. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* define INTEGER_TYPE to what we want */ @@ -74,7 +74,7 @@ else /* unsigned */ u = n == 2 ? 0 : -1; } - rnd = RND_RAND (); + rnd = RND_RAND_NO_RNDF (); mpfr_set_prec (y, yprec); compare = TEST_FUNCTION (y, x, u, rnd); if (mpfr_can_round (y, yprec, rnd, rnd, prec)) @@ -92,14 +92,11 @@ printf ("Function: %s\n", TEST_FUNCTION_NAME); #endif printf ("got "); - mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); - puts (""); + mpfr_dump (z); printf ("expected "); - mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); - puts (""); - printf ("approx "); - mpfr_print_binary (y); - puts (""); + mpfr_dump (t); + printf ("approx "); + mpfr_dump (y); exit (1); } compare2 = mpfr_cmp (t, y); @@ -109,7 +106,7 @@ compare = compare + compare2; else compare = inexact; /* cannot determine sign(t-f(x)) */ - if (! SAME_SIGN (inexact, compare)) + if (! SAME_SIGN (inexact, compare) && rnd != MPFR_RNDF) { printf ("Wrong inexact flag for rnd=%s: expected %d, got %d" "\n", mpfr_print_rnd_mode (rnd), compare, inexact); diff -Nru mpfr4-3.1.4/tests/tget_d_2exp.c mpfr4-4.0.2/tests/tget_d_2exp.c --- mpfr4-3.1.4/tests/tget_d_2exp.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tget_d_2exp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test mpfr_get_d_2exp. -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include #include "mpfr-test.h" @@ -80,8 +78,7 @@ static void check_inf_nan (void) { - /* only if nans and infs are available */ -#if _GMP_IEEE_FLOATS +#if !defined(MPFR_ERRDIVZERO) mpfr_t x; double d; long exp; diff -Nru mpfr4-3.1.4/tests/tget_d.c mpfr4-4.0.2/tests/tget_d.c --- mpfr4-3.1.4/tests/tget_d.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tget_d.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_get_d -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include #include "mpfr-test.h" @@ -91,7 +89,7 @@ check_inf_nan (void) { /* only if nans and infs are available */ -#if _GMP_IEEE_FLOATS && !defined(MPFR_ERRDIVZERO) +#if !defined(MPFR_ERRDIVZERO) mpfr_t x; double d; @@ -141,7 +139,7 @@ MPFR_ASSERTN(d == -DBL_MAX); d = mpfr_get_d (u, MPFR_RNDU); MPFR_ASSERTN(d == -DBL_MAX); -#if _GMP_IEEE_FLOATS && !defined(MPFR_ERRDIVZERO) +#if !defined(MPFR_ERRDIVZERO) d = mpfr_get_d (u, MPFR_RNDN); MPFR_ASSERTN(DOUBLE_ISINF(d) && d < 0.0); d = mpfr_get_d (u, MPFR_RNDD); @@ -153,7 +151,7 @@ MPFR_ASSERTN(d == DBL_MAX); d = mpfr_get_d (u, MPFR_RNDD); MPFR_ASSERTN(d == DBL_MAX); -#if _GMP_IEEE_FLOATS && !defined(MPFR_ERRDIVZERO) +#if !defined(MPFR_ERRDIVZERO) d = mpfr_get_d (u, MPFR_RNDN); MPFR_ASSERTN(DOUBLE_ISINF(d) && d > 0.0); d = mpfr_get_d (u, MPFR_RNDU); diff -Nru mpfr4-3.1.4/tests/tget_f.c mpfr4-4.0.2/tests/tget_f.c --- mpfr4-3.1.4/tests/tget_f.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tget_f.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_get_f. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,15 +17,14 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include - +#define MPFR_NEED_MPF_INTERNALS #include "mpfr-test.h" +#ifndef MPFR_USE_MINI_GMP + /* Test that there is no lost of accuracy when converting a mpfr_t number into a mpf_t number (test with various precisions and exponents). */ static void @@ -178,7 +177,7 @@ mpf_init2 (x, 256); mpfr_init2 (y, 256); - for (prec = 2; prec <= 256; prec++) + for (prec = MPFR_PREC_MIN; prec <= 256; prec++) { mpf_set_prec (x, prec); @@ -187,77 +186,77 @@ /* y == 1 */ mpfr_set_ui_2exp (y, 1, prec, MPFR_RNDN); - RND_LOOP (rnd) - { - inex = mpfr_get_f (x, y, (mpfr_rnd_t) rnd); - - if (inex != 0 || mpfr_cmp_f (y, x) !=0) - { - printf ("Error in mpfr_get_f (x, y, %s)\nx = ", - mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpf_out_str (stdout, 2, 0, x); - printf ("\ny = "); - mpfr_dump (y); - if (inex != 0) - printf ("got ternary value = %+d, expected: 0\n", inex); - - exit (1); - } - } + RND_LOOP_NO_RNDF (rnd) + { + inex = mpfr_get_f (x, y, (mpfr_rnd_t) rnd); + + if (inex != 0 || mpfr_cmp_f (y, x) != 0) + { + printf ("Error (1) in mpfr_get_f (x, y, %s)\nx = ", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpf_out_str (stdout, 2, 0, x); + printf ("\ny = "); + mpfr_dump (y); + if (inex != 0) + printf ("got ternary value = %+d, expected: 0\n", inex); + + exit (1); + } + } /* y == 1 + epsilon */ mpfr_nextbelow (y); - RND_LOOP (rnd) - { - switch (rnd) - { - case MPFR_RNDU: case MPFR_RNDA: - case MPFR_RNDN: - expected_inex = +1; - break; - default : - expected_inex = -1; - } - - inex = mpfr_get_f (x, y, (mpfr_rnd_t) rnd); - - if (! SAME_SIGN (expected_inex, inex) - || SAME_SIGN (expected_inex, mpfr_cmp_f (y, x))) - { - printf ("Error in mpfr_get_f (x, y, %s)\nx = ", - mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpf_out_str (stdout, 2, 0, x); - printf ("\ny = "); - mpfr_dump (y); - if (! SAME_SIGN (expected_inex, inex)) - printf ("got ternary value = %+d, expected: %+d\n", - inex, expected_inex); + RND_LOOP_NO_RNDF (rnd) + { + switch (rnd) + { + case MPFR_RNDU: case MPFR_RNDA: + case MPFR_RNDN: + expected_inex = +1; + break; + default : + expected_inex = -1; + } - exit (1); - } - } + inex = mpfr_get_f (x, y, (mpfr_rnd_t) rnd); + + if (! SAME_SIGN (expected_inex, inex) + || SAME_SIGN (expected_inex, mpfr_cmp_f (y, x))) + { + printf ("Error (2) in mpfr_get_f (x, y, %s)\nx = ", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpf_out_str (stdout, 2, 0, x); + printf ("\ny = "); + mpfr_dump (y); + if (! SAME_SIGN (expected_inex, inex)) + printf ("got ternary value = %+d, expected: %+d\n", + inex, expected_inex); + + exit (1); + } + } /* y == positive random float */ mpfr_random2 (y, MPFR_LIMB_SIZE (y), 1024, RANDS); - RND_LOOP (rnd) - { - inex = mpfr_get_f (x, y, (mpfr_rnd_t) rnd); - - if (! SAME_SIGN (inex, -mpfr_cmp_f (y, x))) - { - printf ("Error in mpfr_get_f (x, y, %s)\nx = ", - mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpf_out_str (stdout, 2, 0, x); - printf ("\ny = "); - mpfr_dump (y); - printf ("got ternary value = %+d, expected: %+d\n", - inex, -mpfr_cmp_f (y, x)); - - exit (1); - } - } + RND_LOOP_NO_RNDF (rnd) + { + inex = mpfr_get_f (x, y, (mpfr_rnd_t) rnd); + + if (! SAME_SIGN (inex, -mpfr_cmp_f (y, x))) + { + printf ("Error (3) in mpfr_get_f (x, y, %s)\nx = ", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpf_out_str (stdout, 2, 0, x); + printf ("\ny = "); + mpfr_dump (y); + printf ("got ternary value = %+d, expected: %+d\n", + inex, -mpfr_cmp_f (y, x)); + + exit (1); + } + } } mpf_clear (x); @@ -388,3 +387,13 @@ tests_end_mpfr (); return 0; } + +#else + +int +main (void) +{ + return 77; +} + +#endif diff -Nru mpfr4-3.1.4/tests/tget_flt.c mpfr4-4.0.2/tests/tget_flt.c --- mpfr4-3.1.4/tests/tget_flt.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tget_flt.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_get_flt and mpfr_set_flt -Copyright 2009-2016 Free Software Foundation, Inc. +Copyright 2009-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,35 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include #include /* for FLT_MIN */ + #include "mpfr-test.h" +/* return non-zero iff f == g, and if both are zero check the sign */ +static int +equal_flt (float f, float g) +{ + if (f != 0.0) + return f == g; + else if (g != 0) + return 0; + else /* f = g = 0: check they have the same sign */ + { + int sf, sg; + mpfr_t z; + mpfr_init2 (z, MPFR_PREC_MIN); + mpfr_set_flt (z, f, MPFR_RNDN); + sf = mpfr_signbit (z); + mpfr_set_flt (z, g, MPFR_RNDN); + sg = mpfr_signbit (z); + mpfr_clear (z); + return !sf == !sg; + } +} + int main (void) { @@ -93,7 +115,7 @@ mpfr_set_ui (x, 0, MPFR_RNDN); f = mpfr_get_flt (x, MPFR_RNDN); mpfr_set_flt (x, f, MPFR_RNDN); - if (mpfr_zero_p (x) == 0 || MPFR_SIGN (x) < 0) + if (mpfr_zero_p (x) == 0 || MPFR_IS_NEG (x)) { printf ("Error for mpfr_set_flt(mpfr_get_flt(+0))\n"); exit (1); @@ -104,7 +126,7 @@ mpfr_neg (x, x, MPFR_RNDN); f = mpfr_get_flt (x, MPFR_RNDN); mpfr_set_flt (x, f, MPFR_RNDN); - if (mpfr_zero_p (x) == 0 || MPFR_SIGN (x) > 0) + if (mpfr_zero_p (x) == 0 || MPFR_IS_POS (x)) { printf ("Error for mpfr_set_flt(mpfr_get_flt(-0))\n"); exit (1); @@ -186,161 +208,233 @@ mpfr_mul_2exp (x, x, 1, MPFR_RNDN); } -#ifdef HAVE_DENORMS - mpfr_set_si_2exp (x, 1, -150, MPFR_RNDN); - g = 0.0; - f = mpfr_get_flt (x, MPFR_RNDN); - if (f != g) +#ifdef HAVE_DENORMS_FLT + for (i = 0; i < 2; i++) { - printf ("Error for mpfr_get_flt(2^(-150),RNDN)\n"); - printf ("expected %.8e, got %.8e\n", g, f); - exit (1); + mpfr_set_si_2exp (x, 1, -150, MPFR_RNDN); + g = 0.0; + if (i == 1) + { + mpfr_neg (x, x, MPFR_RNDN); + g = -g; + } + f = mpfr_get_flt (x, MPFR_RNDN); + if (!equal_flt (f, g)) + { + printf ("Error for mpfr_get_flt(2^(-150),RNDN)\n"); + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } + f = mpfr_get_flt (x, MPFR_RNDZ); + if (!equal_flt (f, g)) + { + printf ("Error for mpfr_get_flt(2^(-150),RNDZ)\n"); + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } + f = mpfr_get_flt (x, (i == 0) ? MPFR_RNDD : MPFR_RNDU); + if (!equal_flt (f, g)) + { + printf ("Error for mpfr_get_flt(2^(-150),%s)\n", + (i == 0) ? "RNDD" : "RNDU"); + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } + g = FLT_MIN * FLT_EPSILON; + if (i == 1) + g = -g; + f = mpfr_get_flt (x, (i == 0) ? MPFR_RNDU : MPFR_RNDD); + if (!equal_flt (f, g)) + { + printf ("Error for mpfr_get_flt(2^(-150),%s)\n", + (i == 0) ? "RNDU" : "RNDD"); + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } + f = mpfr_get_flt (x, MPFR_RNDA); + if (!equal_flt (f, g)) + { + printf ("Error for mpfr_get_flt(2^(-150),RNDA)\n"); + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } + + mpfr_set_si_2exp (x, 1, -151, MPFR_RNDN); + g = 0.0; + if (i == 1) + { + mpfr_neg (x, x, MPFR_RNDN); + g = -g; + } + f = mpfr_get_flt (x, MPFR_RNDN); + if (!equal_flt (f, g)) + { + printf ("Error for mpfr_get_flt(2^(-151),RNDN)\n"); + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } + f = mpfr_get_flt (x, MPFR_RNDZ); + if (!equal_flt (f, g)) + { + printf ("Error for mpfr_get_flt(2^(-151),RNDZ)\n"); + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } + f = mpfr_get_flt (x, (i == 0) ? MPFR_RNDD : MPFR_RNDU); + if (!equal_flt (f, g)) + { + printf ("Error for mpfr_get_flt(2^(-151),%s)\n", + (i == 0) ? "RNDD" : "RNDU"); + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } + g = FLT_MIN * FLT_EPSILON; + if (i == 1) + g = -g; + f = mpfr_get_flt (x, (i == 0) ? MPFR_RNDU : MPFR_RNDD); + if (!equal_flt (f, g)) + { + printf ("Error for mpfr_get_flt(2^(-151),%s)\n", + (i == 0) ? "RNDU" : "RNDD"); + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } + f = mpfr_get_flt (x, MPFR_RNDA); + if (!equal_flt (f, g)) + { + printf ("Error for mpfr_get_flt(2^(-151),RNDA)\n"); + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } + + mpfr_set_si_2exp (x, 1, -149, MPFR_RNDN); + g = FLT_MIN * FLT_EPSILON; + if (i == 1) + { + mpfr_neg (x, x, MPFR_RNDN); + g = -g; + } + f = mpfr_get_flt (x, MPFR_RNDN); + if (!equal_flt (f, g)) + { + printf ("Error for mpfr_get_flt(2^(-149),RNDN)\n"); + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } + f = mpfr_get_flt (x, MPFR_RNDZ); + if (!equal_flt (f, g)) + { + printf ("Error for mpfr_get_flt(2^(-149),RNDZ)\n"); + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } + f = mpfr_get_flt (x, MPFR_RNDD); + if (!equal_flt (f, g)) + { + printf ("Error for mpfr_get_flt(2^(-149),RNDD)\n"); + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } + f = mpfr_get_flt (x, MPFR_RNDU); + if (!equal_flt (f, g)) + { + printf ("Error for mpfr_get_flt(2^(-149),RNDU)\n"); + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } + f = mpfr_get_flt (x, MPFR_RNDA); + if (!equal_flt (f, g)) + { + printf ("Error for mpfr_get_flt(2^(-149),RNDA)\n"); + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } } +#endif /* HAVE_DENORMS_FLT */ + + mpfr_set_si_2exp (x, 1, 128, MPFR_RNDN); + g = FLT_MAX; f = mpfr_get_flt (x, MPFR_RNDZ); if (f != g) { - printf ("Error for mpfr_get_flt(2^(-150),RNDZ)\n"); + printf ("Error for mpfr_get_flt(2^128,RNDZ)\n"); printf ("expected %.8e, got %.8e\n", g, f); exit (1); } f = mpfr_get_flt (x, MPFR_RNDD); if (f != g) { - printf ("Error for mpfr_get_flt(2^(-150),RNDD)\n"); - printf ("expected %.8e, got %.8e\n", g, f); - exit (1); - } - g = FLT_MIN * FLT_EPSILON; - f = mpfr_get_flt (x, MPFR_RNDU); - if (f != g) - { - printf ("Error for mpfr_get_flt(2^(-150),RNDU)\n"); - printf ("expected %.8e, got %.8e\n", g, f); - exit (1); - } - f = mpfr_get_flt (x, MPFR_RNDA); - if (f != g) - { - printf ("Error for mpfr_get_flt(2^(-150),RNDA)\n"); + printf ("Error for mpfr_get_flt(2^128,RNDD)\n"); printf ("expected %.8e, got %.8e\n", g, f); exit (1); } - mpfr_set_si_2exp (x, 1, -151, MPFR_RNDN); - g = 0.0; - f = mpfr_get_flt (x, MPFR_RNDN); - if (f != g) - { - printf ("Error for mpfr_get_flt(2^(-151),RNDN)\n"); - printf ("expected %.8e, got %.8e\n", g, f); - exit (1); - } + /* same for negative x */ + mpfr_set_si_2exp (x, -1, 128, MPFR_RNDN); + g = -FLT_MAX; f = mpfr_get_flt (x, MPFR_RNDZ); if (f != g) { - printf ("Error for mpfr_get_flt(2^(-151),RNDZ)\n"); - printf ("expected %.8e, got %.8e\n", g, f); - exit (1); - } - f = mpfr_get_flt (x, MPFR_RNDD); - if (f != g) - { - printf ("Error for mpfr_get_flt(2^(-151),RNDD)\n"); + printf ("Error for mpfr_get_flt(-2^128,RNDZ)\n"); printf ("expected %.8e, got %.8e\n", g, f); exit (1); } - g = FLT_MIN * FLT_EPSILON; f = mpfr_get_flt (x, MPFR_RNDU); if (f != g) { - printf ("Error for mpfr_get_flt(2^(-151),RNDU)\n"); - printf ("expected %.8e, got %.8e\n", g, f); - exit (1); - } - f = mpfr_get_flt (x, MPFR_RNDA); - if (f != g) - { - printf ("Error for mpfr_get_flt(2^(-151),RNDA)\n"); + printf ("Error for mpfr_get_flt(-2^128,RNDD)\n"); printf ("expected %.8e, got %.8e\n", g, f); exit (1); } - mpfr_set_si_2exp (x, 1, -149, MPFR_RNDN); - g = FLT_MIN * FLT_EPSILON; - f = mpfr_get_flt (x, MPFR_RNDN); - if (f != g) - { - printf ("Error for mpfr_get_flt(2^(-149),RNDN)\n"); - printf ("expected %.8e, got %.8e\n", g, f); - exit (1); - } - f = mpfr_get_flt (x, MPFR_RNDZ); - if (f != g) - { - printf ("Error for mpfr_get_flt(2^(-149),RNDZ)\n"); - printf ("expected %.8e, got %.8e\n", g, f); - exit (1); - } - f = mpfr_get_flt (x, MPFR_RNDD); +#if !defined(MPFR_ERRDIVZERO) + mpfr_set_si_2exp (x, 1, 128, MPFR_RNDN); + f = mpfr_get_flt (x, MPFR_RNDN); /* 2^128 rounds to itself with extended + exponent range, we should get +Inf */ + g = infp; if (f != g) { - printf ("Error for mpfr_get_flt(2^(-149),RNDD)\n"); + printf ("Error for mpfr_get_flt(2^128,RNDN)\n"); printf ("expected %.8e, got %.8e\n", g, f); exit (1); } f = mpfr_get_flt (x, MPFR_RNDU); if (f != g) { - printf ("Error for mpfr_get_flt(2^(-149),RNDU)\n"); + printf ("Error for mpfr_get_flt(2^128,RNDU)\n"); printf ("expected %.8e, got %.8e\n", g, f); exit (1); } f = mpfr_get_flt (x, MPFR_RNDA); if (f != g) { - printf ("Error for mpfr_get_flt(2^(-149),RNDA)\n"); + printf ("Error for mpfr_get_flt(2^128,RNDA)\n"); printf ("expected %.8e, got %.8e\n", g, f); exit (1); } -#endif - mpfr_set_si_2exp (x, 1, 128, MPFR_RNDN); - g = FLT_MAX; - f = mpfr_get_flt (x, MPFR_RNDZ); - if (f != g) - { - printf ("Error for mpfr_get_flt(2^128,RNDZ)\n"); - printf ("expected %.8e, got %.8e\n", g, f); - exit (1); - } - f = mpfr_get_flt (x, MPFR_RNDD); - if (f != g) - { - printf ("Error for mpfr_get_flt(2^128,RNDD)\n"); - printf ("expected %.8e, got %.8e\n", g, f); - exit (1); - } -#if !defined(MPFR_ERRDIVZERO) - f = mpfr_get_flt (x, MPFR_RNDN); /* 2^128 rounds to itself with extended + /* same for negative x */ + mpfr_set_si_2exp (x, -1, 128, MPFR_RNDN); + f = mpfr_get_flt (x, MPFR_RNDN); /* -2^128 rounds to itself with extended exponent range, we should get +Inf */ - g = infp; + g = -infp; if (f != g) { - printf ("Error for mpfr_get_flt(2^128,RNDN)\n"); + printf ("Error for mpfr_get_flt(-2^128,RNDN)\n"); printf ("expected %.8e, got %.8e\n", g, f); exit (1); } - f = mpfr_get_flt (x, MPFR_RNDU); + f = mpfr_get_flt (x, MPFR_RNDD); if (f != g) { - printf ("Error for mpfr_get_flt(2^128,RNDU)\n"); + printf ("Error for mpfr_get_flt(-2^128,RNDD)\n"); printf ("expected %.8e, got %.8e\n", g, f); exit (1); } f = mpfr_get_flt (x, MPFR_RNDA); if (f != g) { - printf ("Error for mpfr_get_flt(2^128,RNDA)\n"); + printf ("Error for mpfr_get_flt(-2^128,RNDA)\n"); printf ("expected %.8e, got %.8e\n", g, f); exit (1); } diff -Nru mpfr4-3.1.4/tests/tget_ld_2exp.c mpfr4-4.0.2/tests/tget_ld_2exp.c --- mpfr4-3.1.4/tests/tget_ld_2exp.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tget_ld_2exp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test mpfr_get_ld_2exp. -Copyright 2006-2016 Free Software Foundation, Inc. +Copyright 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include #include "mpfr-test.h" @@ -79,8 +77,7 @@ static void check_inf_nan (void) { - /* only if nans and infs are available */ -#if _GMP_IEEE_FLOATS +#if !defined(MPFR_ERRDIVZERO) mpfr_t x; double d; long exp; diff -Nru mpfr4-3.1.4/tests/tget_q.c mpfr4-4.0.2/tests/tget_q.c --- mpfr4-3.1.4/tests/tget_q.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/tget_q.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,181 @@ +/* Test file for mpfr_get_q. + +Copyright 2017-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-test.h" + +#ifndef MPFR_USE_MINI_GMP + +static void +special (void) +{ + mpfr_t f; + mpq_t q; + + mpfr_init2 (f, MPFR_PREC_MIN); + mpq_init (q); + + /* check NaN */ + mpfr_set_nan (f); + mpfr_clear_erangeflag (); + mpfr_get_q (q, f); + MPFR_ASSERTN(mpq_cmp_ui (q, 0, 1) == 0); + MPFR_ASSERTN(mpfr_erangeflag_p ()); + + /* check +Inf */ + mpfr_set_inf (f, 1); + mpfr_clear_erangeflag (); + mpfr_get_q (q, f); + MPFR_ASSERTN(mpq_cmp_ui (q, 0, 1) == 0); + MPFR_ASSERTN(mpfr_erangeflag_p ()); + + /* check -Inf */ + mpfr_set_inf (f, -1); + mpfr_clear_erangeflag (); + mpfr_get_q (q, f); + MPFR_ASSERTN(mpq_cmp_ui (q, 0, 1) == 0); + MPFR_ASSERTN(mpfr_erangeflag_p ()); + + /* check +0 */ + mpfr_set_zero (f, 1); + mpfr_clear_erangeflag (); + mpfr_get_q (q, f); + MPFR_ASSERTN(mpq_cmp_ui (q, 0, 1) == 0); + MPFR_ASSERTN(!mpfr_erangeflag_p ()); + + /* check -0 */ + mpfr_set_zero (f, -1); + mpfr_clear_erangeflag (); + mpfr_get_q (q, f); + MPFR_ASSERTN(mpq_cmp_ui (q, 0, 1) == 0); + MPFR_ASSERTN(!mpfr_erangeflag_p ()); + + mpq_clear (q); + mpfr_clear (f); +} + +static void +random_tests (void) +{ + mpfr_t f, g; + mpq_t q; + int inex; + mpfr_rnd_t rnd; + int i; + + mpfr_init2 (f, MPFR_PREC_MIN + (randlimb() % 100)); + mpfr_init2 (g, mpfr_get_prec (f)); + mpq_init (q); + + for (i = 0; i < 1000; i++) + { + mpfr_urandomb (f, RANDS); + mpfr_get_q (q, f); + rnd = RND_RAND (); + inex = mpfr_set_q (g, q, rnd); + MPFR_ASSERTN(inex == 0); + MPFR_ASSERTN(mpfr_cmp (f, g) == 0); + } + + mpq_clear (q); + mpfr_clear (f); + mpfr_clear (g); +} + +/* Check results are in canonical form. + See https://sympa.inria.fr/sympa/arc/mpfr/2017-12/msg00029.html */ +static void +check_canonical (void) +{ + mpfr_t x; + mpq_t q; + mpz_t z; + + mpfr_init2 (x, 53); + mpfr_set_ui (x, 3, MPFR_RNDN); + mpq_init (q); + mpfr_get_q (q, x); + /* check the denominator is positive */ + if (mpz_sgn (mpq_denref (q)) <= 0) + { + printf ("Error, the denominator of mpfr_get_q should be positive\n"); + exit (1); + } + mpz_init (z); + mpz_gcd (z, mpq_numref (q), mpq_denref (q)); + /* check the numerator and denominator are coprime */ + if (mpz_cmp_ui (z, 1) != 0) + { + printf ("Error, numerator and denominator of mpfr_get_q should be coprime\n"); + exit (1); + } + mpfr_clear (x); + mpq_clear (q); + mpz_clear (z); +} + +static void +coverage (void) +{ + mpfr_t x; + mpq_t q; + mpz_t z; + + mpfr_init2 (x, 5); + mpq_init (q); + mpz_init (z); + + mpfr_set_ui_2exp (x, 17, 100, MPFR_RNDN); + mpfr_get_q (q, x); + MPFR_ASSERTN(mpz_cmp_ui (mpq_denref (q), 1) == 0); + mpz_set_ui (z, 17); + mpz_mul_2exp (z, z, 100); + MPFR_ASSERTN(mpz_cmp (mpq_numref (q), z) == 0); + + mpfr_clear (x); + mpq_clear (q); + mpz_clear (z); +} + +int +main (void) +{ + tests_start_mpfr (); + + coverage (); + special (); + random_tests (); + + check_canonical (); + + tests_end_mpfr (); + return 0; +} + +#else + +int +main (void) +{ + return 77; +} + +#endif /* MPFR_USE_MINI_GMP */ diff -Nru mpfr4-3.1.4/tests/tget_set_d64.c mpfr4-4.0.2/tests/tget_set_d64.c --- mpfr4-3.1.4/tests/tget_set_d64.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tget_set_d64.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_get_decimal64 and mpfr_set_decimal64. -Copyright 2006-2016 Free Software Foundation, Inc. +Copyright 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,24 +17,27 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* Needed due to the test on MPFR_WANT_DECIMAL_FLOATS */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #ifdef MPFR_WANT_DECIMAL_FLOATS -#include /* for exit */ #include "mpfr-test.h" #ifndef DEC64_MAX # define DEC64_MAX 9.999999999999999E384dd #endif -/* #define DEBUG */ - +#if _MPFR_IEEE_FLOATS static void print_decimal64 (_Decimal64 d) { - union ieee_double_extract x; + union mpfr_ieee_double_extract x; union ieee_double_decimal64 y; unsigned int Gh, i; @@ -52,9 +55,33 @@ printf ("%d", (x.s.manl >> (i - 1)) & 1); printf ("|\n"); } +#else +/* Portable version, assuming long double has at least 55 bits. + Note: __STDC_WANT_IEC_60559_DFP_EXT__ or __STDC_WANT_DEC_FP__ + might allow to use printf("%.15De\n", d) */ +static void +print_decimal64 (_Decimal64 d) +{ + printf ("%.15Le\n", (long double) d); +} +#endif /* _MPFR_IEEE_FLOATS */ + +#define PRINT_ERR_MISC(V) \ + do \ + { \ + printf ("Error in check_misc for %s.\n", V); \ + printf (" mpfr_get_decimal64() returned: "); \ + print_decimal64 (d); \ + printf (" mpfr_set_decimal64() set x to: "); \ + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); \ + printf (" approx.\n = "); \ + mpfr_dump (x); \ + exit (1); \ + } \ + while (0) static void -check_inf_nan (void) +check_misc (void) { mpfr_t x, y; _Decimal64 d; @@ -62,6 +89,7 @@ mpfr_init2 (x, 123); mpfr_init2 (y, 123); +#if !defined(MPFR_ERRDIVZERO) mpfr_set_nan (x); d = mpfr_get_decimal64 (x, MPFR_RNDZ); mpfr_set_ui (x, 1, MPFR_RNDZ); @@ -72,57 +100,67 @@ d = mpfr_get_decimal64 (x, MPFR_RNDZ); mpfr_set_ui (x, 1, MPFR_RNDZ); mpfr_set_decimal64 (x, d, MPFR_RNDZ); - MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) > 0); + if (! mpfr_inf_p (x) || MPFR_IS_NEG (x)) + PRINT_ERR_MISC ("+Inf"); mpfr_set_inf (x, -1); d = mpfr_get_decimal64 (x, MPFR_RNDZ); mpfr_set_ui (x, 1, MPFR_RNDZ); mpfr_set_decimal64 (x, d, MPFR_RNDZ); - MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0); + if (! mpfr_inf_p (x) || MPFR_IS_POS (x)) + PRINT_ERR_MISC ("-Inf"); +#endif mpfr_set_ui (x, 0, MPFR_RNDZ); d = mpfr_get_decimal64 (x, MPFR_RNDZ); mpfr_set_ui (x, 1, MPFR_RNDZ); mpfr_set_decimal64 (x, d, MPFR_RNDZ); - MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_SIGN (x) > 0); + if (MPFR_NOTZERO (x) || MPFR_IS_NEG (x)) + PRINT_ERR_MISC ("+0"); mpfr_set_ui (x, 0, MPFR_RNDZ); mpfr_neg (x, x, MPFR_RNDZ); d = mpfr_get_decimal64 (x, MPFR_RNDZ); mpfr_set_ui (x, 1, MPFR_RNDZ); mpfr_set_decimal64 (x, d, MPFR_RNDZ); - MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_SIGN (x) < 0); + if (MPFR_NOTZERO (x) || MPFR_IS_POS (x)) + PRINT_ERR_MISC ("-0"); mpfr_set_ui (x, 1, MPFR_RNDZ); d = mpfr_get_decimal64 (x, MPFR_RNDZ); mpfr_set_ui (x, 0, MPFR_RNDZ); mpfr_set_decimal64 (x, d, MPFR_RNDZ); - MPFR_ASSERTN (mpfr_cmp_ui (x, 1) == 0); + if (mpfr_cmp_ui (x, 1) != 0) + PRINT_ERR_MISC ("+1"); mpfr_set_si (x, -1, MPFR_RNDZ); d = mpfr_get_decimal64 (x, MPFR_RNDZ); mpfr_set_ui (x, 0, MPFR_RNDZ); mpfr_set_decimal64 (x, d, MPFR_RNDZ); - MPFR_ASSERTN (mpfr_cmp_si (x, -1) == 0); + if (mpfr_cmp_si (x, -1) != 0) + PRINT_ERR_MISC ("-1"); mpfr_set_ui (x, 2, MPFR_RNDZ); d = mpfr_get_decimal64 (x, MPFR_RNDZ); mpfr_set_ui (x, 0, MPFR_RNDZ); mpfr_set_decimal64 (x, d, MPFR_RNDZ); - MPFR_ASSERTN (mpfr_cmp_ui (x, 2) == 0); + if (mpfr_cmp_ui (x, 2) != 0) + PRINT_ERR_MISC ("2"); mpfr_set_ui (x, 99, MPFR_RNDZ); d = mpfr_get_decimal64 (x, MPFR_RNDZ); mpfr_set_ui (x, 0, MPFR_RNDZ); mpfr_set_decimal64 (x, d, MPFR_RNDZ); - MPFR_ASSERTN (mpfr_cmp_ui (x, 99) == 0); + if (mpfr_cmp_ui (x, 99) != 0) + PRINT_ERR_MISC ("99"); mpfr_set_str (x, "9999999999999999", 10, MPFR_RNDZ); mpfr_set (y, x, MPFR_RNDZ); d = mpfr_get_decimal64 (x, MPFR_RNDZ); mpfr_set_ui (x, 0, MPFR_RNDZ); mpfr_set_decimal64 (x, d, MPFR_RNDZ); - MPFR_ASSERTN (mpfr_cmp (x, y) == 0); + if (! mpfr_equal_p (x, y)) + PRINT_ERR_MISC ("9999999999999999"); /* smallest normal number */ mpfr_set_str (x, "1E-383", 10, MPFR_RNDU); @@ -130,7 +168,8 @@ d = mpfr_get_decimal64 (x, MPFR_RNDZ); mpfr_set_ui (x, 0, MPFR_RNDZ); mpfr_set_decimal64 (x, d, MPFR_RNDU); - MPFR_ASSERTN (mpfr_cmp (x, y) == 0); + if (! mpfr_equal_p (x, y)) + PRINT_ERR_MISC ("1E-383"); /* smallest subnormal number */ mpfr_set_str (x, "1E-398", 10, MPFR_RNDU); @@ -138,7 +177,49 @@ d = mpfr_get_decimal64 (x, MPFR_RNDZ); mpfr_set_ui (x, 0, MPFR_RNDZ); mpfr_set_decimal64 (x, d, MPFR_RNDU); - MPFR_ASSERTN (mpfr_cmp (x, y) == 0); + if (! mpfr_equal_p (x, y)) + PRINT_ERR_MISC ("1E-398"); + + /* exercise case e < -1323, i.e., x < 0.5*2^(-1323) */ + mpfr_set_ui_2exp (x, 1, -1324, MPFR_RNDN); + mpfr_nextbelow (x); + d = mpfr_get_decimal64 (x, MPFR_RNDZ); + /* d should equal +0 */ + mpfr_set_decimal64 (x, d, MPFR_RNDN); + MPFR_ASSERTN(mpfr_zero_p (x) && mpfr_signbit (x) == 0); + /* check RNDA */ + mpfr_set_ui_2exp (x, 1, -1324, MPFR_RNDN); + mpfr_nextbelow (x); + d = mpfr_get_decimal64 (x, MPFR_RNDA); + /* d should equal 1E-398 */ + mpfr_set_decimal64 (x, d, MPFR_RNDN); + mpfr_set_str (y, "1E-398", 10, MPFR_RNDN); + MPFR_ASSERTN(mpfr_equal_p (x, y)); + /* check negative number */ + mpfr_set_ui_2exp (x, 1, -1324, MPFR_RNDN); + mpfr_nextbelow (x); + mpfr_neg (x, x, MPFR_RNDN); + d = mpfr_get_decimal64 (x, MPFR_RNDZ); + /* d should equal -0 */ + mpfr_set_decimal64 (x, d, MPFR_RNDN); + MPFR_ASSERTN(mpfr_zero_p (x) && mpfr_signbit (x) == 1); + + /* exercise case e10 < -397 */ + mpfr_set_ui_2exp (x, 1, -1323, MPFR_RNDN); + d = mpfr_get_decimal64 (x, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDN); + MPFR_ASSERTN(mpfr_zero_p (x) && mpfr_signbit (x) == 0); + mpfr_set_ui_2exp (x, 1, -1323, MPFR_RNDN); + d = mpfr_get_decimal64 (x, MPFR_RNDU); + mpfr_set_str (y, "1E-398", 10, MPFR_RNDN); + mpfr_set_decimal64 (x, d, MPFR_RNDN); + MPFR_ASSERTN(mpfr_equal_p (x, y)); + mpfr_set_ui_2exp (x, 1, -1323, MPFR_RNDN); + /* 2^(-1323) = 5.46154776930125e-399 thus should be rounded to 1E-398 */ + d = mpfr_get_decimal64 (x, MPFR_RNDN); + mpfr_set_str (y, "1E-398", 10, MPFR_RNDN); + mpfr_set_decimal64 (x, d, MPFR_RNDN); + MPFR_ASSERTN(mpfr_equal_p (x, y)); /* subnormal number with exponent change when we round back from 16 digits to 1 digit */ @@ -147,24 +228,45 @@ mpfr_set_ui (x, 0, MPFR_RNDZ); mpfr_set_decimal64 (x, d, MPFR_RNDD); mpfr_set_str (y, "1E-397", 10, MPFR_RNDN); - MPFR_ASSERTN (mpfr_cmp (x, y) == 0); + if (! mpfr_equal_p (x, y)) + PRINT_ERR_MISC ("9.9E-398"); /* largest number */ mpfr_set_str (x, "9.999999999999999E384", 10, MPFR_RNDZ); mpfr_set (y, x, MPFR_RNDZ); d = mpfr_get_decimal64 (x, MPFR_RNDU); - MPFR_ASSERTN (d == DEC64_MAX); - mpfr_set_ui (x, 0, MPFR_RNDZ); - mpfr_set_decimal64 (x, d, MPFR_RNDZ); - MPFR_ASSERTN (mpfr_cmp (x, y) == 0); + if (d == DEC64_MAX) + { + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDZ); + if (! mpfr_equal_p (x, y)) + PRINT_ERR_MISC ("DEC64_MAX"); + } + else + { + printf ("Error in check_misc for DEC64_MAX.\n"); + printf (" mpfr_get_decimal64() returned: "); + print_decimal64 (d); + exit (1); + } mpfr_set_str (x, "-9.999999999999999E384", 10, MPFR_RNDZ); mpfr_set (y, x, MPFR_RNDZ); d = mpfr_get_decimal64 (x, MPFR_RNDA); - MPFR_ASSERTN (d == -DEC64_MAX); - mpfr_set_ui (x, 0, MPFR_RNDZ); - mpfr_set_decimal64 (x, d, MPFR_RNDZ); - MPFR_ASSERTN (mpfr_cmp (x, y) == 0); + if (d == -DEC64_MAX) + { + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_set_decimal64 (x, d, MPFR_RNDZ); + if (! mpfr_equal_p (x, y)) + PRINT_ERR_MISC ("-DEC64_MAX"); + } + else + { + printf ("Error in check_misc for -DEC64_MAX.\n"); + printf (" mpfr_get_decimal64() returned: "); + print_decimal64 (d); + exit (1); + } mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); @@ -173,7 +275,8 @@ mpfr_set_str (x, "9.999999999999999E384", 10, MPFR_RNDZ); d = mpfr_get_decimal64 (x, MPFR_RNDZ); mpfr_set_decimal64 (y, d, MPFR_RNDU); - MPFR_ASSERTN (mpfr_cmp (x, y) == 0); + if (! mpfr_equal_p (x, y)) + PRINT_ERR_MISC ("DEC64_MAX (2)"); mpfr_clear (x); mpfr_clear (y); @@ -200,6 +303,7 @@ mpfr_set_decimal64 (y, d, MPFR_RNDN); if (mpfr_cmp (x, y) != 0) { + printf ("Error:\n"); printf ("x="); mpfr_dump (x); printf ("d="); print_decimal64 (d); printf ("y="); mpfr_dump (y); @@ -315,24 +419,87 @@ mpfr_clear (x); } +static void +powers_of_10 (void) +{ + mpfr_t x1, x2; + _Decimal64 d[2]; + int i, rnd; + unsigned int neg; + + mpfr_inits2 (200, x1, x2, (mpfr_ptr) 0); + for (i = 0, d[0] = 1, d[1] = 1; i < 150; i++, d[0] *= 10, d[1] /= 10) + for (neg = 0; neg <= 3; neg++) + RND_LOOP_NO_RNDF (rnd) + { + int inex1, inex2; + mpfr_flags_t flags1, flags2; + mpfr_rnd_t rx1; + _Decimal64 dd; + + inex1 = mpfr_set_si (x1, (neg >> 1) ? -i : i, MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + + rx1 = (neg & 1) ? + MPFR_INVERT_RND ((mpfr_rnd_t) rnd) : (mpfr_rnd_t) rnd; + mpfr_clear_flags (); + inex1 = mpfr_exp10 (x1, x1, rx1); + flags1 = __gmpfr_flags; + + dd = d[neg >> 1]; + + if (neg & 1) + { + MPFR_SET_NEG (x1); + inex1 = -inex1; + dd = -dd; + } + + mpfr_clear_flags (); + inex2 = mpfr_set_decimal64 (x2, dd, (mpfr_rnd_t) rnd); + flags2 = __gmpfr_flags; + + if (!(mpfr_equal_p (x1, x2) && + SAME_SIGN (inex1, inex2) && + flags1 == flags2)) + { + printf ("Error in powers_of_10 for i=%d, neg=%d, %s\n", + i, neg, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + printf ("Expected "); + mpfr_dump (x1); + printf ("with inex = %d and flags =", inex1); + flags_out (flags1); + printf ("Got "); + mpfr_dump (x2); + printf ("with inex = %d and flags =", inex2); + flags_out (flags2); + exit (1); + } + } + mpfr_clears (x1, x2, (mpfr_ptr) 0); +} + int main (void) { tests_start_mpfr (); mpfr_test_init (); -#ifdef DEBUG +#ifdef MPFR_DEBUG #ifdef DPD_FORMAT printf ("Using DPD format\n"); #else printf ("Using BID format\n"); #endif #endif - check_inf_nan (); + check_misc (); check_random (); check_native (); +#if !defined(MPFR_ERRDIVZERO) check_overflow (); +#endif check_tiny (); + powers_of_10 (); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tget_sj.c mpfr4-4.0.2/tests/tget_sj.c --- mpfr4-3.1.4/tests/tget_sj.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tget_sj.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_get_sj and mpfr_get_uj. -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,16 +17,14 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* Needed due to the inclusion of mpfr-intmax.h */ #ifdef HAVE_CONFIG_H -# include "config.h" /* for a build within gmp */ +# include "config.h" #endif -#include -#include - #include "mpfr-intmax.h" #include "mpfr-test.h" @@ -40,46 +38,90 @@ #else +#ifdef MPFR_PRINTF_MAXLM +#define PRMAX(SPEC,V) printf (" %" MPFR_PRINTF_MAXLM SPEC ",", V) +#else +#define PRMAX(SPEC,V) (void) 0 +#endif + static void check_sj (intmax_t s, mpfr_ptr x) { + mpfr_exp_t emin, emax; mpfr_t y; int i; - mpfr_init2 (y, MPFR_PREC (x)); + mpfr_init2 (y, MPFR_PREC (x) + 2); + + emin = mpfr_get_emin (); + emax = mpfr_get_emax (); for (i = -1; i <= 1; i++) { int rnd; - - mpfr_set_si_2exp (y, i, -2, MPFR_RNDN); - mpfr_add (y, y, x, MPFR_RNDN); - for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) - { - intmax_t r; - - if (rnd == MPFR_RNDZ && i < 0 && s >= 0) - continue; - if (rnd == MPFR_RNDZ && i > 0 && s <= 0) - continue; - if (rnd == MPFR_RNDD && i < 0) - continue; - if (rnd == MPFR_RNDU && i > 0) - continue; - if (rnd == MPFR_RNDA && ((MPFR_IS_POS(y) && i > 0) || - (MPFR_IS_NEG(y) && i < 0))) - continue; - /* rint (y) == x == s */ - r = mpfr_get_sj (y, (mpfr_rnd_t) rnd); - if (r != s) - { - printf ("Error in check_sj for y = "); - mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); - printf (" in %s\n", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - printf ("Got %jd instead of %jd.\n", r, s); - exit (1); - } - } + int inex; + int fi, e; + mpfr_flags_t flags[2] = { 0, MPFR_FLAGS_ALL }, ex_flags, gt_flags; + + inex = mpfr_set_si_2exp (y, i, -2, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + inex = mpfr_add (y, y, x, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + /* y = x + i/4, with -1 <= i <= 1 */ + RND_LOOP (rnd) + for (fi = 0; fi < numberof (flags); fi++) + { + intmax_t r; + + if (rnd == MPFR_RNDZ && i < 0 && s >= 0) + continue; + if (rnd == MPFR_RNDZ && i > 0 && s <= 0) + continue; + if (rnd == MPFR_RNDD && i < 0) + continue; + if (rnd == MPFR_RNDU && i > 0) + continue; + if (rnd == MPFR_RNDA && ((MPFR_IS_POS(y) && i > 0) || + (MPFR_IS_NEG(y) && i < 0))) + continue; + + for (e = 0; e < 2; e++) + { + if (e) + { + mpfr_exp_t ey; + + if (MPFR_IS_ZERO (y)) + break; + ey = MPFR_GET_EXP (y); + set_emin (ey); + set_emax (ey); + } + /* rint (y) == x == s */ + __gmpfr_flags = ex_flags = flags[fi]; + if (i != 0) + ex_flags |= MPFR_FLAGS_INEXACT; + r = mpfr_get_sj (y, (mpfr_rnd_t) rnd); + gt_flags = __gmpfr_flags; + set_emin (emin); + set_emax (emax); + if ((r != s || gt_flags != ex_flags) && rnd != MPFR_RNDF) + { + printf ("Error in check_sj for fi = %d, y = ", fi); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); + printf (" in %s%s\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), + e ? ", reduced exponent range" : ""); + printf ("Expected:"); + PRMAX ("d", s); + flags_out (ex_flags); + printf ("Got: "); + PRMAX ("d", r); + flags_out (gt_flags); + exit (1); + } + } + } } mpfr_clear (y); @@ -88,124 +130,205 @@ static void check_uj (uintmax_t u, mpfr_ptr x) { + mpfr_exp_t emin, emax; mpfr_t y; int i; - mpfr_init2 (y, MPFR_PREC (x)); + mpfr_init2 (y, MPFR_PREC (x) + 2); + + emin = mpfr_get_emin (); + emax = mpfr_get_emax (); for (i = -1; i <= 1; i++) { int rnd; - - mpfr_set_si_2exp (y, i, -2, MPFR_RNDN); - mpfr_add (y, y, x, MPFR_RNDN); - for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) - { - uintmax_t r; - - if (rnd == MPFR_RNDZ && i < 0) - continue; - if (rnd == MPFR_RNDD && i < 0) - continue; - if (rnd == MPFR_RNDU && i > 0) - continue; - if (rnd == MPFR_RNDA && ((MPFR_IS_POS(y) && i > 0) || - (MPFR_IS_NEG(y) && i < 0))) - continue; - /* rint (y) == x == u */ - r = mpfr_get_uj (y, (mpfr_rnd_t) rnd); - if (r != u) - { - printf ("Error in check_uj for y = "); - mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); - printf (" in %s\n", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - printf ("Got %ju instead of %ju.\n", r, u); - exit (1); - } - } + int inex; + int fi, e; + mpfr_flags_t flags[2] = { 0, MPFR_FLAGS_ALL }, ex_flags, gt_flags; + + inex = mpfr_set_si_2exp (y, i, -2, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + inex = mpfr_add (y, y, x, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + /* y = x + i/4, with -1 <= i <= 1 */ + RND_LOOP (rnd) + for (fi = 0; fi < numberof (flags); fi++) + { + uintmax_t r; + + if (rnd == MPFR_RNDZ && i < 0) + continue; + if (rnd == MPFR_RNDD && i < 0) + continue; + if (rnd == MPFR_RNDU && i > 0) + continue; + if (rnd == MPFR_RNDA && ((MPFR_IS_POS(y) && i > 0) || + (MPFR_IS_NEG(y) && i < 0))) + continue; + + for (e = 0; e < 2; e++) + { + if (e) + { + mpfr_exp_t ey; + + if (MPFR_IS_ZERO (y)) + break; + ey = MPFR_GET_EXP (y); + set_emin (ey); + set_emax (ey); + } + /* rint (y) == x == u */ + __gmpfr_flags = ex_flags = flags[fi]; + if (i != 0) + ex_flags |= MPFR_FLAGS_INEXACT; + r = mpfr_get_uj (y, (mpfr_rnd_t) rnd); + gt_flags = __gmpfr_flags; + set_emin (emin); + set_emax (emax); + if ((r != u || gt_flags != ex_flags) && rnd != MPFR_RNDF) + { + printf ("Error in check_uj for fi = %d, y = ", fi); + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); + printf (" in %s%s\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), + e ? ", reduced exponent range" : ""); + printf ("Expected:"); + PRMAX ("u", u); + flags_out (ex_flags); + printf ("Got: "); + PRMAX ("u", r); + flags_out (gt_flags); + exit (1); + } + } + } } mpfr_clear (y); } +#define CHECK_ERANGE(F,FMT,RES,INPUT,VALUE,E) \ + do \ + { \ + __gmpfr_flags = ex_flags = flags[fi]; \ + RES = F (x, (mpfr_rnd_t) rnd); \ + gt_flags = __gmpfr_flags; \ + if (E) \ + ex_flags |= MPFR_FLAGS_ERANGE; \ + if (RES == VALUE && gt_flags == ex_flags) \ + continue; \ + printf ("Error in check_erange for %s, %s, fi = %d on %s\n", \ + #F, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), fi, INPUT); \ + printf ("Expected:"); \ + PRMAX (FMT, VALUE); \ + flags_out (ex_flags); \ + printf ("Got: "); \ + PRMAX (FMT, RES); \ + flags_out (gt_flags); \ + exit (1); \ + } \ + while (0) + +#define CHECK_ERANGE_U(INPUT,VALUE,E) \ + CHECK_ERANGE (mpfr_get_uj, "u", u, INPUT, (uintmax_t) VALUE, E) +#define CHECK_ERANGE_S(INPUT,VALUE,E) \ + CHECK_ERANGE (mpfr_get_sj, "d", d, INPUT, (intmax_t) VALUE, E) + static void check_erange (void) { mpfr_t x; - uintmax_t dl; + uintmax_t u; intmax_t d; + int rnd; + int fi; + mpfr_flags_t flags[3] = { 0, MPFR_FLAGS_ALL ^ MPFR_FLAGS_ERANGE, + MPFR_FLAGS_ALL }, ex_flags, gt_flags; - /* Test for ERANGE flag + correct behaviour if overflow */ + /* Test for ERANGE flag + correct behavior if overflow */ mpfr_init2 (x, 256); - mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); - mpfr_clear_erangeflag (); - dl = mpfr_get_uj (x, MPFR_RNDN); - if (dl != MPFR_UINTMAX_MAX || mpfr_erangeflag_p ()) - { - printf ("ERROR for get_uj + ERANGE + UINTMAX_MAX (1)\n"); - exit (1); - } - mpfr_add_ui (x, x, 1, MPFR_RNDN); - dl = mpfr_get_uj (x, MPFR_RNDN); - if (dl != MPFR_UINTMAX_MAX || !mpfr_erangeflag_p ()) - { - printf ("ERROR for get_uj + ERANGE + UINTMAX_MAX (2)\n"); - exit (1); - } - mpfr_set_sj (x, -1, MPFR_RNDN); - mpfr_clear_erangeflag (); - dl = mpfr_get_uj (x, MPFR_RNDN); - if (dl != 0 || !mpfr_erangeflag_p ()) - { - printf ("ERROR for get_uj + ERANGE + -1 \n"); - exit (1); - } - mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); - mpfr_clear_erangeflag (); - d = mpfr_get_sj (x, MPFR_RNDN); - if (d != MPFR_INTMAX_MAX || mpfr_erangeflag_p ()) - { - printf ("ERROR for get_sj + ERANGE + INTMAX_MAX (1)\n"); - exit (1); - } - mpfr_add_ui (x, x, 1, MPFR_RNDN); - d = mpfr_get_sj (x, MPFR_RNDN); - if (d != MPFR_INTMAX_MAX || !mpfr_erangeflag_p ()) - { - printf ("ERROR for get_sj + ERANGE + INTMAX_MAX (2)\n"); - exit (1); - } - mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN); - mpfr_clear_erangeflag (); - d = mpfr_get_sj (x, MPFR_RNDN); - if (d != MPFR_INTMAX_MIN || mpfr_erangeflag_p ()) - { - printf ("ERROR for get_sj + ERANGE + INTMAX_MIN (1)\n"); - exit (1); - } - mpfr_sub_ui (x, x, 1, MPFR_RNDN); - d = mpfr_get_sj (x, MPFR_RNDN); - if (d != MPFR_INTMAX_MIN || !mpfr_erangeflag_p ()) - { - printf ("ERROR for get_sj + ERANGE + INTMAX_MIN (2)\n"); - exit (1); - } - mpfr_set_nan (x); - mpfr_clear_erangeflag (); - d = mpfr_get_uj (x, MPFR_RNDN); - if (d != 0 || !mpfr_erangeflag_p ()) - { - printf ("ERROR for get_uj + NaN\n"); - exit (1); - } - mpfr_clear_erangeflag (); - d = mpfr_get_sj (x, MPFR_RNDN); - if (d != 0 || !mpfr_erangeflag_p ()) + RND_LOOP (rnd) + for (fi = 0; fi < numberof (flags); fi++) + { + mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); + CHECK_ERANGE_U ("UINTMAX_MAX", MPFR_UINTMAX_MAX, 0); + mpfr_add_ui (x, x, 1, MPFR_RNDN); + CHECK_ERANGE_U ("UINTMAX_MAX+1", MPFR_UINTMAX_MAX, 1); + mpfr_set_sj (x, -1, MPFR_RNDN); + CHECK_ERANGE_U ("-1", 0, 1); + mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); + CHECK_ERANGE_S ("INTMAX_MAX", MPFR_INTMAX_MAX, 0); + mpfr_add_ui (x, x, 1, MPFR_RNDN); + CHECK_ERANGE_S ("INTMAX_MAX+1", MPFR_INTMAX_MAX, 1); + mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN); + CHECK_ERANGE_S ("INTMAX_MIN", MPFR_INTMAX_MIN, 0); + mpfr_sub_ui (x, x, 1, MPFR_RNDN); + CHECK_ERANGE_S ("INTMAX_MIN-1", MPFR_INTMAX_MIN, 1); + mpfr_set_nan (x); + CHECK_ERANGE_U ("NaN", 0, 1); + CHECK_ERANGE_S ("NaN", 0, 1); + } + + mpfr_clear (x); +} + +static void +test_get_uj_smallneg (void) +{ + mpfr_t x; + int i; + + mpfr_init2 (x, 64); + + for (i = 1; i <= 4; i++) { - printf ("ERROR for get_sj + NaN\n"); - exit (1); + int r; + + mpfr_set_si_2exp (x, -i, -2, MPFR_RNDN); + RND_LOOP (r) + { + intmax_t s; + uintmax_t u; + + mpfr_clear_erangeflag (); + s = mpfr_get_sj (x, r != MPFR_RNDF ? (mpfr_rnd_t) r : MPFR_RNDA); + if (mpfr_erangeflag_p ()) + { + printf ("ERROR for get_sj + ERANGE + small negative op" + " for rnd = %s and x = -%d/4\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r), i); + exit (1); + } + u = mpfr_get_uj (x, (mpfr_rnd_t) r); + if (u != 0) + { + printf ("ERROR for get_uj + ERANGE + small negative op" + " for rnd = %s and x = -%d/4\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r), i); +#ifdef MPFR_PRINTF_MAXLM + printf ("Expected 0, got %" MPFR_PRINTF_MAXLM "u\n", u); +#endif + exit (1); + } + if ((s == 0) ^ !mpfr_erangeflag_p ()) + { + const char *Not = s == 0 ? "" : " not"; + + printf ("ERROR for get_uj + ERANGE + small negative op" + " for rnd = %s and x = -%d/4\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r), i); + printf ("The rounded integer "); +#ifdef MPFR_PRINTF_MAXLM + printf("(%" MPFR_PRINTF_MAXLM "d) ", s); +#endif + printf("is%s representable in unsigned long,\n" + "but the erange flag is%s set.\n", Not, Not); + exit (1); + } + } } mpfr_clear (x); @@ -273,6 +396,7 @@ mpfr_clear (y); check_erange (); + test_get_uj_smallneg (); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tget_str.c mpfr4-4.0.2/tests/tget_str.c --- mpfr4-3.1.4/tests/tget_str.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tget_str.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_get_str. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include - #include "mpfr-test.h" static void @@ -1014,10 +1012,16 @@ mpfr_free_str (s); mpfr_set_nan (x); + mpfr_clear_flags (); s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN); if (strcmp (s, "@NaN@")) { - printf ("Error for NaN\n"); + printf ("Error for NaN (incorrect string)\n"); + exit (1); + } + if (__gmpfr_flags != MPFR_FLAGS_NAN) + { + printf ("Error for NaN (incorrect flags)\n"); exit (1); } mpfr_free_str (s); @@ -1081,6 +1085,8 @@ int r; size_t m; + mpfr_init2 (x, p); + /* check for invalid base */ if (mpfr_get_str (s, &e, 1, 10, x, MPFR_RNDN) != NULL) { @@ -1094,16 +1100,15 @@ } s2[0] = '1'; - for (i=1; i= 20) ^ (! mpfr_inexflag_p ())) + { + printf ("Error in check_inex on i=%d and %s\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("Got %s\n", s[r != 0]); + printf ("Flags:"); + flags_out (flags); + exit (1); + } + if (r != 0) + { + inex |= strcmp (s[0], s[1]) != 0; + mpfr_free_str (s[1]); + } + } + + MPFR_ASSERTN ((i >= 20) ^ inex); + mpfr_free_str (s[0]); + } + mpfr_clear (x); +} + +static void +check_negative_base (void) +{ + mpfr_t f; + mpfr_exp_t e; + char *s, s2[16] = "7B000000000000", s3[16] = "74000000000000"; + + mpfr_init_set_ui (f, 123, MPFR_RNDN); + s = mpfr_get_str (0, &e, -16, 0, f, MPFR_RNDN); + MPFR_ASSERTN(strcmp (s, s2) == 0); + mpfr_free_str (s); + s = mpfr_get_str (0, &e, -17, 0, f, MPFR_RNDN); + MPFR_ASSERTN(strcmp (s, s3) == 0); + mpfr_free_str (s); + mpfr_clear (f); +} + #define ITER 1000 +static void +coverage (void) +{ + mpfr_t x; + char s[42]; + mpfr_exp_t e; + int b = 3; + size_t m = 40; + + mpfr_init2 (x, 128); + + /* exercise corner case in mpfr_get_str_aux: exact case (e < 0), where r + rounds to a power of 2, and f is a multiple of GMP_NUMB_BITS */ + mpfr_set_ui_2exp (x, 1, 64, MPFR_RNDU); + mpfr_nextbelow (x); + /* x = 2^64 - 2^(-64) */ + mpfr_get_str (s, &e, b, m, x, MPFR_RNDU); + /* s is the base-3 string for 6148914691236517206 (in base 10) */ + MPFR_ASSERTN(strcmp (s, "1111222002212212010121102012021021021200") == 0); + MPFR_ASSERTN(e == 41); + + /* exercise corner case in mpfr_get_str: input is m=0, then it is changed + to m=1 */ + mpfr_set_prec (x, 1); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_get_str (s, &e, 2, 0, x, MPFR_RNDN); + MPFR_ASSERTN(strcmp (s, "1") == 0); + MPFR_ASSERTN(e == 1); + mpfr_get_str (s, &e, 2, 1, x, MPFR_RNDN); + MPFR_ASSERTN(strcmp (s, "1") == 0); + MPFR_ASSERTN(e == 1); + + /* exercise corner case in mpfr_get_str: case m < g, exact <> 0, + nx > 2 * n, and low nx-2n limbs from xp not identically zero */ + mpfr_set_prec (x, 129); + mpfr_set_str_binary (x, "0.100100111110110111100010100011011111101010110000011001000111111101100110101110110000110011E8"); + mpfr_nextabove (x); + mpfr_get_str (s, &e, 10, 2, x, MPFR_RNDZ); + MPFR_ASSERTN(strcmp (s, "14") == 0); + MPFR_ASSERTN(e == 3); + + mpfr_clear (x); +} + int main (int argc, char *argv[]) { @@ -1215,6 +1325,7 @@ tests_start_mpfr (); + coverage (); check_small (); check_special (2, 2); @@ -1231,8 +1342,9 @@ m = 2 + (randlimb () % (MAX_DIGITS - 1)); mpfr_urandomb (x, RANDS); e = (mpfr_exp_t) (randlimb () % 21) - 10; - mpfr_set_exp (x, (e == -10) ? mpfr_get_emin () : - ((e == 10) ? mpfr_get_emax () : e)); + if (!MPFR_IS_ZERO(x)) + mpfr_set_exp (x, (e == -10) ? mpfr_get_emin () : + ((e == 10) ? mpfr_get_emax () : e)); b = 2 + (randlimb () % 35); r = RND_RAND (); mpfr_get_str (s, &f, b, m, x, r); @@ -1262,6 +1374,8 @@ check_bug_base2k (); check_reduced_exprange (); + check_inex (); + check_negative_base (); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tget_z.c mpfr4-4.0.2/tests/tget_z.c --- mpfr4-3.1.4/tests/tget_z.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tget_z.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpz_set_fr / mpfr_get_z. -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void @@ -75,55 +72,142 @@ static void check_one (mpz_ptr z) { + mpfr_exp_t emin, emax; int inex; int sh, neg; mpfr_t f; - mpz_t got; + mpz_t got, ex, t; + + emin = mpfr_get_emin (); + emax = mpfr_get_emax (); - mpfr_init2 (f, MAX( mpz_sizeinbase (z, 2), MPFR_PREC_MIN) ); + mpfr_init2 (f, MAX (mpz_sizeinbase (z, 2), MPFR_PREC_MIN)); mpz_init (got); + mpz_init (ex); + mpz_init (t); for (sh = -2*GMP_NUMB_BITS ; sh < 2*GMP_NUMB_BITS ; sh++) { + inex = mpfr_set_z (f, z, MPFR_RNDN); /* exact */ + MPFR_ASSERTN (inex == 0); + + inex = sh < 0 ? + mpfr_div_2exp (f, f, -sh, MPFR_RNDN) : + mpfr_mul_2exp (f, f, sh, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + for (neg = 0; neg <= 1; neg++) { - mpz_neg (z, z); - mpfr_set_z (f, z, MPFR_RNDN); - - if (sh < 0) - { - mpz_tdiv_q_2exp (z, z, -sh); - mpfr_div_2exp (f, f, -sh, MPFR_RNDN); - } - else - { - mpz_mul_2exp (z, z, sh); - mpfr_mul_2exp (f, f, sh, MPFR_RNDN); - } + int rnd; - inex = mpfr_get_z (got, f, MPFR_RNDZ); + /* Test (-1)^neg * z * 2^sh */ - if (mpz_cmp (got, z) != 0) + RND_LOOP_NO_RNDF (rnd) { - printf ("Wrong result for shift=%d\n", sh); - printf (" f "); mpfr_dump (f); - printf (" got "); mpz_dump (got); - printf (" want "); mpz_dump (z); - exit (1); - } - if (! SAME_SIGN (inex, - mpfr_cmp_z (f, z))) - { - printf ("Wrong inexact value for shift=%d\n", sh); - printf (" f "); mpfr_dump (f); - printf (" got %+d\n", inex); - printf (" want %+d\n", -mpfr_cmp_z (f, z)); - exit (1); + int ex_inex, same; + int d, fi, e; + mpfr_flags_t flags[3] = { 0, MPFR_FLAGS_ALL ^ MPFR_FLAGS_ERANGE, + MPFR_FLAGS_ALL }, ex_flags, gt_flags; + + if (neg) + mpz_neg (ex, z); + else + mpz_set (ex, z); + + if (sh < 0) + switch (rnd) + { + case MPFR_RNDN: + mpz_set_si (t, neg ? -1 : 1); + mpz_mul_2exp (t, t, -sh - 1); + mpz_add (ex, ex, t); + /* d = mpz_divisible_2exp_p (ex, -sh); */ + d = mpz_scan1 (ex, 0) >= -sh; + mpz_tdiv_q_2exp (ex, ex, -sh); + if (d && mpz_tstbit (ex, 0) != 0) /* even rounding */ + { + if (neg) + mpz_add_ui (ex, ex, 1); + else + mpz_sub_ui (ex, ex, 1); + } + break; + case MPFR_RNDZ: + mpz_tdiv_q_2exp (ex, ex, -sh); + break; + case MPFR_RNDU: + mpz_cdiv_q_2exp (ex, ex, -sh); + break; + case MPFR_RNDD: + mpz_fdiv_q_2exp (ex, ex, -sh); + break; + case MPFR_RNDA: + if (neg) + mpz_fdiv_q_2exp (ex, ex, -sh); + else + mpz_cdiv_q_2exp (ex, ex, -sh); + break; + default: + MPFR_ASSERTN (0); + } + else + mpz_mul_2exp (ex, ex, sh); + + ex_inex = - mpfr_cmp_z (f, ex); + ex_inex = VSIGN (ex_inex); + + for (fi = 0; fi < numberof (flags); fi++) + for (e = 0; e < 2; e++) + { + if (e) + { + mpfr_exp_t ef; + + if (MPFR_IS_ZERO (f)) + break; + ef = MPFR_GET_EXP (f); + set_emin (ef); + set_emax (ef); + } + ex_flags = __gmpfr_flags = flags[fi]; + if (ex_inex != 0) + ex_flags |= MPFR_FLAGS_INEXACT; + inex = mpfr_get_z (got, f, (mpfr_rnd_t) rnd); + inex = VSIGN (inex); + gt_flags = __gmpfr_flags; + set_emin (emin); + set_emax (emax); + same = SAME_SIGN (inex, ex_inex); + + if (mpz_cmp (got, ex) != 0 || + !same || gt_flags != ex_flags) + { + printf ("Error in check_one for sh=%d, fi=%d, %s%s\n", + sh, fi, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), + e ? ", reduced exponent range" : ""); + printf (" f = "); mpfr_dump (f); + printf ("expected "); mpz_out_str (stdout, 10, ex); + printf ("\n got "); mpz_out_str (stdout, 10, got); + printf ("\nExpected inex ~ %d, got %d (%s)\n", + ex_inex, inex, same ? "OK" : "wrong"); + printf ("Flags:\n"); + printf (" in"); flags_out (flags[fi]); + printf ("expected"); flags_out (ex_flags); + printf (" got"); flags_out (gt_flags); + exit (1); + } + } } + + mpfr_neg (f, f, MPFR_RNDN); } } mpfr_clear (f); mpz_clear (got); + mpz_clear (ex); + mpz_clear (t); } static void @@ -136,6 +220,9 @@ mpz_set_ui (z, 0L); check_one (z); + mpz_set_si (z, 17L); + check_one (z); + mpz_set_si (z, 123L); check_one (z); @@ -154,34 +241,59 @@ int inex; mpfr_t x; mpz_t z; - int i; + int i, fi; + int rnd; mpfr_exp_t e; + mpfr_flags_t flags[3] = { 0, MPFR_FLAGS_ALL ^ MPFR_FLAGS_ERANGE, + MPFR_FLAGS_ALL }, ex_flags, gt_flags; mpfr_init2 (x, 2); mpz_init (z); - for (i = -1; i <= 1; i++) - { - if (i != 0) - mpfr_set_nan (x); - else - mpfr_set_inf (x, i); - mpfr_clear_flags (); - inex = mpfr_get_z (z, x, MPFR_RNDN); - if (!mpfr_erangeflag_p () || inex != 0 || mpz_cmp_ui (z, 0) != 0) + RND_LOOP (rnd) + for (i = -1; i <= 1; i++) + for (fi = 0; fi < numberof (flags); fi++) { - printf ("special() failed on mpfr_get_z for i = %d\n", i); - exit (1); - } - mpfr_clear_flags (); - e = mpfr_get_z_2exp (z, x); - if (!mpfr_erangeflag_p () || e != __gmpfr_emin || - mpz_cmp_ui (z, 0) != 0) - { - printf ("special() failed on mpfr_get_z_2exp for i = %d\n", i); - exit (1); + ex_flags = flags[fi] | MPFR_FLAGS_ERANGE; + if (i != 0) + mpfr_set_nan (x); + else + mpfr_set_inf (x, i); + __gmpfr_flags = flags[fi]; + inex = mpfr_get_z (z, x, (mpfr_rnd_t) rnd); + gt_flags = __gmpfr_flags; + if (gt_flags != ex_flags || inex != 0 || mpz_cmp_ui (z, 0) != 0) + { + printf ("special() failed on mpfr_get_z" + " for %s, i = %d, fi = %d\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), i, fi); + printf ("Expected z = 0, inex = 0,"); + flags_out (ex_flags); + printf ("Got z = "); + mpz_out_str (stdout, 10, z); + printf (", inex = %d,", inex); + flags_out (gt_flags); + exit (1); + } + __gmpfr_flags = flags[fi]; + e = mpfr_get_z_2exp (z, x); + gt_flags = __gmpfr_flags; + if (gt_flags != ex_flags || e != __gmpfr_emin || + mpz_cmp_ui (z, 0) != 0) + { + printf ("special() failed on mpfr_get_z_2exp" + " for %s, i = %d, fi = %d\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), i, fi); + printf ("Expected z = 0, e = %" MPFR_EXP_FSPEC "d,", + (mpfr_eexp_t) __gmpfr_emin); + flags_out (ex_flags); + printf ("Got z = "); + mpz_out_str (stdout, 10, z); + printf (", e = %" MPFR_EXP_FSPEC "d,", (mpfr_eexp_t) e); + flags_out (gt_flags); + exit (1); + } } - } mpfr_clear (x); mpz_clear (z); diff -Nru mpfr4-3.1.4/tests/tgmpop.c mpfr4-4.0.2/tests/tgmpop.c --- mpfr4-3.1.4/tests/tgmpop.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tgmpop.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* Test file for mpfr_add_[q,z], mpfr_sub_[q,z], mpfr_div_[q,z], mpfr_mul_[q,z], mpfr_cmp_[f,q,z] -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,21 +18,22 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include "mpfr-test.h" +#ifndef MPFR_USE_MINI_GMP + #define CHECK_FOR(str, cond) \ if ((cond) == 0) { \ printf ("Special case error %s. Ternary value = %d, flags = %u\n", \ str, res, __gmpfr_flags); \ printf ("Got "); mpfr_dump (y); \ printf ("X = "); mpfr_dump (x); \ - printf ("Q = "); mpz_dump (mpq_numref(q)); \ - printf (" /"); mpz_dump (mpq_denref(q)); \ + printf ("Q = "); mpz_out_str (stdout, 10, mpq_numref(q)); \ + printf ("\n /"); mpz_out_str (stdout, 10, mpq_denref(q)); \ + printf ("\n"); \ exit (1); \ } @@ -42,7 +43,8 @@ str, res, __gmpfr_flags); \ printf ("Got "); mpfr_dump (y); \ printf ("X = "); mpfr_dump (x); \ - printf ("Z = "); mpz_dump (z); \ + printf ("Z = "); mpz_out_str (stdout, 10, z); \ + printf ("\n"); \ exit (1); \ } @@ -66,7 +68,7 @@ mpz_set_str (mpq_denref (q), "5721", 10); mpfr_set_str_binary (x, "11111111101001011011100101100011011110010011100010000100001E-44"); mpfr_add_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("cancelation in add_q", mpfr_cmp_ui_2exp (y, 256783, -64) == 0); + CHECK_FOR ("cancellation in add_q", mpfr_cmp_ui_2exp (y, 256783, -64) == 0); mpfr_set_prec (x, 19); mpfr_set_str_binary (x, "0.1011110101110011100E0"); @@ -76,7 +78,7 @@ mpfr_add_q (y, x, q, MPFR_RNDD); mpfr_set_prec (x, 29); mpfr_set_str_binary (x, "11111111101001110011010001001E-14"); - CHECK_FOR ("cancelation in add_q", mpfr_cmp (x,y) == 0); + CHECK_FOR ("cancellation in add_q", mpfr_cmp (x,y) == 0); /* Inf */ mpfr_set_inf (x, 1); @@ -110,36 +112,36 @@ mpq_set_ui (q, 1, 0); mpfr_set_str1 (x, "0.5"); res = mpfr_add_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("0.5+1/0", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0); + CHECK_FOR ("0.5+1/0", mpfr_inf_p (y) && MPFR_IS_POS (y) && res == 0); res = mpfr_sub_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("0.5-1/0", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0); + CHECK_FOR ("0.5-1/0", mpfr_inf_p (y) && MPFR_IS_NEG (y) && res == 0); mpq_set_si (q, -1, 0); res = mpfr_add_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("0.5+ -1/0", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0); + CHECK_FOR ("0.5+ -1/0", mpfr_inf_p (y) && MPFR_IS_NEG (y) && res == 0); res = mpfr_sub_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("0.5- -1/0", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0); + CHECK_FOR ("0.5- -1/0", mpfr_inf_p (y) && MPFR_IS_POS (y) && res == 0); res = mpfr_div_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("0.5 / (-1/0)", mpfr_zero_p (y) && MPFR_SIGN (y) < 0 && res == 0); + CHECK_FOR ("0.5 / (-1/0)", mpfr_zero_p (y) && MPFR_IS_NEG (y) && res == 0); mpq_set_ui (q, 1, 0); mpfr_set_inf (x, 1); res = mpfr_add_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("+Inf + +Inf", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0); + CHECK_FOR ("+Inf + +Inf", mpfr_inf_p (y) && MPFR_IS_POS (y) && res == 0); res = mpfr_sub_q (y, x, q, MPFR_RNDN); CHECK_FOR ("+Inf - +Inf", MPFR_IS_NAN (y) && res == 0); mpfr_set_inf (x, -1); res = mpfr_add_q (y, x, q, MPFR_RNDN); CHECK_FOR ("-Inf + +Inf", MPFR_IS_NAN (y) && res == 0); res = mpfr_sub_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("-Inf - +Inf", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0); + CHECK_FOR ("-Inf - +Inf", mpfr_inf_p (y) && MPFR_IS_NEG (y) && res == 0); mpq_set_si (q, -1, 0); mpfr_set_inf (x, 1); res = mpfr_add_q (y, x, q, MPFR_RNDN); CHECK_FOR ("+Inf + -Inf", MPFR_IS_NAN (y) && res == 0); res = mpfr_sub_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("+Inf - -Inf", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0); + CHECK_FOR ("+Inf - -Inf", mpfr_inf_p (y) && MPFR_IS_POS (y) && res == 0); mpfr_set_inf (x, -1); res = mpfr_add_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("-Inf + -Inf", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0); + CHECK_FOR ("-Inf + -Inf", mpfr_inf_p (y) && MPFR_IS_NEG (y) && res == 0); res = mpfr_sub_q (y, x, q, MPFR_RNDN); CHECK_FOR ("-Inf - -Inf", MPFR_IS_NAN (y) && res == 0); @@ -151,15 +153,15 @@ res = mpfr_sub_q (y, x, q, MPFR_RNDN); CHECK_FOR ("42-0/1", mpfr_cmp_ui (y, 42) == 0 && res == 0); res = mpfr_mul_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("42*0/1", mpfr_zero_p (y) && MPFR_SIGN (y) > 0 && res == 0); + CHECK_FOR ("42*0/1", mpfr_zero_p (y) && MPFR_IS_POS (y) && res == 0); mpfr_clear_flags (); res = mpfr_div_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("42/(0/1)", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0 + CHECK_FOR ("42/(0/1)", mpfr_inf_p (y) && MPFR_IS_POS (y) && res == 0 && mpfr_divby0_p ()); mpz_set_ui (z, 0); mpfr_clear_flags (); res = mpfr_div_z (y, x, z, MPFR_RNDN); - CHECK_FORZ ("42/0", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0 + CHECK_FORZ ("42/0", mpfr_inf_p (y) && MPFR_IS_POS (y) && res == 0 && mpfr_divby0_p ()); mpz_clear (z); @@ -276,7 +278,7 @@ if (!MPFR_IS_SINGULAR (x)) { mpfr_sub_z (z, x, y, MPFR_RNDN); - res1 = mpfr_sgn (z); + res1 = (mpfr_sgn) (z); res2 = mpfr_cmp_z (x, y); if (res1 != res2) { @@ -305,16 +307,39 @@ mpfr_init2 (z, MPFR_PREC_MIN); mpq_init (y); - /* check the erange flag when x is NaN */ + /* Check the flags when x is NaN: the erange flags must be set, and + only this one. */ mpfr_set_nan (x); mpq_set_ui (y, 17, 1); - mpfr_clear_erangeflag (); + mpfr_clear_flags (); res1 = mpfr_cmp_q (x, y); - if (res1 != 0 || mpfr_erangeflag_p () == 0) + if (res1 != 0 || __gmpfr_flags != MPFR_FLAGS_ERANGE) { printf ("Error for mpfr_cmp_q (NaN, 17)\n"); printf ("Return value: expected 0, got %d\n", res1); - printf ("Erange flag: expected set, got %d\n", mpfr_erangeflag_p ()); + printf ("Expected flags:"); + flags_out (MPFR_FLAGS_ERANGE); + printf ("Got flags: "); + flags_out (__gmpfr_flags); + exit (1); + } + + /* Check the flags when y is NaN: the erange flags must be set, and + only this one. */ + mpfr_set_ui (x, 42, MPFR_RNDN); + /* A NaN rational is represented by 0/0 (MPFR extension). */ + mpz_set_ui (mpq_numref (y), 0); + mpz_set_ui (mpq_denref (y), 0); + mpfr_clear_flags (); + res1 = mpfr_cmp_q (x, y); + if (res1 != 0 || __gmpfr_flags != MPFR_FLAGS_ERANGE) + { + printf ("Error for mpfr_cmp_q (42, NaN)\n"); + printf ("Return value: expected 0, got %d\n", res1); + printf ("Expected flags:"); + flags_out (MPFR_FLAGS_ERANGE); + printf ("Got flags: "); + flags_out (__gmpfr_flags); exit (1); } @@ -328,7 +353,7 @@ if (!MPFR_IS_SINGULAR (x)) { mpfr_sub_q (z, x, y, MPFR_RNDN); - res1 = mpfr_sgn (z); + res1 = (mpfr_sgn) (z); res2 = mpfr_cmp_q (x, y); if (res1 != res2) { @@ -339,6 +364,55 @@ } } } + + /* check for y = 1/0 */ + mpz_set_ui (mpq_numref (y), 1); + mpz_set_ui (mpq_denref (y), 0); + mpfr_set_ui (x, 1, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_q (x, y) < 0); + mpfr_set_inf (x, -1); + MPFR_ASSERTN(mpfr_cmp_q (x, y) < 0); + mpfr_set_inf (x, +1); + MPFR_ASSERTN(mpfr_cmp_q (x, y) == 0); + mpfr_set_nan (x); + mpfr_clear_erangeflag (); + MPFR_ASSERTN(mpfr_cmp_q (x, y) == 0); + MPFR_ASSERTN(mpfr_erangeflag_p ()); + + /* check for y = -1/0 */ + mpz_set_si (mpq_numref (y), -1); + mpz_set_ui (mpq_denref (y), 0); + mpfr_set_ui (x, 1, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_q (x, y) > 0); + mpfr_set_inf (x, -1); + MPFR_ASSERTN(mpfr_cmp_q (x, y) == 0); + mpfr_set_inf (x, +1); + MPFR_ASSERTN(mpfr_cmp_q (x, y) > 0); + mpfr_set_nan (x); + mpfr_clear_erangeflag (); + MPFR_ASSERTN(mpfr_cmp_q (x, y) == 0); + MPFR_ASSERTN(mpfr_erangeflag_p ()); + + /* check for y = 0/0 */ + mpz_set_ui (mpq_numref (y), 0); + mpz_set_ui (mpq_denref (y), 0); + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_clear_erangeflag (); + MPFR_ASSERTN(mpfr_cmp_q (x, y) == 0); + MPFR_ASSERTN(mpfr_erangeflag_p ()); + mpfr_set_inf (x, -1); + mpfr_clear_erangeflag (); + MPFR_ASSERTN(mpfr_cmp_q (x, y) == 0); + MPFR_ASSERTN(mpfr_erangeflag_p ()); + mpfr_set_inf (x, +1); + mpfr_clear_erangeflag (); + MPFR_ASSERTN(mpfr_cmp_q (x, y) == 0); + MPFR_ASSERTN(mpfr_erangeflag_p ()); + mpfr_set_nan (x); + mpfr_clear_erangeflag (); + MPFR_ASSERTN(mpfr_cmp_q (x, y) == 0); + MPFR_ASSERTN(mpfr_erangeflag_p ()); + mpq_clear (y); mpfr_clear (x); mpfr_clear (z); @@ -382,7 +456,7 @@ { mpfr_set_f (z, y, MPFR_RNDN); mpfr_sub (z, x, z, MPFR_RNDN); - res1 = mpfr_sgn (z); + res1 = (mpfr_sgn) (z); res2 = mpfr_cmp_f (x, y); if (res1 != res2) { @@ -444,10 +518,10 @@ if (mpfr_cmp(x1, x2)) { printf("Specialz %s: results differ.\nx1=", op); - mpfr_print_binary(x1); - printf("\nx2="); - mpfr_print_binary(x2); - printf ("\nZ2="); + mpfr_dump (x1); + printf ("x2="); + mpfr_dump (x2); + printf ("Z2="); mpz_out_str (stdout, 2, z1); putchar('\n'); exit(1); @@ -462,10 +536,9 @@ if (mpfr_cmp(x1, x2)) { printf("Specialz %s: results differ(2).\nx1=", op); - mpfr_print_binary(x1); - printf("\nx2="); - mpfr_print_binary(x2); - putchar('\n'); + mpfr_dump (x1); + printf ("x2="); + mpfr_dump (x2); exit(1); } @@ -519,10 +592,10 @@ if (mpfr_cmp(x1, x2)) { printf("Special2z %s: results differ.\nx1=", op); - mpfr_print_binary(x1); - printf("\nx2="); - mpfr_print_binary(x2); - printf ("\nZ2="); + mpfr_dump (x1); + printf ("x2="); + mpfr_dump (x2); + printf ("Z2="); mpz_out_str (stdout, 2, z1); putchar('\n'); exit(1); @@ -537,10 +610,9 @@ if (mpfr_cmp(x1, x2)) { printf("Special2z %s: results differ(2).\nx1=", op); - mpfr_print_binary(x1); - printf("\nx2="); - mpfr_print_binary(x2); - putchar('\n'); + mpfr_dump (x1); + printf ("x2="); + mpfr_dump (x2); exit(1); } @@ -573,20 +645,20 @@ { mpfr_urandomb (arg1, RANDS); mpz_urandomb (arg2, RANDS, 1024); - rnd = RND_RAND (); + rnd = RND_RAND_NO_RNDF (); mpfr_set_prec (dst_big, 2*prec); - compare = func(dst_big, arg1, arg2, rnd); + compare = func (dst_big, arg1, arg2, rnd); if (mpfr_can_round (dst_big, 2*prec, rnd, rnd, prec)) { mpfr_set (tmp, dst_big, rnd); - inexact = func(dst_small, arg1, arg2, rnd); + inexact = func (dst_small, arg1, arg2, rnd); if (mpfr_cmp (tmp, dst_small)) { printf ("Results differ for prec=%u rnd_mode=%s and %s_z:\n" "arg1=", (unsigned) prec, mpfr_print_rnd_mode (rnd), op); - mpfr_print_binary (arg1); - printf("\narg2="); + mpfr_dump (arg1); + printf ("arg2="); mpz_out_str (stdout, 10, arg2); printf ("\ngot "); mpfr_dump (dst_small); @@ -610,11 +682,11 @@ printf ("Wrong inexact flag for rnd=%s and %s_z:\n" "expected %d, got %d\n", mpfr_print_rnd_mode (rnd), op, compare, inexact); - printf ("\narg1="); mpfr_print_binary (arg1); - printf ("\narg2="); mpz_out_str(stdout, 2, arg2); - printf ("\ndstl="); mpfr_print_binary (dst_big); - printf ("\ndsts="); mpfr_print_binary (dst_small); - printf ("\ntmp ="); mpfr_dump (tmp); + printf ("arg1="); mpfr_dump (arg1); + printf ("arg2="); mpz_out_str(stdout, 2, arg2); + printf ("\ndstl="); mpfr_dump (dst_big); + printf ("dsts="); mpfr_dump (dst_small); + printf ("tmp ="); mpfr_dump (tmp); exit (1); } } @@ -650,7 +722,7 @@ { mpfr_urandomb (arg1, RANDS); mpz_urandomb (arg2, RANDS, 1024); - rnd = RND_RAND (); + rnd = RND_RAND_NO_RNDF (); mpfr_set_prec (dst_big, 2*prec); compare = func(dst_big, arg2, arg1, rnd); if (mpfr_can_round (dst_big, 2*prec, rnd, rnd, prec)) @@ -662,8 +734,8 @@ printf ("Results differ for prec=%u rnd_mode=%s and %s_z:\n" "arg1=", (unsigned) prec, mpfr_print_rnd_mode (rnd), op); - mpfr_print_binary (arg1); - printf("\narg2="); + mpfr_dump (arg1); + printf ("arg2="); mpz_out_str (stdout, 10, arg2); printf ("\ngot "); mpfr_dump (dst_small); @@ -687,11 +759,11 @@ printf ("Wrong inexact flag for rnd=%s and %s_z:\n" "expected %d, got %d\n", mpfr_print_rnd_mode (rnd), op, compare, inexact); - printf ("\narg1="); mpfr_print_binary (arg1); - printf ("\narg2="); mpz_out_str(stdout, 2, arg2); - printf ("\ndstl="); mpfr_print_binary (dst_big); - printf ("\ndsts="); mpfr_print_binary (dst_small); - printf ("\ntmp ="); mpfr_dump (tmp); + printf ("arg1="); mpfr_dump (arg1); + printf ("arg2="); mpz_out_str(stdout, 2, arg2); + printf ("\ndstl="); mpfr_dump (dst_big); + printf ("dsts="); mpfr_dump (dst_small); + printf ("tmp ="); mpfr_dump (tmp); exit (1); } } @@ -728,7 +800,7 @@ mpfr_urandomb (arg1, RANDS); mpq_set_ui (arg2, randlimb (), randlimb() ); mpq_canonicalize (arg2); - rnd = RND_RAND (); + rnd = RND_RAND_NO_RNDF (); mpfr_set_prec (dst_big, prec+10); compare = func(dst_big, arg1, arg2, rnd); if (mpfr_can_round (dst_big, prec+10, rnd, rnd, prec)) @@ -740,16 +812,15 @@ printf ("Results differ for prec=%u rnd_mode=%s and %s_q:\n" "arg1=", (unsigned) prec, mpfr_print_rnd_mode (rnd), op); - mpfr_print_binary (arg1); - printf("\narg2="); + mpfr_dump (arg1); + printf ("arg2="); mpq_out_str(stdout, 2, arg2); printf ("\ngot "); - mpfr_print_binary (dst_small); - printf ("\nexpected "); - mpfr_print_binary (tmp); - printf ("\napprox "); - mpfr_print_binary (dst_big); - putchar('\n'); + mpfr_dump (dst_small); + printf ("expected "); + mpfr_dump (tmp); + printf ("approx "); + mpfr_dump (dst_big); exit (1); } compare2 = mpfr_cmp (tmp, dst_big); @@ -766,12 +837,11 @@ printf ("Wrong inexact flag for rnd=%s and %s_q:\n" "expected %d, got %d", mpfr_print_rnd_mode (rnd), op, compare, inexact); - printf ("\narg1="); mpfr_print_binary (arg1); - printf ("\narg2="); mpq_out_str(stdout, 2, arg2); - printf ("\ndstl="); mpfr_print_binary (dst_big); - printf ("\ndsts="); mpfr_print_binary (dst_small); - printf ("\ntmp ="); mpfr_print_binary (tmp); - putchar('\n'); + printf ("arg1="); mpfr_dump (arg1); + printf ("arg2="); mpq_out_str(stdout, 2, arg2); + printf ("\ndstl="); mpfr_dump (dst_big); + printf ("dsts="); mpfr_dump (dst_small); + printf ("tmp ="); mpfr_dump (tmp); exit (1); } } @@ -817,10 +887,9 @@ (unsigned long) prec, op); printf ("\nq1="); mpq_out_str(stdout, 2, q1); printf ("\nq2="); mpq_out_str(stdout, 2, q2); - printf ("\nfr_dn="); mpfr_print_binary (fra); - printf ("\nfr_q ="); mpfr_print_binary (frq); - printf ("\nfr_up="); mpfr_print_binary (frb); - putchar('\n'); + printf ("\nfr_dn="); mpfr_dump (fra); + printf ("fr_q ="); mpfr_dump (frq); + printf ("fr_up="); mpfr_dump (frb); exit (1); } } @@ -1190,10 +1259,9 @@ if ((status != 0) || (mpfr_cmp (cmp, res) != 0)) { printf ("Results differ %d.\nres=", status); - mpfr_print_binary (res); - printf ("\ncmp="); - mpfr_print_binary (cmp); - putchar ('\n'); + mpfr_dump (res); + printf ("cmp="); + mpfr_dump (cmp); exit (1); } @@ -1205,11 +1273,12 @@ mpfr_set_inf (cmp, -1); if ((status != 0) || (mpfr_cmp(res, cmp) != 0)) { - printf ("mpfr_mul_q 1 * (-1/0) returned a wrong value :\n waiting for "); - mpfr_print_binary (cmp); - printf (" got "); - mpfr_print_binary (res); - printf ("\n trinary value is %d\n", status); + printf ("mpfr_mul_q 1 * (-1/0) returned a wrong value:\n"); + printf (" expected "); + mpfr_dump (cmp); + printf (" got "); + mpfr_dump (res); + printf (" ternary value is %d\n", status); exit (1); } @@ -1219,35 +1288,74 @@ mpfr_clear (cmp); } +static void +coverage (void) +{ + mpfr_exp_t emax, emin; + mpz_t z; + mpfr_t x; + int cmp; + + mpz_init (z); + mpfr_init2 (x, 5); + + /* coverage for mpfr_cmp_z in case of overflow */ + emax = mpfr_get_emax (); + mpfr_set_emax (63); + mpz_set_str (z, "9223372036854775808", 10); /* 2^63 */ + mpfr_set_ui_2exp (x, 1, mpfr_get_emax (), MPFR_RNDZ); + /* x = (1-2^(-p))*2^emax */ + mpfr_clear_flags (); + cmp = mpfr_cmp_z (x, z); + MPFR_ASSERTN(cmp < 0); + MPFR_ASSERTN(!mpfr_overflow_p ()); + mpfr_set_emax (emax); + + /* coverage for mpfr_cmp_z in case of underflow */ + mpz_set_str (z, "18446744073709551615", 10); /* 2^64-1 */ + emin = mpfr_get_emin (); + mpfr_set_emin (65); /* xmin = 2^64 */ + mpfr_set_ui_2exp (x, 1, 64, MPFR_RNDN); + mpfr_clear_flags (); + cmp = mpfr_cmp_z (x, z); + MPFR_ASSERTN(cmp > 0); + MPFR_ASSERTN(!mpfr_underflow_p ()); + mpfr_set_emin (emin); + + mpfr_clear (x); + mpz_clear (z); +} + int main (int argc, char *argv[]) { tests_start_mpfr (); + coverage (); special (); test_specialz (mpfr_add_z, mpz_add, "add"); test_specialz (mpfr_sub_z, mpz_sub, "sub"); test_specialz (mpfr_mul_z, mpz_mul, "mul"); - test_genericz (2, 100, 100, mpfr_add_z, "add"); - test_genericz (2, 100, 100, mpfr_sub_z, "sub"); - test_genericz (2, 100, 100, mpfr_mul_z, "mul"); - test_genericz (2, 100, 100, mpfr_div_z, "div"); + test_genericz (MPFR_PREC_MIN, 100, 100, mpfr_add_z, "add"); + test_genericz (MPFR_PREC_MIN, 100, 100, mpfr_sub_z, "sub"); + test_genericz (MPFR_PREC_MIN, 100, 100, mpfr_mul_z, "mul"); + test_genericz (MPFR_PREC_MIN, 100, 100, mpfr_div_z, "div"); test_special2z (mpfr_z_sub, mpz_sub, "sub"); - test_generic2z (2, 100, 100, mpfr_z_sub, "sub"); + test_generic2z (MPFR_PREC_MIN, 100, 100, mpfr_z_sub, "sub"); - test_genericq (2, 100, 100, mpfr_add_q, "add"); - test_genericq (2, 100, 100, mpfr_sub_q, "sub"); - test_genericq (2, 100, 100, mpfr_mul_q, "mul"); - test_genericq (2, 100, 100, mpfr_div_q, "div"); - test_specialq (2, 100, 100, mpfr_mul_q, mpq_mul, "mul"); - test_specialq (2, 100, 100, mpfr_div_q, mpq_div, "div"); - test_specialq (2, 100, 100, mpfr_add_q, mpq_add, "add"); - test_specialq (2, 100, 100, mpfr_sub_q, mpq_sub, "sub"); - - test_cmp_z (2, 100, 100); - test_cmp_q (2, 100, 100); - test_cmp_f (2, 100, 100); + test_genericq (MPFR_PREC_MIN, 100, 100, mpfr_add_q, "add"); + test_genericq (MPFR_PREC_MIN, 100, 100, mpfr_sub_q, "sub"); + test_genericq (MPFR_PREC_MIN, 100, 100, mpfr_mul_q, "mul"); + test_genericq (MPFR_PREC_MIN, 100, 100, mpfr_div_q, "div"); + test_specialq (MPFR_PREC_MIN, 100, 100, mpfr_mul_q, mpq_mul, "mul"); + test_specialq (MPFR_PREC_MIN, 100, 100, mpfr_div_q, mpq_div, "div"); + test_specialq (MPFR_PREC_MIN, 100, 100, mpfr_add_q, mpq_add, "add"); + test_specialq (MPFR_PREC_MIN, 100, 100, mpfr_sub_q, mpq_sub, "sub"); + + test_cmp_z (MPFR_PREC_MIN, 100, 100); + test_cmp_q (MPFR_PREC_MIN, 100, 100); + test_cmp_f (MPFR_PREC_MIN, 100, 100); check_for_zero (); @@ -1263,3 +1371,12 @@ return 0; } +#else + +int +main (void) +{ + return 77; +} + +#endif diff -Nru mpfr4-3.1.4/tests/tgrandom.c mpfr4-4.0.2/tests/tgrandom.c --- mpfr4-3.1.4/tests/tgrandom.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tgrandom.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_grandom -Copyright 2011-2016 Free Software Foundation, Inc. +Copyright 2011-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,10 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - +#define _MPFR_NO_DEPRECATED_GRANDOM #include "mpfr-test.h" static void @@ -34,19 +32,19 @@ mpfr_init2 (x, p); inexact = mpfr_grandom (x, NULL, RANDS, MPFR_RNDN); - if ((inexact & 3) == 0) + if (((unsigned int) inexact & 3) == 0) { printf ("Error: mpfr_grandom() returns a zero ternary value.\n"); exit (1); } - if ((inexact & (3 << 2)) != 0) + if (((unsigned int) inexact & (3 << 2)) != 0) { printf ("Error: the second ternary value of mpfr_grandom(x, NULL, ...)" " must be 0.\n"); exit (1); } - mpfr_clear(x); + mpfr_clear (x); } @@ -55,7 +53,6 @@ int verbose) { mpfr_t *t; - mpfr_t av, va, tmp; int i, inexact; nbtests = (nbtests & 1) ? (nbtests + 1) : nbtests; @@ -67,7 +64,8 @@ for (i = 0; i < nbtests; i += 2) { inexact = mpfr_grandom (t[i], t[i + 1], RANDS, MPFR_RNDN); - if ((inexact & 3) == 0 || (inexact & (3 << 2)) == 0) + if (((unsigned int) inexact & 3) == 0 || + ((unsigned int) inexact & (3 << 2)) == 0) { /* one call in the loop pretended to return an exact number! */ printf ("Error: mpfr_grandom() returns a zero ternary value.\n"); @@ -75,9 +73,11 @@ } } -#ifdef HAVE_STDARG +#if defined(HAVE_STDARG) && !defined(MPFR_USE_MINI_GMP) if (verbose) { + mpfr_t av, va, tmp; + mpfr_init2 (av, prec); mpfr_init2 (va, prec); mpfr_init2 (tmp, prec); @@ -114,6 +114,8 @@ { long nbtests; int verbose; + int i; + tests_start_mpfr (); verbose = 0; @@ -129,6 +131,9 @@ test_grandom (nbtests, 420, MPFR_RNDN, verbose); test_special (2); test_special (42000); + /* the following should exercise the case "Extend by 32 bits" in grandom.c */ + for (i = 0; i < 10000; i++) + test_special (1); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/thyperbolic.c mpfr4-4.0.2/tests/thyperbolic.c --- mpfr4-3.1.4/tests/thyperbolic.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/thyperbolic.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for hyperbolic function : mpfr_cosh, mpfr_sinh, mpfr_tanh, mpfr_acosh, mpfr_asinh, mpfr_atanh. -Copyright 2001-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2001-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static int @@ -220,13 +217,13 @@ MPFR_SET_INF(t); - if(MPFR_SIGN(t)<0) + if(MPFR_IS_NEG (t)) MPFR_CHANGE_SIGN(t); /******cosh********/ tester = mpfr_cosh(ch,t,MPFR_RNDD); - if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester!=0) + if (!MPFR_IS_INF(ch) || MPFR_IS_NEG (ch) || tester!=0) { printf("cosh(INF) \n"); fail = 1; @@ -236,7 +233,7 @@ /******sinh********/ tester=mpfr_sinh(sh,t,MPFR_RNDD); - if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) < 0 || tester!=0) + if (!MPFR_IS_INF(sh) || MPFR_IS_NEG (sh) || tester!=0) { printf("sinh(INF) \n"); fail = 1; @@ -256,7 +253,7 @@ /******acosh********/ tester=mpfr_acosh(ach,t,MPFR_RNDD); - if (!MPFR_IS_INF(ach) || MPFR_SIGN(ach) < 0 || tester!=0) + if (!MPFR_IS_INF(ach) || MPFR_IS_NEG (ach) || tester!=0) { printf("acosh(INF) \n"); fail = 1; @@ -266,7 +263,7 @@ /******asinh********/ tester=mpfr_asinh(ash,t,MPFR_RNDD); - if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) < 0 || tester!=0) + if (!MPFR_IS_INF(ash) || MPFR_IS_NEG (ash) || tester!=0) { printf("asinh(INF) \n"); fail = 1; @@ -288,7 +285,7 @@ /******cosh********/ tester=mpfr_cosh(ch,t,MPFR_RNDD); - if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester!=0) + if (!MPFR_IS_INF(ch) || MPFR_IS_NEG (ch) || tester!=0) { printf("cosh(-INF) \n"); fail = 1; @@ -298,7 +295,7 @@ /******sinh********/ tester=mpfr_sinh(sh,t,MPFR_RNDD); - if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) > 0 || tester!=0) + if (!MPFR_IS_INF(sh) || MPFR_IS_POS (sh) || tester!=0) { printf("sinh(-INF) \n"); fail = 1; @@ -328,7 +325,7 @@ /******asinh********/ tester=mpfr_asinh(ash,t,MPFR_RNDD); - if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) > 0 || tester!=0) + if (!MPFR_IS_INF(ash) || MPFR_IS_POS (ash) || tester!=0) { printf("asinh(-INF) \n"); fail = 1; diff -Nru mpfr4-3.1.4/tests/thypot.c mpfr4-4.0.2/tests/thypot.c --- mpfr4-3.1.4/tests/thypot.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/thypot.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_hypot. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include - #include "mpfr-test.h" /* Non-zero when extended exponent range */ @@ -314,17 +310,46 @@ } } +/* Test failing with GMP_CHECK_RANDOMIZE=1513841234 (overflow flag not set). + The bug was in fact in mpfr_nexttoinf which didn't set the overflow flag. */ +static void +bug20171221 (void) +{ + mpfr_t x, u, y; + int inex; + mpfr_exp_t emax; + + mpfr_init2 (x, 12); + mpfr_init2 (u, 12); + mpfr_init2 (y, 11); + mpfr_set_str_binary (x, "0.111111111110E0"); + mpfr_set_str_binary (u, "0.111011110100E-177"); + emax = mpfr_get_emax (); + mpfr_set_emax (0); + mpfr_clear_flags (); + inex = mpfr_hypot (y, x, u, MPFR_RNDU); + MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) > 0); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_inexflag_p ()); + MPFR_ASSERTN(mpfr_overflow_p ()); + mpfr_set_emax (emax); + mpfr_clear (x); + mpfr_clear (u); + mpfr_clear (y); +} + int main (int argc, char *argv[]) { tests_start_mpfr (); + bug20171221 (); special (); test_large (); alltst (); - test_generic (2, 100, 10); + test_generic (MPFR_PREC_MIN, 100, 10); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tinits.c mpfr4-4.0.2/tests/tinits.c --- mpfr4-3.1.4/tests/tinits.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/tests/tinits.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_init2, mpfr_inits, mpfr_inits2 and mpfr_clears. -Copyright 2003, 2006-2016 Free Software Foundation, Inc. +Copyright 2003, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include - #include "mpfr-test.h" int @@ -42,9 +40,21 @@ large_prec = 2147483647; if (getenv ("MPFR_CHECK_LARGEMEM") != NULL) { + size_t min_memory_limit; + /* We assume that the precision won't be increased internally. */ if (large_prec > MPFR_PREC_MAX) large_prec = MPFR_PREC_MAX; + + /* Increase tests_memory_limit if need be in order to avoid an + obvious failure due to insufficient memory, by choosing a bit + more than the memory used for the variables a and b. Note + that such an increase is necessary, but is not guaranteed to + be sufficient in all cases (e.g. with logging activated). */ + min_memory_limit = 2 * (large_prec / MPFR_BYTES_PER_MP_LIMB) + 65536; + if (tests_memory_limit > 0 && tests_memory_limit < min_memory_limit) + tests_memory_limit = min_memory_limit; + mpfr_inits2 (large_prec, a, b, (mpfr_ptr) 0); mpfr_set_ui (a, 17, MPFR_RNDN); mpfr_set (b, a, MPFR_RNDN); diff -Nru mpfr4-3.1.4/tests/tinp_str.c mpfr4-4.0.2/tests/tinp_str.c --- mpfr4-3.1.4/tests/tinp_str.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tinp_str.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_inp_str. -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" int @@ -31,31 +28,39 @@ mpfr_t x; mpfr_t y; FILE *f; - int i; + int i, n; + tests_start_mpfr (); mpfr_init (x); mpfr_init (y); mpfr_set_prec (x, 15); - f = src_fopen ("inp_str.data", "r"); + f = src_fopen ("inp_str.dat", "r"); if (f == NULL) { - printf ("Error, can't open inp_str.data\n"); + printf ("Error, can't open inp_str.dat\n"); + exit (1); + } + i = mpfr_inp_str (x, f, 10, MPFR_RNDN); + if (i == 0 || mpfr_cmp_si (x, -1700)) + { + printf ("Error in reading 1st line from file inp_str.dat (%d)\n", i); + mpfr_dump (x); exit (1); } i = mpfr_inp_str (x, f, 10, MPFR_RNDN); if (i == 0 || mpfr_cmp_ui (x, 31415)) { - printf ("Error in reading 1st line from file inp_str.data (%d)\n", i); + printf ("Error in reading 2nd line from file inp_str.dat (%d)\n", i); mpfr_dump (x); exit (1); } getc (f); i = mpfr_inp_str (x, f, 10, MPFR_RNDN); - if ((i == 0) || mpfr_cmp_ui (x, 31416)) + if (i == 0 || mpfr_cmp_ui (x, 31416)) { - printf ("Error in reading 2nd line from file inp_str.data (%d)\n", i); + printf ("Error in reading 3rd line from file inp_str.dat (%d)\n", i); mpfr_dump (x); exit (1); } @@ -63,7 +68,7 @@ i = mpfr_inp_str (x, f, 10, MPFR_RNDN); if (i != 0) { - printf ("Error in reading 3rd line from file inp_str.data (%d)\n", i); + printf ("Error in reading 4th line from file inp_str.dat (%d)\n", i); mpfr_dump (x); exit (1); } @@ -72,12 +77,14 @@ mpfr_set_prec (y, 53); mpfr_set_str (y, "1.0010010100001110100101001110011010111011100001110010e226", 2, MPFR_RNDN); - for (i = 2; i < 63; i++) + for (n = 2; n < 63; n++) { getc (f); - if (mpfr_inp_str (x, f, i, MPFR_RNDN) == 0 || !mpfr_equal_p (x, y)) + i = mpfr_inp_str (x, f, n, MPFR_RNDN); + if (i == 0 || !mpfr_equal_p (x, y)) { - printf ("Error in reading %dth line from file inp_str.data\n", i+2); + printf ("Error in reading %dth line from file inp_str.dat (%d)\n", + n+3, i); mpfr_dump (x); exit (1); } diff -Nru mpfr4-3.1.4/tests/tinternals.c mpfr4-4.0.2/tests/tinternals.c --- mpfr4-3.1.4/tests/tinternals.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tinternals.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* tinternals -- Test for internals. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #define MPFR_NEED_LONGLONG_H #include "mpfr-test.h" @@ -70,7 +67,7 @@ mpfr_neg (x, x, MPFR_RNDN), p++, neg++) for (err = 2; err <= 6; err++) for (dir = 0; dir <= 1; dir++) - RND_LOOP(r) + RND_LOOP_NO_RNDF (r) { inex = mpfr_round_near_x (y, x, err, dir, (mpfr_rnd_t) r); @@ -147,11 +144,7 @@ { tests_start_mpfr (); - /* The tested function and macro exist in MPFR 2.2.0, but with a - different (incorrect, but with no effect in 2.2.0) behavior. */ -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,3,0) test_int_ceil_log2 (); -#endif test_round_near_x (); test_set_prec_raw (); diff -Nru mpfr4-3.1.4/tests/tisnan.c mpfr4-4.0.2/tests/tisnan.c --- mpfr4-3.1.4/tests/tisnan.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tisnan.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* Test file for mpfr_nan_p, mpfr_inf_p, mpfr_number_p, mpfr_zero_p and mpfr_regular_p. -Copyright 2001-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2001-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,12 +18,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" int diff -Nru mpfr4-3.1.4/tests/tisqrt.c mpfr4-4.0.2/tests/tisqrt.c --- mpfr4-3.1.4/tests/tisqrt.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tisqrt.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for __gmpfr_isqrt and __gmpfr_cuberoot internal functions. -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void diff -Nru mpfr4-3.1.4/tests/tj0.c mpfr4-4.0.2/tests/tj0.c --- mpfr4-3.1.4/tests/tj0.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tj0.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* tj0 -- test file for the Bessel function of first kind (order 0) -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_j0 @@ -137,7 +134,7 @@ mpfr_clear (x); mpfr_clear (y); - test_generic (2, 100, 10); + test_generic (MPFR_PREC_MIN, 100, 10); data_check ("data/j0", mpfr_j0, "mpfr_j0"); diff -Nru mpfr4-3.1.4/tests/tj1.c mpfr4-4.0.2/tests/tj1.c --- mpfr4-3.1.4/tests/tj1.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tj1.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* tj1 -- test file for the Bessel function of first kind (order 1) -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_j1 @@ -30,6 +27,51 @@ #define REDUCE_EMAX 262143 /* otherwise arg. reduction is too expensive */ #include "tgeneric.c" +/* test for small input, where j1(x) = x/2 - x^3/16 + ... */ +static void +test_small (void) +{ + mpfr_t x, y; + int inex, sign; + mpfr_exp_t e, emin; + + mpfr_init2 (x, 10); + mpfr_init2 (y, 9); + emin = mpfr_get_emin (); + for (e = -4; e >= -30; e--) + { + if (e == -30) + { + e = mpfr_get_emin_min () - 1; + mpfr_set_emin (e + 1); + } + for (sign = -1; sign <= 1; sign += 2) + { + mpfr_set_si_2exp (x, sign, e, MPFR_RNDN); + mpfr_nexttoinf (x); + inex = mpfr_j1 (y, x, MPFR_RNDN); + if (e >= -29) + { + /* since |x| is just above 2^e, |j1(x)| is just above 2^(e-1), + thus y should be 2^(e-1) and the inexact flag should be + of opposite sign of x */ + MPFR_ASSERTN(mpfr_cmp_si_2exp (y, sign, e - 1) == 0); + MPFR_ASSERTN(VSIGN (inex) * sign < 0); + } + else + { + /* here |y| should be 0.5*2^emin and the inexact flag should + have the sign of x */ + MPFR_ASSERTN(mpfr_cmp_si_2exp (y, sign, e) == 0); + MPFR_ASSERTN(VSIGN (inex) * sign > 0); + } + } + } + mpfr_set_emin (emin); + mpfr_clear (x); + mpfr_clear (y); +} + int main (int argc, char *argv[]) { @@ -37,6 +79,8 @@ tests_start_mpfr (); + test_small (); + mpfr_init (x); mpfr_init (y); @@ -78,7 +122,7 @@ mpfr_clear (x); mpfr_clear (y); - test_generic (2, 100, 10); + test_generic (MPFR_PREC_MIN, 100, 10); data_check ("data/j1", mpfr_j1, "mpfr_j1"); diff -Nru mpfr4-3.1.4/tests/tjn.c mpfr4-4.0.2/tests/tjn.c --- mpfr4-3.1.4/tests/tjn.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tjn.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* tjn -- test file for the Bessel function of first kind -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include /* for LONG_MAX */ - #include "mpfr-test.h" int diff -Nru mpfr4-3.1.4/tests/tl2b.c mpfr4-4.0.2/tests/tl2b.c --- mpfr4-3.1.4/tests/tl2b.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tl2b.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for l2b constants. -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,39 +17,50 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Execute this program with an argument to generate code that initializes the l2b constants. */ -#include -#include #include "mpfr-test.h" /* Must be a multiple of 4 */ static const int bits2use[] = {16, 32, 64, 96, 128, 256}; -#define size_of_bits2use ((sizeof bits2use) / sizeof bits2use[0]) +#define size_of_bits2use (numberof (bits2use)) static __mpfr_struct l2b[BASE_MAX-1][2]; static void print_mpfr (mpfr_srcptr x, const char *name) { - unsigned char temp[16]; /* buffer for the base-256 string */ - unsigned char *ptr; /* pointer to its first non-zero byte */ - int size; /* size of the string */ - int i; /* bits2use index */ - int j; /* output limb index */ - int k; /* byte index (in output limb) */ - int r; /* digit index, relative to ptr */ + unsigned char temp[16]; /* buffer for the base-256 string */ + unsigned char *ptr; /* pointer to its first non-zero byte */ + int size; /* size of the string */ + int i; /* bits2use index */ + int j; /* output limb index */ + int k; /* byte index (in output limb) */ + int r; /* digit index, relative to ptr */ + char prefix[12]; /* "0x" or "UINT64_C(0x" */ + char suffix[2]; /* "" or ")" */ if (printf ("#if 0\n") < 0) { fprintf (stderr, "Error in printf\n"); exit (1); } for (i = 0; i < size_of_bits2use; i++) { + if (bits2use[i] == 64) + { + strcpy (prefix, "UINT64_C(0x"); + strcpy (suffix, ")"); + } + else + { + strcpy (prefix, "0x"); + strcpy (suffix, ""); + } if (printf ("#elif GMP_NUMB_BITS == %d\n" - "const mp_limb_t %s__tab[] = { 0x", bits2use[i], name) < 0) + "const mp_limb_t %s__tab[] = { %s", bits2use[i], name, + prefix) < 0) { fprintf (stderr, "Error in printf\n"); exit (1); } size = mpn_get_str (temp, 256, MPFR_MANT (x), MPFR_LIMB_SIZE (x)); MPFR_ASSERTN (size <= 16); @@ -68,7 +79,9 @@ for (k = 0; k < bits2use[i] / 8; k++) if (printf ("%02x", r < size ? ptr[r++] : 0) < 0) { fprintf (stderr, "Error in printf\n"); exit (1); } - if (printf (j == 0 ? " };\n" : ", 0x") < 0) + if (j == 0 && printf ("%s };\n", suffix) < 0) + { fprintf (stderr, "Error in printf\n"); exit (1); } + else if (j > 0 && printf ("%s, %s", suffix, prefix) < 0) { fprintf (stderr, "Error in printf\n"); exit (1); } } } @@ -83,7 +96,10 @@ mpfr_srcptr t; int beta, i; int error = 0; - char buffer[30]; + char buffer[256]; /* larger than needed, for maintainability */ + + if (output) + printf ("#ifndef UINT64_C\n# define UINT64_C(c) c\n#endif\n\n"); for (beta = 2; beta <= BASE_MAX; beta++) { @@ -101,7 +117,7 @@ } else { - /* 76-bit upper approximation to log(2)/log(b) */ + /* 77-bit upper approximation to log(2)/log(b) */ mpfr_init2 (p, 77); mpfr_set_ui (p, beta, MPFR_RNDD); mpfr_log2 (p, p, MPFR_RNDD); diff -Nru mpfr4-3.1.4/tests/tlgamma.c mpfr4-4.0.2/tests/tlgamma.c --- mpfr4-3.1.4/tests/tlgamma.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tlgamma.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_tlgamma -- test file for lgamma function -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static int @@ -147,9 +144,9 @@ { printf ("mpfr_lgamma("CHECK_X1") is wrong:\n" "expected "); - mpfr_print_binary (x); putchar ('\n'); + mpfr_dump (x); printf ("got "); - mpfr_print_binary (y); putchar ('\n'); + mpfr_dump (y); exit (1); } @@ -163,9 +160,9 @@ { printf ("mpfr_lgamma("CHECK_X2") is wrong:\n" "expected "); - mpfr_print_binary (x); putchar ('\n'); + mpfr_dump (x); printf ("got "); - mpfr_print_binary (y); putchar ('\n'); + mpfr_dump (y); exit (1); } @@ -192,8 +189,8 @@ if (mpfr_equal_p (x, y) == 0 || sign != 1) { printf ("Error in mpfr_lgamma (120)\n"); - printf ("Expected "); mpfr_print_binary (y); puts (""); - printf ("Got "); mpfr_print_binary (x); puts (""); + printf ("Expected "); mpfr_dump (y); + printf ("Got "); mpfr_dump (x); exit (1); } @@ -388,13 +385,83 @@ return mpfr_lgamma (y, &sign, x, r); } +/* Since r10377, the following test causes a "too much memory" error + when MPFR is built with Debian's tcc 0.9.27~git20151227.933c223-1 + on x86_64. The problem came from __gmpfr_ceil_log2, now fixed in + r10443 (according to the integer promotion rules, this appeared to + be a bug in tcc, not in MPFR; however relying on such an obscure + rule was not a good idea). */ +static void +tcc_bug20160606 (void) +{ + mpfr_t x, y; + int sign; + + mpfr_init2 (x, 53); + mpfr_init2 (y, 53); + mpfr_set_ui_2exp (x, 1, -1, MPFR_RNDN); + mpfr_lgamma (y, &sign, x, MPFR_RNDN); + mpfr_clear (x); + mpfr_clear (y); +} + +/* With r12088, mpfr_lgamma is much too slow with a reduced emax that + yields an overflow, even though this case is easier. In practice, + this test will hang. */ +static void +bug20180110 (void) +{ + mpfr_exp_t emax, e; + mpfr_t x, y, z; + mpfr_flags_t flags, eflags; + int i, inex, sign; + + emax = mpfr_get_emax (); + + mpfr_init2 (x, 2); + mpfr_inits2 (64, y, z, (mpfr_ptr) 0); + eflags = MPFR_FLAGS_INEXACT | MPFR_FLAGS_OVERFLOW; + + for (i = 10; i <= 30; i++) + { + mpfr_set_si_2exp (x, -1, -(1L << i), MPFR_RNDN); /* -2^(-2^i) */ + mpfr_lgamma (y, &sign, x, MPFR_RNDZ); + e = mpfr_get_exp (y); + mpfr_set_emax (e - 1); + mpfr_clear_flags (); + inex = mpfr_lgamma (y, &sign, x, MPFR_RNDZ); + flags = __gmpfr_flags; + mpfr_set_inf (z, 1); + mpfr_nextbelow (z); + mpfr_set_emax (emax); + if (! (mpfr_equal_p (y, z) && SAME_SIGN (inex, -1) && flags == eflags)) + { + printf ("Error in bug20180110 for i = %d:\n", i); + printf ("Expected "); + mpfr_dump (z); + printf ("with inex = %d and flags =", -1); + flags_out (eflags); + printf ("Got "); + mpfr_dump (y); + printf ("with inex = %d and flags =", inex); + flags_out (flags); + exit (1); + } + } + + mpfr_clears (x, y, z, (mpfr_ptr) 0); +} + int main (void) { tests_start_mpfr (); + tcc_bug20160606 (); + bug20180110 (); + special (); - test_generic (2, 100, 2); + test_generic (MPFR_PREC_MIN, 100, 2); data_check ("data/lgamma", mpfr_lgamma1, "mpfr_lgamma"); diff -Nru mpfr4-3.1.4/tests/tli2.c mpfr4-4.0.2/tests/tli2.c --- mpfr4-3.1.4/tests/tli2.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tli2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_tli2 -- test file for dilogarithm function -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,16 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) - #define TEST_FUNCTION mpfr_li2 #include "tgeneric.c" @@ -188,21 +183,10 @@ normal (); - test_generic (2, 100, 2); + test_generic (MPFR_PREC_MIN, 100, 2); data_check ("data/li2", mpfr_li2, "mpfr_li2"); tests_end_mpfr (); return 0; } - -#else - -int -main (void) -{ - printf ("Warning! Test disabled for this MPFR version.\n"); - return 0; -} - -#endif diff -Nru mpfr4-3.1.4/tests/tlngamma.c mpfr4-4.0.2/tests/tlngamma.c --- mpfr4-3.1.4/tests/tlngamma.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/tests/tlngamma.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_tlngamma -- test file for lngamma function -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_lngamma @@ -146,9 +143,9 @@ { printf ("mpfr_lngamma("CHECK_X1") is wrong:\n" "expected "); - mpfr_print_binary (x); putchar ('\n'); + mpfr_dump (x); printf ("got "); - mpfr_print_binary (y); putchar ('\n'); + mpfr_dump (y); exit (1); } @@ -161,9 +158,9 @@ { printf ("mpfr_lngamma("CHECK_X2") is wrong:\n" "expected "); - mpfr_print_binary (x); putchar ('\n'); + mpfr_dump (x); printf ("got "); - mpfr_print_binary (y); putchar ('\n'); + mpfr_dump (y); exit (1); } @@ -188,8 +185,8 @@ if (mpfr_cmp0 (x, y)) { printf ("Error in mpfr_lngamma (120)\n"); - printf ("Expected "); mpfr_print_binary (y); puts (""); - printf ("Got "); mpfr_print_binary (x); puts (""); + printf ("Expected "); mpfr_dump (y); + printf ("Got "); mpfr_dump (x); exit (1); } @@ -255,13 +252,71 @@ mpfr_clear (y); } +/* test failing with GMP_CHECK_RANDOMIZE=1513869588 */ +static void +bug20171220 (void) +{ + mpfr_t x, y, z; + int inex; + + mpfr_init2 (x, 15); + mpfr_init2 (y, 15); + mpfr_init2 (z, 15); + + mpfr_set_str (x, "1.01111e+00", 10, MPFR_RNDN); /* x = 8283/8192 */ + inex = mpfr_lngamma (y, x, MPFR_RNDN); + mpfr_set_str (z, "-0.0063109971733698154140545190234", 10, MPFR_RNDN); + MPFR_ASSERTN(mpfr_equal_p (y, z)); + MPFR_ASSERTN(inex > 0); + + mpfr_set_prec (x, 43); + mpfr_set_prec (y, 1); + mpfr_set_prec (z, 1); + mpfr_set_str (x, "9.8888652212918e-01", 10, MPFR_RNDN); + /* lngamma(x) = 0.00651701007222520, should be rounded up to 0.0078125 */ + inex = mpfr_lngamma (y, x, MPFR_RNDU); + mpfr_set_ui_2exp (z, 1, -7, MPFR_RNDN); + MPFR_ASSERTN(mpfr_equal_p (y, z)); + MPFR_ASSERTN(inex > 0); + + mpfr_clear (x); + mpfr_clear (y); + mpfr_clear (z); +} + +/* taway failing with GMP_CHECK_RANDOMIZE=1513888822 */ +static void +bug20171220a (void) +{ + mpfr_t x, y, z; + int inex; + + mpfr_init2 (x, 198); + mpfr_init2 (y, 1); + mpfr_init2 (z, 1); + + mpfr_set_str (x, "9.999962351340362288585900348170984233205352566408878552154832e-01", 10, MPFR_RNDN); + inex = mpfr_lngamma (y, x, MPFR_RNDA); + /* lngamma(x) ~ 2.1731512683e0-6 ~ 2^-18.81, should be rounded to 2^-18 */ + mpfr_set_si_2exp (z, 1, -18, MPFR_RNDN); + MPFR_ASSERTN(mpfr_equal_p (y, z)); + MPFR_ASSERTN(inex > 0); + + mpfr_clear (x); + mpfr_clear (y); + mpfr_clear (z); +} + int main (void) { tests_start_mpfr (); + bug20171220 (); + bug20171220a (); + special (); - test_generic (2, 100, 2); + test_generic (MPFR_PREC_MIN, 100, 2); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tlog10.c mpfr4-4.0.2/tests/tlog10.c --- mpfr4-3.1.4/tests/tlog10.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tlog10.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_log10. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #ifdef CHECK_EXTERNAL @@ -61,7 +58,7 @@ tests_start_mpfr (); - test_generic (2, 100, 20); + test_generic (MPFR_PREC_MIN, 100, 20); mpfr_init2 (x, 53); mpfr_init2 (y, 53); diff -Nru mpfr4-3.1.4/tests/tlog1p.c mpfr4-4.0.2/tests/tlog1p.c --- mpfr4-3.1.4/tests/tlog1p.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tlog1p.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_log1p. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #ifdef CHECK_EXTERNAL @@ -139,7 +136,7 @@ special (); other (); - test_generic (2, 100, 50); + test_generic (MPFR_PREC_MIN, 100, 50); data_check ("data/log1p", mpfr_log1p, "mpfr_log1p"); bad_cases (mpfr_log1p, mpfr_expm1, "mpfr_log1p", 256, -64, 40, diff -Nru mpfr4-3.1.4/tests/tlog2.c mpfr4-4.0.2/tests/tlog2.c --- mpfr4-3.1.4/tests/tlog2.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tlog2.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_log2. -Copyright 2001-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2001-2002, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_log2 @@ -75,7 +72,7 @@ special (); - test_generic (2, 100, 30); + test_generic (MPFR_PREC_MIN, 100, 30); data_check ("data/log2", mpfr_log2, "mpfr_log2"); diff -Nru mpfr4-3.1.4/tests/tlog.c mpfr4-4.0.2/tests/tlog.c --- mpfr4-3.1.4/tests/tlog.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tlog.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_log. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #ifdef CHECK_EXTERNAL @@ -64,24 +61,23 @@ printf ("correct result is %s\n mpfr_log gives ", res1s); mpfr_out_str(stdout, 10, 0, tres, MPFR_RNDN); + printf ("\n"); exit (1); } mpfr_clears (ta, tres, (mpfr_ptr) 0); } static void -check3 (double d, unsigned long prec, mpfr_rnd_t rnd) +check3 (char *s, unsigned long prec, mpfr_rnd_t rnd) { mpfr_t x, y; mpfr_init2 (x, prec); mpfr_init2 (y, prec); - mpfr_set_d (x, d, rnd); + mpfr_set_str (x, s, 10, rnd); test_log (y, x, rnd); mpfr_out_str (stdout, 10, 0, y, rnd); puts (""); - mpfr_print_binary (y); - puts (""); mpfr_clear (x); mpfr_clear (y); } @@ -277,9 +273,10 @@ { tests_start_mpfr (); - if (argc==4) + if (argc == 3 || argc == 4) { /* tlog x prec rnd */ - check3 (atof(argv[1]), atoi(argv[2]), (mpfr_rnd_t) atoi(argv[3])); + check3 (argv[1], strtoul (argv[2], NULL, 10), + (argc == 4) ? (mpfr_rnd_t) atoi (argv[3]) : MPFR_RNDN); goto done; } @@ -350,7 +347,7 @@ x_near_one (); - test_generic (2, 100, 40); + test_generic (MPFR_PREC_MIN, 100, 40); data_check ("data/log", mpfr_log, "mpfr_log"); bad_cases (mpfr_log, mpfr_exp, "mpfr_log", 256, -30, 30, 4, 128, 800, 50); diff -Nru mpfr4-3.1.4/tests/tlog_ui.c mpfr4-4.0.2/tests/tlog_ui.c --- mpfr4-3.1.4/tests/tlog_ui.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/tlog_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,202 @@ +/* Test file for mpfr_log_ui. + +Copyright 2016-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-test.h" + +static void +compare_with_log (unsigned long n, mpfr_prec_t p) +{ + mpfr_t x, y; + int inex1, inex2; + mpfr_flags_t flags1; + + mpfr_init2 (x, sizeof (unsigned long) * CHAR_BIT); + mpfr_init2 (y, p); + inex1 = mpfr_set_ui (x, n, MPFR_RNDN); + MPFR_ASSERTN(inex1 == 0); + inex1 = mpfr_log (y, x, MPFR_RNDN); + flags1 = __gmpfr_flags; + mpfr_set_prec (x, p); + inex2 = mpfr_log_ui (x, n, MPFR_RNDN); + MPFR_ASSERTN(inex1 == inex2); + MPFR_ASSERTN(flags1 == __gmpfr_flags); + MPFR_ASSERTN(mpfr_equal_p (x, y)); + mpfr_clears (x, y, (mpfr_ptr) 0); +} + +#define TEST_FUNCTION mpfr_log_ui +#define ONE_ARG +#define ULONG_ARG1 +#define RAND_FUNCTION(x) mpfr_set_ui (x, randlimb (), MPFR_RNDN) +#include "tgeneric.c" + +#define TEST_FUNCTION mpfr_log_ui + +int +main (int argc, char *argv[]) +{ + unsigned int prec, yprec; + int rnd; + mpfr_t x, y, z, t, v; + unsigned long m, n; + int inex; + mpfr_exp_t emin, emax; + int i; + + tests_start_mpfr (); + + emin = mpfr_get_emin (); + emax = mpfr_get_emax (); + + mpfr_inits2 (53, x, y, z, t, (mpfr_ptr) 0); + mpfr_init2 (v, sizeof (unsigned long) * CHAR_BIT); + + if (argc >= 3) /* tlog_ui n prec [rnd] */ + { + mpfr_set_prec (x, strtoul (argv[2], NULL, 10)); + TEST_FUNCTION (x, strtoul (argv[1], NULL, 10), + argc > 3 ? (mpfr_rnd_t) atoi (argv[3]) : MPFR_RNDN); + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); + printf ("\n"); + goto clear_and_exit; + } + + mpfr_set_prec (x, 33); + mpfr_set_prec (y, 33); + mpfr_log_ui (x, 3, MPFR_RNDZ); + mpfr_set_str_binary (y, "1.0001100100111110101001111010101"); + if (mpfr_cmp (x, y)) + { + printf ("Error for log(3), prec=33, MPFR_RNDZ\n"); + printf ("expected "); mpfr_dump (y); + printf ("got "); mpfr_dump (x); + exit (1); + } + + mpfr_set_prec (x, 60); + mpfr_set_prec (y, 60); + mpfr_log_ui (x, 19, MPFR_RNDU); + mpfr_set_str_binary (y, "10.1111000111000110110000001100000010010110011001011000111010"); + if (mpfr_cmp (x, y)) + { + printf ("Error for log(19), prec=60, MPFR_RNDU\n"); + printf ("expected "); mpfr_dump (y); + printf ("got "); mpfr_dump (x); + exit (1); + } + + mpfr_clear_flags (); + inex = mpfr_log_ui (x, 0, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + MPFR_ASSERTN (mpfr_inf_p (x)); + MPFR_ASSERTN (mpfr_sgn (x) < 0); + MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_DIVBY0); + + mpfr_clear_flags (); + inex = mpfr_log_ui (x, 1, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + MPFR_ASSERTN (mpfr_zero_p (x)); + MPFR_ASSERTN (mpfr_signbit (x) == 0); + MPFR_ASSERTN (__gmpfr_flags == 0); + + for (prec = MPFR_PREC_MIN; prec <= 100; prec++) + { + mpfr_set_prec (x, prec); + mpfr_set_prec (z, prec); + mpfr_set_prec (t, prec); + yprec = prec + 20; + mpfr_set_prec (y, yprec); + + for (m = 2; m < 130; m++) + RND_LOOP (rnd) + { + /* Start with n = 2 to 49 (mpfr_can_round would fail for n < 2), + then around ULONG_MAX/3, then around LONG_MAX, then + ULONG_MAX down to ULONG_MAX-19. */ + n = (m < 50 ? m : + m < 80 ? ULONG_MAX/3 + m - 65 : + m < 110 ? (unsigned long) LONG_MAX + m - 95 : + ULONG_MAX - (m - 110)); + inex = mpfr_set_ui (v, n, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + mpfr_log (y, v, MPFR_RNDN); + if (mpfr_can_round (y, yprec, MPFR_RNDN, MPFR_RNDZ, prec + + (rnd == MPFR_RNDN))) + { + mpfr_set (t, y, (mpfr_rnd_t) rnd); + for (i = 0; i <= 1; i++) + { + if (i) + { + mpfr_exp_t e; + + if (MPFR_IS_SINGULAR (t)) + break; + e = mpfr_get_exp (t); + set_emin (e); + set_emax (e); + } + TEST_FUNCTION (z, n, (mpfr_rnd_t) rnd); + if (i) + { + set_emin (emin); + set_emax (emax); + } + if (mpfr_cmp (t, z)) + { + printf ("results differ for n = %lu, prec = %u," + " %s%s\n", n, prec, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), + i ? ", reduced exponent range" : ""); + printf (" got "); + mpfr_dump (z); + printf (" expected "); + mpfr_dump (t); + printf (" approx "); + mpfr_dump (y); + exit (1); + } + } + } + else + { + /* We are not doing random tests. The precision increase + must have be chosen so that this case never occurs. */ + printf ("mpfr_can_round failed for n = %lu, prec = %u, %s\n", + n, prec, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + exit (1); + } + } + } + + + test_generic (MPFR_PREC_MIN, 1000, 1); + + for (n = 1; n < ULONG_MAX / 3; n *= 3) + compare_with_log (n, 10); + + clear_and_exit: + mpfr_clears (x, y, z, t, v, (mpfr_ptr) 0); + + tests_end_mpfr (); + return 0; +} diff -Nru mpfr4-3.1.4/tests/tminmax.c mpfr4-4.0.2/tests/tminmax.c --- mpfr4-3.1.4/tests/tminmax.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tminmax.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_min & mpfr_max. -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" int diff -Nru mpfr4-3.1.4/tests/tmin_prec.c mpfr4-4.0.2/tests/tmin_prec.c --- mpfr4-3.1.4/tests/tmin_prec.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tmin_prec.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_min_prec. -Copyright 2009-2016 Free Software Foundation, Inc. +Copyright 2009-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" int diff -Nru mpfr4-3.1.4/tests/tmodf.c mpfr4-4.0.2/tests/tmodf.c --- mpfr4-3.1.4/tests/tmodf.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/tests/tmodf.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_modf. -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,16 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) - static void check (const char *xis, const char *xfs, const char *xs, mpfr_prec_t xip, mpfr_prec_t xfp, mpfr_prec_t xp, @@ -223,14 +218,3 @@ tests_end_mpfr (); return 0; } - -#else - -int -main (void) -{ - printf ("Warning! Test disabled for this MPFR version.\n"); - return 0; -} - -#endif diff -Nru mpfr4-3.1.4/tests/tmul_2exp.c mpfr4-4.0.2/tests/tmul_2exp.c --- mpfr4-3.1.4/tests/tmul_2exp.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tmul_2exp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_{mul,div}_2{ui,si}. -Copyright 1999, 2001-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static const char * const val[] = { @@ -72,7 +69,7 @@ for (prec = 6; prec >= 3; prec -= 3) { mpfr_inits2 (prec, z1, z2, (mpfr_ptr) 0); - RND_LOOP (rnd) + RND_LOOP_NO_RNDF (rnd) for (k = 1; k <= 4; k++) { /* The following one is assumed to be correct. */ @@ -104,10 +101,8 @@ printf ("MPFR_EMIN_MIN"); else if (e == emin) printf ("default emin"); - else if (e >= LONG_MIN) - printf ("%ld", (long) e); else - printf ("LONG_MAX"); + printf ("%" MPFR_EXP_FSPEC "d", (mpfr_eexp_t) e); printf (") for mpfr_mul_2si\n"); printf ("Expected inex > 0, flags = %u,\n y = ", (unsigned int) MPFR_FLAGS_INEXACT); @@ -195,10 +188,8 @@ printf ("MPFR_EMAX_MAX"); else if (e == emax) printf ("default emax"); - else if (e <= LONG_MAX) - printf ("%ld", (long) e); else - printf (">LONG_MAX"); + printf ("%" MPFR_EXP_FSPEC "d", (mpfr_eexp_t) e); printf (") for mpfr_div_2si\n"); printf ("Expected inex > 0, flags = %u,\n y = ", (unsigned int) MPFR_FLAGS_INEXACT); @@ -220,10 +211,8 @@ printf ("MPFR_EMAX_MAX"); else if (e == emax) printf ("default emax"); - else if (e <= LONG_MAX) - printf ("%ld", (long) e); else - printf (">LONG_MAX"); + printf ("%" MPFR_EXP_FSPEC "d", (mpfr_eexp_t) e); printf (") for mpfr_div_2ui\n"); printf ("Expected inex > 0, flags = %u,\n y = ", (unsigned int) MPFR_FLAGS_INEXACT); @@ -241,10 +230,24 @@ static void large0 (void) { - large (256); - if (mpfr_get_emax () != MPFR_EMAX_MAX) - large (mpfr_get_emax ()); - large (MPFR_EMAX_MAX); + mpfr_exp_t emin; + + emin = mpfr_get_emin (); + + while (1) + { + large (256); + if (mpfr_get_emax () != MPFR_EMAX_MAX) + large (mpfr_get_emax ()); + large (MPFR_EMAX_MAX); + if (mpfr_get_emin () == MPFR_EMIN_MIN) + break; + /* Redo the test with __gmpfr_emin set to MPFR_EMIN_MIN, which can + be useful to trigger integer overflows as in div_2ui.c r12272. */ + set_emin (MPFR_EMIN_MIN); + } + + set_emin (emin); } /* Cases where the function overflows on n = 0 when rounding is like @@ -268,10 +271,10 @@ for (neg = 0; neg <= 1; neg++) { - RND_LOOP (r) + RND_LOOP_NO_RNDF (r) { int inex1, inex2; - unsigned int flags1, flags2; + mpfr_flags_t flags1, flags2; /* Even if there isn't an overflow (rounding ~ toward zero), the result is the same as the one of an overflow. */ @@ -317,6 +320,21 @@ set_emax (old_emax); } +static void +coverage_div_2ui (void) +{ + mpfr_t x, y; + + mpfr_init2 (x, 2); + mpfr_init2 (y, 2); + mpfr_set_ui_2exp (x, 1, mpfr_get_emax () - 1, MPFR_RNDN); + mpfr_div_2ui (y, x, (unsigned long) LONG_MAX + 1, MPFR_RNDN); + MPFR_ASSERTN(mpfr_zero_p (y)); + MPFR_ASSERTN(mpfr_signbit (y) == 0); + mpfr_clear (x); + mpfr_clear (y); +} + int main (int argc, char *argv[]) { @@ -326,6 +344,7 @@ tests_start_mpfr (); + coverage_div_2ui (); mpfr_inits2 (53, w, z, (mpfr_ptr) 0); for (i = 0; i < 3; i++) diff -Nru mpfr4-3.1.4/tests/tmul.c mpfr4-4.0.2/tests/tmul.c --- mpfr4-3.1.4/tests/tmul.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tmul.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_mul. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #ifdef CHECK_EXTERNAL @@ -65,24 +62,16 @@ test_mul(zz, xx, yy, rnd_mode); if (mpfr_cmp_str1 (zz, res) ) { - printf ("(1)mpfr_mul failed for x=%s y=%s with rnd=%s\n", + printf ("(1) mpfr_mul failed for x=%s y=%s with rnd=%s\n", xs, ys, mpfr_print_rnd_mode (rnd_mode)); printf ("correct is %s, mpfr_mul gives ", res); - mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN); - /* - printf("\nBinary forms:\nxx="); - mpfr_print_binary (xx); - printf("\nyy="); - mpfr_print_binary (yy); - printf("\nzz="); - mpfr_print_binary(zz); - printf("\nre="); - mpfr_set_str1 (zz, res); - mpfr_print_binary(zz); - putchar('\n');*/ + mpfr_out_str (stdout, 10, 0, zz, MPFR_RNDN); + putchar ('\n'); exit (1); } - mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz); + mpfr_clear (xx); + mpfr_clear (yy); + mpfr_clear (zz); } static void @@ -99,18 +88,8 @@ printf ("(2) mpfr_mul failed for x=%s y=%s with rnd=%s\n", xs, ys, mpfr_print_rnd_mode(rnd_mode)); printf ("correct result is %s,\n mpfr_mul gives ", zs); - mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN); - /* - printf("\nBinary forms:\nxx="); - mpfr_print_binary (xx); - printf("\nyy="); - mpfr_print_binary (yy); - printf("\nzz="); - mpfr_print_binary(zz); - printf("\nre="); - mpfr_set_str1 (zz, zs); - mpfr_print_binary(zz); - putchar('\n'); */ + mpfr_out_str (stdout, 10, 0, zz, MPFR_RNDN); + putchar ('\n'); exit (1); } mpfr_clears (xx, yy, zz, (mpfr_ptr) 0); @@ -131,8 +110,8 @@ printf ("(3) mpfr_mul failed for x=%s y=%s with " "rnd=%s\n", xs, ys, mpfr_print_rnd_mode(rnd_mode)); printf ("correct result is gives %s, mpfr_mul gives ", zs); - mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN); - putchar('\n'); + mpfr_out_str (stdout, 10, 0, zz, MPFR_RNDN); + putchar ('\n'); exit (1); } mpfr_clears (xx, yy, zz, (mpfr_ptr) 0); @@ -198,8 +177,8 @@ if (mpfr_cmp_ui (a, 4) ) { printf ("2.0*2.0 gives \n"); - mpfr_out_str(stdout, 10, 0, a, MPFR_RNDN); - putchar('\n'); + mpfr_out_str (stdout, 10, 0, a, MPFR_RNDN); + putchar ('\n'); exit (1); } mpfr_clear(a); mpfr_clear(b); @@ -230,11 +209,12 @@ exit (1); } - for (prec = 2; prec < 100; prec++) + for (prec = MPFR_PREC_MIN; prec < 100; prec++) { mpfr_set_prec (a, prec); mpfr_set_prec (b, prec); - mpfr_set_prec (c, 2 * prec - 2); + /* for prec=1, ensure PREC(c) >= 1 */ + mpfr_set_prec (c, 2 * prec - 2 + (prec == 1)); mpfr_set_prec (d, 2 * prec); for (i = 0; i < 1000; i++) { @@ -247,12 +227,22 @@ printf ("unexpected inexact return value\n"); exit (1); } - if ((inexact == 0) && mpfr_cmp (c, d)) + if ((inexact == 0) && mpfr_cmp (c, d) && rnd != MPFR_RNDF) { - printf ("inexact=0 but results differ\n"); + printf ("rnd=%s: inexact=0 but results differ\n", + mpfr_print_rnd_mode (rnd)); + printf ("a="); + mpfr_out_str (stdout, 2, 0, a, rnd); + printf ("\nb="); + mpfr_out_str (stdout, 2, 0, b, rnd); + printf ("\nc="); + mpfr_out_str (stdout, 2, 0, c, rnd); + printf ("\nd="); + mpfr_out_str (stdout, 2, 0, d, rnd); + printf ("\n"); exit (1); } - else if (inexact && (mpfr_cmp (c, d) == 0)) + else if (inexact && (mpfr_cmp (c, d) == 0) && rnd != MPFR_RNDF) { printf ("inexact!=0 but results agree\n"); printf ("prec=%u rnd=%s a=", (unsigned int) prec, @@ -277,10 +267,11 @@ } static void -check_max(void) +check_max (void) { mpfr_t xx, yy, zz; mpfr_exp_t emin; + int inex; mpfr_init2(xx, 4); mpfr_init2(yy, 4); @@ -343,6 +334,20 @@ MPFR_ASSERTN(mpfr_cmp (zz, yy) == 0); set_emin (emin); + /* coverage test for mulders.c, case n > 8448 (MUL_FFT_THRESHOLD default) */ + mpfr_set_prec (xx, (8448 + 1) * GMP_NUMB_BITS); + mpfr_set_prec (yy, (8448 + 1) * GMP_NUMB_BITS); + mpfr_set_prec (zz, (8448 + 1) * GMP_NUMB_BITS); + mpfr_set_ui (xx, 1, MPFR_RNDN); + mpfr_nextbelow (xx); + mpfr_set_ui (yy, 1, MPFR_RNDN); + mpfr_nextabove (yy); + /* xx = 1 - 2^(-p), yy = 1 + 2^(1-p), where p = PREC(x), + thus xx * yy should be rounded to 1 */ + inex = mpfr_mul (zz, xx, yy, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_cmp_ui (zz, 1) == 0); + mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz); @@ -361,7 +366,7 @@ mpfr_set_str1(yy, "0.9375"); mpfr_mul_2si(yy, yy, MPFR_EMIN_DEFAULT - MPFR_EMIN_DEFAULT/2 - 1, MPFR_RNDN); test_mul(zz, xx, yy, MPFR_RNDD); - if (mpfr_sgn(zz) != 0) + if (MPFR_NOTZERO (zz)) { printf("check_min failed: got "); mpfr_out_str(stdout, 2, 0, zz, MPFR_RNDZ); @@ -644,11 +649,629 @@ mpfr_clears (a, b, c, (mpfr_ptr) 0); } +static void +testall_rndf (mpfr_prec_t pmax) +{ + mpfr_t a, b, c, d; + mpfr_prec_t pa, pb, pc; + + for (pa = MPFR_PREC_MIN; pa <= pmax; pa++) + { + mpfr_init2 (a, pa); + mpfr_init2 (d, pa); + for (pb = MPFR_PREC_MIN; pb <= pmax; pb++) + { + mpfr_init2 (b, pb); + mpfr_set_ui (b, 1, MPFR_RNDN); + while (mpfr_cmp_ui (b, 2) < 0) + { + for (pc = MPFR_PREC_MIN; pc <= pmax; pc++) + { + mpfr_init2 (c, pc); + mpfr_set_ui (c, 1, MPFR_RNDN); + while (mpfr_cmp_ui (c, 2) < 0) + { + mpfr_mul (a, b, c, MPFR_RNDF); + mpfr_mul (d, b, c, MPFR_RNDD); + if (!mpfr_equal_p (a, d)) + { + mpfr_mul (d, b, c, MPFR_RNDU); + if (!mpfr_equal_p (a, d)) + { + printf ("Error: mpfr_mul(a,b,c,RNDF) does not " + "match RNDD/RNDU\n"); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); + exit (1); + } + } + mpfr_nextabove (c); + } + mpfr_clear (c); + } + mpfr_nextabove (b); + } + mpfr_clear (b); + } + mpfr_clear (a); + mpfr_clear (d); + } +} + +/* Check underflow flag corresponds to *after* rounding. + * + * More precisely, we want to test mpfr_mul on inputs b and c such that + * EXP(b*c) < emin but EXP(round(b*c, p, rnd)) = emin. Thus an underflow + * must not be generated. + */ +static void +test_underflow (mpfr_prec_t pmax) +{ + mpfr_exp_t emin; + mpfr_prec_t p; + mpfr_t a0, a, b, c; + int inex; + + mpfr_init2 (a0, MPFR_PREC_MIN); + emin = mpfr_get_emin (); + mpfr_setmin (a0, emin); /* 0.5 * 2^emin */ + + /* for RNDN, we want b*c < 0.5 * 2^emin but RNDN(b*c, p) = 0.5 * 2^emin, + thus b*c >= (0.5 - 1/4 * ulp_p(0.5)) * 2^emin */ + for (p = MPFR_PREC_MIN; p <= pmax; p++) + { + mpfr_init2 (a, p + 1); + mpfr_init2 (b, p + 10); + mpfr_init2 (c, p + 10); + do mpfr_urandomb (b, RANDS); while (MPFR_IS_ZERO (b)); + inex = mpfr_set_ui_2exp (a, 1, -1, MPFR_RNDZ); /* a = 0.5 */ + MPFR_ASSERTN (inex == 0); + mpfr_nextbelow (a); /* 0.5 - 1/2*ulp_{p+1}(0.5) = 0.5 - 1/4*ulp_p(0.5) */ + inex = mpfr_div (c, a, b, MPFR_RNDU); + /* 0.5 - 1/4 * ulp_p(0.5) = a <= b*c < 0.5 */ + mpfr_mul_2si (b, b, emin / 2, MPFR_RNDZ); + mpfr_mul_2si (c, c, (emin - 1) / 2, MPFR_RNDZ); + /* now (0.5 - 1/4 * ulp_p(0.5)) * 2^emin <= b*c < 0.5 * 2^emin, + thus b*c should be rounded to 0.5 * 2^emin */ + mpfr_set_prec (a, p); + mpfr_clear_underflow (); + mpfr_mul (a, b, c, MPFR_RNDN); + if (mpfr_underflow_p () || ! mpfr_equal_p (a, a0)) + { + printf ("Error, b*c incorrect or underflow flag incorrectly set" + " for emin=%" MPFR_EXP_FSPEC "d, rnd=%s\n", + (mpfr_eexp_t) emin, mpfr_print_rnd_mode (MPFR_RNDN)); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); + mpfr_set_prec (a, mpfr_get_prec (b) + mpfr_get_prec (c)); + mpfr_mul_2exp (b, b, 1, MPFR_RNDN); + inex = mpfr_mul (a, b, c, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + printf ("Exact 2*a="); mpfr_dump (a); + exit (1); + } + mpfr_clear (a); + mpfr_clear (b); + mpfr_clear (c); + } + + /* for RNDU, we want b*c < 0.5*2^emin but RNDU(b*c, p) = 0.5*2^emin thus + b*c > (0.5 - 1/2 * ulp_p(0.5)) * 2^emin */ + for (p = MPFR_PREC_MIN; p <= pmax; p++) + { + mpfr_init2 (a, p); + mpfr_init2 (b, p + 10); + mpfr_init2 (c, p + 10); + do mpfr_urandomb (b, RANDS); while (MPFR_IS_ZERO (b)); + inex = mpfr_set_ui_2exp (a, 1, -1, MPFR_RNDZ); /* a = 0.5 */ + MPFR_ASSERTN (inex == 0); + mpfr_nextbelow (a); /* 0.5 - 1/2 * ulp_p(0.5) */ + inex = mpfr_div (c, a, b, MPFR_RNDU); + /* 0.5 - 1/2 * ulp_p(0.5) <= b*c < 0.5 */ + mpfr_mul_2si (b, b, emin / 2, MPFR_RNDZ); + mpfr_mul_2si (c, c, (emin - 1) / 2, MPFR_RNDZ); + if (inex == 0) + mpfr_nextabove (c); /* ensures b*c > (0.5 - 1/2 * ulp_p(0.5)) * 2^emin. + Warning: for p=1, 0.5 - 1/2 * ulp_p(0.5) + = 0.25, thus b*c > 2^(emin-2), which should + also be rounded up with p=1 to 0.5 * 2^emin + with an unbounded exponent range. */ + mpfr_clear_underflow (); + mpfr_mul (a, b, c, MPFR_RNDU); + if (mpfr_underflow_p () || ! mpfr_equal_p (a, a0)) + { + printf ("Error, b*c incorrect or underflow flag incorrectly set" + " for emin=%" MPFR_EXP_FSPEC "d, rnd=%s\n", + (mpfr_eexp_t) emin, mpfr_print_rnd_mode (MPFR_RNDU)); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); + mpfr_set_prec (a, mpfr_get_prec (b) + mpfr_get_prec (c)); + mpfr_mul_2exp (b, b, 1, MPFR_RNDN); + inex = mpfr_mul (a, b, c, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + printf ("Exact 2*a="); mpfr_dump (a); + exit (1); + } + mpfr_clear (a); + mpfr_clear (b); + mpfr_clear (c); + } + + mpfr_clear (a0); +} + +/* checks special case where no underflow should occur */ +static void +bug20161209 (void) +{ + mpfr_exp_t emin; + mpfr_t x, y, z; + + emin = mpfr_get_emin (); + set_emin (-1); + + /* test for mpfr_mul_1 for 64-bit limb, mpfr_mul_2 for 32-bit limb */ + mpfr_init2 (x, 53); + mpfr_init2 (y, 53); + mpfr_init2 (z, 53); + mpfr_set_str_binary (x, "0.101000001E-1"); /* x = 321/2^10 */ + mpfr_set_str_binary (y, "0.110011000010100101111000011011000111011000001E-1"); + /* y = 28059810762433/2^46 */ + /* x * y = (2^53+1)/2^56 = 0.001...000[1]000..., and should round to 0.25 */ + mpfr_mul (z, x, y, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (z, 1, -2) == 0); + + /* test for mpfr_mul_2 for 64-bit limb */ + mpfr_set_prec (x, 65); + mpfr_set_prec (y, 65); + mpfr_set_prec (z, 65); + mpfr_set_str_binary (x, "0.101101000010010110100001E-1"); /* 11806113/2^25 */ + mpfr_set_str_binary (y, "0.101101011110010101011010001111111001100001E-1"); + /* y = 3124947910241/2^43 */ + /* x * y = (2^65+1)/2^68 = 0.001...000[1]000..., and should round to 0.25 */ + mpfr_mul (z, x, y, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (z, 1, -2) == 0); + + /* test for the generic code */ + mpfr_set_prec (x, 54); + mpfr_set_prec (y, 55); + mpfr_set_prec (z, 53); + mpfr_set_str_binary (x, "0.101000001E-1"); + mpfr_set_str_binary (y, "0.110011000010100101111000011011000111011000001E-1"); + mpfr_mul (z, x, y, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (z, 1, -2) == 0); + + /* another test for the generic code */ + mpfr_set_prec (x, 66); + mpfr_set_prec (y, 67); + mpfr_set_prec (z, 65); + mpfr_set_str_binary (x, "0.101101000010010110100001E-1"); + mpfr_set_str_binary (y, "0.101101011110010101011010001111111001100001E-1"); + mpfr_mul (z, x, y, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (z, 1, -2) == 0); + + mpfr_clear (x); + mpfr_clear (y); + mpfr_clear (z); + set_emin (emin); +} + +/* test for case in mpfr_mul_1() where: + ax = __gmpfr_emin - 1 + ap[0] == ~mask + rnd_mode = MPFR_RNDZ. + Whatever the values of rb and sb, we should round to zero (underflow). */ +static void +bug20161209a (void) +{ + mpfr_exp_t emin; + mpfr_t x, y, z; + + emin = mpfr_get_emin (); + set_emin (-1); + + mpfr_init2 (x, 53); + mpfr_init2 (y, 53); + mpfr_init2 (z, 53); + + /* case rb = sb = 0 */ + mpfr_set_str_binary (x, "0.11010010100110000110110011111E-1"); + mpfr_set_str_binary (y, "0.1001101110011000110100001"); + /* x = 441650591/2^30, y = 20394401/2^25 */ + /* x * y = (2^53-1)/2^55 = 0.00111...111[0]000..., and should round to 0 */ + mpfr_mul (z, x, y, MPFR_RNDZ); + MPFR_ASSERTN(mpfr_zero_p (z)); + + /* case rb = 1, sb = 0 */ + mpfr_set_str_binary (x, "0.111111111000000000000000000111111111E-1"); + mpfr_set_str_binary (y, "0.1000000001000000001"); + /* x = 68585259519/2^37, y = 262657/2^19 */ + /* x * y = (2^54-1)/2^56 = 0.00111...111[1]000..., and should round to 0 */ + mpfr_mul (z, x, y, MPFR_RNDZ); + MPFR_ASSERTN(mpfr_zero_p (z)); + + /* case rb = 0, sb = 1 */ + mpfr_set_str_binary (x, "0.110010011001011110001100100001000001E-1"); + mpfr_set_str_binary (y, "0.10100010100010111101"); + /* x = 541144371852^37, y = 665789/2^20 */ + /* x * y = (2^55-3)/2^57 = 0.00111...111[0]100..., and should round to 0 */ + mpfr_mul (z, x, y, MPFR_RNDZ); + MPFR_ASSERTN(mpfr_zero_p (z)); + + /* case rb = sb = 1 */ + mpfr_set_str_binary (x, "0.10100110001001001010001111110010100111E-1"); + mpfr_set_str_binary (y, "0.110001010011101001"); + /* x = 178394823847/2^39, y = 201961/2^18 */ + /* x * y = (2^55-1)/2^57 = 0.00111...111[1]100..., and should round to 0 */ + mpfr_mul (z, x, y, MPFR_RNDZ); + MPFR_ASSERTN(mpfr_zero_p (z)); + + /* similar test for mpfr_mul_2 (we only check rb = sb = 1 here) */ + mpfr_set_prec (x, 65); + mpfr_set_prec (y, 65); + mpfr_set_prec (z, 65); + /* 2^67-1 = 193707721 * 761838257287 */ + mpfr_set_str_binary (x, "0.1011100010111011111011001001E-1"); + mpfr_set_str_binary (y, "0.1011000101100001000110010100010010000111"); + mpfr_mul (z, x, y, MPFR_RNDZ); + MPFR_ASSERTN(mpfr_zero_p (z)); + + mpfr_clear (x); + mpfr_clear (y); + mpfr_clear (z); + set_emin (emin); +} + +/* bug for RNDF */ +static void +bug20170602 (void) +{ + mpfr_t x, u, y, yd, yu; + + mpfr_init2 (x, 493); + mpfr_init2 (u, 493); + mpfr_init2 (y, 503); + mpfr_init2 (yd, 503); + mpfr_init2 (yu, 503); + mpfr_set_str_binary (x, "0.1111100000000000001111111110000000001111111111111000000000000000000011111111111111111111111000000000000000000001111111111111111111111111111111111111111000000000011111111111111111111000000000011111111111111000000000000001110000000000000000000000000000000000000000011111111111110011111111111100000000000000011111111111111111110000000011111111111111111110011111111111110000000000001111111111111111000000000000000000000000000000000000111111111111111111111111111111011111111111111111111111111111100E44"); + mpfr_set_str_binary (u, "0.1110000000000000001111111111111111111111111111111111111000000000111111111111111111111111111111000000000000000000001111111000000000000000011111111111111111111111111111111111111111111111111111111000000000000000011111111111111000000011111111111111111110000000000000001111111111111111111111111111111111111110000000000001111111111111111111111111111111111111000000000000000000000000000000000001111111111111000000000000000000001111111111100000000000000011111111111111111111111111111111111111111111111E35"); + mpfr_mul (y, x, u, MPFR_RNDF); + mpfr_mul (yd, x, u, MPFR_RNDD); + mpfr_mul (yu, x, u, MPFR_RNDU); + if (mpfr_cmp (y, yd) != 0 && mpfr_cmp (y, yu) != 0) + { + printf ("RNDF is neither RNDD nor RNDU\n"); + printf ("x"); mpfr_dump (x); + printf ("u"); mpfr_dump (u); + printf ("y(RNDF)="); mpfr_dump (y); + printf ("y(RNDD)="); mpfr_dump (yd); + printf ("y(RNDU)="); mpfr_dump (yu); + exit (1); + } + mpfr_clear (x); + mpfr_clear (u); + mpfr_clear (y); + mpfr_clear (yd); + mpfr_clear (yu); +} + +/* Test for 1 to 3 limbs. */ +static void +small_prec (void) +{ + mpfr_exp_t emin, emax; + mpfr_t x, y, z1, z2, zz; + int xq, yq, zq; + mpfr_rnd_t rnd; + mpfr_flags_t flags1, flags2; + int inex1, inex2; + int i, j, r, s, ediff; + + emin = mpfr_get_emin (); + emax = mpfr_get_emax (); + + /* The mpfr_mul implementation doesn't extend the exponent range, + so that it is OK to reduce it here for the test to make sure that + mpfr_mul_2si can be used. */ + set_emin (-1000); + set_emax (1000); + + mpfr_inits2 (3 * GMP_NUMB_BITS, x, y, z1, z2, (mpfr_ptr) 0); + mpfr_init2 (zz, 6 * GMP_NUMB_BITS); + for (i = 0; i < 3; i++) + for (j = 0; j < 10000; j++) + { + xq = i * GMP_NUMB_BITS + 1 + randlimb () % GMP_NUMB_BITS; + mpfr_set_prec (x, xq); + yq = i * GMP_NUMB_BITS + 1 + randlimb () % GMP_NUMB_BITS; + mpfr_set_prec (y, yq); + zq = i * GMP_NUMB_BITS + 1 + randlimb () % (GMP_NUMB_BITS-1); + mpfr_set_prec (z1, zq); + mpfr_set_prec (z2, zq); + s = r = randlimb () & 0x7f; + do mpfr_urandomb (x, RANDS); while (mpfr_zero_p (x)); + if (s & 1) + mpfr_neg (x, x, MPFR_RNDN); + s >>= 1; + if (s & 1) + { + do mpfr_urandomb (y, RANDS); while (mpfr_zero_p (y)); + } + else + { + mpfr_ui_div (y, 1, x, MPFR_RNDN); + mpfr_set_exp (y, 0); + } + s >>= 1; + if (s & 1) + mpfr_neg (y, y, MPFR_RNDN); + s >>= 1; + rnd = RND_RAND_NO_RNDF (); + inex1 = mpfr_mul (zz, x, y, MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + if (s == 0) + { + ediff = __gmpfr_emin - MPFR_EXP (x); + mpfr_set_exp (x, __gmpfr_emin); + } + else if (s == 1) + { + ediff = __gmpfr_emax - MPFR_EXP (x) + 1; + mpfr_set_exp (x, __gmpfr_emax); + mpfr_mul_2ui (y, y, 1, MPFR_RNDN); + } + else + ediff = 0; + mpfr_clear_flags (); + inex1 = mpfr_mul_2si (z1, zz, ediff, rnd); + flags1 = __gmpfr_flags; + mpfr_clear_flags (); + inex2 = mpfr_mul (z2, x, y, rnd); + flags2 = __gmpfr_flags; + if (!(mpfr_equal_p (z1, z2) && + SAME_SIGN (inex1, inex2) && + flags1 == flags2)) + { + printf ("Error in small_prec on i = %d, j = %d\n", i, j); + printf ("r = 0x%x, xq = %d, yq = %d, zq = %d, rnd = %s\n", + r, xq, yq, zq, mpfr_print_rnd_mode (rnd)); + printf ("x = "); + mpfr_dump (x); + printf ("y = "); + mpfr_dump (y); + printf ("ediff = %d\n", ediff); + printf ("zz = "); + mpfr_dump (zz); + printf ("Expected "); + mpfr_dump (z1); + printf ("with inex = %d and flags =", inex1); + flags_out (flags1); + printf ("Got "); + mpfr_dump (z2); + printf ("with inex = %d and flags =", inex2); + flags_out (flags2); + exit (1); + } + } + mpfr_clears (x, y, z1, z2, zz, (mpfr_ptr) 0); + + set_emin (emin); + set_emax (emax); +} + +/* check ax < __gmpfr_emin with rnd_mode == MPFR_RNDN, rb = 0 and sb <> 0 */ +static void +test_underflow2 (void) +{ + mpfr_t x, y, z; + mpfr_exp_t emin; + + emin = mpfr_get_emin (); + mpfr_set_emin (0); + + mpfr_init2 (x, 24); + mpfr_init2 (y, 24); + mpfr_init2 (z, 24); + + mpfr_set_ui_2exp (x, 12913, -14, MPFR_RNDN); + mpfr_set_ui_2exp (y, 5197, -13, MPFR_RNDN); + mpfr_clear_underflow (); + /* x*y = 0.0111111111111111111111111[01] thus underflow */ + mpfr_mul (z, y, x, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (z, 1, -1) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + mpfr_set_prec (x, 65); + mpfr_set_prec (y, 65); + mpfr_set_prec (z, 65); + mpfr_set_str_binary (x, "0.10011101000110111011111100101001111"); + mpfr_set_str_binary (y, "0.110100001001000111000011011110011"); + mpfr_clear_underflow (); + /* x*y = 0.011111111111111111111111111111111111111111111111111111111111111111[01] thus underflow */ + mpfr_mul (z, y, x, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (z, 1, -1) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + mpfr_clear (y); + mpfr_clear (x); + mpfr_clear (z); + + mpfr_set_emin (emin); +} + +static void +coverage (mpfr_prec_t pmax) +{ + mpfr_t a, b, c; + mpfr_prec_t p; + int inex; + + for (p = MPFR_PREC_MIN; p <= pmax; p++) + { + mpfr_init2 (a, p); + mpfr_init2 (b, p); + mpfr_init2 (c, p); + + /* exercise case b*c = 2^(emin-2), which is just in the middle + between 0 and the smallest positive number 0.5*2^emin */ + mpfr_set_ui_2exp (b, 1, mpfr_get_emin (), MPFR_RNDN); + mpfr_set_ui_2exp (c, 1, -2, MPFR_RNDN); + mpfr_clear_flags (); + inex = mpfr_mul (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_zero_p (a) && mpfr_signbit (a) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + if (p == 1) + goto end_of_loop; + + /* case b*c > 2^(emin-2): b = (1-2^(-p))*2^emin, + c = 0.25*(1+2^(1-p)), thus b*c = (1+2^(-p)-2^(1-2p))*2^(emin-2) + should be rounded to 2^(emin-1) for RNDN */ + mpfr_nextbelow (b); + mpfr_nextabove (c); + mpfr_clear_flags (); + inex = mpfr_mul (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + /* b = (1-2^(1-p))*2^emin, c = 0.25*(1+2^(1-p)), + thus b*c = (1-2^(2-2p))*2^(emin-2) should be rounded to 0 */ + mpfr_nextbelow (b); + mpfr_clear_flags (); + inex = mpfr_mul (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_zero_p (a) && mpfr_signbit (a) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + /* special case where b*c is in [nextbelow(0.5*2^emin),0.5*2^emin[ */ + if ((p % 2) == 0) + { + /* the middle of the interval [nextbelow(0.5*2^emin),0.5*2^emin[ + is (1-2^(-p-1))*2^(emin-1) + = (1-2^(-p/2))*(1+2^(-p/2))*2^(emin-1) */ + mpfr_set_si_2exp (b, -1, -p/2, MPFR_RNDN); + mpfr_add_ui (b, b, 1, MPFR_RNDN); + mpfr_set_si_2exp (c, 1, -p/2, MPFR_RNDN); + mpfr_add_ui (c, c, 1, MPFR_RNDN); + MPFR_ASSERTN(mpfr_get_emin () < 0); + mpfr_mul_2si (b, b, (mpfr_get_emin () - 1) / 2, MPFR_RNDN); + mpfr_mul_2si (c, c, (mpfr_get_emin () - 2) / 2, MPFR_RNDN); + mpfr_clear_flags (); + inex = mpfr_mul (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + mpfr_clear_flags (); + inex = mpfr_mul (a, b, c, MPFR_RNDU); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + mpfr_clear_flags (); + inex = mpfr_mul (a, b, c, MPFR_RNDD); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_zero_p (a) && mpfr_signbit (a) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + } + else /* p is odd: + b = (1-2^(-(p+1)/2))*2^... + c = (1+2^(-(p+1)/2))*2^... */ + { + mpfr_set_si_2exp (b, -1, -(p+1)/2, MPFR_RNDN); + mpfr_add_ui (b, b, 1, MPFR_RNDN); + mpfr_set_si_2exp (c, 1, -(p+1)/2, MPFR_RNDN); + mpfr_add_ui (c, c, 1, MPFR_RNDN); + MPFR_ASSERTN(mpfr_get_emin () < 0); + mpfr_mul_2si (b, b, (mpfr_get_emin () - 1) / 2, MPFR_RNDN); + mpfr_mul_2si (c, c, (mpfr_get_emin () - 2) / 2, MPFR_RNDN); + mpfr_clear_flags (); + inex = mpfr_mul (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(!mpfr_underflow_p ()); + mpfr_clear_flags (); + inex = mpfr_mul (a, b, c, MPFR_RNDU); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(!mpfr_underflow_p ()); + mpfr_clear_flags (); + inex = mpfr_mul (a, b, c, MPFR_RNDD); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_zero_p (a) && mpfr_signbit (a) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + } + + if (p <= 2) /* for p=2, 1+2^(-ceil((p+1)/2)) = 1 + 2^(-2) is not + exactly representable */ + goto end_of_loop; + + /* b = 1-2^(-ceil((p+1)/2)) + c = 1+2^(-ceil((p+1)/2)) + For p odd, b*c = 1-2^(p+1) should round to 1; + for p even, b*c = 1-2^(p+2) should round to 1 too. */ + mpfr_set_si_2exp (b, -1, -(p+2)/2, MPFR_RNDN); + mpfr_add_ui (b, b, 1, MPFR_RNDN); + mpfr_set_si_2exp (c, 1, -(p+2)/2, MPFR_RNDN); + mpfr_add_ui (c, c, 1, MPFR_RNDN); + inex = mpfr_mul (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui (a, 1) == 0); + /* For RNDU, b*c should round to 1 */ + inex = mpfr_mul (a, b, c, MPFR_RNDU); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui (a, 1) == 0); + /* For RNDD, b*c should round to 1-2^(-p) */ + inex = mpfr_mul (a, b, c, MPFR_RNDD); + MPFR_ASSERTN(inex < 0); + mpfr_nextabove (a); + MPFR_ASSERTN(mpfr_cmp_ui (a, 1) == 0); + + /* same as above, but near emax, to exercise the case where a carry + produces an overflow */ + mpfr_set_si_2exp (b, -1, -(p+2)/2, MPFR_RNDN); + mpfr_add_ui (b, b, 1, MPFR_RNDN); + mpfr_mul_2si (b, b, mpfr_get_emax (), MPFR_RNDN); + mpfr_set_si_2exp (c, 1, -(p+2)/2, MPFR_RNDN); + mpfr_add_ui (c, c, 1, MPFR_RNDN); + /* b*c should round to 2^emax */ + mpfr_clear_flags (); + inex = mpfr_mul (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_inf_p (a) && mpfr_sgn (a) > 0); + MPFR_ASSERTN(mpfr_overflow_p ()); + /* idem for RNDU */ + mpfr_clear_flags (); + inex = mpfr_mul (a, b, c, MPFR_RNDU); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_inf_p (a) && mpfr_sgn (a) > 0); + MPFR_ASSERTN(mpfr_overflow_p ()); + /* For RNDD, b*c should round to (1-2^(-p))*2^emax */ + mpfr_clear_flags (); + inex = mpfr_mul (a, b, c, MPFR_RNDD); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(!mpfr_inf_p (a)); + MPFR_ASSERTN(!mpfr_overflow_p ()); + mpfr_nextabove (a); + MPFR_ASSERTN(mpfr_inf_p (a) && mpfr_sgn (a) > 0); + + end_of_loop: + mpfr_clear (a); + mpfr_clear (b); + mpfr_clear (c); + } +} + int main (int argc, char *argv[]) { tests_start_mpfr (); + coverage (1024); + testall_rndf (9); check_nans (); check_exact (); check_float (); @@ -684,13 +1307,19 @@ 49, 3, 2, "0.09375"); check_max(); check_min(); + small_prec (); check_regression (); - test_generic (2, 500, 100); + test_generic (MPFR_PREC_MIN, 500, 100); data_check ("data/mulpi", mpfr_mulpi, "mpfr_mulpi"); valgrind20110503 (); + test_underflow (128); + bug20161209 (); + bug20161209a (); + bug20170602 (); + test_underflow2 (); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tmul_d.c mpfr4-4.0.2/tests/tmul_d.c --- mpfr4-3.1.4/tests/tmul_d.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tmul_d.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_mul_d -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,17 +17,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include #include "mpfr-test.h" -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) - static void check_nans (void) { @@ -42,7 +38,7 @@ mpfr_clear_flags(); inexact = mpfr_mul_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); - MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0); + MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN); MPFR_ASSERTN (mpfr_nan_p (y)); /* +inf * 1.0 == +inf */ @@ -58,7 +54,7 @@ mpfr_clear_flags(); inexact = mpfr_mul_d (y, x, 0.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); - MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0); + MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN); MPFR_ASSERTN (mpfr_nan_p (y)); /* -inf * 1.0 == -inf */ @@ -74,6 +70,24 @@ mpfr_clear (y); } +static void +bug20171218 (void) +{ + mpfr_t a, b; + mpfr_init2 (a, 22); + mpfr_init2 (b, 1312); + mpfr_set_str (b, "1.ffffffffffffffffffc3e0007ffe000700fff8001fff800000000007e0fffe0007fffffff00001f800000003ffffffe1fc00000003fffe7c03ffffffffffffffe000000fffffffff83f0000007ffc03ffffffffc0007ff0000ffcfffffe00000f80000000003c007ffffffff3ff807ffffffffff000000000000001fc000fffe000600000ff0003ffe00fffffffc00001ffc0fffffffffff00000807fe03ffffffc01ffe", 16, MPFR_RNDN); + mpfr_mul_d (a, b, 0.5, MPFR_RNDF); + /* a should be 1 or nextbelow(1) */ + if (mpfr_cmp_ui (a, 1) != 0) + { + mpfr_nextabove (a); + MPFR_ASSERTN(mpfr_cmp_ui (a, 1) == 0); + } + mpfr_clear (a); + mpfr_clear (b); +} + #define TEST_FUNCTION mpfr_mul_d #define DOUBLE_ARG2 #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS) @@ -88,6 +102,8 @@ tests_start_mpfr (); + bug20171218 (); + /* check with enough precision */ mpfr_init2 (x, IEEE_DBL_MANT_DIG); mpfr_init2 (y, IEEE_DBL_MANT_DIG); @@ -118,19 +134,8 @@ check_nans (); - test_generic (2, 1000, 100); + test_generic (MPFR_PREC_MIN, 1000, 100); tests_end_mpfr (); return 0; } - -#else - -int -main (void) -{ - printf ("Warning! Test disabled for this MPFR version.\n"); - return 0; -} - -#endif diff -Nru mpfr4-3.1.4/tests/tmul_ui.c mpfr4-4.0.2/tests/tmul_ui.c --- mpfr4-3.1.4/tests/tmul_ui.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tmul_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_mul_ui. -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void @@ -45,9 +42,12 @@ exit (1); } - for (q = 2; q <= p; q++) + for (q = MPFR_PREC_MIN; q <= p; q++) for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) { + if (rnd == MPFR_RNDF) + continue; /* inexact is undefined */ + mpfr_set_prec (y, q); inexact = mpfr_mul_ui (y, x, u, (mpfr_rnd_t) rnd); cmp = mpfr_cmp (y, z); @@ -108,8 +108,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_mul_ui: 1*y != y\n"); - printf ("y= "); mpfr_print_binary (y); puts (""); - printf ("1*y="); mpfr_print_binary (x); puts (""); + printf ("y= "); mpfr_dump (y); + printf ("1*y="); mpfr_dump (x); exit (1); } @@ -148,10 +148,17 @@ emax = mpfr_get_emax (); set_emax (0); mpfr_set_str_binary (x, "0.1E0"); - mpfr_mul_ui (x, x, 2, MPFR_RNDN); + (mpfr_mul_ui) (x, x, 2, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && MPFR_IS_POS(x)); set_emax (emax); + /* To check the macros call */ + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_mul_ui (x, x, 2, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui(x, 2) == 0); + mpfr_mul_si (x, x, 4, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui(x, 8) == 0); + mpfr_set_str (x, /*1.0/3.0*/ "0.333333333333333333333333333333333", 10, MPFR_RNDZ); mpfr_mul_ui (x, x, 3, MPFR_RNDU); @@ -168,7 +175,7 @@ if (mpfr_cmp_ui(x, 0) <= 0) { printf("Error in mpfr_mul_ui: 4*3.0 does not give a positive result:\n"); - mpfr_print_binary(x); puts (""); + mpfr_dump (x); printf("mpfr_cmp_ui(x, 0) = %d\n", mpfr_cmp_ui(x, 0)); exit(1); } @@ -181,7 +188,7 @@ if (mpfr_cmp (x, y)) { printf ("Error in mul_ui for 1335*(0.100001111E9)\n"); - printf ("got "); mpfr_print_binary (x); puts (""); + printf ("got "); mpfr_dump (x); exit(1); } @@ -195,7 +202,7 @@ if (mpfr_cmp(x, y)) { printf("Error for 121*y: expected result is:\n"); - mpfr_print_binary(y); puts (""); + mpfr_dump (y); } mpfr_set_prec (x, 32); @@ -222,8 +229,8 @@ if (mpfr_cmp (x, y)) { printf ("Error for 23 * 2143861251406875.0\n"); - printf ("expected "); mpfr_print_binary (x); puts (""); - printf ("got "); mpfr_print_binary (y); puts (""); + printf ("expected "); mpfr_dump (x); + printf ("got "); mpfr_dump (y); exit (1); } @@ -240,8 +247,8 @@ { printf ("multiplication by 1.0 fails for xprec=%u, yprec=%u\n", xprec, yprec); - printf ("expected "); mpfr_print_binary (x); puts (""); - printf ("got "); mpfr_print_binary (y); puts (""); + printf ("expected "); mpfr_dump (x); + printf ("got "); mpfr_dump (y); exit (1); } } @@ -275,7 +282,7 @@ mpfr_clear(x); mpfr_clear(y); - test_generic (2, 500, 100); + test_generic (MPFR_PREC_MIN, 500, 100); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tnext.c mpfr4-4.0.2/tests/tnext.c --- mpfr4-3.1.4/tests/tnext.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tnext.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_nextabove, mpfr_nextbelow, mpfr_nexttoward. -Copyright 2003-2016 Free Software Foundation, Inc. +Copyright 2003-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" /* Generic tests for mpfr_nextabove and mpfr_nextbelow */ @@ -99,7 +96,7 @@ int i, neg, below; mpfr_prec_t prec; - for (i = 0; i < (int) (sizeof(tests) / sizeof(tests[0])); i++) + for (i = 0; i < numberof (tests); i++) for (neg = 0; neg <= 1; neg++) for (below = 0; below <= 1; below++) for (prec = MPFR_PREC_MIN; prec < 200; prec += 3) diff -Nru mpfr4-3.1.4/tests/tnrandom.c mpfr4-4.0.2/tests/tnrandom.c --- mpfr4-3.1.4/tests/tnrandom.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/tnrandom.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,127 @@ +/* Test file for mpfr_nrandom + +Copyright 2011-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-test.h" + +static void +test_special (mpfr_prec_t p) +{ + mpfr_t x; + int inexact; + + mpfr_init2 (x, p); + + inexact = mpfr_nrandom (x, RANDS, MPFR_RNDN); + if (inexact == 0) + { + printf ("Error: mpfr_nrandom() returns a zero ternary value.\n"); + exit (1); + } + + mpfr_clear (x); +} + + +static void +test_nrandom (long nbtests, mpfr_prec_t prec, mpfr_rnd_t rnd, + int verbose) +{ + mpfr_t *t; + int i, inexact; + + t = (mpfr_t *) tests_allocate (nbtests * sizeof (mpfr_t)); + + for (i = 0; i < nbtests; ++i) + mpfr_init2 (t[i], prec); + + for (i = 0; i < nbtests; i++) + { + inexact = mpfr_nrandom (t[i], RANDS, MPFR_RNDN); + if (inexact == 0) + { + /* one call in the loop pretended to return an exact number! */ + printf ("Error: mpfr_nrandom() returns a zero ternary value.\n"); + exit (1); + } + } + +#if defined(HAVE_STDARG) && !defined(MPFR_USE_MINI_GMP) + if (verbose) + { + mpfr_t av, va, tmp; + + mpfr_init2 (av, prec); + mpfr_init2 (va, prec); + mpfr_init2 (tmp, prec); + + mpfr_set_ui (av, 0, MPFR_RNDN); + mpfr_set_ui (va, 0, MPFR_RNDN); + for (i = 0; i < nbtests; ++i) + { + mpfr_add (av, av, t[i], MPFR_RNDN); + mpfr_sqr (tmp, t[i], MPFR_RNDN); + mpfr_add (va, va, tmp, MPFR_RNDN); + } + mpfr_div_ui (av, av, nbtests, MPFR_RNDN); + mpfr_div_ui (va, va, nbtests, MPFR_RNDN); + mpfr_sqr (tmp, av, MPFR_RNDN); + mpfr_sub (va, va, av, MPFR_RNDN); + + mpfr_printf ("Average = %.5Rf\nVariance = %.5Rf\n", av, va); + mpfr_clear (av); + mpfr_clear (va); + mpfr_clear (tmp); + } +#endif /* HAVE_STDARG */ + + for (i = 0; i < nbtests; ++i) + mpfr_clear (t[i]); + tests_free (t, nbtests * sizeof (mpfr_t)); + return; +} + + +int +main (int argc, char *argv[]) +{ + long nbtests; + int verbose; + + tests_start_mpfr (); + + verbose = 0; + nbtests = 10; + if (argc > 1) + { + long a = atol (argv[1]); + verbose = 1; + if (a != 0) + nbtests = a; + } + + test_nrandom (nbtests, 420, MPFR_RNDN, verbose); + test_special (2); + test_special (42000); + + tests_end_mpfr (); + return 0; +} diff -Nru mpfr4-3.1.4/tests/tnrandom_chisq.c mpfr4-4.0.2/tests/tnrandom_chisq.c --- mpfr4-3.1.4/tests/tnrandom_chisq.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/tnrandom_chisq.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,354 @@ +/* Chi-squared test for mpfr_nrandom + +Copyright 2011-2019 Free Software Foundation, Inc. +Contributed by Charles Karney , SRI International. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-test.h" + +/* Return Phi(x) = erf(x / sqrt(2)) / 2, the cumulative probability function + * for the normal distribution. We only take differences of this function so + * the offset doesn't matter; here Phi(0) = 0. */ +static void +normal_cumulative (mpfr_t z, mpfr_t x, mpfr_rnd_t rnd) +{ + mpfr_sqrt_ui (z, 2, rnd); + mpfr_div (z, x, z, rnd); + mpfr_erf (z, z, rnd); + mpfr_div_ui (z, z, 2, rnd); +} + +/* Given nu and chisqp, compute probability that chisq > chisqp. This uses, + * A&S 26.4.16, + * + * Q(nu,chisqp) = + * erfc( (3/2)*sqrt(nu) * ( cbrt(chisqp/nu) - 1 + 2/(9*nu) ) ) / 2 + * + * which is valid for nu > 30. This is the basis for the formula in Knuth, + * TAOCP, Vol 2, 3.3.1, Table 1. It more accurate than the similar formula, + * DLMF 8.11.10. */ +static void +chisq_prob (mpfr_t q, long nu, mpfr_t chisqp) +{ + mpfr_t t; + mpfr_rnd_t rnd; + + rnd = MPFR_RNDN; /* This uses an approx formula. Might as well use RNDN. */ + mpfr_init2 (t, mpfr_get_prec (q)); + + mpfr_div_si (q, chisqp, nu, rnd); /* chisqp/nu */ + mpfr_cbrt (q, q, rnd); /* (chisqp/nu)^(1/3) */ + mpfr_sub_ui (q, q, 1, rnd); /* (chisqp/nu)^(1/3) - 1 */ + mpfr_set_ui (t, 2, rnd); + mpfr_div_si (t, t, 9*nu, rnd); /* 2/(9*nu) */ + mpfr_add (q, q, t, rnd); /* (chisqp/nu)^(1/3) - 1 + 2/(9*nu) */ + mpfr_sqrt_ui (t, nu, rnd); /* sqrt(nu) */ + mpfr_mul_d (t, t, 1.5, rnd); /* (3/2)*sqrt(nu) */ + mpfr_mul (q, q, t, rnd); /* arg to erfc */ + mpfr_erfc (q, q, rnd); /* erfc(...) */ + mpfr_div_ui (q, q, 2, rnd); /* erfc(...)/2 */ + + mpfr_clear (t); +} + +/* The continuous chi-squared test on with a set of bins of equal width. + * + * A single precision is picked for sampling and the chi-squared calculation. + * This should picked high enough so that binning in test doesn't need to be + * accurately aligned with possible values of the deviates. Also we need the + * precision big enough that chi-squared calculation itself is reliable. + * + * There's no particular benefit is testing with at very higher precisions; + * because of the way tnrandom samples, this just adds additional barely + * significant random bits to the deviates. So this chi-squared test with + * continuous equal width bins isn't a good tool for finding problems here. + * + * The testing of low precision normal deviates is done by + * test_nrandom_chisq_disc. */ +static double +test_nrandom_chisq_cont (long num, mpfr_prec_t prec, int nu, + double xmin, double xmax, int verbose) +{ + mpfr_t x, a, b, dx, z, pa, pb, ps, t; + long *counts; + int i, inexact; + long k; + mpfr_rnd_t rnd, rndd; + double Q, chisq; + + rnd = MPFR_RNDN; /* For chi-squared calculation */ + rndd = MPFR_RNDD; /* For sampling and figuring the bins */ + mpfr_inits2 (prec, x, a, b, dx, z, pa, pb, ps, t, (mpfr_ptr) 0); + + counts = (long *) tests_allocate ((nu + 1) * sizeof (long)); + for (i = 0; i <= nu; i++) + counts[i] = 0; + + /* a and b are bounds of nu equally spaced bins. Set dx = (b-a)/nu */ + mpfr_set_d (a, xmin, rnd); + mpfr_set_d (b, xmax, rnd); + + mpfr_sub (dx, b, a, rnd); + mpfr_div_si (dx, dx, nu, rnd); + + for (k = 0; k < num; ++k) + { + inexact = mpfr_nrandom (x, RANDS, rndd); + if (inexact == 0) + { + /* one call in the loop pretended to return an exact number! */ + printf ("Error: mpfr_nrandom() returns a zero ternary value.\n"); + exit (1); + } + mpfr_sub (x, x, a, rndd); + mpfr_div (x, x, dx, rndd); + i = mpfr_get_si (x, rndd); + ++counts[i >= 0 && i < nu ? i : nu]; + } + + mpfr_set (x, a, rnd); + normal_cumulative (pa, x, rnd); + mpfr_add_ui (ps, pa, 1, rnd); + mpfr_set_zero (t, 1); + for (i = 0; i <= nu; ++i) + { + if (i < nu) + { + mpfr_add (x, x, dx, rnd); + normal_cumulative (pb, x, rnd); + mpfr_sub (pa, pb, pa, rnd); /* prob for this bin */ + } + else + mpfr_sub (pa, ps, pa, rnd); /* prob for last bin, i = nu */ + + /* Compute z = counts[i] - num * p; t += z * z / (num * p) */ + mpfr_mul_ui (pa, pa, num, rnd); + mpfr_ui_sub (z, counts[i], pa, rnd); + mpfr_sqr (z, z, rnd); + mpfr_div (z, z, pa, rnd); + mpfr_add (t, t, z, rnd); + mpfr_swap (pa, pb); /* i.e., pa = pb */ + } + + chisq = mpfr_get_d (t, rnd); + chisq_prob (t, nu, t); + Q = mpfr_get_d (t, rnd); + if (verbose) + { + printf ("num = %ld, equal bins in [%.2f, %.2f], nu = %d: chisq = %.2f\n", + num, xmin, xmax, nu, chisq); + if (Q < 0.05) + printf (" WARNING: probability (less than 5%%) = %.2e\n", Q); + } + + tests_free (counts, (nu + 1) * sizeof (long)); + mpfr_clears (x, a, b, dx, z, pa, pb, ps, t, (mpfr_ptr) 0); + return Q; +} + +/* Return a sequential number for a positive low-precision x. x is altered by + * this function. low precision means prec = 2, 3, or 4. High values of + * precision will result in integer overflow. */ +static long +sequential (mpfr_t x) +{ + long expt, prec; + + prec = mpfr_get_prec (x); + expt = mpfr_get_exp (x); + mpfr_mul_2si (x, x, prec - expt, MPFR_RNDN); + + return expt * (1 << (prec - 1)) + mpfr_get_si (x, MPFR_RNDN); +} + +/* The chi-squared test on low precision normal deviates. wprec is the working + * precision for the chi-squared calculation. prec is the precision for the + * sampling; choose this in [2,5]. The bins consist of all the possible + * deviate values in the range [xmin, xmax] coupled with the value of inexact. + * Thus with prec = 2, the bins are + * ... + * (7/16, 1/2) x = 1/2, inexact = +1 + * (1/2 , 5/8) x = 1/2, inexact = -1 + * (5/8 , 3/4) x = 3/4, inexact = +1 + * (3/4 , 7/8) x = 3/4, inexact = -1 + * (7/8 , 1 ) x = 1 , inexact = +1 + * (1 , 5/4) x = 1 , inexact = -1 + * (5/4 , 3/2) x = 3/2, inexact = +1 + * (3/2 , 7/4) x = 3/2, inexact = -1 + * ... + * In addition, two bins are allocated for [0,xmin) and (xmax,inf). + * + * This test is applied to the absolute values of the deviates. The sign is + * tested by test_nrandom_chisq_cont. In any case, the way the sign is + * assigned in mpfr_nrandom is trivial. In addition, the sampling is with + * MPFR_RNDN. This is the rounding mode which elicits the most information. + * trandom_deviate includes checks on the consistency of the results extracted + * from a random_deviate with other rounding modes. */ +static double +test_nrandom_chisq_disc (long num, mpfr_prec_t wprec, int prec, + double xmin, double xmax, int verbose) +{ + mpfr_t x, v, pa, pb, z, t; + mpfr_rnd_t rnd; + int i, inexact, nu; + long *counts; + long k, seqmin, seqmax, seq; + double Q, chisq; + + rnd = MPFR_RNDN; + mpfr_init2 (x, prec); + mpfr_init2 (v, prec+1); + mpfr_inits2 (wprec, pa, pb, z, t, (mpfr_ptr) 0); + + mpfr_set_d (x, xmin, rnd); + xmin = mpfr_get_d (x, rnd); + mpfr_set (v, x, rnd); + seqmin = sequential (x); + mpfr_set_d (x, xmax, rnd); + xmax = mpfr_get_d (x, rnd); + seqmax = sequential (x); + + /* Two bins for each sequential number (for inexact = +/- 1), plus 1 for u < + * umin and 1 for u > umax, minus 1 for degrees of freedom */ + nu = 2 * (seqmax - seqmin + 1) + 2 - 1; + counts = (long *) tests_allocate ((nu + 1) * sizeof (long)); + for (i = 0; i <= nu; i++) + counts[i] = 0; + + for (k = 0; k < num; ++k) + { + inexact = mpfr_nrandom (x, RANDS, rnd); + if (mpfr_signbit (x)) + { + inexact = -inexact; + mpfr_setsign (x, x, 0, rnd); + } + /* Don't call sequential with small args to avoid undefined behavior with + * zero and possibility of overflow. */ + seq = mpfr_greaterequal_p (x, v) ? sequential (x) : seqmin - 1; + ++counts[seq < seqmin ? 0 : + seq <= seqmax ? 2 * (seq - seqmin) + 1 + (inexact > 0 ? 0 : 1) : + nu]; + } + + mpfr_set_zero (v, 1); + normal_cumulative (pa, v, rnd); + /* Cycle through all the bin boundaries using mpfr_nextabove at precision + * prec + 1 starting at mpfr_nextbelow (xmin) */ + mpfr_set_d (x, xmin, rnd); + mpfr_set (v, x, rnd); + mpfr_nextbelow (v); + mpfr_nextbelow (v); + mpfr_set_zero (t, 1); + for (i = 0; i <= nu; ++i) + { + if (i < nu) + mpfr_nextabove (v); + else + mpfr_set_inf (v, 1); + normal_cumulative (pb, v, rnd); + mpfr_sub (pa, pb, pa, rnd); + + /* Compute z = counts[i] - num * p; t += z * z / (num * p). 2*num to + * account for the fact the p needs to be doubled since we are + * considering only the absolute value of the deviates. */ + mpfr_mul_ui (pa, pa, 2*num, rnd); + mpfr_ui_sub (z, counts[i], pa, rnd); + mpfr_sqr (z, z, rnd); + mpfr_div (z, z, pa, rnd); + mpfr_add (t, t, z, rnd); + mpfr_swap (pa, pb); /* i.e., pa = pb */ + } + + chisq = mpfr_get_d (t, rnd); + chisq_prob (t, nu, t); + Q = mpfr_get_d (t, rnd); + if (verbose) + { + printf ("num = %ld, discrete (prec = %d) bins in [%.6f, %.2f], " + "nu = %d: chisq = %.2f\n", num, prec, xmin, xmax, nu, chisq); + if (Q < 0.05) + printf (" WARNING: probability (less than 5%%) = %.2e\n", Q); + } + + tests_free (counts, (nu + 1) * sizeof (long)); + mpfr_clears (x, v, pa, pb, z, t, (mpfr_ptr) 0); + return Q; +} + +static void +run_chisq (double (*f)(long, mpfr_prec_t, int, double, double, int), + long num, mpfr_prec_t prec, int bin, + double xmin, double xmax, int verbose) +{ + double Q, Qcum, Qbad, Qthresh; + int i; + + Qcum = 1; + Qbad = 1.e-9; + Qthresh = 0.01; + for (i = 0; i < 3; ++i) + { + Q = (*f)(num, prec, bin, xmin, xmax, verbose); + Qcum *= Q; + if (Q > Qthresh) + return; + else if (Q < Qbad) + { + printf ("Error: mpfr_nrandom chi-squared failure " + "(prob = %.2e)\n", Q); + exit (1); + } + num *= 10; + Qthresh /= 10; + } + if (Qcum < Qbad) /* Presumably this is true */ + { + printf ("Error: mpfr_nrandom combined chi-squared failure " + "(prob = %.2e)\n", Qcum); + exit (1); + } +} + +int +main (int argc, char *argv[]) +{ + long nbtests; + int verbose; + + tests_start_mpfr (); + + verbose = 0; + nbtests = 100000; + if (argc > 1) + { + long a = atol (argv[1]); + verbose = 1; + if (a != 0) + nbtests = a; + } + + run_chisq (test_nrandom_chisq_cont, nbtests, 64, 60, -4, 4, verbose); + run_chisq (test_nrandom_chisq_disc, nbtests, 64, 2, 0.0005, 3, verbose); + run_chisq (test_nrandom_chisq_disc, nbtests, 64, 3, 0.002, 4, verbose); + run_chisq (test_nrandom_chisq_disc, nbtests, 64, 4, 0.004, 4, verbose); + + tests_end_mpfr (); + return 0; +} diff -Nru mpfr4-3.1.4/tests/toutimpl.c mpfr4-4.0.2/tests/toutimpl.c --- mpfr4-3.1.4/tests/toutimpl.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/toutimpl.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* Test file for internal debugging-out functions: - mpfr_dump, mpfr_print_binary, mpfr_print_rnd_mode. + mpfr_print_rnd_mode, mpfr_dump, mpfr_print_mant_binary. -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,26 +18,36 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include #include "mpfr-test.h" -/* We output stdout to a file to check if it is correct - Is it a good idea? - We can't use tmpname since it is insecure */ -#define FILE_NAME "dummy.tmp" +#define FILE_NAME "toutimpl_out.txt" static const char Buffer[] = -"@NaN@\n" -"-@Inf@\n" -"-0\n" -"0.10101010101011111001000110001100010000100000000000000E32\n"; + "@NaN@\n" + "-@NaN@\n" + "@Inf@\n" + "-@Inf@\n" + "0\n" + "-0\n" + "0.10101010101011111001000110001100010000100000000000000E32\n" +#if GMP_NUMB_BITS == 32 + "x = 10101010101011111001000110001100.010000100000000000000[00000000000.]\n" + "0.01010101010101111100100011000110010000100000000000000[00000000001]E32!!!NT!!!\n" +#elif GMP_NUMB_BITS == 64 + "x = 10101010101011111001000110001100010000100000000000000[00000000000.]\n" + "0.01010101010101111100100011000110001000010000000000000[00000000001]E32!!!NT!!!\n" +#endif + ; int main (void) { + mpfr_exp_t e; mpfr_t x; FILE *f; int i; @@ -45,22 +55,22 @@ tests_start_mpfr (); /* Check RND_MODE */ - if (strcmp (mpfr_print_rnd_mode(MPFR_RNDN), "MPFR_RNDN")) + if (strcmp (mpfr_print_rnd_mode (MPFR_RNDN), "MPFR_RNDN")) { printf ("Error for printing MPFR_RNDN\n"); exit (1); } - if (strcmp (mpfr_print_rnd_mode(MPFR_RNDU), "MPFR_RNDU")) + if (strcmp (mpfr_print_rnd_mode (MPFR_RNDU), "MPFR_RNDU")) { printf ("Error for printing MPFR_RNDU\n"); exit (1); } - if (strcmp (mpfr_print_rnd_mode(MPFR_RNDD), "MPFR_RNDD")) + if (strcmp (mpfr_print_rnd_mode (MPFR_RNDD), "MPFR_RNDD")) { printf ("Error for printing MPFR_RNDD\n"); exit (1); } - if (strcmp (mpfr_print_rnd_mode(MPFR_RNDZ), "MPFR_RNDZ")) + if (strcmp (mpfr_print_rnd_mode (MPFR_RNDZ), "MPFR_RNDZ")) { printf ("Error for printing MPFR_RNDZ\n"); exit (1); @@ -72,27 +82,41 @@ exit (1); } - /* Reopen stdout to a file. All errors will be put to stderr - Can't use tmpname since it is unsecure */ + /* Reopen stdout to a file. All errors will be put to stderr. */ if (freopen (FILE_NAME, "w", stdout) == NULL) { printf ("Error can't redirect stdout\n"); exit (1); } - mpfr_init (x); + mpfr_init2 (x, 53); mpfr_set_nan (x); mpfr_dump (x); + MPFR_CHANGE_SIGN (x); + mpfr_dump (x); + mpfr_set_inf (x, +1); + mpfr_dump (x); mpfr_set_inf (x, -1); mpfr_dump (x); - MPFR_SET_ZERO (x); MPFR_SET_NEG (x); + mpfr_set_zero (x, +1); + mpfr_dump (x); + mpfr_set_zero (x, -1); mpfr_dump (x); mpfr_set_str_binary (x, "0.101010101010111110010001100011000100001E32"); mpfr_dump (x); - mpfr_print_mant_binary ("x=",MPFR_MANT(x), MPFR_PREC(x)); - - + mpfr_print_mant_binary ("x =", MPFR_MANT(x), MPFR_PREC(x)); + MPFR_MANT(x)[MPFR_LAST_LIMB(x)] >>= 1; + MPFR_MANT(x)[0] |= 1; + e = mpfr_get_emin (); + mpfr_set_emin (33); + mpfr_dump (x); + mpfr_set_emin (e); + e = mpfr_get_emax (); + mpfr_set_emax (31); + mpfr_dump (x); + mpfr_set_emax (e); mpfr_clear (x); fclose (stdout); + /* Open it and check for it */ f = fopen (FILE_NAME, "r"); if (f == NULL) @@ -100,7 +124,7 @@ fprintf (stderr, "Can't reopen file!\n"); exit (1); } - for(i = 0 ; i < sizeof(Buffer)-1 ; i++) + for (i = 0 ; i < sizeof (Buffer) - 1 ; i++) { if (feof (f)) { @@ -109,8 +133,8 @@ } if (Buffer[i] != fgetc (f)) { - fprintf (stderr, "Character mismatch for i=%d / %lu\n", - i, (unsigned long) sizeof(Buffer)); + fprintf (stderr, "Character mismatch for i = %d / %lu\n", + i, (unsigned long) sizeof (Buffer)); exit (1); } } diff -Nru mpfr4-3.1.4/tests/tout_str.c mpfr4-4.0.2/tests/tout_str.c --- mpfr4-3.1.4/tests/tout_str.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tout_str.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_out_str. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,10 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include -#include #include "mpfr-test.h" @@ -114,7 +113,7 @@ fout = fopen ("/dev/null", "w"); /* If we failed to open this device, try with a dummy file */ if (fout == NULL) - fout = fopen ("mpfrtest.txt", "w"); + fout = fopen ("tout_str_out.txt", "w"); } else { diff -Nru mpfr4-3.1.4/tests/tpow3.c mpfr4-4.0.2/tests/tpow3.c --- mpfr4-3.1.4/tests/tpow3.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tpow3.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_pow. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include - #include "mpfr-test.h" @@ -65,7 +61,7 @@ mpfr_urandomb (s, RANDS); if (randlimb () % 2) mpfr_neg (s, s, MPFR_RNDN); - rnd = RND_RAND (); + rnd = RND_RAND_NO_RNDF (); mpfr_set_prec (y, yprec); compare = mpfr_pow (y, x, s, rnd); err = (rnd == MPFR_RNDN) ? yprec + 1 : yprec; @@ -75,21 +71,19 @@ inexact = mpfr_pow (z, x, s, rnd); if (mpfr_cmp (t, z)) { - printf ("results differ for x^y with x="); - mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN); - printf (" y="); - mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN); - printf (" prec=%u rnd_mode=%s\n", (unsigned int) prec, + printf ("results differ for x^y with\n"); + printf (" x="); + mpfr_dump (x); + printf (" y="); + mpfr_dump (s); + printf (" with prec=%u rnd_mode=%s\n", (unsigned int) prec, mpfr_print_rnd_mode (rnd)); printf ("got "); - mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); - puts (""); + mpfr_dump (z); printf ("expected "); - mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); - puts (""); - printf ("approx "); - mpfr_print_binary (y); - puts (""); + mpfr_dump (t); + printf ("approx "); + mpfr_dump (y); exit (1); } compare2 = mpfr_cmp (t, y); @@ -105,9 +99,9 @@ { printf ("Wrong inexact flag for rnd=%s: expected %d, got %d" "\n", mpfr_print_rnd_mode (rnd), compare, inexact); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("y="); mpfr_print_binary (y); puts (""); - printf ("t="); mpfr_print_binary (t); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); + printf ("t="); mpfr_dump (t); exit (1); } } diff -Nru mpfr4-3.1.4/tests/tpow_all.c mpfr4-4.0.2/tests/tpow_all.c --- mpfr4-3.1.4/tests/tpow_all.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tpow_all.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for the various power functions -Copyright 2008-2016 Free Software Foundation, Inc. +Copyright 2008-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Note: some tests of the other tpow* test files could be moved there. @@ -29,8 +29,6 @@ /* Execute with at least an argument to report all the errors found by comparisons. */ -#include - #include "mpfr-test.h" /* Behavior of cmpres (called by test_others): @@ -89,10 +87,7 @@ if (MPFR_IS_PURE_FP (z2)) return; } - else if (SAME_SIGN (inex1, inex2) && - ((MPFR_IS_NAN (z1) && MPFR_IS_NAN (z2)) || - ((MPFR_IS_NEG (z1) ^ MPFR_IS_NEG (z2)) == 0 && - mpfr_equal_p (z1, z2)))) + else if (SAME_SIGN (inex1, inex2) && SAME_VAL (z1, z2)) return; } @@ -115,12 +110,12 @@ else { mpfr_out_str (stdout, 16, 0, z1, MPFR_RNDN); - printf (", inex = %d,\n flags =", SIGN (inex1)); + printf (", inex = %d,\n flags =", VSIGN (inex1)); flags_out (flags1); } printf ("Got "); mpfr_out_str (stdout, 16, 0, z2, MPFR_RNDN); - printf (", inex = %d,\n flags =", SIGN (inex2)); + printf (", inex = %d,\n flags =", VSIGN (inex2)); flags_out (flags2); if (all_cmpres_errors != 0) all_cmpres_errors = -1; @@ -272,7 +267,6 @@ s, "mpfr_sqrt, flags set"); } -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) /* If y = -0.5, we can test mpfr_rec_sqrt, except if x = -Inf (because the rule for mpfr_pow on -Inf is different). */ if (MPFR_IS_PURE_FP (y) && mpfr_cmp_str1 (y, "-0.5") == 0 && @@ -287,7 +281,6 @@ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, MPFR_FLAGS_ALL, s, "mpfr_rec_sqrt, flags set"); } -#endif /* If x is an integer that fits in an unsigned long and is not -0, we can test mpfr_ui_pow. */ @@ -363,7 +356,7 @@ static void tst (void) { - int sv = sizeof (val) / sizeof (*val); + int sv = numberof (val); int i, j; int rnd; mpfr_t x, y, z, tmp; @@ -372,7 +365,7 @@ for (i = 0; i < sv; i++) for (j = 0; j < sv; j++) - RND_LOOP (rnd) + RND_LOOP_NO_RNDF (rnd) { int exact, inex; unsigned int flags; @@ -498,7 +491,7 @@ for (i = 0; i <= 12; i++) { unsigned int flags = 0; - char sy[16]; + char sy[256]; /* larger than needed, for maintainability */ /* Test 2^(emin - i/4). * --> Underflow iff i > 4. @@ -512,7 +505,7 @@ sprintf (sy, "emin - %d/4", i); - RND_LOOP (rnd) + RND_LOOP_NO_RNDF (rnd) { int zero; @@ -580,7 +573,7 @@ /* 0 < eps < 1 / (2n), thus (1 - eps)^n > 1/2, and 1/2 (1/2)^n < (1/2 - eps/2)^n < (1/2)^n. */ mpfr_inits2 (64, z, z0, (mpfr_ptr) 0); - RND_LOOP (rnd) + RND_LOOP_NO_RNDF (rnd) { unsigned int ufinex = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT; int expected_inex; @@ -618,7 +611,7 @@ inex = mpfr_set_exp_t (y, mpfr_get_emin () - 2, MPFR_RNDN); MPFR_ASSERTN (inex == 0); for (i = -1; i <= 1; i++) - RND_LOOP (rnd) + RND_LOOP_NO_RNDF (rnd) { unsigned int ufinex = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT; int expected_inex; @@ -694,7 +687,7 @@ * t = 0: always overflow * t > 0: overflow for MPFR_RNDN and MPFR_RNDU. */ - RND_LOOP (rnd) + RND_LOOP_NO_RNDF (rnd) { int inf, overflow; mpfr_rnd_t rnd2; diff -Nru mpfr4-3.1.4/tests/tpow.c mpfr4-4.0.2/tests/tpow.c --- mpfr4-3.1.4/tests/tpow.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tpow.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_pow, mpfr_pow_ui and mpfr_pow_si. -Copyright 2000-2016 Free Software Foundation, Inc. +Copyright 2000-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,15 +17,10 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include -#include -#include - +#define _MPFR_NO_DEPRECATED_ROOT #include "mpfr-test.h" #ifdef CHECK_EXTERNAL @@ -56,7 +51,7 @@ #define TEST_FUNCTION test_pow #define TWO_ARGS -#define TEST_RANDOM_POS 16 +#define TEST_RANDOM_POS 16 /* the 2nd argument is negative with prob. 16/512 */ #define TGENERIC_NOWARNING 1 #include "tgeneric.c" @@ -71,6 +66,21 @@ #define test_generic_ui test_generic_si #include "tgeneric_ui.c" +#define DEFN(N) \ + static int powu##N (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) \ + { return mpfr_pow_ui (y, x, N, rnd); } \ + static int pows##N (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) \ + { return mpfr_pow_si (y, x, N, rnd); } \ + static int root##N (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) \ + { return mpfr_root (y, x, N, rnd); } + +DEFN(2) +DEFN(3) +DEFN(4) +DEFN(5) +DEFN(17) +DEFN(120) + static void check_pow_ui (void) { @@ -133,7 +143,7 @@ /* Check overflow */ mpfr_set_str_binary (a, "1E10"); res = mpfr_pow_ui (a, a, ULONG_MAX, MPFR_RNDN); - if (!MPFR_IS_INF (a) || MPFR_SIGN (a) < 0) + if (!MPFR_IS_INF (a) || MPFR_IS_NEG (a)) { printf ("Error for (1e10)^ULONG_MAX\n"); exit (1); @@ -146,7 +156,7 @@ mpfr_set_str_binary (a, "-1E10"); n = (ULONG_MAX ^ (ULONG_MAX >> 1)) + 1; res = mpfr_pow_ui (a, a, n, MPFR_RNDN); - if (!MPFR_IS_INF (a) || MPFR_SIGN (a) > 0) + if (!MPFR_IS_INF (a) || MPFR_IS_POS (a)) { printf ("Error for (-1e10)^%lu, expected -Inf,\ngot ", n); mpfr_dump (a); @@ -425,14 +435,18 @@ mpfr_init (t); mpfr_urandomb (x, RANDS); u = randlimb () % 2; - for (q = 2; q <= p; q++) - for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) + for (q = MPFR_PREC_MIN; q <= p; q++) + RND_LOOP_NO_RNDF(rnd) { mpfr_set_prec (y, q); mpfr_set_prec (z, q + 10); mpfr_set_prec (t, q); inexact = mpfr_pow_ui (y, x, u, (mpfr_rnd_t) rnd); cmp = mpfr_pow_ui (z, x, u, (mpfr_rnd_t) rnd); + /* Note: that test makes no sense for RNDF, since according to the + reference manual, if the mpfr_can_round() call succeeds, one would + have to use RNDN in the mpfr_set() call below, which might give a + different value for t that the value y obtained above. */ if (mpfr_can_round (z, q + 10, (mpfr_rnd_t) rnd, (mpfr_rnd_t) rnd, q)) { cmp = mpfr_set (t, z, (mpfr_rnd_t) rnd) || cmp; @@ -440,10 +454,10 @@ { printf ("results differ for u=%lu rnd=%s\n", u, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("y="); mpfr_print_binary (y); puts (""); - printf ("t="); mpfr_print_binary (t); puts (""); - printf ("z="); mpfr_print_binary (z); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); + printf ("t="); mpfr_dump (t); + printf ("z="); mpfr_dump (z); exit (1); } if (((inexact == 0) && (cmp != 0)) || @@ -453,8 +467,8 @@ (unsigned int) p, (unsigned int) q, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); printf ("expected %d, got %d\n", cmp, inexact); - printf ("u=%lu x=", u); mpfr_print_binary (x); puts (""); - printf ("y="); mpfr_print_binary (y); puts (""); + printf ("u=%lu x=", u); mpfr_dump (x); + printf ("y="); mpfr_dump (y); exit (1); } } @@ -789,7 +803,8 @@ { printf ("Error in mpfr_pow for (%s)^(%s) (%d,%d):\n" "Flags = %u instead of expected %u\n", - name[i], name[j], i, j, __gmpfr_flags, f[i][j]); + name[i], name[j], i, j, + (unsigned int) __gmpfr_flags, f[i][j]); mpfr_dump (r); error = 1; } @@ -818,7 +833,8 @@ { printf ("Error in mpfr_pow_z for (%s)^(%s) (%d,%d):\n" "Flags = %u instead of expected %u\n", - name[i], name[j], i, j, __gmpfr_flags, f[i][j]); + name[i], name[j], i, j, + (unsigned int) __gmpfr_flags, f[i][j]); mpfr_dump (r); error = 1; } @@ -843,7 +859,8 @@ { printf ("Error in mpfr_pow_si for (%s)^(%s) (%d,%d):\n" "Flags = %u instead of expected %u\n", - name[i], name[j], i, j, __gmpfr_flags, f[i][j]); + name[i], name[j], i, j, + (unsigned int) __gmpfr_flags, f[i][j]); mpfr_dump (r); error = 1; } @@ -869,7 +886,8 @@ { printf ("Error in mpfr_pow_ui for (%s)^(%s) (%d,%d):\n" "Flags = %u instead of expected %u\n", - name[i], name[j], i, j, __gmpfr_flags, f[i][j]); + name[i], name[j], i, j, + (unsigned int) __gmpfr_flags, f[i][j]); mpfr_dump (r); error = 1; } @@ -899,7 +917,8 @@ { printf ("Error in mpfr_ui_pow for (%s)^(%s) (%d,%d):\n" "Flags = %u instead of expected %u\n", - name[i], name[j], i, j, __gmpfr_flags, f[i][j]); + name[i], name[j], i, j, + (unsigned int) __gmpfr_flags, f[i][j]); mpfr_dump (r); error = 1; } @@ -1109,7 +1128,7 @@ if (__gmpfr_flags != (MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT)) { printf ("Error in overflows2 (e = %d): bad flags (%u)\n", - e, __gmpfr_flags); + e, (unsigned int) __gmpfr_flags); exit (1); } } @@ -1158,7 +1177,7 @@ if (__gmpfr_flags != (MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT)) { printf ("Error in overflows3 (RNDN, i = %d): bad flags (%u)\n", - i, __gmpfr_flags); + i, (unsigned int) __gmpfr_flags); exit (1); } @@ -1248,7 +1267,7 @@ mpfr_set_exp (y, mpfr_get_emax ()); mpfr_clear_flags (); mpfr_pow (z, x, y, MPFR_RNDN); - MPFR_ASSERTN (mpfr_zero_p (z) && MPFR_SIGN (z) > 0 && + MPFR_ASSERTN (mpfr_zero_p (z) && MPFR_IS_POS (z) && __gmpfr_flags == (MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT)); mpfr_clears (x, y, z, (mpfr_ptr) 0); @@ -1275,7 +1294,7 @@ mpfr_set_si (y, -2, MPFR_RNDN); /* y = -2 */ mpfr_clear_flags (); inex = mpfr_pow (z, x, y, MPFR_RNDN); - if (! mpfr_inf_p (z) || MPFR_SIGN (z) < 0) + if (! mpfr_inf_p (z) || MPFR_IS_NEG (z)) { printf ("Error in bug20071104: expected +Inf, got "); mpfr_dump (z); @@ -1288,7 +1307,8 @@ } if (__gmpfr_flags != (MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT)) { - printf ("Error in bug20071104: bad flags (%u)\n", __gmpfr_flags); + printf ("Error in bug20071104: bad flags (%u)\n", + (unsigned int) __gmpfr_flags); exit (1); } mpfr_clears (x, y, z, (mpfr_ptr) 0); @@ -1370,7 +1390,7 @@ mpfr_set_si_2exp (y, -1, i, MPFR_RNDN); mpfr_add_si (y, y, 1, MPFR_RNDN); tern = mpfr_pow (z, x, y, MPFR_RNDN); - MPFR_ASSERTN(mpfr_zero_p (z) && MPFR_SIGN(z) < 0); + MPFR_ASSERTN(mpfr_zero_p (z) && MPFR_IS_NEG (z)); } mpfr_clear (x); @@ -1452,7 +1472,7 @@ MPFR_ASSERTN (inex == 0); mpfr_set_str_binary (t[0], "-0.10101101e2"); mpfr_set_str_binary (t[1], "-0.10101110e2"); - RND_LOOP (rnd) + RND_LOOP_NO_RNDF (rnd) { int i, inex0; @@ -1460,6 +1480,7 @@ inex0 = i ? -1 : 1; mpfr_clear_flags (); inex = mpfr_pow (z, x, y, (mpfr_rnd_t) rnd); + if (__gmpfr_flags != MPFR_FLAGS_INEXACT || ! SAME_SIGN (inex, inex0) || MPFR_IS_NAN (z) || mpfr_cmp (z, t[i]) != 0) { @@ -1548,6 +1569,151 @@ set_emin (emin); } +static void +tst20140422 (void) +{ + mpfr_t x, y, z1, z2; + int inex, rnd; + unsigned int flags; + + mpfr_inits2 (128, x, y, z1, z2, (mpfr_ptr) 0); + mpfr_set_ui (x, 1296, MPFR_RNDN); + mpfr_set_ui_2exp (y, 3, -2, MPFR_RNDN); + mpfr_set_ui (z2, 216, MPFR_RNDN); + RND_LOOP (rnd) + { + mpfr_clear_flags (); + inex = mpfr_pow (z1, x, y, (mpfr_rnd_t) rnd); + flags = __gmpfr_flags; + if (inex != 0 || flags != 0 || ! mpfr_equal_p (z1, z2)) + { + printf ("Error in bug20140422 with %s\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + printf ("Expected inex = 0, flags = 0, z = "); + mpfr_dump (z2); + printf ("Got inex = %d, flags = %u, z = ", inex, flags); + mpfr_dump (z1); + exit (1); + } + } + mpfr_clears (x, y, z1, z2, (mpfr_ptr) 0); +} + +static void +coverage (void) +{ + mpfr_t x, y, z, t, u; + mpfr_exp_t emin; + int inex; + int i; + + /* check a corner case with prec(z)=1 */ + mpfr_init2 (x, 2); + mpfr_init2 (y, 8); + mpfr_init2 (z, 1); + mpfr_set_ui_2exp (x, 3, -2, MPFR_RNDN); /* x = 3/4 */ + emin = mpfr_get_emin (); + mpfr_set_emin (-40); + mpfr_set_ui_2exp (y, 199, -1, MPFR_RNDN); /* y = 99.5 */ + /* x^y ~ 0.81*2^-41 */ + mpfr_clear_underflow (); + inex = mpfr_pow (z, x, y, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (z, 1, -41) == 0); + /* there should be no underflow, since with unbounded exponent range, + and a precision of 1 bit, x^y is rounded to 1.0*2^-41 */ + MPFR_ASSERTN(!mpfr_underflow_p ()); + mpfr_set_ui_2exp (y, 201, -1, MPFR_RNDN); /* y = 100.5 */ + /* x^y ~ 0.61*2^-41 */ + mpfr_clear_underflow (); + inex = mpfr_pow (z, x, y, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (z, 1, -41) == 0); + /* there should be an underflow, since with unbounded exponent range, + and a precision of 1 bit, x^y is rounded to 0.5*2^-41 */ + MPFR_ASSERTN(mpfr_underflow_p ()); + mpfr_set_ui_2exp (y, 203, -1, MPFR_RNDN); /* y = 101.5 */ + /* x^y ~ 0.46*2^-41 */ + mpfr_clear_underflow (); + inex = mpfr_pow (z, x, y, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_zero_p (z) && mpfr_signbit (z) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + mpfr_clears (x, y, z, (mpfr_ptr) 0); + mpfr_set_emin (emin); + + /* test for x = -2, y an odd integer with EXP(y) > i */ + mpfr_inits2 (10, t, u, (mpfr_ptr) 0); + mpfr_set_ui_2exp (t, 1, 1UL << 8, MPFR_RNDN); + for (i = 8; i <= 300; i++) + { + mpfr_flags_t flags, flags_u; + int inex_u; + + mpfr_mul_si (u, t, -2, MPFR_RNDN); /* u = (-2)^(2^i + 1) */ + mpfr_init2 (x, 10); + mpfr_init2 (y, i+1); + mpfr_init2 (z, 10); + mpfr_set_si (x, -2, MPFR_RNDN); + mpfr_set_ui_2exp (y, 1, i, MPFR_RNDN); + mpfr_nextabove (y); /* y = 2^i + 1 */ + if (MPFR_IS_INF (u)) + { + inex_u = -1; + flags_u = MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT; + } + else + { + inex_u = 0; + flags_u = 0; + } + mpfr_clear_flags (); + inex = mpfr_pow (z, x, y, MPFR_RNDN); + flags = __gmpfr_flags; + if (mpfr_cmp0 (z, u) != 0 || + ! SAME_SIGN (inex, inex_u) || + flags != flags_u) + { + printf ("Error in coverage for (-2)^(2^%d + 1):\n", i); + printf ("Expected "); + mpfr_dump (u); + printf (" with inex = %d and flags:", inex_u); + flags_out (flags_u); + printf ("Got "); + mpfr_dump (z); + printf (" with inex = %d and flags:", inex); + flags_out (flags); + exit (1); + } + mpfr_sqr (t, t, MPFR_RNDN); + mpfr_clears (x, y, z, (mpfr_ptr) 0); + } + mpfr_clears (t, u, (mpfr_ptr) 0); + +#if _MPFR_EXP_FORMAT >= 3 && _MPFR_PREC_FORMAT == 3 && MPFR_PREC_BITS == 64 + /* thus an unsigned long has at least 64 bits and x will be finite */ + { + mpfr_exp_t emax; + + emax = mpfr_get_emax (); + mpfr_set_emax ((1UL << 62) - 1); + /* emax = 4611686018427387903 on a 64-bit machine */ + mpfr_init2 (x, 65); + mpfr_init2 (y, 65); + mpfr_init2 (z, 64); + mpfr_set_ui_2exp (x, 512, 3074457345618258593UL, MPFR_RNDN); + mpfr_nextbelow (x); + mpfr_set_str_binary (y, "1.1"); /* y = 3/2 */ + mpfr_nextabove (y); + inex = mpfr_pow (z, x, y, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_inf_p (z)); + mpfr_clears (x, y, z, (mpfr_ptr) 0); + mpfr_set_emax (emax); + } +#endif +} + int main (int argc, char **argv) { @@ -1555,6 +1721,7 @@ tests_start_mpfr (); + coverage (); bug20071127 (); special (); particular_cases (); @@ -1562,7 +1729,7 @@ check_pow_si (); check_special_pow_si (); pow_si_long_min (); - for (p = 2; p < 100; p++) + for (p = MPFR_PREC_MIN; p < 100; p++) check_inexact (p); underflows (); overflows (); @@ -1576,13 +1743,39 @@ bug20080721 (); bug20080820 (); bug20110320 (); + tst20140422 (); - test_generic (2, 100, 100); - test_generic_ui (2, 100, 100); - test_generic_si (2, 100, 100); + test_generic (MPFR_PREC_MIN, 100, 100); + test_generic_ui (MPFR_PREC_MIN, 100, 100); + test_generic_si (MPFR_PREC_MIN, 100, 100); data_check ("data/pow275", mpfr_pow275, "mpfr_pow275"); + bad_cases (powu2, root2, "mpfr_pow_ui[2]", + 8, -256, 255, 4, 128, 800, 40); + bad_cases (pows2, root2, "mpfr_pow_ui[2]", + 8, -256, 255, 4, 128, 800, 40); + bad_cases (powu3, root3, "mpfr_pow_ui[3]", + 8, -256, 255, 4, 128, 800, 40); + bad_cases (pows3, root3, "mpfr_pow_ui[3]", + 8, -256, 255, 4, 128, 800, 40); + bad_cases (powu4, root4, "mpfr_pow_ui[4]", + 8, -256, 255, 4, 128, 800, 40); + bad_cases (pows4, root4, "mpfr_pow_ui[4]", + 8, -256, 255, 4, 128, 800, 40); + bad_cases (powu5, root5, "mpfr_pow_ui[5]", + 8, -256, 255, 4, 128, 800, 40); + bad_cases (pows5, root5, "mpfr_pow_ui[5]", + 8, -256, 255, 4, 128, 800, 40); + bad_cases (powu17, root17, "mpfr_pow_ui[17]", + 8, -256, 255, 4, 128, 800, 40); + bad_cases (pows17, root17, "mpfr_pow_ui[17]", + 8, -256, 255, 4, 128, 800, 40); + bad_cases (powu120, root120, "mpfr_pow_ui[120]", + 8, -256, 255, 4, 128, 800, 40); + bad_cases (pows120, root120, "mpfr_pow_ui[120]", + 8, -256, 255, 4, 128, 800, 40); + tests_end_mpfr (); return 0; } diff -Nru mpfr4-3.1.4/tests/tpow_z.c mpfr4-4.0.2/tests/tpow_z.c --- mpfr4-3.1.4/tests/tpow_z.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tpow_z.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_pow_z -- power function x^z with z a MPZ -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,16 +17,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include - #include "mpfr-test.h" -#define ERROR(str) do { printf("Error for "str"\n"); exit (1); } while (0) +#define PRINT_ERROR(str) \ + do { printf ("Error for %s\n", str); exit (1); } while (0) static void check_special (void) @@ -44,93 +41,93 @@ mpz_set_ui (z, 0); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (y, 1) != 0) - ERROR ("23^0"); + PRINT_ERROR ("23^0"); mpfr_set_nan (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_nan_p (y) || mpfr_cmp_si (y, 1) != 0) - ERROR ("NAN^0"); + PRINT_ERROR ("NAN^0"); mpfr_set_inf (x, 1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_cmp_ui (y, 1) != 0) - ERROR ("INF^0"); + PRINT_ERROR ("INF^0"); /* sINF^N = INF if s==1 or n even if N > 0*/ mpz_set_ui (z, 42); mpfr_set_inf (x, 1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0) - ERROR ("INF^42"); + PRINT_ERROR ("INF^42"); mpfr_set_inf (x, -1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0) - ERROR ("-INF^42"); + PRINT_ERROR ("-INF^42"); mpz_set_ui (z, 17); mpfr_set_inf (x, 1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0) - ERROR ("INF^17"); + PRINT_ERROR ("INF^17"); mpfr_set_inf (x, -1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) >= 0) - ERROR ("-INF^17"); + PRINT_ERROR ("-INF^17"); mpz_set_si (z, -42); mpfr_set_inf (x, 1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) - ERROR ("INF^-42"); + if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) + PRINT_ERROR ("INF^-42"); mpfr_set_inf (x, -1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) - ERROR ("-INF^-42"); + if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) + PRINT_ERROR ("-INF^-42"); mpz_set_si (z, -17); mpfr_set_inf (x, 1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) - ERROR ("INF^-17"); + if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) + PRINT_ERROR ("INF^-17"); mpfr_set_inf (x, -1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) >= 0) - ERROR ("-INF^-17"); + if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_POS (y)) + PRINT_ERROR ("-INF^-17"); /* s0^N = +0 if s==+ or n even if N > 0*/ mpz_set_ui (z, 42); MPFR_SET_ZERO (x); MPFR_SET_POS (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) - ERROR ("+0^42"); + if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) + PRINT_ERROR ("+0^42"); MPFR_SET_NEG (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) - ERROR ("-0^42"); + if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) + PRINT_ERROR ("-0^42"); mpz_set_ui (z, 17); MPFR_SET_POS (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) - ERROR ("+0^17"); + if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) + PRINT_ERROR ("+0^17"); MPFR_SET_NEG (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) >= 0) - ERROR ("-0^17"); + if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_POS (y)) + PRINT_ERROR ("-0^17"); mpz_set_si (z, -42); MPFR_SET_ZERO (x); MPFR_SET_POS (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) <= 0) - ERROR ("+0^-42"); + if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_IS_NEG (y)) + PRINT_ERROR ("+0^-42"); MPFR_SET_NEG (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) <= 0) - ERROR ("-0^-42"); + if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_IS_NEG (y)) + PRINT_ERROR ("-0^-42"); mpz_set_si (z, -17); MPFR_SET_POS (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) <= 0) - ERROR ("+0^-17"); + if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_IS_NEG (y)) + PRINT_ERROR ("+0^-17"); MPFR_SET_NEG (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) >= 0) - ERROR ("-0^-17"); + if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_IS_POS (y)) + PRINT_ERROR ("-0^-17"); mpz_clear (z); mpfr_clear (y); @@ -237,7 +234,7 @@ mpfr_nextbelow (x); /* x = -2^(emin-1) */ mpfr_clear_flags (); inex = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (! mpfr_inf_p (y) || MPFR_SIGN (y) < 0) + if (! mpfr_inf_p (y) || MPFR_IS_NEG (y)) { printf ("Error in bug20071104: expected +Inf, got "); mpfr_dump (y); @@ -250,7 +247,8 @@ } if (__gmpfr_flags != (MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT)) { - printf ("Error in bug20071104: bad flags (%u)\n", __gmpfr_flags); + printf ("Error in bug20071104: bad flags (%u)\n", + (unsigned int) __gmpfr_flags); exit (1); } mpfr_clears (x, y, (mpfr_ptr) 0); @@ -270,7 +268,7 @@ mpfr_set_str_binary (a, "1E10"); mpz_init_set_ui (z, ULONG_MAX); res = mpfr_pow_z (a, a, z, MPFR_RNDN); - if (! MPFR_IS_INF (a) || MPFR_SIGN (a) < 0 || res <= 0) + if (! MPFR_IS_INF (a) || MPFR_IS_NEG (a) || res <= 0) { printf ("Error for (1e10)^ULONG_MAX, expected +Inf,\ngot "); mpfr_dump (a); @@ -286,7 +284,7 @@ n = (ULONG_MAX ^ (ULONG_MAX >> 1)) + 1; mpz_set_ui (z, n); res = mpfr_pow_z (a, a, z, MPFR_RNDN); - if (! MPFR_IS_INF (a) || MPFR_SIGN (a) > 0 || res >= 0) + if (! MPFR_IS_INF (a) || MPFR_IS_POS (a) || res >= 0) { printf ("Error for (-1e10)^%lu, expected -Inf,\ngot ", n); mpfr_dump (a); diff -Nru mpfr4-3.1.4/tests/tprintf.c mpfr4-4.0.2/tests/tprintf.c --- mpfr4-3.1.4/tests/tprintf.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tprintf.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* tprintf.c -- test file for mpfr_printf and mpfr_vprintf -Copyright 2008-2016 Free Software Foundation, Inc. +Copyright 2008-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,22 +17,28 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_STDARG +/* Needed due to the tests on HAVE_STDARG and MPFR_USE_MINI_GMP */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#if defined(HAVE_STDARG) && !defined(MPFR_USE_MINI_GMP) #include -#include -#include #include +#include + +#ifdef HAVE_LOCALE_H +#include +#endif #include "mpfr-intmax.h" #include "mpfr-test.h" #define STDOUT_FILENO 1 -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) - #define QUOTE(X) NAME(X) #define NAME(X) #X @@ -66,7 +72,7 @@ { if (mpfr_printf (fmt, x) == -1) { - fprintf (stderr, "Error in mpfr_printf(\"%s\", ...)\n", fmt); + fprintf (stderr, "Error 1 in mpfr_printf(\"%s\", ...)\n", fmt); exit (1); } @@ -81,7 +87,7 @@ va_start (ap, fmt); if (mpfr_vprintf (fmt, ap) == -1) { - fprintf (stderr, "Error in mpfr_vprintf(\"%s\", ...)\n", fmt); + fprintf (stderr, "Error 2 in mpfr_vprintf(\"%s\", ...)\n", fmt); va_end (ap); exit (1); @@ -90,87 +96,123 @@ va_end (ap); } -static void +static unsigned int check_vprintf_failure (const char *fmt, ...) { va_list ap; + int r, e; va_start (ap, fmt); - if (mpfr_vprintf (fmt, ap) != -1) - { - putchar ('\n'); - fprintf (stderr, "Error in mpfr_vprintf(\"%s\", ...)\n", fmt); - - va_end (ap); - exit (1); - } - putchar ('\n'); + errno = 0; + r = mpfr_vprintf (fmt, ap); + e = errno; va_end (ap); -} -static void -check_invalid_format (void) -{ - int i = 0; + if (r != -1 +#ifdef EOVERFLOW + || e != EOVERFLOW +#endif + ) + { + putchar ('\n'); + fprintf (stderr, "Error 3 in mpfr_vprintf(\"%s\", ...)\n" + "Got r = %d, errno = %d\n", fmt, r, e); + return 1; + } - /* format in disorder */ - check_vprintf_failure ("blah %l2.1d blah", i); - check_vprintf_failure ("blah %2.1#d blah", i); - - /* incomplete format */ - check_vprintf_failure ("%", i); - check_vprintf_failure ("% (missing conversion specifier)", i); - check_vprintf_failure ("missing conversion specifier %h", i); - check_vprintf_failure ("this should fail %.l because of missing conversion specifier " - "(or doubling %%)", i); - check_vprintf_failure ("%L", i); - check_vprintf_failure ("%hh. ", i); - check_vprintf_failure ("blah %j."); - check_vprintf_failure ("%ll blah"); - check_vprintf_failure ("blah%t blah"); - check_vprintf_failure ("%z "); - check_vprintf_failure ("%F (missing conversion specifier)"); - check_vprintf_failure ("%Q (missing conversion specifier)"); - check_vprintf_failure ("%M (missing conversion specifier)"); - check_vprintf_failure ("%N (missing conversion specifier)"); - check_vprintf_failure ("%Z (missing conversion specifier)"); - check_vprintf_failure ("%R (missing conversion specifier)"); - check_vprintf_failure ("%R"); - check_vprintf_failure ("%P (missing conversion specifier)"); - - /* conversion specifier with wrong length specifier */ - check_vprintf_failure ("%ha", i); - check_vprintf_failure ("%hhe", i); - check_vprintf_failure ("%jf", i); - check_vprintf_failure ("%lg", i); - check_vprintf_failure ("%tA", i); - check_vprintf_failure ("%zE", i); - check_vprintf_failure ("%Ld", i); - check_vprintf_failure ("%Qf", i); - check_vprintf_failure ("%MG", i); - check_vprintf_failure ("%Na", i); - check_vprintf_failure ("%ZE", i); - check_vprintf_failure ("%PG", i); - check_vprintf_failure ("%Fu", i); - check_vprintf_failure ("%Rx", i); + putchar ('\n'); + return 0; } +/* The goal of this test is to check cases where more INT_MAX characters + are output, in which case, it should be a failure, because like C's + *printf functions, the return type is int and the returned value must + be either the number of characters printed or a negative value. */ static void check_long_string (void) { /* this test is VERY expensive both in time (~1 min on core2 @ 2.40GHz) and in memory (~2.5 GB) */ mpfr_t x; + long large_prec = 2147483647; + size_t min_memory_limit, old_memory_limit; + + old_memory_limit = tests_memory_limit; + + /* With a 32-bit (4GB) address space, a realloc failure has been noticed + with a 2G precision (though allocating up to 4GB is possible): + MPFR: Can't reallocate memory (old_size=4096 new_size=2147487744) + The implementation might be improved to use less memory and avoid + this problem. In the mean time, let's choose a smaller precision, + but this will generally have the effect to disable the test. */ + if (sizeof (void *) == 4) + large_prec /= 2; + + /* We assume that the precision won't be increased internally. */ + if (large_prec > MPFR_PREC_MAX) + large_prec = MPFR_PREC_MAX; + + /* Increase tests_memory_limit if need be in order to avoid an + obvious failure due to insufficient memory. Note that such an + increase is necessary, but is not guaranteed to be sufficient + in all cases (e.g. with logging activated). */ + min_memory_limit = large_prec / MPFR_BYTES_PER_MP_LIMB; + if (min_memory_limit > (size_t) -1 / 32) + min_memory_limit = (size_t) -1; + else + min_memory_limit *= 32; + if (tests_memory_limit > 0 && tests_memory_limit < min_memory_limit) + tests_memory_limit = min_memory_limit; - mpfr_init2 (x, INT_MAX); + mpfr_init2 (x, large_prec); mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_nextabove (x); - check_vprintf_failure ("%Rb", x); - check_vprintf_failure ("%RA %RA %Ra %Ra", x, x, x, x); + if (large_prec >= INT_MAX - 512) + { + unsigned int err = 0; + +#define LS1 "%Rb %512d" +#define LS2 "%RA %RA %Ra %Ra %512d" + + err |= check_vprintf_failure (LS1, x, 1); + err |= check_vprintf_failure (LS2, x, x, x, x, 1); + + if (sizeof (long) * CHAR_BIT > 40) + { + long n1, n2; + + n1 = large_prec + 517; + n2 = -17; + err |= check_vprintf_failure (LS1 "%ln", x, 1, &n2); + if (n1 != n2) + { + fprintf (stderr, "Error in check_long_string(\"%s\", ...)\n" + "Expected n = %ld\n" + "Got n = %ld\n", + LS1 "%ln", n1, n2); + err = 1; + } + n1 = ((large_prec - 2) / 4) * 4 + 548; + n2 = -17; + err |= check_vprintf_failure (LS2 "%ln", x, x, x, x, 1, &n2); + if (n1 != n2) + { + fprintf (stderr, "Error in check_long_string(\"%s\", ...)\n" + "Expected n = %ld\n" + "Got n = %ld\n", + LS2 "%ln", n1, n2); + err = 1; + } + } + + if (err) + exit (1); + } mpfr_clear (x); + tests_memory_limit = old_memory_limit; } static void @@ -236,11 +278,11 @@ unsigned long ulo = 1; float f = -1.25; double d = -1.25; -#if !defined(NPRINTF_T) || !defined(NPRINTF_L) +#if defined(PRINTF_T) || defined(PRINTF_L) long double ld = -1.25; #endif -#ifndef NPRINTF_T +#ifdef PRINTF_T ptrdiff_t p = 1, saved_p; #endif size_t sz = 1; @@ -279,15 +321,20 @@ mpfr, mpq, &mpfr, (void *) &i); check_length_with_cmp (7, mpfr, 15, mpfr_cmp_ui (mpfr, 15), Rg); -#ifndef NPRINTF_T +#ifdef PRINTF_T saved_p = p; check_vprintf ("%% a. %RNg, b. %Qx, c. %td%tn", mpfr, mpq, p, &p); if (p != 20) - mpfr_fprintf (stderr, "Error in test 8, got '%% a. %RNg, b. %Qx, c. %td'\n", mpfr, mpq, saved_p); + { + mpfr_fprintf (stderr, "Error in test 8, got '%% a. %RNg, b. %Qx, c. %td'\n", mpfr, mpq, saved_p); + /* under MinGW, -D__USE_MINGW_ANSI_STDIO is required to support %td + see https://gcc.gnu.org/ml/gcc/2013-03/msg00103.html */ + fprintf (stderr, "Under MinGW, compiling GMP with -D__USE_MINGW_ANSI_STDIO might be required\n"); + } check_length (8, (long) p, 20, ld); /* no format specifier '%td' in C89 */ #endif -#ifndef NPRINTF_L +#ifdef PRINTF_L check_vprintf ("a. %RA, b. %Lf, c. %QX%zn", mpfr, ld, mpq, &sz); check_length (9, (unsigned long) sz, 30, lu); /* no format specifier '%zu' in C89 */ #endif @@ -431,6 +478,111 @@ mpfr_clear (x); } +#if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE) + +static void +test_locale (void) +{ + const char * const tab_locale[] = { + "en_US", + "en_US.iso88591", + "en_US.iso885915", + "en_US.utf8" + }; + int i; + mpfr_t x; + int count; + char v[] = "99999999999999999999999.5"; + + for (i = 0; i < numberof(tab_locale); i++) + { + char *s; + + s = setlocale (LC_ALL, tab_locale[i]); + + if (s != NULL && MPFR_THOUSANDS_SEPARATOR == ',') + break; + } + + if (i == numberof(tab_locale)) + { + if (getenv ("MPFR_CHECK_LOCALES") == NULL) + return; + + fprintf (stderr, "Cannot find a locale with ',' thousands separator.\n" + "Please install one of the en_US based locales.\n"); + exit (1); + } + + mpfr_init2 (x, 113); + mpfr_set_ui (x, 10000, MPFR_RNDN); + + count = mpfr_printf ("(1) 10000=%'Rg \n", x); + check_length (10000, count, 18, d); + count = mpfr_printf ("(2) 10000=%'Rf \n", x); + check_length (10001, count, 25, d); + + mpfr_set_ui (x, 1000, MPFR_RNDN); + count = mpfr_printf ("(3) 1000=%'Rf \n", x); + check_length (10002, count, 23, d); + + for (i = 1; i <= sizeof (v) - 3; i++) + { + mpfr_set_str (x, v + sizeof (v) - 3 - i, 10, MPFR_RNDN); + count = mpfr_printf ("(4) 10^i=%'.0Rf \n", x); + check_length (10002 + i, count, 12 + i + i/3, d); + } + +#define N0 20 + + for (i = 1; i <= N0; i++) + { + char s[N0+4]; + int j, rnd; + + s[0] = '1'; + for (j = 1; j <= i; j++) + s[j] = '0'; + s[i+1] = '\0'; + + mpfr_set_str (x, s, 10, MPFR_RNDN); + + RND_LOOP (rnd) + { + count = mpfr_printf ("(5) 10^i=%'.0R*f \n", (mpfr_rnd_t) rnd, x); + check_length (11000 + 10 * i + rnd, count, 12 + i + i/3, d); + } + + strcat (s + (i + 1), ".5"); + count = mpfr_printf ("(5) 10^i=%'.0Rf \n", x); + check_length (11000 + 10 * i + 9, count, 12 + i + i/3, d); + } + + mpfr_set_str (x, "1000", 10, MPFR_RNDN); + count = mpfr_printf ("%'012.3Rg\n", x); + check_length (12000, count, 13, d); + count = mpfr_printf ("%'012.4Rg\n", x); + check_length (12001, count, 13, d); + count = mpfr_printf ("%'013.4Rg\n", x); + check_length (12002, count, 14, d); + + mpfr_clear (x); +} + +#else + +static void +test_locale (void) +{ + if (getenv ("MPFR_CHECK_LOCALES") != NULL) + { + fprintf (stderr, "Cannot test locales.\n"); + exit (1); + } +} + +#endif + int main (int argc, char *argv[]) { @@ -447,11 +599,11 @@ if (freopen ("/dev/null", "w", stdout) == NULL) { /* We failed to open this device, try with a dummy file */ - if (freopen ("mpfrtest.txt", "w", stdout) == NULL) + if (freopen ("tprintf_out.txt", "w", stdout) == NULL) { /* Output the error message to stderr since it is not a message about a wrong result in MPFR. Anyway the - stdandard output may have changed. */ + standard output may have changed. */ fprintf (stderr, "Can't open /dev/null or a temporary file\n"); exit (1); } @@ -463,7 +615,6 @@ N = atoi (argv[1]); } - check_invalid_format (); check_special (); check_mixed (); @@ -473,6 +624,8 @@ check_random (N); + test_locale (); + if (stdout_redirect) { if ((fflush (stdout) == EOF) || (fclose (stdout) == -1)) @@ -482,17 +635,6 @@ return 0; } -#else /* MPFR_VERSION */ - -int -main (void) -{ - printf ("Warning! Test disabled for this MPFR version.\n"); - return 0; -} - -#endif /* MPFR_VERSION */ - #else /* HAVE_STDARG */ int diff -Nru mpfr4-3.1.4/tests/trandom.c mpfr4-4.0.2/tests/trandom.c --- mpfr4-3.1.4/tests/trandom.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/trandom.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_urandomb -Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void @@ -34,12 +31,9 @@ mpfr_exp_t emin; size_tab = (nbtests >= 1000 ? nbtests / 50 : 20); - tab = (int *) calloc (size_tab, sizeof(int)); - if (tab == NULL) - { - fprintf (stderr, "trandom: can't allocate memory in test_urandomb\n"); - exit (1); - } + tab = (int *) tests_allocate (size_tab * sizeof (int)); + for (k = 0; k < size_tab; k++) + tab[k] = 0; mpfr_init2 (x, prec); xn = 1 + (prec - 1) / mp_bits_per_limb; @@ -48,11 +42,12 @@ for (k = 0; k < nbtests; k++) { mpfr_urandomb (x, RANDS); + MPFR_ASSERTN (MPFR_IS_FP (x)); /* check that lower bits are zero */ - if (MPFR_MANT(x)[0] & MPFR_LIMB_MASK(sh)) + if (MPFR_NOTZERO(x) && (MPFR_MANT(x)[0] & MPFR_LIMB_MASK(sh))) { printf ("Error: mpfr_urandomb() returns invalid numbers:\n"); - mpfr_print_binary (x); puts (""); + mpfr_dump (x); exit (1); } d = mpfr_get_d1 (x); av += d; var += d*d; @@ -73,35 +68,34 @@ set_emin (emin); mpfr_clear (x); - if (!verbose) + + if (verbose) { - free(tab); - return; - } + av /= nbtests; + var = (var / nbtests) - av * av; - av /= nbtests; - var = (var / nbtests) - av * av; + th = (double) nbtests / size_tab; + printf ("Average = %.5f\nVariance = %.5f\n", av, var); + printf ("Repartition for urandomb. Each integer should be close to" + " %d.\n", (int) th); - th = (double)nbtests / size_tab; - printf("Average = %.5f\nVariance = %.5f\n", av, var); - printf("Repartition for urandomb. Each integer should be close to %d.\n", - (int)th); + for (k = 0; k < size_tab; k++) + { + chi2 += (tab[k] - th) * (tab[k] - th) / th; + printf ("%d ", tab[k]); + if (((unsigned int) (k+1) & 7) == 0) + printf ("\n"); + } - for (k = 0; k < size_tab; k++) - { - chi2 += (tab[k] - th) * (tab[k] - th) / th; - printf("%d ", tab[k]); - if (((k+1) & 7) == 0) - printf("\n"); + printf ("\nChi2 statistics value (with %d degrees of freedom) :" + " %.5f\n\n", size_tab - 1, chi2); } - printf("\nChi2 statistics value (with %d degrees of freedom) : %.5f\n\n", - size_tab - 1, chi2); - - free(tab); + tests_free (tab, size_tab * sizeof (int)); return; } +#ifndef MPFR_USE_MINI_GMP /* Problem reported by Carl Witty: check mpfr_urandomb give similar results on 32-bit and 64-bit machines. We assume the default GMP random generator does not depend on the machine @@ -143,6 +137,7 @@ mpfr_clear (x); gmp_randclear (s); } +#endif int main (int argc, char *argv[]) @@ -159,7 +154,7 @@ nbtests = 10000; if (argc > 1) { - long a = atol(argv[1]); + long a = atol (argv[1]); if (a != 0) nbtests = a; } @@ -167,7 +162,7 @@ if (argc <= 2) prec = 1000; else - prec = atol(argv[2]); + prec = atol (argv[2]); test_urandomb (nbtests, prec, verbose); @@ -176,12 +171,17 @@ test_urandomb (nbtests, 2, 0); } +#ifndef MPFR_USE_MINI_GMP + + /* Since these tests assume a deterministic random generator, and this + is not implemented in mini-gmp, we omit them with mini-gmp. */ + bug20100914 (); #if __MPFR_GMP(4,2,0) /* Get a non-zero fixed-point number whose first 32 bits are 0 with the default GMP PRNG. This corresponds to the case cnt == 0 && k != 0 in - src/urandomb.c with the 32-bit ABI. */ + src/urandomb.c (fixed in r8762) with the 32-bit ABI. */ { gmp_randstate_t s; mpfr_t x; @@ -212,6 +212,8 @@ } #endif +#endif + tests_end_mpfr (); return 0; } diff -Nru mpfr4-3.1.4/tests/trandom_deviate.c mpfr4-4.0.2/tests/trandom_deviate.c --- mpfr4-3.1.4/tests/trandom_deviate.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/trandom_deviate.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,322 @@ +/* Test file for mpfr_random_deviate + +Copyright 2011-2019 Free Software Foundation, Inc. +Contributed by Charles Karney , SRI International. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-test.h" + +#include "random_deviate.h" + +#define W 32 /* Must match value in random_deviate.c */ + +/* set random deviate rop from op */ +static void +mpfr_random_deviate_set (mpfr_random_deviate_t rop, mpfr_random_deviate_t op) +{ + rop->e = op->e; + rop->h = op->h; + mpz_set (rop->f, op->f); +} + +/* set random deviate to fract * 2^-expt. expt must be a multiple + * of W and cannot be 0. fract must be in [0,2^W) */ +static void +mpfr_random_deviate_ldexp (mpfr_random_deviate_t rop, + unsigned long fract, unsigned long expt) +{ + rop->h = (expt > W ? 0ul : fract); + mpz_set_ui (rop->f, expt > W ? fract : 0ul); + rop->e = expt; +} + +/* Test mpfr_random_deviate_less. With two initially equal deviates this + * should return true half the time. In order to execute additional code + * paths, the two deviates are repeatedly set equal and the test repeated (with + * now a longer fraction and with the test now triggering the sampling of an + * additional chunk. */ +static void +test_compare (long nbtests, int verbose) +{ + mpfr_random_deviate_t u, v; + int k, i, t1, t2; + long count; + + mpfr_random_deviate_init (u); + mpfr_random_deviate_init (v); + + count = 0; + for (k = 0; k < nbtests; ++k) + { + mpfr_random_deviate_reset (u); + mpfr_random_deviate_reset (v); + for (i = 0; i < 10; ++i) + { + t1 = mpfr_random_deviate_less (u, v, RANDS); + t2 = mpfr_random_deviate_less (u, v, RANDS); + if (t1 != t2) + { + printf ("Error: mpfr_random_deviate_less() inconsistent.\n"); + exit (1); + } + if (t1) + ++count; + /* Force the test to sample an additional chunk */ + mpfr_random_deviate_set (u, v); + } + t1 = mpfr_random_deviate_less (u, u, RANDS); + if (t1) + { + printf ("Error: mpfr_random_deviate_less() gives u < u.\n"); + exit (1); + } + t1 = mpfr_random_deviate_tstbit (u, 0, RANDS); + if (t1) + { + printf ("Error: mpfr_random_deviate_tstbit() says 1 bit is on.\n"); + exit (1); + } + } + mpfr_random_deviate_clear (v); + mpfr_random_deviate_clear (u); + if (verbose) + printf ("Fraction of true random_deviate_less = %.4f" + " (should be about 0.5)\n", + count / (double) (10 * nbtests)); +} + +/* A random_deviate should consistently return the same value at a given + * precision, even if intervening operations have caused the fraction to be + * extended. */ +static void +test_value_consistency (long nbtests) +{ + mpfr_t a1, a2, a3, b1, b2, b3; + mpfr_random_deviate_t u; + int inexa1, inexa2, inexa3, inexb1, inexb2, inexb3; + mpfr_prec_t prec1, prec2, prec3; + mpfr_rnd_t rnd; + long i; + unsigned n; + int neg; + + /* Pick prec{1,2,3} random in [2,101] */ + prec1 = 2 + gmp_urandomm_ui (RANDS, 100); + prec2 = 2 + gmp_urandomm_ui (RANDS, 100); + prec3 = 2 + gmp_urandomm_ui (RANDS, 100); + + rnd = MPFR_RNDN; + mpfr_random_deviate_init (u); + mpfr_init2 (a1, prec1); + mpfr_init2 (b1, prec1); + mpfr_init2 (a2, prec2); + mpfr_init2 (b2, prec2); + mpfr_init2 (a3, prec3); + mpfr_init2 (b3, prec3); + + for (i = 0; i < nbtests; ++i) + { + mpfr_random_deviate_reset (u); + n = gmp_urandomb_ui (RANDS, 4); + neg = gmp_urandomb_ui (RANDS, 1); + inexa1 = mpfr_random_deviate_value (neg, n, u, a1, RANDS, rnd); + inexa2 = mpfr_random_deviate_value (neg, n, u, a2, RANDS, rnd); + inexa3 = mpfr_random_deviate_value (neg, n, u, a3, RANDS, rnd); + inexb1 = mpfr_random_deviate_value (neg, n, u, b1, RANDS, rnd); + inexb2 = mpfr_random_deviate_value (neg, n, u, b2, RANDS, rnd); + inexb3 = mpfr_random_deviate_value (neg, n, u, b3, RANDS, rnd); + /* Of course a1, a2, and a3 should all be nearly equal. But more + * crucially (and easier to test), we need a1 == b1, etc. (This is not a + * trivial issue because the detailed mpfr operations giving b1 will be + * different than for a1, if, e.g., prec2 > prec1. */ + if ( !( inexa1 == inexb1 && mpfr_equal_p (a1, b1) && + inexa2 == inexb2 && mpfr_equal_p (a2, b2) && + inexa3 == inexb3 && mpfr_equal_p (a3, b3) ) ) + { + printf ("Error: random_deviate values are inconsistent.\n"); + exit (1); + } + } + mpfr_random_deviate_clear (u); + mpfr_clears (a1, a2, a3, b1, b2, b3, (mpfr_ptr) 0); +} + +/* Check that the values from random_deviate with different rounding modes are + * consistent. */ +static void +test_value_round (long nbtests, mpfr_prec_t prec) +{ + mpfr_t xn, xd, xu, xz, xa, t; + mpfr_random_deviate_t u; + int inexn, inexd, inexu, inexz, inexa, inext; + long i; + unsigned n; + int neg, s; + + mpfr_random_deviate_init (u); + mpfr_inits2 (prec, xn, xd, xu, xz, xa, t, (mpfr_ptr) 0); + + for (i = 0; i < nbtests; ++i) + { + mpfr_random_deviate_reset (u); + n = gmp_urandomb_ui (RANDS, 4); + neg = gmp_urandomb_ui (RANDS, 1); + s = neg ? -1 : 1; + inexn = mpfr_random_deviate_value (neg, n, u, xn, RANDS, MPFR_RNDN); + inexd = mpfr_random_deviate_value (neg, n, u, xd, RANDS, MPFR_RNDD); + inexu = mpfr_random_deviate_value (neg, n, u, xu, RANDS, MPFR_RNDU); + inexz = mpfr_random_deviate_value (neg, n, u, xz, RANDS, MPFR_RNDZ); + inexa = mpfr_random_deviate_value (neg, n, u, xa, RANDS, MPFR_RNDA); + inext = mpfr_set (t, xn, MPFR_RNDN); + /* Check inexact values */ + if ( !( inexn != 0 && inext == 0 && + inexd < 0 && inexu > 0 && + inexz * s < 0 && inexa * s > 0 ) ) + { + printf ("n %d t %d d %d u %d z %d a %d s %d\n", + inexn, inext, inexd, inexu, inexz, inexa, s); + printf ("Error: random_deviate has wrong values for inexact.\n"); + exit (1); + } + if (inexn < 0) + mpfr_nextabove (t); + else + mpfr_nextbelow (t); + /* Check that x{d,u,z,a} == xn is the inexact flags match, else + * x{d,u,z,a} == t */ + if ( !( mpfr_equal_p(xd, SAME_SIGN(inexn, inexd) ? xn : t) && + mpfr_equal_p(xu, SAME_SIGN(inexn, inexu) ? xn : t) && + mpfr_equal_p(xz, SAME_SIGN(inexn, inexz) ? xn : t) && + mpfr_equal_p(xa, SAME_SIGN(inexn, inexa) ? xn : t) ) ) + { + printf ("n %d t %d d %d u %d z %d a %d s %d\n", + inexn, inext, inexd, inexu, inexz, inexa, s); + printf ("n %.4f t %.4f d %.4f u %.4f z %.4f a %.4f\n", + mpfr_get_d (xn, MPFR_RNDN), mpfr_get_d (t, MPFR_RNDN), + mpfr_get_d (xd, MPFR_RNDN), mpfr_get_d (xu, MPFR_RNDN), + mpfr_get_d (xz, MPFR_RNDN), mpfr_get_d (xa, MPFR_RNDN)); + printf ("Error: random_deviate rounds inconsistently.\n"); + exit (1); + } + } + mpfr_random_deviate_clear (u); + mpfr_clears (xn, xd, xu, xz, xa, t, (mpfr_ptr) 0); +} + +/* Test mpfr_random_deviate_value. Check for the leading bit in the number in + * various positions. */ +static void +test_value (long nbtests, mpfr_prec_t prec, mpfr_rnd_t rnd, + int verbose) +{ + mpfr_t x; + mpfr_random_deviate_t u; + int inexact, exact; + int i, k, b, neg; + unsigned long e, f, n; + long count, sum; + + mpfr_random_deviate_init (u); + mpfr_init2 (x, prec); + + count = 0; sum = 0; + exact = 0; + + for (k = 0; k < nbtests; ++k) + { + for (i = 0; i < 32; ++i) + { + b = gmp_urandomm_ui (RANDS, 32) + 1; /* bits to sample in integer */ + n = gmp_urandomb_ui (RANDS, b); + neg = gmp_urandomb_ui (RANDS, 1); + inexact = mpfr_random_deviate_value (neg, n, u, x, RANDS, rnd); + if (!inexact) + exact = 1; + if (inexact > 0) + ++count; + ++sum; + } + for (i = 0; i < 32; ++i) + { + b = gmp_urandomm_ui (RANDS, W) + 1; /* bits to sample in fraction */ + f = gmp_urandomb_ui (RANDS, b); + e = W * (gmp_urandomm_ui (RANDS, 3) + 1); + mpfr_random_deviate_ldexp (u, f, e); + neg = gmp_urandomb_ui (RANDS, 1); + inexact = mpfr_random_deviate_value (neg, 0, u, x, RANDS, rnd); + if (!inexact) + exact = 1; + if (inexact > 0) + ++count; + ++sum; + } + if (exact) + { + printf ("Error: random_deviate() returns a zero ternary value.\n"); + exit (1); + } + mpfr_random_deviate_reset (u); + } + mpfr_random_deviate_clear (u); + mpfr_clear (x); + + if (verbose) + { + printf ("Fraction of inexact > 0 = %.4f", count / (double) (sum)); + if (rnd == MPFR_RNDD) + printf (" should be exactly 0\n"); + else if (rnd == MPFR_RNDU) + printf (" should be exactly 1\n"); + else + printf (" should be about 0.5\n"); + } +} + +int +main (int argc, char *argv[]) +{ + long nbtests; + int verbose; + long a; + + tests_start_mpfr (); + + verbose = 0; + nbtests = 10; + if (argc > 1) + { + a = atol (argv[1]); + verbose = 1; + if (a != 0) + nbtests = a; + } + + test_compare (nbtests, verbose); + test_value_consistency (nbtests); + test_value_round (nbtests, 2); + test_value_round (nbtests, 64); + test_value (nbtests, 2, MPFR_RNDD, verbose); + test_value (nbtests, 5, MPFR_RNDU, verbose); + test_value (nbtests, 24, MPFR_RNDN, verbose); + test_value (nbtests, 53, MPFR_RNDZ, verbose); + test_value (nbtests, 64, MPFR_RNDA, verbose); + + tests_end_mpfr (); + return 0; +} diff -Nru mpfr4-3.1.4/tests/trec_sqrt.c mpfr4-4.0.2/tests/trec_sqrt.c --- mpfr4-3.1.4/tests/trec_sqrt.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/trec_sqrt.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_rec_sqrt. -Copyright 2008-2016 Free Software Foundation, Inc. +Copyright 2008-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,16 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) - #define TEST_FUNCTION mpfr_rec_sqrt #define TEST_RANDOM_POS 8 /* 8/512 = 1/64 of the tested numbers are negative */ #include "tgeneric.c" @@ -188,7 +183,7 @@ special (); bad_case1 (); bad_case2 (); - test_generic (2, 300, 15); + test_generic (MPFR_PREC_MIN, 300, 15); data_check ("data/rec_sqrt", mpfr_rec_sqrt, "mpfr_rec_sqrt"); bad_cases (mpfr_rec_sqrt, pm2, "mpfr_rec_sqrt", 8, -256, 255, 4, 128, @@ -197,14 +192,3 @@ tests_end_mpfr (); return 0; } - -#else /* MPFR_VERSION */ - -int -main (void) -{ - printf ("Warning! Test disabled for this MPFR version.\n"); - return 0; -} - -#endif /* MPFR_VERSION */ diff -Nru mpfr4-3.1.4/tests/tremquo.c mpfr4-4.0.2/tests/tremquo.c --- mpfr4-3.1.4/tests/tremquo.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tremquo.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ -/* tremquo -- test file for mpfr_remquo and mpfr_remainder +/* tremquo -- test file for mpfr_remquo, mpfr_remainder and mpfr_fmodquo. -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void @@ -61,6 +58,8 @@ long q[1]; int inex; + tests_start_mpfr (); + if (argc == 3) /* usage: tremquo x y (rnd=MPFR_RNDN implicit) */ { mpfr_init2 (x, GMP_NUMB_BITS); @@ -78,8 +77,6 @@ return 0; } - tests_start_mpfr (); - bug20090227 (); mpfr_init (x); @@ -91,32 +88,45 @@ mpfr_set_ui (y, 1, MPFR_RNDN); mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (r)); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN(mpfr_nan_p (r)); mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_set_nan (y); mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (r)); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN(mpfr_nan_p (r)); mpfr_set_inf (x, 1); /* +Inf */ mpfr_set_ui (y, 1, MPFR_RNDN); mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (r)); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_nan_p (r)); mpfr_set_inf (x, 1); /* +Inf */ mpfr_set_ui (y, 0, MPFR_RNDN); mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (r)); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_nan_p (r)); mpfr_set_inf (x, 1); /* +Inf */ mpfr_set_inf (y, 1); mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (r)); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_nan_p (r)); mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_set_inf (y, 1); mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_POS (r)); MPFR_ASSERTN (q[0] == (long) 0); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_POS (r)); + MPFR_ASSERTN (q[0] == (long) 0); mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_neg (x, x, MPFR_RNDN); /* -0 */ @@ -124,23 +134,34 @@ mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_NEG (r)); MPFR_ASSERTN (q[0] == (long) 0); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_NEG (r)); + MPFR_ASSERTN (q[0] == (long) 0); mpfr_set_ui (x, 17, MPFR_RNDN); mpfr_set_inf (y, 1); mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp (r, x) == 0); MPFR_ASSERTN (q[0] == (long) 0); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp (r, x) == 0); + MPFR_ASSERTN (q[0] == (long) 0); mpfr_set_ui (x, 17, MPFR_RNDN); mpfr_set_ui (y, 0, MPFR_RNDN); mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (r)); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_nan_p (r)); mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_set_ui (y, 17, MPFR_RNDN); mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_POS (r)); MPFR_ASSERTN (q[0] == (long) 0); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_POS (r)); + MPFR_ASSERTN (q[0] == (long) 0); mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_neg (x, x, MPFR_RNDN); @@ -148,32 +169,88 @@ mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_NEG (r)); MPFR_ASSERTN (q[0] == (long) 0); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_NEG (r)); + MPFR_ASSERTN (q[0] == (long) 0); mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); - /* check four possible sign combinations */ + /* check four possible sign combinations for 42/17 */ mpfr_set_ui (x, 42, MPFR_RNDN); mpfr_set_ui (y, 17, MPFR_RNDN); mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (r, 8) == 0); MPFR_ASSERTN (q[0] == (long) 2); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_ui (r, 8) == 0); + MPFR_ASSERTN (q[0] == (long) 2); + mpfr_set_si (x, -42, MPFR_RNDN); mpfr_set_ui (y, 17, MPFR_RNDN); mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_si (r, -8) == 0); MPFR_ASSERTN (q[0] == (long) -2); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_si (r, -8) == 0); + MPFR_ASSERTN (q[0] == (long) -2); + mpfr_set_si (x, -42, MPFR_RNDN); mpfr_set_si (y, -17, MPFR_RNDN); mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_si (r, -8) == 0); MPFR_ASSERTN (q[0] == (long) 2); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_si (r, -8) == 0); + MPFR_ASSERTN (q[0] == (long) 2); + mpfr_set_ui (x, 42, MPFR_RNDN); mpfr_set_si (y, -17, MPFR_RNDN); mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui (r, 8) == 0); MPFR_ASSERTN (q[0] == (long) -2); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_ui (r, 8) == 0); + MPFR_ASSERTN (q[0] == (long) -2); + /* same tests for 43/17, rounded to 3 to nearest, and to 2 to zero */ + mpfr_set_ui (x, 43, MPFR_RNDN); + mpfr_set_ui (y, 17, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_si (r, -8) == 0); + MPFR_ASSERTN (q[0] == (long) 3); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_ui (r, 9) == 0); + MPFR_ASSERTN (q[0] == (long) 2); + + mpfr_set_si (x, -43, MPFR_RNDN); + mpfr_set_ui (y, 17, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_si (r, 8) == 0); + MPFR_ASSERTN (q[0] == (long) -3); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_si (r, -9) == 0); + MPFR_ASSERTN (q[0] == (long) -2); + + mpfr_set_si (x, -43, MPFR_RNDN); + mpfr_set_si (y, -17, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_si (r, 8) == 0); + MPFR_ASSERTN (q[0] == (long) 3); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_si (r, -9) == 0); + MPFR_ASSERTN (q[0] == (long) 2); + + mpfr_set_ui (x, 43, MPFR_RNDN); + mpfr_set_si (y, -17, MPFR_RNDN); + mpfr_remquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_si (r, -8) == 0); + MPFR_ASSERTN (q[0] == (long) -3); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_ui (r, 9) == 0); + MPFR_ASSERTN (q[0] == (long) -2); + + /* other tests */ mpfr_set_prec (x, 100); mpfr_set_prec (y, 50); mpfr_set_ui (x, 42, MPFR_RNDN); @@ -182,6 +259,9 @@ mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 1, -94) == 0); MPFR_ASSERTN (q[0] == (long) 2); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 1, -94) == 0); + MPFR_ASSERTN (q[0] == (long) 2); mpfr_set_prec (x, 50); mpfr_set_prec (y, 100); @@ -191,6 +271,9 @@ mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 1, -44) == 0); MPFR_ASSERTN (q[0] == (long) 2); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 1, -44) == 0); + MPFR_ASSERTN (q[0] == (long) 2); mpfr_set_prec (x, 100); mpfr_set_prec (y, 50); @@ -201,6 +284,11 @@ /* r should be 42 - 2*(21 + 2^(-45)) = -2^(-44) */ MPFR_ASSERTN (mpfr_cmp_si_2exp (r, -1, -44) == 0); MPFR_ASSERTN (q[0] == (long) 2); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + /* r should be 42 - (21 + 2^(-45) = 21 - 2^(-45) */ + mpfr_sub_ui (r, r, 21, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_si_2exp (r, -1, -45) == 0); + MPFR_ASSERTN (q[0] == (long) 1); mpfr_set_prec (x, 50); mpfr_set_prec (y, 100); @@ -211,6 +299,11 @@ /* r should be 42 - 2*(21 + 2^(-95)) = -2^(-94) */ MPFR_ASSERTN (mpfr_cmp_si_2exp (r, -1, -94) == 0); MPFR_ASSERTN (q[0] == (long) 2); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + /* r should be 42 - (21 + 2^(-95) = 21 - 2^(-94), which rounded to 53 bits + should give 21 */ + MPFR_ASSERTN (mpfr_cmp_ui (r, 21) == 0); + MPFR_ASSERTN (q[0] == (long) 1); /* exercise large quotient */ mpfr_set_ui_2exp (x, 1, 65, MPFR_RNDN); @@ -219,6 +312,9 @@ mpfr_remquo (r, q, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_si (r, 0) == 0); MPFR_ASSERTN (q[0] % 1073741824L == 0L); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_cmp_si (r, 0) == 0); + MPFR_ASSERTN (q[0] % 1073741824L == 0L); /* another large quotient */ mpfr_set_prec (x, 65); @@ -231,6 +327,10 @@ /* q should be 41803643793084085130, r should be 605/2048 */ MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 605, -11) == 0); MPFR_ASSERTN ((q[0] > 0) && ((q[0] % 1073741824L) == 733836170L)); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + /* q should be 41803643793084085130, r should be 605/2048 */ + MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 605, -11) == 0); + MPFR_ASSERTN ((q[0] > 0) && ((q[0] % 1073741824L) == 733836170L)); /* check cases where quotient is 1.5 +/- eps */ mpfr_set_prec (x, 65); @@ -242,6 +342,11 @@ /* x/y = 1.5, quotient should be 2 (even rule), remainder should be -1 */ MPFR_ASSERTN (mpfr_cmp_si (r, -1) == 0); MPFR_ASSERTN (q[0] == 2L); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + /* x/y = 1.5, quotient should be 1, remainder should be 1 */ + MPFR_ASSERTN (mpfr_cmp_si (r, 1) == 0); + MPFR_ASSERTN (q[0] == 1L); + mpfr_set_ui (x, 3, MPFR_RNDN); mpfr_nextabove (x); /* 3 + 2^(-63) */ mpfr_set_ui (y, 2, MPFR_RNDN); @@ -250,6 +355,14 @@ MPFR_ASSERTN (mpfr_add_ui (r, r, 1, MPFR_RNDN) == 0); MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 1, -63) == 0); MPFR_ASSERTN (q[0] == 2L); + mpfr_set_prec (r, 64); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + /* x/y = 1.5 + 2^(-64), quo should be 1, r should be 1 + 2^(-63) */ + MPFR_ASSERTN (mpfr_sub_ui (r, r, 1, MPFR_RNDN) == 0); + MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 1, -63) == 0); + MPFR_ASSERTN (q[0] == 1L); + + mpfr_set_prec (r, 63); mpfr_set_ui (x, 3, MPFR_RNDN); mpfr_set_ui (y, 2, MPFR_RNDN); mpfr_nextabove (y); /* 2 + 2^(-63) */ @@ -258,28 +371,37 @@ MPFR_ASSERTN (mpfr_sub_ui (r, r, 1, MPFR_RNDN) == 0); MPFR_ASSERTN (mpfr_cmp_si_2exp (r, -1, -63) == 0); MPFR_ASSERTN (q[0] == 1L); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + /* x/y = 1.5 - eps, quo should be 1, r should be 1 - 2^(-63) */ + MPFR_ASSERTN (mpfr_sub_ui (r, r, 1, MPFR_RNDN) == 0); + MPFR_ASSERTN (mpfr_cmp_si_2exp (r, -1, -63) == 0); + MPFR_ASSERTN (q[0] == 1L); /* bug founds by Kaveh Ghazi, 3 May 2007 */ mpfr_set_ui (x, 2, MPFR_RNDN); mpfr_set_ui (y, 3, MPFR_RNDN); + /* quotient rounded to nearest is 1, thus remainder is -1 */ mpfr_remainder (r, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_cmp_si (r, -1) == 0); mpfr_set_si (x, -1, MPFR_RNDN); mpfr_set_ui (y, 1, MPFR_RNDN); mpfr_remainder (r, x, y, MPFR_RNDN); - MPFR_ASSERTN (mpfr_cmp_si (r, 0) == 0 && MPFR_SIGN (r) < 0); + MPFR_ASSERTN (mpfr_cmp_si (r, 0) == 0 && MPFR_IS_NEG (r)); /* check argument reuse */ mpfr_set_si (x, -1, MPFR_RNDN); mpfr_set_ui (y, 1, MPFR_RNDN); mpfr_remainder (x, x, y, MPFR_RNDN); - MPFR_ASSERTN (mpfr_cmp_si (x, 0) == 0 && MPFR_SIGN (x) < 0); + MPFR_ASSERTN (mpfr_cmp_si (x, 0) == 0 && MPFR_IS_NEG (x)); mpfr_set_ui_2exp (x, 1, mpfr_get_emax () - 1, MPFR_RNDN); mpfr_set_ui_2exp (y, 1, mpfr_get_emin (), MPFR_RNDN); mpfr_remquo (r, q, x, y, MPFR_RNDN); - MPFR_ASSERTN (mpfr_zero_p (r) && MPFR_SIGN (r) > 0); + MPFR_ASSERTN (mpfr_zero_p (r) && MPFR_IS_POS (r)); + MPFR_ASSERTN (q[0] == 0); + mpfr_fmodquo (r, q, x, y, MPFR_RNDN); + MPFR_ASSERTN (mpfr_zero_p (r) && MPFR_IS_POS (r)); MPFR_ASSERTN (q[0] == 0); mpfr_set_prec (x, 380); diff -Nru mpfr4-3.1.4/tests/trint.c mpfr4-4.0.2/tests/trint.c --- mpfr4-3.1.4/tests/trint.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/trint.c 2019-01-25 02:00:06.000000000 +0000 @@ -1,7 +1,7 @@ /* Test file for mpfr_rint, mpfr_trunc, mpfr_floor, mpfr_ceil, mpfr_round, mpfr_rint_trunc, mpfr_rint_floor, mpfr_rint_ceil, mpfr_rint_round. -Copyright 2002-2016 Free Software Foundation, Inc. +Copyright 2002-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,11 +18,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include - #include "mpfr-test.h" #if __MPFR_STDC (199901L) @@ -265,36 +263,42 @@ emax = mpfr_get_emax (); mpfr_init2 (x, 16); - for (prec = 2; prec <= 7; prec++) + for (prec = MPFR_PREC_MIN; prec <= 7; prec++) { mpfr_inits2 (prec, y, z, (mpfr_ptr) 0); for (s = 1; s >= -1; s -= 2) for (i = 1; i <= 72; i++) { - int k, t, u, v, f, e; + int k, t, u, v, f, e, b; for (t = i/4, k = 0; t >= 1 << prec; t >>= 1, k++) ; + b = !(t & 1); t <<= k; for (u = (i+3)/4, k = 0; u >= 1 << prec; u = (u+1)/2, k++) ; u <<= k; v = i < (t+u) << 1 ? t : u; + if (b) + b = i == (t+u) << 1; f = t == u ? 0 : i % 4 == 0 ? 1 : 2; mpfr_set_si_2exp (x, s * i, -2, MPFR_RNDN); e = mpfr_get_exp (x); - RND_LOOP(r) + RND_LOOP_NO_RNDF (r) { BASIC_TEST (trunc, s * (i/4)); BASIC_TEST (floor, s > 0 ? i/4 : - ((i+3)/4)); BASIC_TEST (ceil, s > 0 ? (i+3)/4 : - (i/4)); BASIC_TEST (round, s * ((i+2)/4)); + BASIC_TEST (roundeven, s * (i % 8 == 2 ? i/4 : (i+2)/4)); } BASIC_TEST2 (trunc, s * t, - s * f); BASIC_TEST2 (floor, s > 0 ? t : - u, - f); BASIC_TEST2 (ceil, s > 0 ? u : - t, f); BASIC_TEST2 (round, s * v, v == t ? - s * f : s * f); + BASIC_TEST2 (roundeven, s * (b ? t : v), + b || v == t ? - s * f : s * f); } mpfr_clears (y, z, (mpfr_ptr) 0); } @@ -333,12 +337,12 @@ mpfr_clear (yy); } -#define TEST_FCT(F) test_fct (&F, &mpfr_##F, #F, r) +#define TEST_FCT(F) test_fct (&F, &mpfr_##F, #F, (mpfr_rnd_t) r) static void test_against_libc (void) { - mpfr_rnd_t r = MPFR_RNDN; + int r = MPFR_RNDN; (void) r; /* avoid a warning by using r */ #if HAVE_ROUND @@ -355,8 +359,8 @@ #endif #if HAVE_NEARBYINT for (r = 0; r < MPFR_RND_MAX ; r++) - if (mpfr_set_machine_rnd_mode (r) == 0) - test_fct (&nearbyint, &mpfr_rint, "rint", r); + if (mpfr_set_machine_rnd_mode ((mpfr_rnd_t) r) == 0) + test_fct (&nearbyint, &mpfr_rint, "rint", (mpfr_rnd_t) r); #endif } @@ -369,10 +373,9 @@ printf ("Error: %s\ns = %u, p = %u, r = %s, trint = %d, inexact = %d\nx = ", str, (unsigned int) s, (unsigned int) p, mpfr_print_rnd_mode (r), trint, inexact); - mpfr_print_binary (x); - printf ("\ny = "); - mpfr_print_binary (y); - printf ("\n"); + mpfr_dump (x); + printf ("y = "); + mpfr_dump (y); exit (1); } @@ -465,6 +468,12 @@ #define test_generic test_generic_round #include "tgeneric.c" +#define TEST_FUNCTION mpfr_rint_roundeven +#define TEST_RANDOM_EMIN -20 +#define TEST_RANDOM_ALWAYS_SCALE 1 +#define test_generic test_generic_roundeven +#include "tgeneric.c" + int main (int argc, char *argv[]) { @@ -484,85 +493,108 @@ mpfr_init (u); mpfr_init (v); mpz_set_ui (z, 1); - for (s = 2; s < 100; s++) + /* the code below works for 1 <= MPFR_PREC_MIN <= 2 */ + MPFR_ASSERTN(1 <= MPFR_PREC_MIN && MPFR_PREC_MIN <= 2); + for (s = MPFR_PREC_MIN; s < 100; s++) { - /* z has exactly s bits */ - - mpz_mul_2exp (z, z, 1); - if (randlimb () % 2) - mpz_add_ui (z, z, 1); + if (s > 1) + { + mpz_mul_2exp (z, z, 1); + if (randlimb () % 2) + mpz_add_ui (z, z, 1); + } + /* now 2^(s-1) <= z < 2^s */ mpfr_set_prec (x, s); mpfr_set_prec (t, s); mpfr_set_prec (u, s); if (mpfr_set_z (x, z, MPFR_RNDN)) { - printf ("Error: mpfr_set_z should be exact (s = %u)\n", - (unsigned int) s); +#ifndef MPFR_USE_MINI_GMP + gmp_printf ("Error: mpfr_set_z should be exact (z = %Zd, s = %u)\n", + z, (unsigned int) s); +#else /* mini-gmp has no gmp_printf (at least in gmp-6.1.2) */ + printf ("mpfr_set_z should be exact\n"); +#endif exit (1); } if (randlimb () % 2) mpfr_neg (x, x, MPFR_RNDN); if (randlimb () % 2) mpfr_div_2ui (x, x, randlimb () % s, MPFR_RNDN); - for (p = 2; p < 100; p++) + for (p = MPFR_PREC_MIN; p < 100; p++) { int trint; mpfr_set_prec (y, p); mpfr_set_prec (v, p); for (r = 0; r < MPFR_RND_MAX ; r++) - for (trint = 0; trint < 3; trint++) + for (trint = 0; trint < 4; trint++) { if (trint == 2) inexact = mpfr_rint (y, x, (mpfr_rnd_t) r); + else if (trint == 3) + { + if (r != MPFR_RNDN) + continue; + inexact = mpfr_round (y, x); + } else if (r == MPFR_RNDN) - inexact = mpfr_round (y, x); + inexact = (trint ? mpfr_roundeven (y, x) : + mpfr_rint_roundeven (y, x, MPFR_RNDZ)); else if (r == MPFR_RNDZ) inexact = (trint ? mpfr_trunc (y, x) : mpfr_rint_trunc (y, x, MPFR_RNDZ)); else if (r == MPFR_RNDU) inexact = (trint ? mpfr_ceil (y, x) : mpfr_rint_ceil (y, x, MPFR_RNDU)); - else /* r = MPFR_RNDD */ + else if (r == MPFR_RNDD) inexact = (trint ? mpfr_floor (y, x) : mpfr_rint_floor (y, x, MPFR_RNDD)); + else + { + MPFR_ASSERTN (r == MPFR_RNDA || r == MPFR_RNDF); + continue; + } if (mpfr_sub (t, y, x, MPFR_RNDN)) - err ("subtraction 1 should be exact", - s, x, y, p, (mpfr_rnd_t) r, trint, inexact); + err ("subtraction 1 should be exact", s, x, y, p, + (mpfr_rnd_t) r, trint, inexact); sign_t = mpfr_cmp_ui (t, 0); if (trint != 0 && (((inexact == 0) && (sign_t != 0)) || ((inexact < 0) && (sign_t >= 0)) || ((inexact > 0) && (sign_t <= 0)))) - err ("wrong inexact flag", s, x, y, p, (mpfr_rnd_t) r, trint, inexact); + err ("wrong inexact flag", s, x, y, p, + (mpfr_rnd_t) r, trint, inexact); if (inexact == 0) continue; /* end of the test for exact results */ - if (((r == MPFR_RNDD || (r == MPFR_RNDZ && MPFR_SIGN (x) > 0)) + if (((r == MPFR_RNDD || (r == MPFR_RNDZ && MPFR_IS_POS (x))) && inexact > 0) || - ((r == MPFR_RNDU || (r == MPFR_RNDZ && MPFR_SIGN (x) < 0)) + ((r == MPFR_RNDU || (r == MPFR_RNDZ && MPFR_IS_NEG (x))) && inexact < 0)) - err ("wrong rounding direction", - s, x, y, p, (mpfr_rnd_t) r, trint, inexact); + err ("wrong rounding direction", s, x, y, p, + (mpfr_rnd_t) r, trint, inexact); if (inexact < 0) { mpfr_add_ui (v, y, 1, MPFR_RNDU); if (mpfr_cmp (v, x) <= 0) - err ("representable integer between x and its " - "rounded value", s, x, y, p, (mpfr_rnd_t) r, trint, inexact); + err ("representable integer between x and " + "its rounded value", s, x, y, p, + (mpfr_rnd_t) r, trint, inexact); } else { mpfr_sub_ui (v, y, 1, MPFR_RNDD); if (mpfr_cmp (v, x) >= 0) - err ("representable integer between x and its " - "rounded value", s, x, y, p, (mpfr_rnd_t) r, trint, inexact); + err ("representable integer between x and " + "its rounded value", s, x, y, p, + (mpfr_rnd_t) r, trint, inexact); } - if (r == MPFR_RNDN) + if (r == MPFR_RNDN && trint != 0) { int cmp; if (mpfr_sub (u, v, x, MPFR_RNDN)) - err ("subtraction 2 should be exact", - s, x, y, p, (mpfr_rnd_t) r, trint, inexact); + err ("subtraction 2 should be exact", s, x, y, p, + (mpfr_rnd_t) r, trint, inexact); cmp = mpfr_cmp_abs (t, u); if (cmp > 0) err ("faithful rounding, but not the nearest integer", @@ -577,28 +609,35 @@ mode: round to an even integer or significand. */ mpfr_div_2ui (y, y, 1, MPFR_RNDZ); if (!mpfr_integer_p (y)) - err ("halfway case for mpfr_rint, result isn't an" - " even integer", s, x, y, p, (mpfr_rnd_t) r, trint, inexact); - /* If floor(x) and ceil(x) aren't both representable - integers, the significand must be even. */ - mpfr_sub (v, v, y, MPFR_RNDN); - mpfr_abs (v, v, MPFR_RNDN); - if (mpfr_cmp_ui (v, 1) != 0) + err ("halfway case for mpfr_rint, result isn't " + "an even integer", s, x, y, p, + (mpfr_rnd_t) r, trint, inexact); + if (p > 1) { - mpfr_div_2si (y, y, MPFR_EXP (y) - MPFR_PREC (y) - + 1, MPFR_RNDN); - if (!mpfr_integer_p (y)) - err ("halfway case for mpfr_rint, significand isn't" - " even", s, x, y, p, (mpfr_rnd_t) r, trint, inexact); + /* For p > 1, if floor(x) and ceil(x) aren't + both representable integers, the significand + must be even. */ + mpfr_sub (v, v, y, MPFR_RNDN); + mpfr_abs (v, v, MPFR_RNDN); + if (mpfr_cmp_ui (v, 1) != 0) + { + mpfr_div_2si (y, y, MPFR_EXP (y) - + MPFR_PREC (y) + 1, MPFR_RNDN); + if (!mpfr_integer_p (y)) + err ("halfway case for mpfr_rint, " + "significand isn't even", s, x, y, p, + (mpfr_rnd_t) r, trint, inexact); + } } } - else + else if (trint == 3) { /* halfway case for mpfr_round: x must have been rounded away from zero. */ - if ((MPFR_SIGN (x) > 0 && inexact < 0) || - (MPFR_SIGN (x) < 0 && inexact > 0)) - err ("halfway case for mpfr_round, bad rounding" - " direction", s, x, y, p, (mpfr_rnd_t) r, trint, inexact); + if ((MPFR_IS_POS (x) && inexact < 0) || + (MPFR_IS_NEG (x) && inexact > 0)) + err ("halfway case for mpfr_round, " + "bad rounding direction", s, x, y, p, + (mpfr_rnd_t) r, trint, inexact); } } } @@ -615,10 +654,11 @@ basic_tests (); coverage_03032011 (); - test_generic_trunc (2, 300, 20); - test_generic_floor (2, 300, 20); - test_generic_ceil (2, 300, 20); - test_generic_round (2, 300, 20); + test_generic_trunc (MPFR_PREC_MIN, 300, 20); + test_generic_floor (MPFR_PREC_MIN, 300, 20); + test_generic_ceil (MPFR_PREC_MIN, 300, 20); + test_generic_round (MPFR_PREC_MIN, 300, 20); + test_generic_roundeven (MPFR_PREC_MIN, 300, 20); #if __MPFR_STDC (199901L) if (argc > 1 && strcmp (argv[1], "-s") == 0) diff -Nru mpfr4-3.1.4/tests/trndna.c mpfr4-4.0.2/tests/trndna.c --- mpfr4-3.1.4/tests/trndna.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/trndna.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,166 @@ +/* Test file for mpfr_round_nearest_away. + +Copyright 2012-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-test.h" + +static void +test_special (void) +{ + mpfr_t x, y; + int inex; + + mpfr_init2 (x, MPFR_PREC_MIN); + mpfr_init2 (y, MPFR_PREC_MIN); + + mpfr_set_nan (x); + inex = mpfr_round_nearest_away (mpfr_sin, y, x); + if (inex != 0) + { + printf ("Wrong ternary value for sin(NaN)\n"); + exit (1); + } + if (mpfr_nan_p (y) == 0) + { + printf ("Wrong output for sin(NaN)\n"); + exit (1); + } + + mpfr_set_inf (x, 1); + inex = mpfr_round_nearest_away (mpfr_exp, y, x); + if (inex != 0) + { + printf ("Wrong ternary value for exp(+Inf)\n"); + printf ("expected 0, got %d\n", inex); + exit (1); + } + if (mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0) + { + printf ("Wrong output for exp(+Inf)\n"); + exit (1); + } + + mpfr_set_inf (x, -1); + inex = mpfr_round_nearest_away (mpfr_cbrt, y, x); + if (inex != 0) + { + printf ("Wrong ternary value for cbrt(-Inf)\n"); + exit (1); + } + if (mpfr_inf_p (y) == 0 || mpfr_sgn (y) >= 0) + { + printf ("Wrong output for cbrt(-Inf)\n"); + exit (1); + } + + mpfr_clear (x); + mpfr_clear (y); +} + +static void +test_nonspecial (void) +{ + mpfr_t x, y; + int inex; + + mpfr_init2 (x, 10); + mpfr_init2 (y, 10); + + /* case where the computation on n+1 bits ends with a '0' */ + mpfr_set_ui (x, 2, MPFR_RNDN); + inex = mpfr_round_nearest_away (mpfr_sin, y, x); + if (inex >= 0) + { + printf ("Wrong ternary value for sin(2)\n"); + exit (1); + } + if (mpfr_cmp_ui_2exp (y, 931, -10) != 0) + { + printf ("Wrong output for sin(2)\n"); + exit (1); + } + + /* case where the computation on n+1 bits ends with a '1' and is exact */ + mpfr_set_ui (x, 37, MPFR_RNDN); + inex = mpfr_round_nearest_away (mpfr_sqr, y, x); + if (inex <= 0) + { + printf ("Wrong ternary value for sqr(37)\n"); + exit (1); + } + if (mpfr_cmp_ui (y, 1370) != 0) + { + printf ("Wrong output for sqr(37)\n"); + exit (1); + } + + /* case where the computation on n+1 bits ends with a '1' but is inexact */ + mpfr_set_ui (x, 91, MPFR_RNDN); + inex = mpfr_round_nearest_away (mpfr_sqr, y, x); + if (inex <= 0) + { + printf ("Wrong ternary value for sqr(91)\n"); + exit (1); + } + if (mpfr_cmp_ui (y, 8288) != 0) + { + printf ("Wrong output for sqr(91)\n"); + exit (1); + } + + mpfr_set_ui (x, 131, MPFR_RNDN); + inex = mpfr_round_nearest_away (mpfr_sqr, y, x); + if (inex >= 0) + { + printf ("Wrong ternary value for sqr(131)\n"); + exit (1); + } + if (mpfr_cmp_ui (y, 17152) != 0) + { + printf ("Wrong output for sqr(131)\n"); + exit (1); + } + + mpfr_clear (x); + mpfr_clear (y); +} + +int +main (int argc, char *argv[]) +{ + mpfr_exp_t emin; + + tests_start_mpfr (); + + /* mpfr_round_nearest_away requires emin is not the smallest possible */ + if ((emin = mpfr_get_emin ()) == mpfr_get_emin_min ()) + mpfr_set_emin (mpfr_get_emin_min () + 1); + + test_special (); + + test_nonspecial (); + + mpfr_set_emin (emin); + + tests_end_mpfr (); + return 0; +} + diff -Nru mpfr4-3.1.4/tests/troot.c mpfr4-4.0.2/tests/troot.c --- mpfr4-3.1.4/tests/troot.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/troot.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ -/* Test file for mpfr_root. +/* Test file for mpfr_root (also used for mpfr_rootn_ui). -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,17 +17,31 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include +#ifdef TF +# define TF_IS_MPFR_ROOT 0 +#else +# define TF_IS_MPFR_ROOT 1 +# define TF mpfr_root +# define _MPFR_NO_DEPRECATED_ROOT +#endif #include "mpfr-test.h" +#include + +/* return the cpu time in seconds */ +static double +cputime (void) +{ + return (double) clock () / (double) CLOCKS_PER_SEC; +} + #define DEFN(N) \ static int root##N (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) \ - { return mpfr_root (y, x, N, rnd); } \ + { return TF (y, x, N, rnd); } \ static int pow##N (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) \ { return mpfr_pow_ui (y, x, N, rnd); } @@ -49,58 +63,96 @@ /* root(NaN) = NaN */ mpfr_set_nan (x); - mpfr_root (y, x, 17, MPFR_RNDN); + i = TF (y, x, 17, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: root(NaN,17) <> NaN\n"); exit (1); } + MPFR_ASSERTN (i == 0); /* root(+Inf) = +Inf */ mpfr_set_inf (x, 1); - mpfr_root (y, x, 42, MPFR_RNDN); + i = TF (y, x, 42, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) { printf ("Error: root(+Inf,42) <> +Inf\n"); exit (1); } + MPFR_ASSERTN (i == 0); /* root(-Inf, 17) = -Inf */ mpfr_set_inf (x, -1); - mpfr_root (y, x, 17, MPFR_RNDN); + i = TF (y, x, 17, MPFR_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0) { printf ("Error: root(-Inf,17) <> -Inf\n"); exit (1); } + MPFR_ASSERTN (i == 0); + /* root(-Inf, 42) = NaN */ mpfr_set_inf (x, -1); - mpfr_root (y, x, 42, MPFR_RNDN); + i = TF (y, x, 42, MPFR_RNDN); if (!mpfr_nan_p (y)) { printf ("Error: root(-Inf,42) <> -Inf\n"); exit (1); } + MPFR_ASSERTN (i == 0); - /* root(+/-0, k) = +/-0 for k > 0 */ - mpfr_set_ui (x, 0, MPFR_RNDN); - mpfr_root (y, x, 17, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) + /* root(+/-0, k) = +/-0, with the sign depending on TF. + * Before calling the function, we set y to NaN with the wrong sign, + * so that if the code of the function forgets to do something, this + * will be detected. + */ + mpfr_set_zero (x, 1); /* x is +0 */ + MPFR_SET_NAN (y); + MPFR_SET_NEG (y); + i = TF (y, x, 17, MPFR_RNDN); + if (MPFR_NOTZERO (y) || MPFR_IS_NEG (y)) { printf ("Error: root(+0,17) <> +0\n"); exit (1); } - mpfr_neg (x, x, MPFR_RNDN); - mpfr_root (y, x, 42, MPFR_RNDN); - if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0) + MPFR_ASSERTN (i == 0); + MPFR_SET_NAN (y); + MPFR_SET_NEG (y); + i = TF (y, x, 42, MPFR_RNDN); + if (MPFR_NOTZERO (y) || MPFR_IS_NEG (y)) { - printf ("Error: root(-0,42) <> -0\n"); + printf ("Error: root(+0,42) <> +0\n"); exit (1); } + MPFR_ASSERTN (i == 0); + mpfr_set_zero (x, -1); /* x is -0 */ + MPFR_SET_NAN (y); + MPFR_SET_POS (y); + i = TF (y, x, 17, MPFR_RNDN); + if (MPFR_NOTZERO (y) || MPFR_IS_POS (y)) + { + printf ("Error: root(-0,17) <> -0\n"); + exit (1); + } + MPFR_ASSERTN (i == 0); + MPFR_SET_NAN (y); + if (TF_IS_MPFR_ROOT) + MPFR_SET_POS (y); + else + MPFR_SET_NEG (y); + i = TF (y, x, 42, MPFR_RNDN); + if (MPFR_NOTZERO (y) || + (TF_IS_MPFR_ROOT ? MPFR_IS_POS (y) : MPFR_IS_NEG (y))) + { + printf ("Error: root(-0,42) <> %c0\n", + TF_IS_MPFR_ROOT ? '-' : '+'); + exit (1); + } + MPFR_ASSERTN (i == 0); mpfr_set_prec (x, 53); mpfr_set_str (x, "8.39005285514734966412e-01", 10, MPFR_RNDN); - mpfr_root (x, x, 3, MPFR_RNDN); + TF (x, x, 3, MPFR_RNDN); if (mpfr_cmp_str1 (x, "9.43166207799662426048e-01")) { printf ("Error in root3 (1)\n"); @@ -113,7 +165,7 @@ mpfr_set_prec (x, 32); mpfr_set_prec (y, 32); mpfr_set_str_binary (x, "0.10000100001100101001001001011001"); - mpfr_root (x, x, 3, MPFR_RNDN); + TF (x, x, 3, MPFR_RNDN); mpfr_set_str_binary (y, "0.11001101011000100111000111111001"); if (mpfr_cmp (x, y)) { @@ -124,7 +176,7 @@ mpfr_set_prec (x, 32); mpfr_set_prec (y, 32); mpfr_set_str_binary (x, "-0.1100001110110000010101011001011"); - mpfr_root (x, x, 3, MPFR_RNDD); + TF (x, x, 3, MPFR_RNDD); mpfr_set_str_binary (y, "-0.11101010000100100101000101011001"); if (mpfr_cmp (x, y)) { @@ -135,7 +187,7 @@ mpfr_set_prec (x, 82); mpfr_set_prec (y, 27); mpfr_set_str_binary (x, "0.1010001111011101011011000111001011001101100011110110010011011011011010011001100101e-7"); - mpfr_root (y, x, 3, MPFR_RNDD); + TF (y, x, 3, MPFR_RNDD); mpfr_set_str_binary (x, "0.101011110001110001000100011E-2"); if (mpfr_cmp (x, y)) { @@ -146,7 +198,7 @@ mpfr_set_prec (x, 204); mpfr_set_prec (y, 38); mpfr_set_str_binary (x, "0.101000000001101000000001100111111011111001110110100001111000100110100111001101100111110001110001011011010110010011100101111001111100001010010100111011101100000011011000101100010000000011000101001010001001E-5"); - mpfr_root (y, x, 3, MPFR_RNDD); + TF (y, x, 3, MPFR_RNDD); mpfr_set_str_binary (x, "0.10001001111010011011101000010110110010E-1"); if (mpfr_cmp (x, y)) { @@ -158,11 +210,11 @@ mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); mpfr_set_str_binary (x, "1.0100001101101101001100110001001000000101001101100011E28"); - mpfr_root (y, x, 35, MPFR_RNDN); + TF (y, x, 35, MPFR_RNDN); mpfr_set_str_binary (x, "1.1100000010110101100011101011000010100001101100100011E0"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_root (y, x, 35, MPFR_RNDN) for\n" + printf ("Error in rootn (y, x, 35, MPFR_RNDN) for\n" "x = 1.0100001101101101001100110001001000000101001101100011E28\n" "Expected "); mpfr_dump (x); @@ -172,11 +224,11 @@ } /* Worst cases found on 2006-11-26 */ mpfr_set_str_binary (x, "1.1111010011101110001111010110000101110000110110101100E17"); - mpfr_root (y, x, 36, MPFR_RNDD); + TF (y, x, 36, MPFR_RNDD); mpfr_set_str_binary (x, "1.0110100111010001101001010111001110010100111111000010E0"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_root (y, x, 36, MPFR_RNDD) for\n" + printf ("Error in rootn (y, x, 36, MPFR_RNDD) for\n" "x = 1.1111010011101110001111010110000101110000110110101100E17\n" "Expected "); mpfr_dump (x); @@ -185,11 +237,11 @@ exit (1); } mpfr_set_str_binary (x, "1.1100011101101101100010110001000001110001111110010000E23"); - mpfr_root (y, x, 36, MPFR_RNDU); + TF (y, x, 36, MPFR_RNDU); mpfr_set_str_binary (x, "1.1001010100001110000110111111100011011101110011000100E0"); if (mpfr_cmp (x, y)) { - printf ("Error in mpfr_root (y, x, 36, MPFR_RNDU) for\n" + printf ("Error in rootn (y, x, 36, MPFR_RNDU) for\n" "x = 1.1100011101101101100010110001000001110001111110010000E23\n" "Expected "); mpfr_dump (x); @@ -200,7 +252,7 @@ /* Check for k = 1 */ mpfr_set_ui (x, 17, MPFR_RNDN); - i = mpfr_root (y, x, 1, MPFR_RNDN); + i = TF (y, x, 1, MPFR_RNDN); if (mpfr_cmp_ui (x, 17) || i != 0) { printf ("Error in root for 17^(1/1)\n"); @@ -208,14 +260,14 @@ } mpfr_set_ui (x, 0, MPFR_RNDN); - i = mpfr_root (y, x, 0, MPFR_RNDN); + i = TF (y, x, 0, MPFR_RNDN); if (!MPFR_IS_NAN (y) || i != 0) { printf ("Error in root for (+0)^(1/0)\n"); exit (1); } mpfr_neg (x, x, MPFR_RNDN); - i = mpfr_root (y, x, 0, MPFR_RNDN); + i = TF (y, x, 0, MPFR_RNDN); if (!MPFR_IS_NAN (y) || i != 0) { printf ("Error in root for (-0)^(1/0)\n"); @@ -223,7 +275,7 @@ } mpfr_set_ui (x, 1, MPFR_RNDN); - i = mpfr_root (y, x, 0, MPFR_RNDN); + i = TF (y, x, 0, MPFR_RNDN); if (!MPFR_IS_NAN (y) || i != 0) { printf ("Error in root for 1^(1/0)\n"); @@ -232,7 +284,7 @@ /* Check for k==2 */ mpfr_set_si (x, -17, MPFR_RNDD); - i = mpfr_root (y, x, 2, MPFR_RNDN); + i = TF (y, x, 2, MPFR_RNDN); if (!MPFR_IS_NAN (y) || i != 0) { printf ("Error in root for (-17)^(1/2)\n"); @@ -259,7 +311,7 @@ mpfr_set_ui (x, 10, MPFR_RNDN); if (sizeof (unsigned long) * CHAR_BIT == 64) { - mpfr_root (x, x, ULONG_MAX, MPFR_RNDN); + TF (x, x, ULONG_MAX, MPFR_RNDN); mpfr_set_ui_2exp (y, 1, -63, MPFR_RNDN); mpfr_add_ui (y, y, 1, MPFR_RNDN); if (! mpfr_equal_p (x, y)) @@ -274,7 +326,7 @@ } mpfr_set_ui (x, 10, MPFR_RNDN); - mpfr_root (x, x, 1234567890, MPFR_RNDN); + TF (x, x, 1234567890, MPFR_RNDN); mpfr_set_str_binary (y, "1.00000000000000000000000000001000000000101011000101000110010001"); if (! mpfr_equal_p (x, y)) @@ -290,7 +342,7 @@ mpfr_clears (x, y, (mpfr_ptr) 0); } -#define TEST_FUNCTION mpfr_root +#define TEST_FUNCTION TF #define INTEGER_TYPE unsigned long #define INT_RAND_FUNCTION() \ (INTEGER_TYPE) (randlimb () & 1 ? randlimb () : randlimb () % 3 + 2) @@ -316,7 +368,7 @@ mpfr_init2 (y, mpz_sizeinbase (z, 2)); for (neg = 0; neg <= 1; neg++) { - inex = mpfr_root (y, x, k, MPFR_RNDN); + inex = TF (y, x, k, MPFR_RNDN); if (inex != 0) { printf ("Error in exact_powers, b=%ld, k=%ld\n", b, k); @@ -370,17 +422,17 @@ for (i = 0; i < 10; i++) { mpfr_rnd_t rnd; - unsigned int flags1, flags2; + mpfr_flags_t flags1, flags2; int inex1, inex2; tests_default_random (x, 0, __gmpfr_emin, __gmpfr_emax, 1); - rnd = RND_RAND (); + rnd = RND_RAND_NO_RNDF (); mpfr_set_ui_2exp (y1, 1, -h, MPFR_RNDN); mpfr_clear_flags (); inex1 = mpfr_pow (y1, x, y1, rnd); flags1 = __gmpfr_flags; mpfr_clear_flags (); - inex2 = mpfr_root (y2, x, k, rnd); + inex2 = TF (y2, x, k, rnd); flags2 = __gmpfr_flags; if (!(mpfr_equal_p (y1, y2) && SAME_SIGN (inex1, inex2) && flags1 == flags2)) @@ -405,16 +457,77 @@ mpfr_clears (x, y1, y2, (mpfr_ptr) 0); } +static void +bug20171214 (void) +{ + mpfr_t x, y; + int inex; + + mpfr_init2 (x, 805); + mpfr_init2 (y, 837); + mpfr_set_ui (x, 1, MPFR_RNDN); + inex = TF (y, x, 120, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + MPFR_ASSERTN (mpfr_cmp_ui (y, 1) == 0); + mpfr_set_si (x, -1, MPFR_RNDN); + inex = TF (y, x, 121, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + MPFR_ASSERTN (mpfr_cmp_si (y, -1) == 0); + mpfr_clear (x); + mpfr_clear (y); +} + int -main (void) +main (int argc, char *argv[]) { mpfr_t x; int r; mpfr_prec_t p; unsigned long k; + if (argc == 3) /* troot prec k */ + { + double st1, st2; + unsigned long k; + int l; + mpfr_t y; + p = strtoul (argv[1], NULL, 10); + k = strtoul (argv[2], NULL, 10); + mpfr_init2 (x, p); + mpfr_init2 (y, p); + mpfr_const_pi (y, MPFR_RNDN); + TF (x, y, k, MPFR_RNDN); /* to warm up cache */ + st1 = cputime (); + for (l = 0; cputime () - st1 < 1.0; l++) + TF (x, y, k, MPFR_RNDN); + st1 = (cputime () - st1) / l; + printf ("%-15s took %.2es\n", MAKE_STR(TF), st1); + + /* compare with x^(1/k) = exp(1/k*log(x)) */ + /* first warm up cache */ + mpfr_swap (x, y); + mpfr_log (y, x, MPFR_RNDN); + mpfr_div_ui (y, y, k, MPFR_RNDN); + mpfr_exp (y, y, MPFR_RNDN); + + st2 = cputime (); + for (l = 0; cputime () - st2 < 1.0; l++) + { + mpfr_log (y, x, MPFR_RNDN); + mpfr_div_ui (y, y, k, MPFR_RNDN); + mpfr_exp (y, y, MPFR_RNDN); + } + st2 = (cputime () - st2) / l; + printf ("exp(1/k*log(x)) took %.2es\n", st2); + + mpfr_clear (x); + mpfr_clear (y); + return 0; + } + tests_start_mpfr (); + bug20171214 (); exact_powers (3, 1000); special (); bigint (); @@ -422,17 +535,17 @@ mpfr_init (x); - for (p = 2; p < 100; p++) + for (p = MPFR_PREC_MIN; p < 100; p++) { mpfr_set_prec (x, p); for (r = 0; r < MPFR_RND_MAX; r++) { mpfr_set_ui (x, 1, MPFR_RNDN); k = 2 + randlimb () % 4; /* 2 <= k <= 5 */ - mpfr_root (x, x, k, (mpfr_rnd_t) r); + TF (x, x, k, (mpfr_rnd_t) r); if (mpfr_cmp_ui (x, 1)) { - printf ("Error in mpfr_root(%lu) for x=1, rnd=%s\ngot ", + printf ("Error in rootn[%lu] for x=1, rnd=%s\ngot ", k, mpfr_print_rnd_mode ((mpfr_rnd_t) r)); mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); @@ -441,10 +554,10 @@ mpfr_set_si (x, -1, MPFR_RNDN); if (k % 2) { - mpfr_root (x, x, k, (mpfr_rnd_t) r); + TF (x, x, k, (mpfr_rnd_t) r); if (mpfr_cmp_si (x, -1)) { - printf ("Error in mpfr_root(%lu) for x=-1, rnd=%s\ngot ", + printf ("Error in rootn[%lu] for x=-1, rnd=%s\ngot ", k, mpfr_print_rnd_mode ((mpfr_rnd_t) r)); mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf ("\n"); @@ -459,10 +572,10 @@ { mpfr_set_ui (x, 27, MPFR_RNDN); mpfr_mul_2si (x, x, 3*i, MPFR_RNDN); - mpfr_root (x, x, 3, MPFR_RNDN); + TF (x, x, 3, MPFR_RNDN); if (mpfr_cmp_si_2exp (x, 3, i)) { - printf ("Error in mpfr_root(3) for " + printf ("Error in rootn[3] for " "x = 27.0 * 2^(%d), rnd=%s\ngot ", 3*i, mpfr_print_rnd_mode ((mpfr_rnd_t) r)); mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); @@ -475,14 +588,14 @@ } mpfr_clear (x); - test_generic_ui (2, 200, 30); + test_generic_ui (MPFR_PREC_MIN, 200, 30); - bad_cases (root2, pow2, "mpfr_root[2]", 8, -256, 255, 4, 128, 800, 40); - bad_cases (root3, pow3, "mpfr_root[3]", 8, -256, 255, 4, 128, 800, 40); - bad_cases (root4, pow4, "mpfr_root[4]", 8, -256, 255, 4, 128, 800, 40); - bad_cases (root5, pow5, "mpfr_root[5]", 8, -256, 255, 4, 128, 800, 40); - bad_cases (root17, pow17, "mpfr_root[17]", 8, -256, 255, 4, 128, 800, 40); - bad_cases (root120, pow120, "mpfr_root[120]", 8, -256, 255, 4, 128, 800, 40); + bad_cases (root2, pow2, "rootn[2]", 8, -256, 255, 4, 128, 800, 40); + bad_cases (root3, pow3, "rootn[3]", 8, -256, 255, 4, 128, 800, 40); + bad_cases (root4, pow4, "rootn[4]", 8, -256, 255, 4, 128, 800, 40); + bad_cases (root5, pow5, "rootn[5]", 8, -256, 255, 4, 128, 800, 40); + bad_cases (root17, pow17, "rootn[17]", 8, -256, 255, 4, 128, 800, 40); + bad_cases (root120, pow120, "rootn[120]", 8, -256, 255, 4, 128, 800, 40); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/trootn_ui.c mpfr4-4.0.2/tests/trootn_ui.c --- mpfr4-3.1.4/tests/trootn_ui.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/trootn_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,24 @@ +/* Test file for mpfr_rootn_ui. + +Copyright 2017-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define TF mpfr_rootn_ui +#include "troot.c" diff -Nru mpfr4-3.1.4/tests/tround_prec.c mpfr4-4.0.2/tests/tround_prec.c --- mpfr4-3.1.4/tests/tround_prec.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tround_prec.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_prec_round. -Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" int diff -Nru mpfr4-3.1.4/tests/tsec.c mpfr4-4.0.2/tests/tsec.c --- mpfr4-3.1.4/tests/tsec.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsec.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_sec. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_sec @@ -99,7 +96,7 @@ mpfr_nextbelow (y); set_emax (emax); /* 1 is not representable. */ for (i = -1; i <= 1; i++) - RND_LOOP (rnd) + RND_LOOP_NO_RNDF (rnd) { mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN); mpfr_clear_flags (); @@ -123,9 +120,10 @@ if (! mpfr_equal_p (x, y)) { printf ("Error in overflowed_sec0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of 0.11111111E%d.\n", emax); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of 0.11111111E%d.\n", emax); err = 1; } } @@ -138,12 +136,13 @@ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0)) + if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overflowed_sec0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of +Inf.\n"); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of +Inf.\n"); err = 1; } } @@ -164,7 +163,7 @@ check_specials (); - test_generic (2, 200, 10); + test_generic (MPFR_PREC_MIN, 200, 10); overflowed_sec0 (); tests_end_mpfr (); diff -Nru mpfr4-3.1.4/tests/tsech.c mpfr4-4.0.2/tests/tsech.c --- mpfr4-3.1.4/tests/tsech.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsech.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_sech. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_sech @@ -48,7 +45,7 @@ mpfr_set_inf (x, 1); mpfr_sech (y, x, MPFR_RNDN); - if (! (MPFR_IS_ZERO (y) && MPFR_SIGN (y) > 0)) + if (! (MPFR_IS_ZERO (y) && MPFR_IS_POS (y))) { printf ("Error: sech(+Inf) != +0\n"); exit (1); @@ -56,7 +53,7 @@ mpfr_set_inf (x, -1); mpfr_sech (y, x, MPFR_RNDN); - if (! (MPFR_IS_ZERO (y) && MPFR_SIGN (y) > 0)) + if (! (MPFR_IS_ZERO (y) && MPFR_IS_POS (y))) { printf ("Error: sech(-Inf) != +0\n"); exit (1); @@ -81,14 +78,14 @@ /* check huge x */ mpfr_set_str (x, "8e8", 10, MPFR_RNDN); mpfr_sech (y, x, MPFR_RNDN); - if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0)) + if (! (mpfr_zero_p (y) && MPFR_IS_POS (y))) { printf ("Error: sech(8e8) != +0\n"); exit (1); } mpfr_set_str (x, "-8e8", 10, MPFR_RNDN); mpfr_sech (y, x, MPFR_RNDN); - if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0)) + if (! (mpfr_zero_p (y) && MPFR_IS_POS (y))) { printf ("Error: sech(-8e8) != +0\n"); exit (1); @@ -117,7 +114,7 @@ set_emax (emax); /* 1 is not representable. */ /* and if emax < 0, 1 - eps is not representable either. */ for (i = -1; i <= 1; i++) - RND_LOOP (rnd) + RND_LOOP_NO_RNDF (rnd) { mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN); mpfr_clear_flags (); @@ -142,9 +139,10 @@ if (! mpfr_equal_p (x, y)) { printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of 0.11111111E%d.\n", emax); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of 0.11111111E%d.\n", emax); err = 1; } } @@ -157,12 +155,13 @@ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0)) + if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n" - " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of +Inf.\n"); + " Got ", i, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of +Inf.\n"); err = 1; } } @@ -182,7 +181,7 @@ tests_start_mpfr (); check_specials (); - test_generic (2, 200, 10); + test_generic (MPFR_PREC_MIN, 200, 10); overflowed_sech0 (); tests_end_mpfr (); diff -Nru mpfr4-3.1.4/tests/tset.c mpfr4-4.0.2/tests/tset.c --- mpfr4-3.1.4/tests/tset.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tset.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_set. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,15 +17,12 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" -int error; +static int error; #define PRINT_ERROR_IF(condition, text) \ do { \ @@ -37,18 +34,62 @@ } while (0) -/* Maybe better create its own test file ? */ +/* Maybe better create its own test file? */ static void check_neg_special (void) { - mpfr_t x; - mpfr_init (x); + mpfr_t x, y; + int inexact; + int s1, s2, s3; + + mpfr_inits2 (53, x, y, (mpfr_ptr) 0); + MPFR_SET_NAN (x); + s1 = mpfr_signbit (x) != 0; + mpfr_clear_nanflag (); - mpfr_neg (x, x, MPFR_RNDN); + inexact = mpfr_neg (y, x, MPFR_RNDN); + s2 = mpfr_signbit (y) != 0; PRINT_ERROR_IF (!mpfr_nanflag_p (), - "ERROR: neg (NaN) doesn't set Nan flag.\n"); - mpfr_clear (x); + "ERROR: neg (NaN) doesn't set Nan flag (1).\n"); + PRINT_ERROR_IF (!mpfr_nan_p (y) || inexact != 0, + "ERROR: neg (NaN) failed to set variable to NaN (1).\n"); + PRINT_ERROR_IF (s1 == s2, + "ERROR: neg (NaN) doesn't correctly flip sign bit (1).\n"); + + mpfr_clear_nanflag (); + inexact = mpfr_neg (x, x, MPFR_RNDN); + s2 = mpfr_signbit (x) != 0; + PRINT_ERROR_IF (!mpfr_nanflag_p (), + "ERROR: neg (NaN) doesn't set Nan flag (2).\n"); + PRINT_ERROR_IF (!mpfr_nan_p (x) || inexact != 0, + "ERROR: neg (NaN) failed to set variable to NaN (2).\n"); + /* check following "bug" is fixed: + https://sympa.inria.fr/sympa/arc/mpfr/2017-11/msg00003.html */ + PRINT_ERROR_IF (s1 == s2, + "ERROR: neg (NaN) doesn't correctly flip sign bit (2).\n"); + + mpfr_clear_nanflag (); + inexact = mpfr_neg (y, x, MPFR_RNDN); + s3 = mpfr_signbit (y) != 0; + PRINT_ERROR_IF (!mpfr_nanflag_p (), + "ERROR: neg (NaN) doesn't set Nan flag (3).\n"); + PRINT_ERROR_IF (!mpfr_nan_p (y) || inexact != 0, + "ERROR: neg (NaN) failed to set variable to NaN (3).\n"); + PRINT_ERROR_IF (s2 == s3, + "ERROR: neg (NaN) doesn't correctly flip sign bit (3).\n"); + + mpfr_clear_nanflag (); + inexact = mpfr_neg (x, x, MPFR_RNDN); + s3 = mpfr_signbit (x) != 0; + PRINT_ERROR_IF (!mpfr_nanflag_p (), + "ERROR: neg (NaN) doesn't set Nan flag (4).\n"); + PRINT_ERROR_IF (!mpfr_nan_p (x) || inexact != 0, + "ERROR: neg (NaN) failed to set variable to NaN (4).\n"); + PRINT_ERROR_IF (s2 == s3, + "ERROR: neg (NaN) doesn't correctly flip sign bit (4).\n"); + + mpfr_clears (x, y, (mpfr_ptr) 0); } static void @@ -56,51 +97,111 @@ { mpfr_t x, y; int inexact; + int s1, s2; - mpfr_init (x); - mpfr_init (y); + mpfr_inits2 (53, x, y, (mpfr_ptr) 0); mpfr_set_inf (x, 1); PRINT_ERROR_IF (!mpfr_inf_p (x) || mpfr_sgn (x) < 0, - "ERROR: mpfr_set_inf failed to set variable to +infinity.\n"); + "ERROR: mpfr_set_inf failed to set variable to +inf [1].\n"); + mpfr_set_inf (x, INT_MAX); + PRINT_ERROR_IF (!mpfr_inf_p (x) || mpfr_sgn (x) < 0, + "ERROR: mpfr_set_inf failed to set variable to +inf [2].\n"); + mpfr_set_inf (x, 0); + PRINT_ERROR_IF (!mpfr_inf_p (x) || mpfr_sgn (x) < 0, + "ERROR: mpfr_set_inf failed to set variable to +inf [3].\n"); inexact = mpfr_set (y, x, MPFR_RNDN); PRINT_ERROR_IF (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || inexact != 0, "ERROR: mpfr_set failed to set variable to +infinity.\n"); inexact = mpfr_set_ui (y, 0, MPFR_RNDN); - PRINT_ERROR_IF (!mpfr_zero_p (y) || mpfr_sgn (y) < 0 || inexact != 0, + PRINT_ERROR_IF (MPFR_NOTZERO (y) || MPFR_IS_NEG (y) || inexact != 0, "ERROR: mpfr_set_ui failed to set variable to +0.\n"); mpfr_set_inf (x, -1); PRINT_ERROR_IF (!mpfr_inf_p (x) || mpfr_sgn (x) > 0, - "ERROR: mpfr_set_inf failed to set variable to -infinity.\n"); + "ERROR: mpfr_set_inf failed to set variable to -inf [1].\n"); + mpfr_set_inf (x, INT_MIN); + PRINT_ERROR_IF (!mpfr_inf_p (x) || mpfr_sgn (x) > 0, + "ERROR: mpfr_set_inf failed to set variable to -inf [2].\n"); inexact = mpfr_set (y, x, MPFR_RNDN); PRINT_ERROR_IF (!mpfr_inf_p (y) || mpfr_sgn (y) > 0 || inexact != 0, "ERROR: mpfr_set failed to set variable to -infinity.\n"); mpfr_set_zero (x, 1); - PRINT_ERROR_IF (!mpfr_zero_p (x) || mpfr_sgn (x) < 0, - "ERROR: mpfr_set_zero failed to set variable to +0.\n"); + PRINT_ERROR_IF (MPFR_NOTZERO (x) || MPFR_IS_NEG (x), + "ERROR: mpfr_set_zero failed to set variable to +0 [1].\n"); + mpfr_set_zero (x, INT_MAX); + PRINT_ERROR_IF (MPFR_NOTZERO (x) || MPFR_IS_NEG (x), + "ERROR: mpfr_set_zero failed to set variable to +0 [2].\n"); + mpfr_set_zero (x, 0); + PRINT_ERROR_IF (MPFR_NOTZERO (x) || MPFR_IS_NEG (x), + "ERROR: mpfr_set_zero failed to set variable to +0 [3].\n"); inexact = mpfr_set (y, x, MPFR_RNDN); - PRINT_ERROR_IF (!mpfr_zero_p (y) || mpfr_sgn (y) < 0 || inexact != 0, + PRINT_ERROR_IF (MPFR_NOTZERO (y) || MPFR_IS_NEG (y) || inexact != 0, "ERROR: mpfr_set failed to set variable to +0.\n"); mpfr_set_zero (x, -1); - PRINT_ERROR_IF (!mpfr_zero_p (x) || mpfr_sgn (x) > 0, - "ERROR: mpfr_set_zero failed to set variable to -0.\n"); + PRINT_ERROR_IF (MPFR_NOTZERO (x) || MPFR_IS_POS (x), + "ERROR: mpfr_set_zero failed to set variable to -0 [1].\n"); + mpfr_set_zero (x, INT_MIN); + PRINT_ERROR_IF (MPFR_NOTZERO (x) || MPFR_IS_POS (x), + "ERROR: mpfr_set_zero failed to set variable to -0 [2].\n"); inexact = mpfr_set (y, x, MPFR_RNDN); - PRINT_ERROR_IF (!mpfr_zero_p (y) || mpfr_sgn (y) > 0 || inexact != 0, + PRINT_ERROR_IF (MPFR_NOTZERO (y) || MPFR_IS_POS (y) || inexact != 0, "ERROR: mpfr_set failed to set variable to -0.\n"); + /* NaN tests */ + mpfr_set_nan (x); PRINT_ERROR_IF (!mpfr_nan_p (x), "ERROR: mpfr_set_nan failed to set variable to NaN.\n"); + s1 = mpfr_signbit (x) != 0; + + mpfr_clear_nanflag (); inexact = mpfr_set (y, x, MPFR_RNDN); + s2 = mpfr_signbit (y) != 0; + PRINT_ERROR_IF (!mpfr_nanflag_p (), + "ERROR: mpfr_set doesn't set Nan flag (1).\n"); PRINT_ERROR_IF (!mpfr_nan_p (y) || inexact != 0, - "ERROR: mpfr_set failed to set variable to NaN.\n"); + "ERROR: mpfr_set failed to set variable to NaN (1).\n"); + PRINT_ERROR_IF (s1 != s2, + "ERROR: mpfr_set doesn't preserve the sign bit (1).\n"); - mpfr_clear (x); - mpfr_clear (y); + mpfr_clear_nanflag (); + inexact = mpfr_set (x, x, MPFR_RNDN); + s2 = mpfr_signbit (x) != 0; + PRINT_ERROR_IF (!mpfr_nanflag_p (), + "ERROR: mpfr_set doesn't set Nan flag (2).\n"); + PRINT_ERROR_IF (!mpfr_nan_p (x) || inexact != 0, + "ERROR: mpfr_set failed to set variable to NaN (2).\n"); + PRINT_ERROR_IF (s1 != s2, + "ERROR: mpfr_set doesn't preserve the sign bit (2).\n"); + + MPFR_CHANGE_SIGN (x); + s1 = !s1; + + mpfr_clear_nanflag (); + inexact = mpfr_set (y, x, MPFR_RNDN); + s2 = mpfr_signbit (y) != 0; + PRINT_ERROR_IF (!mpfr_nanflag_p (), + "ERROR: mpfr_set doesn't set Nan flag (3).\n"); + PRINT_ERROR_IF (!mpfr_nan_p (y) || inexact != 0, + "ERROR: mpfr_set failed to set variable to NaN (3).\n"); + PRINT_ERROR_IF (s1 != s2, + "ERROR: mpfr_set doesn't preserve the sign bit (3).\n"); + + mpfr_clear_nanflag (); + inexact = mpfr_set (x, x, MPFR_RNDN); + s2 = mpfr_signbit (x) != 0; + PRINT_ERROR_IF (!mpfr_nanflag_p (), + "ERROR: mpfr_set doesn't set Nan flag (4).\n"); + PRINT_ERROR_IF (!mpfr_nan_p (x) || inexact != 0, + "ERROR: mpfr_set failed to set variable to NaN (4).\n"); + PRINT_ERROR_IF (s1 != s2, + "ERROR: mpfr_set doesn't preserve the sign bit (4).\n"); + + mpfr_clears (x, y, (mpfr_ptr) 0); } static void @@ -123,13 +224,28 @@ mpfr_set_prec (y, q); for (rnd = 0; rnd < MPFR_RND_MAX; rnd++) { + if (rnd == MPFR_RNDF) /* the test below makes no sense */ + continue; inexact = mpfr_set (y, x, (mpfr_rnd_t) rnd); cmp = mpfr_cmp (y, x); if (((inexact == 0) && (cmp != 0)) || ((inexact > 0) && (cmp <= 0)) || ((inexact < 0) && (cmp >= 0))) { - printf ("Wrong ternary value in mpfr_set: expected %d," + printf ("Wrong ternary value in mpfr_set for %s: expected" + " %d, got %d\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), cmp, + inexact); + exit (1); + } + /* Test mpfr_set function too */ + inexact = (mpfr_set) (y, x, (mpfr_rnd_t) rnd); + cmp = mpfr_cmp (y, x); + if (((inexact == 0) && (cmp != 0)) || + ((inexact > 0) && (cmp <= 0)) || + ((inexact < 0) && (cmp >= 0))) + { + printf ("Wrong ternary value in mpfr_set(2): expected %d," " got %d\n", cmp, inexact); exit (1); } @@ -140,6 +256,93 @@ mpfr_clear (y); } +static void +test_set_1_2 (void) +{ + mpfr_t u, v, zz, z; + int inex; + + /* (8,16)-bit test */ + mpfr_inits2 (16, u, v, zz, (mpfr_ptr) 0); + mpfr_init2 (z, 8); + mpfr_set_str_binary (u, "0.1100001100011010E-1"); + mpfr_set_str_binary (v, "0.1100010101110010E0"); + /* u + v = 1.0010011011111111 */ + inex = mpfr_add (zz, u, v, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + mpfr_set_str_binary (u, "1.001001110000000"); + MPFR_ASSERTN(mpfr_equal_p (zz, u)); + inex = mpfr_set_1_2 (z, zz, MPFR_RNDN, inex); + /* we should have z = 1.0010011 and inex < 0 */ + MPFR_ASSERTN(inex < 0); + mpfr_set_str_binary (u, "1.0010011"); + MPFR_ASSERTN(mpfr_equal_p (z, u)); + mpfr_clears (u, v, zz, z, (mpfr_ptr) 0); + + /* (16,32)-bit test: + * take for v a random 32-bit number in [1/2,1), here 2859611790/2^32 + * take for z a random 16-bit number in [1,2), less than 2*v, + with last bit 0, here we take z = 40900/2^15 + * take u = z-v-1/2^16-1/2^32 */ + mpfr_inits2 (32, u, v, zz, (mpfr_ptr) 0); + mpfr_init2 (z, 16); + mpfr_set_str_binary (u, "0.10010101000101001100100101110001"); + mpfr_set_str_binary (v, "0.10101010011100100011011010001110"); + /* u + v = 1.00111111100001101111111111111111 */ + inex = mpfr_add (zz, u, v, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + mpfr_set_str_binary (u, "1.0011111110000111"); + MPFR_ASSERTN(mpfr_equal_p (zz, u)); + inex = mpfr_set_1_2 (z, zz, MPFR_RNDN, inex); + /* we should have z = 1.001111111000011 and inex < 0 */ + MPFR_ASSERTN(inex < 0); + mpfr_set_str_binary (u, "1.001111111000011"); + MPFR_ASSERTN(mpfr_equal_p (z, u)); + mpfr_clears (u, v, zz, z, (mpfr_ptr) 0); + + /* (32,64)-bit test: + * take for v a random 64-bit number in [1/2,1), + here v = 13687985014345662879/2^64 + * take for z a random 32-bit number in [1,2), less than 2*v, + with last bit 0, here we take z = 2871078774/2^31 + * take u = z-v-1/2^32-1/2^64 */ + mpfr_inits2 (64, u, v, zz, (mpfr_ptr) 0); + mpfr_init2 (z, 32); + mpfr_set_str_binary (u, "0.10011000010011001110000100010001110010010000111001111110011"); + mpfr_set_str_binary (v, "0.1011110111110101011111011101100100110110111100011000000110011111"); + /* u + v = 1.0101011001000010010111101110101011111111111111111111111111111111 */ + inex = mpfr_add (zz, u, v, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + mpfr_set_str_binary (u, "1.01010110010000100101111011101011"); + MPFR_ASSERTN(mpfr_equal_p (zz, u)); + inex = mpfr_set_1_2 (z, zz, MPFR_RNDN, inex); + /* we should have z = 1.0101011001000010010111101110101 and inex < 0 */ + MPFR_ASSERTN(inex < 0); + mpfr_set_str_binary (u, "1.0101011001000010010111101110101"); + MPFR_ASSERTN(mpfr_equal_p (z, u)); + mpfr_clears (u, v, zz, z, (mpfr_ptr) 0); + + /* (64,128)-bit test: + * take for v a random 128-bit number in [1/2,1), + here v = 322263811942091240216761391118876232409/2^128 + * take for z a random 64-bit number in [1,2), less than 2*v, + with last bit 0, here we take z = 16440347967874738276/2^63 + * take u = z-v-1/2^64-1/2^128 */ + mpfr_inits2 (128, u, v, zz, (mpfr_ptr) 0); + mpfr_init2 (z, 64); + mpfr_set_str_binary (u, "0.1101010111011101111100100001011111111000010011011001000101111010110101101101011011100110101001010001101011011110101101010010011"); + mpfr_set_str_binary (v, "0.11110010011100011100000010100110100010011010110010111111010011000010100100101001000110010101101011100101001000010100101011011001"); + inex = mpfr_add (zz, u, v, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + mpfr_set_str_binary (u, "1.1100100001001111101100101011111010000001111110100101000011000111"); + MPFR_ASSERTN(mpfr_equal_p (zz, u)); + inex = mpfr_set_1_2 (z, zz, MPFR_RNDN, inex); + MPFR_ASSERTN(inex < 0); + mpfr_set_str_binary (u, "1.1100100001001111101100101011111010000001111110100101000011000110"); + MPFR_ASSERTN(mpfr_equal_p (z, u)); + mpfr_clears (u, v, zz, z, (mpfr_ptr) 0); +} + #define TEST_FUNCTION mpfr_set #include "tgeneric.c" @@ -152,6 +355,8 @@ tests_start_mpfr (); + test_set_1_2 (); + /* Default : no error */ error = 0; @@ -171,7 +376,7 @@ mpfr_set_str_binary (x, "0.111"); mpfr_set_prec (y, 2); mpfr_set (y, x, MPFR_RNDU); - if (!(MPFR_IS_INF (y) && MPFR_SIGN (y) > 0)) + if (!(MPFR_IS_INF (y) && MPFR_IS_POS (y))) { printf ("Error for y=x=0.111 with px=3, py=2 and emax=0\nx="); mpfr_dump (x); @@ -202,7 +407,7 @@ check_special (); check_neg_special (); - test_generic (2, 1000, 10); + test_generic (MPFR_PREC_MIN, 1000, 10); tests_end_mpfr (); return error; diff -Nru mpfr4-3.1.4/tests/tset_d.c mpfr4-4.0.2/tests/tset_d.c --- mpfr4-3.1.4/tests/tset_d.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tset_d.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_set_d and mpfr_get_d. -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include #include "mpfr-test.h" @@ -101,6 +99,8 @@ if (mpfr_cmp_ui (x, 0) != 0 || MPFR_IS_POS(x)) { printf ("Error in mpfr_set_d on -0\n"); + printf ("d = %g, x = ", d); + mpfr_dump (x); exit (1); } #endif /* HAVE_SIGNEDZ */ @@ -123,7 +123,7 @@ /* checks that subnormals are not flushed to zero */ d = DBL_MIN; /* 2^(-1022) */ - for (n=0; n<52; n++, d /= 2.0) + for (n = 0; n < 53; n++, d /= 2.0) if (d != 0.0) /* should be 2^(-1022-n) */ { mpfr_set_d (x, d, MPFR_RNDN); @@ -133,8 +133,7 @@ printf ("got "); mpfr_out_str (stdout, 10, 10, x, MPFR_RNDN); printf ("\n"); - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); exit (1); } } @@ -145,14 +144,14 @@ if (mpfr_cmp_ui (x, 4)) { printf ("Error in tset_d: expected 4.0, got "); - mpfr_print_binary (x); putchar('\n'); + mpfr_dump (x); exit (1); } mpfr_set_d (x, -5.0, MPFR_RNDN); if (mpfr_cmp_si (x, -4)) { printf ("Error in tset_d: expected -4.0, got "); - mpfr_print_binary (x); putchar('\n'); + mpfr_dump (x); exit (1); } @@ -160,7 +159,7 @@ if (mpfr_cmp_ui (x, 1)) { printf ("Error in tset_d: expected 1.0, got "); - mpfr_print_binary (x); putchar('\n'); + mpfr_dump (x); exit (1); } @@ -168,7 +167,7 @@ mpfr_set_d (z, 1.0, (mpfr_rnd_t) 0); if (mpfr_cmp_ui (z, 1)) { - mpfr_print_binary (z); puts (""); + mpfr_dump (z); printf ("Error: 1.0 != 1.0\n"); exit (1); } @@ -177,7 +176,7 @@ mpfr_set_d (x, d=-1.08007920352320089721e+150, (mpfr_rnd_t) 0); if (mpfr_get_d1 (x) != d) { - mpfr_print_binary (x); puts (""); + mpfr_dump (x); printf ("Error: get_d o set_d <> identity for d = %1.20e %1.20e\n", d, mpfr_get_d1 (x)); exit (1); @@ -188,8 +187,7 @@ mpfr_set_d (x, d, (mpfr_rnd_t) 0); if (d != mpfr_get_d1 (x)) { - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); printf ("Error: get_d o set_d <> identity for d = %1.20e %1.20e\n", d, mpfr_get_d1 (x)); exit (1); @@ -212,8 +210,7 @@ if (d != dd && !(Isnan(d) && Isnan(dd))) { printf ("Mismatch on : %1.18g != %1.18g\n", d, mpfr_get_d1 (x)); - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); exit (1); } } diff -Nru mpfr4-3.1.4/tests/tset_exp.c mpfr4-4.0.2/tests/tset_exp.c --- mpfr4-3.1.4/tests/tset_exp.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tset_exp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ -/* Test file for mpfr_set_exp. +/* Test file for mpfr_get_exp and mpfr_set_exp. -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" int @@ -30,32 +27,54 @@ { mpfr_t x; int ret; - mpfr_exp_t emin, emax; + mpfr_exp_t emin, emax, e; tests_start_mpfr (); emin = mpfr_get_emin (); emax = mpfr_get_emax (); - mpfr_init (x); + mpfr_init2 (x, 53); mpfr_set_ui (x, 1, MPFR_RNDN); ret = mpfr_set_exp (x, 2); - MPFR_ASSERTN(ret == 0 && mpfr_cmp_ui (x, 2) == 0); + MPFR_ASSERTN (ret == 0 && mpfr_cmp_ui (x, 2) == 0); + e = mpfr_get_exp (x); + MPFR_ASSERTN (e == 2); + e = (mpfr_get_exp) (x); + MPFR_ASSERTN (e == 2); + + ret = mpfr_set_exp (x, emax); + e = mpfr_get_exp (x); + MPFR_ASSERTN (e == emax); + e = (mpfr_get_exp) (x); + MPFR_ASSERTN (e == emax); + + ret = mpfr_set_exp (x, emin); + e = mpfr_get_exp (x); + MPFR_ASSERTN (e == emin); + e = (mpfr_get_exp) (x); + MPFR_ASSERTN (e == emin); set_emin (-1); + + e = mpfr_get_exp (x); + MPFR_ASSERTN (e == emin); + e = (mpfr_get_exp) (x); + MPFR_ASSERTN (e == emin); + ret = mpfr_set_exp (x, -1); - MPFR_ASSERTN(ret == 0 && mpfr_cmp_ui_2exp (x, 1, -2) == 0); + MPFR_ASSERTN (ret == 0 && mpfr_cmp_ui_2exp (x, 1, -2) == 0); set_emax (1); ret = mpfr_set_exp (x, 1); - MPFR_ASSERTN(ret == 0 && mpfr_cmp_ui (x, 1) == 0); + MPFR_ASSERTN (ret == 0 && mpfr_cmp_ui (x, 1) == 0); ret = mpfr_set_exp (x, -2); - MPFR_ASSERTN(ret != 0 && mpfr_cmp_ui (x, 1) == 0); + MPFR_ASSERTN (ret != 0 && mpfr_cmp_ui (x, 1) == 0); ret = mpfr_set_exp (x, 2); - MPFR_ASSERTN(ret != 0 && mpfr_cmp_ui (x, 1) == 0); + MPFR_ASSERTN (ret != 0 && mpfr_cmp_ui (x, 1) == 0); mpfr_clear (x); diff -Nru mpfr4-3.1.4/tests/tset_f.c mpfr4-4.0.2/tests/tset_f.c --- mpfr4-3.1.4/tests/tset_f.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tset_f.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_set_f. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,15 +17,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include /* for ULONG_MAX */ - #include "mpfr-test.h" +#ifndef MPFR_USE_MINI_GMP + int main (void) { @@ -205,3 +203,13 @@ tests_end_mpfr (); return 0; } + +#else + +int +main (void) +{ + return 77; +} + +#endif diff -Nru mpfr4-3.1.4/tests/tset_float128.c mpfr4-4.0.2/tests/tset_float128.c --- mpfr4-3.1.4/tests/tset_float128.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tests/tset_float128.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,349 @@ +/* Test file for mpfr_set_float128 and mpfr_get_float128. + +Copyright 2012-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Needed due to the test on MPFR_WANT_FLOAT128 */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef MPFR_WANT_FLOAT128 + +#include "mpfr-test.h" + +static void +check_special (void) +{ + __float128 f; + mpfr_t x; + + mpfr_init2 (x, 113); + +#if !defined(MPFR_ERRDIVZERO) + /* check NaN */ + f = 0.0 / 0.0; + mpfr_set_float128 (x, f, MPFR_RNDN); + if (! mpfr_nan_p (x)) + { + printf ("Error in mpfr_set_float128(x, NaN)\n"); + exit (1); + } + f = mpfr_get_float128 (x, MPFR_RNDN); + if (! DOUBLE_ISNAN (f)) + { + printf ("Error in mpfr_get_float128(NaN)\n"); + printf ("got %f\n", (double) f); + exit (1); + } + + /* check +Inf */ + f = 1.0 / 0.0; + mpfr_set_float128 (x, f, MPFR_RNDN); + if (! mpfr_inf_p (x) || MPFR_IS_NEG (x)) + { + printf ("Error in mpfr_set_float128(x, +Inf)\n"); + exit (1); + } + f = mpfr_get_float128 (x, MPFR_RNDN); + if (f != (1.0 / 0.0)) + { + printf ("Error in mpfr_get_float128(+Inf)\n"); + exit (1); + } + + /* check -Inf */ + f = -1.0 / 0.0; + mpfr_set_float128 (x, f, MPFR_RNDN); + if (! mpfr_inf_p (x) || MPFR_IS_POS (x)) + { + printf ("Error in mpfr_set_float128(x, -Inf)\n"); + exit (1); + } + f = mpfr_get_float128 (x, MPFR_RNDN); + if (f != (-1.0 / 0.0)) + { + printf ("Error in mpfr_get_float128(-Inf)\n"); + exit (1); + } +#endif + + /* check +0 */ + f = 0.0; + mpfr_set_float128 (x, f, MPFR_RNDN); + if (! mpfr_zero_p (x) || MPFR_IS_NEG (x)) + { + printf ("Error in mpfr_set_float128(x, +0)\n"); + exit (1); + } + f = mpfr_get_float128 (x, MPFR_RNDN); + if (f != 0.0) /* the sign is not checked */ + { + printf ("Error in mpfr_get_float128(+0.0)\n"); + exit (1); + } +#if !defined(MPFR_ERRDIVZERO) && defined(HAVE_SIGNEDZ) + if (1 / f != 1 / 0.0) /* check the sign */ + { + printf ("Error in mpfr_get_float128(+0.0)\n"); + exit (1); + } +#endif + + /* check -0 */ + f = -0.0; + mpfr_set_float128 (x, f, MPFR_RNDN); + if (! mpfr_zero_p (x)) + { + printf ("Error in mpfr_set_float128(x, -0)\n"); + exit (1); + } +#if defined(HAVE_SIGNEDZ) + if (MPFR_IS_POS (x)) + { + printf ("Error in mpfr_set_float128(x, -0)\n"); + exit (1); + } +#endif + f = mpfr_get_float128 (x, MPFR_RNDN); + if (f != -0.0) /* the sign is not checked */ + { + printf ("Error in mpfr_get_float128(-0.0)\n"); + exit (1); + } +#if !defined(MPFR_ERRDIVZERO) && defined(HAVE_SIGNEDZ) + if (1 / f != 1 / -0.0) /* check the sign */ + { + printf ("Error in mpfr_get_float128(-0.0)\n"); + exit (1); + } +#endif + + mpfr_clear (x); +} + +static void +check_large (void) +{ + mpfr_exp_t emin, emax; + __float128 f, e; + int i; + mpfr_t x, y; + int r; + int red; + + emin = mpfr_get_emin (); + emax = mpfr_get_emax (); + + mpfr_init2 (x, 113); + mpfr_init2 (y, 113); + + /* check with the largest float128 number 2^16384*(1-2^(-113)) */ + for (f = 1.0, i = 0; i < 113; i++) + f = f + f; + f = f - (__float128) 1.0; + mpfr_set_ui (y, 1, MPFR_RNDN); + mpfr_mul_2exp (y, y, 113, MPFR_RNDN); + mpfr_sub_ui (y, y, 1, MPFR_RNDN); + for (i = 113; i < 16384; i++) + { + RND_LOOP (r) + { + mpfr_set_float128 (x, f, (mpfr_rnd_t) r); + if (! mpfr_equal_p (x, y)) + { + printf ("mpfr_set_float128 failed for 2^%d*(1-2^(-113)) rnd=%s\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("got "); + mpfr_dump (x); + exit (1); + } + for (red = 0; red < 2; red++) + { + if (red) + { + mpfr_exp_t ex; + + if (MPFR_IS_SINGULAR (x)) + break; + ex = MPFR_GET_EXP (x); + set_emin (ex); + set_emax (ex); + } + e = mpfr_get_float128 (x, (mpfr_rnd_t) r); + set_emin (emin); + set_emax (emax); + if (e != f) + { + printf ("mpfr_get_float128 failed for 2^%d*(1-2^(-113))" + " rnd=%s%s\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) r), + red ? ", reduced exponent range" : ""); + exit (1); + } + } + } + + /* check with opposite number */ + f = -f; + mpfr_neg (y, y, MPFR_RNDN); + RND_LOOP (r) + { + mpfr_set_float128 (x, f, (mpfr_rnd_t) r); + if (! mpfr_equal_p (x, y)) + { + printf ("mpfr_set_float128 failed for -2^%d*(1-2^(-113)) rnd=%s\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("got "); + mpfr_dump (x); + exit (1); + } + e = mpfr_get_float128 (x, (mpfr_rnd_t) r); + if (e != f) + { + printf ("mpfr_get_float128 failed for -2^%d*(1-2^(-113)) rnd=%s\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + exit (1); + } + } + + f = -f; + mpfr_neg (y, y, MPFR_RNDN); + f = f + f; + mpfr_add (y, y, y, MPFR_RNDN); + } + + mpfr_clear (x); + mpfr_clear (y); +} + +static void +check_small (void) +{ + int t[5] = { 1, 2, 17, 111, 112 }; + mpfr_exp_t emin; + __float128 e, f; + int i, j, neg, inex, r; + mpfr_t w, x, y, z; + + emin = mpfr_get_emin (); + + mpfr_inits2 (113, w, x, y, z, (mpfr_ptr) 0); + + f = 1.0; + mpfr_set_ui (y, 1, MPFR_RNDN); + for (i = 0; i > -16500; i--) + { + for (j = 0; j < 5; j++) + { + mpfr_div_2ui (z, y, t[j], MPFR_RNDN); + inex = mpfr_add (z, z, y, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + /* z = y (1 + 2^(-t[j]) */ + for (neg = 0; neg < 2; neg++) + { + RND_LOOP_NO_RNDF (r) + { + if (j == 0 && f != 0) + { + /* This test does not depend on j. */ + mpfr_set_float128 (x, f, (mpfr_rnd_t) r); + if (! mpfr_equal_p (x, y)) + { + printf ("mpfr_set_float128 failed for " + "%c2^(%d) rnd=%s\n", neg ? '-' : '+', i, + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("got "); + mpfr_dump (x); + exit (1); + } + e = mpfr_get_float128 (x, (mpfr_rnd_t) r); + if (e != f) + { + printf ("mpfr_get_float128 failed for " + "%c2^(%d) rnd=%s\n", neg ? '-' : '+', i, + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + exit (1); + } + } + if (i < -16378) + { + /* Subnormals or close to subnormals... + Here we mainly test mpfr_get_float128. */ + e = mpfr_get_float128 (z, (mpfr_rnd_t) r); + mpfr_set_float128 (x, e, MPFR_RNDN); /* exact */ + inex = mpfr_set (w, z, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + mpfr_set_emin (-16493); + inex = mpfr_check_range (w, 0, (mpfr_rnd_t) r); + mpfr_subnormalize (w, inex, (mpfr_rnd_t) r); + mpfr_set_emin (emin); + if (! mpfr_equal_p (x, w)) + { + printf ("mpfr_get_float128 failed for " + "%c(2^(%d))(1+2^(-%d)) rnd=%s\n", + neg ? '-' : '+', i, t[j], + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("expected "); + mpfr_dump (w); + printf ("got "); + mpfr_dump (x); + exit (1); + } + } + } + f = -f; + mpfr_neg (y, y, MPFR_RNDN); + mpfr_neg (z, z, MPFR_RNDN); + } + } + f = 0.5 * f; + mpfr_div_2exp (y, y, 1, MPFR_RNDN); + } + + mpfr_clears (w, x, y, z, (mpfr_ptr) 0); +} + +int +main (int argc, char *argv[]) +{ + tests_start_mpfr (); + + check_special (); + + check_large (); + + check_small (); + + tests_end_mpfr (); + + return 0; +} + +#else /* MPFR_WANT_FLOAT128 */ + +/* dummy main to say this test is ignored */ +int +main (void) +{ + return 77; +} + +#endif /* MPFR_WANT_FLOAT128 */ diff -Nru mpfr4-3.1.4/tests/tset_ld.c mpfr4-4.0.2/tests/tset_ld.c --- mpfr4-3.1.4/tests/tset_ld.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tset_ld.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_set_ld and mpfr_get_ld. -Copyright 2002-2016 Free Software Foundation, Inc. +Copyright 2002-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,16 +17,10 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include -#include -#ifdef WITH_FPU_CONTROL -#include -#endif #include "mpfr-test.h" @@ -34,13 +28,14 @@ check_gcc33_bug (void) { volatile long double x; + x = (long double) 9007199254740992.0 + 1.0; if (x != 0.0) return; /* OK */ printf ("Detected optimization bug of gcc 3.3 on Alpha concerning long double\n" "comparisons; set_ld tests might fail (set_ld won't work correctly).\n" - "See http://gcc.gnu.org/ml/gcc-bugs/2003-10/msg00853.html for more\n" + "See https://gcc.gnu.org/ml/gcc-bugs/2003-10/msg00853.html for more\n" "information.\n"); } @@ -59,55 +54,213 @@ return 1; } -/* checks that a long double converted to a mpfr (with precision >=113), - then converted back to a long double gives the initial value, - or in other words mpfr_get_ld(mpfr_set_ld(d)) = d. +/* Return the minimal number of bits to represent d exactly (0 for zero). + If flag is non-zero, also print d. */ +/* FIXME: This function doesn't work if the rounding precision is reduced. */ +static mpfr_prec_t +print_binary (long double d, int flag) +{ + long double e, f, r; + long exp = 1; + mpfr_prec_t prec = 0; + + if (Isnan_ld (d)) + { + if (flag) + printf ("NaN\n"); + return 0; + } + if (d < (long double) 0.0 +#if !defined(MPFR_ERRDIVZERO) + || (d == (long double) 0.0 && (1.0 / (double) d < 0.0)) +#endif + ) + { + if (flag) + printf ("-"); + d = -d; + } + /* now d >= 0 */ + /* Use 2 different tests for Inf, to avoid potential bugs + in implementations. */ + if (Isnan_ld (d - d) || (d > 1 && d * 0.5 == d)) + { + if (flag) + printf ("Inf\n"); + return 0; + } + if (d == (long double) 0.0) + { + if (flag) + printf ("0.0\n"); + return prec; + } + MPFR_ASSERTN (d > 0); + e = (long double) 1.0; + while (e > d) + { + e = e * (long double) 0.5; + exp --; + } + if (flag == 2) printf ("1: e=%.36Le\n", e); + MPFR_ASSERTN (d >= e); + /* FIXME: There can be an overflow here, which may not be supported + on all platforms. */ + while (f = e + e, d >= f) + { + e = f; + exp ++; + } + if (flag == 2) printf ("2: e=%.36Le\n", e); + MPFR_ASSERTN (e <= d && d < f); + if (flag == 1) + printf ("0."); + if (flag == 2) printf ("3: d=%.36Le e=%.36Le prec=%ld\n", d, e, + (long) prec); + /* Note: the method we use here to extract the bits of d is the following, + to deal with the case where the rounding precision is less than the + precision of d: + (1) we accumulate the upper bits of d into f + (2) when accumulating a new bit into f is not exact, we subtract + f from d and reset f to 0 + This is guaranteed to work only when the rounding precision is at least + half the precision of d, since otherwise d-f might not be exact. + This method does not work with flush-to-zero on underflow. */ + f = 0.0; /* will hold accumulated powers of 2 */ + while (1) + { + prec++; + r = f + e; + /* r is close to f (in particular in the cases where f+e may + not be exact), so that r - f should be exact. */ + if (r - f != e) /* f+e is not exact */ + { + d -= f; /* should be exact */ + f = 0.0; + r = e; + } + if (d >= r) + { + if (flag == 1) + printf ("1"); + if (d == r) + break; + f = r; + } + else + { + if (flag == 1) + printf ("0"); + } + e *= (long double) 0.5; + MPFR_ASSERTN (e != 0); /* may fail with flush-to-zero on underflow */ + if (flag == 2) printf ("4: d=%.36Le e=%.36Le prec=%ld\n", d, e, + (long) prec); + } + if (flag == 1) + printf ("e%ld\n", exp); + return prec; +} + +/* Checks that a long double converted exactly to a MPFR number, then + converted back to a long double gives the initial value, or in other + words, mpfr_get_ld(mpfr_set_ld(d)) = d. */ static void -check_set_get (long double d, mpfr_t x) +check_set_get (long double d) { + mpfr_exp_t emin, emax; + mpfr_t x; + mpfr_prec_t prec; int r; long double e; int inex; + int red; - for (r = 0; r < MPFR_RND_MAX; r++) + emin = mpfr_get_emin (); + emax = mpfr_get_emax (); + + /* Select a precision to ensure that the conversion of d to x be exact. */ + prec = print_binary (d, 0); + if (prec < MPFR_PREC_MIN) + prec = MPFR_PREC_MIN; + mpfr_init2 (x, prec); + + RND_LOOP(r) { inex = mpfr_set_ld (x, d, (mpfr_rnd_t) r); if (inex != 0) { - mpfr_exp_t emin, emax; - emin = mpfr_get_emin (); - emax = mpfr_get_emax (); - printf ("Error: mpfr_set_ld should be exact\n"); - printf ("d=%1.30Le inex=%d\n", d, inex); + printf ("Error: mpfr_set_ld should be exact (rnd = %s)\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + /* We use 36 digits here, as the maximum LDBL_MANT_DIG value + seen in the current implementations is 113 (binary128), + and ceil(1+113*log(2)/log(10)) = 36. But the current glibc + implementation of printf with double-double arithmetic + (e.g. on PowerPC) is not accurate. */ + printf (" d ~= %.36Le (output may be wrong!)\n", d); + printf (" inex = %d\n", inex); if (emin >= LONG_MIN) - printf ("emin=%ld\n", (long) emin); + printf (" emin = %ld\n", (long) emin); if (emax <= LONG_MAX) - printf ("emax=%ld\n", (long) emax); + printf (" emax = %ld\n", (long) emax); + ld_trace (" d", d); + printf (" d = "); + print_binary (d, 1); + printf (" x = "); mpfr_dump (x); + printf (" MPFR_LDBL_MANT_DIG=%u\n", MPFR_LDBL_MANT_DIG); + printf (" prec=%ld\n", (long) prec); + print_binary (d, 2); exit (1); } - e = mpfr_get_ld (x, (mpfr_rnd_t) r); - if ((Isnan_ld(d) && ! Isnan_ld(e)) || - (Isnan_ld(e) && ! Isnan_ld(d)) || - (e != d && !(Isnan_ld(e) && Isnan_ld(d)))) + for (red = 0; red < 2; red++) { - printf ("Error: mpfr_get_ld o mpfr_set_ld <> Id\n"); - printf (" r=%d\n", r); - printf (" d=%1.30Le get_ld(set_ld(d))=%1.30Le\n", d, e); - ld_trace (" d", d); - printf (" x="); mpfr_out_str (NULL, 16, 0, x, MPFR_RNDN); - printf ("\n"); - ld_trace (" e", e); + if (red) + { + mpfr_exp_t ex; + + if (MPFR_IS_SINGULAR (x)) + break; + ex = MPFR_GET_EXP (x); + set_emin (ex); + set_emax (ex); + } + e = mpfr_get_ld (x, (mpfr_rnd_t) r); + set_emin (emin); + set_emax (emax); + if (inex == 0 && ((Isnan_ld(d) && ! Isnan_ld(e)) || + (Isnan_ld(e) && ! Isnan_ld(d)) || + (e != d && !(Isnan_ld(e) && Isnan_ld(d))))) + { + printf ("Error: mpfr_get_ld o mpfr_set_ld <> Id%s\n", + red ? ", reduced exponent range" : ""); + printf (" rnd = %s\n", mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf (" d ~= %.36Le (output may be wrong!)\n", d); + printf (" e ~= %.36Le (output may be wrong!)\n", e); + ld_trace (" d", d); + printf (" x = "); mpfr_out_str (NULL, 16, 0, x, MPFR_RNDN); + printf ("\n"); + ld_trace (" e", e); + printf (" d = "); + print_binary (d, 1); + printf (" x = "); + mpfr_dump (x); + printf (" e = "); + print_binary (e, 1); + printf (" MPFR_LDBL_MANT_DIG=%u\n", MPFR_LDBL_MANT_DIG); #ifdef MPFR_NANISNAN - if (Isnan_ld(d) || Isnan_ld(e)) - printf ("The reason is that NAN == NAN. Please look at the " - "configure output\nand Section \"In case of problem\" " - "of the INSTALL file.\n"); + if (Isnan_ld(d) || Isnan_ld(e)) + printf ("The reason is that NAN == NAN. Please look at the " + "configure output\nand Section \"In case of problem\"" + " of the INSTALL file.\n"); #endif - exit (1); + exit (1); + } } } + + mpfr_clear (x); } static void @@ -116,9 +269,9 @@ mpfr_t x, y, z; long double d; - mpfr_init2 (x, 64); - mpfr_init2 (y, 64); - mpfr_init2 (z, 64); + mpfr_init2 (x, MPFR_LDBL_MANT_DIG); + mpfr_init2 (y, MPFR_LDBL_MANT_DIG); + mpfr_init2 (z, MPFR_LDBL_MANT_DIG); /* x = 11906603631607553907/2^(16381+64) */ mpfr_set_str (x, "0.1010010100111100110000001110101101000111010110000001111101110011E-16381", 2, MPFR_RNDN); @@ -136,7 +289,7 @@ mpfr_out_str (NULL, 10, 21, x, MPFR_RNDN); printf (" = "); mpfr_out_str (NULL, 16, 0, x, MPFR_RNDN); - printf ("\n -> d = %.21Lg", d); + printf ("\n -> d = %.33Le", d); printf ("\n -> y = "); mpfr_out_str (NULL, 10, 21, y, MPFR_RNDN); printf (" = "); @@ -159,7 +312,7 @@ long double l, m; /* bug found by Steve Kargl (2009-03-14) */ - mpfr_init2 (x, 64); + mpfr_init2 (x, MPFR_LDBL_MANT_DIG); mpfr_set_ui_2exp (x, 1, -16447, MPFR_RNDN); mpfr_get_ld (x, MPFR_RNDN); /* an assertion failed in init2.c:50 */ @@ -193,53 +346,195 @@ mpfr_clear (x); } -int -main (int argc, char *argv[]) +static void +check_subnormal (void) +{ + long double d, e; + mpfr_t x; + + d = 17.0; + mpfr_init2 (x, MPFR_LDBL_MANT_DIG); + while (d != 0.0) + { + mpfr_set_ld (x, d, MPFR_RNDN); + e = mpfr_get_ld (x, MPFR_RNDN); + if (e != d) + { + printf ("Error for mpfr_get_ld o mpfr_set_ld\n"); + printf ("d=%Le\n", d); + printf ("x="); mpfr_dump (x); + printf ("e=%Le\n", e); + exit (1); + } + d *= 0.5; + } + mpfr_clear (x); +} + +static void +check_overflow (void) { long double d, e; mpfr_t x; int i; - mpfr_exp_t emax; -#ifdef WITH_FPU_CONTROL - fpu_control_t cw; - if (argc > 1) + mpfr_init2 (x, MPFR_LDBL_MANT_DIG); + for (i = 0; i < 2; i++) + { + d = i == 0 ? LDBL_MAX : -LDBL_MAX; + mpfr_set_ld (x, d, MPFR_RNDN); + mpfr_mul_2ui (x, x, 1, MPFR_RNDN); + e = mpfr_get_ld (x, MPFR_RNDN); + if (! DOUBLE_ISINF (e) || (i == 0 ? (e < 0) : (e > 0))) + { + printf ("Error in check_overflow.\n"); + printf ("d=%Le\n", d); + printf ("x="); mpfr_dump (x); + printf ("e=%Le\n", e); + exit (1); + } + } + mpfr_clear (x); +} + +/* issue reported by Sisyphus on powerpc */ +static void +test_20140212 (void) +{ + mpfr_t fr1, fr2; + long double ld, h, l, ld2; + int i, c1, c2; + + mpfr_init2 (fr1, 106); + mpfr_init2 (fr2, 2098); + + for (h = 1.0L, i = 0; i < 1023; i++) + h *= 2.0L; + for (l = 1.0L, i = 0; i < 1074; i++) + l *= 0.5L; + ld = h + l; /* rounding of 2^1023 + 2^(-1074) */ + + mpfr_set_ld (fr1, ld, MPFR_RNDN); + mpfr_set_ld (fr2, ld, MPFR_RNDN); + + c1 = mpfr_cmp_ld (fr1, ld); + c2 = mpfr_cmp_ld (fr2, ld); + + /* If long double is binary64, then ld = fr1 = fr2 = 2^1023. + If long double is double-double, then ld = 2^1023 + 2^(-1074), + fr1 = 2^1023 and fr2 = 2^1023 + 2^(-1074) */ + MPFR_ASSERTN(ld == h ? (c1 == 0) : (c1 < 0)); + + MPFR_ASSERTN(c2 == 0); + + ld2 = mpfr_get_ld (fr2, MPFR_RNDN); + MPFR_ASSERTN(ld2 == ld); + + mpfr_clear (fr1); + mpfr_clear (fr2); +} + +/* bug reported by Walter Mascarenhas + https://sympa.inria.fr/sympa/arc/mpfr/2016-09/msg00005.html */ +static void +bug_20160907 (void) +{ +#if HAVE_LDOUBLE_IEEE_EXT_LITTLE + long double dn, ld; + mpfr_t mp; + long e; + mpfr_long_double_t x; + + /* the following is the encoding of the smallest subnormal number + for HAVE_LDOUBLE_IEEE_EXT_LITTLE */ + x.s.manl = 1; + x.s.manh = 0; + x.s.expl = 0; + x.s.exph = 0; + x.s.sign= 0; + dn = x.ld; + e = -16445; + /* dn=2^e is now the smallest subnormal. */ + + mpfr_init2 (mp, 64); + mpfr_set_ui_2exp (mp, 1, e - 1, MPFR_RNDN); + ld = mpfr_get_ld (mp, MPFR_RNDU); + /* since mp = 2^(e-1) and ld is rounded upwards, we should have + ld = 2^e */ + if (ld != dn) + { + printf ("Error, ld = %Le <> dn = %Le\n", ld, dn); + printf ("mp="); + mpfr_out_str (stdout, 10, 0, mp, MPFR_RNDN); + printf ("\n"); + printf ("mp="); mpfr_dump (mp); + exit (1); + } + + /* check a few more numbers */ + for (e = -16446; e <= -16381; e++) { - cw = strtol(argv[1], NULL, 0); - printf ("FPU control word: 0x%x\n", (unsigned int) cw); - _FPU_SETCW (cw); + mpfr_set_ui_2exp (mp, 1, e, MPFR_RNDN); + ld = mpfr_get_ld (mp, MPFR_RNDU); + mpfr_set_ld (mp, ld, MPFR_RNDU); + /* mp is 2^e rounded up, thus should be >= 2^e */ + MPFR_ASSERTN(mpfr_cmp_ui_2exp (mp, 1, e) >= 0); + + mpfr_set_ui_2exp (mp, 1, e, MPFR_RNDN); + ld = mpfr_get_ld (mp, MPFR_RNDD); + mpfr_set_ld (mp, ld, MPFR_RNDD); + /* mp is 2^e rounded down, thus should be <= 2^e */ + if (mpfr_cmp_ui_2exp (mp, 3, e) > 0) + { + printf ("Error, expected value <= 2^%ld\n", e); + printf ("got "); mpfr_dump (mp); + exit (1); + } } + + mpfr_clear (mp); #endif +} - check_gcc33_bug (); - test_fixed_bugs (); +int +main (int argc, char *argv[]) +{ + volatile long double d, e, maxp2; + mpfr_t x; + int i; + mpfr_exp_t emax; tests_start_mpfr (); mpfr_test_init (); - mpfr_init2 (x, MPFR_LDBL_MANT_DIG); + check_gcc33_bug (); + test_fixed_bugs (); + + mpfr_init2 (x, MPFR_LDBL_MANT_DIG + 64); #if !defined(MPFR_ERRDIVZERO) /* check NaN */ mpfr_set_nan (x); d = mpfr_get_ld (x, MPFR_RNDN); - check_set_get (d, x); + check_set_get (d); #endif /* check +0.0 and -0.0 */ d = 0.0; - check_set_get (d, x); + check_set_get (d); d = DBL_NEG_ZERO; - check_set_get (d, x); + check_set_get (d); /* check that the sign of -0.0 is set */ mpfr_set_ld (x, DBL_NEG_ZERO, MPFR_RNDN); - if (MPFR_SIGN(x) > 0) + if (MPFR_IS_POS (x)) { +#if defined(HAVE_SIGNEDZ) printf ("Error: sign of -0.0 is not set correctly\n"); -#if _GMP_IEEE_FLOATS exit (1); +#else /* Non IEEE doesn't support negative zero yet */ + printf ("Warning: sign of -0.0 is not set correctly\n"); #endif } @@ -247,50 +542,76 @@ /* check +Inf */ mpfr_set_inf (x, 1); d = mpfr_get_ld (x, MPFR_RNDN); - check_set_get (d, x); + check_set_get (d); /* check -Inf */ mpfr_set_inf (x, -1); d = mpfr_get_ld (x, MPFR_RNDN); - check_set_get (d, x); + check_set_get (d); #endif /* check the largest power of two */ - d = 1.0; while (d < LDBL_MAX / 2.0) d += d; - check_set_get (d, x); - check_set_get (-d, x); + maxp2 = 1.0; + while (maxp2 < LDBL_MAX / 2.0) + maxp2 *= 2.0; + check_set_get (maxp2); + check_set_get (-maxp2); - /* check largest long double */ d = LDBL_MAX; - check_set_get (d, x); - check_set_get (-d, x); + e = d / 2.0; + if (e != maxp2) /* false under NetBSD/x86 */ + { + /* d = LDBL_MAX does not have excess precision. */ + check_set_get (d); + check_set_get (-d); + } /* check the smallest power of two */ d = 1.0; while ((e = d / 2.0) != (long double) 0.0 && e != d) d = e; - check_set_get (d, x); - check_set_get (-d, x); - - /* check largest 2^(2^k) that is representable as a long double */ - d = (LDBL_MAX / 2) + (LDBL_MAX / 4 * LDBL_EPSILON); - check_set_get (d, x); + check_set_get (d); + check_set_get (-d); - /* check that 2^i, 2^i+1 and 2^i-1 are correctly converted */ + /* check that 2^i, 2^i+1, 2^i-1 and 2^i-2^(i-2)-1 are correctly converted */ d = 1.0; - for (i = 1; i < MPFR_LDBL_MANT_DIG; i++) + for (i = 1; i < MPFR_LDBL_MANT_DIG + 8; i++) { d = 2.0 * d; /* d = 2^i */ - check_set_get (d, x); - check_set_get (d + 1.0, x); - check_set_get (d - 1.0, x); + check_set_get (d); + if (d + 1.0 != d) + check_set_get (d + 1.0); + else + { + mpfr_set_ui_2exp (x, 1, i, MPFR_RNDN); + mpfr_add_ui (x, x, 1, MPFR_RNDN); + e = mpfr_get_ld (x, MPFR_RNDN); + check_set_get (e); + } + if (d - 1.0 != d) + check_set_get (d - 1.0); + else + { + mpfr_set_ui_2exp (x, 1, i, MPFR_RNDN); + mpfr_sub_ui (x, x, 1, MPFR_RNDN); + e = mpfr_get_ld (x, MPFR_RNDN); + check_set_get (e); + } + if (i < 3) + continue; + /* The following test triggers a failure in r10844 for i = 56, + with gcc -mpc64 on x86 (64-bit ABI). */ + mpfr_set_ui_2exp (x, 3, i-2, MPFR_RNDN); + mpfr_sub_ui (x, x, 1, MPFR_RNDN); + e = mpfr_get_ld (x, MPFR_RNDN); + check_set_get (e); } for (i = 0; i < 10000; i++) { mpfr_urandomb (x, RANDS); d = mpfr_get_ld (x, MPFR_RNDN); - check_set_get (d, x); + check_set_get (d); } /* check with reduced emax to exercise overflow */ @@ -300,7 +621,7 @@ mpfr_set_ld (x, (long double) 2.0, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); for (d = (long double) 2.0, i = 0; i < 13; i++, d *= d); - /* now d = 2^8192 */ + /* now d = 2^8192, or an infinity (e.g. with double or double-double) */ mpfr_set_ld (x, d, MPFR_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); set_emax (emax); @@ -309,6 +630,14 @@ test_small (); + check_subnormal (); +#if !defined(MPFR_ERRDIVZERO) + check_overflow (); +#endif + + test_20140212 (); + bug_20160907 (); + tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tset_q.c mpfr4-4.0.2/tests/tset_q.c --- mpfr4-3.1.4/tests/tset_q.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/tests/tset_q.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_set_q. -Copyright 2000-2016 Free Software Foundation, Inc. +Copyright 2000-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,21 +17,20 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" +#ifndef MPFR_USE_MINI_GMP + static void check (long int n, long int d, mpfr_rnd_t rnd, const char *ys) { mpq_t q; mpfr_t x, t; int inexact, compare; - unsigned int flags, ex_flags; + mpfr_flags_t flags, ex_flags; mpfr_init2 (x, 53); mpfr_init2 (t, mpfr_get_prec (x) + mp_bits_per_limb); @@ -131,11 +130,11 @@ mpfr_init2 (mpfr_cmp, MPFR_PREC_MIN); mpfr_set_nan (mpfr_cmp); printf ("mpfr_set_q with a NAN mpq value returned a wrong value :\n" - " waiting for "); - mpfr_print_binary (mpfr_cmp); - printf (" got "); - mpfr_print_binary (mpfr_value); - printf ("\n trinary value is %d\n", status); + " expected "); + mpfr_dump (mpfr_cmp); + printf (" got "); + mpfr_dump (mpfr_value); + printf (" ternary value is %d\n", status); exit (1); } @@ -150,11 +149,11 @@ mpfr_init2 (mpfr_cmp, MPFR_PREC_MIN); mpfr_set_inf (mpfr_cmp, -1); printf ("mpfr_set_q with a -INF mpq value returned a wrong value :\n" - " waiting for "); - mpfr_print_binary (mpfr_cmp); - printf (" got "); - mpfr_print_binary (mpfr_value); - printf ("\n trinary value is %d\n", status); + " expected "); + mpfr_dump (mpfr_cmp); + printf (" got "); + mpfr_dump (mpfr_value); + printf (" ternary value is %d\n", status); exit (1); } @@ -184,3 +183,13 @@ tests_end_mpfr (); return 0; } + +#else + +int +main (void) +{ + return 77; +} + +#endif diff -Nru mpfr4-3.1.4/tests/tset_si.c mpfr4-4.0.2/tests/tset_si.c --- mpfr4-3.1.4/tests/tset_si.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tset_si.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ -/* Test file for mpfr_set_si and mpfr_set_ui. +/* Test file for mpfr_set_si, mpfr_set_ui, mpfr_get_si and mpfr_get_ui. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,16 +17,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include - #include "mpfr-test.h" -#define ERROR(str) {printf("Error for "str"\n"); exit(1);} +#define PRINT_ERROR(str) \ + do { printf ("Error for %s\n", str); exit (1); } while (0) static void test_2exp (void) @@ -37,58 +34,58 @@ mpfr_init2 (x, 32); mpfr_set_ui_2exp (x, 1, 0, MPFR_RNDN); - if (mpfr_cmp_ui(x, 1)) - ERROR("(1U,0)"); + if (mpfr_cmp_ui (x, 1) != 0) + PRINT_ERROR ("(1U,0)"); mpfr_set_ui_2exp (x, 1024, -10, MPFR_RNDN); - if (mpfr_cmp_ui(x, 1)) - ERROR("(1024U,-10)"); + if (mpfr_cmp_ui(x, 1) != 0) + PRINT_ERROR ("(1024U,-10)"); mpfr_set_ui_2exp (x, 1024, 10, MPFR_RNDN); - if (mpfr_cmp_ui(x, 1024*1024)) - ERROR("(1024U,+10)"); + if (mpfr_cmp_ui (x, 1024 * 1024) != 0) + PRINT_ERROR ("(1024U,+10)"); mpfr_set_si_2exp (x, -1024L * 1024L, -10, MPFR_RNDN); - if (mpfr_cmp_si(x, -1024)) - ERROR("(1M,-10)"); + if (mpfr_cmp_si (x, -1024) != 0) + PRINT_ERROR ("(1M,-10)"); mpfr_set_ui_2exp (x, 0x92345678, 16, MPFR_RNDN); - if (mpfr_cmp_str (x, "92345678@4", 16, MPFR_RNDN)) - ERROR("(x92345678U,+16)"); + if (mpfr_cmp_str (x, "92345678@4", 16, MPFR_RNDN) != 0) + PRINT_ERROR ("(x92345678U,+16)"); mpfr_set_si_2exp (x, -0x1ABCDEF0, -256, MPFR_RNDN); - if (mpfr_cmp_str (x, "-1ABCDEF0@-64", 16, MPFR_RNDN)) - ERROR("(-x1ABCDEF0,-256)"); + if (mpfr_cmp_str (x, "-1ABCDEF0@-64", 16, MPFR_RNDN) != 0) + PRINT_ERROR ("(-x1ABCDEF0,-256)"); mpfr_set_prec (x, 2); res = mpfr_set_si_2exp (x, 7, 10, MPFR_RNDU); - if (mpfr_cmp_ui (x, 1<<13) || res <= 0) - ERROR ("Prec 2 + si_2exp"); + if (mpfr_cmp_ui (x, 1<<13) != 0 || res <= 0) + PRINT_ERROR ("Prec 2 + si_2exp"); res = mpfr_set_ui_2exp (x, 7, 10, MPFR_RNDU); - if (mpfr_cmp_ui (x, 1<<13) || res <= 0) - ERROR ("Prec 2 + ui_2exp"); + if (mpfr_cmp_ui (x, 1<<13) != 0 || res <= 0) + PRINT_ERROR ("Prec 2 + ui_2exp"); mpfr_clear_flags (); mpfr_set_ui_2exp (x, 17, MPFR_EMAX_MAX, MPFR_RNDN); if (!mpfr_inf_p (x) || MPFR_IS_NEG (x)) - ERROR ("mpfr_set_ui_2exp and overflow (bad result)"); + PRINT_ERROR ("mpfr_set_ui_2exp and overflow (bad result)"); if (!mpfr_overflow_p ()) - ERROR ("mpfr_set_ui_2exp and overflow (overflow flag not set)"); + PRINT_ERROR ("mpfr_set_ui_2exp and overflow (overflow flag not set)"); mpfr_clear_flags (); mpfr_set_si_2exp (x, 17, MPFR_EMAX_MAX, MPFR_RNDN); if (!mpfr_inf_p (x) || MPFR_IS_NEG (x)) - ERROR ("mpfr_set_si_2exp (pos) and overflow (bad result)"); + PRINT_ERROR ("mpfr_set_si_2exp (pos) and overflow (bad result)"); if (!mpfr_overflow_p ()) - ERROR ("mpfr_set_si_2exp (pos) and overflow (overflow flag not set)"); + PRINT_ERROR ("mpfr_set_si_2exp (pos) and overflow (overflow flag not set)"); mpfr_clear_flags (); mpfr_set_si_2exp (x, -17, MPFR_EMAX_MAX, MPFR_RNDN); if (!mpfr_inf_p (x) || MPFR_IS_POS (x)) - ERROR ("mpfr_set_si_2exp (neg) and overflow (bad result)"); + PRINT_ERROR ("mpfr_set_si_2exp (neg) and overflow (bad result)"); if (!mpfr_overflow_p ()) - ERROR ("mpfr_set_si_2exp (neg) and overflow (overflow flag not set)"); + PRINT_ERROR ("mpfr_set_si_2exp (neg) and overflow (overflow flag not set)"); mpfr_clear (x); } @@ -100,6 +97,9 @@ mpfr_ptr p; int r; + /* Note: the ++'s below allow one to check that the corresponding + arguments are evaluated only once by the macros. */ + mpfr_inits (x[0], x[1], x[2], (mpfr_ptr) 0); p = x[0]; r = 0; @@ -143,6 +143,190 @@ mpfr_clear (x); } +static void +test_get_ui_smallneg (void) +{ + mpfr_t x; + int i; + + mpfr_init2 (x, 64); + + for (i = 1; i <= 4; i++) + { + int r; + + mpfr_set_si_2exp (x, -i, -2, MPFR_RNDN); + RND_LOOP (r) + { + long s; + unsigned long u; + + mpfr_clear_erangeflag (); + s = mpfr_get_si (x, r != MPFR_RNDF ? (mpfr_rnd_t) r : MPFR_RNDA); + if (mpfr_erangeflag_p ()) + { + printf ("ERROR for get_si + ERANGE + small negative op" + " for rnd = %s and x = -%d/4\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r), i); + exit (1); + } + u = mpfr_get_ui (x, (mpfr_rnd_t) r); + if (u != 0) + { + printf ("ERROR for get_ui + ERANGE + small negative op" + " for rnd = %s and x = -%d/4\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r), i); + printf ("Expected 0, got %lu\n", u); + exit (1); + } + if ((s == 0) ^ !mpfr_erangeflag_p ()) + { + const char *Not = s == 0 ? "" : " not"; + + printf ("ERROR for get_ui + ERANGE + small negative op" + " for rnd = %s and x = -%d/4\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r), i); + printf ("The rounding integer (%ld) is%s representable in " + "unsigned long,\nbut the erange flag is%s set.\n", + s, Not, Not); + exit (1); + } + } + } + + mpfr_clear (x); +} + +/* Test mpfr_get_si and mpfr_get_ui, on values around some particular + * integers (see ts[] and tu[]): x = t?[i] + j/4, where '?' is 's' or + * 'u', and j is an integer from -8 to 8. + */ +static void get_tests (void) +{ + mpfr_exp_t emin, emax; + mpfr_t x, z; + long ts[5] = { LONG_MIN, LONG_MAX, -17, 0, 17 }; + unsigned long tu[3] = { 0, ULONG_MAX, 17 }; + int s, i, j, odd, ctr = 0; + int inex; + int r; + + emin = mpfr_get_emin (); + emax = mpfr_get_emax (); + + /* We need the bitsize of an unsigned long + 3 bits (1 additional bit for + * the cases >= ULONG_MAX + 1; 2 additional bits for the fractional part). + */ + mpfr_init2 (x, sizeof (unsigned long) * CHAR_BIT + 3); + + mpfr_init2 (z, MPFR_PREC_MIN); + mpfr_set_ui_2exp (z, 1, -2, MPFR_RNDN); /* z = 1/4 */ + + for (s = 1; s >= 0; s--) + for (i = 0; i < (s ? 5 : 3); i++) + { + odd = (s ? (unsigned long) ts[i] : tu[i]) & 1; + inex = s ? + mpfr_set_si (x, ts[i], MPFR_RNDN) : + mpfr_set_ui (x, tu[i], MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + inex = mpfr_sub_ui (x, x, 2, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + for (j = -8; j <= 8; j++) + { + /* Test x = t?[i] + j/4 in each non-RNDF rounding mode... */ + RND_LOOP_NO_RNDF (r) + { + mpfr_flags_t ex_flags, flags; + int e, k, overflow; + + ctr++; /* for the check below */ + + /* Let's determine k such that the rounded integer should + be t?[i] + k, assuming an unbounded exponent range. */ + k = (j + 8 + + (MPFR_IS_LIKE_RNDD (r, MPFR_SIGN (x)) ? 0 : + MPFR_IS_LIKE_RNDU (r, MPFR_SIGN (x)) ? 3 : + 2)) / 4 - 2; + if (r == MPFR_RNDN && ((unsigned int) j & 3) == 2 && + ((odd + k) & 1)) + k--; /* even rounding */ + + /* Overflow cases. Note that with the above choices: + _ t?[0] == minval(type) + _ t?[1] == maxval(type) + */ + overflow = (i == 0 && k < 0) || (i == 1 && k > 0); + + /* Expected flags. Note that in case of overflow, only the + erange flag is set. Otherwise, the result is inexact iff + j mod 1 != 0, i.e. the last two bits are not 00. */ + ex_flags = overflow ? MPFR_FLAGS_ERANGE + : ((unsigned int) j & 3) != 0 ? MPFR_FLAGS_INEXACT : 0; + + mpfr_clear_flags (); + +#define GET_TESTS_TEST(TYPE,TZ,F,C,FMT) \ + do { \ + TYPE a, d; \ + \ + a = TZ[i] + (overflow ? 0 : k); \ + if (e) \ + { \ + mpfr_exp_t ex; \ + ex = MPFR_GET_EXP (x); \ + set_emin (ex); \ + set_emax (ex); \ + } \ + d = F (x, (mpfr_rnd_t) r); \ + flags = __gmpfr_flags; \ + set_emin (emin); \ + set_emax (emax); \ + if (flags != ex_flags || a != d) \ + { \ + printf ("Error in get_tests for " #F " on %s%s\n", \ + mpfr_print_rnd_mode ((mpfr_rnd_t) r), \ + e ? ", reduced exponent range" : ""); \ + printf ("x = t" C "[%d] + (%d/4) = ", i, j); \ + mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); \ + printf ("\n--> k = %d\n", k); \ + printf ("Expected %l" FMT "\n", a); \ + printf ("Got %l" FMT "\n", d); \ + printf ("Expected flags:"); \ + flags_out (ex_flags); \ + printf ("Got flags: "); \ + flags_out (flags); \ + exit (1); \ + } \ + } while (0) + + for (e = 0; e < 2; e++) + { + if (e && MPFR_IS_ZERO (x)) + break; + if (s) + GET_TESTS_TEST (long, + ts, mpfr_get_si, "s", "d"); + else + GET_TESTS_TEST (unsigned long, + tu, mpfr_get_ui, "u", "u"); + } + } + inex = mpfr_add (x, x, z, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + } + } + + /* Check that we have tested everything: 8 = 5 + 3 integers t?[i] + * with 17 = 8 - (-8) + 1 additional terms (j/4) for each integer, + * and each non-RNDF rounding mode. + */ + MPFR_ASSERTN (ctr == 8 * 17 * ((int) MPFR_RND_MAX - 1)); + + mpfr_clear (x); + mpfr_clear (z); +} + /* FIXME: Comparing against mpfr_get_si/ui is not ideal, it'd be better to have all tests examine the bits in mpfr_t for what should come out. */ @@ -159,9 +343,11 @@ tests_start_mpfr (); + get_tests (); + mpfr_init2 (x, 100); - N = (argc==1) ? 100000 : atol (argv[1]); + N = (argc == 1) ? 100000 : atol (argv[1]); for (k = 1; k <= N; k++) { @@ -215,21 +401,17 @@ mpfr_set_prec (x, 3); inex = mpfr_set_si (x, 77617, MPFR_RNDD); /* should be 65536 */ - if (MPFR_MANT(x)[0] != ((mp_limb_t)1 << (mp_bits_per_limb-1)) - || inex >= 0) + if (MPFR_MANT(x)[0] != MPFR_LIMB_HIGHBIT || inex >= 0) { printf ("Error in mpfr_set_si(x:3, 77617, MPFR_RNDD)\n"); - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); exit (1); } inex = mpfr_set_ui (x, 77617, MPFR_RNDD); /* should be 65536 */ - if (MPFR_MANT(x)[0] != ((mp_limb_t)1 << (mp_bits_per_limb-1)) - || inex >= 0) + if (MPFR_MANT(x)[0] != MPFR_LIMB_HIGHBIT || inex >= 0) { printf ("Error in mpfr_set_ui(x:3, 77617, MPFR_RNDD)\n"); - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); exit (1); } @@ -345,7 +527,7 @@ MPFR_ASSERTN (mpfr_get_ui (x, MPFR_RNDD) == 0); MPFR_ASSERTN (mpfr_get_si (x, MPFR_RNDD) == 0); - /* Test for ERANGE flag + correct behaviour if overflow */ + /* Test for ERANGE flag + correct behavior if overflow */ mpfr_set_prec (x, 256); mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); mpfr_clear_erangeflag (); @@ -402,16 +584,16 @@ } mpfr_set_nan (x); - mpfr_clear_erangeflag (); + mpfr_clear_flags (); d = mpfr_get_ui (x, MPFR_RNDN); - if (d != 0 || !mpfr_erangeflag_p ()) + if (d != 0 || __gmpfr_flags != MPFR_FLAGS_ERANGE) { printf ("ERROR for get_ui + NaN\n"); exit (1); } mpfr_clear_erangeflag (); d = mpfr_get_si (x, MPFR_RNDN); - if (d != 0 || !mpfr_erangeflag_p ()) + if (d != 0 || __gmpfr_flags != MPFR_FLAGS_ERANGE) { printf ("ERROR for get_si + NaN\n"); exit (1); @@ -459,6 +641,7 @@ test_2exp (); test_macros (); test_macros_keyword (); + test_get_ui_smallneg (); tests_end_mpfr (); return 0; } diff -Nru mpfr4-3.1.4/tests/tset_sj.c mpfr4-4.0.2/tests/tset_sj.c --- mpfr4-3.1.4/tests/tset_sj.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tset_sj.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* Test file for mpfr_set_sj, mpfr_set_uj, mpfr_set_sj_2exp and mpfr_set_uj_2exp. -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,17 +18,14 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* Needed due to the inclusion of mpfr-intmax.h */ #ifdef HAVE_CONFIG_H -# include "config.h" /* for a build within gmp */ +# include "config.h" #endif -#include -#include -#include - #include "mpfr-intmax.h" #include "mpfr-test.h" @@ -42,7 +39,8 @@ #else -#define ERROR(str) {printf("Error for "str"\n"); exit(1);} +#define PRINT_ERROR(str) \ + do { printf ("Error for %s\n", str); exit (1); } while (0) static int inexact_sign (int x) @@ -60,7 +58,7 @@ mpfr_inits2 (pmax, x, y, (mpfr_ptr) 0); - for ( p = pmin ; p < pmax ; p++) + for (p = pmin ; p < pmax ; p++) { mpfr_set_prec (x, p); mpfr_set_prec (y, p); @@ -91,14 +89,14 @@ mpfr_set_prec (x, sizeof(uintmax_t)*CHAR_BIT); inex1 = mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); if (inex1 != 0 || mpfr_sgn(x) <= 0) - ERROR ("inexact / UINTMAX_MAX"); + PRINT_ERROR ("inexact / UINTMAX_MAX"); inex1 = mpfr_add_ui (x, x, 1, MPFR_RNDN); if (inex1 != 0 || !mpfr_powerof2_raw (x) - || MPFR_EXP (x) != (sizeof(uintmax_t)*CHAR_BIT+1) ) - ERROR ("power of 2"); + || MPFR_EXP (x) != sizeof(uintmax_t) * CHAR_BIT + 1) + PRINT_ERROR ("power of 2"); mpfr_set_uj (x, 0, MPFR_RNDN); if (!MPFR_IS_ZERO (x)) - ERROR ("Setting 0"); + PRINT_ERROR ("Setting 0"); mpfr_clears (x, y, (mpfr_ptr) 0); } @@ -113,30 +111,30 @@ inex = mpfr_set_uj_2exp (x, 1, 0, MPFR_RNDN); if (inex || mpfr_cmp_ui(x, 1)) - ERROR("(1U,0)"); + PRINT_ERROR ("(1U,0)"); inex = mpfr_set_uj_2exp (x, 1024, -10, MPFR_RNDN); if (inex || mpfr_cmp_ui(x, 1)) - ERROR("(1024U,-10)"); + PRINT_ERROR ("(1024U,-10)"); inex = mpfr_set_uj_2exp (x, 1024, 10, MPFR_RNDN); if (inex || mpfr_cmp_ui(x, 1024L * 1024L)) - ERROR("(1024U,+10)"); + PRINT_ERROR ("(1024U,+10)"); inex = mpfr_set_uj_2exp (x, MPFR_UINTMAX_MAX, 1000, MPFR_RNDN); inex |= mpfr_div_2ui (x, x, 1000, MPFR_RNDN); inex |= mpfr_add_ui (x, x, 1, MPFR_RNDN); if (inex || !mpfr_powerof2_raw (x) - || MPFR_EXP (x) != (sizeof(uintmax_t)*CHAR_BIT+1) ) - ERROR("(UINTMAX_MAX)"); + || MPFR_EXP (x) != sizeof(uintmax_t) * CHAR_BIT + 1) + PRINT_ERROR ("(UINTMAX_MAX)"); inex = mpfr_set_uj_2exp (x, MPFR_UINTMAX_MAX, MPFR_EMAX_MAX-10, MPFR_RNDN); if (inex == 0 || !mpfr_inf_p (x)) - ERROR ("Overflow"); + PRINT_ERROR ("Overflow"); inex = mpfr_set_uj_2exp (x, MPFR_UINTMAX_MAX, MPFR_EMIN_MIN-1000, MPFR_RNDN); if (inex == 0 || !MPFR_IS_ZERO (x)) - ERROR ("Underflow"); + PRINT_ERROR ("Underflow"); mpfr_clear (x); } @@ -152,12 +150,12 @@ inex = mpfr_set_sj (x, -MPFR_INTMAX_MAX, MPFR_RNDN); inex |= mpfr_add_si (x, x, -1, MPFR_RNDN); if (inex || mpfr_sgn (x) >=0 || !mpfr_powerof2_raw (x) - || MPFR_EXP (x) != (sizeof(intmax_t)*CHAR_BIT) ) - ERROR("set_sj (-INTMAX_MAX)"); + || MPFR_EXP (x) != sizeof(intmax_t) * CHAR_BIT) + PRINT_ERROR ("set_sj (-INTMAX_MAX)"); inex = mpfr_set_sj (x, 1742, MPFR_RNDN); if (inex || mpfr_cmp_ui (x, 1742)) - ERROR ("set_sj (1742)"); + PRINT_ERROR ("set_sj (1742)"); mpfr_clear (x); } @@ -172,8 +170,8 @@ inex = mpfr_set_sj_2exp (x, MPFR_INTMAX_MIN, 1000, MPFR_RNDN); if (inex || mpfr_sgn (x) >=0 || !mpfr_powerof2_raw (x) - || MPFR_EXP (x) != (sizeof(intmax_t)*CHAR_BIT+1000) ) - ERROR("set_sj_2exp (INTMAX_MIN)"); + || MPFR_EXP (x) != sizeof(intmax_t) * CHAR_BIT + 1000) + PRINT_ERROR ("set_sj_2exp (INTMAX_MIN)"); mpfr_clear (x); } diff -Nru mpfr4-3.1.4/tests/tset_str.c mpfr4-4.0.2/tests/tset_str.c --- mpfr4-3.1.4/tests/tset_str.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tset_str.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_set_str. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include - #include "mpfr-test.h" #define N 30000 @@ -31,11 +29,10 @@ mpfr_set_str_binary (x, t); \ if (mpfr_cmp (x, y)) \ { \ - printf ("Error in mpfr_set_str (%d):\n", n); \ - mpfr_print_binary (x); \ - puts (""); \ - mpfr_print_binary (y); \ - puts (""); \ + printf ("Error in mpfr_set_str (%d):\nexpected ", n); \ + mpfr_dump (x); \ + printf ("got "); \ + mpfr_dump (y); \ mpfr_clear (x); \ mpfr_clear (y); \ exit (1); \ @@ -66,7 +63,7 @@ /* check overflow */ emax = mpfr_get_emax (); - set_emax (1073741823); /* 2^30-1 */ + set_emax (1073741821); /* 2^30-3 */ mpfr_set_str (a, "2E1000000000", 10, MPFR_RNDN); if (!mpfr_inf_p (a) || mpfr_sgn (a) < 0) { @@ -96,13 +93,28 @@ mpfr_clear (x); } +static void +bug20180908 (void) +{ + mpfr_t x, y; + const char s[] = "ssq4"; + + mpfr_init2 (x, 12); + mpfr_init2 (y, 12); + mpfr_set_str_binary (x, "0.100010111010E24"); + /* x = 9150464 = [4, 52, 54, 54] in base 55 */ + mpfr_set_str (y, s, 55, MPFR_RNDN); + MPFR_ASSERTN (mpfr_equal_p (x, y)); + mpfr_clear (x); + mpfr_clear (y); +} + int main (int argc, char *argv[]) { mpfr_t x, y; - unsigned long k, bd, nc, i; - char *str, *str2; - mpfr_exp_t e; + long nc, i; + char *str; int base, logbase, prec, baseprec, ret, obase; tests_start_mpfr (); @@ -120,34 +132,59 @@ return 0; } - mpfr_init2 (x, 2); - nc = (argc > 1) ? atoi(argv[1]) : 53; if (nc < 100) nc = 100; - bd = randlimb () & 8; + str = (char *) tests_allocate (nc); + + mpfr_init2 (x, nc + 10); - str2 = str = (char*) tests_allocate (nc); +#define NR 50 - if (bd) + for (i = 0; i < NR; i++) { - for(k = 1; k <= bd; k++) - *(str2++) = (randlimb () & 1) + '0'; - } - else - *(str2++) = '0'; + char *str2 = str; + long bd, k, lz; - *(str2++) = '.'; + bd = randlimb () & 8; /* 0 or 8 */ + lz = -bd; - for (k = 1; k < nc - 17 - bd; k++) - *(str2++) = '0' + (char) (randlimb () & 1); + if (bd) + { + for (k = 1; k <= bd; k++, str2++) + { + *str2 = '0' + (randlimb () & 1); + if (lz == -bd && *str2 != '0') + lz = k - bd; /* position of the first 1 */ + } + } + else + *(str2++) = '0'; - *(str2++) = 'e'; - sprintf (str2, "%d", (int) (randlimb () & INT_MAX) + INT_MIN/2); + *(str2++) = '.'; - mpfr_set_prec (x, nc + 10); - mpfr_set_str_binary (x, str); + for (k = 1; k < nc - 17 - bd; k++, str2++) + { + *str2 = '0' + (randlimb () & 1); + if (lz == -bd && *str2 != '0') + lz = k; /* position of the first 1 */ + } + + *(str2++) = 'e'; + + /* Half cases have an exponent around zero, the other half cases + have the minimum exponent for which the value is representable + (not a subnormal). */ + sprintf (str2, "%" MPFR_EXP_FSPEC "d", i < NR/2 ? + ((mpfr_eexp_t) (randlimb () & 0xff) - 0x80) : + ((mpfr_eexp_t) mpfr_get_emin () + lz - 1)); + + /* if (i >= NR/2) printf ("lz = %ld, str: %s\n", lz, str); */ + mpfr_set_str_binary (x, str); + } + + tests_free (str, nc); mpfr_set_prec (x, 54); mpfr_set_str_binary (x, "0.100100100110110101001010010101111000001011100100101010E-529"); @@ -156,10 +193,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (1a):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -170,17 +205,13 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (1b):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); } - tests_free (str, nc); - mpfr_set_prec (x, 53); mpfr_set_str_binary (x, "+110101100.01010000101101000000100111001000101011101110E00"); @@ -214,9 +245,10 @@ prec = 53; mpfr_set_prec (x, prec); mpfr_set_prec (y, prec); - for (i=0;i id for rnd_mode=%s\n", mpfr_print_rnd_mode (rnd)); printf ("x="); - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); printf ("s=%s, exp=%d, base=%d\n", str, (int) e, base); printf ("y="); - mpfr_print_binary (y); - puts (""); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -262,21 +293,21 @@ /* if (mpfr_set_str (x, "@Inf@garbage", i, MPFR_RNDN) != 0 || - !mpfr_inf_p(x) || MPFR_SIGN(x) < 0) + !mpfr_inf_p(x) || MPFR_IS_NEG (x)) { printf ("mpfr_set_str failed on @Inf@garbage\n"); exit (1); } if (mpfr_set_str (x, "-@Inf@garbage", i, MPFR_RNDN) != 0 || - !mpfr_inf_p(x) || MPFR_SIGN(x) > 0) + !mpfr_inf_p(x) || MPFR_IS_POS (x)) { printf ("mpfr_set_str failed on -@Inf@garbage\n"); exit (1); } if (mpfr_set_str (x, "+@Inf@garbage", i, MPFR_RNDN) != 0 || - !mpfr_inf_p(x) || MPFR_SIGN(x) < 0) + !mpfr_inf_p(x) || MPFR_IS_NEG (x)) { printf ("mpfr_set_str failed on +@Inf@garbage\n"); exit (1); @@ -294,21 +325,21 @@ } if (mpfr_set_str (x, "Inf", i, MPFR_RNDN) != 0 || - !mpfr_inf_p(x) || MPFR_SIGN(x) < 0) + !mpfr_inf_p(x) || MPFR_IS_NEG (x)) { printf ("mpfr_set_str failed on Inf\n"); exit (1); } if (mpfr_set_str (x, "-Inf", i, MPFR_RNDN) != 0 || - !mpfr_inf_p(x) || MPFR_SIGN(x) > 0) + !mpfr_inf_p(x) || MPFR_IS_POS (x)) { printf ("mpfr_set_str failed on -Inf\n"); exit (1); } if (mpfr_set_str (x, "+Inf", i, MPFR_RNDN) != 0 || - !mpfr_inf_p(x) || MPFR_SIGN(x) < 0) + !mpfr_inf_p(x) || MPFR_IS_NEG (x)) { printf ("mpfr_set_str failed on +Inf\n"); exit (1); @@ -334,10 +365,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (2):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -355,10 +384,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (3):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -379,10 +406,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (4):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -398,10 +423,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (5):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -415,10 +438,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (6):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -432,10 +453,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (7):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -450,10 +469,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (8):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -464,10 +481,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (9):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -478,10 +493,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (10):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -492,10 +505,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (11):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -506,10 +517,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (12):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -520,10 +529,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (13):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -534,10 +541,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (14):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -548,10 +553,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (15):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -562,10 +565,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (16):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -576,10 +577,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (17):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -590,10 +589,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (18):\n"); - mpfr_print_binary (x); - puts (""); - mpfr_print_binary (y); - puts (""); + mpfr_dump (x); + mpfr_dump (y); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -794,11 +791,9 @@ "rnd=%s:\n", (unsigned int) nb_digit, base[cbase], mpfr_print_rnd_mode (rnd[crnd])); printf ("instead of: "); - mpfr_print_binary (x); - puts (""); + mpfr_dump (x); printf ("return : "); - mpfr_print_binary (y); - puts (""); + mpfr_dump (y); exit (1); } } @@ -808,16 +803,17 @@ /* end of tests added by Alain Delplanque */ - /* check that flags are correctly cleared */ mpfr_set_nan (x); mpfr_set_str (x, "+0.0", 10, MPFR_RNDN); - if (!mpfr_number_p(x) || mpfr_cmp_ui (x, 0) != 0 || mpfr_sgn (x) < 0) + if (MPFR_NOTZERO (x) || MPFR_IS_NEG (x)) { printf ("x <- +0.0 failed after x=NaN\n"); exit (1); } + + mpfr_set_nan (x); mpfr_set_str (x, "-0.0", 10, MPFR_RNDN); - if (!mpfr_number_p(x) || mpfr_cmp_ui (x, 0) != 0 || mpfr_sgn (x) > 0) + if (MPFR_NOTZERO (x) || MPFR_IS_POS (x)) { printf ("x <- -0.0 failed after x=NaN\n"); exit (1); @@ -864,6 +860,7 @@ check_underflow (); bug20081028 (); + bug20180908 (); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tset_z.c mpfr4-4.0.2/tests/tset_z.c --- mpfr4-3.1.4/tests/tset_z.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tset_z.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_set_z. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include - #include "mpfr-test.h" static void check0(void) diff -Nru mpfr4-3.1.4/tests/tset_z_exp.c mpfr4-4.0.2/tests/tset_z_exp.c --- mpfr4-3.1.4/tests/tset_z_exp.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tset_z_exp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_set_z_2exp. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include - #include "mpfr-test.h" static mpfr_exp_t @@ -62,6 +58,14 @@ exit (1); } } + + /* coverage test for huge exponent */ + mpz_setbit (y, GMP_NUMB_BITS); + mpfr_clear_flags (); + inexact = mpfr_set_z_2exp (x, y, mpfr_get_emax_max(), MPFR_RNDN); + MPFR_ASSERTN(inexact > 0); + MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); + MPFR_ASSERTN(mpfr_overflow_p ()); mpfr_clear(x); mpz_clear(y); } diff -Nru mpfr4-3.1.4/tests/tsgn.c mpfr4-4.0.2/tests/tsgn.c --- mpfr4-3.1.4/tests/tsgn.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsgn.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* tsgn -- Test for the sign of a floating point number. -Copyright 2003, 2006-2016 Free Software Foundation, Inc. +Copyright 2003, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,10 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - +#define MPFR_TESTS_TSGN 1 #include "mpfr-test.h" static void diff -Nru mpfr4-3.1.4/tests/tsin.c mpfr4-4.0.2/tests/tsin.c --- mpfr4-3.1.4/tests/tsin.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsin.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_sin. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include - #include "mpfr-test.h" #ifdef CHECK_EXTERNAL @@ -109,7 +107,7 @@ mpfr_set_prec (x, p); mpfr_mul_ui (x, pid, k, MPFR_RNDD); test_sin (y, x, MPFR_RNDN); - if (MPFR_SIGN(y) > 0) + if (MPFR_IS_POS (y)) { printf ("Error in test_sign for sin(%dpi-epsilon), prec = %d" " for argument.\nResult should have been negative.\n", @@ -118,7 +116,7 @@ } mpfr_mul_ui (x, piu, k, MPFR_RNDU); test_sin (y, x, MPFR_RNDN); - if (MPFR_SIGN(y) < 0) + if (MPFR_IS_NEG (y)) { printf ("Error in test_sign for sin(%dpi+epsilon), prec = %d" " for argument.\nResult should have been positive.\n", @@ -365,7 +363,7 @@ mpfr_clear (c); mpfr_clear (x); - test_generic (2, 100, 15); + test_generic (MPFR_PREC_MIN, 100, 15); test_generic (MPFR_SINCOS_THRESHOLD-1, MPFR_SINCOS_THRESHOLD+1, 2); test_sign (); check_tiny (); diff -Nru mpfr4-3.1.4/tests/tsin_cos.c mpfr4-4.0.2/tests/tsin_cos.c --- mpfr4-3.1.4/tests/tsin_cos.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsin_cos.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_sin_cos. -Copyright 2000-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2000-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void @@ -197,12 +194,13 @@ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - if (! (mpfr_zero_p (x) && MPFR_SIGN (x) < 0)) + if (! (mpfr_zero_p (x) && MPFR_IS_NEG (x))) { printf ("Error in overflowed_sin_cos0 (rnd = %s):\n" - " Got sin = ", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (x); - printf (" instead of -0.\n"); + " Got sin = ", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); + mpfr_dump (x); + printf (" instead of -0.\n"); err = 1; } if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD) @@ -217,10 +215,10 @@ if (! mpfr_equal_p (y, z)) { printf ("Error in overflowed_sin_cos0 (rnd = %s):\n" - " Got cos = ", + " Got cos = ", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (y); - printf (" instead of 0.11111111E%d.\n", emax); + mpfr_dump (y); + printf (" instead of 0.11111111E%d.\n", emax); err = 1; } } @@ -233,13 +231,13 @@ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - if (! (mpfr_inf_p (y) && MPFR_SIGN (y) > 0)) + if (! (mpfr_inf_p (y) && MPFR_IS_POS (y))) { printf ("Error in overflowed_sin_cos0 (rnd = %s):\n" - " Got cos = ", + " Got cos = ", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); - mpfr_print_binary (y); - printf (" instead of +Inf.\n"); + mpfr_dump (y); + printf (" instead of +Inf.\n"); err = 1; } } @@ -582,6 +580,8 @@ mpfr_set_si (x, (j & 2) ? 1 : -1, MPFR_RNDN); mpfr_set_exp (x, mpfr_get_emin ()); rnd = (mpfr_rnd_t) (i % MPFR_RND_MAX); + if (rnd == MPFR_RNDF) + goto end; flags_before = 0; if (j & 4) mpfr_set_emax (-17); @@ -589,7 +589,7 @@ else { tests_default_random (x, 256, -5, 50, 0); - rnd = RND_RAND (); + rnd = RND_RAND_NO_RNDF (); flags_before = (randlimb () & 1) ? (unsigned int) (MPFR_FLAGS_ALL ^ MPFR_FLAGS_ERANGE) : (unsigned int) 0; @@ -629,6 +629,7 @@ flags_sin, flags_cos, flags, flags_ref); exit (1); } + end: mpfr_clears (x, s1, s2, c1, c2, (mpfr_ptr) 0); mpfr_set_emin (emin); mpfr_set_emax (emax); @@ -650,7 +651,7 @@ status_f = mpfr_sincos_fast (svalf, NULL, val, MPFR_RNDN); status = mpfr_sin_cos (sval, cval, val, MPFR_RNDN); - if (! mpfr_equal_p (svalf, sval) || SIGN (status_f) != SIGN (status)) + if (! mpfr_equal_p (svalf, sval) || VSIGN (status_f) != VSIGN (status)) { printf ("mpfr_sincos_fast differ from mpfr_sin_cos result:\n" " sin fast is "); diff -Nru mpfr4-3.1.4/tests/tsinh.c mpfr4-4.0.2/tests/tsinh.c --- mpfr4-3.1.4/tests/tsinh.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsinh.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_sinh. -Copyright 2001-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2001-2002, 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_sinh @@ -63,28 +60,28 @@ mpfr_clear_flags (); mpfr_set_str_binary (x, "1E1000000000"); i = mpfr_sinh (x, x, MPFR_RNDN); - MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_IS_POS (x)); MPFR_ASSERTN (mpfr_overflow_p ()); MPFR_ASSERTN (i == 1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); i = mpfr_sinh (x, x, MPFR_RNDN); - MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) < 0); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_IS_NEG (x)); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == -1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); i = mpfr_sinh (x, x, MPFR_RNDD); - MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) < 0); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_IS_NEG (x)); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == -1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); i = mpfr_sinh (x, x, MPFR_RNDU); - MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_SIGN (x) < 0); + MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_IS_NEG (x)); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == 1); @@ -98,7 +95,7 @@ special (); - test_generic (2, 100, 100); + test_generic (MPFR_PREC_MIN, 100, 100); data_check ("data/sinh", mpfr_sinh, "mpfr_sinh"); bad_cases (mpfr_sinh, mpfr_asinh, "mpfr_sinh", 256, -256, 255, diff -Nru mpfr4-3.1.4/tests/tsinh_cosh.c mpfr4-4.0.2/tests/tsinh_cosh.c --- mpfr4-3.1.4/tests/tsinh_cosh.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsinh_cosh.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_sinh_cosh. -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,16 +17,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) - static void failed (mpfr_t x, mpfr_t esh, mpfr_t gsh, mpfr_t ech, mpfr_t gch) { @@ -130,14 +125,3 @@ tests_end_mpfr (); return 0; } - -#else - -int -main (void) -{ - printf ("Warning! Test disabled for this MPFR version.\n"); - return 0; -} - -#endif diff -Nru mpfr4-3.1.4/tests/tsi_op.c mpfr4-4.0.2/tests/tsi_op.c --- mpfr4-3.1.4/tests/tsi_op.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsi_op.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* Test file for mpfr_add_si, mpfr_sub_si, mpfr_si_sub, mpfr_mul_si, mpfr_div_si, mpfr_si_div -Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,22 +18,25 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" -#define ERROR1(s, i, z, exp) \ -{\ - printf("Error for "s" and i=%d\n", i);\ - printf("Expected %s\n", exp);\ - printf("Got "); mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);\ - putchar ('\n');\ - exit(1);\ -} +/* TODO: Add generic tests for mpfr_si_sub and mpfr_si_div. + tgeneric_ui.c should probably be replaced by tgeneric.c, + with some changes, since tgeneric.c does more checks. */ + +#define PRINT_ERROR1(s,i,z,exp) \ + do \ + { \ + printf ("Error for " s " and i=%d\n", i); \ + printf ("Expected %s\n", exp); \ + printf ("Got "); mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN); \ + putchar ('\n'); \ + exit(1); \ + } \ + while (0) const struct { const char * op1; @@ -57,7 +60,12 @@ mpfr_set_ui (x, 0xC, MPFR_RNDN); mpfr_si_sub (x, -1, x, MPFR_RNDD); /* -0001 - 1100 = - 1101 --> -1 0000 */ - if (mpfr_cmp_si (x, -0x10) ) + /* If MPFR_PREC_MIN = 2, then x is first set to 12 exactly, then we get + -13 which is rounded down to -16. + If MPFR_PREC_MIN = 1, then x is first set to 16 exactly, then we get + -17 which is rounded down to -32. */ + if ((MPFR_PREC_MIN == 2 && mpfr_cmp_si (x, -0x10)) || + (MPFR_PREC_MIN == 1 && mpfr_cmp_si (x, -0x20))) { printf ("Special rounding error\n"); exit (1); @@ -109,37 +117,37 @@ y = tab[i].op2; mpfr_add_si (z, x, y, MPFR_RNDZ); if (mpfr_cmp_str (z, tab[i].res_add, 16, MPFR_RNDN)) - ERROR1("add_si", i, z, tab[i].res_add); + PRINT_ERROR1 ("add_si", i, z, tab[i].res_add); mpfr_sub_si (z, x, y, MPFR_RNDZ); if (mpfr_cmp_str (z, tab[i].res_sub, 16, MPFR_RNDN)) - ERROR1("sub_si", i, z, tab[i].res_sub); + PRINT_ERROR1 ("sub_si", i, z, tab[i].res_sub); mpfr_si_sub (z, y, x, MPFR_RNDZ); mpfr_neg (z, z, MPFR_RNDZ); if (mpfr_cmp_str (z, tab[i].res_sub, 16, MPFR_RNDN)) - ERROR1("si_sub", i, z, tab[i].res_sub); + PRINT_ERROR1 ("si_sub", i, z, tab[i].res_sub); mpfr_mul_si (z, x, y, MPFR_RNDZ); if (mpfr_cmp_str (z, tab[i].res_mul, 16, MPFR_RNDN)) - ERROR1("mul_si", i, z, tab[i].res_mul); + PRINT_ERROR1 ("mul_si", i, z, tab[i].res_mul); mpfr_div_si (z, x, y, MPFR_RNDZ); if (mpfr_cmp_str (z, tab[i].res_div, 16, MPFR_RNDN)) - ERROR1("div_si", i, z, tab[i].res_div); + PRINT_ERROR1 ("div_si", i, z, tab[i].res_div); } mpfr_set_str1 (x, "1"); mpfr_si_div (z, 1024, x, MPFR_RNDN); if (mpfr_cmp_str1 (z, "1024")) - ERROR1("si_div", i, z, "1024"); + PRINT_ERROR1 ("si_div", i, z, "1024"); mpfr_si_div (z, -1024, x, MPFR_RNDN); if (mpfr_cmp_str1 (z, "-1024")) - ERROR1("si_div", i, z, "-1024"); + PRINT_ERROR1 ("si_div", i, z, "-1024"); mpfr_clears (x, z, (mpfr_ptr) 0); check_invert (); - test_generic_add_si (2, 200, 17); - test_generic_sub_si (2, 200, 17); - test_generic_mul_si (2, 200, 17); - test_generic_div_si (2, 200, 17); + test_generic_add_si (MPFR_PREC_MIN, 200, 17); + test_generic_sub_si (MPFR_PREC_MIN, 200, 17); + test_generic_mul_si (MPFR_PREC_MIN, 200, 17); + test_generic_div_si (MPFR_PREC_MIN, 200, 17); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tsprintf.c mpfr4-4.0.2/tests/tsprintf.c --- mpfr4-3.1.4/tests/tsprintf.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsprintf.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,7 +1,7 @@ /* tsprintf.c -- test file for mpfr_sprintf, mpfr_vsprintf, mpfr_snprintf, and mpfr_vsnprintf -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -18,13 +18,17 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_STDARG +/* Needed due to the tests on HAVE_STDARG and MPFR_USE_MINI_GMP */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#if defined(HAVE_STDARG) && !defined(MPFR_USE_MINI_GMP) #include -#include #include #ifdef HAVE_LOCALE_H @@ -33,8 +37,6 @@ #include "mpfr-test.h" -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) - const int prec_max_printf = 5000; /* limit for random precision in random_double() */ #define BUF_SIZE 65536 @@ -46,13 +48,15 @@ const char nan_str[] = "nan"; const char nan_uc_str[] = "NAN"; +int randsize; + /* 1. compare expected string with the string BUFFER returned by mpfr_sprintf(buffer, fmt, x) 2. then test mpfr_snprintf (buffer, p, fmt, x) with a random p. */ static int check_sprintf (const char *expected, const char *fmt, mpfr_srcptr x) { - int n0, n1, p; + int n0, n1; char buffer[BUF_SIZE]; /* test mpfr_sprintf */ @@ -66,35 +70,39 @@ } /* test mpfr_snprintf */ - p = (int) (randlimb () % n0); - if (p == 0 && (randlimb () & 1) == 0) + randsize = (int) (randlimb () % (n0 + 3)) - 3; /* between -3 and n0 - 1 */ + if (randsize < 0) { n1 = mpfr_snprintf (NULL, 0, fmt, x); } else { - buffer[p] = 17; - n1 = mpfr_snprintf (buffer, p, fmt, x); - if (buffer[p] != 17) + buffer[randsize] = 17; + n1 = mpfr_snprintf (buffer, randsize, fmt, x); + if (buffer[randsize] != 17) { - printf ("Buffer overflow in mpfr_snprintf for p = %d!\n", p); + printf ("Buffer overflow in mpfr_snprintf for randsize = %d!\n", + randsize); exit (1); } } if (n0 != n1) { printf ("Error in mpfr_snprintf (s, %d, \"%s\", x) return value\n", - p, fmt); - printf ("expected: %d\ngot: %d\n", n0, n1); + randsize, fmt); + printf ("expected: %d\ngot: %d\nx='", n0, n1); + mpfr_printf (fmt, x); + printf ("'\n"); exit (1); } - if ((p > 1 && strncmp (expected, buffer, p-1) != 0) - || (p == 1 && buffer[0] != '\0')) + if ((randsize > 1 && strncmp (expected, buffer, randsize - 1) != 0) + || (randsize == 1 && buffer[0] != '\0')) { char part_expected[BUF_SIZE]; - strncpy (part_expected, expected, p); - part_expected[p-1] = '\0'; - printf ("Error in mpfr_vsnprintf (s, %d, \"%s\", ...);\n", p, fmt); + strncpy (part_expected, expected, randsize); + part_expected[randsize - 1] = '\0'; + printf ("Error in mpfr_vsnprintf (s, %d, \"%s\", ...);\n", + randsize, fmt); printf ("expected: \"%s\"\ngot: \"%s\"\n", part_expected, buffer); exit (1); } @@ -107,63 +115,63 @@ static int check_vsprintf (const char *expected, const char *fmt, ...) { - int n0, n1, p; + int n0, n1; char buffer[BUF_SIZE]; va_list ap0, ap1; - va_start (ap0, fmt); - va_start (ap1, fmt); + va_start (ap0, fmt); n0 = mpfr_vsprintf (buffer, fmt, ap0); + va_end (ap0); + if (strcmp (buffer, expected) != 0) { printf ("Error in mpfr_vsprintf (s, \"%s\", ...);\n", fmt); printf ("expected: \"%s\"\ngot: \"%s\"\n", expected, buffer); - - va_end (ap0); - va_end (ap1); exit (1); } - va_end (ap0); + + va_start (ap1, fmt); /* test mpfr_snprintf */ - p = (int) (randlimb () % n0); - if (p == 0 && (randlimb () & 1) == 0) + randsize = (int) (randlimb () % (n0 + 3)) - 3; /* between -3 and n0 - 1 */ + if (randsize < 0) { n1 = mpfr_vsnprintf (NULL, 0, fmt, ap1); } else { - buffer[p] = 17; - n1 = mpfr_vsnprintf (buffer, p, fmt, ap1); - if (buffer[p] != 17) + buffer[randsize] = 17; + n1 = mpfr_vsnprintf (buffer, randsize, fmt, ap1); + if (buffer[randsize] != 17) { - printf ("Buffer overflow in mpfr_vsnprintf for p = %d!\n", p); + printf ("Buffer overflow in mpfr_vsnprintf for randsize = %d!\n", + randsize); exit (1); } } + + va_end (ap1); + if (n0 != n1) { printf ("Error in mpfr_vsnprintf (s, %d, \"%s\", ...) return value\n", - p, fmt); + randsize, fmt); printf ("expected: %d\ngot: %d\n", n0, n1); - - va_end (ap1); exit (1); } - if ((p > 1 && strncmp (expected, buffer, p-1) != 0) - || (p == 1 && buffer[0] != '\0')) + if ((randsize > 1 && strncmp (expected, buffer, randsize - 1) != 0) + || (randsize == 1 && buffer[0] != '\0')) { char part_expected[BUF_SIZE]; - strncpy (part_expected, expected, p); - part_expected[p-1] = '\0'; - printf ("Error in mpfr_vsnprintf (s, %d, \"%s\", ...);\n", p, fmt); - printf ("expected: \"%s\"\ngot: \"%s\"\n", part_expected, buffer); - va_end (ap1); + strncpy (part_expected, expected, randsize); + part_expected[randsize - 1] = '\0'; + printf ("Error in mpfr_vsnprintf (s, %d, \"%s\", ...);\n", + randsize, fmt); + printf ("expected: \"%s\"\ngot: \"%s\"\n", part_expected, buffer); exit (1); } - va_end (ap1); return n0; } @@ -224,6 +232,22 @@ /* specifier 'P' for precision */ check_vsprintf ("128", "%Pu", p); check_vsprintf ("00128", "%.5Pu", p); + check_vsprintf (" 128", "%5Pu", p); + check_vsprintf ("000128", "%06Pu", p); + check_vsprintf ("128 :", "%-7Pu:", p); + check_vsprintf ("000128:", "%-2.6Pd:", p); + check_vsprintf (" 000128:", "%8.6Pd:", p); + check_vsprintf ("000128 :", "%-8.6Pd:", p); + check_vsprintf ("+128:", "%+d:", p); + check_vsprintf (" 128:", "% d:", p); + check_vsprintf ("80:", "% x:", p); + check_vsprintf ("0x80:", "% #x:", p); + check_vsprintf ("0x80:", "%0#+ -x:", p); + check_vsprintf ("0200:", "%0#+ -o:", p); + check_vsprintf ("+0000128 :", "%0+ *.*Pd:", -9, 7, p); + check_vsprintf ("+12345 :", "%0+ -*.*Pd:", -9, -3, (mpfr_prec_t) 12345); + /* Do not add a test like "%05.1Pd" as MS Windows is buggy: when + a precision is given, the '0' flag must be ignored. */ /* special numbers */ mpfr_set_inf (x, 1); @@ -322,6 +346,8 @@ /* sign or space, decimal point, left justified */ check_sprintf (" 1.8E+07 ", "%- #11.1RDE", x); check_sprintf (" 1.E+07 ", "%- #11.0RDE", x); + /* large requested precision */ + check_sprintf ("18993474.61279296875", "%.2147483647Rg", x); /* negative numbers */ mpfr_mul_si (x, x, -1, MPFR_RNDD); @@ -370,7 +396,7 @@ check_sprintf ("1.00 ", "%-#20.3RG", x); check_sprintf ("0.9999 ", "%-#20.4RG", x); - /* multiple of 10 */ + /* powers of 10 */ mpfr_set_str (x, "1e17", 10, MPFR_RNDN); check_sprintf ("1e+17", "%Re", x); check_sprintf ("1.000e+17", "%.3Re", x); @@ -392,7 +418,7 @@ check_sprintf ("1", "%.0RUf", x); check_sprintf ("1", "%.0RYf", x); - /* multiple of 10 with 'g' style */ + /* powers of 10 with 'g' style */ mpfr_set_str (x, "10", 10, MPFR_RNDN); check_sprintf ("10", "%Rg", x); check_sprintf ("1e+01", "%.0Rg", x); @@ -409,6 +435,12 @@ check_sprintf ("1e+03", "%.0Rg", x); check_sprintf ("1e+03", "%.3Rg", x); check_sprintf ("1000", "%.4Rg", x); + check_sprintf ("1e+03", "%.3Rg", x); + check_sprintf ("1000", "%.4Rg", x); + check_sprintf (" 1e+03", "%9.3Rg", x); + check_sprintf (" 1000", "%9.4Rg", x); + check_sprintf ("00001e+03", "%09.3Rg", x); + check_sprintf ("000001000", "%09.4Rg", x); mpfr_ui_div (x, 1, x, MPFR_RNDN); check_sprintf ("0.001", "%Rg", x); @@ -420,6 +452,10 @@ check_sprintf ("1e+05", "%.0Rg", x); check_sprintf ("1e+05", "%.5Rg", x); check_sprintf ("100000", "%.6Rg", x); + check_sprintf (" 1e+05", "%17.5Rg", x); + check_sprintf (" 100000", "%17.6Rg", x); + check_sprintf ("0000000000001e+05", "%017.5Rg", x); + check_sprintf ("00000000000100000", "%017.6Rg", x); mpfr_ui_div (x, 1, x, MPFR_RNDN); check_sprintf ("1e-05", "%Rg", x); @@ -555,6 +591,9 @@ mpfr_set_str (x, "-9.996", 10, MPFR_RNDN); check_sprintf ("-10.0", "%.1Rf", x); + /* regression in MPFR 3.1.0 (bug introduced in r7761, fixed in r7931) */ + check_sprintf ("-10", "%.2Rg", x); + mpfr_clears (x, z, (mpfr_ptr) 0); return 0; } @@ -787,7 +826,7 @@ int n1; int n2; int i = 121; -#ifndef NPRINTF_L +#ifdef PRINTF_L long double d = 1. / 31.; #endif mpf_t mpf; @@ -795,6 +834,7 @@ mpz_t mpz; mpfr_t x; mpfr_rnd_t rnd; + int k; mpf_init (mpf); mpf_set_ui (mpf, 40); @@ -814,21 +854,41 @@ x); check_vsprintf ("-12345678.9, 121", "%.1Rf, %i", x, i); check_vsprintf ("-12345678, 1e240/45b352", "%.0R*f, %Qx", MPFR_RNDZ, x, mpq); - n1 = check_vsprintf ("121, -12345678.875000000000, 1.290323", "%i, %.*Rf, %Ff%n", - i, 12, x, mpf, &n2); - if (n1 != n2) - { - printf ("error in number of characters written by mpfr_vsprintf\n"); - printf ("expected: %d\n", n2); - printf (" got: %d\n", n1); - exit (1); + + /* TODO: Systematically test with and without %n in check_vsprintf? */ + /* Do the test several times due to random parameters in check_vsprintf + and the use of %n. In r11501, n2 is incorrect (seems random) when + randsize <= 0, i.e. when the size argument of mpfr_vsnprintf is 0. */ + for (k = 0; k < 30; k++) + { + n2 = -17; + /* If this value is obtained for n2 after the check_vsprintf call below, + this probably means that n2 has not been written as expected. */ + n1 = check_vsprintf ("121, -12345678.875000000000, 1.290323", + "%i, %.*Rf, %Ff%n", i, 12, x, mpf, &n2); + if (n1 != n2) + { + printf ("error in number of characters written by mpfr_vsprintf" + " for k = %d, randsize = %d\n", k, randsize); + printf ("expected: %d\n", n2); + printf (" got: %d\n", n1); + exit (1); + } } -#ifndef NPRINTF_L +#ifdef PRINTF_L + /* under MinGW, -D__USE_MINGW_ANSI_STDIO is required to support %Lf + see https://gcc.gnu.org/ml/gcc/2013-03/msg00103.html */ check_vsprintf ("00000010610209857723, -1.2345678875e+07, 0.032258", "%.*Zi, %R*e, %Lf", 20, mpz, rnd, x, d); #endif + /* check invalid spec.spec */ + check_vsprintf ("%,", "%,"); + + /* check empty format */ + check_vsprintf ("%", "%"); + mpf_clear (mpf); mpq_clear (mpq); mpz_clear (mpz); @@ -836,12 +896,12 @@ return 0; } -#if MPFR_LCONV_DPTS +#if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE) && MPFR_LCONV_DPTS /* Check with locale "da_DK". On most platforms, decimal point is ',' and thousands separator is '.'; the test is not performed if this is not the case or if the locale doesn't exist. */ -static int +static void locale_da_DK (void) { mpfr_prec_t p = 128; @@ -850,7 +910,16 @@ if (setlocale (LC_ALL, "da_DK") == 0 || localeconv()->decimal_point[0] != ',' || localeconv()->thousands_sep[0] != '.') - return 0; + { + setlocale (LC_ALL, "C"); + + if (getenv ("MPFR_CHECK_LOCALES") == NULL) + return; + + fprintf (stderr, + "Cannot test the da_DK locale (not found or inconsistent).\n"); + exit (1); + } mpfr_init2 (x, p); @@ -869,22 +938,31 @@ check_sprintf (" 000000018.993.474,61279296875", "%' 030.19RG", x); check_sprintf (" 00000000000018.993.474,612793", "%' 030RF", x); - mpfr_set_ui (x, 50, MPFR_RNDN); +#define T1 "000" +#define T2 ".000" +#define S1 T1 T1 T1 T1 T1 T1 T1 T1 T1 T1 T1 T1 T1 T1 T1 T1 +#define S2 T2 T2 T2 T2 T2 T2 T2 T2 T2 T2 T2 T2 T2 T2 T2 T2 "," + + mpfr_set_ui (x, 48, MPFR_RNDN); mpfr_exp10 (x, x, MPFR_RNDN); - check_sprintf ("100000000000000000000000000000000000000000000000000", "%.0Rf", - x); - check_sprintf - ("100.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000,", - "%'#.0Rf", x); - check_sprintf - ("100.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000,0000", - "%'.4Rf", x); + check_sprintf ("1" S1, "%.0Rf", x); + check_sprintf ("1" S2, "%'#.0Rf", x); + check_sprintf ("1" S2 "0000", "%'.4Rf", x); + mpfr_mul_ui (x, x, 10, MPFR_RNDN); + check_sprintf ("10" S1, "%.0Rf", x); + check_sprintf ("10" S2, "%'#.0Rf", x); + check_sprintf ("10" S2 "0000", "%'.4Rf", x); + mpfr_mul_ui (x, x, 10, MPFR_RNDN); + check_sprintf ("100" S1, "%.0Rf", x); + check_sprintf ("100" S2, "%'#.0Rf", x); + check_sprintf ("100" S2 "0000", "%'.4Rf", x); mpfr_clear (x); - return 0; + + setlocale (LC_ALL, "C"); } -#endif /* MPFR_LCONV_DPTS */ +#endif /* ... && MPFR_LCONV_DPTS */ /* check concordance between mpfr_asprintf result with a regular mpfr float and with a regular double float */ @@ -900,8 +978,8 @@ '+', ' ', '#', - '0', /* no ambiguity: first zeros are flag zero*/ - '\'' + '0', /* no ambiguity: first zeros are flag zero */ + '\'' /* SUS extension */ }; /* no 'a': mpfr and glibc do not have the same semantic */ char specifier[] = @@ -965,8 +1043,12 @@ *ptr_mpfr++ = *ptr++ = '%'; /* random specifier 'e', 'f', 'g', 'E', 'F', or 'G' */ spec = (int) (randlimb() % 6); - /* random flags, but no ' flag with %e */ + /* random flags, but no ' flag with %e or with non-glibc */ +#if __MPFR_GLIBC(1,0) jmax = (spec == 0 || spec == 3) ? 5 : 6; +#else + jmax = 5; +#endif for (j = 0; j < jmax; j++) { if (randlimb() % 3 == 0) @@ -996,7 +1078,7 @@ the sign of a zero exponent (the C99 rationale says: "The sign of a zero exponent in %e format is unspecified. The committee knows of different implementations and choose not to require - implementations to document their behaviour in this case + implementations to document their behavior in this case (by making this be implementation defined behaviour). Most implementations use a "+" sign, e.g., 1.2e+00; but there is at least one implementation that uses the sign of the unlimited @@ -1151,8 +1233,8 @@ printf ("(>LONG_MAX)\n"); else printf ("%ld\n", (long) e); - printf ("Expected %s\n", s2); - printf ("Got %s\n", s1); + printf ("Expected '%s'\n", s2); + printf ("Got '%s'\n", s1); exit (1); } @@ -1251,34 +1333,295 @@ check_emin_aux (MPFR_EMIN_MIN); } +static void +test20161214 (void) +{ + mpfr_t x; + char buf[32]; + const char s[] = "0x0.fffffffffffff8p+1024"; + int r; + + mpfr_init2 (x, 64); + mpfr_set_str (x, s, 16, MPFR_RNDN); + r = mpfr_snprintf (buf, 32, "%.*RDf", -2, x); + MPFR_ASSERTN(r == 316); + r = mpfr_snprintf (buf, 32, "%.*RDf", INT_MIN + 1, x); + MPFR_ASSERTN(r == 316); + r = mpfr_snprintf (buf, 32, "%.*RDf", INT_MIN, x); + MPFR_ASSERTN(r == 316); + mpfr_clear (x); +} + +/* http://gforge.inria.fr/tracker/index.php?func=detail&aid=21056 */ +static void +bug21056 (void) +{ + mpfr_t x; + const char s[] = "0x0.fffffffffffff8p+1024"; + int ndigits, r; + + mpfr_init2 (x, 64); + + mpfr_set_str (x, s, 16, MPFR_RNDN); + + ndigits = 1000; + r = mpfr_snprintf (0, 0, "%.*RDf", ndigits, x); + /* the return value should be ndigits + 310 */ + MPFR_ASSERTN(r == ndigits + 310); + + ndigits = INT_MAX - 310; + r = mpfr_snprintf (0, 0, "%.*RDf", ndigits, x); + MPFR_ASSERTN(r == INT_MAX); + + ndigits = INT_MAX - 10; + r = mpfr_snprintf (0, 0, "%.*RDa", ndigits, x); + MPFR_ASSERTN(r == INT_MAX); + + ndigits = INT_MAX - 7; + r = mpfr_snprintf (0, 0, "%.*RDe", ndigits, x); + MPFR_ASSERTN(r == INT_MAX); + + ndigits = 1000; + r = mpfr_snprintf (0, 0, "%.*RDg", ndigits, x); + /* since trailing zeros are removed with %g, we get less digits */ + MPFR_ASSERTN(r == 309); + + ndigits = INT_MAX; + r = mpfr_snprintf (0, 0, "%.*RDg", ndigits, x); + /* since trailing zeros are removed with %g, we get less digits */ + MPFR_ASSERTN(r == 309); + + ndigits = INT_MAX - 1; + r = mpfr_snprintf (0, 0, "%#.*RDg", ndigits, x); + MPFR_ASSERTN(r == ndigits + 1); + + mpfr_clear (x); +} + +/* Fails for i = 5, i.e. t[i] = (size_t) UINT_MAX + 1, + with r11427 on 64-bit machines (4-byte int, 8-byte size_t). + On such machines, t[5] converted to int typically gives 0. + Note: the assumed behavior corresponds to the snprintf behavior + in ISO C, but this conflicts with POSIX: + https://sourceware.org/bugzilla/show_bug.cgi?id=14771#c2 + http://austingroupbugs.net/view.php?id=761 +*/ +static void +snprintf_size (void) +{ + mpfr_t x; + char buf[12]; + const char s[] = "17.00000000"; + size_t t[] = { 11, 12, 64, INT_MAX, (size_t) INT_MAX + 1, + (size_t) UINT_MAX + 1, (size_t) UINT_MAX + 2, + (size_t) -1 }; + int i, r; + + mpfr_init2 (x, 64); + mpfr_set_ui (x, 17, MPFR_RNDN); + + for (i = 0; i < sizeof (t) / sizeof (*t); i++) + { + memset (buf, 0, sizeof (buf)); + /* r = snprintf (buf, t[i], "%.8f", 17.0); */ + r = mpfr_snprintf (buf, t[i], "%.8Rf", x); + if (r != 11 || (t[i] > 11 && strcmp (buf, s) != 0)) + { + printf ("Error in snprintf_size for i = %d:\n", i); + printf ("expected r = 11, \"%s\"\n", s); + printf ("got r = %d, \"%s\"\n", r, buf); + exit (1); + } + } + + mpfr_clear (x); +} + +/* With r11516, n2 gets a random value for i = 0 only! + valgrind detects a problem for "nchar = buf.curr - buf.start;" + in the spec.spec == 'n' case. Indeed, there is no buffer when + size is 0. */ +static void +percent_n (void) +{ + int err = 0, i, j; + + for (i = 0; i < 24; i++) + for (j = 0; j < 3; j++) + { + volatile int n1, n2; + char buffer[64]; + + memset (buffer, 0, 64); + n2 = -17; + n1 = mpfr_snprintf (buffer, i % 8, "%d%n", 123, &n2); + if (n1 != 3 || n2 != 3) + { + printf ("Error 1 in percent_n: i = %d, n1 = %d, n2 = %d\n", + i, n1, n2); + err = 1; + } + } + + if (err) + exit (1); +} + +#if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE) + +/* The following tests should be equivalent to those from test_locale() + in tprintf.c (remove the \n at the end of the test strings). */ + +static void +test_locale (void) +{ + const char * const tab_locale[] = { + "en_US", + "en_US.iso88591", + "en_US.iso885915", + "en_US.utf8" + }; + int i; + mpfr_t x; + char v[] = "99999999999999999999999.5"; + + for (i = 0; i < numberof(tab_locale); i++) + { + char *s; + + s = setlocale (LC_ALL, tab_locale[i]); + + if (s != NULL && MPFR_THOUSANDS_SEPARATOR == ',') + break; + } + + if (i == numberof(tab_locale)) + { + if (getenv ("MPFR_CHECK_LOCALES") == NULL) + return; + + fprintf (stderr, "Cannot find a locale with ',' thousands separator.\n" + "Please install one of the en_US based locales.\n"); + exit (1); + } + + mpfr_init2 (x, 113); + mpfr_set_ui (x, 10000, MPFR_RNDN); + + check_sprintf ("(1) 10000=10,000 ", "(1) 10000=%'Rg ", x); + check_sprintf ("(2) 10000=10,000.000000 ", "(2) 10000=%'Rf ", x); + + mpfr_set_ui (x, 1000, MPFR_RNDN); + check_sprintf ("(3) 1000=1,000.000000 ", "(3) 1000=%'Rf ", x); + + for (i = 1; i <= sizeof (v) - 3; i++) + { + char buf[64]; + int j; + + strcpy (buf, "(4) 10^i=1"); + for (j = i; j > 0; j--) + strcat (buf, ",0" + (j % 3 != 0)); + strcat (buf, " "); + mpfr_set_str (x, v + sizeof (v) - 3 - i, 10, MPFR_RNDN); + check_sprintf (buf, "(4) 10^i=%'.0Rf ", x); + } + +#define N0 20 + + for (i = 1; i <= N0; i++) + { + char s[N0+4], buf[64]; + int j; + + s[0] = '1'; + for (j = 1; j <= i; j++) + s[j] = '0'; + s[i+1] = '\0'; + + strcpy (buf, "(5) 10^i=1"); + for (j = i; j > 0; j--) + strcat (buf, ",0" + (j % 3 != 0)); + strcat (buf, " "); + + mpfr_set_str (x, s, 10, MPFR_RNDN); + + check_sprintf (buf, "(5) 10^i=%'.0RNf ", x); + check_sprintf (buf, "(5) 10^i=%'.0RZf ", x); + check_sprintf (buf, "(5) 10^i=%'.0RUf ", x); + check_sprintf (buf, "(5) 10^i=%'.0RDf ", x); + check_sprintf (buf, "(5) 10^i=%'.0RYf ", x); + + strcat (s + (i + 1), ".5"); + check_sprintf (buf, "(5) 10^i=%'.0Rf ", x); + } + + mpfr_set_str (x, "1000", 10, MPFR_RNDN); + check_sprintf ("00000001e+03", "%'012.3Rg", x); + check_sprintf ("00000001,000", "%'012.4Rg", x); + check_sprintf ("000000001,000", "%'013.4Rg", x); + +#ifdef PRINTF_GROUPFLAG + check_vsprintf ("+01,234,567 :", "%0+ -'13.10Pd:", (mpfr_prec_t) 1234567); +#endif + + mpfr_clear (x); +} + +#else + +static void +test_locale (void) +{ + if (getenv ("MPFR_CHECK_LOCALES") != NULL) + { + fprintf (stderr, "Cannot test locales.\n"); + exit (1); + } +} + +#endif + int main (int argc, char **argv) { - char *locale; + int k; tests_start_mpfr (); #if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE) /* currently, we just check with 'C' locale */ - locale = setlocale (LC_ALL, "C"); + setlocale (LC_ALL, "C"); #endif bug20111102 (); - native_types (); - hexadecimal (); - binary (); - decimal (); - mixed (); - check_emax (); - check_emin (); -#if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE) -#if MPFR_LCONV_DPTS - locale_da_DK (); - /* Avoid a warning by doing the setlocale outside of this #if */ -#endif - setlocale (LC_ALL, locale); + for (k = 0; k < 40; k++) + { + native_types (); + hexadecimal (); + binary (); + decimal (); + +#if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE) && MPFR_LCONV_DPTS + locale_da_DK (); +#else + if (getenv ("MPFR_CHECK_LOCALES") != NULL) + { + fprintf (stderr, "Cannot test locales.\n"); + exit (1); + } #endif + } + + check_emax (); + check_emin (); + test20161214 (); + bug21056 (); + snprintf_size (); + percent_n (); + mixed (); + test_locale (); if (getenv ("MPFR_CHECK_LIBC_PRINTF")) { @@ -1292,17 +1635,6 @@ return 0; } -#else /* MPFR_VERSION */ - -int -main (void) -{ - printf ("Warning! Test disabled for this MPFR version.\n"); - return 0; -} - -#endif /* MPFR_VERSION */ - #else /* HAVE_STDARG */ int diff -Nru mpfr4-3.1.4/tests/tsqr.c mpfr4-4.0.2/tests/tsqr.c --- mpfr4-3.1.4/tests/tsqr.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsqr.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_sqr. -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_sqr @@ -70,7 +67,7 @@ { mpfr_urandomb (x, RANDS); if (MPFR_IS_PURE_FP(x)) - for (r = 0 ; r < MPFR_RND_MAX ; r++) + RND_LOOP_NO_RNDF (r) { inexact1 = mpfr_mul (y, x, x, (mpfr_rnd_t) r); inexact2 = mpfr_sqr (z, x, (mpfr_rnd_t) r); @@ -121,6 +118,41 @@ mpfr_clear (x); } +/* check ax < __gmpfr_emin with rnd_mode == MPFR_RNDN, rb = 0 and sb <> 0 */ +static void +test_underflow (void) +{ + mpfr_t x, y; + mpfr_exp_t emin; + + emin = mpfr_get_emin (); + mpfr_set_emin (0); + + mpfr_init2 (x, 24); + mpfr_init2 (y, 24); + + mpfr_set_ui_2exp (x, 11863283, -24, MPFR_RNDN); + /* x^2 = 0.011111111111111111111111101101100111111010101001*2^(-48) + thus we have an underflow */ + mpfr_clear_underflow (); + mpfr_sqr (y, x, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (y, 1, -1) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + mpfr_set_prec (x, 69); + mpfr_set_prec (y, 69); + mpfr_set_str_binary (x, "0.101101010000010011110011001100111111100111011110011001001000010001011"); + mpfr_clear_underflow (); + mpfr_sqr (y, x, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (y, 1, -1) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + mpfr_clear (y); + mpfr_clear (x); + + mpfr_set_emin (emin); +} + /* Test of a bug seen with GCC 4.5.2 and GMP 5.0.1 on m68k (m68000 target). https://sympa.inria.fr/sympa/arc/mpfr/2011-05/msg00003.html https://sympa.inria.fr/sympa/arc/mpfr/2011-05/msg00041.html @@ -156,6 +188,156 @@ #endif } +static void +coverage (mpfr_prec_t pmax) +{ + mpfr_prec_t p; + + for (p = MPFR_PREC_MIN; p <= pmax; p++) + { + mpfr_t a, b, c; + int inex; + mpfr_exp_t emin; + + mpfr_init2 (a, p); + mpfr_init2 (b, p); + mpfr_init2 (c, p); + + /* exercise carry in most significant bits of a, with overflow */ + mpfr_set_ui_2exp (b, 1, mpfr_get_emax (), MPFR_RNDZ); + mpfr_sqrt (b, b, MPFR_RNDU); + mpfr_div_2exp (c, b, 1, MPFR_RNDN); + mpfr_sqr (c, c, MPFR_RNDN); + mpfr_clear_flags (); + inex = mpfr_sqr (a, b, MPFR_RNDN); + /* if EXP(c) > emax-2, there is overflow */ + if (mpfr_get_exp (c) > mpfr_get_emax () - 2) + { + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_inf_p (a) && mpfr_sgn (a) > 0); + MPFR_ASSERTN(mpfr_overflow_p ()); + } + else /* no overflow */ + { + /* 2^p-1 is a square only for p=1 */ + MPFR_ASSERTN((p == 1 && inex == 0) || (p > 1 && inex < 0)); + MPFR_ASSERTN(!mpfr_overflow_p ()); + mpfr_set_ui_2exp (c, 1, mpfr_get_emax (), MPFR_RNDZ); + MPFR_ASSERTN(mpfr_equal_p (a, c)); + } + + /* same as above, with RNDU */ + mpfr_set_ui_2exp (b, 1, mpfr_get_emax (), MPFR_RNDZ); + mpfr_sqrt (b, b, MPFR_RNDU); + mpfr_div_2exp (c, b, 1, MPFR_RNDN); + mpfr_sqr (c, c, MPFR_RNDU); + mpfr_clear_flags (); + inex = mpfr_sqr (a, b, MPFR_RNDU); + /* if EXP(c) > emax-2, there is overflow */ + if (mpfr_get_exp (c) > mpfr_get_emax () - 2) + { + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_inf_p (a) && mpfr_sgn (a) > 0); + MPFR_ASSERTN(mpfr_overflow_p ()); + } + else /* no overflow */ + { + /* 2^p-1 is a square only for p=1 */ + MPFR_ASSERTN((p == 1 && inex == 0) || (p > 1 && inex < 0)); + MPFR_ASSERTN(!mpfr_overflow_p ()); + mpfr_set_ui_2exp (c, 1, mpfr_get_emax (), MPFR_RNDZ); + MPFR_ASSERTN(mpfr_equal_p (a, c)); + } + + /* exercise trivial overflow */ + mpfr_set_ui_2exp (b, 1, mpfr_get_emax (), MPFR_RNDZ); + mpfr_sqrt (b, b, MPFR_RNDU); + mpfr_mul_2exp (b, b, 1, MPFR_RNDN); + mpfr_clear_flags (); + inex = mpfr_sqr (a, b, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_inf_p (a) && mpfr_sgn (a) > 0); + MPFR_ASSERTN(mpfr_overflow_p ()); + + /* exercise trivial underflow */ + mpfr_set_ui_2exp (b, 1, mpfr_get_emin () - 1, MPFR_RNDZ); + mpfr_sqrt (b, b, MPFR_RNDU); + mpfr_div_2exp (b, b, 1, MPFR_RNDN); + mpfr_clear_flags (); + inex = mpfr_sqr (a, b, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_zero_p (a) && mpfr_signbit (a) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + /* exercise square between 0.5*2^emin and its predecessor (emin even) */ + emin = mpfr_get_emin (); + mpfr_set_emin (emin + (emin & 1)); /* now emin is even */ + mpfr_set_ui_2exp (b, 1, mpfr_get_emin () - 1, MPFR_RNDN); + inex = mpfr_sqrt (b, b, MPFR_RNDZ); + MPFR_ASSERTN(inex != 0); /* sqrt(2) is not exact */ + mpfr_mul_2exp (c, b, 1, MPFR_RNDN); + mpfr_sqr (c, c, MPFR_RNDN); + mpfr_clear_flags (); + inex = mpfr_sqr (a, b, MPFR_RNDN); + if (mpfr_get_exp (c) < mpfr_get_emin () + 2) /* underflow */ + { + /* if c > 0.5*2^(emin+1), we should round to 0.5*2^emin */ + if (mpfr_cmp_ui_2exp (c, 1, mpfr_get_emin ()) > 0) + { + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + } + else /* we should round to 0 */ + { + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_zero_p (a) && mpfr_signbit (a) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + } + } + else + { + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(!mpfr_underflow_p ()); + } + mpfr_set_emin (emin); + + /* exercise exact square root 2^(emin-2) for emin even */ + emin = mpfr_get_emin (); + mpfr_set_emin (emin + (emin & 1)); /* now emin is even */ + mpfr_set_ui_2exp (b, 1, (mpfr_get_emin () - 2) / 2, MPFR_RNDN); + inex = mpfr_sqr (a, b, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_zero_p (a) && mpfr_signbit (a) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + mpfr_set_emin (emin); + + /* same as above, for RNDU */ + emin = mpfr_get_emin (); + mpfr_set_emin (emin + (emin & 1)); /* now emin is even */ + mpfr_set_ui_2exp (b, 1, mpfr_get_emin () - 1, MPFR_RNDN); + inex = mpfr_sqrt (b, b, MPFR_RNDZ); + MPFR_ASSERTN(inex != 0); /* sqrt(2) is not exact */ + mpfr_mul_2exp (c, b, 1, MPFR_RNDN); + mpfr_sqr (c, c, MPFR_RNDU); + mpfr_clear_flags (); + inex = mpfr_sqr (a, b, MPFR_RNDU); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 1, mpfr_get_emin () - 1) == 0); + /* we have underflow if c < 2^(emin+1) */ + if (mpfr_cmp_ui_2exp (c, 1, mpfr_get_emin () + 1) < 0) + MPFR_ASSERTN(mpfr_underflow_p ()); + else + MPFR_ASSERTN(!mpfr_underflow_p ()); + mpfr_set_emin (emin); + + mpfr_clear (a); + mpfr_clear (b); + mpfr_clear (c); + } +} + int main (void) { @@ -163,13 +345,15 @@ tests_start_mpfr (); + coverage (1024); check_mpn_sqr (); - check_special (); - for (p = 2; p < 200; p++) + test_underflow (); + + for (p = MPFR_PREC_MIN; p < 200; p++) check_random (p); - test_generic (2, 200, 15); + test_generic (MPFR_PREC_MIN, 200, 15); data_check ("data/sqr", mpfr_sqr, "mpfr_sqr"); bad_cases (mpfr_sqr, mpfr_sqrt, "mpfr_sqr", 8, -256, 255, 4, 128, 800, 50); diff -Nru mpfr4-3.1.4/tests/tsqrt.c mpfr4-4.0.2/tests/tsqrt.c --- mpfr4-3.1.4/tests/tsqrt.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsqrt.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_sqrt. -Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Copyright 1999, 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #ifdef CHECK_EXTERNAL @@ -69,20 +66,20 @@ } static void -check4 (const char *as, mpfr_rnd_t rnd_mode, const char *Qs) +check4 (const char *as, mpfr_rnd_t rnd_mode, const char *qs) { mpfr_t q; mpfr_init2 (q, 53); mpfr_set_str1 (q, as); test_sqrt (q, q, rnd_mode); - if (mpfr_cmp_str (q, Qs, 16, MPFR_RNDN)) + if (mpfr_cmp_str (q, qs, 16, MPFR_RNDN)) { printf ("mpfr_sqrt failed for a=%s, rnd_mode=%s\n", - as, mpfr_print_rnd_mode(rnd_mode)); - printf ("expected "); + as, mpfr_print_rnd_mode (rnd_mode)); + printf ("expected %s\ngot ", qs); mpfr_out_str (stdout, 16, 0, q, MPFR_RNDN); - printf ("\ngot %s\n", Qs); + printf ("\n"); mpfr_clear (q); exit (1); } @@ -255,7 +252,7 @@ { printf ("Error: sqrt(1+ulp(1), up) should give 1.5 (prec=%u)\n", (unsigned int) p); - printf ("got "); mpfr_print_binary (x); puts (""); + printf ("got "); mpfr_dump (x); exit (1); } } @@ -279,8 +276,7 @@ if (mpfr_cmp_ui (z, 0) < 0) { printf ("Error: square root of 1 gives "); - mpfr_print_binary(z); - putchar('\n'); + mpfr_dump (z); exit (1); } @@ -323,7 +319,7 @@ /* case prec(result) << prec(input) */ mpfr_set_prec (z, 2); - for (p = 2; p < 1000; p++) + for (p = mpfr_get_prec (z); p < 1000; p++) { mpfr_set_prec (x, p); mpfr_set_ui (x, 1, MPFR_RNDN); @@ -354,11 +350,13 @@ mpfr_set_exp (x, GMP_NUMB_BITS); mpfr_add_ui (x, x, 1, MPFR_RNDN); /* now x = 2^(GMP_NUMB_BITS - 1) + 1 (GMP_NUMB_BITS bits) */ - MPFR_ASSERTN (mpfr_mul (x, x, x, MPFR_RNDN) == 0); /* exact */ + inexact = mpfr_mul (x, x, x, MPFR_RNDN); + MPFR_ASSERTN (inexact == 0); /* exact */ inexact = test_sqrt (z, x, MPFR_RNDN); /* even rule: z should be 2^(GMP_NUMB_BITS - 1) */ MPFR_ASSERTN (inexact < 0); - MPFR_ASSERTN (mpfr_cmp_ui_2exp (z, 1, GMP_NUMB_BITS - 1) == 0); + inexact = mpfr_cmp_ui_2exp (z, 1, GMP_NUMB_BITS - 1); + MPFR_ASSERTN (inexact == 0); mpfr_nextbelow (x); /* now x is just below [2^(GMP_NUMB_BITS - 1) + 1]^2 */ inexact = test_sqrt (z, x, MPFR_RNDN); @@ -429,7 +427,7 @@ mpfr_init2 (y, p); mpfr_init2 (z, 2*p); mpfr_urandomb (x, RANDS); - rnd = RND_RAND (); + rnd = RND_RAND_NO_RNDF (); inexact = test_sqrt (y, x, rnd); if (mpfr_mul (z, y, y, rnd)) /* exact since prec(z) = 2*prec(y) */ { @@ -442,12 +440,12 @@ ((inexact > 0) && (sign <= 0)) || ((inexact < 0) && (sign >= 0))) { - printf ("Error: wrong inexact flag, expected %d, got %d\n", - sign, inexact); + printf ("Error with rnd=%s: wrong ternary value, expected %d, got %d\n", + mpfr_print_rnd_mode (rnd), sign, inexact); printf ("x="); - mpfr_print_binary (x); - printf (" rnd=%s\n", mpfr_print_rnd_mode (rnd)); - printf ("y="); mpfr_print_binary (y); puts (""); + mpfr_dump (x); + printf ("y="); + mpfr_dump (y); exit (1); } mpfr_clear (x); @@ -598,6 +596,324 @@ mpfr_clear(y); } +/* Bug in mpfr_sqrt2 when prec(u) = 2*GMP_NUMB_BITS and the exponent of u is + odd: the last bit of u is lost. */ +static void +bug20160908 (void) +{ + mpfr_t r, u; + int n = GMP_NUMB_BITS, ret; + + mpfr_init2 (r, 2*n - 1); + mpfr_init2 (u, 2 * n); + mpfr_set_ui_2exp (u, 1, 2*n-2, MPFR_RNDN); /* u=2^(2n-2) with exp(u)=2n-1 */ + mpfr_nextabove (u); + /* now u = 2^(2n-2) + 1/2 */ + ret = mpfr_sqrt (r, u, MPFR_RNDZ); + MPFR_ASSERTN(ret == -1 && mpfr_cmp_ui_2exp (r, 1, n-1) == 0); + mpfr_clear (r); + mpfr_clear (u); +} + +static void +testall_rndf (mpfr_prec_t pmax) +{ + mpfr_t a, b, d; + mpfr_prec_t pa, pb; + + for (pa = MPFR_PREC_MIN; pa <= pmax; pa++) + { + mpfr_init2 (a, pa); + mpfr_init2 (d, pa); + for (pb = MPFR_PREC_MIN; pb <= pmax; pb++) + { + mpfr_init2 (b, pb); + mpfr_set_ui (b, 1, MPFR_RNDN); + while (mpfr_cmp_ui (b, 4) < 0) + { + mpfr_sqrt (a, b, MPFR_RNDF); + mpfr_sqrt (d, b, MPFR_RNDD); + if (!mpfr_equal_p (a, d)) + { + mpfr_sqrt (d, b, MPFR_RNDU); + if (!mpfr_equal_p (a, d)) + { + printf ("Error: mpfr_sqrt(a,b,RNDF) does not " + "match RNDD/RNDU\n"); + printf ("b="); mpfr_dump (b); + printf ("a="); mpfr_dump (a); + exit (1); + } + } + mpfr_nextabove (b); + } + mpfr_clear (b); + } + mpfr_clear (a); + mpfr_clear (d); + } +} + +/* test the case prec = GMP_NUMB_BITS */ +static void +test_sqrt1n (void) +{ + mpfr_t r, u; + int inex; + + mpfr_init2 (r, GMP_NUMB_BITS); + mpfr_init2 (u, GMP_NUMB_BITS); + + inex = mpfr_set_ui_2exp (u, 17 * 17, 2 * GMP_NUMB_BITS - 10, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + inex = mpfr_sqrt (r, u, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (r, 17, GMP_NUMB_BITS - 5) == 0); + + inex = mpfr_set_ui_2exp (u, 1, GMP_NUMB_BITS - 2, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + inex = mpfr_add_ui (u, u, 1, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + inex = mpfr_mul_2exp (u, u, GMP_NUMB_BITS, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + /* u = 2^(2*GMP_NUMB_BITS-2) + 2^GMP_NUMB_BITS, thus + u = r^2 + 2^GMP_NUMB_BITS with r = 2^(GMP_NUMB_BITS-1). + Should round to r+1 to nearest. */ + inex = mpfr_sqrt (r, u, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + inex = mpfr_sub_ui (r, r, 1, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (r, 1, GMP_NUMB_BITS - 1) == 0); + + mpfr_clear (r); + mpfr_clear (u); +} + +static void +check_overflow (void) +{ + mpfr_t r, u; + mpfr_prec_t p; + mpfr_exp_t emax; + int inex; + + emax = mpfr_get_emax (); + for (p = MPFR_PREC_MIN; p <= 1024; p++) + { + mpfr_init2 (r, p); + mpfr_init2 (u, p); + + mpfr_set_emax (-1); + mpfr_set_ui_2exp (u, 1, mpfr_get_emax () - 1, MPFR_RNDN); + mpfr_nextbelow (u); + mpfr_mul_2exp (u, u, 1, MPFR_RNDN); + /* now u = (1 - 2^(-p))*2^emax is the largest number < +Inf, + it square root is near 0.707 and has exponent 0 > emax */ + /* for RNDN, the result should be +Inf */ + inex = mpfr_sqrt (r, u, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_inf_p (r) && mpfr_sgn (r) > 0); + /* for RNDA, the result should be +Inf */ + inex = mpfr_sqrt (r, u, MPFR_RNDA); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_inf_p (r) && mpfr_sgn (r) > 0); + /* for RNDZ, the result should be u */ + inex = mpfr_sqrt (r, u, MPFR_RNDZ); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_equal_p (r, u)); + + mpfr_set_emax (0); + mpfr_set_ui_2exp (u, 1, mpfr_get_emax () - 1, MPFR_RNDN); + mpfr_nextbelow (u); + mpfr_mul_2exp (u, u, 1, MPFR_RNDN); + /* u = 1-2^(-p), its square root is > u, and should thus give +Inf when + rounding away */ + inex = mpfr_sqrt (r, u, MPFR_RNDA); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_inf_p (r) && mpfr_sgn (r) > 0); + + mpfr_clear (r); + mpfr_clear (u); + } + mpfr_set_emax (emax); +} + +static void +check_underflow (void) +{ + mpfr_t r, u; + mpfr_prec_t p; + mpfr_exp_t emin; + int inex; + + emin = mpfr_get_emin (); + for (p = MPFR_PREC_MIN; p <= 1024; p++) + { + mpfr_init2 (r, p); + mpfr_init2 (u, p); + + mpfr_set_emin (2); + mpfr_set_ui_2exp (u, 1, mpfr_get_emin () - 1, MPFR_RNDN); /* u = 2 */ + /* for RNDN, since sqrt(2) is closer from 2 than 0, the result is 2 */ + mpfr_clear_flags (); + inex = mpfr_sqrt (r, u, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_equal_p (r, u)); + MPFR_ASSERTN(mpfr_underflow_p ()); + /* for RNDA, the result should be u, and there is underflow for p > 1, + since for p=1 we have 1 < sqrt(2) < 2, but for p >= 2, sqrt(2) should + be rounded to a number <= 1.5, which is representable */ + mpfr_clear_flags (); + inex = mpfr_sqrt (r, u, MPFR_RNDA); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_equal_p (r, u)); + MPFR_ASSERTN((p == 1 && !mpfr_underflow_p ()) || + (p != 1 && mpfr_underflow_p ())); + /* for RNDZ, the result should be +0 */ + mpfr_clear_flags (); + inex = mpfr_sqrt (r, u, MPFR_RNDZ); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_zero_p (r) && mpfr_signbit (r) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + /* generate an input u such that sqrt(u) < 0.5*2^emin but there is no + underflow since sqrt(u) >= pred(0.5*2^emin), thus u >= 2^(2emin-2) */ + mpfr_set_ui_2exp (u, 1, 2 * mpfr_get_emin () - 2, MPFR_RNDN); + mpfr_clear_flags (); + inex = mpfr_sqrt (r, u, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (r, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(!mpfr_underflow_p ()); + mpfr_clear_flags (); + inex = mpfr_sqrt (r, u, MPFR_RNDA); + MPFR_ASSERTN(inex == 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (r, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(!mpfr_underflow_p ()); + mpfr_clear_flags (); + inex = mpfr_sqrt (r, u, MPFR_RNDZ); + MPFR_ASSERTN(inex == 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (r, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(!mpfr_underflow_p ()); + + /* next number */ + mpfr_set_ui_2exp (u, 1, 2 * mpfr_get_emin () - 2, MPFR_RNDN); + mpfr_nextabove (u); + mpfr_clear_flags (); + inex = mpfr_sqrt (r, u, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (r, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(!mpfr_underflow_p ()); + mpfr_clear_flags (); + inex = mpfr_sqrt (r, u, MPFR_RNDA); + MPFR_ASSERTN(inex > 0); + mpfr_nextbelow (r); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (r, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(!mpfr_underflow_p ()); + mpfr_clear_flags (); + inex = mpfr_sqrt (r, u, MPFR_RNDZ); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (r, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(!mpfr_underflow_p ()); + + /* previous number */ + mpfr_set_ui_2exp (u, 1, 2 * mpfr_get_emin () - 2, MPFR_RNDN); + mpfr_nextbelow (u); + mpfr_clear_flags (); + inex = mpfr_sqrt (r, u, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (r, 1, mpfr_get_emin () - 1) == 0); + /* since sqrt(u) is just below the middle between 0.5*2^emin and + the previous number (with unbounded exponent range), there is + underflow */ + MPFR_ASSERTN(mpfr_underflow_p ()); + mpfr_clear_flags (); + inex = mpfr_sqrt (r, u, MPFR_RNDA); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (r, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(!mpfr_underflow_p ()); + mpfr_clear_flags (); + inex = mpfr_sqrt (r, u, MPFR_RNDZ); + MPFR_ASSERTN(inex < 0); + mpfr_nextabove (r); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (r, 1, mpfr_get_emin () - 1) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + mpfr_set_emin (3); + mpfr_set_ui_2exp (u, 1, mpfr_get_emin () - 1, MPFR_RNDN); /* u = 4 */ + /* sqrt(u) = 2 = 0.5^2^(emin-1) should be rounded to +0 */ + mpfr_clear_flags (); + inex = mpfr_sqrt (r, u, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_zero_p (r) && mpfr_signbit (r) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + /* next number */ + mpfr_set_ui_2exp (u, 1, mpfr_get_emin () - 1, MPFR_RNDN); /* u = 4 */ + mpfr_nextabove (u); + /* sqrt(u) should be rounded to 4 */ + mpfr_clear_flags (); + inex = mpfr_sqrt (r, u, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui (r, 4) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + mpfr_set_emin (4); + mpfr_set_ui_2exp (u, 1, mpfr_get_emin () - 1, MPFR_RNDN); /* u = 8 */ + /* sqrt(u) should be rounded to +0 */ + mpfr_clear_flags (); + inex = mpfr_sqrt (r, u, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_zero_p (r) && mpfr_signbit (r) == 0); + MPFR_ASSERTN(mpfr_underflow_p ()); + + mpfr_clear (r); + mpfr_clear (u); + } + mpfr_set_emin (emin); +} + +static void +coverage (void) +{ + mpfr_t r, t, u, v, w; + mpfr_prec_t p; + int inex; + + /* exercise even rule */ + for (p = MPFR_PREC_MIN; p <= 1024; p++) + { + mpfr_init2 (r, p); + mpfr_init2 (t, p + 1); + mpfr_init2 (u, 2 * p + 2); + mpfr_init2 (v, p); + mpfr_init2 (w, p); + do + mpfr_urandomb (v, RANDS); + while (mpfr_zero_p (v)); + mpfr_set (w, v, MPFR_RNDN); + mpfr_nextabove (w); /* w = nextabove(v) */ + mpfr_set (t, v, MPFR_RNDN); + mpfr_nextabove (t); + mpfr_mul (u, t, t, MPFR_RNDN); + inex = mpfr_sqrt (r, u, MPFR_RNDN); + if (mpfr_min_prec (v) < p) /* v is even */ + { + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_equal_p (r, v)); + } + else /* v is odd */ + { + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_equal_p (r, w)); + } + mpfr_clear (r); + mpfr_clear (t); + mpfr_clear (u); + mpfr_clear (v); + mpfr_clear (w); + } +} + #define TEST_FUNCTION test_sqrt #define TEST_RANDOM_POS 8 #include "tgeneric.c" @@ -610,6 +926,10 @@ tests_start_mpfr (); + coverage (); + check_underflow (); + check_overflow (); + testall_rndf (16); for (p = MPFR_PREC_MIN; p <= 128; p++) { test_property1 (p, MPFR_RNDN, 0); @@ -729,11 +1049,13 @@ check4 ("72154663483843080704304789585920.0", MPFR_RNDA, "1.e2d9a51977e6e@13"); - test_generic (2, 300, 15); + test_generic (MPFR_PREC_MIN, 300, 15); data_check ("data/sqrt", mpfr_sqrt, "mpfr_sqrt"); bad_cases (mpfr_sqrt, mpfr_sqr, "mpfr_sqrt", 8, -256, 255, 4, 128, 800, 50); bug20160120 (); + bug20160908 (); + test_sqrt1n (); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tsqrt_ui.c mpfr4-4.0.2/tests/tsqrt_ui.c --- mpfr4-3.1.4/tests/tsqrt_ui.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsqrt_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_sqrt_ui. -Copyright 2000-2003, 2006-2016 Free Software Foundation, Inc. +Copyright 2000-2003, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void @@ -37,7 +34,8 @@ printf ("mpfr_sqrt_ui failed for a=%lu, rnd_mode=%s\n", a, mpfr_print_rnd_mode (rnd_mode)); printf ("sqrt gives %s, mpfr_sqrt_ui gives ", qs); - mpfr_out_str(stdout, 10, 0, q, MPFR_RNDN); + mpfr_out_str (stdout, 10, 0, q, MPFR_RNDN); + putchar ('\n'); exit (1); } mpfr_clear (q); diff -Nru mpfr4-3.1.4/tests/tstckintc.c mpfr4-4.0.2/tests/tstckintc.c --- mpfr4-3.1.4/tests/tstckintc.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tstckintc.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_custom_* -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include - #include "mpfr-test.h" #define BUFFER_SIZE 250 @@ -34,6 +32,22 @@ #define ALIGNED(s) (((s) + sizeof (long) - 1) / sizeof (long) * sizeof (long)) +/* This code ensures alignment to "long". However, this might not be + sufficient on some platforms. GCC's -Wcast-align=strict option can + be useful, but this needs successive casts to help GCC, e.g. + + newx = (mpfr_ptr) (long *) (void *) old_stack; + + successively casts old_stack (of type char *) to + - void *: avoid a false positive for the following cast to long * + (as the code takes care of alignment to "long"); + - long *: this corresponds to the alignment checked by MPFR; coming + from void *, it will not trigger a warning (even if incorrect); + - mpfr_ptr: -Wcast-align=strict will emit a warning if mpfr_ptr has + an alignment requirement stronger than long *. In such a case, + the code will have to be fixed. +*/ + static void * new_st (size_t s) { @@ -96,12 +110,14 @@ void *mantissa = mpfr_custom_get_significand (x); size_t size_mantissa = mpfr_custom_get_size (mpfr_get_prec (x)); mpfr_ptr newx; + long *newx2; memmove (old_stack, x, sizeof (mpfr_t)); memmove (old_stack + ALIGNED (sizeof (mpfr_t)), mantissa, size_mantissa); - newx = (mpfr_ptr) old_stack; - mpfr_custom_move (newx, old_stack + ALIGNED (sizeof (mpfr_t))); - stack = old_stack + ALIGNED (sizeof (mpfr_t)) + ALIGNED (size_mantissa); + newx = (mpfr_ptr) (long *) (void *) old_stack; + newx2 = (long *) (void *) (old_stack + ALIGNED (sizeof (mpfr_t))); + mpfr_custom_move (newx, newx2); + stack = (char *) newx2 + ALIGNED (size_mantissa); return newx; } @@ -115,7 +131,7 @@ memmove (old_stack, x, sizeof (mpfr_t)); memmove (old_stack + ALIGNED (sizeof (mpfr_t)), mantissa, size_mantissa); - newx = (mpfr_ptr) old_stack; + newx = (mpfr_ptr) (long *) (void *) old_stack; (mpfr_custom_move) (newx, old_stack + ALIGNED (sizeof (mpfr_t))); stack = old_stack + ALIGNED (sizeof (mpfr_t)) + ALIGNED (size_mantissa); return newx; @@ -129,7 +145,7 @@ mpfr_ptr x, y; reset_stack (); - org = (long *) stack; + org = (long *) (void *) stack; x = new_mpfr (p); y = new_mpfr (p); @@ -195,24 +211,24 @@ sign = 1; mpfr_set_inf (val, sign); kind = (mpfr_custom_get_kind) (val); - if ((ABS (kind) != MPFR_INF_KIND) || (SIGN (kind) != SIGN (sign))) + if ((ABS (kind) != MPFR_INF_KIND) || (VSIGN (kind) != VSIGN (sign))) { printf ("mpfr_custom_get_kind error: "); mpfr_dump (val); printf (" is kind %d instead of %d\n", kind, (int) MPFR_INF_KIND); - printf (" have sign %d instead of %d\n", SIGN (kind), SIGN (sign)); + printf (" have sign %d instead of %d\n", VSIGN (kind), VSIGN (sign)); exit (1); } sign = -1; mpfr_set_zero (val, sign); kind = (mpfr_custom_get_kind) (val); - if ((ABS (kind) != MPFR_ZERO_KIND) || (SIGN (kind) != SIGN (sign))) + if ((ABS (kind) != MPFR_ZERO_KIND) || (VSIGN (kind) != VSIGN (sign))) { printf ("mpfr_custom_get_kind error: "); mpfr_dump (val); printf (" is kind %d instead of %d\n", kind, (int) MPFR_ZERO_KIND); - printf (" have sign %d instead of %d\n", SIGN (kind), SIGN (sign)); + printf (" have sign %d instead of %d\n", VSIGN (kind), VSIGN (sign)); exit (1); } @@ -279,7 +295,7 @@ long *a, *b, *c; reset_stack (); - org = (long *) stack; + org = (long *) (void *) stack; a = dummy_set_si (42); b = dummy_set_si (17); diff -Nru mpfr4-3.1.4/tests/tstdint.c mpfr4-4.0.2/tests/tstdint.c --- mpfr4-3.1.4/tests/tstdint.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tstdint.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for multiple mpfr.h inclusion and intmax_t related functions -Copyright 2010-2016 Free Software Foundation, Inc. +Copyright 2010-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,22 +17,42 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_STDINT_H -#include - #if _MPFR_EXP_FORMAT == 4 /* If mpfr_exp_t is defined as intmax_t, intmax_t must be defined before the inclusion of mpfr.h (this test doesn't use mpfr-impl.h). */ # include #endif -/* Assume that this is in fact a header inclusion for some library - that uses MPFR, i.e. this inclusion is hidden in another one. - MPFR currently (rev 6704) fails to handle this case. */ +#ifdef MPFR_USE_MINI_GMP +#include "mpfr-test.h" +#endif + +/* One of the goals of this test is to detect potential issues with the + * following case in user code: + * + * #include + * #include + * #define MPFR_USE_INTMAX_T + * #include + * + * where some_lib.h has "#include ". So, the mpfr.h header file + * is included multiple times, a first time without before, + * and a second time with support. We need to make sure that + * the second inclusion is not a no-op due to some #include guard. This + * was fixed in r7320. + * + * With mini-gmp, mpfr-impl.h is included first, but this should not + * affect this test. + * + * Note: If _MPFR_EXP_FORMAT == 4 (which is never the case by default), + * a part of the above check is not done because is included + * before the first mpfr.h inclusion (see above). + */ #include #include @@ -55,7 +75,11 @@ mpfr_clear (x); if (j != 1) { - printf ("Error: got %jd instead of 1.\n", j); +#ifdef MPFR_PRINTF_MAXLM + printf ("Error: got %" MPFR_PRINTF_MAXLM "d instead of 1.\n", j); +#else + printf ("Error: did not get 1.\n"); +#endif exit (1); } diff -Nru mpfr4-3.1.4/tests/tstrtofr.c mpfr4-4.0.2/tests/tstrtofr.c --- mpfr4-3.1.4/tests/tstrtofr.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tstrtofr.c 2019-01-08 13:30:18.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_set_str. -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,17 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include - #include "mpfr-test.h" +/* The implicit \0 is useless, but we do not write num_to_text[62] otherwise + g++ complains. */ +static const char num_to_text36[] = "0123456789abcdefghijklmnopqrstuvwxyz"; +static const char num_to_text62[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz"; + static void check_special (void) { @@ -900,6 +904,20 @@ { printf ("Check overflow failed (2) with:\n s='%s'\n x=", s); mpfr_dump (x); +#if defined(__GNUC__) + printf ("This failure is triggered by GCC bug 86554:\n" + " https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86554\n" + " https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87276 " + "(about this test)\nWorkaround: disable code hoisting " + "with -fno-code-hoisting in CFLAGS.\n"); + /* Note: In Debian, this error is obtained with gcc-snapshot from + 20180908-1 to 20181127-1. With gcc-snapshot from 20181209-1 to + 20190102-1 (at least), the MPFR build no longer seems affected + in general, but using --with-gmp-build=... together with + --enable-assert still triggers this failure. This bug has been + fixed in the GCC trunk rev 267725, thus the future gcc-snapshot + versions should no longer have this bug. */ +#endif exit (1); } mpfr_strtofr (x, "123456789E170141183460469231731687303715884105728", @@ -940,6 +958,20 @@ mpfr_dump (x); exit (1); } + mpfr_strtofr (x, "1@2305843009213693951", &s, 16, MPFR_RNDN); + if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x)) + { + printf ("Check overflow failed (8) with:\n s=%s\n x=", s); + mpfr_dump (x); + exit (1); + } + mpfr_strtofr (x, "1@2305843009213693951", &s, 17, MPFR_RNDN); + if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x)) + { + printf ("Check overflow failed (9) with:\n s=%s\n x=", s); + mpfr_dump (x); + exit (1); + } /* Check underflow */ mpfr_strtofr (x, "123456789E-2147483646", &s, 0, MPFR_RNDN); @@ -971,6 +1003,13 @@ mpfr_dump (x); exit (1); } + mpfr_strtofr (x, "1@-2305843009213693952", &s, 16, MPFR_RNDN); + if (s[0] != 0 || !MPFR_IS_ZERO (x) || !MPFR_IS_POS (x) ) + { + printf ("Check underflow failed (8) with:\n s='%s'\n x=", s); + mpfr_dump (x); + exit (1); + } mpfr_clear (x); } @@ -1079,7 +1118,7 @@ } /* check that 1.23e is correctly parsed, cf - http://gmplib.org/list-archives/gmp-bugs/2010-March/001898.html */ + https://gmplib.org/list-archives/gmp-bugs/2010-March/001898.html */ static void test20100310 (void) { @@ -1159,14 +1198,14 @@ s[4+i] = 0; inex1 = mpfr_mul_ui (e, e, 10, MPFR_RNDN); MPFR_ASSERTN (inex1 == 0); - RND_LOOP(r) + RND_LOOP_NO_RNDF (r) { mpfr_rnd_t rnd = (mpfr_rnd_t) r; inex1 = mpfr_exp10 (x1, e, rnd); - inex1 = SIGN (inex1); + inex1 = VSIGN (inex1); inex2 = mpfr_strtofr (x2, s, NULL, 0, rnd); - inex2 = SIGN (inex2); + inex2 = VSIGN (inex2); /* On 32-bit machines, for i = 7, r8389, r8391 and r8394 do: strtofr.c:...: MPFR assertion failed: cy == 0 r8396 is OK. @@ -1191,11 +1230,282 @@ mpfr_clears (e, x1, x2, (mpfr_ptr) 0); } +/* https://sympa.inria.fr/sympa/arc/mpfr/2016-12/msg00043.html + mpfr_strtofr can return an incorrect ternary value. + Note: As a consequence, the value can also be incorrect if the current + exponent range is not the maximum one (since the ternary value is used + to resolve double rounding in mpfr_check_range); this can happen only + if the value is a midpoint between 0 and the minimum positive number + or the opposite. */ +static void +bug20161217 (void) +{ + mpfr_t fp, z; + static const char * num = "0.1387778780781445675529539585113525390625e31"; + /* The above number is 5^47/2^9. */ + int inex; + + mpfr_init2 (fp, 110); + mpfr_init2 (z, 110); + + inex = mpfr_strtofr (fp, num, NULL, 10, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + mpfr_set_str_binary (z, "10001100001000010011110110011101101001010000001011011110010001010100010100100110111101000010001011001100001101E-9"); + MPFR_ASSERTN(mpfr_equal_p (fp, z)); + + /* try with 109 bits */ + mpfr_set_prec (fp, 109); + inex = mpfr_strtofr (fp, num, NULL, 10, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + mpfr_set_str_binary (z, "10001100001000010011110110011101101001010000001011011110010001010100010100100110111101000010001011001100001100E-9"); + MPFR_ASSERTN(mpfr_equal_p (fp, z)); + + mpfr_clear (fp); + mpfr_clear (z); +} + +/* check bug in MPFR 3.1.5 is fixed: cf + https://sympa.inria.fr/sympa/arc/mpfr/2017-03/msg00009.html + Note: same bug as bug20161217. See also the comments of bug20161217; + here, this is a case where the value is incorrect. */ +static void +bug20170308 (void) +{ + mpfr_exp_t emin; + /* the following is slightly larger than 2^-1075, thus should be rounded + to 0.5*2^-1074, with ternary value < 0 */ + char str[] = "2.47032822920623272089E-324"; + mpfr_t z; + int inex; + + emin = mpfr_get_emin (); + mpfr_init2 (z, 53); + mpfr_set_emin (-1073); + /* with emin = -1073, the smallest positive number is 0.5*2^emin = 2^(-1074), + thus str should be rounded to 2^(-1074) with inex > 0 */ + inex = mpfr_strtofr (z, str, NULL, 10, MPFR_RNDN); + MPFR_ASSERTN(inex > 0 && mpfr_cmp_ui_2exp (z, 1, -1074) == 0); + mpfr_set_emin (-1074); + /* with emin = -1074, str should be rounded to 2^(-1075) with inex < 0 */ + inex = mpfr_strtofr (z, str, NULL, 10, MPFR_RNDN); + MPFR_ASSERTN(inex < 0 && mpfr_cmp_ui_2exp (z, 1, -1075) == 0); + mpfr_clear (z); + mpfr_set_emin (emin); +} + +/* r13299 fails with 8-bit limbs (micro-gmp/8). */ +static void +bug20181127 (void) +{ + char s[] = "9.Z6nrLVSMG1bDcCF2ONJdX@-183295525"; /* base 58 */ + mpfr_t x, y; + + mpfr_inits2 (6, x, y, (mpfr_ptr) 0); + mpfr_set_ui_2exp (x, 5, -1073741701, MPFR_RNDN); + mpfr_strtofr (y, s, NULL, 58, MPFR_RNDZ); + if (! mpfr_equal_p (x, y)) + { + printf ("Error in bug20181127 on %s (base 58)\n", s); + printf ("Expected x = "); + mpfr_dump (x); + printf ("Got y = "); + mpfr_dump (y); + printf ("*Note* In base 58, x ~= "); + mpfr_out_str (stdout, 58, 8, x, MPFR_RNDN); + printf ("\n"); + exit (1); + } + mpfr_clears (x, y, (mpfr_ptr) 0); +} + +static void +coverage (void) +{ +#if _MPFR_EXP_FORMAT >= 3 && _MPFR_PREC_FORMAT == 3 && MPFR_PREC_BITS == 64 + char str3[] = "1@-2112009130072406892"; + char str31[] = "1@-511170973314085831"; + mpfr_t x; + int inex; + mpfr_exp_t emin; + + /* exercise assertion cy == 0 around line 698 of strtofr.c */ + emin = mpfr_get_emin (); + mpfr_set_emin (mpfr_get_emin_min ()); + /* emin = -4611686018427387903 on a 64-bit machine */ + mpfr_init2 (x, 1); + inex = mpfr_strtofr (x, str3, NULL, 3, MPFR_RNDN); + /* 3^-2112009130072406892 is slightly larger than (2^64)^-52303988630398057 + thus we should get inex < 0 */ + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (x, 1, -52303988630398057 * 64) == 0); + inex = mpfr_strtofr (x, str31, NULL, 31, MPFR_RNDN); + /* 31^-511170973314085831 is slightly smaller than (2^64)^-39569396093273623 + thus we should get inex > 0 */ + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (x, 1, -39569396093273623 * 64) == 0); + mpfr_clear (x); + mpfr_set_emin (emin); +#endif +} + +#define BSIZE 512 + +static void +random_tests (void) +{ + char s0[BSIZE], s1[BSIZE], s2[BSIZE+64]; + mpfr_t x0, x1, x2; + int prec, i; + + for (prec = MPFR_PREC_MIN; prec < 300; prec++) + { + mpfr_inits2 (prec, x0, x1, x2, (mpfr_ptr) 0); + + for (i = 0; i < 20; i++) + { + const char *num_to_text; + mpfr_exp_t e0, e1; + int base, j, k, neg; + int noteq = 0; + char d; + + /* We want the same exponent for x0 and its successor x1. + This is not possible for precision 1 in base 2. */ + do + base = 2 + (randlimb () % 61); + while (prec == 1 && base == 2); + + num_to_text = base <= 36 ? num_to_text36 : num_to_text62; + + do + { + /* Let's consider only positive numbers. We should test + negative numbers, but they should be built later, just + for the test itself. */ + tests_default_random (x0, 0, + mpfr_get_emin (), mpfr_get_emax (), 1); + mpfr_set (x1, x0, MPFR_RNDN); + mpfr_nextabove (x1); + mpfr_get_str (s0, &e0, base, BSIZE - 1, x0, MPFR_RNDU); + mpfr_get_str (s1, &e1, base, BSIZE - 1, x1, MPFR_RNDD); + } + while (! (mpfr_regular_p (x0) && mpfr_regular_p (x1) && e0 == e1)); + + /* 0 < x0 <= (s0,e) <= (s1,e) <= x1 with e = e0 = e1. + Let's build a string s2 randomly formed by: + - the common prefix of s0 and s1; + - some of the following digits of s0 (possibly none); + - the next digit of s0 + 1; + - some of the following digits of s1 (possibly none). + Then 0 < x0 <= (s0,e) < (s2,e) <= (s1,e) <= x1, and with + a very high probability that (s2,e) < (s1,e); noteq is + set to true in this case. + For instance, if: + s0 = 123456789 + s1 = 124012345 + one can have, e.g.: + s2 = 12345734 + s2 = 123556789 + s2 = 124 + s2 = 124012 + s2 is not taken completely randomly between s0 and s1, but it + will be built rather easily, and with the randomness of x0, + we should cover all cases, with s2 very close to s0, s2 very + close to s1, or not too close to either. */ + + neg = randlimb () & 1; + s2[0] = neg ? '-' : '+'; + s2[1] = '.'; + + for (j = 0; + MPFR_ASSERTN (s0[j] != 0 && s1[j] != 0), s0[j] == s1[j]; + j++) + s2[j+2] = s0[j]; + + /* k is the position of the first differing digit. */ + k = j; + + while (j < BSIZE - 2 && randlimb () % 8 != 0) + { + MPFR_ASSERTN (s0[j] != 0); + s2[j+2] = s0[j]; + j++; + } + + MPFR_ASSERTN (s0[j] != 0); + /* We will increment the next digit. Thus while s0[j] is the + maximum digit, go back until this is no longer the case + (the first digit after the common prefix cannot be the + maximum digit, so that we will stop early enough). */ + while ((d = s0[j]) == num_to_text[base - 1]) + j--; + noteq = j != k; + s2[j+2] = d = *(strchr (num_to_text, d) + 1); + if (d != s1[j]) + noteq = 1; + j++; + + while (j < BSIZE - 1 && randlimb () % 8 != 0) + { + MPFR_ASSERTN (s1[j] != 0); + s2[j+2] = s1[j]; + j++; + } + + sprintf (s2 + (j+2), "@%" MPFR_EXP_FSPEC "d", (mpfr_eexp_t) e0); + + while (noteq == 0 && j < BSIZE - 1) + { + if (s1[j] != '0') + noteq = 1; + j++; + } + + if (neg) + { + mpfr_neg (x0, x0, MPFR_RNDN); + mpfr_neg (x1, x1, MPFR_RNDN); + } + + if (noteq) + { + mpfr_strtofr (x2, s2, NULL, base, MPFR_RNDZ); + if (! mpfr_equal_p (x2, x0)) + { + printf ("Error in random_tests for prec=%d i=%d base=%d\n", + prec, i, base); + printf ("s0 = %s\ns1 = %s\ns2 = %s\n", s0, s1, s2); + printf ("x0 = "); + mpfr_dump (x0); + printf ("x2 = "); + mpfr_dump (x2); + exit (1); + } + } + + mpfr_strtofr (x2, s2, NULL, base, MPFR_RNDA); + if (! mpfr_equal_p (x2, x1)) + { + printf ("Error in random_tests for prec=%d i=%d base=%d\n", + prec, i, base); + printf ("s0 = %s\ns1 = %s\ns2 = %s\n", s0, s1, s2); + printf ("x1 = "); + mpfr_dump (x1); + printf ("x2 = "); + mpfr_dump (x2); + exit (1); + } + } + mpfr_clears (x0, x1, x2, (mpfr_ptr) 0); + } +} + int main (int argc, char *argv[]) { tests_start_mpfr (); + coverage (); check_special(); check_reftable (); check_parse (); @@ -1205,6 +1515,10 @@ test20100310 (); bug20120814 (); bug20120829 (); + bug20161217 (); + bug20170308 (); + bug20181127 (); + random_tests (); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tsub1sp.c mpfr4-4.0.2/tests/tsub1sp.c --- mpfr4-3.1.4/tests/tsub1sp.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsub1sp.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_sub1sp. -Copyright 2003-2016 Free Software Foundation, Inc. +Copyright 2003-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,16 +17,378 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void check_special (void); static void check_random (mpfr_prec_t p); +static void check_underflow (mpfr_prec_t p); +static void check_corner (mpfr_prec_t p); + +static void +bug20170109 (void) +{ + mpfr_t a, b, c; + + mpfr_init2 (a, 111); + mpfr_init2 (b, 111); + mpfr_init2 (c, 111); + mpfr_set_str_binary (b, "0.110010010000111111011010101000100010000101101000110000100011010011000100110001100110001010001011100000001101110E1"); + mpfr_set_str_binary (c, "0.111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111E-63"); + mpfr_sub (a, b, c, MPFR_RNDN); + mpfr_set_str_binary (b, "0.110010010000111111011010101000100010000101101000110000100011001111000100110001100110001010001011100000001101110E1"); + MPFR_ASSERTN(mpfr_equal_p (a, b)); + mpfr_clear (a); + mpfr_clear (b); + mpfr_clear (c); +} + +/* check mpfr_sub1sp1 when: + (1) p = GMP_NUMB_BITS-1, d = GMP_NUMB_BITS and bp[0] = MPFR_LIMB_HIGHBIT + (2) p = 2*GMP_NUMB_BITS-1, d = 2*GMP_NUMB_BITS and b = 1000...000 + (3) p = 3*GMP_NUMB_BITS-1, d = 3*GMP_NUMB_BITS and b = 1000...000 +*/ +static void +test20170208 (void) +{ + mpfr_t a, b, c; + int inex; + + mpfr_inits2 (GMP_NUMB_BITS - 1, a, b, c, (mpfr_ptr) 0); + + /* test (1) */ + mpfr_set_ui_2exp (b, 1, GMP_NUMB_BITS, MPFR_RNDN); + mpfr_set_ui_2exp (c, 1, 0, MPFR_RNDN); + inex = mpfr_sub (a, b, c, MPFR_RNDN); + /* b-c = 2^GMP_NUMB_BITS-1 which has GMP_NUMB_BITS bits, thus we should + round to 2^GMP_NUMB_BITS (even rule) */ + MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 1, GMP_NUMB_BITS) == 0); + MPFR_ASSERTN(inex > 0); + inex = mpfr_sub1sp (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 1, GMP_NUMB_BITS) == 0); + MPFR_ASSERTN(inex > 0); + + mpfr_set_ui_2exp (c, 2, 0, MPFR_RNDN); + mpfr_nextbelow (c); + /* now c = 2 - 2^(1-GMP_NUMB_BITS) */ + inex = mpfr_sub (a, b, c, MPFR_RNDN); + /* b-c = 2^GMP_NUMB_BITS-2+2^(1-GMP_NUMB_BITS), which should + round to 2^GMP_NUMB_BITS-2. We check by directly inspecting the bit + field of a, since mpfr_cmp_ui might not work if unsigned long is shorter + than mp_limb_t, and we don't want to use mpfr_add_ui or mpfr_sub_ui + to construct the expected result. */ + MPFR_ASSERTN(MPFR_MANT(a)[0] == (mp_limb_t) -2); + MPFR_ASSERTN(MPFR_EXP(a) == GMP_NUMB_BITS); + MPFR_ASSERTN(inex < 0); + inex = mpfr_sub1sp (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(MPFR_MANT(a)[0] == (mp_limb_t) -2); + MPFR_ASSERTN(MPFR_EXP(a) == GMP_NUMB_BITS); + MPFR_ASSERTN(inex < 0); + + /* test (2) */ + mpfr_set_prec (a, 2 * GMP_NUMB_BITS - 1); + mpfr_set_prec (b, 2 * GMP_NUMB_BITS - 1); + mpfr_set_prec (c, 2 * GMP_NUMB_BITS - 1); + mpfr_set_ui_2exp (b, 1, 2 * GMP_NUMB_BITS, MPFR_RNDN); + mpfr_set_ui_2exp (c, 1, 0, MPFR_RNDN); + inex = mpfr_sub (a, b, c, MPFR_RNDN); + /* b-c = 2^(2*GMP_NUMB_BITS)-1 which has 2*GMP_NUMB_BITS bits, thus we should + round to 2^(2*GMP_NUMB_BITS) (even rule) */ + MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 1, 2 * GMP_NUMB_BITS) == 0); + MPFR_ASSERTN(inex > 0); + inex = mpfr_sub1sp (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 1, 2 * GMP_NUMB_BITS) == 0); + MPFR_ASSERTN(inex > 0); + + mpfr_set_ui_2exp (c, 2, 0, MPFR_RNDN); + mpfr_nextbelow (c); + /* now c = 2 - 2^(1-2*GMP_NUMB_BITS) */ + inex = mpfr_sub (a, b, c, MPFR_RNDN); + /* b-c = 2^(2*GMP_NUMB_BITS)-2+2^(1-2*GMP_NUMB_BITS), which should + round to 2^(2*GMP_NUMB_BITS)-2. We check by directly inspecting the bit + field of a, since mpfr_cmp_ui might not work if unsigned long is shorter + than mp_limb_t, and we don't want to use mpfr_add_ui or mpfr_sub_ui + to construct the expected result. */ + MPFR_ASSERTN(MPFR_MANT(a)[1] == (mp_limb_t) -1); + MPFR_ASSERTN(MPFR_MANT(a)[0] == (mp_limb_t) -2); + MPFR_ASSERTN(MPFR_EXP(a) == 2 * GMP_NUMB_BITS); + MPFR_ASSERTN(inex < 0); + inex = mpfr_sub1sp (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(MPFR_MANT(a)[1] == (mp_limb_t) -1); + MPFR_ASSERTN(MPFR_MANT(a)[0] == (mp_limb_t) -2); + MPFR_ASSERTN(MPFR_EXP(a) == 2 * GMP_NUMB_BITS); + MPFR_ASSERTN(inex < 0); + + /* test (3) */ + mpfr_set_prec (a, 3 * GMP_NUMB_BITS - 1); + mpfr_set_prec (b, 3 * GMP_NUMB_BITS - 1); + mpfr_set_prec (c, 3 * GMP_NUMB_BITS - 1); + mpfr_set_ui_2exp (b, 1, 3 * GMP_NUMB_BITS, MPFR_RNDN); + mpfr_set_ui_2exp (c, 1, 0, MPFR_RNDN); + inex = mpfr_sub (a, b, c, MPFR_RNDN); + /* b-c = 2^(3*GMP_NUMB_BITS)-1 which has 3*GMP_NUMB_BITS bits, thus we should + round to 3^(2*GMP_NUMB_BITS) (even rule) */ + MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 1, 3 * GMP_NUMB_BITS) == 0); + MPFR_ASSERTN(inex > 0); + inex = mpfr_sub1sp (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 1, 3 * GMP_NUMB_BITS) == 0); + MPFR_ASSERTN(inex > 0); + + mpfr_set_ui_2exp (c, 2, 0, MPFR_RNDN); + mpfr_nextbelow (c); + /* now c = 2 - 2^(1-3*GMP_NUMB_BITS) */ + inex = mpfr_sub (a, b, c, MPFR_RNDN); + /* b-c = 2^(3*GMP_NUMB_BITS)-2+2^(1-3*GMP_NUMB_BITS), which should + round to 2^(3*GMP_NUMB_BITS)-2. We check by directly inspecting the bit + field of a, since mpfr_cmp_ui might not work if unsigned long is shorter + than mp_limb_t, and we don't want to use mpfr_add_ui or mpfr_sub_ui + to construct the expected result. */ + MPFR_ASSERTN(MPFR_MANT(a)[2] == (mp_limb_t) -1); + MPFR_ASSERTN(MPFR_MANT(a)[1] == (mp_limb_t) -1); + MPFR_ASSERTN(MPFR_MANT(a)[0] == (mp_limb_t) -2); + MPFR_ASSERTN(MPFR_EXP(a) == 3 * GMP_NUMB_BITS); + MPFR_ASSERTN(inex < 0); + inex = mpfr_sub1sp (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(MPFR_MANT(a)[2] == (mp_limb_t) -1); + MPFR_ASSERTN(MPFR_MANT(a)[1] == (mp_limb_t) -1); + MPFR_ASSERTN(MPFR_MANT(a)[0] == (mp_limb_t) -2); + MPFR_ASSERTN(MPFR_EXP(a) == 3 * GMP_NUMB_BITS); + MPFR_ASSERTN(inex < 0); + + mpfr_clears (a, b, c, (mpfr_ptr) 0); +} + +static void +compare_sub_sub1sp (void) +{ + mpfr_t a, b, c, a_ref; + mpfr_prec_t p; + unsigned long d; + int i, inex_ref, inex; + int r; + + for (p = 1; p <= 3*GMP_NUMB_BITS; p++) + { + mpfr_inits2 (p, a, b, c, a_ref, (mpfr_ptr) 0); + for (d = 0; d <= p + 2; d++) + { + /* EXP(b) - EXP(c) = d */ + for (i = 0; i < 4; i++) + { + /* for i even, b is the smallest number, for b odd the largest */ + mpfr_set_ui_2exp (b, 1, d, MPFR_RNDN); + if (i & 1) + { + mpfr_mul_2exp (b, b, 1, MPFR_RNDN); + mpfr_nextbelow (b); + } + mpfr_set_ui_2exp (c, 1, 0, MPFR_RNDN); + if (i & 2) + { + mpfr_mul_2exp (c, c, 1, MPFR_RNDN); + mpfr_nextbelow (c); + } + RND_LOOP_NO_RNDF (r) + { + /* increase the precision of b to ensure sub1sp is not used */ + mpfr_prec_round (b, p + 1, MPFR_RNDN); + inex_ref = mpfr_sub (a_ref, b, c, (mpfr_rnd_t) r); + inex = mpfr_prec_round (b, p, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + inex = mpfr_sub1sp (a, b, c, (mpfr_rnd_t) r); + if (inex != inex_ref) + { + printf ("mpfr_sub and mpfr_sub1sp differ for r=%s\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("expected inex=%d and ", inex_ref); + mpfr_dump (a_ref); + printf ("got inex=%d and ", inex); + mpfr_dump (a); + exit (1); + } + MPFR_ASSERTN(mpfr_equal_p (a, a_ref)); + } + } + } + mpfr_clears (a, b, c, a_ref, (mpfr_ptr) 0); + } +} + +static void +bug20171213 (void) +{ + mpfr_t a, b, c; + + mpfr_init2 (a, 127); + mpfr_init2 (b, 127); + mpfr_init2 (c, 127); + mpfr_set_str_binary (b, "0.1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E1"); + mpfr_set_str_binary (c, "0.1000011010111101100101100110101111111001011001010000110000000000000000000000000000000000000000000000000000000000000000000000000E-74"); + mpfr_sub (a, b, c, MPFR_RNDN); + mpfr_set_str_binary (b, "0.1111111111111111111111111111111111111111111111111111111111111111111111111101111001010000100110100110010100000001101001101011110E0"); + MPFR_ASSERTN(mpfr_equal_p (a, b)); + mpfr_clear (a); + mpfr_clear (b); + mpfr_clear (c); +} + +/* generic test for bug20171213: + b = 1.0 with precision p + c = 0.1xxx110...0E-e with precision p, with e >= 1, such that the part 1xxx1 has + exactly p+1-e bits, thus b-c = 0.111..01... is exact on p+1 bits. + Due to the round-to-even rule, b-c should be rounded to 0.111..0. +*/ +static void +bug20171213_gen (mpfr_prec_t pmax) +{ + mpfr_prec_t p; + mpfr_exp_t e; + mpfr_t a, b, c, d; + + for (p = MPFR_PREC_MIN; p <= pmax; p++) + { + for (e = 1; e < p; e++) + { + mpfr_init2 (a, p); + mpfr_init2 (b, p); + mpfr_init2 (c, p); + mpfr_init2 (d, p); + mpfr_set_ui (b, 1, MPFR_RNDN); + mpfr_set_ui_2exp (c, 1, p + 1 - e, MPFR_RNDN); /* c = 2^(p + 1 - e) */ + mpfr_sub_ui (c, c, 1, MPFR_RNDN); /* c = 2^(p + 1 - e) - 1 */ + mpfr_div_2exp (c, c, p + 1, MPFR_RNDN); /* c = 2^(-e) - 2^(-p-1) */ + /* the exact difference is 1 - 2^(-e) + 2^(-p-1) */ + mpfr_sub (a, b, c, MPFR_RNDN); + /* check that a = 1 - 2^(-e) */ + mpfr_set_ui_2exp (d, 1, e, MPFR_RNDN); /* b = 2^e */ + mpfr_sub_ui (d, d, 1, MPFR_RNDN); /* b = 2^e - 1 */ + mpfr_div_2exp (d, d, e, MPFR_RNDN); /* b = 1 - 2^(-e) */ + if (! mpfr_equal_p (a, d)) + { + printf ("bug20171213_gen failed for p=%ld, e=%ld\n", + (long) p, (long) e); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("got a="); mpfr_dump (a); + printf ("expected d="); mpfr_dump (d); + exit (1); + } + mpfr_clear (a); + mpfr_clear (b); + mpfr_clear (c); + mpfr_clear (d); + } + } +} + +static void +coverage (void) +{ + mpfr_t a, b, c, d, u; + int inex; + + /* coverage test in mpfr_sub1sp: case d=1, limb > MPFR_LIMB_HIGHBIT, RNDF + and also RNDZ */ + mpfr_init2 (a, 3 * GMP_NUMB_BITS); + mpfr_init2 (b, 3 * GMP_NUMB_BITS); + mpfr_init2 (c, 3 * GMP_NUMB_BITS); + mpfr_init2 (d, 3 * GMP_NUMB_BITS); + mpfr_init2 (u, 3 * GMP_NUMB_BITS); + mpfr_set_ui (b, 1, MPFR_RNDN); + mpfr_nextbelow (b); /* b = 1 - 2^(-p) */ + mpfr_set_prec (c, GMP_NUMB_BITS); + mpfr_set_ui_2exp (c, 1, -1, MPFR_RNDN); + mpfr_nextbelow (c); + mpfr_nextbelow (c); /* c = 1/2 - 2*2^(-GMP_NUMB_BITS-1) */ + mpfr_prec_round (c, 3 * GMP_NUMB_BITS, MPFR_RNDN); + mpfr_nextbelow (c); /* c = 1/2 - 2*2^(-GMP_NUMB_BITS-1) - 2^(-p-1) */ + /* b-c = c */ + mpfr_sub (a, b, c, MPFR_RNDF); + mpfr_sub (d, b, c, MPFR_RNDD); + mpfr_sub (u, b, c, MPFR_RNDU); + /* check a = d or u */ + MPFR_ASSERTN(mpfr_equal_p (a, d) || mpfr_equal_p (a, u)); + + /* coverage test in mpfr_sub1sp: case d=p, RNDN, sb = 0, significand of b + is even but b<>2^e, (case 1e) */ + mpfr_set_prec (a, 3 * GMP_NUMB_BITS); + mpfr_set_prec (b, 3 * GMP_NUMB_BITS); + mpfr_set_prec (c, 3 * GMP_NUMB_BITS); + mpfr_set_ui (b, 1, MPFR_RNDN); + mpfr_nextabove (b); + mpfr_nextabove (b); + mpfr_set_ui_2exp (c, 1, -3 * GMP_NUMB_BITS, MPFR_RNDN); + inex = mpfr_sub (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_equal_p (a, b)); + + mpfr_clear (a); + mpfr_clear (b); + mpfr_clear (c); + mpfr_clear (d); + mpfr_clear (u); +} + +/* bug in mpfr_sub1sp1n, made generic */ +static void +bug20180217 (mpfr_prec_t pmax) +{ + mpfr_t a, b, c; + int inex; + mpfr_prec_t p; + + for (p = MPFR_PREC_MIN; p <= pmax; p++) + { + mpfr_init2 (a, p); + mpfr_init2 (b, p); + mpfr_init2 (c, p); + mpfr_set_ui (b, 1, MPFR_RNDN); /* b = 1 */ + mpfr_set_ui_2exp (c, 1, -p-1, MPFR_RNDN); /* c = 2^(-p-1) */ + /* a - b = 1 - 2^(-p-1) and should be rounded to 1 (case 2f of + mpfr_sub1sp) */ + inex = mpfr_sub (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui (a, 1) == 0); + /* check also when a=b */ + mpfr_set_ui (a, 1, MPFR_RNDN); + inex = mpfr_sub (a, a, c, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui (a, 1) == 0); + /* and when a=c */ + mpfr_set_ui (b, 1, MPFR_RNDN); /* b = 1 */ + mpfr_set_ui_2exp (a, 1, -p-1, MPFR_RNDN); + inex = mpfr_sub (a, b, a, MPFR_RNDN); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_cmp_ui (a, 1) == 0); + mpfr_clear (a); + mpfr_clear (b); + mpfr_clear (c); + } +} + +/* bug in revision 12985 (trunk only) with tlog and + GMP_CHECK_RANDOMIZE=1534111552615050 */ +static void +bug20180813 (void) +{ + mpfr_t a, b, c; + + mpfr_init2 (a, 194); + mpfr_init2 (b, 194); + mpfr_init2 (c, 194); + mpfr_set_str_binary (b, "0.10000111101000100000010000100010110111011100110100000101100111000010101000110110010101011101101011110110001000111001000010110010111010010100011011010100001010001110000101000010101110100110001000E7"); + mpfr_set_str_binary (c, "0.10000000000000000100001111010001000000100001000101101110111001101000001011001110000101010001101100101010111011010111101100010001110010000101100101110100101000110110101000010100011100001010000101E24"); + mpfr_sub (a, b, c, MPFR_RNDN); + mpfr_set_str_binary (b, "-0.11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111E23"); + MPFR_ASSERTN(mpfr_equal_p (a, b)); + mpfr_clear (a); + mpfr_clear (b); + mpfr_clear (c); +} int main (void) @@ -35,9 +397,21 @@ tests_start_mpfr (); + bug20180813 (); + bug20180217 (1024); + coverage (); + compare_sub_sub1sp (); + test20170208 (); + bug20170109 (); + bug20171213 (); + bug20171213_gen (256); check_special (); - for (p = 2 ; p < 200 ; p++) - check_random (p); + for (p = MPFR_PREC_MIN ; p < 200 ; p++) + { + check_underflow (p); + check_random (p); + check_corner (p); + } tests_end_mpfr (); return 0; @@ -48,12 +422,11 @@ { \ printf("ERROR: for %s and p=%lu and i=%d:\nY=", \ mpfr_print_rnd_mode ((mpfr_rnd_t) r), (unsigned long) p, i); \ - mpfr_print_binary(y); \ - printf("\nZ="); mpfr_print_binary(z); \ - printf("\nReal: "); mpfr_print_binary(x2); \ - printf("\nGot : "); mpfr_print_binary(x); \ - putchar('\n'); \ - exit(1); \ + mpfr_dump (y); \ + printf ("Z="); mpfr_dump (z); \ + printf ("Expected: "); mpfr_dump (x2); \ + printf ("Got : "); mpfr_dump (x); \ + abort(); \ } \ while (0) @@ -62,11 +435,12 @@ { \ printf("ERROR: for %s and p=%lu and i=%d:\nY=", \ mpfr_print_rnd_mode ((mpfr_rnd_t) r), (unsigned long) p, i); \ - mpfr_print_binary(y); \ - printf("\nZ="); mpfr_print_binary(z); \ - printf("\nR="); mpfr_print_binary(x); \ - printf("\nWrong inexact flag. Real: %d. Got: %d\n", \ - inexact1, inexact2); \ + mpfr_dump (y); \ + printf ("Z="); mpfr_dump (z); \ + printf ("Expected: "); mpfr_dump (x2); \ + printf ("Got : "); mpfr_dump (x); \ + printf ("Wrong inexact flag. Expected %d. Got %d\n", \ + inexact1, inexact2); \ exit(1); \ } \ while (0) @@ -87,6 +461,9 @@ if (MPFR_IS_PURE_FP(y) && MPFR_IS_PURE_FP(z)) for(r = 0 ; r < MPFR_RND_MAX ; r++) { + if (r == MPFR_RNDF) + continue; /* mpfr_sub1 and mpfr_sub1sp could differ, + and inexact makes no sense */ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r); inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r); if (mpfr_cmp(x, x2)) @@ -112,6 +489,9 @@ for (r = 0 ; r < MPFR_RND_MAX ; r++) { + if (r == MPFR_RNDF) + continue; /* comparison between sub1 and sub1sp makes no sense here */ + p = 53; mpfr_set_prec(x, 53); mpfr_set_prec(x2, 53); @@ -126,7 +506,7 @@ { printf("Error for x-x with p=%lu. Expected 0. Got:", (unsigned long) p); - mpfr_print_binary(x); + mpfr_dump (x); exit(1); } @@ -136,7 +516,7 @@ { printf("Error for x-y with y=x and p=%lu. Expected 0. Got:", (unsigned long) p); - mpfr_print_binary(x); + mpfr_dump (x); exit(1); } /* diff = 0 */ @@ -513,3 +893,108 @@ mpfr_clears (x, y, z, x2, (mpfr_ptr) 0); } + +static void +check_underflow (mpfr_prec_t p) +{ + mpfr_t x, y, z; + int inexact; + + mpfr_inits2 (p, x, y, z, (mpfr_ptr) 0); + + if (p >= 2) /* we need p >= 2 so that 3 is exact */ + { + mpfr_set_ui_2exp (y, 4, mpfr_get_emin () - 2, MPFR_RNDN); + mpfr_set_ui_2exp (z, 3, mpfr_get_emin () - 2, MPFR_RNDN); + inexact = mpfr_sub (x, y, z, MPFR_RNDN); + if (inexact >= 0 || (mpfr_cmp_ui (x, 0) != 0)) + { + printf ("4*2^(emin-2) - 3*2^(emin-2) with RNDN failed for p=%ld\n", + (long) p); + printf ("Expected inexact < 0 with x=0\n"); + printf ("Got inexact=%d with x=", inexact); + mpfr_dump (x); + exit (1); + } + } + + if (p >= 3) /* we need p >= 3 so that 5 is exact */ + { + mpfr_set_ui_2exp (y, 5, mpfr_get_emin () - 2, MPFR_RNDN); + mpfr_set_ui_2exp (z, 4, mpfr_get_emin () - 2, MPFR_RNDN); + inexact = mpfr_sub (x, y, z, MPFR_RNDN); + if (inexact >= 0 || (mpfr_cmp_ui (x, 0) != 0)) + { + printf ("5*2^(emin-2) - 4*2^(emin-2) with RNDN failed for p=%ld\n", + (long) p); + printf ("Expected inexact < 0 with x=0\n"); + printf ("Got inexact=%d with x=", inexact); + mpfr_dump (x); + exit (1); + } + } + + mpfr_clears (x, y, z, (mpfr_ptr) 0); +} + +/* check corner cases of mpfr_sub1sp in case d = 1 and limb = MPFR_LIMB_HIGHBIT */ +static void +check_corner (mpfr_prec_t p) +{ + mpfr_t x, y, z; + mpfr_exp_t e; + int inex, odd; + + if (p < 4) /* ensures that the initial value of z is > 1 below */ + return; + + mpfr_inits2 (p, x, y, z, (mpfr_ptr) 0); + mpfr_const_pi (y, MPFR_RNDN); + mpfr_set_ui (z, 2, MPFR_RNDN); + inex = mpfr_sub (z, y, z, MPFR_RNDN); /* z is near pi-2, thus y-z is near 2 */ + MPFR_ASSERTN(inex == 0); + for (e = 0; e < p; e++) + { + /* add 2^(-e) to z */ + mpfr_mul_2exp (z, z, e, MPFR_RNDN); + inex = mpfr_add_ui (z, z, 1, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + mpfr_div_2exp (z, z, e, MPFR_RNDN); + + /* compute x = y - z which should be exact, near 2-2^(-e) */ + inex = mpfr_sub (x, y, z, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + MPFR_ASSERTN(mpfr_get_exp (x) == 1); + + /* restore initial z */ + mpfr_mul_2exp (z, z, e, MPFR_RNDN); + inex = mpfr_sub_ui (z, z, 1, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + mpfr_div_2exp (z, z, e, MPFR_RNDN); + + /* subtract 2^(-e) to z */ + mpfr_mul_2exp (z, z, e, MPFR_RNDN); + inex = mpfr_sub_ui (z, z, 1, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + mpfr_div_2exp (z, z, e, MPFR_RNDN); + + /* ensure last significant bit of z is 0 so that y-z is exact */ + odd = mpfr_min_prec (z) == p; + if (odd) /* add one ulp to z */ + mpfr_nextabove (z); + + /* compute x = y - z which should be exact, near 2+2^(-e) */ + inex = mpfr_sub (x, y, z, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + MPFR_ASSERTN(mpfr_get_exp (x) == 2); + + /* restore initial z */ + if (odd) + mpfr_nextbelow (z); + mpfr_mul_2exp (z, z, e, MPFR_RNDN); + inex = mpfr_add_ui (z, z, 1, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + mpfr_div_2exp (z, z, e, MPFR_RNDN); + } + mpfr_clears (x, y, z, (mpfr_ptr) 0); +} diff -Nru mpfr4-3.1.4/tests/tsub.c mpfr4-4.0.2/tests/tsub.c --- mpfr4-3.1.4/tests/tsub.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsub.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_sub. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,20 +17,18 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" -#ifdef CHECK_EXTERNAL static int test_sub (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) { +#ifdef CHECK_EXTERNAL int res; int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_number_p (c); + if (ok) { mpfr_print_raw (b); @@ -45,10 +43,69 @@ printf ("\n"); } return res; -} -#else -#define test_sub mpfr_sub +#else /* reuse test */ + int inex; + + inex = mpfr_sub (a, b, c, rnd_mode); + + if (a != b && a != c && ! MPFR_IS_NAN (a)) + { + mpfr_t t; + int reuse_b, reuse_c, inex_r; + + reuse_b = MPFR_PREC (a) == MPFR_PREC (b); + reuse_c = MPFR_PREC (a) == MPFR_PREC (c); + + if (reuse_b || reuse_c) + mpfr_init2 (t, MPFR_PREC (a)); + + if (reuse_b) + { + mpfr_set (t, b, MPFR_RNDN); + inex_r = mpfr_sub (t, t, c, rnd_mode); + if (!(mpfr_equal_p (t, a) && SAME_SIGN (inex_r, inex))) + { + printf ("reuse of b error in b - c in %s for\n", + mpfr_print_rnd_mode (rnd_mode)); + printf ("b = "); + mpfr_dump (b); + printf ("c = "); + mpfr_dump (c); + printf ("Expected "); mpfr_dump (a); + printf (" with inex = %d\n", inex); + printf ("Got "); mpfr_dump (t); + printf (" with inex = %d\n", inex_r); + exit (1); + } + } + + if (reuse_c) + { + mpfr_set (t, c, MPFR_RNDN); + inex_r = mpfr_sub (t, b, t, rnd_mode); + if (!(mpfr_equal_p (t, a) && SAME_SIGN (inex_r, inex))) + { + printf ("reuse of c error in b - c in %s for\n", + mpfr_print_rnd_mode (rnd_mode)); + printf ("b = "); + mpfr_dump (b); + printf ("c = "); + mpfr_dump (c); + printf ("Expected "); mpfr_dump (a); + printf (" with inex = %d\n", inex); + printf ("Got "); mpfr_dump (t); + printf (" with inex = %d\n", inex_r); + exit (1); + } + } + + if (reuse_b || reuse_c) + mpfr_clear (t); + } + + return inex; #endif +} static void check_diverse (void) @@ -86,6 +143,19 @@ exit (1); } + /* yet another coverage test */ + mpfr_set_prec (x, 2); + mpfr_set_prec (y, 3); + mpfr_set_prec (z, 1); + mpfr_set_ui_2exp (y, 1, mpfr_get_emax (), MPFR_RNDZ); + /* y = (1 - 2^(-3))*2^emax */ + mpfr_set_ui_2exp (z, 1, mpfr_get_emax () - 4, MPFR_RNDZ); + /* z = 2^(emax - 4) */ + /* y - z = (1 - 2^(-3) - 2^(-4))*2^emax > (1-2^(-2))*2^emax */ + inexact = mpfr_sub (x, y, z, MPFR_RNDU); + MPFR_ASSERTN(inexact > 0); + MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); + mpfr_set_prec (x, 288); mpfr_set_prec (y, 288); mpfr_set_prec (z, 288); @@ -108,8 +178,8 @@ if (mpfr_cmp (z, y)) { printf ("Error in mpfr_sub (5)\n"); - printf ("expected "); mpfr_print_binary (y); puts (""); - printf ("got "); mpfr_print_binary (z); puts (""); + printf ("expected "); mpfr_dump (y); + printf ("got "); mpfr_dump (z); exit (1); } @@ -121,8 +191,8 @@ if (mpfr_cmp (z, y)) { printf ("Error in mpfr_sub (7)\n"); - printf ("expected "); mpfr_print_binary (y); puts (""); - printf ("got "); mpfr_print_binary (z); puts (""); + printf ("expected "); mpfr_dump (y); + printf ("got "); mpfr_dump (z); exit (1); } @@ -134,8 +204,8 @@ if (mpfr_cmp (z, y)) { printf ("Error in mpfr_sub (6)\n"); - printf ("expected "); mpfr_print_binary (y); puts (""); - printf ("got "); mpfr_print_binary (z); puts (""); + printf ("expected "); mpfr_dump (y); + printf ("got "); mpfr_dump (z); exit (1); } @@ -168,8 +238,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_sub (1 - 1E-33) with prec=33\n"); - printf ("Expected "); mpfr_print_binary (y); puts (""); - printf ("got "); mpfr_print_binary (x); puts (""); + printf ("Expected "); mpfr_dump (y); + printf ("got "); mpfr_dump (x); exit (1); } @@ -181,7 +251,7 @@ if (mpfr_cmp_ui (x, 1)) { printf ("Error in mpfr_sub (1 - 1E-33) with prec=32\n"); - printf ("Expected 1.0, got "); mpfr_print_binary (x); puts (""); + printf ("Expected 1.0, got "); mpfr_dump (x); exit (1); } @@ -201,8 +271,8 @@ if (mpfr_cmp (z, x)) { printf ("Error in mpfr_sub (2)\n"); - printf ("Expected "); mpfr_print_binary (x); puts (""); - printf ("Got "); mpfr_print_binary (z); puts (""); + printf ("Expected "); mpfr_dump (x); + printf ("Got "); mpfr_dump (z); exit (1); } mpfr_set_str_binary (x, "1.1110111011110001110111011111111111101000011001011100101100101101"); @@ -260,8 +330,8 @@ test_sub (z, x, y, MPFR_RNDN); if (mpfr_cmp (z, x)) { printf ("mpfr_sub(z, x, y) failed for prec(x)=112, prec(y)=98\n"); - printf ("expected "); mpfr_print_binary (x); puts (""); - printf ("got "); mpfr_print_binary (z); puts (""); + printf ("expected "); mpfr_dump (x); + printf ("got "); mpfr_dump (z); exit (1); } @@ -338,8 +408,8 @@ if (mpfr_cmp(ex2, ex3)) { printf ("Error in ddefour test.\n"); - printf ("ex2="); mpfr_print_binary (ex2); puts (""); - printf ("ex3="); mpfr_print_binary (ex3); puts (""); + printf ("ex2="); mpfr_dump (ex2); + printf ("ex3="); mpfr_dump (ex3); exit (1); } @@ -379,11 +449,11 @@ { printf ("Wrong inexact flag for prec=%u, rnd=%s\n", (unsigned)p, mpfr_print_rnd_mode (rnd)); - printf ("x="); mpfr_print_binary(x); puts (""); - printf ("y="); mpfr_print_binary(y); puts (""); - printf ("u="); mpfr_print_binary(u); puts (""); - printf ("v="); mpfr_print_binary(v); puts (""); - printf ("w="); mpfr_print_binary(w); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); + printf ("u="); mpfr_dump (u); + printf ("v="); mpfr_dump (v); + printf ("w="); mpfr_dump (w); printf ("inexact = %d\n", inexact); exit (1); } @@ -446,14 +516,14 @@ : MPFR_EXP(u) - MPFR_EXP(x); pz = pz + MAX(MPFR_PREC(x), MPFR_PREC(u)); mpfr_set_prec (z, pz); - rnd = RND_RAND (); + rnd = RND_RAND_NO_RNDF (); if (test_sub (z, x, u, rnd)) { printf ("z <- x - u should be exact\n"); exit (1); } { - rnd = RND_RAND (); + rnd = RND_RAND_NO_RNDF (); inexact = test_sub (y, x, u, rnd); cmp = mpfr_cmp (y, z); if (((inexact == 0) && (cmp != 0)) || @@ -463,10 +533,10 @@ printf ("Wrong inexact flag for rnd=%s\n", mpfr_print_rnd_mode(rnd)); printf ("expected %d, got %d\n", cmp, inexact); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("u="); mpfr_print_binary (u); puts (""); - printf ("y= "); mpfr_print_binary (y); puts (""); - printf ("x-u="); mpfr_print_binary (z); puts (""); + printf ("x="); mpfr_dump (x); + printf ("u="); mpfr_dump (u); + printf ("y= "); mpfr_dump (y); + printf ("x-u="); mpfr_dump (z); exit (1); } } @@ -538,8 +608,8 @@ { printf ("Error in mpfr_sub for b-c for b=2^64+1+2^(-64), c=1\n"); printf ("Expected result 2^64 with inex < 0\n"); - printf ("Got "); mpfr_print_binary (a); - printf (" with inex=%d\n", inex); + printf ("Got "); mpfr_dump (a); + printf ("with inex=%d\n", inex); exit (1); } @@ -575,48 +645,50 @@ mpfr_set_ui_2exp (c, 1, -l, MPFR_RNDN); i = mpfr_sub (a, b, c, MPFR_RNDN); /* b - c = 2^p + 1 + 2^(-k) - 2^(-l), should be rounded to - 2^p for l <= k, and 2^p+2 for l < k */ - if (l <= k) + 2^p for l <= k, and 2^p+2 for l < k, except when p=1 and + k=l, in which case b - c = 3, and the round-away rule implies + a = 4 = 2^p+2 = 2^(p+1) */ + if (l < k || (l == k && p > 1)) { if (mpfr_cmp_ui_2exp (a, 1, p) != 0) { printf ("Wrong result in check_rounding\n"); printf ("p=%lu k=%ld l=%ld\n", (unsigned long) p, k, l); - printf ("b="); mpfr_print_binary (b); puts (""); - printf ("c="); mpfr_print_binary (c); puts (""); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); printf ("Expected 2^%lu\n", (unsigned long) p); - printf ("Got "); mpfr_print_binary (a); puts (""); + printf ("Got "); mpfr_dump (a); exit (1); } if (i >= 0) { printf ("Wrong ternary value in check_rounding\n"); printf ("p=%lu k=%ld l=%ld\n", (unsigned long) p, k, l); - printf ("b="); mpfr_print_binary (b); puts (""); - printf ("c="); mpfr_print_binary (c); puts (""); - printf ("a="); mpfr_print_binary (a); puts (""); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); printf ("Expected < 0, got %d\n", i); exit (1); } } - else /* l < k */ + else /* l < k or (l = k and p = 1) */ { mpfr_set_ui_2exp (res, 1, p, MPFR_RNDN); mpfr_add_ui (res, res, 2, MPFR_RNDN); if (mpfr_cmp (a, res) != 0) { printf ("Wrong result in check_rounding\n"); - printf ("b="); mpfr_print_binary (b); puts (""); - printf ("c="); mpfr_print_binary (c); puts (""); - printf ("Expected "); mpfr_print_binary (res); puts (""); - printf ("Got "); mpfr_print_binary (a); puts (""); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("Expected "); mpfr_dump (res); + printf ("Got "); mpfr_dump (a); exit (1); } if (i <= 0) { printf ("Wrong ternary value in check_rounding\n"); - printf ("b="); mpfr_print_binary (b); puts (""); - printf ("c="); mpfr_print_binary (c); puts (""); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); printf ("Expected > 0, got %d\n", i); exit (1); } @@ -630,6 +702,463 @@ } } +/* Check a = b - c, where the significand of b has all 1's, c is small + compared to b, and PREC(a) = PREC(b) - 1. Thus b is a midpoint for + the precision of the result a. The test is done with the extended + exponent range and with some reduced exponent range. Two choices + are made for the exponent of b: the maximum exponent - 1 (similar + to some normal case) and the maximum exponent (overflow case or + near overflow case, depending on the rounding mode). + This test is useful to trigger a bug in r10382: Since c is small, + the computation in sub1.c was done by first rounding b in the + precision of a, then correcting the result if b was a breakpoint + for this precision (exactly representable number for the directed + rounding modes, or midpoint for the round-to-nearest mode). The + problem was that for a midpoint in the round-to-nearest mode, the + rounding of b gave a spurious overflow; not only the overflow flag + was incorrect, but the result could not be corrected, since due to + this overflow, the "even rounding" information was lost. + In the case of reduced exponent range, an additional test is done + for consistency checks: the subtraction is done in the extended + exponent range (no overflow), then the result is converted to the + initial exponent range with mpfr_check_range. */ +static void +check_max_almosteven (void) +{ + mpfr_exp_t old_emin, old_emax; + mpfr_exp_t emin[2] = { MPFR_EMIN_MIN, -1000 }; + mpfr_exp_t emax[2] = { MPFR_EMAX_MAX, 1000 }; + int i; + + old_emin = mpfr_get_emin (); + old_emax = mpfr_get_emax (); + + for (i = 0; i < 2; i++) + { + mpfr_t a1, a2, b, c; + mpfr_prec_t p; + int neg, j, rnd; + + set_emin (emin[i]); + set_emax (emax[i]); + + p = MPFR_PREC_MIN + randlimb () % 70; + mpfr_init2 (a1, p); + mpfr_init2 (a2, p); + mpfr_init2 (b, p+1); + mpfr_init2 (c, MPFR_PREC_MIN); + + mpfr_setmax (b, 0); + mpfr_set_ui (c, 1, MPFR_RNDN); + + for (neg = 0; neg < 2; neg++) + { + for (j = 1; j >= 0; j--) + { + mpfr_set_exp (b, __gmpfr_emax - j); + RND_LOOP_NO_RNDF (rnd) + { + mpfr_flags_t flags1, flags2; + int inex1, inex2; + + /* Expected result. */ + flags1 = MPFR_FLAGS_INEXACT; + if (rnd == MPFR_RNDN || MPFR_IS_LIKE_RNDZ (rnd, neg)) + { + inex1 = neg ? 1 : -1; + mpfr_setmax (a1, __gmpfr_emax - j); + } + else + { + inex1 = neg ? -1 : 1; + if (j == 0) + { + flags1 |= MPFR_FLAGS_OVERFLOW; + mpfr_set_inf (a1, 1); + } + else + { + mpfr_setmin (a1, __gmpfr_emax); + } + } + MPFR_SET_SIGN (a1, neg ? -1 : 1); + + /* Computed result. */ + mpfr_clear_flags (); + inex2 = mpfr_sub (a2, b, c, (mpfr_rnd_t) rnd); + flags2 = __gmpfr_flags; + + if (! (flags1 == flags2 && SAME_SIGN (inex1, inex2) && + mpfr_equal_p (a1, a2))) + { + printf ("Error 1 in check_max_almosteven for %s," + " i = %d, j = %d, neg = %d\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), + i, j, neg); + printf (" b = "); + mpfr_dump (b); + printf ("Expected "); + mpfr_dump (a1); + printf (" with inex = %d, flags =", inex1); + flags_out (flags1); + printf ("Got "); + mpfr_dump (a2); + printf (" with inex = %d, flags =", inex2); + flags_out (flags2); + exit (1); + } + + if (i == 0) + break; + + /* Additional test for the reduced exponent range. */ + mpfr_clear_flags (); + set_emin (MPFR_EMIN_MIN); + set_emax (MPFR_EMAX_MAX); + inex2 = mpfr_sub (a2, b, c, (mpfr_rnd_t) rnd); + set_emin (emin[i]); + set_emax (emax[i]); + inex2 = mpfr_check_range (a2, inex2, (mpfr_rnd_t) rnd); + flags2 = __gmpfr_flags; + + if (! (flags1 == flags2 && SAME_SIGN (inex1, inex2) && + mpfr_equal_p (a1, a2))) + { + printf ("Error 2 in check_max_almosteven for %s," + " i = %d, j = %d, neg = %d\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), + i, j, neg); + printf (" b = "); + mpfr_dump (b); + printf ("Expected "); + mpfr_dump (a1); + printf (" with inex = %d, flags =", inex1); + flags_out (flags1); + printf ("Got "); + mpfr_dump (a2); + printf (" with inex = %d, flags =", inex2); + flags_out (flags2); + exit (1); + } + } + } /* j */ + + mpfr_neg (b, b, MPFR_RNDN); + mpfr_neg (c, c, MPFR_RNDN); + } /* neg */ + + mpfr_clears (a1, a2, b, c, (mpfr_ptr) 0); + } /* i */ + + set_emin (old_emin); + set_emax (old_emax); +} + +static void +test_rndf (void) +{ + mpfr_t a, b, c, d; + + mpfr_init2 (a, 7); + mpfr_init2 (b, 7); + mpfr_init2 (c, 7); + mpfr_init2 (d, 7); + mpfr_set_str_binary (b, "-1.000000e-7"); + mpfr_set_str_binary (c, "-1.000000"); + mpfr_sub (a, b, c, MPFR_RNDF); + MPFR_ASSERTN(MPFR_IS_NORMALIZED(a)); + mpfr_sub (d, b, c, MPFR_RNDD); + if (!mpfr_equal_p (a, d)) + { + mpfr_sub (d, b, c, MPFR_RNDU); + if (!mpfr_equal_p (a, d)) + { + printf ("Error: mpfr_sub(a,b,c,RNDF) does not match RNDD/RNDU\n"); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); + exit (1); + } + } + mpfr_clear (a); + mpfr_clear (b); + mpfr_clear (c); + mpfr_clear (d); +} + +static void +testall_rndf (mpfr_prec_t pmax) +{ + mpfr_t a, b, c, d; + mpfr_prec_t pa, pb, pc; + mpfr_exp_t eb; + + for (pa = MPFR_PREC_MIN; pa <= pmax; pa++) + { + mpfr_init2 (a, pa); + mpfr_init2 (d, pa); + for (pb = MPFR_PREC_MIN; pb <= pmax; pb++) + { + mpfr_init2 (b, pb); + for (eb = 0; eb <= pmax + 3; eb ++) + { + mpfr_set_ui_2exp (b, 1, eb, MPFR_RNDN); + while (mpfr_cmp_ui_2exp (b, 1, eb + 1) < 0) + { + for (pc = MPFR_PREC_MIN; pc <= pmax; pc++) + { + mpfr_init2 (c, pc); + mpfr_set_ui (c, 1, MPFR_RNDN); + while (mpfr_cmp_ui (c, 2) < 0) + { + mpfr_sub (a, b, c, MPFR_RNDF); + mpfr_sub (d, b, c, MPFR_RNDD); + if (!mpfr_equal_p (a, d)) + { + mpfr_sub (d, b, c, MPFR_RNDU); + if (!mpfr_equal_p (a, d)) + { + printf ("Error: mpfr_sub(a,b,c,RNDF) does not " + "match RNDD/RNDU\n"); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); + exit (1); + } + } + mpfr_nextabove (c); + } + mpfr_clear (c); + } + mpfr_nextabove (b); + } + } + mpfr_clear (b); + } + mpfr_clear (a); + mpfr_clear (d); + } +} + +static void +test_rndf_exact (mp_size_t pmax) +{ + mpfr_t a, b, c, d; + mpfr_prec_t pa, pb, pc; + mpfr_exp_t eb; + + for (pa = MPFR_PREC_MIN; pa <= pmax; pa++) + { + /* only check pa mod GMP_NUMB_BITS = -2, -1, 0, 1, 2 */ + if ((pa + 2) % GMP_NUMB_BITS > 4) + continue; + mpfr_init2 (a, pa); + mpfr_init2 (d, pa); + for (pb = MPFR_PREC_MIN; pb <= pmax; pb++) + { + if ((pb + 2) % GMP_NUMB_BITS > 4) + continue; + mpfr_init2 (b, pb); + for (eb = 0; eb <= pmax + 3; eb ++) + { + mpfr_urandomb (b, RANDS); + mpfr_mul_2exp (b, b, eb, MPFR_RNDN); + for (pc = MPFR_PREC_MIN; pc <= pmax; pc++) + { + if ((pc + 2) % GMP_NUMB_BITS > 4) + continue; + mpfr_init2 (c, pc); + mpfr_urandomb (c, RANDS); + mpfr_sub (a, b, c, MPFR_RNDF); + mpfr_sub (d, b, c, MPFR_RNDD); + if (!mpfr_equal_p (a, d)) + { + mpfr_sub (d, b, c, MPFR_RNDU); + if (!mpfr_equal_p (a, d)) + { + printf ("Error: mpfr_sub(a,b,c,RNDF) does not " + "match RNDD/RNDU\n"); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); + exit (1); + } + } + + /* now make the low bits from c match those from b */ + mpfr_add (c, b, d, MPFR_RNDN); + mpfr_sub (a, b, c, MPFR_RNDF); + mpfr_sub (d, b, c, MPFR_RNDD); + if (!mpfr_equal_p (a, d)) + { + mpfr_sub (d, b, c, MPFR_RNDU); + if (!mpfr_equal_p (a, d)) + { + printf ("Error: mpfr_sub(a,b,c,RNDF) does not " + "match RNDD/RNDU\n"); + printf ("b="); mpfr_dump (b); + printf ("c="); mpfr_dump (c); + printf ("a="); mpfr_dump (a); + exit (1); + } + } + + mpfr_clear (c); + } + } + mpfr_clear (b); + } + mpfr_clear (a); + mpfr_clear (d); + } +} + +static void +bug20180215 (void) +{ + mpfr_t x, y, z1, z2; + mpfr_rnd_t r[] = { MPFR_RNDN, MPFR_RNDU, MPFR_RNDA }; + int i, p; + + for (p = 3; p <= 3 + 4 * GMP_NUMB_BITS; p++) + { + mpfr_inits2 (p, x, y, z1, z2, (mpfr_ptr) 0); + mpfr_set_ui_2exp (x, 1, p - 1, MPFR_RNDN); + mpfr_nextabove (x); + mpfr_set_ui_2exp (y, 3, -1, MPFR_RNDN); + mpfr_set (z1, x, MPFR_RNDN); + mpfr_nextbelow (z1); + mpfr_nextbelow (z1); + for (i = 0; i < numberof (r); i++) + { + test_sub (z2, x, y, r[i]); + if (! mpfr_equal_p (z1, z2)) + { + printf ("Error in bug20180215 in precision %d, %s\n", + p, mpfr_print_rnd_mode (r[i])); + printf ("expected "); mpfr_dump (z1); + printf ("got "); mpfr_dump (z2); + exit (1); + } + } + mpfr_clears (x, y, z1, z2, (mpfr_ptr) 0); + } +} + +static void +bug20180216 (void) +{ + mpfr_t x, y, z1, z2; + int r, p, d, inex; + + for (p = 3; p <= 3 + 4 * GMP_NUMB_BITS; p++) + { + mpfr_inits2 (p, x, y, z1, z2, (mpfr_ptr) 0); + for (d = 1; d <= p-2; d++) + { + inex = mpfr_set_ui_2exp (z1, 1, d, MPFR_RNDN); /* z1 = 2^d */ + MPFR_ASSERTN (inex == 0); + inex = mpfr_add_ui (x, z1, 1, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + mpfr_nextabove (x); /* x = 2^d + 1 + epsilon */ + inex = mpfr_sub (y, x, z1, MPFR_RNDN); /* y = 1 + epsilon */ + MPFR_ASSERTN (inex == 0); + inex = mpfr_add (z2, y, z1, MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + MPFR_ASSERTN (mpfr_equal_p (z2, x)); /* consistency check */ + RND_LOOP (r) + { + inex = test_sub (z2, x, y, (mpfr_rnd_t) r); + if (! mpfr_equal_p (z1, z2) || inex != 0) + { + printf ("Error in bug20180216 with p=%d, d=%d, %s\n", + p, d, mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("expected "); mpfr_dump (z1); + printf (" with inex = 0\n"); + printf ("got "); mpfr_dump (z2); + printf (" with inex = %d\n", inex); + exit (1); + } + } + } + mpfr_clears (x, y, z1, z2, (mpfr_ptr) 0); + } +} + +/* Fails with r12281: "reuse of c error in b - c in MPFR_RNDN". */ +static void +bug20180217 (void) +{ + mpfr_t x, y, z1, z2; + int r, p, d, i, inex1, inex2; + + for (p = 3; p <= 3 + 4 * GMP_NUMB_BITS; p++) + { + mpfr_inits2 (p, x, y, z1, z2, (mpfr_ptr) 0); + for (d = p; d <= p+4; d++) + { + mpfr_set_ui (x, 1, MPFR_RNDN); + mpfr_set_ui_2exp (y, 1, -d, MPFR_RNDN); + for (i = 0; i < 3; i++) + { + RND_LOOP_NO_RNDF (r) + { + mpfr_set (z1, x, MPFR_RNDN); + if (d == p) + { + mpfr_nextbelow (z1); + if (i == 0) + inex1 = 0; + else if (r == MPFR_RNDD || r == MPFR_RNDZ || + (r == MPFR_RNDN && i > 1)) + { + mpfr_nextbelow (z1); + inex1 = -1; + } + else + inex1 = 1; + } + else if (r == MPFR_RNDD || r == MPFR_RNDZ || + (r == MPFR_RNDN && d == p+1 && i > 0)) + { + mpfr_nextbelow (z1); + inex1 = -1; + } + else + inex1 = 1; + inex2 = test_sub (z2, x, y, (mpfr_rnd_t) r); + if (!(mpfr_equal_p (z1, z2) && SAME_SIGN (inex1, inex2))) + { + printf ("Error in bug20180217 with " + "p=%d, d=%d, i=%d, %s\n", p, d, i, + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("x = "); + mpfr_dump (x); + printf ("y = "); + mpfr_dump (y); + printf ("Expected "); mpfr_dump (z1); + printf (" with inex = %d\n", inex1); + printf ("Got "); mpfr_dump (z2); + printf (" with inex = %d\n", inex2); + exit (1); + } + } + if (i == 0) + mpfr_nextabove (y); + else + { + if (p < 6) + break; + mpfr_nextbelow (y); + mpfr_mul_ui (y, y, 25, MPFR_RNDD); + mpfr_div_2ui (y, y, 4, MPFR_RNDN); + } + } + } + mpfr_clears (x, y, z1, z2, (mpfr_ptr) 0); + } +} + #define TEST_FUNCTION test_sub #define TWO_ARGS #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS) @@ -643,15 +1172,22 @@ tests_start_mpfr (); + test_rndf (); + testall_rndf (7); + test_rndf_exact (200); bug20101017 (); check_rounding (); check_diverse (); check_inexact (); + check_max_almosteven (); bug_ddefour (); + bug20180215 (); + bug20180216 (); + bug20180217 (); for (p=2; p<200; p++) for (i=0; i<50; i++) check_two_sum (p); - test_generic (2, 800, 100); + test_generic (MPFR_PREC_MIN, 800, 100); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tsub_d.c mpfr4-4.0.2/tests/tsub_d.c --- mpfr4-3.1.4/tests/tsub_d.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsub_d.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_sub_d -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,17 +17,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include #include "mpfr-test.h" -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) - static void check_nans (void) { @@ -42,7 +38,7 @@ mpfr_clear_flags (); inexact = mpfr_sub_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); - MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0); + MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN); MPFR_ASSERTN (mpfr_nan_p (y)); /* +inf - 1.0 == +inf */ @@ -78,6 +74,7 @@ mpfr_t x, y, z; double d; int inexact; + tests_start_mpfr (); /* check with enough precision */ @@ -110,19 +107,8 @@ check_nans (); - test_generic (2, 1000, 100); + test_generic (MPFR_PREC_MIN, 1000, 100); tests_end_mpfr (); return 0; } - -#else - -int -main (void) -{ - printf ("Warning! Test disabled for this MPFR version.\n"); - return 0; -} - -#endif diff -Nru mpfr4-3.1.4/tests/tsubnormal.c mpfr4-4.0.2/tests/tsubnormal.c --- mpfr4-3.1.4/tests/tsubnormal.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsubnormal.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_subnormalize. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include - #include "mpfr-test.h" static const struct { @@ -67,7 +63,7 @@ mpfr_set_emax (10); mpfr_init (x); - for (i = 0; i < (sizeof (tab) / sizeof (tab[0])); i++) + for (i = 0; i < numberof (tab); i++) for (s = 0; s <= (tab[i].rnd == MPFR_RNDN); s++) for (k = 0; k <= 1; k++) { diff -Nru mpfr4-3.1.4/tests/tsub_ui.c mpfr4-4.0.2/tests/tsub_ui.c --- mpfr4-3.1.4/tests/tsub_ui.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsub_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_sub_ui -Copyright 2000-2016 Free Software Foundation, Inc. +Copyright 2000-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,11 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include #include "mpfr-test.h" @@ -38,8 +36,8 @@ if (mpfr_cmp_str1(zz, zs)) { printf ("expected sum is %s, got ", zs); - mpfr_print_binary(zz); - printf ("\nmpfr_sub_ui failed for x=%s y=%lu with rnd_mode=%s\n", + mpfr_dump (zz); + printf ("mpfr_sub_ui failed for x=%s y=%lu with rnd_mode=%s\n", xs, y, mpfr_print_rnd_mode (rnd_mode)); exit (1); } @@ -76,10 +74,10 @@ printf ("Wrong inexact flag for prec=%u, rnd=%s\n", (unsigned int) p, mpfr_print_rnd_mode (rnd)); printf ("x=%u\n", x); - printf ("y="); mpfr_print_binary(y); puts (""); - printf ("u="); mpfr_print_binary(u); puts (""); - printf ("v="); mpfr_print_binary(v); puts (""); - printf ("w="); mpfr_print_binary(w); puts (""); + printf ("y="); mpfr_dump (y); + printf ("u="); mpfr_dump (u); + printf ("v="); mpfr_dump (v); + printf ("w="); mpfr_dump (w); printf ("inexact = %d\n", inexact); exit (1); } @@ -96,7 +94,9 @@ /* nan - 1 == nan */ mpfr_set_nan (x); + mpfr_clear_nanflag (); mpfr_sub_ui (y, x, 1L, MPFR_RNDN); + MPFR_ASSERTN (mpfr_nanflag_p ()); MPFR_ASSERTN (mpfr_nan_p (y)); /* +inf - 1 == +inf */ @@ -137,7 +137,7 @@ check3 ("0.9999999999", 1, MPFR_RNDN, "-10000000827403709990903735160827636718750e-50"); - test_generic (2, 1000, 100); + test_generic (MPFR_PREC_MIN, 1000, 100); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tsum.c mpfr4-4.0.2/tests/tsum.c --- mpfr4-3.1.4/tests/tsum.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tsum.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* tsum -- test file for the list summation function -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,205 +17,183 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include #include "mpfr-test.h" -static int -check_is_sorted (unsigned long n, mpfr_srcptr *perm) -{ - unsigned long i; +#ifndef MPFR_NCANCEL +#define MPFR_NCANCEL 10 +#endif - for (i = 0; i < n - 1; i++) - if (MPFR_GET_EXP(perm[i]) < MPFR_GET_EXP(perm[i+1])) - return 0; - return 1; -} +#include +/* return the cpu time in milliseconds */ static int -sum_tab (mpfr_ptr ret, mpfr_t *tab, unsigned long n, mpfr_rnd_t rnd) +cputime (void) { - mpfr_ptr *tabtmp; - unsigned long i; - int inexact; - MPFR_TMP_DECL(marker); - - MPFR_TMP_MARK(marker); - tabtmp = (mpfr_ptr *) MPFR_TMP_ALLOC(n * sizeof(mpfr_srcptr)); - for (i = 0; i < n; i++) - tabtmp[i] = tab[i]; - - inexact = mpfr_sum (ret, tabtmp, n, rnd); - MPFR_TMP_FREE(marker); - return inexact; + return clock () / (CLOCKS_PER_SEC / 1000); } - static mpfr_prec_t -get_prec_max (mpfr_t *tab, unsigned long n, mpfr_prec_t f) +get_prec_max (mpfr_t *t, int n) { - mpfr_prec_t res; - mpfr_exp_t min, max; - unsigned long i; + mpfr_exp_t e, min, max; + int i; - i = 0; - while (MPFR_IS_ZERO (tab[i])) - { - i++; - if (i == n) - return MPFR_PREC_MIN; /* all values are 0 */ - } + min = MPFR_EMAX_MAX; + max = MPFR_EMIN_MIN; + for (i = 0; i < n; i++) + if (MPFR_IS_PURE_FP (t[i])) + { + e = MPFR_GET_EXP (t[i]); + if (e > max) + max = e; + e -= MPFR_GET_PREC (t[i]); + if (e < min) + min = e; + } - if (! mpfr_check (tab[i])) - { - printf ("tab[%lu] is not valid.\n", i); - exit (1); - } - MPFR_ASSERTN (MPFR_IS_FP (tab[i])); - min = max = MPFR_GET_EXP(tab[i]); - for (i++; i < n; i++) - { - if (! mpfr_check (tab[i])) - { - printf ("tab[%lu] is not valid.\n", i); - exit (1); - } - MPFR_ASSERTN (MPFR_IS_FP (tab[i])); - if (! MPFR_IS_ZERO (tab[i])) - { - if (MPFR_GET_EXP(tab[i]) > max) - max = MPFR_GET_EXP(tab[i]); - if (MPFR_GET_EXP(tab[i]) < min) - min = MPFR_GET_EXP(tab[i]); - } - } - res = max - min; - res += f; - res += __gmpfr_ceil_log2 (n) + 1; - return res; + return min > max ? MPFR_PREC_MIN /* no pure FP values */ + : max - min + __gmpfr_ceil_log2 (n); } - static void -algo_exact (mpfr_t somme, mpfr_t *tab, unsigned long n, mpfr_prec_t f) +get_exact_sum (mpfr_t sum, mpfr_t *tab, int n) { - unsigned long i; - mpfr_prec_t prec_max; + int i; - prec_max = get_prec_max(tab, n, f); - mpfr_set_prec (somme, prec_max); - mpfr_set_ui (somme, 0, MPFR_RNDN); + mpfr_set_prec (sum, get_prec_max (tab, n)); + mpfr_set_ui (sum, 0, MPFR_RNDN); for (i = 0; i < n; i++) - { - if (mpfr_add(somme, somme, tab[i], MPFR_RNDN)) - { - printf ("FIXME: algo_exact is buggy.\n"); - exit (1); - } - } + if (mpfr_add (sum, sum, tab[i], MPFR_RNDN)) + { + printf ("FIXME: get_exact_sum is buggy.\n"); + exit (1); + } } -/* Test the sorting function */ static void -test_sort (mpfr_prec_t f, unsigned long n) +generic_tests (void) { - mpfr_t *tab; - mpfr_ptr *tabtmp; - mpfr_srcptr *perm; - unsigned long i; - mpfr_prec_t prec = MPFR_PREC_MIN; - - /* Init stuff */ - tab = (mpfr_t *) tests_allocate (n * sizeof (mpfr_t)); - for (i = 0; i < n; i++) - mpfr_init2 (tab[i], f); - tabtmp = (mpfr_ptr *) tests_allocate (n * sizeof(mpfr_ptr)); - perm = (mpfr_srcptr *) tests_allocate (n * sizeof(mpfr_srcptr)); + mpfr_t exact_sum, sum1, sum2; + mpfr_t *t; + mpfr_ptr *p; + mpfr_prec_t precmax = 444; + int i, m, nmax = 500; + int rnd_mode; - for (i = 0; i < n; i++) + t = (mpfr_t *) tests_allocate (nmax * sizeof(mpfr_t)); + p = (mpfr_ptr *) tests_allocate (nmax * sizeof(mpfr_ptr)); + for (i = 0; i < nmax; i++) { - mpfr_urandomb (tab[i], RANDS); - tabtmp[i] = tab[i]; + mpfr_init2 (t[i], precmax); + p[i] = t[i]; } + mpfr_inits2 (precmax, exact_sum, sum1, sum2, (mpfr_ptr) 0); - mpfr_sum_sort ((mpfr_srcptr *)tabtmp, n, perm, &prec); - - if (check_is_sorted (n, perm) == 0) + for (m = 0; m < 20000; m++) { - printf ("mpfr_sum_sort incorrect.\n"); + int non_uniform, n; + mpfr_prec_t prec; + + non_uniform = randlimb () % 10; + n = (randlimb () % nmax) + 1; + prec = MPFR_PREC_MIN + (randlimb () % (precmax - MPFR_PREC_MIN + 1)); + mpfr_set_prec (sum1, prec); + mpfr_set_prec (sum2, prec); + for (i = 0; i < n; i++) - mpfr_dump (perm[i]); - exit (1); + { + mpfr_set_prec (t[i], MPFR_PREC_MIN + + (randlimb () % (precmax - MPFR_PREC_MIN + 1))); + mpfr_urandomb (t[i], RANDS); + if (m % 8 != 0 && (m % 8 == 1 || (randlimb () & 1))) + mpfr_neg (t[i], t[i], MPFR_RNDN); + if (non_uniform && MPFR_NOTZERO (t[i])) + mpfr_set_exp (t[i], randlimb () % 1000); + /* putchar ("-0+"[SIGN (mpfr_sgn (t[i])) + 1]); */ + } + /* putchar ('\n'); */ + get_exact_sum (exact_sum, t, n); + RND_LOOP (rnd_mode) + if (rnd_mode == MPFR_RNDF) + { + int inex; + + inex = mpfr_set (sum1, exact_sum, MPFR_RNDD); + mpfr_sum (sum2, p, n, MPFR_RNDF); + if (! mpfr_equal_p (sum1, sum2) && + (inex == 0 || + (mpfr_nextabove (sum1), ! mpfr_equal_p (sum1, sum2)))) + { + printf ("generic_tests failed on m = %d, MPFR_RNDF\n", m); + printf ("Exact sum = "); + mpfr_dump (exact_sum); + printf ("Got "); + mpfr_dump (sum2); + exit (1); + } + } + else + { + int inex1, inex2; + + inex1 = mpfr_set (sum1, exact_sum, (mpfr_rnd_t) rnd_mode); + inex2 = mpfr_sum (sum2, p, n, (mpfr_rnd_t) rnd_mode); + if (!(mpfr_equal_p (sum1, sum2) && SAME_SIGN (inex1, inex2))) + { + printf ("generic_tests failed on m = %d, %s\n", m, + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd_mode)); + printf ("Expected "); + mpfr_dump (sum1); + printf ("with inex = %d\n", inex1); + printf ("Got "); + mpfr_dump (sum2); + printf ("with inex = %d\n", inex2); + exit (1); + } + } } - /* Clear stuff */ - for (i = 0; i < n; i++) - mpfr_clear (tab[i]); - tests_free (tab, n * sizeof (mpfr_t)); - tests_free (tabtmp, n * sizeof(mpfr_ptr)); - tests_free (perm, n * sizeof(mpfr_srcptr)); + for (i = 0; i < nmax; i++) + mpfr_clear (t[i]); + mpfr_clears (exact_sum, sum1, sum2, (mpfr_ptr) 0); + tests_free (t, nmax * sizeof(mpfr_t)); + tests_free (p, nmax * sizeof(mpfr_ptr)); } -static void -test_sum (mpfr_prec_t f, unsigned long n) +/* glibc free() error or segmentation fault when configured + * with GMP 6.0.0 built with "--disable-alloca ABI=32". + * GCC's address sanitizer shows a heap-buffer-overflow. + * Fixed in r9369 (before the merge into the trunk). The problem was due + * to the fact that mpn functions do not accept a zero size argument, and + * since mpn_add_1 is here a macro in GMP, there's no assertion even when + * GMP was built with assertion checking (--enable-assert). + */ +static +void check_simple (void) { - mpfr_t sum, real_sum, real_non_rounded; - mpfr_t *tab; - unsigned long i; - int rnd_mode; - - /* Init */ - tab = (mpfr_t *) tests_allocate (n * sizeof(mpfr_t)); - for (i = 0; i < n; i++) - mpfr_init2 (tab[i], f); - mpfr_inits2 (f, sum, real_sum, real_non_rounded, (mpfr_ptr) 0); + mpfr_t tab[3], r; + mpfr_ptr tabp[3]; + int i; - /* First Uniform */ - for (i = 0; i < n; i++) - mpfr_urandomb (tab[i], RANDS); - algo_exact (real_non_rounded, tab, n, f); - for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX; rnd_mode++) - { - sum_tab (sum, tab, n, (mpfr_rnd_t) rnd_mode); - mpfr_set (real_sum, real_non_rounded, (mpfr_rnd_t) rnd_mode); - if (mpfr_cmp (real_sum, sum) != 0) - { - printf ("mpfr_sum incorrect.\n"); - mpfr_dump (real_sum); - mpfr_dump (sum); - exit (1); - } + mpfr_init2 (r, 16); + for (i = 0; i < 3; i++) + { + mpfr_init2 (tab[i], 16); + mpfr_set_ui (tab[i], 1, MPFR_RNDN); + tabp[i] = tab[i]; } - /* Then non uniform */ - for (i = 0; i < n; i++) + i = mpfr_sum (r, tabp, 3, MPFR_RNDN); + if (mpfr_cmp_ui (r, 3) || i != 0) { - mpfr_urandomb (tab[i], RANDS); - if (! mpfr_zero_p (tab[i])) - mpfr_set_exp (tab[i], randlimb () % 1000); - } - algo_exact (real_non_rounded, tab, n, f); - for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX; rnd_mode++) - { - sum_tab (sum, tab, n, (mpfr_rnd_t) rnd_mode); - mpfr_set (real_sum, real_non_rounded, (mpfr_rnd_t) rnd_mode); - if (mpfr_cmp (real_sum, sum) != 0) - { - printf ("mpfr_sum incorrect.\n"); - mpfr_dump (real_sum); - mpfr_dump (sum); - exit (1); - } + printf ("Error in check_simple\n"); + exit (1); } - /* Clear stuff */ - for (i = 0; i < n; i++) - mpfr_clear (tab[i]); - mpfr_clears (sum, real_sum, real_non_rounded, (mpfr_ptr) 0); - tests_free (tab, n * sizeof(mpfr_t)); + mpfr_clears (tab[0], tab[1], tab[2], r, (mpfr_ptr) 0); } static @@ -225,7 +203,7 @@ mpfr_ptr tabp[3]; int i; - mpfr_inits (tab[0], tab[1], tab[2], r, (mpfr_ptr) 0); + mpfr_inits2 (53, tab[0], tab[1], tab[2], r, (mpfr_ptr) 0); tabp[0] = tab[0]; tabp[1] = tab[1]; tabp[2] = tab[2]; @@ -301,12 +279,450 @@ mpfr_clears (tab[0], tab[1], tab[2], r, (mpfr_ptr) 0); } +#define NC 7 +#define NS 6 + +static void +check_more_special (void) +{ + char *str[NC] = { "NaN", "+Inf", "-Inf", "+0", "-0", "+1", "-1" }; + int i, r, k[NS]; + mpfr_t c[NC], s[NS], sum; + mpfr_ptr p[NS]; + int inex; + + for (i = 0; i < NC; i++) + { + int ret; + mpfr_init2 (c[i], 8); + ret = mpfr_set_str (c[i], str[i], 0, MPFR_RNDN); + MPFR_ASSERTN (ret == 0); + } + for (i = 0; i < NS; i++) + mpfr_init2 (s[i], 8); + mpfr_init2 (sum, 8); + + RND_LOOP(r) + { + i = 0; + while (1) + { + while (i < NS) + { + p[i] = c[0]; + mpfr_set_nan (s[i]); + k[i++] = 0; + } + inex = mpfr_sum (sum, p, NS, (mpfr_rnd_t) r); + if (! SAME_VAL (sum, s[NS-1]) || inex != 0) + { + printf ("Error in check_more_special on %s", + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + for (i = 0; i < NS; i++) + printf (" %d", k[i]); + printf (" with\n"); + for (i = 0; i < NS; i++) + { + printf (" p[%d] = %s = ", i, str[k[i]]); + mpfr_dump (p[i]); + } + printf ("Expected "); + mpfr_dump (s[NS-1]); + printf ("with inex = 0\n"); + printf ("Got "); + mpfr_dump (sum); + printf ("with inex = %d\n", inex); + exit (1); + } + while (k[--i] == NC-1) + if (i == 0) + goto next_rnd; + p[i] = c[++k[i]]; + if (i == 0) + mpfr_set (s[i], p[i], (mpfr_rnd_t) r); + else + mpfr_add (s[i], s[i-1], p[i], (mpfr_rnd_t) r); + i++; + } + next_rnd: ; + } + + for (i = 0; i < NC; i++) + mpfr_clear (c[i]); + for (i = 0; i < NS; i++) + mpfr_clear (s[i]); + mpfr_clear (sum); +} + +/* i * 2^(46+h) + j * 2^(45+h) + k * 2^(44+h) + f * 2^(-2), + with -1 <= i, j, k <= 1, i != 0, -3 <= f <= 3, and + * prec set up so that ulp(exact sum) = 2^0, then + * prec set up so that ulp(exact sum) = 2^(44+h) when possible, + i.e. when prec >= MPFR_PREC_MIN. + ------ + Some explanations: + ulp(exact sum) = 2^q means EXP(exact sum) - prec = q where prec is + the precision of the output. Thus ulp(exact sum) = 2^0 is achieved + by setting prec = EXP(s3), where s3 is the exact sum (computed with + mpfr_add's and sufficient precision). Then ulp(exact sum) = 2^(44+h) + is achieved by subtracting 44+h from prec. The loop on prec does + this. Since EXP(s3) <= 47+h, prec <= 3 at the second iteration, + thus there will be at most 2 iterations. Whether a second iteration + is done or not depends on EXP(s3), i.e. the values of the parameters, + and the value of MPFR_PREC_MIN. */ +static void +check1 (int h) +{ + mpfr_t sum1, sum2, s1, s2, s3, t[4]; + mpfr_ptr p[4]; + int i, j, k, f, prec, r, inex1, inex2; + + mpfr_init2 (sum1, 47 + h); + mpfr_init2 (sum2, 47 + h); + mpfr_init2 (s1, 3); + mpfr_init2 (s2, 3); + mpfr_init2 (s3, 49 + h); + for (i = 0; i < 4; i++) + { + mpfr_init2 (t[i], 2); + p[i] = t[i]; + } + + for (i = -1; i <= 1; i += 2) + { + mpfr_set_si_2exp (t[0], i, 46 + h, MPFR_RNDN); + for (j = -1; j <= 1; j++) + { + mpfr_set_si_2exp (t[1], j, 45 + h, MPFR_RNDN); + inex1 = mpfr_add (s1, t[0], t[1], MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + for (k = -1; k <= 1; k++) + { + mpfr_set_si_2exp (t[2], k, 44 + h, MPFR_RNDN); + inex1 = mpfr_add (s2, s1, t[2], MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + for (f = -3; f <= 3; f++) + { + mpfr_set_si_2exp (t[3], f, -2, MPFR_RNDN); + inex1 = mpfr_add (s3, s2, t[3], MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + for (prec = mpfr_get_exp (s3); + prec >= MPFR_PREC_MIN; + prec -= 44 + h) + { + mpfr_set_prec (sum1, prec); + mpfr_set_prec (sum2, prec); + RND_LOOP_NO_RNDF (r) + { + inex1 = mpfr_set (sum1, s3, (mpfr_rnd_t) r); + inex2 = mpfr_sum (sum2, p, 4, (mpfr_rnd_t) r); + MPFR_ASSERTN (mpfr_check (sum1)); + MPFR_ASSERTN (mpfr_check (sum2)); + if (!(mpfr_equal_p (sum1, sum2) && + SAME_SIGN (inex1, inex2))) + { + printf ("Error in check1 on %s, prec = %d, " + "i = %d, j = %d, k = %d, f = %d, " + "h = %d\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r), + prec, i, j, k, f, h); + printf ("Expected "); + mpfr_dump (sum1); + printf ("with inex = %d\n", inex1); + printf ("Got "); + mpfr_dump (sum2); + printf ("with inex = %d\n", inex2); + exit (1); + } + } + } + } + } + } + } + + for (i = 0; i < 4; i++) + mpfr_clear (t[i]); + mpfr_clears (sum1, sum2, s1, s2, s3, (mpfr_ptr) 0); +} + +/* With N = 2 * GMP_NUMB_BITS: + i * 2^N + j + k * 2^(-1) + f1 * 2^(-N) + f2 * 2^(-N), + with i = -1 or 1, j = 0 or i, -1 <= k <= 1, -1 <= f1 <= 1, -1 <= f2 <= 1 + ulp(exact sum) = 2^0. */ +static void +check2 (void) +{ + mpfr_t sum1, sum2, s1, s2, s3, s4, t[5]; + mpfr_ptr p[5]; + int i, j, k, f1, f2, prec, r, inex1, inex2; + +#define N (2 * GMP_NUMB_BITS) + + mpfr_init2 (sum1, N+1); + mpfr_init2 (sum2, N+1); + mpfr_init2 (s1, N+1); + mpfr_init2 (s2, N+2); + mpfr_init2 (s3, 2*N+1); + mpfr_init2 (s4, 2*N+1); + for (i = 0; i < 5; i++) + { + mpfr_init2 (t[i], 2); + p[i] = t[i]; + } + + for (i = -1; i <= 1; i += 2) + { + mpfr_set_si_2exp (t[0], i, N, MPFR_RNDN); + for (j = 0; j != 2*i; j += i) + { + mpfr_set_si (t[1], j, MPFR_RNDN); + inex1 = mpfr_add (s1, t[0], t[1], MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + for (k = -1; k <= 1; k++) + { + mpfr_set_si_2exp (t[2], k, -1, MPFR_RNDN); + inex1 = mpfr_add (s2, s1, t[2], MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + for (f1 = -1; f1 <= 1; f1++) + { + mpfr_set_si_2exp (t[3], f1, -N, MPFR_RNDN); + inex1 = mpfr_add (s3, s2, t[3], MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + for (f2 = -1; f2 <= 1; f2++) + { + mpfr_set_si_2exp (t[4], f2, -N, MPFR_RNDN); + inex1 = mpfr_add (s4, s3, t[4], MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + prec = mpfr_get_exp (s4); + mpfr_set_prec (sum1, prec); + mpfr_set_prec (sum2, prec); + RND_LOOP_NO_RNDF (r) + { + inex1 = mpfr_set (sum1, s4, (mpfr_rnd_t) r); + inex2 = mpfr_sum (sum2, p, 5, (mpfr_rnd_t) r); + MPFR_ASSERTN (mpfr_check (sum1)); + MPFR_ASSERTN (mpfr_check (sum2)); + if (!(mpfr_equal_p (sum1, sum2) && + SAME_SIGN (inex1, inex2))) + { + printf ("Error in check2 on %s, prec = %d, " + "i = %d, j = %d, k = %d, f1 = %d, " + "f2 = %d\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r), + prec, i, j, k, f1, f2); + printf ("Expected "); + mpfr_dump (sum1); + printf ("with inex = %d\n", inex1); + printf ("Got "); + mpfr_dump (sum2); + printf ("with inex = %d\n", inex2); + exit (1); + } + } + } + } + } + } + } + + for (i = 0; i < 5; i++) + mpfr_clear (t[i]); + mpfr_clears (sum1, sum2, s1, s2, s3, s4, (mpfr_ptr) 0); +} + +/* t[i] = (2^17 - 1) * 2^(17*(i-8)) for 0 <= i <= 16. + * t[17] = 2^(17*9+1) * j for -4 <= j <= 4. + * t[18] = 2^(-1) * k for -1 <= k <= 1. + * t[19] = 2^(-17*8) * m for -3 <= m <= 3. + * prec = MPFR_PREC_MIN and 17*9+4 + */ +static void +check3 (void) +{ + mpfr_t sum1, sum2, s1, s2, s3, s4, t[20]; + mpfr_ptr p[20]; + mpfr_flags_t flags1, flags2; + int i, s, j, k, m, q, r, inex1, inex2; + int prec[2] = { MPFR_PREC_MIN, 17*9+4 }; + + mpfr_init2 (s1, 17*17); + mpfr_init2 (s2, 17*17+4); + mpfr_init2 (s3, 17*17+4); + mpfr_init2 (s4, 17*17+5); + mpfr_set_ui (s1, 0, MPFR_RNDN); + for (i = 0; i < 20; i++) + { + mpfr_init2 (t[i], 20); + p[i] = t[i]; + if (i < 17) + { + mpfr_set_ui_2exp (t[i], 0x1ffff, 17*(i-8), MPFR_RNDN); + inex1 = mpfr_add (s1, s1, t[i], MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + } + } + + for (s = 1; s >= -1; s -= 2) + { + for (j = -4; j <= 4; j++) + { + mpfr_set_si_2exp (t[17], j, 17*9+1, MPFR_RNDN); + inex1 = mpfr_add (s2, s1, t[17], MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + for (k = -1; k <= 1; k++) + { + mpfr_set_si_2exp (t[18], k, -1, MPFR_RNDN); + inex1 = mpfr_add (s3, s2, t[18], MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + for (m = -3; m <= 3; m++) + { + mpfr_set_si_2exp (t[19], m, -17*8, MPFR_RNDN); + inex1 = mpfr_add (s4, s3, t[19], MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + for (q = 0; q < 2; q++) + { + mpfr_inits2 (prec[q], sum1, sum2, (mpfr_ptr) 0); + RND_LOOP_NO_RNDF (r) + { + mpfr_clear_flags (); + inex1 = mpfr_set (sum1, s4, (mpfr_rnd_t) r); + flags1 = __gmpfr_flags; + mpfr_clear_flags (); + inex2 = mpfr_sum (sum2, p, 20, (mpfr_rnd_t) r); + flags2 = __gmpfr_flags; + MPFR_ASSERTN (mpfr_check (sum1)); + MPFR_ASSERTN (mpfr_check (sum2)); + if (!(mpfr_equal_p (sum1, sum2) && + SAME_SIGN (inex1, inex2) && + flags1 == flags2)) + { + printf ("Error in check3 on %s, " + "s = %d, j = %d, k = %d, m = %d\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r), + s, j, k, m); + printf ("Expected "); + mpfr_dump (sum1); + printf ("with inex = %d and flags =", inex1); + flags_out (flags1); + printf ("Got "); + mpfr_dump (sum2); + printf ("with inex = %d and flags =", inex2); + flags_out (flags2); + exit (1); + } + } + mpfr_clears (sum1, sum2, (mpfr_ptr) 0); + } /* q */ + } /* m */ + } /* k */ + } /* j */ + for (i = 0; i < 17; i++) + mpfr_neg (t[i], t[i], MPFR_RNDN); + mpfr_neg (s1, s1, MPFR_RNDN); + } /* s */ + + for (i = 0; i < 20; i++) + mpfr_clear (t[i]); + mpfr_clears (s1, s2, s3, s4, (mpfr_ptr) 0); +} + +/* Test of s * (q * 2^(n-1) - 2^k) + h + i * 2^(-2) + j * 2^(-2) + * with h = -1 or 1, -1 <= i odd <= j <= 3, 2 <= q <= 3, s = -1 or 1, + * prec n-k. + * On a 64-bit machine: + * MPFR_RNDN, tmd=2, rbit=0, sst=0, negative is checked with the inputs + * -3*2^58, 2^5, -1, 2^(-2), 3*2^(-2) + * MPFR_RNDN, tmd=2, rbit=0, sst=1, negative is checked with the inputs + * -3*2^58, 2^5, -1, 3*2^(-2), 3*2^(-2) + * + * Note: This test detects an error in a result when "sq + 3" is replaced + * by "sq + 2" (11th argument of the first sum_raw invocation) and the + * corresponding assertion d >= 3 is removed, confirming that one cannot + * decrease this proved error bound. + */ +static void +check4 (void) +{ + mpfr_t sum1, sum2, s1, s2, s3, s4, t[5]; + mpfr_ptr p[5]; + int h, i, j, k, n, q, r, s, prec, inex1, inex2; + + mpfr_inits2 (257, sum1, sum2, s1, s2, s3, s4, (mpfr_ptr) 0); + for (i = 0; i < 5; i++) + { + mpfr_init2 (t[i], 2); + p[i] = t[i]; + } + + /* No GNU style for the many nested loops... */ + for (k = 1; k <= 64; k++) { + mpfr_set_si_2exp (t[0], -1, k, MPFR_RNDN); + for (n = k + MPFR_PREC_MIN; n <= k + 65; n++) { + prec = n - k; + mpfr_set_prec (sum1, prec); + mpfr_set_prec (sum2, prec); + for (q = 2; q <= 3; q++) { + mpfr_set_si_2exp (t[1], q, n - 1, MPFR_RNDN); + inex1 = mpfr_add (s1, t[0], t[1], MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + for (s = -1; s <= 1; s += 2) { + mpfr_neg (t[0], t[0], MPFR_RNDN); + mpfr_neg (t[1], t[1], MPFR_RNDN); + mpfr_neg (s1, s1, MPFR_RNDN); + for (h = -1; h <= 1; h += 2) { + mpfr_set_si (t[2], h, MPFR_RNDN); + inex1 = mpfr_add (s2, s1, t[2], MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + for (i = -1; i <= 3; i += 2) { + mpfr_set_si_2exp (t[3], i, -2, MPFR_RNDN); + inex1 = mpfr_add (s3, s2, t[3], MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + for (j = i; j <= 3; j++) { + mpfr_set_si_2exp (t[4], j, -2, MPFR_RNDN); + inex1 = mpfr_add (s4, s3, t[4], MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + RND_LOOP_NO_RNDF (r) { + inex1 = mpfr_set (sum1, s4, (mpfr_rnd_t) r); + inex2 = mpfr_sum (sum2, p, 5, (mpfr_rnd_t) r); + MPFR_ASSERTN (mpfr_check (sum1)); + MPFR_ASSERTN (mpfr_check (sum2)); + if (!(mpfr_equal_p (sum1, sum2) && + SAME_SIGN (inex1, inex2))) + { + printf ("Error in check4 on %s, " + "k = %d, n = %d (prec %d), " + "q = %d, s = %d, h = %d, i = %d, j = %d\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r), + k, n, prec, q, s, h, i, j); + printf ("Expected "); + mpfr_dump (sum1); + printf ("with inex = %d\n", inex1); + printf ("Got "); + mpfr_dump (sum2); + printf ("with inex = %d\n", inex2); + exit (1); + } + } + } + } + } + } + } + } + } + + for (i = 0; i < 5; i++) + mpfr_clear (t[i]); + mpfr_clears (sum1, sum2, s1, s2, s3, s4, (mpfr_ptr) 0); +} + /* bug reported by Joseph S. Myers on 2013-10-27 https://sympa.inria.fr/sympa/arc/mpfr/2013-10/msg00015.html */ static void bug20131027 (void) { - mpfr_t r, t[4]; + mpfr_t sum, t[4]; mpfr_ptr p[4]; char *s[4] = { "0x1p1000", @@ -314,44 +730,607 @@ "-0x1p947", "0x1p880" }; - int i; + int i, r; + + mpfr_init2 (sum, 53); - mpfr_init2 (r, 53); for (i = 0; i < 4; i++) { mpfr_init2 (t[i], i == 0 ? 53 : 1000); mpfr_set_str (t[i], s[i], 0, MPFR_RNDN); p[i] = t[i]; } - mpfr_sum (r, p, 4, MPFR_RNDN); - if (MPFR_NOTZERO (r)) + RND_LOOP(r) + { + int expected_sign = (mpfr_rnd_t) r == MPFR_RNDD ? -1 : 1; + int inex; + + inex = mpfr_sum (sum, p, 4, (mpfr_rnd_t) r); + + if (MPFR_NOTZERO (sum) || MPFR_SIGN (sum) != expected_sign || inex != 0) + { + printf ("mpfr_sum incorrect in bug20131027 for %s:\n" + "expected %c0 with inex = 0, got ", + mpfr_print_rnd_mode ((mpfr_rnd_t) r), + expected_sign > 0 ? '+' : '-'); + mpfr_dump (sum); + printf ("with inex = %d\n", inex); + exit (1); + } + } + + for (i = 0; i < 4; i++) + mpfr_clear (t[i]); + mpfr_clear (sum); +} + +/* Occurs in branches/new-sum/src/sum.c@9344 on a 64-bit machine. */ +static void +bug20150327 (void) +{ + mpfr_t sum1, sum2, t[3]; + mpfr_ptr p[3]; + char *s[3] = { "0.10000111110101000010101011100001", "1E-100", "0.1E95" }; + int i, r; + + mpfr_inits2 (58, sum1, sum2, (mpfr_ptr) 0); + + for (i = 0; i < 3; i++) + { + mpfr_init2 (t[i], 64); + mpfr_set_str (t[i], s[i], 2, MPFR_RNDN); + p[i] = t[i]; + } + + RND_LOOP_NO_RNDF (r) + { + int inex1, inex2; + + mpfr_set (sum1, t[2], MPFR_RNDN); + inex1 = -1; + if (MPFR_IS_LIKE_RNDU ((mpfr_rnd_t) r, 1)) + { + mpfr_nextabove (sum1); + inex1 = 1; + } + + inex2 = mpfr_sum (sum2, p, 3, (mpfr_rnd_t) r); + + if (!(mpfr_equal_p (sum1, sum2) && SAME_SIGN (inex1, inex2))) + { + printf ("mpfr_sum incorrect in bug20150327 for %s:\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); + printf ("Expected "); + mpfr_dump (sum1); + printf ("with inex = %d\n", inex1); + printf ("Got "); + mpfr_dump (sum2); + printf ("with inex = %d\n", inex2); + exit (1); + } + } + + for (i = 0; i < 3; i++) + mpfr_clear (t[i]); + mpfr_clears (sum1, sum2, (mpfr_ptr) 0); +} + +/* TODO: A test with more inputs (but can't be compared to mpfr_add). */ +static void +check_extreme (void) +{ + mpfr_t u, v, w, x, y; + mpfr_ptr t[2]; + int i, inex1, inex2, r; + + t[0] = u; + t[1] = v; + + mpfr_inits2 (32, u, v, w, x, y, (mpfr_ptr) 0); + mpfr_setmin (u, mpfr_get_emax ()); + mpfr_setmax (v, mpfr_get_emin ()); + mpfr_setmin (w, mpfr_get_emax () - 40); + RND_LOOP_NO_RNDF (r) + for (i = 0; i < 2; i++) + { + mpfr_set_prec (x, 64); + inex1 = mpfr_add (x, u, w, MPFR_RNDN); + MPFR_ASSERTN (inex1 == 0); + inex1 = mpfr_prec_round (x, 32, (mpfr_rnd_t) r); + inex2 = mpfr_sum (y, t, 2, (mpfr_rnd_t) r); + if (!(mpfr_equal_p (x, y) && SAME_SIGN (inex1, inex2))) + { + printf ("Error in check_extreme (%s, i = %d)\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r), i); + printf ("Expected "); + mpfr_dump (x); + printf ("with inex = %d\n", inex1); + printf ("Got "); + mpfr_dump (y); + printf ("with inex = %d\n", inex2); + exit (1); + } + mpfr_neg (v, v, MPFR_RNDN); + mpfr_neg (w, w, MPFR_RNDN); + } + mpfr_clears (u, v, w, x, y, (mpfr_ptr) 0); +} + +/* Generic random tests with cancellations. + * + * In summary, we do 4000 tests of the following form: + * 1. We set the first MPFR_NCANCEL members of an array to random values, + * with a random exponent taken in 4 ranges, depending on the value of + * i % 4 (see code below). + * 2. For each of the next MPFR_NCANCEL iterations: + * A. we randomly permute some terms of the array (to make sure that a + * particular order doesn't have an influence on the result); + * B. we compute the sum in a random rounding mode; + * C. if this sum is zero, we end the current test (there is no longer + * anything interesting to test); + * D. we check that this sum is below some bound (chosen as infinite + * for the first iteration of (2), i.e. this test will be useful + * only for the next iterations, after cancellations); + * E. we put the opposite of this sum in the array, the goal being to + * introduce a chain of cancellations; + * F. we compute the bound for the next iteration, derived from (E). + * 3. We do another iteration like (2), but with reusing a random element + * of the array. This last test allows one to check the support of + * reused arguments. Before this support (r10467), it triggers an + * assertion failure with (almost?) all seeds, and if assertions are + * not checked, tsum fails in most cases but not all. + */ +static void +cancel (void) +{ + mpfr_t x[2 * MPFR_NCANCEL], bound; + mpfr_ptr px[2 * MPFR_NCANCEL]; + int i, j, k, n; + + mpfr_init2 (bound, 2); + + /* With 4000 tests, tsum will fail in most cases without support of + reused arguments (before r10467). */ + for (i = 0; i < 4000; i++) { - printf ("mpfr_sum incorrect in bug20131027: expected 0, got\n"); + mpfr_set_inf (bound, 1); + for (n = 0; n <= numberof (x); n++) + { + mpfr_prec_t p; + mpfr_rnd_t rnd; + + if (n < numberof (x)) + { + px[n] = x[n]; + p = MPFR_PREC_MIN + (randlimb () % 256); + mpfr_init2 (x[n], p); + k = n; + } + else + { + /* Reuse of a random member of the array. */ + k = randlimb () % n; + } + + if (n < MPFR_NCANCEL) + { + mpfr_exp_t e; + + MPFR_ASSERTN (n < numberof (x)); + e = (i & 1) ? 0 : mpfr_get_emin (); + tests_default_random (x[n], 256, e, + ((i & 2) ? e + 2000 : mpfr_get_emax ()), + 0); + } + else + { + /* random permutation with n random transpositions */ + for (j = 0; j < n; j++) + { + int k1, k2; + + k1 = randlimb () % (n-1); + k2 = randlimb () % (n-1); + mpfr_swap (x[k1], x[k2]); + } + + rnd = RND_RAND (); + +#if MPFR_DEBUG + printf ("mpfr_sum cancellation test\n"); + for (j = 0; j < n; j++) + { + printf (" x%d[%3ld] = ", j, mpfr_get_prec(x[j])); + mpfr_out_str (stdout, 16, 0, x[j], MPFR_RNDN); + printf ("\n"); + } + printf (" rnd = %s, output prec = %ld\n", + mpfr_print_rnd_mode (rnd), mpfr_get_prec (x[n])); +#endif + + mpfr_sum (x[k], px, n, rnd); + + if (mpfr_zero_p (x[k])) + { + if (k == n) + n++; + break; + } + + if (mpfr_cmpabs (x[k], bound) > 0) + { + printf ("Error in cancel on i = %d, n = %d\n", i, n); + printf ("Expected bound: "); + mpfr_dump (bound); + printf ("x[%d]: ", k); + mpfr_dump (x[k]); + exit (1); + } + + if (k != n) + break; + + /* For the bound, use MPFR_RNDU due to possible underflow. + It would be nice to add some specific underflow checks, + though there are already ones in check_underflow(). */ + mpfr_set_ui_2exp (bound, 1, + mpfr_get_exp (x[n]) - p - (rnd == MPFR_RNDN), + MPFR_RNDU); + /* The next sum will be <= bound in absolute value + (the equality can be obtained in all rounding modes + since the sum will be rounded). */ + + mpfr_neg (x[n], x[n], MPFR_RNDN); + } + } + + while (--n >= 0) + mpfr_clear (x[n]); + } + + mpfr_clear (bound); +} + +#ifndef NOVFL +# define NOVFL 30 +#endif + +static void +check_overflow (void) +{ + mpfr_t sum1, sum2, x, y; + mpfr_ptr t[2 * NOVFL]; + mpfr_exp_t emin, emax; + int i, r; + + emin = mpfr_get_emin (); + emax = mpfr_get_emax (); + set_emin (MPFR_EMIN_MIN); + set_emax (MPFR_EMAX_MAX); + + mpfr_inits2 (32, sum1, sum2, x, y, (mpfr_ptr) 0); + mpfr_setmax (x, mpfr_get_emax ()); + mpfr_neg (y, x, MPFR_RNDN); + + for (i = 0; i < 2 * NOVFL; i++) + t[i] = i < NOVFL ? x : y; + + /* Two kinds of test: + * i = 1: overflow. + * i = 2: intermediate overflow (exact sum is 0). + */ + for (i = 1; i <= 2; i++) + RND_LOOP(r) + { + int inex1, inex2; + + inex1 = mpfr_add (sum1, x, i == 1 ? x : y, (mpfr_rnd_t) r); + inex2 = mpfr_sum (sum2, t, i * NOVFL, (mpfr_rnd_t) r); + MPFR_ASSERTN (mpfr_check (sum1)); + MPFR_ASSERTN (mpfr_check (sum2)); + if (!(mpfr_equal_p (sum1, sum2) && SAME_SIGN (inex1, inex2))) + { + printf ("Error in check_overflow on %s, i = %d\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r), i); + printf ("Expected "); + mpfr_dump (sum1); + printf ("with inex = %d\n", inex1); + printf ("Got "); + mpfr_dump (sum2); + printf ("with inex = %d\n", inex2); + exit (1); + } + } + + mpfr_clears (sum1, sum2, x, y, (mpfr_ptr) 0); + + set_emin (emin); + set_emax (emax); +} + +#ifndef NUNFL +# define NUNFL 9 +#endif + +static void +check_underflow (void) +{ + mpfr_t sum1, sum2, t[NUNFL]; + mpfr_ptr p[NUNFL]; + mpfr_prec_t precmax = 444; + mpfr_exp_t emin, emax; + unsigned int ex_flags, flags; + int c, i; + + emin = mpfr_get_emin (); + emax = mpfr_get_emax (); + set_emin (MPFR_EMIN_MIN); + set_emax (MPFR_EMAX_MAX); + + ex_flags = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT; + + mpfr_init2 (sum1, MPFR_PREC_MIN); + mpfr_init2 (sum2, precmax); + + for (i = 0; i < NUNFL; i++) + { + mpfr_init2 (t[i], precmax); + p[i] = t[i]; + } + + for (c = 0; c < 8; c++) + { + mpfr_prec_t fprec; + int n, neg, r; + + fprec = MPFR_PREC_MIN + (randlimb () % (precmax - MPFR_PREC_MIN + 1)); + n = 3 + (randlimb () % (NUNFL - 2)); + MPFR_ASSERTN (n <= NUNFL); + + mpfr_set_prec (sum2, (randlimb () & 1) ? MPFR_PREC_MIN : precmax); + mpfr_set_prec (t[0], fprec + 64); + mpfr_set_zero (t[0], 1); + + for (i = 1; i < n; i++) + { + int inex; + + mpfr_set_prec (t[i], MPFR_PREC_MIN + + (randlimb () % (fprec - MPFR_PREC_MIN + 1))); + do + mpfr_urandomb (t[i], RANDS); + while (MPFR_IS_ZERO (t[i])); + mpfr_set_exp (t[i], MPFR_EMIN_MIN); + inex = mpfr_sub (t[0], t[0], t[i], MPFR_RNDN); + MPFR_ASSERTN (inex == 0); + } + + neg = randlimb () & 1; + if (neg) + mpfr_nextbelow (t[0]); + else + mpfr_nextabove (t[0]); + + RND_LOOP(r) + { + int inex1, inex2; + + mpfr_set_zero (sum1, 1); + if (neg) + mpfr_nextbelow (sum1); + else + mpfr_nextabove (sum1); + inex1 = mpfr_div_2ui (sum1, sum1, 2, (mpfr_rnd_t) r); + + mpfr_clear_flags (); + inex2 = mpfr_sum (sum2, p, n, (mpfr_rnd_t) r); + flags = __gmpfr_flags; + + MPFR_ASSERTN (mpfr_check (sum1)); + MPFR_ASSERTN (mpfr_check (sum2)); + + if (flags != ex_flags) + { + printf ("Bad flags in check_underflow on %s, c = %d\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r), c); + printf ("Expected flags:"); + flags_out (ex_flags); + printf ("Got flags: "); + flags_out (flags); + printf ("sum = "); + mpfr_dump (sum2); + exit (1); + } + + if (!(mpfr_equal_p (sum1, sum2) && SAME_SIGN (inex1, inex2))) + { + printf ("Error in check_underflow on %s, c = %d\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r), c); + printf ("Expected "); + mpfr_dump (sum1); + printf ("with inex = %d\n", inex1); + printf ("Got "); + mpfr_dump (sum2); + printf ("with inex = %d\n", inex2); + exit (1); + } + } + } + + for (i = 0; i < NUNFL; i++) + mpfr_clear (t[i]); + mpfr_clears (sum1, sum2, (mpfr_ptr) 0); + + set_emin (emin); + set_emax (emax); +} + +static void +check_coverage (void) +{ +#ifdef MPFR_COV_CHECK + int r, i, j, k, p, q; + int err = 0; + + RND_LOOP_NO_RNDF (r) + for (i = 0; i < 1 + ((mpfr_rnd_t) r == MPFR_RNDN); i++) + for (j = 0; j < 2; j++) + for (k = 0; k < 3; k++) + for (p = 0; p < 2; p++) + for (q = 0; q < 2; q++) + if (!__gmpfr_cov_sum_tmd[r][i][j][k][p][q]) + { + printf ("TMD not tested on %s, tmd=%d, rbit=%d, sst=%d," + " %s, sq %s MPFR_PREC_MIN\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) r), i+1, j, k-1, + p ? "pos" : "neg", q ? ">" : "=="); + err = 1; + } + + if (err) + exit (1); +#endif +} + +static int +mpfr_sum_naive (mpfr_t s, mpfr_t *x, int n, mpfr_rnd_t rnd) +{ + int ret, i; + switch (n) + { + case 0: + return mpfr_set_ui (s, 0, rnd); + case 1: + return mpfr_set (s, x[0], rnd); + default: + ret = mpfr_add (s, x[0], x[1], rnd); + for (i = 2; i < n; i++) + ret = mpfr_add (s, s, x[i], rnd); + return ret; + } +} + +/* check adding n random numbers, iterated k times */ +static void +check_random (int n, int k, mpfr_prec_t prec, mpfr_rnd_t rnd) +{ + mpfr_t *x, s, ref_s; + mpfr_ptr *y; + int i, st, ret = 0, ref_ret = 0; + gmp_randstate_t state; + + gmp_randinit_default (state); + mpfr_init2 (s, prec); + mpfr_init2 (ref_s, prec); + x = (mpfr_t *) tests_allocate (n * sizeof (mpfr_t)); + y = (mpfr_ptr *) tests_allocate (n * sizeof (mpfr_ptr)); + for (i = 0; i < n; i++) + { + y[i] = x[i]; + mpfr_init2 (x[i], prec); + mpfr_urandom (x[i], state, rnd); + } + + st = cputime (); + for (i = 0; i < k; i++) + ref_ret = mpfr_sum_naive (ref_s, x, n, rnd); + printf ("mpfr_sum_naive took %dms\n", cputime () - st); + + st = cputime (); + for (i = 0; i < k; i++) + ret = mpfr_sum (s, y, n, rnd); + printf ("mpfr_sum took %dms\n", cputime () - st); + + if (n <= 2) + { + MPFR_ASSERTN (mpfr_cmp (ref_s, s) == 0); + MPFR_ASSERTN (ref_ret == ret); + } + + for (i = 0; i < n; i++) + mpfr_clear (x[i]); + tests_free (x, n * sizeof (mpfr_t)); + tests_free (y, n * sizeof (mpfr_ptr)); + mpfr_clear (s); + mpfr_clear (ref_s); + gmp_randclear (state); +} + +/* This bug appears when porting sum.c for MPFR 3.1.4 (0.11E826 is returned), + but does not appear in the trunk. It was due to buggy MPFR_IS_LIKE_RNDD + and MPFR_IS_LIKE_RNDU macros. The fix was done in r9295 in the trunk and + it has been merged in r10234 in the 3.1 branch. Note: the bug would have + been caught by generic_tests anyway, but a simple testcase is easier for + checking with log messages (MPFR_LOG_ALL=1). */ +static void +bug20160315 (void) +{ + mpfr_t r, t[4]; + mpfr_ptr p[4]; + char *s[4] = { "0.10E20", "0", "0.11E382", "0.10E826" }; + int i; + + mpfr_init2 (r, 2); + for (i = 0; i < 4; i++) + { + mpfr_init2 (t[i], 2); + mpfr_set_str_binary (t[i], s[i]); + p[i] = t[i]; + } + mpfr_sum (r, p, 4, MPFR_RNDN); + if (! mpfr_equal_p (r, t[3])) + { + printf ("Error in bug20160315.\n"); + printf ("Expected "); + mpfr_dump (t[3]); + printf ("Got "); mpfr_dump (r); exit (1); } - for (i = 0; i < 4; i++) mpfr_clear (t[i]); mpfr_clear (r); } int -main (void) +main (int argc, char *argv[]) { - mpfr_prec_t p; - unsigned long n; + int h; + + if (argc == 5) + { + check_random (atoi (argv[1]), atoi (argv[2]), atoi (argv[3]), + (mpfr_rnd_t) atoi (argv[4])); + return 0; + } tests_start_mpfr (); + if (argc != 1) + { + fprintf (stderr, "Usage: tsum\n tsum n k prec rnd\n"); + exit (1); + } + + check_simple (); check_special (); + check_more_special (); + for (h = 0; h <= 64; h++) + check1 (h); + check2 (); + check3 (); + check4 (); bug20131027 (); - test_sort (1764, 1026); - for (p = 2 ; p < 444 ; p += 17) - for (n = 2 ; n < 1026 ; n += 42 + p) - test_sum (p, n); + bug20150327 (); + bug20160315 (); + generic_tests (); + check_extreme (); + cancel (); + check_overflow (); + check_underflow (); + check_coverage (); tests_end_mpfr (); return 0; } diff -Nru mpfr4-3.1.4/tests/tswap.c mpfr4-4.0.2/tests/tswap.c --- mpfr4-3.1.4/tests/tswap.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tswap.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_swap. -Copyright 2000-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2000-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" int diff -Nru mpfr4-3.1.4/tests/ttan.c mpfr4-4.0.2/tests/ttan.c --- mpfr4-3.1.4/tests/ttan.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/tests/ttan.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_tan. -Copyright 2001-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 2001-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_tan @@ -95,6 +92,46 @@ mpfr_clear (y); } +/* This test was generated from bad_cases, with GMP_CHECK_RANDOMIZE=1514257254. + For the x value below, we have tan(x) = -1.875 + epsilon, + thus with RNDZ it should be rounded to -1.c. */ +static void +bug20171218 (void) +{ + mpfr_t x, y, z; + mpfr_init2 (x, 804); + mpfr_init2 (y, 4); + mpfr_init2 (z, 4); + mpfr_set_str (x, "-1.14b1dd5f90ce0eded2a8f59c05e72daf7cc4c78f5075d73246fa420e2c026291d9377e67e7f54e925c4aed39c7b2f917424033c8612f00a19821890558d6c2cef9c60f4ad2c3b061ed53a1709dc1ec8e139627c2119c36d7ebdff0d715e559b47f740c534", 16, MPFR_RNDN); + mpfr_tan (y, x, MPFR_RNDZ); + mpfr_set_str (z, "-1.c", 16, MPFR_RNDN); + MPFR_ASSERTN(mpfr_equal_p (y, z)); + mpfr_clear (x); + mpfr_clear (y); + mpfr_clear (z); +} + +static void +coverage (void) +{ + mpfr_t x, y; + int inex; + mpfr_exp_t emax; + + /* exercise mpfr_round_near_x when rounding gives an overflow */ + emax = mpfr_get_emax (); + mpfr_set_emax (-2); + mpfr_init2 (x, 2); + mpfr_init2 (y, 2); + mpfr_setmax (x, mpfr_get_emax ()); + inex = mpfr_tan (y, x, MPFR_RNDA); + MPFR_ASSERTN(inex > 0); + MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_signbit (y) == 0); + mpfr_clear (x); + mpfr_clear (y); + mpfr_set_emax (emax); +} + int main (int argc, char *argv[]) { @@ -105,6 +142,8 @@ tests_start_mpfr (); + coverage (); + bug20171218 (); check_nans (); mpfr_init (x); @@ -115,9 +154,8 @@ if (mpfr_cmp_ui_2exp(x, 1, -1)) { printf ("mpfr_tan(0.5, MPFR_RNDD) failed\n" - "expected 0.5, got"); - mpfr_print_binary(x); - putchar('\n'); + "expected 0.5, got "); + mpfr_dump (x); exit (1); } @@ -153,7 +191,7 @@ mpfr_clear (x); - test_generic (2, 100, 10); + test_generic (MPFR_PREC_MIN, 100, 10); data_check ("data/tan", mpfr_tan, "mpfr_tan"); bad_cases (mpfr_tan, mpfr_atan, "mpfr_tan", 256, -256, 255, 4, 128, 800, 40); diff -Nru mpfr4-3.1.4/tests/ttanh.c mpfr4-4.0.2/tests/ttanh.c --- mpfr4-3.1.4/tests/ttanh.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/ttanh.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_tanh. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_tanh @@ -119,15 +116,35 @@ mpfr_clear (x); } +/* This test was generated from bad_cases, with input y=-7.778@-1 = -3823/8192. + For the x value below, we have atanh(y) < x, thus since tanh() is increasing, + y < tanh(x), and thus tanh(x) rounded towards zero should give -3822/8192. */ +static void +bug20171218 (void) +{ + mpfr_t x, y, z; + mpfr_init2 (x, 813); + mpfr_init2 (y, 12); + mpfr_init2 (z, 12); + mpfr_set_str (x, "-8.17cd20bfc17ae00935dc3abad8e17ab43d3ef7740c320798eefb93191f4a62dba9a2daa5efb6eace21130abd87e3ee2eadd2ad8ddae883d2f2db5dee1ac7ce3c59d16eca09e2ca3f21dc2a0386c037a0d3972e62d5b6e82446032020705553c566b1df24f40@-1", 16, MPFR_RNDN); + mpfr_tanh (y, x, MPFR_RNDZ); + mpfr_set_str (z, "-7.770@-1", 16, MPFR_RNDN); + MPFR_ASSERTN(mpfr_equal_p (y, z)); + mpfr_clear (x); + mpfr_clear (y); + mpfr_clear (z); +} + int main (int argc, char *argv[]) { tests_start_mpfr (); + bug20171218 (); special_overflow (); special (); - test_generic (2, 100, 100); + test_generic (MPFR_PREC_MIN, 100, 100); data_check ("data/tanh", mpfr_tanh, "mpfr_tanh"); bad_cases (mpfr_tanh, mpfr_atanh, "mpfr_tanh", 256, -128, 0, diff -Nru mpfr4-3.1.4/tests/ttrunc.c mpfr4-4.0.2/tests/ttrunc.c --- mpfr4-3.1.4/tests/ttrunc.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/ttrunc.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_trunc, mpfr_ceil, mpfr_floor. -Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define SIZEX 100 @@ -42,8 +39,7 @@ if (mpfr_cmp_ui (y, 1)) { printf ("Error in mpfr_ceil for x=0.5: expected 1.0, got "); - mpfr_print_binary(y); - putchar('\n'); + mpfr_dump (y); exit (1); } @@ -52,8 +48,7 @@ if (mpfr_cmp_ui(y,0)) { printf ("Error in mpfr_ceil for x=0.0: expected 0.0, got "); - mpfr_print_binary(y); - putchar('\n'); + mpfr_dump (y); exit (1); } @@ -62,8 +57,7 @@ if (mpfr_cmp_ui(y,1)) { printf ("Error in mpfr_ceil for x=1.0: expected 1.0, got "); - mpfr_print_binary(y); - putchar('\n'); + mpfr_dump (y); exit (1); } @@ -92,34 +86,25 @@ if (!mpfr_eq(y, y2, k)) { - printf("Error in floor, x = "); mpfr_print_binary(x); - printf("\n"); - printf("floor(x) = "); mpfr_print_binary(y); - printf("\n"); - printf("round(x, RNDD) = "); mpfr_print_binary(y2); - printf("\n"); + printf ("Error in floor, x = "); mpfr_dump (x); + printf ("floor(x) = "); mpfr_dump (y); + printf ("round(x, RNDD) = "); mpfr_dump (y2); exit(1); } if (!mpfr_eq(z, z2, k)) { - printf("Error in trunc, x = "); mpfr_print_binary(x); - printf("\n"); - printf("trunc(x) = "); mpfr_print_binary(z); - printf("\n"); - printf("round(x, RNDZ) = "); mpfr_print_binary(z2); - printf("\n"); + printf ("Error in trunc, x = "); mpfr_dump (x); + printf ("trunc(x) = "); mpfr_dump (z); + printf ("round(x, RNDZ) = "); mpfr_dump (z2); exit(1); } if (!mpfr_eq(y, y2, k)) { - printf("Error in ceil, x = "); mpfr_print_binary(x); - printf("\n"); - printf("ceil(x) = "); mpfr_print_binary(t); - printf("\n"); - printf("round(x, RNDU) = "); mpfr_print_binary(t2); - printf("\n"); + printf ("Error in ceil, x = "); mpfr_dump (x); + printf ("ceil(x) = "); mpfr_dump (t); + printf ("round(x, RNDU) = "); mpfr_dump (t2); exit(1); } MPFR_EXP(x)++; diff -Nru mpfr4-3.1.4/tests/tui_div.c mpfr4-4.0.2/tests/tui_div.c --- mpfr4-3.1.4/tests/tui_div.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tui_div.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_ui_div. -Copyright 2000-2016 Free Software Foundation, Inc. +Copyright 2000-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" /* checks that y/x gives the right result with 53 bits of precision */ @@ -58,7 +55,7 @@ mpfr_init (y); mpfr_init (z); - for (px = 2; px < 300; px++) + for (px = MPFR_PREC_MIN; px < 300; px++) { mpfr_set_prec (x, px); do @@ -67,7 +64,7 @@ } while (mpfr_cmp_ui (x, 0) == 0); u = randlimb (); - for (py = 2; py < 300; py++) + for (py = MPFR_PREC_MIN; py < 300; py++) { mpfr_set_prec (y, py); mpfr_set_prec (z, py + px); @@ -80,7 +77,7 @@ exit (1); } cmp = mpfr_cmp_ui (z, u); - if (! SAME_SIGN (inexact, cmp)) + if (rnd != MPFR_RNDF && ! SAME_SIGN (inexact, cmp)) { printf ("Wrong inexact flag for u=%lu, rnd=%s\n", u, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); @@ -107,13 +104,12 @@ mpfr_init2 (d, 100L); mpfr_init2 (q, 100L); - /* 1/+inf == 0 */ + /* 1/+inf == +0 */ MPFR_SET_INF (d); MPFR_SET_POS (d); mpfr_clear_flags (); MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */ - MPFR_ASSERTN (mpfr_number_p (q)); - MPFR_ASSERTN (mpfr_sgn (q) == 0); + MPFR_ASSERTN (MPFR_IS_ZERO (q) && MPFR_IS_POS (q)); MPFR_ASSERTN (__gmpfr_flags == 0); /* 1/-inf == -0 */ @@ -121,8 +117,7 @@ MPFR_SET_NEG (d); mpfr_clear_flags (); MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */ - MPFR_ASSERTN (mpfr_number_p (q)); - MPFR_ASSERTN (mpfr_sgn (q) == 0); + MPFR_ASSERTN (MPFR_IS_ZERO (q) && MPFR_IS_NEG (q)); MPFR_ASSERTN (__gmpfr_flags == 0); /* 1/nan == nan */ @@ -158,14 +153,14 @@ mpfr_set_ui (d, 1L, MPFR_RNDN); mpfr_clear_flags (); MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, MPFR_RNDZ) == 0); /* exact */ - MPFR_ASSERTN (mpfr_cmp_ui (q, 0) == 0 && MPFR_IS_POS (q)); + MPFR_ASSERTN (MPFR_IS_ZERO (q) && MPFR_IS_POS (q)); MPFR_ASSERTN (__gmpfr_flags == 0); /* 0/-1 = -0 */ mpfr_set_si (d, -1, MPFR_RNDN); mpfr_clear_flags (); MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, MPFR_RNDZ) == 0); /* exact */ - MPFR_ASSERTN (mpfr_cmp_ui (q, 0) == 0 && MPFR_IS_NEG (q)); + MPFR_ASSERTN (MPFR_IS_ZERO (q) && MPFR_IS_NEG (q)); MPFR_ASSERTN (__gmpfr_flags == 0); mpfr_clear (d); @@ -184,7 +179,7 @@ mpfr_exp_t emin, emax; mpfr_t x, y1, y2; int inex1, inex2, rnd_mode; - unsigned int flags1, flags2; + mpfr_flags_t flags1, flags2; emin = mpfr_get_emin (); emax = mpfr_get_emax (); @@ -247,7 +242,7 @@ "-6.8938315017943889615e-297"); check_overflow (); - test_generic (2, 1000, 100); + test_generic (MPFR_PREC_MIN, 1000, 100); /* inv is for 1/x */ data_check ("data/inv", mpfr_inv, "mpfr_ui_div(1,x)"); diff -Nru mpfr4-3.1.4/tests/tui_pow.c mpfr4-4.0.2/tests/tui_pow.c --- mpfr4-3.1.4/tests/tui_pow.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tui_pow.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_ui_pow and mpfr_ui_pow_ui. -Copyright 2001-2016 Free Software Foundation, Inc. +Copyright 2001-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,13 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include - #include "mpfr-test.h" static void @@ -114,14 +110,11 @@ printf (" prec=%u rnd_mode=%s\n", (unsigned) prec, mpfr_print_rnd_mode (rnd)); printf ("got "); - mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN); - puts (""); + mpfr_dump (z); printf ("expected "); - mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN); - puts (""); - printf ("approx "); - mpfr_print_binary (y); - puts (""); + mpfr_dump (t); + printf ("approx "); + mpfr_dump (y); exit (1); } compare2 = mpfr_cmp (t, y); @@ -137,9 +130,9 @@ { printf ("Wrong inexact flag for rnd=%s: expected %d, got %d\n", mpfr_print_rnd_mode (rnd), compare, inexact); - printf ("x="); mpfr_print_binary (x); puts (""); - printf ("y="); mpfr_print_binary (y); puts (""); - printf ("t="); mpfr_print_binary (t); puts (""); + printf ("x="); mpfr_dump (x); + printf ("y="); mpfr_dump (y); + printf ("t="); mpfr_dump (t); exit (1); } } @@ -160,13 +153,13 @@ mpfr_init (x); mpfr_init (y); - n = randlimb (); + do n = randlimb (); while (n <= 1); MPFR_SET_INF(x); mpfr_ui_pow (y, n, x, MPFR_RNDN); if(!MPFR_IS_INF(y)) { - printf ("evaluation of function in INF does not return INF\n"); + printf ("evaluation of function at INF does not return INF\n"); exit (1); } @@ -243,12 +236,12 @@ for (prec = p0; prec <= p1; prec++) { mpfr_set_prec (x, prec); - for (n=0; n -#include #include #include "mpfr-test.h" @@ -267,7 +265,7 @@ mpfr_exp_t emin, emax; mpfr_t x, y1, y2; int inex1, inex2, rnd_mode; - unsigned int flags1, flags2; + mpfr_flags_t flags1, flags2; emin = mpfr_get_emin (); emax = mpfr_get_emax (); @@ -277,39 +275,39 @@ mpfr_inits2 (32, x, y1, y2, (mpfr_ptr) 0); mpfr_setmax (x, MPFR_EMAX_MAX); mpfr_neg (x, x, MPFR_RNDN); - RND_LOOP (rnd_mode) - { - if (rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDA) - { - inex1 = mpfr_overflow (y1, (mpfr_rnd_t) rnd_mode, 1); - flags1 = MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT; - } - else - { - mpfr_neg (y1, x, MPFR_RNDN); - inex1 = -1; - flags1 = MPFR_FLAGS_INEXACT; - } - mpfr_clear_flags (); - inex2 = mpfr_ui_sub (y2, 1, x, (mpfr_rnd_t) rnd_mode); - flags2 = __gmpfr_flags; - if (!(mpfr_equal_p (y1, y2) && - SAME_SIGN (inex1, inex2) && - flags1 == flags2)) - { - printf ("Error in check_overflow for %s\n", - mpfr_print_rnd_mode ((mpfr_rnd_t) rnd_mode)); - printf ("Expected "); - mpfr_dump (y1); - printf (" with inex = %d, flags =", inex1); - flags_out (flags1); - printf ("Got "); - mpfr_dump (y2); - printf (" with inex = %d, flags =", inex2); - flags_out (flags2); - exit (1); - } - } + RND_LOOP_NO_RNDF (rnd_mode) + { + if (rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDA) + { + inex1 = mpfr_overflow (y1, (mpfr_rnd_t) rnd_mode, 1); + flags1 = MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT; + } + else + { + mpfr_neg (y1, x, MPFR_RNDN); + inex1 = -1; + flags1 = MPFR_FLAGS_INEXACT; + } + mpfr_clear_flags (); + inex2 = mpfr_ui_sub (y2, 1, x, (mpfr_rnd_t) rnd_mode); + flags2 = __gmpfr_flags; + if (!(mpfr_equal_p (y1, y2) && + SAME_SIGN (inex1, inex2) && + flags1 == flags2)) + { + printf ("Error in check_overflow for %s\n", + mpfr_print_rnd_mode ((mpfr_rnd_t) rnd_mode)); + printf ("Expected "); + mpfr_dump (y1); + printf (" with inex = %d, flags =", inex1); + flags_out (flags1); + printf ("Got "); + mpfr_dump (y2); + printf (" with inex = %d, flags =", inex2); + flags_out (flags2); + exit (1); + } + } mpfr_clears (x, y1, y2, (mpfr_ptr) 0); set_emin (emin); @@ -355,7 +353,7 @@ check_neg (); - test_generic (2, 1000, 100); + test_generic (MPFR_PREC_MIN, 1000, 100); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/turandom.c mpfr4-4.0.2/tests/turandom.c --- mpfr4-3.1.4/tests/turandom.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/turandom.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_urandom -Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Copyright 1999-2004, 2006-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void @@ -38,14 +35,12 @@ long count = 0; int i; int inex = 1; + mpfr_flags_t ex_flags, flags; size_tab = (nbtests >= 1000 ? nbtests / 50 : 20); - tab = (int *) calloc (size_tab, sizeof(int)); - if (tab == NULL) - { - fprintf (stderr, "trandom: can't allocate memory in test_urandom\n"); - exit (1); - } + tab = (int *) tests_allocate (size_tab * sizeof (int)); + for (k = 0; k < size_tab; k++) + tab[k] = 0; mpfr_init2 (x, prec); xn = 1 + (prec - 1) / mp_bits_per_limb; @@ -60,26 +55,44 @@ for (k = 0; k < nbtests; k++) { + mpfr_clear_flags (); + ex_flags = MPFR_FLAGS_INEXACT; i = mpfr_urandom (x, RANDS, rnd); + flags = __gmpfr_flags; inex = (i != 0) && inex; /* check that lower bits are zero */ if (MPFR_MANT(x)[0] & MPFR_LIMB_MASK(sh) && !MPFR_IS_ZERO (x)) { printf ("Error: mpfr_urandom() returns invalid numbers:\n"); - mpfr_print_binary (x); puts (""); + mpfr_dump (x); exit (1); } /* check that the value is in [0,1] */ if (mpfr_cmp_ui (x, 0) < 0 || mpfr_cmp_ui (x, 1) > 0) { printf ("Error: mpfr_urandom() returns number outside [0, 1]:\n"); - mpfr_print_binary (x); puts (""); + mpfr_dump (x); + exit (1); + } + /* check the flags (an underflow is theoretically possible, but + impossible in practice due to the huge exponent range) */ + if (flags != ex_flags) + { + printf ("Error: mpfr_urandom() returns incorrect flags.\n"); + printf ("Expected "); + flags_out (ex_flags); + printf ("Got "); + flags_out (flags); exit (1); } - d = mpfr_get_d1 (x); av += d; var += d*d; - i = (int)(size_tab * d); - if (d == 1.0) i --; + d = mpfr_get_d1 (x); + av += d; + var += d*d; + i = (int) (size_tab * d); + if (d == 1.0) + i--; + MPFR_ASSERTN (i < size_tab); tab[i]++; if (limb_mask && (MPFR_MANT (x)[limb_index] & limb_mask)) @@ -98,62 +111,273 @@ for (k = 0; k < 5; k++) { set_emin (k+1); - inex = mpfr_urandom (x, RANDS, rnd); - if (( (rnd == MPFR_RNDZ || rnd == MPFR_RNDD) - && (!MPFR_IS_ZERO (x) || inex != -1)) - || ((rnd == MPFR_RNDU || rnd == MPFR_RNDA) - && (mpfr_cmp_ui (x, 1 << k) != 0 || inex != +1)) - || (rnd == MPFR_RNDN - && (k > 0 || mpfr_cmp_ui (x, 1 << k) != 0 || inex != +1) - && (!MPFR_IS_ZERO (x) || inex != -1))) - { - printf ("Error: mpfr_urandom() do not handle correctly a restricted" - " exponent range.\nrounding mode: %s\nternary value: %d\n" - "random value: ", mpfr_print_rnd_mode (rnd), inex); - mpfr_print_binary (x); puts (""); - exit (1); + ex_flags = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT; + for (i = 0; i < 5; i++) + { + mpfr_clear_flags (); + inex = mpfr_urandom (x, RANDS, rnd); + flags = __gmpfr_flags; + if (k > 0 && flags != ex_flags) + { + printf ("Error: mpfr_urandom() returns incorrect flags" + " for emin = %d (i = %d).\n", k+1, i); + printf ("Expected "); + flags_out (ex_flags); + printf ("Got "); + flags_out (flags); + exit (1); + } + if (( (rnd == MPFR_RNDZ || rnd == MPFR_RNDD) + && (!MPFR_IS_ZERO (x) || inex != -1)) + || ((rnd == MPFR_RNDU || rnd == MPFR_RNDA) + && (mpfr_cmp_ui (x, 1 << k) != 0 || inex != +1)) + || (rnd == MPFR_RNDN + && (k > 0 || mpfr_cmp_ui (x, 1 << k) != 0 || inex != +1) + && (!MPFR_IS_ZERO (x) || inex != -1))) + { + printf ("Error: mpfr_urandom() does not handle correctly" + " a restricted exponent range.\nemin = %d\n" + "rounding mode: %s\nternary value: %d\nrandom value: ", + k+1, mpfr_print_rnd_mode (rnd), inex); + mpfr_dump (x); + exit (1); + } } } set_emin (emin); mpfr_clear (x); - if (!verbose) + + if (verbose) { - free(tab); - return; - } + av /= nbtests; + var = (var / nbtests) - av * av; - av /= nbtests; - var = (var / nbtests) - av * av; + th = (double)nbtests / size_tab; + printf ("Average = %.5f\nVariance = %.5f\n", av, var); + printf ("Repartition for urandom with rounding mode %s. " + "Each integer should be close to %d.\n", + mpfr_print_rnd_mode (rnd), (int) th); - th = (double)nbtests / size_tab; - printf ("Average = %.5f\nVariance = %.5f\n", av, var); - printf ("Repartition for urandom with rounding mode %s. " - "Each integer should be close to %d.\n", - mpfr_print_rnd_mode (rnd), (int)th); + for (k = 0; k < size_tab; k++) + { + chi2 += (tab[k] - th) * (tab[k] - th) / th; + printf("%d ", tab[k]); + if (((unsigned int) (k+1) & 7) == 0) + printf("\n"); + } - for (k = 0; k < size_tab; k++) - { - chi2 += (tab[k] - th) * (tab[k] - th) / th; - printf("%d ", tab[k]); - if (((k+1) & 7) == 0) - printf("\n"); + printf("\nChi2 statistics value (with %d degrees of freedom) : %.5f\n", + size_tab - 1, chi2); + + if (limb_mask) + printf ("Bit #%ld is set %ld/%ld = %.1f %% of time\n", + bit_index, count, nbtests, count * 100.0 / nbtests); + + puts (""); } - printf("\nChi2 statistics value (with %d degrees of freedom) : %.5f\n", - size_tab - 1, chi2); + tests_free (tab, size_tab * sizeof (int)); + return; +} - if (limb_mask) - printf ("Bit #%ld is set %ld/%ld = %.1f %% of time\n", - bit_index, count, nbtests, count * 100.0 / nbtests); +static void +underflow_tests (void) +{ + mpfr_t x; + mpfr_exp_t emin; + int i, k; + int rnd; - puts (""); + emin = mpfr_get_emin (); + mpfr_init2 (x, 4); - free(tab); - return; + for (i = 2; i >= -4; i--) + RND_LOOP (rnd) + for (k = 0; k < 100; k++) + { + mpfr_flags_t ex_flags, flags; + int inex; + + if (i >= 2) + { + /* Always underflow when emin >= 2, i.e. when the minimum + representable positive number is >= 2. */ + ex_flags = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT; + } + else + { +#ifndef MPFR_USE_MINI_GMP + gmp_randstate_t s; + + /* Since the unrounded random number does not depend on + the current exponent range, we can detect underflow + in a range larger than the one that will be tested. */ + gmp_randinit_set (s, mpfr_rands); + mpfr_clear_flags (); + mpfr_urandom (x, s, (mpfr_rnd_t) rnd); + gmp_randclear (s); + ex_flags = MPFR_FLAGS_INEXACT; + if (MPFR_IS_ZERO (x) || mpfr_get_exp (x) < i) + ex_flags |= MPFR_FLAGS_UNDERFLOW; +#else + /* Do not test the flags. */ + ex_flags = 0; +#endif + } + + mpfr_set_emin (i); + mpfr_clear_flags (); + inex = mpfr_urandom (x, mpfr_rands, (mpfr_rnd_t) rnd); + flags = __gmpfr_flags; + MPFR_ASSERTN (mpfr_inexflag_p ()); + mpfr_set_emin (emin); + + if (MPFR_IS_NEG (x)) + { + printf ("Error in underflow_tests: got a negative sign" + " for i=%d rnd=%s k=%d.\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), k); + exit (1); + } + + if (MPFR_IS_ZERO (x)) + { + if (rnd == MPFR_RNDU || rnd == MPFR_RNDA) + { + printf ("Error in underflow_tests: the value cannot" + " be 0 for i=%d rnd=%s k=%d.\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), k); + exit (1); + } + } + + if (inex == 0 || (MPFR_IS_ZERO (x) && inex > 0)) + { + printf ("Error in underflow_tests: incorrect inex (%d)" + " for i=%d rnd=%s k=%d.\n", inex, + i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), k); + exit (1); + } + + if (ex_flags != 0 && flags != ex_flags) + { + printf ("Error in underflow_tests: incorrect flags" + " for i=%d rnd=%s k=%d.\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), k); + printf ("Expected "); + flags_out (ex_flags); + printf ("Got "); + flags_out (flags); + exit (1); + } + } + + mpfr_clear (x); +} + +static void +test_underflow (int verbose) +{ + mpfr_t x; + mpfr_exp_t emin = mpfr_get_emin (); + long i, exp[6] = {0, 0, 0, 0, 0, 0}; + + mpfr_init2 (x, 2); + mpfr_set_emin (-3); +#define N 1000000 + for (i = 0; i < N; i++) + { + mpfr_urandom (x, RANDS, MPFR_RNDN); + if (mpfr_zero_p (x)) + exp[5] ++; + else + /* exp=1 is possible if the generated number is 0.111111... */ + exp[1-mpfr_get_exp(x)] ++; + } + if (verbose) + printf ("exp=1:%.3f(%.3f) 0:%.3f(%.3f) -1:%.3f(%.3f) -2:%.3f(%.3f) " + "-3:%.3f(%.3f) zero:%.3f(%.3f)\n", + 100.0 * (double) exp[0] / (double) N, 12.5, + 100.0 * (double) exp[1] / (double) N, 43.75, + 100.0 * (double) exp[2] / (double) N, 21.875, + 100.0 * (double) exp[3] / (double) N, 10.9375, + 100.0 * (double) exp[4] / (double) N, 7.8125, + 100.0 * (double) exp[5] / (double) N, 3.125); + mpfr_clear (x); + mpfr_set_emin (emin); +#undef N } -/* problem reported by Carl Witty */ +static void +overflow_tests (void) +{ + mpfr_t x; + mpfr_exp_t emax; + int i, k; + int inex; + int rnd; + mpfr_flags_t ex_flags, flags; + + emax = mpfr_get_emax (); + mpfr_init2 (x, 4); + ex_flags = MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT; /* if overflow */ + for (i = -4; i <= 0; i++) + { + mpfr_set_emax (i); + RND_LOOP (rnd) + for (k = 0; k < 100; k++) + { + mpfr_clear_flags (); + inex = mpfr_urandom (x, mpfr_rands, (mpfr_rnd_t) rnd); + flags = __gmpfr_flags; + MPFR_ASSERTN (mpfr_inexflag_p ()); + if (MPFR_IS_NEG (x)) + { + printf ("Error in overflow_tests: got a negative sign" + " for i=%d rnd=%s k=%d.\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), k); + exit (1); + } + if (MPFR_IS_INF (x)) + { + if (rnd == MPFR_RNDD || rnd == MPFR_RNDZ) + { + printf ("Error in overflow_tests: the value cannot" + " be +inf for i=%d rnd=%s k=%d.\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), k); + exit (1); + } + if (flags != ex_flags) + { + printf ("Error in overflow_tests: incorrect flags" + " for i=%d rnd=%s k=%d.\n", + i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), k); + printf ("Expected "); + flags_out (ex_flags); + printf ("Got "); + flags_out (flags); + exit (1); + } + } + if (inex == 0 || (MPFR_IS_INF (x) && inex < 0)) + { + printf ("Error in overflow_tests: incorrect inex (%d)" + " for i=%d rnd=%s k=%d.\n", inex, + i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), k); + exit (1); + } + } + } + mpfr_clear (x); + mpfr_set_emax (emax); +} + +#ifndef MPFR_USE_MINI_GMP + +/* Problem reported by Carl Witty. This test assumes the random generator + used by GMP is deterministic (for a given seed). We need to distinguish + two cases since the random generator changed in GMP 4.2.0. */ static void bug20100914 (void) { @@ -191,6 +415,190 @@ gmp_randclear (s); } +/* non-regression test for bug reported by Trevor Spiteri + https://sympa.inria.fr/sympa/arc/mpfr/2017-01/msg00020.html */ +static void +bug20170123 (void) +{ +#if __MPFR_GMP(4,2,0) + mpfr_t x; + mpfr_exp_t emin; + gmp_randstate_t s; + + emin = mpfr_get_emin (); + mpfr_set_emin (-7); + mpfr_init2 (x, 53); + gmp_randinit_default (s); + gmp_randseed_ui (s, 398); + mpfr_urandom (x, s, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (x, 1, -8) == 0); + mpfr_clear (x); + gmp_randclear (s); + mpfr_set_emin (emin); +#endif +} + +/* Reproducibility test with several rounding modes and exponent ranges. */ +static void +reprod_rnd_exp (void) +{ + int i; + + for (i = 0; i < 10; i++) + { + gmp_randstate_t s1; + mpfr_prec_t prec; + mpfr_t x1, x2, y; + mp_limb_t v; + int r; + + prec = MPFR_PREC_MIN + (randlimb () % 200); + mpfr_inits2 (prec, x1, x2, y, (mpfr_ptr) 0); + + gmp_randinit_set (s1, mpfr_rands); + mpfr_urandom (x1, mpfr_rands, MPFR_RNDZ); + mpfr_rand_raw (&v, mpfr_rands, GMP_NUMB_BITS); + mpfr_set (x2, x1, MPFR_RNDN); + mpfr_nextabove (x2); + /* The real number is between x1 and x2. */ + + RND_LOOP (r) + { + gmp_randstate_t s2; + mpfr_rnd_t rr = (mpfr_rnd_t) r; + mp_limb_t w; + mpfr_ptr t[2]; + int k, nk = 0; + + gmp_randinit_set (s2, s1); + mpfr_urandom (y, s2, rr); + mpfr_rand_raw (&w, s2, GMP_NUMB_BITS); + if (w != v) + { + printf ("Error in reprod_rnd_exp for i=%d rnd=%s: different " + "PRNG state\n", i, mpfr_print_rnd_mode (rr)); + exit (1); + } + + if (! MPFR_IS_LIKE_RNDA (rr, 0)) + t[nk++] = x1; + if (! MPFR_IS_LIKE_RNDZ (rr, 0)) + t[nk++] = x2; + MPFR_ASSERTN (nk == 1 || nk == 2); + + if (!(mpfr_equal_p (y, t[0]) || (nk > 1 && mpfr_equal_p (y, t[1])))) + { + printf ("Error in reprod_rnd_exp for i=%d rnd=%s:\n", + i, mpfr_print_rnd_mode (rr)); + printf ("Expected%s\n", nk > 1 ? " one of" : ""); + for (k = 0; k < nk; k++) + { + printf (" "); + mpfr_dump (t[k]); + } + printf ("Got\n "); + mpfr_dump (y); + exit (1); + } + + gmp_randclear (s2); + } + + mpfr_clears (x1, x2, y, (mpfr_ptr) 0); + gmp_randclear (s1); + } +} + +/* Reproducibility test: check that the behavior does not depend on + the platform ABI or MPFR version (new, incompatible MPFR versions + may introduce changes, in which case the hardcoded values should + depend on MPFR_VERSION). + It is not necessary to test with different rounding modes and + exponent ranges as this has already been done in reprod_rnd_exp. + We do not need to check the status of the PRNG after mpfr_urandom + since this is done implicitly by comparing the next value, except + for the last itaration. +*/ +static void +reprod_abi (void) +{ +#if __MPFR_GMP(4,2,0) +#define N 6 + /* Run this program with the MPFR_REPROD_ABI_OUTPUT environment variable + set to get the array of strings. */ + char *t[5 * N] = { + "1.0@-1", + "3.0@-1", + "7.0@-1", + "9.0@-1", + "c.0@-1", + "4.385434c0@-1", + "1.9a018734@-1", + "8.26547780@-1", + "a.fd334198@-1", + "9.aa11d5f00@-1", + "d.aa9a32fd0a801ac0@-1", + "c.eb47074368ec6340@-1", + "9.7dbe2ced88ae4c30@-1", + "d.03218ea6704a42c0@-1", + "7.1530156aac800d980@-1", + "e.270121b1d74aea9029ccc740@-1", + "5.614fc2d9ca3917107609e2e0@-1", + "5.15417c51af272232181d6a40@-1", + "f.dfb431dd6533c004b6d3c590@-1", + "4.345f96fd2929d41eb278a4f40@-1", + "a.804590c6449cd8c83bae31f31f7a4100@-1", + "a.0a2b318d3c99911a45e4cf33847d3680@-1", + "2.89f6127c19092d7a1808b1842b296400@-1", + "2.1db4fc00348ca1531983fe4bd4cdf6d2@-1", + "5.2d90f11ed710425ebe549a95decbb6540@-1", + "8.ca35d1302cf369e03c2a58bf2ce5cff8307f0bc0@-1", + "3.a22bae632c32f2a7a67a1fa78a93f5e84f9caa40@-1", + "f.370a36febed972dbb47f2503f7e08a651edbf120@-1", + "d.0764d7a38c206eeba6ffe8cf39d777194f5c9200@-1", + "a.1a312f0bb16db20c4783c6438725ed5d6dff6af80@-1" + }; + gmp_randstate_t s; + int generate, i; + + /* We must hardcode the seed to be able to compare with hardcoded values. */ + gmp_randinit_default (s); + gmp_randseed_ui (s, 17); + + generate = getenv ("MPFR_REPROD_ABI_OUTPUT") != NULL; + + for (i = 0; i < 5 * N; i++) + { + mpfr_prec_t prec; + mpfr_t x; + + prec = i < 5 ? MPFR_PREC_MIN + i : (i / 5) * 32 + (i % 5) - 2; + mpfr_init2 (x, prec); + mpfr_urandom (x, s, MPFR_RNDN); + if (generate) + { + printf (" \""); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDZ); + printf (i < 5 * N - 1 ? "\",\n" : "\"\n"); + } + else if (mpfr_cmp_str (x, t[i], 16, MPFR_RNDN) != 0) + { + printf ("Error in reprod_abi for i=%d\n", i); + printf ("Expected %s\n", t[i]); + printf ("Got "); + mpfr_out_str (stdout, 16, 0, x, MPFR_RNDZ); + printf ("\n"); + exit (1); + } + mpfr_clear (x); + } + + gmp_randclear (s); +#endif +} + +#endif + int main (int argc, char *argv[]) { @@ -238,11 +646,23 @@ if (argc == 1) /* check also small precision */ { - test_urandom (nbtests, 2, (mpfr_rnd_t) rnd, -1, 0); + test_urandom (nbtests, MPFR_PREC_MIN, (mpfr_rnd_t) rnd, -1, 0); } } + underflow_tests (); + overflow_tests (); + +#ifndef MPFR_USE_MINI_GMP + /* Since these tests assume a deterministic random generator, and + this is not implemented in mini-gmp, we omit it with mini-gmp. */ bug20100914 (); + bug20170123 (); + reprod_rnd_exp (); + reprod_abi (); +#endif + + test_underflow (verbose); tests_end_mpfr (); return 0; diff -Nru mpfr4-3.1.4/tests/tvalist.c mpfr4-4.0.2/tests/tvalist.c --- mpfr4-3.1.4/tests/tvalist.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tvalist.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for multiple mpfr.h inclusion and va_list related functions -Copyright 2011-2016 Free Software Foundation, Inc. +Copyright 2011-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_STDARG @@ -28,9 +28,28 @@ # include #endif -/* Assume that this is in fact a header inclusion for some library - that uses MPFR, i.e. this inclusion is hidden in another one. - MPFR currently (rev 6704) fails to handle this case. */ +#define MPFR_DONT_USE_FILE /* don't use FILE in mpfr-impl.h */ +#ifdef MPFR_USE_MINI_GMP +#include "mpfr-test.h" +#endif + +/* One of the goals of this test is to detect potential issues with the + * following case in user code: + * + * #include + * #include + * #define MPFR_USE_VA_LIST + * #include + * + * where some_lib.h has "#include ". So, the mpfr.h header file + * is included multiple times, a first time without before, + * and a second time with support. We need to make sure that + * the second inclusion is not a no-op due to some #include guard. This + * was fixed in r7320. + * + * With mini-gmp, mpfr-impl.h is included first, but this should not + * affect this test thanks to MPFR_DONT_USE_FILE. + */ #include #include @@ -46,7 +65,7 @@ static void test (FILE *fout, const char *fmt, ...) { - int (*fct) (FILE*, __gmp_const char*, va_list); + int (*fct) (FILE*, const char*, va_list); fct = mpfr_vfprintf; if (0) diff -Nru mpfr4-3.1.4/tests/tversion.c mpfr4-4.0.2/tests/tversion.c --- mpfr4-3.1.4/tests/tversion.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tversion.c 2019-01-27 18:30:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_version. -Copyright 2004-2016 Free Software Foundation, Inc. +Copyright 2004-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,28 +17,62 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* Needed due to the inclusion of mpfr-intmax.h */ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include +#include #include "mpfr-intmax.h" #include "mpfr-test.h" +/* Warning about the usage of printf/puts below: + * + * - If a macro expansion is used, it must not appear in the first + * argument of printf (format string), as we do not know whether + * the expanded string contains a '%' character. + * + * - If a #if preprocessor directive is used in an argument, parentheses + * must be put around the function name, in case this function is also + * implemented as a macro (#if does not work in macro arguments). + */ + int main (void) { + mpfr_exp_t e; int err = 0; /* Test the GMP and MPFR versions. */ if (test_version ()) exit (1); - printf ("[tversion] MPFR %s\n", MPFR_VERSION_STRING); + tests_start_mpfr (); + + errno = 0; + + /*********************** MPFR version and patches ************************/ + + /* The printf failure test was added because of an output issue under Wine, + * eventually not related to this output; this test is kept just in case... + * Details: + * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914822 + * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914949 + */ + if (printf ("[tversion] MPFR %s\n", MPFR_VERSION_STRING) < 0) + { + perror ("tversion (first printf)"); + err = 1; + } + + if (strcmp (mpfr_get_patches (), "") != 0) + printf ("[tversion] MPFR patches: %s\n", mpfr_get_patches ()); + + /************************* Compiler information **************************/ /* TODO: We may want to output info for non-GNUC-compat compilers too. See: * http://sourceforge.net/p/predef/wiki/Compilers/ @@ -65,15 +99,130 @@ printf (COMP2 "%s\n", __VERSION__); #endif + /************** More information about the C implementation **************/ + + /* The following macros are currently used by src/mpfr-cvers.h and/or + src/mpfr-impl.h; they may have an influcence on how MPFR is compiled. */ + +#if defined(__STDC__) || defined(__STDC_VERSION__) + (puts) ("[tversion] C standard: __STDC__ = " +#if defined(__STDC__) + MAKE_STR(__STDC__) +#else + "undef" +#endif + ", __STDC_VERSION__ = " +#if defined(__STDC_VERSION__) + MAKE_STR(__STDC_VERSION__) +#else + "undef" +#endif + ); +#endif + +#if defined(__GNUC__) + (puts) ("[tversion] __GNUC__ = " MAKE_STR(__GNUC__) ", __GNUC_MINOR__ = " +#if defined(__GNUC_MINOR__) + MAKE_STR(__GNUC_MINOR__) +#else + "undef" +#endif + ); +#endif + +#if defined(__ICC) || defined(__INTEL_COMPILER) + (puts) ("[tversion] Intel compiler: __ICC = " +#if defined(__ICC) + MAKE_STR(__ICC) +#else + "undef" +#endif + ", __INTEL_COMPILER = " +#if defined(__INTEL_COMPILER) + MAKE_STR(__INTEL_COMPILER) +#else + "undef" +#endif + ); +#endif + +#if defined(_WIN32) || defined(_MSC_VER) + (puts) ("[tversion] MS Windows: _WIN32 = " +#if defined(_WIN32) + MAKE_STR(_WIN32) +#else + "undef" +#endif + ", _MSC_VER = " +#if defined(_MSC_VER) + MAKE_STR(_MSC_VER) +#else + "undef" +#endif + ); +#endif + +#if defined(__GLIBC__) + (puts) ("[tversion] __GLIBC__ = " MAKE_STR(__GLIBC__) ", __GLIBC_MINOR__ = " +#if defined(__GLIBC_MINOR__) + MAKE_STR(__GLIBC_MINOR__) +#else + "undef" +#endif + ); +#endif + + /******************* GMP version and build information *******************/ + #ifdef __MPIR_VERSION printf ("[tversion] MPIR: header %d.%d.%d, library %s\n", __MPIR_VERSION, __MPIR_VERSION_MINOR, __MPIR_VERSION_PATCHLEVEL, mpir_version); #else +#ifdef MPFR_USE_MINI_GMP + printf ("[tversion] mini-gmp\n"); +#else printf ("[tversion] GMP: header %d.%d.%d, library %s\n", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL, gmp_version); #endif +#endif + +#ifdef __GMP_CC + printf ("[tversion] __GMP_CC = \"%s\"\n", __GMP_CC); +#endif +#ifdef __GMP_CFLAGS + printf ("[tversion] __GMP_CFLAGS = \"%s\"\n", __GMP_CFLAGS); +#endif + + /* The following output is also useful under Unix, where one should get: + WinDLL: __GMP_LIBGMP_DLL = 0, MPFR_WIN_THREAD_SAFE_DLL = undef + If this is not the case, something is probably broken. We cannot test + automatically as some MS Windows implementations may declare some Unix + (POSIX) compatibility; for instance, Cygwin32 defines __unix__ (but + Cygwin64 does not, probably because providing both MS Windows API and + POSIX API is not possible with a 64-bit ABI, since MS Windows is LLP64 + and Unix is LP64). + MPFR_WIN_THREAD_SAFE_DLL is directly set up from __GMP_LIBGMP_DLL; + that is why it is output here. */ + (puts) ("[tversion] WinDLL: __GMP_LIBGMP_DLL = " +#if defined(__GMP_LIBGMP_DLL) + MAKE_STR(__GMP_LIBGMP_DLL) +#else + "undef" +#endif + ", MPFR_WIN_THREAD_SAFE_DLL = " +#if defined(MPFR_WIN_THREAD_SAFE_DLL) + MAKE_STR(MPFR_WIN_THREAD_SAFE_DLL) +#else + "undef" +#endif + ); + + /********************* MPFR configuration parameters *********************/ + + /* The following code outputs configuration parameters, either set up + by the user or determined automatically (default values). */ if ( #ifdef MPFR_USE_THREAD_SAFE @@ -87,6 +236,17 @@ } if ( +#ifdef MPFR_WANT_FLOAT128 + ! +#endif + mpfr_buildopt_float128_p ()) + { + printf ("ERROR! mpfr_buildopt_float128_p() and macros" + " do not match!\n"); + err = 1; + } + + if ( #ifdef MPFR_WANT_DECIMAL_FLOATS ! #endif @@ -108,12 +268,40 @@ err = 1; } - printf ("[tversion] TLS = %s, decimal = %s, GMP internals = %s\n", - mpfr_buildopt_tls_p () ? "yes" : "no", - mpfr_buildopt_decimal_p () ? "yes" : "no", - mpfr_buildopt_gmpinternals_p () ? "yes" : "no"); + if ( +#ifdef MPFR_WANT_SHARED_CACHE + ! +#endif + mpfr_buildopt_sharedcache_p ()) + { + printf ("ERROR! mpfr_buildopt_sharedcache_p() and macros" + " do not match!\n"); + err = 1; + } + + (printf) ("[tversion] TLS = %s, float128 = %s, decimal = %s," + " GMP internals = %s\n", + mpfr_buildopt_tls_p () ? "yes" : "no", + mpfr_buildopt_float128_p () ? "yes" : "no", + mpfr_buildopt_decimal_p () ? "yes (" +#ifdef DPD_FORMAT + "DPD" +#else + "BID" +#endif + ")" : "no", + mpfr_buildopt_gmpinternals_p () ? "yes" : "no"); - printf ("[tversion] intmax_t = " +#ifdef MPFR_THREAD_LOCK_METHOD +# define LOCK_METHOD " (lock method: " MPFR_THREAD_LOCK_METHOD ")" +#else +# define LOCK_METHOD "" +#endif + + (printf) ("[tversion] Shared cache = %s\n", + mpfr_buildopt_sharedcache_p () ? "yes" LOCK_METHOD : "no"); + + (puts) ("[tversion] intmax_t = " #if defined(_MPFR_H_HAVE_INTMAX_T) "yes" #else @@ -125,9 +313,15 @@ #else "no" #endif - "\n"); + ", IEEE floats = " +#if _MPFR_IEEE_FLOATS + "yes" +#else + "no" +#endif + ); - printf ("[tversion] gmp_printf: hhd = " + (puts) ("[tversion] gmp_printf: hhd = " #if defined(NPRINTF_HH) "no" #else @@ -148,16 +342,28 @@ ", td = " #if defined(NPRINTF_T) "no" -#else +#elif defined(PRINTF_T) "yes" +#else + "?" #endif ", Ld = " #if defined(NPRINTF_L) "no" +#elif defined(PRINTF_L) + "yes" #else + "?" +#endif + ); + + (puts) ("[tversion] _mulx_u64 = " +#if defined(HAVE_MULX_U64) "yes" +#else + "no" #endif - "\n"); + ); if (strcmp (mpfr_buildopt_tune_case (), MPFR_TUNE_CASE) != 0) { @@ -169,8 +375,90 @@ else printf ("[tversion] MPFR tuning parameters from %s\n", MPFR_TUNE_CASE); - if (strcmp (mpfr_get_patches (), "") != 0) - printf ("[tversion] MPFR patches: %s\n", mpfr_get_patches ()); + /**************************** ABI information ****************************/ + + (printf) ("[tversion] sizeof(long) = %ld" +#if defined(_MPFR_H_HAVE_INTMAX_T) + ", sizeof(intmax_t) = %ld" +#endif + "\n", (long) sizeof(long) +#if defined(_MPFR_H_HAVE_INTMAX_T) + , (long) sizeof(intmax_t) +#endif + ); + + if (mp_bits_per_limb != GMP_NUMB_BITS) + { + printf ("ERROR! mp_bits_per_limb != GMP_NUMB_BITS (%ld vs %ld)\n", + (long) mp_bits_per_limb, (long) GMP_NUMB_BITS); + err = 1; + } + + printf ("[tversion] GMP_NUMB_BITS = %ld, sizeof(mp_limb_t) = %ld\n", + (long) GMP_NUMB_BITS, (long) sizeof(mp_limb_t)); + + printf ("[tversion] _MPFR_PREC_FORMAT = %ld, sizeof(mpfr_prec_t) = %ld\n", + (long) _MPFR_PREC_FORMAT, (long) sizeof(mpfr_prec_t)); + + printf ("[tversion] _MPFR_EXP_FORMAT = %ld, sizeof(mpfr_exp_t) = %ld\n", + (long) _MPFR_EXP_FORMAT, (long) sizeof(mpfr_exp_t)); + + printf ("[tversion] sizeof(mpfr_t) = %ld, sizeof(mpfr_ptr) = %ld\n", + (long) sizeof(mpfr_t), (long) sizeof(mpfr_ptr)); + +#define RANGE " range: [%" MPFR_EXP_FSPEC "d,%" MPFR_EXP_FSPEC "d]\n" + + printf ("[tversion] Precision" RANGE, + (mpfr_eexp_t) MPFR_PREC_MIN, (mpfr_eexp_t) MPFR_PREC_MAX); + + e = mpfr_get_emin_min (); + if (e != MPFR_EMIN_MIN) + { + printf ("ERROR! mpfr_get_emin_min != MPFR_EMIN_MIN (%ld vs %ld)\n", + (mpfr_eexp_t) e, (mpfr_eexp_t) MPFR_EMIN_MIN); + err = 1; + } + + e = mpfr_get_emax_max (); + if (e != MPFR_EMAX_MAX) + { + printf ("ERROR! mpfr_get_emax_max != MPFR_EMAX_MAX (%ld vs %ld)\n", + (mpfr_eexp_t) e, (mpfr_eexp_t) MPFR_EMAX_MAX); + err = 1; + } + + printf ("[tversion] Max exponent" RANGE, + (mpfr_eexp_t) MPFR_EMIN_MIN, (mpfr_eexp_t) MPFR_EMAX_MAX); + + (puts) ("[tversion] Generic ABI code: " +#if defined(MPFR_GENERIC_ABI) + "yes" +#else + "no" +#endif + ); + + /************************** Runtime information **************************/ + + if (locale != NULL) + printf ("[tversion] Locale: %s\n", locale); + /* The memory limit should not be changed for "make check". + The warning below signals a possible user mistake. + Do not use "%zu" because it is not available in C90; + the type mpfr_ueexp_t should be sufficiently large. */ + if (tests_memory_limit != DEFAULT_MEMORY_LIMIT) + printf ("[tversion] Warning! Memory limit changed to %" MPFR_EXP_FSPEC + "u\n", (mpfr_ueexp_t) tests_memory_limit); + + /*************************************************************************/ + + if (errno != 0) + { + perror ("tversion"); + err = 1; + } + + tests_end_mpfr (); return err; } diff -Nru mpfr4-3.1.4/tests/ty0.c mpfr4-4.0.2/tests/ty0.c --- mpfr4-3.1.4/tests/ty0.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/ty0.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* ty0 -- test file for the Bessel function of second kind (order 0) -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,16 +17,14 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_y0 #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 8, RANDS) +#define REDUCE_EMAX 262143 /* otherwise arg. reduction is too expensive */ #include "tgeneric.c" int @@ -88,7 +86,7 @@ mpfr_clear (x); mpfr_clear (y); - test_generic (2, 100, 1); + test_generic (MPFR_PREC_MIN, 100, 1); data_check ("data/y0", mpfr_y0, "mpfr_y0"); diff -Nru mpfr4-3.1.4/tests/ty1.c mpfr4-4.0.2/tests/ty1.c --- mpfr4-3.1.4/tests/ty1.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/ty1.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* ty1 -- test file for the Bessel function of second kind (order 1) -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,16 +17,14 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_y1 #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 8, RANDS) +#define REDUCE_EMAX 262143 /* otherwise arg. reduction is too expensive */ #include "tgeneric.c" int @@ -88,7 +86,7 @@ mpfr_clear (x); mpfr_clear (y); - test_generic (2, 100, 1); + test_generic (MPFR_PREC_MIN, 100, 1); data_check ("data/y1", mpfr_y1, "mpfr_y1"); diff -Nru mpfr4-3.1.4/tests/tyn.c mpfr4-4.0.2/tests/tyn.c --- mpfr4-3.1.4/tests/tyn.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tyn.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* tyn -- test file for the Bessel function of second kind -Copyright 2007-2016 Free Software Foundation, Inc. +Copyright 2007-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" int diff -Nru mpfr4-3.1.4/tests/tzeta.c mpfr4-4.0.2/tests/tzeta.c --- mpfr4-3.1.4/tests/tzeta.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tzeta.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* tzeta -- test file for the Riemann Zeta function -Copyright 2003-2016 Free Software Foundation, Inc. +Copyright 2003-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,22 +17,22 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" static void test1 (void) { mpfr_t x, y; + int inex; mpfr_init2 (x, 32); mpfr_init2 (y, 42); + mpfr_clear_flags (); + mpfr_set_str_binary (x, "1.1111111101000111011010010010100e-1"); mpfr_zeta (y, x, MPFR_RNDN); /* shouldn't crash */ @@ -45,12 +45,12 @@ if (mpfr_cmp (x, y)) { printf ("Error for input on 40 bits, output on 50 bits\n"); - printf ("Expected "); mpfr_print_binary (x); puts (""); - printf ("Got "); mpfr_print_binary (y); puts (""); + printf ("Expected "); mpfr_dump (x); + printf ("Got "); mpfr_dump (y); mpfr_set_str_binary (x, "1.001101001101000010011010110100110000101e-1"); mpfr_zeta (y, x, MPFR_RNDU); - mpfr_print_binary (x); puts (""); - mpfr_print_binary (y); puts (""); + mpfr_dump (x); + mpfr_dump (y); exit (1); } @@ -63,8 +63,8 @@ if (mpfr_cmp (x, y)) { printf ("Error in mpfr_zeta (1)\n"); - printf ("Expected "); mpfr_print_binary (x); puts (""); - printf ("Got "); mpfr_print_binary (y); puts (""); + printf ("Expected "); mpfr_dump (x); + printf ("Got "); mpfr_dump (y); exit (1); } @@ -94,18 +94,29 @@ mpfr_zeta (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui_2exp (y, 3, -1) == 0); - mpfr_set_nan (x); - mpfr_zeta (y, x, MPFR_RNDN); - MPFR_ASSERTN(mpfr_nan_p (y)); + /* yet another coverage test (case beta <= 0.0) */ + mpfr_set_prec (x, 10); + mpfr_set_ui (x, 23, MPFR_RNDN); + mpfr_set_prec (y, 15); + inex = mpfr_zeta (y, x, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); mpfr_set_inf (x, 1); mpfr_zeta (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); + /* Since some tests don't really check that the result is not NaN... */ + MPFR_ASSERTN (! mpfr_nanflag_p ()); + mpfr_set_inf (x, -1); mpfr_zeta (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); + mpfr_set_nan (x); + mpfr_zeta (y, x, MPFR_RNDN); + MPFR_ASSERTN(mpfr_nan_p (y)); + mpfr_clear (x); mpfr_clear (y); } @@ -171,22 +182,64 @@ if (mpfr_cmp_str (y, val[i+1] , 2, MPFR_RNDZ)) { printf("Wrong result for zeta(%s=", val[i]); - mpfr_print_binary (x); + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); printf (").\nGot : "); - mpfr_print_binary(y); putchar('\n'); + mpfr_dump (y); printf("Expected: "); mpfr_set_str (y, val[i+1], 2, MPFR_RNDZ); - mpfr_print_binary(y); putchar('\n'); + mpfr_dump (y); mpfr_set_prec(y, 65); mpfr_zeta(y, x, MPFR_RNDZ); printf("+ Prec : "); - mpfr_print_binary(y); putchar('\n'); + mpfr_dump (y); exit(1); } } mpfr_clears (x, y, (mpfr_ptr) 0); } +/* The following test attempts to trigger an intermediate overflow in + Gamma(s1) in the reflection formula with a 32-bit ABI (the example + depends on the extended exponent range): r10804 fails when the + exponent field is on 32 bits. */ +static void +intermediate_overflow (void) +{ + mpfr_t x, y1, y2; + mpfr_flags_t flags1, flags2; + int inex1, inex2; + + mpfr_inits2 (64, x, y1, y2, (mpfr_ptr) 0); + + mpfr_set_si (x, -44787928, MPFR_RNDN); + mpfr_nextabove (x); + + mpfr_set_str (y1, "0x3.0a6ab0ab281742acp+954986780", 0, MPFR_RNDN); + inex1 = -1; + flags1 = MPFR_FLAGS_INEXACT; + + mpfr_clear_flags (); + inex2 = mpfr_zeta (y2, x, MPFR_RNDN); + flags2 = __gmpfr_flags; + + if (!(mpfr_equal_p (y1, y2) && + SAME_SIGN (inex1, inex2) && + flags1 == flags2)) + { + printf ("Error in intermediate_overflow\n"); + printf ("Expected "); + mpfr_dump (y1); + printf ("with inex = %d and flags =", inex1); + flags_out (flags1); + printf ("Got "); + mpfr_dump (y2); + printf ("with inex = %d and flags =", inex2); + flags_out (flags2); + exit (1); + } + mpfr_clears (x, y1, y2, (mpfr_ptr) 0); +} + #define TEST_FUNCTION mpfr_zeta #define TEST_RANDOM_EMIN -48 #define TEST_RANDOM_EMAX 31 @@ -201,6 +254,7 @@ mpfr_t s, y, z; mpfr_prec_t prec; mpfr_rnd_t rnd_mode; + mpfr_flags_t flags; int inex; tests_start_mpfr (); @@ -250,7 +304,7 @@ mpfr_set_ui (s, 1, MPFR_RNDN); mpfr_clear_divby0(); mpfr_zeta (z, s, MPFR_RNDN); - if (!mpfr_inf_p (z) || MPFR_SIGN (z) < 0 || !mpfr_divby0_p()) + if (!mpfr_inf_p (z) || MPFR_IS_NEG (z) || !mpfr_divby0_p()) { printf ("Error in mpfr_zeta for s = 1 (should be +inf) with divby0 flag\n"); exit (1); @@ -342,14 +396,14 @@ mpfr_set_str (s, "-400000001", 10, MPFR_RNDZ); mpfr_zeta (z, s, MPFR_RNDN); - if (!(mpfr_inf_p (z) && MPFR_SIGN(z) < 0)) + if (!(mpfr_inf_p (z) && MPFR_IS_NEG (z))) { printf ("Error in mpfr_zeta (-400000001)\n"); exit (1); } mpfr_set_str (s, "-400000003", 10, MPFR_RNDZ); mpfr_zeta (z, s, MPFR_RNDN); - if (!(mpfr_inf_p (z) && MPFR_SIGN(z) > 0)) + if (!(mpfr_inf_p (z) && MPFR_IS_POS (z))) { printf ("Error in mpfr_zeta (-400000003)\n"); exit (1); @@ -387,7 +441,7 @@ mpfr_set_prec (z, 128); mpfr_set_str_binary (s, "-0.1000000000000000000000000000000000000000000000000000000000000001E64"); inex = mpfr_zeta (z, s, MPFR_RNDN); - MPFR_ASSERTN (mpfr_inf_p (z) && MPFR_SIGN (z) < 0 && inex < 0); + MPFR_ASSERTN (mpfr_inf_p (z) && MPFR_IS_NEG (z) && inex < 0); inex = mpfr_zeta (z, s, MPFR_RNDU); mpfr_set_inf (s, -1); mpfr_nextabove (s); @@ -414,13 +468,36 @@ } } + /* The following test yields an overflow in the error computation. + With r10864, this is detected and one gets an assertion failure. */ + mpfr_set_prec (s, 1025); + mpfr_set_si_2exp (s, -1, 1024, MPFR_RNDN); + mpfr_nextbelow (s); /* -(2^1024 + 1) */ + mpfr_clear_flags (); + inex = mpfr_zeta (z, s, MPFR_RNDN); + flags = __gmpfr_flags; + if (flags != (MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT) || + ! mpfr_inf_p (z) || MPFR_IS_POS (z) || inex >= 0) + { + printf ("Error in mpfr_zeta for s = -(2^1024 + 1)\nGot "); + mpfr_dump (z); + printf ("with inex = %d and flags =", inex); + flags_out (flags); + exit (1); + } + mpfr_clear (s); mpfr_clear (y); mpfr_clear (z); - test_generic (2, 70, 5); + /* FIXME: change the last argument back to 5 once the working precision + in the mpfr_zeta implementation no longer depends on the precision of + the input. */ + test_generic (MPFR_PREC_MIN, 70, 1); test2 (); + intermediate_overflow (); + tests_end_mpfr (); return 0; } diff -Nru mpfr4-3.1.4/tests/tzeta_ui.c mpfr4-4.0.2/tests/tzeta_ui.c --- mpfr4-3.1.4/tests/tzeta_ui.c 2016-03-06 11:33:03.000000000 +0000 +++ mpfr4-4.0.2/tests/tzeta_ui.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Test file for mpfr_zeta_ui. -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,12 +17,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include - #include "mpfr-test.h" #define TEST_FUNCTION mpfr_zeta_ui @@ -30,14 +27,13 @@ int main (int argc, char *argv[]) { -#if MPFR_VERSION >= MPFR_VERSION_NUM(2,3,0) unsigned int prec, yprec; int rnd; mpfr_t x, y, z, t; unsigned long n; int inex; mpfr_exp_t emin, emax; - unsigned int flags, ex_flags; + mpfr_flags_t flags, ex_flags; int i; tests_start_mpfr (); @@ -78,7 +74,7 @@ MPFR_ASSERTN (inex == 0 && mpfr_cmp_si_2exp (x, -1, -1) == 0 && flags == 0); for (i = -2; i <= 2; i += 2) - RND_LOOP (rnd) + RND_LOOP_NO_RNDF (rnd) { int ex_inex; @@ -154,7 +150,7 @@ mpfr_set_prec (y, yprec); for (n = 0; n < 50; n++) - RND_LOOP (rnd) + RND_LOOP_NO_RNDF (rnd) { mpfr_zeta_ui (y, n, MPFR_RNDN); if (mpfr_can_round (y, yprec, MPFR_RNDN, MPFR_RNDZ, prec @@ -205,6 +201,5 @@ mpfr_clear (t); tests_end_mpfr (); -#endif return 0; } diff -Nru mpfr4-3.1.4/TODO mpfr4-4.0.2/TODO --- mpfr4-3.1.4/TODO 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/TODO 2019-01-07 13:53:20.000000000 +0000 @@ -1,4 +1,4 @@ -Copyright 1999-2016 Free Software Foundation, Inc. +Copyright 1999-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -15,12 +15,12 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. Table of contents: 1. Documentation -2. Installation +2. Compiler/library detection 3. Changes in existing functions 4. New functions to implement 5. Efficiency @@ -31,10 +31,10 @@ 1. Documentation ############################################################################## -- add a description of the algorithms used + proof of correctness +- add a description of the algorithms used and a proof of correctness ############################################################################## -2. Installation +2. Compiler/library detection ############################################################################## - if we want to distinguish GMP and MPIR, we can check at configure time @@ -47,6 +47,11 @@ There is also a library symbol mpir_version, which should match VERSION, set by configure, for example 0.9.0. +- update ICC detection. + * Use only __INTEL_COMPILER instead of the obsolete macro __ICC? + * Possibly enable some features with ICC. For instance, removing + "&& !defined(__ICC)" from src/mpfr.h works with ICC 15.0.0 20140723. + ############################################################################## 3. Changes in existing functions ############################################################################## @@ -54,7 +59,7 @@ - export mpfr_overflow and mpfr_underflow as public functions - many functions currently taking into account the precision of the *input* - variable to set the initial working precison (acosh, asinh, cosh, ...). + variable to set the initial working precision (acosh, asinh, cosh, ...). This is nonsense since the "average" working precision should only depend on the precision of the *output* variable (and maybe on the *value* of the input in case of cancellation). @@ -82,12 +87,58 @@ aa = q*b+r --> q has exactly n bits. If RNDN, takes nq+1 bits. (See also the new division function). +- revisit the conversion functions between a MPFR number and a native + floating-point value. + * Consequences if some exception is trapped? + * Specify under which conditions (current rounding direction and + precision of the FPU, whether a format has been recognized...), + correct rounding is guaranteed. Fix the code if need be. Do not + forget subnormals. + * Provide mpfr_buildopt_* functions to tell whether the format of a + native type (float / double / long double) has been recognized and + which format it is? + * For functions that return a native floating-point value (mpfr_get_flt, + mpfr_get_d, mpfr_get_ld, mpfr_get_decimal64), in case of underflow or + overflow, follow the convention used for the functions in ? + See §7.12.1 "Treatment of error conditions" of ISO C11, which provides + two ways of handling error conditions, depending on math_errhandling: + errno (to be set to ERANGE here) and floating-point exceptions. + If floating-point exceptions need to be generated, do not use + feraiseexcept(), as this function may require the math library (-lm); + use a floating-point expression instead, such as DBL_MIN * DBL_MIN + (underflow) or DBL_MAX * DBL_MAX (overflow), which are probably safe + as used in the GNU libc implementation. + * For testing the lack of subnormal support: + see the -mfpu GCC option for ARM and + https://en.wikipedia.org/wiki/Denormal_number#Disabling_denormal_floats_at_the_code_level + ############################################################################## 4. New functions to implement ############################################################################## +- implement new functions from the C++17 standard: + http://en.cppreference.com/w/cpp/numeric/special_math + assoc_laguerre, assoc_legendre, comp_ellint_1, comp_ellint_2, comp_ellint_3, + cyl_bessel_i, cyl_bessel_j, cyl_bessel_k, cyl_neumann, ellint_1, ellint_2, + ellint_3, hermite, legendre, laguerre, sph_bessel, sph_legendre, + sph_neumann. + Already in mpfr4: beta and riemann_zeta. + See also https://isocpp.org/files/papers/P0226R1.pdf and §29.9.5 in the + C++17 draft: + https://github.com/cplusplus/draft/blob/master/source/numerics.tex +- implement mpfr_get_decimal128 and mpfr_set_decimal128 +- implement mpfr_log_ui to compute log(n) for an unsigned long n. + We can write for argument reduction n = 2^k * n/2^k, where + 2/3 <= n/2^k < 4/3, i.e., k = floor(log2(3n))-1, thus + log(n) = k*log(2) + log(n/2^k), and we can use binary splitting on the + Taylor expansion of log(1+x) to compute log(n/2^k), where at most + p*log(2)/log(3) terms are needed for precision p. + Other idea (from Fredrik Johansson): compute log(m) + log(n/m) where + m=2^a*3^b*5^c*7^d and m is close to n. - implement mpfr_q_sub, mpfr_z_div, mpfr_q_div? +- implement mpfr_pow_q and variants with two integers (native or mpz) + instead of a rational? See IEEE P1788. - implement functions for random distributions, see for example https://sympa.inria.fr/sympa/arc/mpfr/2010-01/msg00034.html (suggested by Charles Karney , 18 Jan 2010): @@ -104,21 +155,19 @@ PolylogP, PolylogD, PolylogDold: see http://arxiv.org/abs/math.CA/0702243 and the references herein. JBessel(n, x) = BesselJ(n+1/2, x) - IncompleteGamma [also wanted by 4 Feb 2008: Gamma(a,x), - gamma(a,x), P(a,x), Q(a,x); see A&S 6.5, ref. [Smith01] in algorithms.bib] KBessel, KBessel2 [2nd kind] JacobiTheta + (see http://www.ams.org/journals/mcom/0000-000-00/S0025-5718-2017-03245-2/home.html) LogIntegral - ExponentialIntegralE1 - E1(z) = int(exp(-t)/t, t=z..infinity), |arg z| < Pi - mpfr_eint1: implement E1(x) for x > 0, and Ei(-x) for x < 0 - E1(NaN) = NaN - E1(+Inf) = +0 - E1(-Inf) = -Inf - E1(+0) = +Inf - E1(-0) = -Inf + ExponentialIntegralEn (formula 5.1.4 of Abramowitz and Stegun) DawsonIntegral GammaD(x) = Gamma(x+1/2) +- new functions of IEEE 754-2008, and more generally functions of the + C binding draft TS 18661-4: + http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1946.pdf + Some propositions about rootn: mpfr_rootn_si, mpfr_rootn_sj, mpfr_rootn_z, + and versions with an unsigned integer: mpfr_rootn_ui (now implemented, as + similar to mpfr_root) and mpfr_rootn_uj. - functions defined in the LIA-2 standard + minimum and maximum (5.2.2): max, min, max_seq, min_seq, mmax_seq and mmin_seq (mpfr_min and mpfr_max correspond to mmin and mmax); @@ -139,7 +188,7 @@ + arcu (5.3.10.15): arctan2(y,x) u / (2 pi); + rad_to_cycle, cycle_to_rad, cycle_to_cycle (5.3.11.{1..3}). - From GSL, missing special functions (if useful in MPFR): - (cf http://www.gnu.org/software/gsl/manual/gsl-ref.html#Special-Functions) + (cf https://www.gnu.org/software/gsl/manual/gsl-ref.html#Special-Functions) + The Airy functions Ai(x) and Bi(x) defined by the integral representations: * Ai(x) = (1/\pi) \int_0^\infty \cos((1/3) t^3 + xt) dt * Bi(x) = (1/\pi) \int_0^\infty (e^(-(1/3) t^3) + \sin((1/3) t^3 + xt)) dt @@ -207,11 +256,30 @@ + Lambert W Functions, W(x) are defined to be solutions of the equation: W(x) \exp(W(x)) = x. This function has multiple branches for x < 0 (2 funcs W0(x) and Wm1(x)) + From Fredrik Johansson: + See https://cs.uwaterloo.ca/research/tr/1993/03/W.pdf, in particular + formulas 5.2 and 5.3 for the error bound: one first computes an + approximation w, and then evaluates the residual w e^w - x. There is an + expression for the error in terms of the residual and the derivative W'(t), + where the derivative can be bounded by piecewise simple functions, + something like min(1, 1/t) when t >= 0. + See https://arxiv.org/abs/1705.03266 for rigorous error bounds. + Trigamma Function psi'(x). and Polygamma Function: psi^{(m)}(x) for m >= 0, x > 0. +- functions from ISO/IEC 24747:2009 (Extensions to the C Library, + to Support Mathematical Special Functions). + Standard: http://www.iso.org/iso/catalogue_detail.htm?csnumber=38857 + Draft: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1292.pdf + Rationale: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1244.pdf + See also: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3060.pdf + (similar, for C++). + Also check whether the functions that are already implemented in MPFR + match this standard. - from gnumeric (www.gnome.org/projects/gnumeric/doc/function-reference.html): - - beta + - incomplete beta function, see message from Martin Maechler + on 18 Jan 2016, and Section 6.6 in + Abramowitz & Stegun - betaln - degrees - radians @@ -230,6 +298,17 @@ 5. Efficiency ############################################################################## +- Fredrik Johansson reports that mpfr_ai is slow for large arguments: an + asymptotic expansion should be used (once done, remove REDUCE_EMAX from + tests/tai.c and update the description in mpfr.texi). +- for exp(x), Fredrik Johansson reports a 20% speed improvement starting from + 4000 bits, and up to a 75% memory improvement in his Arb implementation, by + using recursive instead of iterative binary splitting: + https://github.com/fredrik-johansson/arb/blob/master/elefun/exp_sum_bs_powtab.c +- improve mpfr_grandom using the algorithm in http://arxiv.org/abs/1303.6257 +- use the src/x86_64/corei5/mparam.h file once GMP recognizes correctly the + Core i5 processors (note that gcc -mtune=native gives __tune_corei7__ + and not __tune_corei5__ on those processors) - implement a mpfr_sqrthigh algorithm based on Mulders' algorithm, with a basecase variant - use mpn_div_q to speed up mpfr_div. However mpn_div_q, which is new in @@ -238,35 +317,33 @@ Also mpfr_div uses the remainder computed by mpn_divrem. A workaround would be to first try with mpn_div_q, and if we cannot (easily) compute the rounding, then use the current code with mpn_divrem. +- improve atanh(x) for small x by using atanh(x) = log1p(2x/(1-x)), + and log1p should also be improved for small arguments. - compute exp by using the series for cosh or sinh, which has half the terms (see Exercise 4.11 from Modern Computer Arithmetic, version 0.3) The same method can be used for log, using the series for atanh, i.e., atanh(x) = 1/2*log((1+x)/(1-x)). - improve mpfr_gamma (see https://code.google.com/p/fastfunlib/). A possible idea is to implement a fast algorithm for the argument reconstruction - gamma(x+k). One could also use the series for 1/gamma(x), see for example + gamma(x+k): instead of performing k products by x+i, we could precompute + x^2, ..., x^m for m ~ sqrt(k), and perform only sqrt(k) products. + One could also use the series for 1/gamma(x), see for example http://dlmf.nist.gov/5/7/ or formula (36) from http://mathworld.wolfram.com/GammaFunction.html +- improve the computation of Bernoulli numbers: instead of computing just one + B[2n] at a time in mpfr_bernoulli_internal, we could compute several at a + time, sharing the expensive computation of the 1/p^(2n) series. - fix regression with mpfr_mpz_root (from Keith Briggs, 5 July 2006), for example on 3Ghz P4 with gmp-4.2, x=12.345: prec=50000 k=2 k=3 k=10 k=100 mpz_root 0.036 0.072 0.476 7.628 mpfr_mpz_root 0.004 0.004 0.036 12.20 See also mail from Carl Witty on mpfr list, 09 Oct 2007. -- implement Mulders algorithm for squaring and division - for sparse input (say x=1 with 2 bits), mpfr_exp is not faster than for full precision when precision <= MPFR_EXP_THRESHOLD. The reason is that argument reduction kills sparsity. Maybe avoid argument reduction for sparse input? -- speed up const_euler for large precision [for x=1.1, prec=16610, it takes - 75% of the total time of eint(x)!] -- speed up mpfr_atan for large arguments (to speed up mpc_log) - [from Mark Watkins on Fri, 18 Mar 2005] - Also mpfr_atan(x) seems slower (by a factor of 2) for x near from 1. - Example on a Athlon for 10^5 bits: x=1.1 takes 3s, whereas 2.1 takes 1.8s. - The current implementation does not give monotonous timing for the following: - mpfr_random (x); for (i = 0; i < k; i++) mpfr_atan (y, x, MPFR_RNDN); - for precision 300 and k=1000, we get 1070ms, and 500ms only for p=400! +- speed up mpfr_atan for large arguments (to speed up mpc_log) see FR #6198 - improve mpfr_sin on values like ~pi (do not compute sin from cos, because of the cancellation). For instance, reduce the input modulo pi/2 in [-pi/4,pi/4], and define auxiliary functions for which the argument is @@ -327,6 +404,37 @@ Mulders short product was slower than a full product for large sizes. This should be precisely analyzed and fixed if needed. +- for various functions, check the timings as a function of the magnitude + of the input (and the input and/or output precisions?), and use better + thresholds for asymptotic expansions. + +- improve the special case of mpfr_{add,sub} (x, x, y, ...) when |x| > |y| + to do the addition in-place and have a complexity of O(prec(y)) in most + cases. The mpfr_{add,sub}_{d,ui} functions should automatically benefit + from this change. + +- in gmp_op.c, for functions with mpz_srcptr, check whether mpz_fits_slong_p + is really useful in all cases (see TODO in this file). + +- optimize code that uses a test based on the fact that x >> s is + undefined in C for s == width of x but the result is expected to + be 0. ARM and PowerPC could benefit from such an optimization, + but not x86. This needs support from the compiler. + For PowerPC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79233 + +- deal with MPFR_RNDF in mpfr_round_near_x (replaced by MPFR_RNDZ). + +- instead of a fixed mparam.h, optionally use function multiversioning + (FMV), currently only available with the GNU C++ front end: + https://gcc.gnu.org/wiki/FunctionMultiVersioning + According to https://lwn.net/Articles/691932/ the dispatch resolution + is now done by the dynamic loader, so that this should be fast enough + (the cost would be the reading of a static variable, initialized at + load time, instead of a constant). + In particular, binary package distributions would benefit from FMV as + only one binary is generated for different processor families. + + ############################################################################## 6. Miscellaneous ############################################################################## @@ -337,6 +445,10 @@ * functions to set/test a quiet/signaling NaN: mpfr_set_snan, mpfr_snan_p, mpfr_set_qnan, mpfr_qnan_p * correctly convert to/from double (if encoding of s/qNaN is fixed in 754R) + Note: Signaling NaNs are not specified by the ISO C standard and may + not be supported by the implementation. GCC needs the -fsignaling-nans + option (but this does not affect the C library, which may or may not + accept signaling NaNs). - check again coverage: on 2007-07-27, Patrick Pelissier reports that the following files are not tested at 100%: add1.c, atan.c, atan2.c, @@ -359,8 +471,9 @@ 1250 bytes would still be small compared to the code size! Store pi in round to zero mode (to recover other modes). -- add a new rounding mode: round to nearest, with ties away from zero - (this is roundTiesToAway in 754-2008, could be used by mpfr_round) +- add other prototypes for round to nearest-away (mpfr_round_nearest_away + only deals with the prototypes of say mpfr_sin) or implement it as a native + rounding mode - add a new roundind mode: round to odd. If the result is not exactly representable, then round to the odd mantissa. This rounding has the nice property that for k > 1, if: @@ -368,6 +481,36 @@ z = round(y, p, TO_NEAREST_EVEN), then z = round(x, p, TO_NEAREST_EVEN) so it avoids the double-rounding problem. + VL: I prefer the (original?) term "sticky rounding", as used in + J Strother Moore, Tom Lynch, Matt Kaufmann. A Mechanically Checked + Proof of the Correctness of the Kernel of the AMD5K86 Floating-Point + Division Algorithm. IEEE Transactions on Computers, 1996. + and + http://www.russinoff.com/libman/text/node26.html + +- new rounding mode MPFR_RNDE when the result is known to be exact? + * In normal mode, this would allow MPFR to optimize using + this information. + * In debug mode, MPFR would check that the result is exact + (i.e. that the ternary value is 0). + +- new "rounding mode" MPFR_RNDF (faithful rounding)? + This is not really a rounding mode since it is non-deterministic. The + goal is to avoid the Table Maker's Dilemma in internal computations. + The definition of faithful rounding of a real number x is: return either + RNDD(x) or RNDU(x). This means that if x is exactly representable, one + returns x exactly. In MPFR, the ternary value should be unspecified for + efficiency reasons. + Note: One typically implements faithful rounding by computing an + approximation to the result with some adequately chosen error bound, + then by rounding this approximation to nearest. + Concerning the choice of the error bound, if the result x is equal to + 1 + t, where t is a very small positive number, then the error bound + needs to be at most ulp(x)/4 + t. Since t can be arbitrarily small, + the error bound needs to be at most ulp(x)/4. And this error bound + is sufficient in all cases. Note that with the even rounding rule or + rounding away from zero, it is not needed to relax the condition when + x is exactly representable. - add tests of the ternary value for constants @@ -416,6 +559,121 @@ a constant (see README.dev). Also check the use of MPFR_EMIN_MIN and MPFR_EMAX_MAX. +- add a test checking that no mpfr.h macros depend on mpfr-impl.h + (the current tests cannot check that since mpfr-impl.h is always + included). + +- move some macro definitions from acinclude.m4 to the m4 directory + as suggested by the Automake manual? The reason is that the + acinclude.m4 file is big and a bit difficult to read. + +- use symbol versioning. + +- check whether mpz_t caching (pool) is necessary. Timings with -static + with details about the C / C library implementation should be put + somewhere as a comment in the source or in the doc. Using -static + is important because otherwise the cache saves the dynamic call to + mpz_init and mpz_clear; so, what we're measuring is not clear. + See thread: + https://gmplib.org/list-archives/gmp-devel/2015-September/004147.html + Summary: It will not be integrated in GMP because 1) This yields + problems with threading (in MPFR, we have TLS variables, but this is + not the case of GMP). 2) The gain (if confirmed with -static) would + be due to a poor malloc implementation (timings would depend on the + platform). 3) Applications would use more RAM. + Additional notes [VL]: the major differences in the timings given + by Patrick in 2014-01 under Linux were: + Before: + arccos(x) took 0.054689 ms (32767 eval in 1792 ms) + arctan(x) took 0.042116 ms (32767 eval in 1380 ms) + After: + arccos(x) took 0.043580 ms (32767 eval in 1428 ms) + arctan(x) took 0.035401 ms (32767 eval in 1160 ms) + mpfr_acos doesn't use mpz, but calls mpfr_atan, so that the issue comes + from mpfr_atan, which uses mpz a lot. The problem mainly comes from the + reallocations in GMP because mpz_init is used instead of mpz_init2 with + the estimated maximum size. Other places in the code that uses mpz_init + may be concerned. + Issues with mpz_t caching: + * The pool can take much memory, which may no longer be useful. + For instance: + mpfr_init2 (x, 10000000); + mpfr_log_ui (x, 17, MPFR_RNDN); + /* ... */ + mpfr_clear (x); + /* followed by code using only small precision */ + while contrary to real caches, they contain no data. This is not + valuable memory: freeing/allocating a large block of memory is + much faster than the actual computations, so that mpz_t caching + has no impact on the performance in such cases. A pool with large + blocks also potentially destroys the data locality. + * It assumes that the real GMP functions are __gmpz_init and + __gmpz_clear, which are not part of the official GMP API, thus + is based on GMP internals, which may change in the future or + may be different in forks / compatible libraries / etc. This + can be solved if MPFR code calls mpfr_mpz_init / mpfr_mpz_clear + directly, avoiding the #define's. + Questions that need to be answered: + * What about the comparisons with other memory allocators? + * Shouldn't the pool be part of the memory allocator? + For the default memory allocator (malloc): RFE? + If it is decided to keep some form of mpz_t caching, a possible solution + for both issues: define mpfr_mpz_init2 and mpfr_mpz_clear2, which both + take 2 arguments like mpz_init2, where mpfr_mpz_init2 behaves in a way + similar to mpz_init2, and mpfr_mpz_clear2 behaves in a way similar to + mpz_clear but where the size argument is a hint for the pool; if it is + too large, then the mpz_t should not be pushed back to the pool. The + size argument of mpfr_mpz_init2 could also be a hint to decide which + element to pull from the pool. + +- in tsum, add testcases for mpfr_sum triggering the bug fixed in r9722, + that is, with a large error during the computation of the secondary term + (when the TMD occurs). + +- add internal or public variants of some basic functions (+, -, *) with + mpz_t as the exponent for correctly rounded polynomials (like fmma), + in order to avoid internal overflow and underflow in extreme cases? + Alternatively, for fmma, modify add*.c and sub*.c code to define + mpfr_add_raw, which takes arrays of limbs and their precision, and the + positive exponent delta (as mpfr_uexp_t to be always representable). + The exponent delta should be sufficient for now since it can be bounded + by MPFR_PREC_MAX+1 if need be. + +- use the keyword "static" in array indices of parameter declarations with + C99 compilers (6.7.5.3p7) when the pointer is expected not to be null? + For instance, if mpfr.h is changed to have: + __MPFR_DECLSPEC void mpfr_dump (const __mpfr_struct [static 1]); + and one calls + mpfr_dump (NULL); + one gets a warning with Clang. This is just an example; this needs to be + done in a clean way. + See: + http://stackoverflow.com/a/3430353/3782797 + https://hamberg.no/erlend/posts/2013-02-18-static-array-indices.html + +- change most mpfr_urandomb occurrences to mpfr_urandom in the tests? + (The one done in r10573 allowed us to find a bug even without + assertion checking.) + +- tzeta has been much slower since r9848 (which increases the precision + of the input for the low output precisions), at least with the x86 + 32-bit ABI. This seems to come from the fact that the working precision + in the mpfr_zeta implementation depends on the precision of the input. + Once mpfr_zeta has improved, change the last argument of test_generic + in tzeta.c back to 5 (as it was before r10667). + +- check the small-precision tables in the tests? + This may require to export some pointer to the tables, but this could + be done only if some debug macro is defined. + +- optionally use malloc() for the caches? See mpfr_mp_memory_cleanup. + Note: This can be implemented by adding a TLS flag saying whether we + are under cache generation or not, and by making the MPFR allocation + functions consider this flag. Moreover, this can only work for mpfr_t + caching (floating-point constants), not for mpz_t caching (Bernoulli + constants) because we do not have the control of memory allocation for + mpz_init. + ############################################################################## 7. Portability @@ -423,8 +681,6 @@ - add a web page with results of builds on different architectures -- support the decimal64 function without requiring --with-gmp-build - - [Kevin about texp.c long strings] For strings longer than c99 guarantees, it might be cleaner to introduce a "tests_strdupcat" or something to concatenate literal @@ -432,3 +688,5 @@ couple of places already. Arrays of chars are not much fun. - use https://gcc.gnu.org/viewcvs/gcc/trunk/config/stdint.m4 for mpfr-gmp.h + +- with MinGW, build with -D__USE_MINGW_ANSI_STDIO by default? diff -Nru mpfr4-3.1.4/tools/bench/benchtime.h mpfr4-4.0.2/tools/bench/benchtime.h --- mpfr4-3.1.4/tools/bench/benchtime.h 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tools/bench/benchtime.h 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,70 @@ +/* benchtime.h -- header file for MPFRbench + +Copyright 1999, 2001-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + + +/* compute the time to run accurately niter calls of the function for any + number of inputs */ +#define DECLARE_ACCURATE_TIME_NOP(func, funccall) \ +unsigned long int ACCURATE_TIME_NOP##func( unsigned long int niter, int n, mpfr_t* z, mpfr_t* x, mpfr_t* y, int nop);\ +unsigned long int ACCURATE_TIME_NOP##func( unsigned long int niter, int n, mpfr_t* z, mpfr_t* x, mpfr_t* y, int nop)\ +{ \ + unsigned long int ti, i; int kn; \ + unsigned long int t0 = get_cputime (); \ + for (i = niter, kn=0; i > 0; i--) \ + { \ + funccall; \ + kn++; if (kn==n) kn = 0; \ + } \ + ti = get_cputime () - t0; \ + /* following lines are appended to avoid warnings but minimize the number \ + of macros */ \ + if (nop==2) y = NULL; \ + return ti; \ +} + +/* address of the function to time accurately niter calls of func */ +#define ADDR_ACCURATE_TIME_NOP(func) ACCURATE_TIME_NOP##func + +/* address of the function to time one call of func */ +#define ADDR_TIME_NOP(func) TIME_NOP##func + + +/* compute the time to run one only call of the function with two inputs */ +#define DECLARE_TIME_NOP(func, funcall, nop) \ + DECLARE_ACCURATE_TIME_NOP(func, funcall) \ + double TIME_NOP##func(int n, mpfr_t* z, mpfr_t* x, mpfr_t* y); \ + double TIME_NOP##func(int n, mpfr_t* z, mpfr_t* x, mpfr_t* y) \ + { \ + double t; unsigned long int nbcall, mytime; \ + for (nbcall = 1, mytime=0; mytime<250000; nbcall<<=1) \ + { \ + mytime = ACCURATE_TIME_NOP##func(nbcall, n, z, x, y, nop); \ + } \ + t = (double) mytime/ nbcall ; \ + return t; \ + } + +/* compute the time to run accurately niter calls of the function */ +/* functions with 2 operands */ +#define DECLARE_TIME_2OP(func) DECLARE_TIME_NOP(func, func(z[kn],x[kn],y[kn], MPFR_RNDN), 2 ) +/* functions with 1 operand */ +#define DECLARE_TIME_1OP(func) DECLARE_TIME_NOP(func, func(z[kn],x[kn], MPFR_RNDN), 1 ) diff -Nru mpfr4-3.1.4/tools/bench/Makefile.am mpfr4-4.0.2/tools/bench/Makefile.am --- mpfr4-3.1.4/tools/bench/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tools/bench/Makefile.am 2019-01-01 21:02:47.000000000 +0000 @@ -0,0 +1,24 @@ +# Copyright 2000-2019 Free Software Foundation, Inc. +# This Makefile.am is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src +AM_DEFAULT_SOURCE_EXT = .c + +LDADD = $(top_builddir)/src/libmpfr.la + +EXTRA_PROGRAMS = mpfrbench + +EXTRA_DIST = README + +noinst_HEADERS = benchtime.h + +bench : mpfrbench + ./mpfrbench + diff -Nru mpfr4-3.1.4/tools/bench/Makefile.in mpfr4-4.0.2/tools/bench/Makefile.in --- mpfr4-3.1.4/tools/bench/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tools/bench/Makefile.in 2019-01-31 20:43:20.000000000 +0000 @@ -0,0 +1,613 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright 2000-2019 Free Software Foundation, Inc. +# This Makefile.am is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +EXTRA_PROGRAMS = mpfrbench$(EXEEXT) +subdir = tools/bench +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +mpfrbench_SOURCES = mpfrbench.c +mpfrbench_OBJECTS = mpfrbench.$(OBJEXT) +mpfrbench_LDADD = $(LDADD) +mpfrbench_DEPENDENCIES = $(top_builddir)/src/libmpfr.la +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/mpfrbench.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = mpfrbench.c +DIST_SOURCES = mpfrbench.c +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp README +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATAFILES = @DATAFILES@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBMPFR_LDFLAGS = @LIBMPFR_LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MPFR_LDFLAGS = @MPFR_LDFLAGS@ +MPFR_LIBM = @MPFR_LIBM@ +MPFR_LIBQUADMATH = @MPFR_LIBQUADMATH@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TUNE_LIBS = @TUNE_LIBS@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src +AM_DEFAULT_SOURCE_EXT = .c +LDADD = $(top_builddir)/src/libmpfr.la +EXTRA_DIST = README +noinst_HEADERS = benchtime.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/bench/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tools/bench/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mpfrbench$(EXEEXT): $(mpfrbench_OBJECTS) $(mpfrbench_DEPENDENCIES) $(EXTRA_mpfrbench_DEPENDENCIES) + @rm -f mpfrbench$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(mpfrbench_OBJECTS) $(mpfrbench_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpfrbench.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/mpfrbench.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/mpfrbench.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +bench : mpfrbench + ./mpfrbench + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru mpfr4-3.1.4/tools/bench/mpfrbench.c mpfr4-4.0.2/tools/bench/mpfrbench.c --- mpfr4-3.1.4/tools/bench/mpfrbench.c 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tools/bench/mpfrbench.c 2019-01-07 13:53:20.000000000 +0000 @@ -0,0 +1,309 @@ +/* mpfrbench.c -- compute the timings for the MPFRbench benchmark + +Copyright 1999, 2001-2019 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include +#include +#ifdef HAVE_GETRUSAGE +#include +#include +#else +#include +#endif +#include "mpfr.h" +#include "benchtime.h" + +static unsigned long get_cputime (void); + +/* enumeration of the group of functions */ +enum egroupfunc +{ + egroup_arith = 0, /* e.g., arith ... */ + egroup_special, /* e.g., cos, ... */ + egroup_last /* to get the number of enum */ +}; + +/* name of the group of functions */ +const char *groupname [] = { + "Arith ", + "Special" +}; + + + +struct benchfunc +{ + const char *name; /* name of the function */ + double (*func_init) (int n, mpfr_t * z, mpfr_t * x, mpfr_t * y); /* compute the time for one call (not accurate) */ + unsigned long int (*func_accurate) (unsigned long int niter, int n, mpfr_t * z, mpfr_t * x, mpfr_t * y, int nop); /* compute the time for "niter" calls (accurate) */ + enum egroupfunc group; /* group of the function */ + int noperands; /* number of operands */ +}; + + +/* declare the function to compute the cost for one call of the function */ +DECLARE_TIME_2OP (mpfr_mul) +DECLARE_TIME_2OP (mpfr_add) +DECLARE_TIME_2OP (mpfr_sub) +DECLARE_TIME_2OP (mpfr_div) +DECLARE_TIME_1OP (mpfr_sqrt) +DECLARE_TIME_1OP (mpfr_exp) +DECLARE_TIME_1OP (mpfr_log) +DECLARE_TIME_1OP (mpfr_sin) +DECLARE_TIME_1OP (mpfr_cos) +DECLARE_TIME_1OP (mpfr_asin) +DECLARE_TIME_1OP (mpfr_acos) + +/* number of operations to score */ +#define NB_BENCH_OP 11 +/* number of random numbers */ +#define NB_RAND_FLOAT 10000 + +/* list of functions to compute the score */ +const struct benchfunc arrayfunc[NB_BENCH_OP] = { + {"mul", ADDR_TIME_NOP (mpfr_mul), ADDR_ACCURATE_TIME_NOP (mpfr_mul), egroup_arith, 2}, + {"add", ADDR_TIME_NOP (mpfr_add), ADDR_ACCURATE_TIME_NOP (mpfr_add), egroup_arith, 2}, + {"sub", ADDR_TIME_NOP (mpfr_sub), ADDR_ACCURATE_TIME_NOP (mpfr_sub), egroup_arith, 2}, + {"div", ADDR_TIME_NOP (mpfr_div), ADDR_ACCURATE_TIME_NOP (mpfr_div), egroup_arith, 2}, + {"sqrt", ADDR_TIME_NOP (mpfr_sqrt), ADDR_ACCURATE_TIME_NOP (mpfr_sqrt), egroup_special, 1}, + {"exp", ADDR_TIME_NOP (mpfr_exp), ADDR_ACCURATE_TIME_NOP (mpfr_exp), egroup_special, 1}, + {"log", ADDR_TIME_NOP (mpfr_log), ADDR_ACCURATE_TIME_NOP (mpfr_log), egroup_special, 1}, + {"cos", ADDR_TIME_NOP (mpfr_cos), ADDR_ACCURATE_TIME_NOP (mpfr_cos), egroup_special, 1}, + {"sin", ADDR_TIME_NOP (mpfr_sin), ADDR_ACCURATE_TIME_NOP (mpfr_sin), egroup_special, 1}, + {"acos", ADDR_TIME_NOP (mpfr_acos), ADDR_ACCURATE_TIME_NOP (mpfr_acos), egroup_special, 1}, + {"asin", ADDR_TIME_NOP (mpfr_asin), ADDR_ACCURATE_TIME_NOP (mpfr_asin), egroup_special, 1} +}; + +/* the following arrays must have the same number of elements */ + +/* list of precisions to test for the first operand */ +const int arrayprecision_op1[] = + { 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, + 50, 100, 200, 350, 700, 1500, 3000, 6000, 10000, 1500, 3000, 5000, + }; + +/* list of precisions to test for the second operand */ +const int arrayprecision_op2[] = + { 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, + 50, 100, 200, 350, 700, 1500, 3000, 6000, 10000, 3000, 6000, 10000 + }; + +/* get the time in microseconds */ +static unsigned long +get_cputime (void) +{ +#ifdef HAVE_GETRUSAGE + struct rusage ru; + + getrusage (RUSAGE_SELF, &ru); + return ru.ru_utime.tv_sec * 1000000 + ru.ru_utime.tv_usec + + ru.ru_stime.tv_sec * 1000000 + ru.ru_stime.tv_usec; +#else + return (unsigned long) ((double) clock () / ((double) CLOCKS_PER_SEC / 1e6)); +#endif +} + +/* initialize an array of n random numbers */ +static mpfr_t * +bench_random_array (int n, mpfr_prec_t precision, gmp_randstate_t randstate) +{ + int j; + mpfr_t *ptr; + + ptr = (mpfr_t *) malloc (n * sizeof (mpfr_t)); + if (ptr == NULL) + { + printf ("Can't allocate memory for %d numbers\n", n); + exit (1); + return NULL; + } + for (j = 0; j < n; j++) + { + mpfr_init2 (ptr[j], precision); + mpfr_urandomb (ptr[j], randstate); + } + return ptr; +} + +/* compute the score for the operation arrayfunc[op] */ +static void +compute_score (mpz_t zscore, int op, gmp_randstate_t randstate) +{ + mpfr_t *xptr, *yptr, *zptr; + int i, j; + size_t k; + unsigned long niter, ti; + double t; + unsigned long ops_per_sec; + int countprec = 0; + + mpz_init_set_si (zscore, 1); + + i = op; + for (k = 0; k < (int) sizeof (arrayprecision_op1) / sizeof (arrayprecision_op1[0]); + k++, countprec++) + { + mpfr_prec_t precision1 = arrayprecision_op1[k]; + mpfr_prec_t precision2 = arrayprecision_op2[k]; + mpfr_prec_t precision3 = arrayprecision_op2[k]; + + /* allocate array of random numbers */ + xptr = bench_random_array (NB_RAND_FLOAT, precision1, randstate); + yptr = bench_random_array (NB_RAND_FLOAT, precision2, randstate); + zptr = bench_random_array (NB_RAND_FLOAT, precision3, randstate); + + /* compute the number of operations per second */ + if (arrayfunc[i].noperands==2) + { + printf ("operation %5s, precision : %5lux%5lu to %5lu bits ... ", arrayfunc[i].name, precision1, precision2, precision3); + } + else + { + printf ("operation %5s, precision : %5lu to %5lu bits ... ", arrayfunc[i].name, precision1, precision3); + } + fflush (stdout); + + t = arrayfunc[i].func_init (NB_RAND_FLOAT, zptr, xptr, yptr); + niter = 1 + (unsigned long) (1e6 / t); + + printf (" %10lu iterations ...", niter); + fflush (stdout); + + /* ti expressed in microseconds */ + ti = arrayfunc[i].func_accurate (niter, NB_RAND_FLOAT, zptr, xptr, yptr, arrayfunc[i].noperands); + + ops_per_sec = (unsigned long) (1000000E0 * niter / (double) ti); + + printf (" %10lu operations per second\n", ops_per_sec); + + mpz_mul_ui (zscore, zscore, ops_per_sec); + + /* free memory */ + for (j = 0; j < NB_RAND_FLOAT; j++) + { + mpfr_clear (xptr[j]); + mpfr_clear (yptr[j]); + mpfr_clear (zptr[j]); + } + free (xptr); + free (yptr); + free (zptr); + } + + mpz_root (zscore, zscore, countprec); +} + +/* compute the score for all groups */ +static void +compute_groupscore (mpz_t groupscore[], int countop, mpz_t zscore[]) +{ + int op; + enum egroupfunc group; + int countgroupop; + + for (group = (enum egroupfunc)0; group != egroup_last; group++) + { + mpz_init_set_si (groupscore[group], 1); + for (op = 0, countgroupop = 0; op < countop; op++) + { + if (group == arrayfunc[op].group) + { + mpz_mul (groupscore[group], groupscore[group], zscore[op]); + countgroupop++; + } + } + mpz_root (groupscore[group], groupscore[group], countgroupop); + } +} + + +/* compute the global score */ +static void +compute_globalscore (mpz_t globalscore, int countop, mpz_t zscore[]) +{ + int op; + + mpz_init_set_si (globalscore, 1); + for (op = 0; op < countop; op++) + { + mpz_mul (globalscore, globalscore, zscore[op]); + } + mpz_root (globalscore, globalscore, countop); +} + +int +main (void) +{ + int i; + enum egroupfunc group; + mpz_t score[NB_BENCH_OP]; + mpz_t globalscore, groupscore[egroup_last]; + gmp_randstate_t randstate; + + gmp_randinit_default (randstate); + + for (i = 0; i < NB_BENCH_OP; i++) + { + compute_score (score[i], i, randstate); + } + compute_globalscore (globalscore, NB_BENCH_OP, score); + compute_groupscore (groupscore, NB_BENCH_OP, score); + + printf ("\n=================================================================\n\n"); + printf ("GMP : %s MPFR : %s \n", gmp_version, mpfr_get_version ()); +#ifdef __GMP_CC + printf ("GMP compiler : %s\n", __GMP_CC); +#endif +#ifdef __GMP_CFLAGS + printf ("GMP flags : %s\n", __GMP_CFLAGS); +#endif + printf ("\n\n"); + + for (i = 0; i < NB_BENCH_OP; i++) + { + gmp_printf ("\tscore for %5s : %12Zd\n", arrayfunc[i].name, score[i]); + if (i == NB_BENCH_OP-1 || arrayfunc[i+1].group != arrayfunc[i].group) + { + enum egroupfunc g = arrayfunc[i].group; + gmp_printf ("group score %s : %12Zd\n\n", groupname[g], groupscore[g]); + } + } + /* divide by 132 the global score to get about 10^3 on a + Intel(R) Core(TM)2 Quad CPU Q9550 @ 2.83GHz + with GMP : 5.1.3 MPFR : 3.1.2 + GMP compiler: gcc -std=gnu99, GMP flags: -O2 -pedantic + -fomit-frame-pointer -m64 -mtune=core2 -march=core2 */ + mpz_div_ui (globalscore, globalscore, 132); + gmp_printf ("global score : %12Zd\n\n", globalscore); + + for (i = 0; i < NB_BENCH_OP; i++) + { + mpz_clear (score[i]); + } + + for (group = (enum egroupfunc)0; group != egroup_last; group++) + { + mpz_clear (groupscore[group]); + } + mpz_clear (globalscore); + gmp_randclear (randstate); + return 0; +} diff -Nru mpfr4-3.1.4/tools/bench/README mpfr4-4.0.2/tools/bench/README --- mpfr4-3.1.4/tools/bench/README 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tools/bench/README 2015-09-04 09:48:35.000000000 +0000 @@ -0,0 +1,34 @@ +To compile mpfrbench, simply do: + +$ make mpfrbench + +To run it: + +$ ./mpfrbench + +On a typical computer, it should take around 12 minutes. The final output +looks like (here on a Intel(R) Core(TM)2 Quad CPU Q9550 @ 2.83GHz with +GCC 4.9.3, and --with-gmp-build=gmp-6.0.0), svn revision 9669: + +GMP : 6.0.0 MPFR : 3.2.0-dev +GMP compiler : gcc -std=gnu99 +GMP flags : -O2 -pedantic -fomit-frame-pointer -m64 -mtune=core2 -march=core2 + + + score for mul : 1434798 + score for add : 6419546 + score for sub : 6228906 + score for div : 698843 +group score Arith : 2516353 + + score for sqrt : 550492 + score for exp : 26517 + score for log : 20034 + score for cos : 28853 + score for sin : 23044 + score for acos : 7639 + score for asin : 8010 +group score Special : 27501 + +global score : 1076 + diff -Nru mpfr4-3.1.4/tools/ck-clz_tab mpfr4-4.0.2/tools/ck-clz_tab --- mpfr4-3.1.4/tools/ck-clz_tab 1970-01-01 00:00:00.000000000 +0000 +++ mpfr4-4.0.2/tools/ck-clz_tab 2019-01-01 21:02:47.000000000 +0000 @@ -0,0 +1,30 @@ +#!/bin/sh + +# Copyright 2016-2019 Free Software Foundation, Inc. +# This script is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# ck-clz_tab can be run from the tools directory +dir=$(pwd) +[ -d src ] || [ "$(basename "$dir")" != tools ] || cd .. + +size1=$(sed -n 's/^extern .* __clz_tab\[\([0-9]\+\)\].*/\1/p' \ + src/mpfr-longlong.h) + +size2=$(sed -n 's/^.* __clz_tab\[\([0-9]\+\)\].*/\1/p' \ + src/mp_clz_tab.c) + +if [ -n "$size1" ] && [ -n "$size2" ] && [ "$size1" != "$size2" ]; then + cat >&2 < @@ -32,7 +32,7 @@ /* Let f be a function for which we have several implementations f1, f2... */ /* We wish to have a quick overview of which implementation is the best */ -/* in function of the point x where f(x) is computed and of the prectision */ +/* in function of the point x where f(x) is computed and of the precision */ /* prec requested by the user. */ /* This is performed by drawing a 2D graphic with color indicating which */ /* method is the best. */ diff -Nru mpfr4-3.1.4/tune/Makefile.am mpfr4-4.0.2/tune/Makefile.am --- mpfr4-3.1.4/tune/Makefile.am 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/tune/Makefile.am 2019-01-01 21:02:47.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright 2010-2016 Free Software Foundation, Inc. +# Copyright 2010-2019 Free Software Foundation, Inc. # This Makefile.am is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff -Nru mpfr4-3.1.4/tune/Makefile.in mpfr4-4.0.2/tune/Makefile.in --- mpfr4-3.1.4/tune/Makefile.in 2016-03-06 11:33:18.000000000 +0000 +++ mpfr4-4.0.2/tune/Makefile.in 2019-01-31 20:43:20.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,7 +14,7 @@ @SET_MAKE@ -# Copyright 2010-2016 Free Software Foundation, Inc. +# Copyright 2010-2019 Free Software Foundation, Inc. # This Makefile.am is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -104,8 +104,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -153,7 +152,9 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/bidimensional_sample.Po \ + ./$(DEPDIR)/speed.Po ./$(DEPDIR)/tuneup.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -253,6 +254,7 @@ MKDIR_P = @MKDIR_P@ MPFR_LDFLAGS = @MPFR_LDFLAGS@ MPFR_LIBM = @MPFR_LIBM@ +MPFR_LIBQUADMATH = @MPFR_LIBQUADMATH@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -267,6 +269,9 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -286,6 +291,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -359,8 +365,8 @@ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -390,9 +396,15 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bidimensional_sample.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/speed.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tuneup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bidimensional_sample.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/speed.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tuneup.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -473,7 +485,10 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -543,7 +558,9 @@ clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/bidimensional_sample.Po + -rm -f ./$(DEPDIR)/speed.Po + -rm -f ./$(DEPDIR)/tuneup.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -589,7 +606,9 @@ installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/bidimensional_sample.Po + -rm -f ./$(DEPDIR)/speed.Po + -rm -f ./$(DEPDIR)/tuneup.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -610,18 +629,19 @@ .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool cscopelist-am ctags ctags-am distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am .PRECIOUS: Makefile diff -Nru mpfr4-3.1.4/tune/speed.c mpfr4-4.0.2/tune/speed.c --- mpfr4-3.1.4/tune/speed.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/tune/speed.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Tune various threshold of MPFR -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include @@ -31,8 +31,7 @@ static short mulhigh_ktab[MPFR_MULHIGH_TAB_SIZE]; #else static short mulhigh_ktab[] = {MPFR_MULHIGH_TAB}; -#define MPFR_MULHIGH_TAB_SIZE \ - ((mp_size_t) (sizeof(mulhigh_ktab) / sizeof(mulhigh_ktab[0]))) +#define MPFR_MULHIGH_TAB_SIZE ((mp_size_t) (numberof (mulhigh_ktab))) #endif #undef _PROTO diff -Nru mpfr4-3.1.4/tune/tuneup.c mpfr4-4.0.2/tune/tuneup.c --- mpfr4-3.1.4/tune/tuneup.c 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/tune/tuneup.c 2019-01-07 13:53:20.000000000 +0000 @@ -1,6 +1,6 @@ /* Tune various threshold of MPFR -Copyright 2005-2016 Free Software Foundation, Inc. +Copyright 2005-2019 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see -http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include @@ -30,6 +30,12 @@ #define _PROTO __GMP_PROTO #include "speed.h" +/* Undefine static assertion system */ +#undef MPFR_DECL_STATIC_ASSERT +#undef MPFR_STAT_STATIC_ASSERT +#define MPFR_DECL_STATIC_ASSERT(a) MPFR_ASSERTN(a) +#define MPFR_STAT_STATIC_ASSERT(a) MPFR_ASSERTN(a) + int verbose; /* template for an unary function */ @@ -274,8 +280,12 @@ } /* Setup mpfr_mul, mpfr_sqr and mpfr_div */ -mpfr_prec_t mpfr_mul_threshold; -mpfr_prec_t mpfr_sqr_threshold; +/* Since mpfr_mul() deals with both mul and sqr, and contains an assert that + the thresholds are >= 1, we initialize both values to 1 to avoid a failed + assertion (let's recall that static assertions are replaced by normal + dynamic assertions here). */ +mpfr_prec_t mpfr_mul_threshold = 1; +mpfr_prec_t mpfr_sqr_threshold = 1; mpfr_prec_t mpfr_div_threshold; #undef MPFR_MUL_THRESHOLD #define MPFR_MUL_THRESHOLD mpfr_mul_threshold @@ -562,7 +572,7 @@ It assumes that for (x,p) close to zero, algo1 is used and algo2 is used when (x,p) is far from zero. If algo2 is better for low prec, and algo1 better for high prec, - the behaviour of this function is undefined. + the behavior of this function is undefined. This tuning function tries couples (x,p) of the form (ell*dirx, ell*dirp) until it finds a point on the boundary. It returns ell. */ @@ -953,7 +963,7 @@ if (k != MPFR_DIVHIGH_TAB_SIZE - 1) fputc (',', f); if ((k+1) % 16 == 0) - fprintf (f, " /*%zu-%zu*/ \\\n ", k - 15, k); + fprintf (f, " /*%zu-%zu*/ \\\n ", (size_t) k - 15, (size_t) k); if (verbose) putchar ('.'); } diff -Nru mpfr4-3.1.4/VERSION mpfr4-4.0.2/VERSION --- mpfr4-3.1.4/VERSION 2016-03-06 11:33:04.000000000 +0000 +++ mpfr4-4.0.2/VERSION 2019-01-31 20:29:48.000000000 +0000 @@ -1 +1 @@ -3.1.4 +4.0.2