diff options
Diffstat (limited to 'Build/source/libs/mpfr/mpfr-src/src')
248 files changed, 1058 insertions, 694 deletions
diff --git a/Build/source/libs/mpfr/mpfr-src/src/Makefile.am b/Build/source/libs/mpfr/mpfr-src/src/Makefile.am index fc0c3384040..fbd077710b0 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/Makefile.am +++ b/Build/source/libs/mpfr/mpfr-src/src/Makefile.am @@ -1,4 +1,4 @@ -# Copyright 2000-2015 Free Software Foundation, Inc. +# Copyright 2000-2016 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. @@ -75,7 +75,7 @@ libmpfr_la_LIBADD = @LIBOBJS@ # 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:3:1 +libmpfr_la_LDFLAGS = $(MPFR_LDFLAGS) $(LIBMPFR_LDFLAGS) -version-info 5:4:1 # 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 diff --git a/Build/source/libs/mpfr/mpfr-src/src/abort_prec_max.c b/Build/source/libs/mpfr/mpfr-src/src/abort_prec_max.c index 57cd1d20858..92eb80de35b 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/abort_prec_max.c +++ b/Build/source/libs/mpfr/mpfr-src/src/abort_prec_max.c @@ -1,7 +1,7 @@ /* mpfr_abort_prec_max -- Abort due to maximal precision overflow. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/acos.c b/Build/source/libs/mpfr/mpfr-src/src/acos.c index 7b2bf9e93e2..9dc79eb8a9c 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/acos.c +++ b/Build/source/libs/mpfr/mpfr-src/src/acos.c @@ -1,7 +1,7 @@ /* mpfr_acos -- arc-cosinus of a floating-point number -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/acosh.c b/Build/source/libs/mpfr/mpfr-src/src/acosh.c index a0f96dc4ae3..0bfa102e818 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/acosh.c +++ b/Build/source/libs/mpfr/mpfr-src/src/acosh.c @@ -1,7 +1,7 @@ /* mpfr_acosh -- inverse hyperbolic cosine -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/add.c b/Build/source/libs/mpfr/mpfr-src/src/add.c index c70981d9dfd..a38546b35e9 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/add.c +++ b/Build/source/libs/mpfr/mpfr-src/src/add.c @@ -1,7 +1,7 @@ /* mpfr_add -- add two floating-point numbers -Copyright 1999-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/add1.c b/Build/source/libs/mpfr/mpfr-src/src/add1.c index b7b3094acab..9c3f21327f8 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/add1.c +++ b/Build/source/libs/mpfr/mpfr-src/src/add1.c @@ -1,7 +1,7 @@ /* mpfr_add1 -- internal function to perform a "real" addition -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/add1sp.c b/Build/source/libs/mpfr/mpfr-src/src/add1sp.c index 1435e317096..c9c92f6cc73 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/add1sp.c +++ b/Build/source/libs/mpfr/mpfr-src/src/add1sp.c @@ -1,8 +1,8 @@ /* mpfr_add1sp -- internal function to perform a "real" addition All the op must have the same precision -Copyright 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/add_d.c b/Build/source/libs/mpfr/mpfr-src/src/add_d.c index ee55aed2499..47a533a79d7 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/add_d.c +++ b/Build/source/libs/mpfr/mpfr-src/src/add_d.c @@ -1,8 +1,8 @@ /* mpfr_add_d -- add a multiple precision floating-point number to a machine double precision float -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/add_ui.c b/Build/source/libs/mpfr/mpfr-src/src/add_ui.c index 51b996c82b6..49c6752a074 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/add_ui.c +++ b/Build/source/libs/mpfr/mpfr-src/src/add_ui.c @@ -1,7 +1,7 @@ /* mpfr_add_ui -- add a floating-point number with a machine integer -Copyright 2000-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/agm.c b/Build/source/libs/mpfr/mpfr-src/src/agm.c index 0177e32d5e1..cef4b2bc7a9 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/agm.c +++ b/Build/source/libs/mpfr/mpfr-src/src/agm.c @@ -1,7 +1,7 @@ /* mpfr_agm -- arithmetic-geometric mean of two floating-point numbers -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -96,10 +96,7 @@ mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mpfr_rnd_t rnd_mode) /* b (op2) and a (op1) are the 2 operands but we want b >= a */ compare = mpfr_cmp (op1, op2); if (MPFR_UNLIKELY( compare == 0 )) - { - mpfr_set (r, op1, rnd_mode); - MPFR_RET (0); /* exact */ - } + return mpfr_set (r, op1, rnd_mode); else if (compare > 0) { mpfr_srcptr t = op1; diff --git a/Build/source/libs/mpfr/mpfr-src/src/ai.c b/Build/source/libs/mpfr/mpfr-src/src/ai.c index cbab7cfcbe0..313cf98e1b1 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/ai.c +++ b/Build/source/libs/mpfr/mpfr-src/src/ai.c @@ -1,7 +1,7 @@ /* mpfr_ai -- Airy function Ai -Copyright 2010-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2010-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/amd/amdfam10/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/amd/amdfam10/mparam.h index 4a3e407b225..43bc9164a94 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/amd/amdfam10/mparam.h +++ b/Build/source/libs/mpfr/mpfr-src/src/amd/amdfam10/mparam.h @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2015 Free Software Foundation, Inc. +Copyright 2005-2016 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/amd/athlon/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/amd/athlon/mparam.h index 38236c4ab24..39ef0992a55 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/amd/athlon/mparam.h +++ b/Build/source/libs/mpfr/mpfr-src/src/amd/athlon/mparam.h @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2015 Free Software Foundation, Inc. +Copyright 2005-2016 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/amd/k8/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/amd/k8/mparam.h index 1f818869c0d..bd54b7f95d1 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/amd/k8/mparam.h +++ b/Build/source/libs/mpfr/mpfr-src/src/amd/k8/mparam.h @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2015 Free Software Foundation, Inc. +Copyright 2005-2016 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/arm/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/arm/mparam.h index 7b73c9a7d12..592ef1895c0 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/arm/mparam.h +++ b/Build/source/libs/mpfr/mpfr-src/src/arm/mparam.h @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2015 Free Software Foundation, Inc. +Copyright 2005-2016 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/asin.c b/Build/source/libs/mpfr/mpfr-src/src/asin.c index 6aae6812dec..9556d2000ec 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/asin.c +++ b/Build/source/libs/mpfr/mpfr-src/src/asin.c @@ -1,7 +1,7 @@ /* mpfr_asin -- arc-sinus of a floating-point number -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/asinh.c b/Build/source/libs/mpfr/mpfr-src/src/asinh.c index 276aa27d719..f3274bc7a82 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/asinh.c +++ b/Build/source/libs/mpfr/mpfr-src/src/asinh.c @@ -1,7 +1,7 @@ /* mpfr_asinh -- inverse hyperbolic sine -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/atan.c b/Build/source/libs/mpfr/mpfr-src/src/atan.c index 5fb1c8a4673..cd1875c6d1e 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/atan.c +++ b/Build/source/libs/mpfr/mpfr-src/src/atan.c @@ -1,7 +1,7 @@ /* mpfr_atan -- arc-tangent of a floating-point number -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/atan2.c b/Build/source/libs/mpfr/mpfr-src/src/atan2.c index 9b7b4c3315a..02b5654ab69 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/atan2.c +++ b/Build/source/libs/mpfr/mpfr-src/src/atan2.c @@ -1,7 +1,7 @@ /* mpfr_atan2 -- arc-tan 2 of a floating-point number -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/atanh.c b/Build/source/libs/mpfr/mpfr-src/src/atanh.c index 4c440bdae63..0ad46ecac0a 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/atanh.c +++ b/Build/source/libs/mpfr/mpfr-src/src/atanh.c @@ -1,7 +1,7 @@ /* mpfr_atanh -- Inverse Hyperbolic Tangente -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/bernoulli.c b/Build/source/libs/mpfr/mpfr-src/src/bernoulli.c index 0bacbb00bf3..b175a65a472 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/bernoulli.c +++ b/Build/source/libs/mpfr/mpfr-src/src/bernoulli.c @@ -1,7 +1,7 @@ /* bernoulli -- internal function to compute Bernoulli numbers. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/buildopt.c b/Build/source/libs/mpfr/mpfr-src/src/buildopt.c index c44b97a3d36..d25c61e9ff2 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/buildopt.c +++ b/Build/source/libs/mpfr/mpfr-src/src/buildopt.c @@ -1,8 +1,8 @@ /* buildopt.c -- functions giving information about options used during the mpfr library compilation -Copyright 2009-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2009-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/cache.c b/Build/source/libs/mpfr/mpfr-src/src/cache.c index 1ddddf3b86f..1324ccec20c 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/cache.c +++ b/Build/source/libs/mpfr/mpfr-src/src/cache.c @@ -1,7 +1,7 @@ /* mpfr_cache -- cache interface for multiple-precision constants in MPFR. -Copyright 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/cbrt.c b/Build/source/libs/mpfr/mpfr-src/src/cbrt.c index d6858bc92fa..6a72ba1961f 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/cbrt.c +++ b/Build/source/libs/mpfr/mpfr-src/src/cbrt.c @@ -1,7 +1,7 @@ /* mpfr_cbrt -- cube root function. -Copyright 2002-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2002-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/check.c b/Build/source/libs/mpfr/mpfr-src/src/check.c index 10ab789a6e5..3dec303d064 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/check.c +++ b/Build/source/libs/mpfr/mpfr-src/src/check.c @@ -1,7 +1,7 @@ /* mpfr_check -- Check if a floating-point number has not been corrupted. -Copyright 2003-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/clear.c b/Build/source/libs/mpfr/mpfr-src/src/clear.c index 65282effbea..3b3d4671e3f 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/clear.c +++ b/Build/source/libs/mpfr/mpfr-src/src/clear.c @@ -1,7 +1,7 @@ /* mpfr_clear -- free the memory space allocated for a floating-point number -Copyright 1999-2001, 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2001, 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/clears.c b/Build/source/libs/mpfr/mpfr-src/src/clears.c index dfa830b4d28..d608f573844 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/clears.c +++ b/Build/source/libs/mpfr/mpfr-src/src/clears.c @@ -1,8 +1,8 @@ /* mpfr_clears -- free the memory space allocated for several floating-point numbers -Copyright 2003-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/cmp.c b/Build/source/libs/mpfr/mpfr-src/src/cmp.c index 237313ccab8..e123453c50f 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/cmp.c +++ b/Build/source/libs/mpfr/mpfr-src/src/cmp.c @@ -1,7 +1,7 @@ /* mpfr_cmp -- compare two floating-point numbers -Copyright 1999, 2001, 2003-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001, 2003-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/cmp2.c b/Build/source/libs/mpfr/mpfr-src/src/cmp2.c index 917247c0e21..79a5a37c49d 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/cmp2.c +++ b/Build/source/libs/mpfr/mpfr-src/src/cmp2.c @@ -1,7 +1,7 @@ /* mpfr_cmp2 -- exponent shift when subtracting two numbers. -Copyright 1999-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/cmp_abs.c b/Build/source/libs/mpfr/mpfr-src/src/cmp_abs.c index 62ce27ff1d1..0c9d2707598 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/cmp_abs.c +++ b/Build/source/libs/mpfr/mpfr-src/src/cmp_abs.c @@ -1,7 +1,7 @@ /* mpfr_cmpabs -- compare the absolute values of two FP numbers -Copyright 1999, 2001-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/cmp_d.c b/Build/source/libs/mpfr/mpfr-src/src/cmp_d.c index 70d687a4bd1..8fd45e9bb8e 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/cmp_d.c +++ b/Build/source/libs/mpfr/mpfr-src/src/cmp_d.c @@ -1,7 +1,7 @@ /* mpfr_cmp_d -- compare a floating-point number with a double -Copyright 2003-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -27,12 +27,19 @@ mpfr_cmp_d (mpfr_srcptr b, double d) { mpfr_t tmp; int res; + MPFR_SAVE_EXPO_DECL (expo); + + MPFR_SAVE_EXPO_MARK (expo); mpfr_init2 (tmp, IEEE_DBL_MANT_DIG); res = mpfr_set_d (tmp, d, MPFR_RNDN); MPFR_ASSERTD (res == 0); + + mpfr_clear_flags (); res = mpfr_cmp (b, tmp); - mpfr_clear (tmp); + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); + mpfr_clear (tmp); + MPFR_SAVE_EXPO_FREE (expo); return res; } diff --git a/Build/source/libs/mpfr/mpfr-src/src/cmp_ld.c b/Build/source/libs/mpfr/mpfr-src/src/cmp_ld.c index 4e9ec0b3bae..d0a65889159 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/cmp_ld.c +++ b/Build/source/libs/mpfr/mpfr-src/src/cmp_ld.c @@ -1,7 +1,7 @@ /* mpfr_cmp_d -- compare a floating-point number with a long double -Copyright 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -27,12 +27,19 @@ mpfr_cmp_ld (mpfr_srcptr b, long double d) { mpfr_t tmp; int res; + MPFR_SAVE_EXPO_DECL (expo); + + MPFR_SAVE_EXPO_MARK (expo); mpfr_init2 (tmp, MPFR_LDBL_MANT_DIG); res = mpfr_set_ld (tmp, d, MPFR_RNDN); MPFR_ASSERTD (res == 0); + + mpfr_clear_flags (); res = mpfr_cmp (b, tmp); - mpfr_clear (tmp); + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); + mpfr_clear (tmp); + MPFR_SAVE_EXPO_FREE (expo); return res; } diff --git a/Build/source/libs/mpfr/mpfr-src/src/cmp_si.c b/Build/source/libs/mpfr/mpfr-src/src/cmp_si.c index 1bd8e7b5a2a..86b93665d6d 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/cmp_si.c +++ b/Build/source/libs/mpfr/mpfr-src/src/cmp_si.c @@ -1,8 +1,8 @@ /* mpfr_cmp_si_2exp -- compare a floating-point number with a signed machine integer multiplied by a power of 2 -Copyright 1999, 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/cmp_ui.c b/Build/source/libs/mpfr/mpfr-src/src/cmp_ui.c index e42b43e35a4..a186207c5cb 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/cmp_ui.c +++ b/Build/source/libs/mpfr/mpfr-src/src/cmp_ui.c @@ -1,8 +1,8 @@ /* 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-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/comparisons.c b/Build/source/libs/mpfr/mpfr-src/src/comparisons.c index ca7fa90f460..3c06b879bd7 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/comparisons.c +++ b/Build/source/libs/mpfr/mpfr-src/src/comparisons.c @@ -1,7 +1,7 @@ /* comparison predicates -Copyright 2002-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2002-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/const_catalan.c b/Build/source/libs/mpfr/mpfr-src/src/const_catalan.c index 0e4402d7643..41b6bd97d64 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/const_catalan.c +++ b/Build/source/libs/mpfr/mpfr-src/src/const_catalan.c @@ -1,7 +1,7 @@ /* mpfr_const_catalan -- compute Catalan's constant. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -26,6 +26,14 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., /* 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 + /* Set User Interface */ #undef mpfr_const_catalan int diff --git a/Build/source/libs/mpfr/mpfr-src/src/const_euler.c b/Build/source/libs/mpfr/mpfr-src/src/const_euler.c index 802561fbed4..e00dda53de6 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/const_euler.c +++ b/Build/source/libs/mpfr/mpfr-src/src/const_euler.c @@ -1,7 +1,7 @@ /* mpfr_const_euler -- Euler's constant -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -26,6 +26,14 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., /* 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 + /* Set User Interface */ #undef mpfr_const_euler int diff --git a/Build/source/libs/mpfr/mpfr-src/src/const_log2.c b/Build/source/libs/mpfr/mpfr-src/src/const_log2.c index 7c634e9d7cf..8496d2d58a3 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/const_log2.c +++ b/Build/source/libs/mpfr/mpfr-src/src/const_log2.c @@ -1,7 +1,7 @@ /* mpfr_const_log2 -- compute natural logarithm of 2 -Copyright 1999, 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -29,7 +29,17 @@ 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_cache_ptr MPFR_THREAD_ATTR __gmpfr_cache_const_log2 = __gmpfr_normal_log2; +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 #endif /* Set User interface */ diff --git a/Build/source/libs/mpfr/mpfr-src/src/const_pi.c b/Build/source/libs/mpfr/mpfr-src/src/const_pi.c index 0306d432aff..7c555c9eef3 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/const_pi.c +++ b/Build/source/libs/mpfr/mpfr-src/src/const_pi.c @@ -1,7 +1,7 @@ /* mpfr_const_pi -- compute Pi -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -28,7 +28,17 @@ 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_cache_ptr MPFR_THREAD_ATTR __gmpfr_cache_const_pi = __gmpfr_normal_pi; +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 #endif /* Set User Interface */ diff --git a/Build/source/libs/mpfr/mpfr-src/src/constant.c b/Build/source/libs/mpfr/mpfr-src/src/constant.c index 158496c2e4b..7ff8c04dafa 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/constant.c +++ b/Build/source/libs/mpfr/mpfr-src/src/constant.c @@ -1,7 +1,7 @@ /* MPFR internal constant FP numbers -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/copysign.c b/Build/source/libs/mpfr/mpfr-src/src/copysign.c index 96c18137531..010675ca4e1 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/copysign.c +++ b/Build/source/libs/mpfr/mpfr-src/src/copysign.c @@ -1,7 +1,7 @@ /* mpfr_copysign -- Produce a value with the magnitude of x and sign bit of y -Copyright 2001-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/cos.c b/Build/source/libs/mpfr/mpfr-src/src/cos.c index c9eac10a2cb..b2b864345bc 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/cos.c +++ b/Build/source/libs/mpfr/mpfr-src/src/cos.c @@ -1,7 +1,7 @@ /* mpfr_cos -- cosine of a floating-point number -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/cosh.c b/Build/source/libs/mpfr/mpfr-src/src/cosh.c index c07773474da..3d3ede4ebc7 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/cosh.c +++ b/Build/source/libs/mpfr/mpfr-src/src/cosh.c @@ -1,7 +1,7 @@ /* mpfr_cosh -- hyperbolic cosine -Copyright 2001-2002, 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2002, 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/cot.c b/Build/source/libs/mpfr/mpfr-src/src/cot.c index 8959966f2ac..44744f71a7d 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/cot.c +++ b/Build/source/libs/mpfr/mpfr-src/src/cot.c @@ -1,7 +1,7 @@ /* mpfr_cot - cotangent function. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/coth.c b/Build/source/libs/mpfr/mpfr-src/src/coth.c index 94aadfebd05..94f664418d9 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/coth.c +++ b/Build/source/libs/mpfr/mpfr-src/src/coth.c @@ -1,7 +1,7 @@ /* mpfr_coth - Hyperbolic cotangent function. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/csc.c b/Build/source/libs/mpfr/mpfr-src/src/csc.c index 41703d46f13..d1cd63a329c 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/csc.c +++ b/Build/source/libs/mpfr/mpfr-src/src/csc.c @@ -1,7 +1,7 @@ /* mpfr_csc - cosecant function. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/csch.c b/Build/source/libs/mpfr/mpfr-src/src/csch.c index ab25a6764f1..dc46654e5b7 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/csch.c +++ b/Build/source/libs/mpfr/mpfr-src/src/csch.c @@ -1,7 +1,7 @@ /* mpfr_csch - Hyperbolic cosecant function. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/d_div.c b/Build/source/libs/mpfr/mpfr-src/src/d_div.c index cad7f102b38..c7f4d62c532 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/d_div.c +++ b/Build/source/libs/mpfr/mpfr-src/src/d_div.c @@ -1,8 +1,8 @@ /* mpfr_d_div -- divide a machine double precision float by a multiple precision floating-point number -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/d_sub.c b/Build/source/libs/mpfr/mpfr-src/src/d_sub.c index c8b8ff59a13..bad6cf4970c 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/d_sub.c +++ b/Build/source/libs/mpfr/mpfr-src/src/d_sub.c @@ -1,8 +1,8 @@ /* mpfr_d_sub -- subtract a multiple precision floating-point number from a machine double precision float -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/digamma.c b/Build/source/libs/mpfr/mpfr-src/src/digamma.c index 1c4e7df4606..99110e9331b 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/digamma.c +++ b/Build/source/libs/mpfr/mpfr-src/src/digamma.c @@ -1,7 +1,7 @@ /* mpfr_digamma -- digamma function of a floating-point number -Copyright 2009-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2009-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/dim.c b/Build/source/libs/mpfr/mpfr-src/src/dim.c index 8a25cbbbbf4..3212f10d5bf 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/dim.c +++ b/Build/source/libs/mpfr/mpfr-src/src/dim.c @@ -1,7 +1,7 @@ /* mpfr_dim -- positive difference -Copyright 2001-2002, 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/div.c b/Build/source/libs/mpfr/mpfr-src/src/div.c index 8b3aabe9ebb..5d7f2bd49b0 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/div.c +++ b/Build/source/libs/mpfr/mpfr-src/src/div.c @@ -1,7 +1,7 @@ /* mpfr_div -- divide two floating-point numbers -Copyright 1999, 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -310,24 +310,23 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mpfr_rnd_t rnd_mode) qp = MPFR_TMP_LIMBS_ALLOC (n); qh = mpfr_divhigh_n (qp, ap, bp, n); + MPFR_ASSERTD (qh == 0 || qh == 1); /* in all cases, the error is at most (2n+2) ulps on qh*B^n+{qp,n}, cf algorithms.tex */ p = n * GMP_NUMB_BITS - MPFR_INT_CEIL_LOG2 (2 * n + 2); - /* if qh is 1, then we need only PREC(q)-1 bits of {qp,n}, - if rnd=RNDN, we need to be able to round with a directed rounding - and one more bit */ + /* If rnd=RNDN, we need to be able to round with a directed rounding + and one more bit. */ + if (qh == 1) + { + mpn_rshift (qp, qp, n, 1); + qp[n - 1] |= MPFR_LIMB_HIGHBIT; + } if (MPFR_LIKELY (mpfr_round_p (qp, n, p, - MPFR_PREC(q) + (rnd_mode == MPFR_RNDN) - qh))) + MPFR_PREC(q) + (rnd_mode == MPFR_RNDN)))) { /* we can round correctly whatever the rounding mode */ - if (qh == 0) - MPN_COPY (q0p, qp + 1, q0size); - else - { - mpn_rshift (q0p, qp + 1, q0size, 1); - q0p[q0size - 1] ^= MPFR_LIMB_HIGHBIT; - } + MPN_COPY (q0p, qp + 1, q0size); q0p[0] &= ~MPFR_LIMB_MASK(sh); /* put to zero low sh bits */ if (rnd_mode == MPFR_RNDN) /* round to nearest */ @@ -335,15 +334,10 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mpfr_rnd_t rnd_mode) /* we know we can round, thus we are never in the even rule case: if the round bit is 0, we truncate if the round bit is 1, we add 1 */ - if (qh == 0) - { - if (sh > 0) - round_bit = (qp[1] >> (sh - 1)) & 1; - else - round_bit = qp[0] >> (GMP_NUMB_BITS - 1); - } - else /* qh = 1 */ - round_bit = (qp[1] >> sh) & 1; + if (sh > 0) + round_bit = (qp[1] >> (sh - 1)) & 1; + else + round_bit = qp[0] >> (GMP_NUMB_BITS - 1); if (round_bit == 0) { inex = -1; diff --git a/Build/source/libs/mpfr/mpfr-src/src/div_2exp.c b/Build/source/libs/mpfr/mpfr-src/src/div_2exp.c index 909e798883e..d28e84576f5 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/div_2exp.c +++ b/Build/source/libs/mpfr/mpfr-src/src/div_2exp.c @@ -1,7 +1,7 @@ /* mpfr_div_2exp -- divide a floating-point number by a power of two -Copyright 1999, 2001, 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001, 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/div_2si.c b/Build/source/libs/mpfr/mpfr-src/src/div_2si.c index c7da6a05849..b3c877543ab 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/div_2si.c +++ b/Build/source/libs/mpfr/mpfr-src/src/div_2si.c @@ -1,7 +1,7 @@ /* mpfr_div_2si -- divide a floating-point number by a power of two -Copyright 1999, 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -45,11 +45,12 @@ mpfr_div_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd_mode) if (rnd_mode == MPFR_RNDN && (__gmpfr_emin > MPFR_EMAX_MAX - (n - 1) || exp < __gmpfr_emin + (n - 1) || - (inexact >= 0 && mpfr_powerof2_raw (y)))) + ((MPFR_IS_NEG (y) ? inexact <= 0 : inexact >= 0) && + mpfr_powerof2_raw (y)))) rnd_mode = MPFR_RNDZ; return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y)); } - else if (MPFR_UNLIKELY(n < 0 && (__gmpfr_emax < MPFR_EMIN_MIN - n || + else if (MPFR_UNLIKELY(n <= 0 && (__gmpfr_emax < MPFR_EMIN_MIN - n || exp > __gmpfr_emax + n)) ) return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y)); diff --git a/Build/source/libs/mpfr/mpfr-src/src/div_2ui.c b/Build/source/libs/mpfr/mpfr-src/src/div_2ui.c index 12df43bb760..71ce188c8d7 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/div_2ui.c +++ b/Build/source/libs/mpfr/mpfr-src/src/div_2ui.c @@ -1,7 +1,7 @@ /* mpfr_div_2ui -- divide a floating-point number by a power of two -Copyright 1999, 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -32,7 +32,7 @@ mpfr_div_2ui (mpfr_ptr y, mpfr_srcptr x, unsigned long n, mpfr_rnd_t rnd_mode) rnd_mode), ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inexact)); - if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) + if (MPFR_UNLIKELY (n == 0 || MPFR_IS_SINGULAR (x))) return mpfr_set (y, x, rnd_mode); else { @@ -44,7 +44,9 @@ mpfr_div_2ui (mpfr_ptr y, mpfr_srcptr x, unsigned long n, mpfr_rnd_t rnd_mode) if (MPFR_UNLIKELY (n >= diffexp)) /* exp - n <= emin - 1 */ { if (rnd_mode == MPFR_RNDN && - (n > diffexp || (inexact >= 0 && mpfr_powerof2_raw (y)))) + (n > diffexp || + ((MPFR_IS_NEG (y) ? inexact <= 0 : inexact >= 0) && + mpfr_powerof2_raw (y)))) rnd_mode = MPFR_RNDZ; return mpfr_underflow (y, rnd_mode, MPFR_SIGN (y)); } diff --git a/Build/source/libs/mpfr/mpfr-src/src/div_d.c b/Build/source/libs/mpfr/mpfr-src/src/div_d.c index 4ee009e038b..4d299fd9938 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/div_d.c +++ b/Build/source/libs/mpfr/mpfr-src/src/div_d.c @@ -1,8 +1,8 @@ /* mpfr_div_d -- divide a multiple precision floating-point number by a machine double precision float -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/div_ui.c b/Build/source/libs/mpfr/mpfr-src/src/div_ui.c index 322a1351388..35764f29f4c 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/div_ui.c +++ b/Build/source/libs/mpfr/mpfr-src/src/div_ui.c @@ -1,7 +1,7 @@ /* mpfr_div_{ui,si} -- divide a floating-point number by a machine integer -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -274,7 +274,8 @@ mpfr_div_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode) res = mpfr_div_ui (y, x, u, rnd_mode); else { - res = -mpfr_div_ui (y, x, -u, MPFR_INVERT_RND (rnd_mode)); + res = - mpfr_div_ui (y, x, - (unsigned long) u, + MPFR_INVERT_RND (rnd_mode)); MPFR_CHANGE_SIGN (y); } return res; diff --git a/Build/source/libs/mpfr/mpfr-src/src/dump.c b/Build/source/libs/mpfr/mpfr-src/src/dump.c index fb00f79b2bf..7b3c256e33a 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/dump.c +++ b/Build/source/libs/mpfr/mpfr-src/src/dump.c @@ -1,7 +1,7 @@ /* mpfr_dump -- Dump a float to stdout. -Copyright 1999, 2001, 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001, 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/eint.c b/Build/source/libs/mpfr/mpfr-src/src/eint.c index aaff14a83c0..a5dde78ebbb 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/eint.c +++ b/Build/source/libs/mpfr/mpfr-src/src/eint.c @@ -1,7 +1,7 @@ /* mpfr_eint, mpfr_eint1 -- the exponential integral -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -206,7 +206,7 @@ mpfr_eint (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) { - /* exp(NaN) = exp(-Inf) = NaN */ + /* eint(NaN) = eint(-Inf) = NaN */ if (MPFR_IS_NAN (x) || (MPFR_IS_INF (x) && MPFR_IS_NEG(x))) { MPFR_SET_NAN (y); diff --git a/Build/source/libs/mpfr/mpfr-src/src/eq.c b/Build/source/libs/mpfr/mpfr-src/src/eq.c index c58110ca639..f97431bc6f1 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/eq.c +++ b/Build/source/libs/mpfr/mpfr-src/src/eq.c @@ -1,7 +1,7 @@ /* mpfr_eq -- Compare two floats up to a specified bit #. -Copyright 1999, 2001, 2003-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001, 2003-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/erf.c b/Build/source/libs/mpfr/mpfr-src/src/erf.c index 227eba71ec3..7bf7025098e 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/erf.c +++ b/Build/source/libs/mpfr/mpfr-src/src/erf.c @@ -1,7 +1,7 @@ /* mpfr_erf -- error function of a floating-point number -Copyright 2001, 2003-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001, 2003-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/erfc.c b/Build/source/libs/mpfr/mpfr-src/src/erfc.c index 1f0b36d3b36..c65646cc47f 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/erfc.c +++ b/Build/source/libs/mpfr/mpfr-src/src/erfc.c @@ -1,7 +1,7 @@ /* mpfr_erfc -- The Complementary Error Function of a floating-point number -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/exceptions.c b/Build/source/libs/mpfr/mpfr-src/src/exceptions.c index dacca4eaa1b..ad8beb2c464 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/exceptions.c +++ b/Build/source/libs/mpfr/mpfr-src/src/exceptions.c @@ -1,7 +1,7 @@ /* Exception flags and utilities. -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -22,10 +22,16 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-impl.h" -unsigned int MPFR_THREAD_ATTR __gmpfr_flags = 0; +MPFR_THREAD_ATTR unsigned int __gmpfr_flags = 0; -mpfr_exp_t MPFR_THREAD_ATTR __gmpfr_emin = MPFR_EMIN_DEFAULT; -mpfr_exp_t MPFR_THREAD_ATTR __gmpfr_emax = MPFR_EMAX_DEFAULT; +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 #undef mpfr_get_emin diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp.c b/Build/source/libs/mpfr/mpfr-src/src/exp.c index 2a4f3414d09..225b6774324 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/exp.c +++ b/Build/source/libs/mpfr/mpfr-src/src/exp.c @@ -1,7 +1,7 @@ /* mpfr_exp -- exponential of a floating-point number -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp10.c b/Build/source/libs/mpfr/mpfr-src/src/exp10.c index 49b9bc8a0ee..e68d8aab40e 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/exp10.c +++ b/Build/source/libs/mpfr/mpfr-src/src/exp10.c @@ -1,7 +1,7 @@ /* mpfr_exp10 -- power of 10 function 10^y -Copyright 2003-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp2.c b/Build/source/libs/mpfr/mpfr-src/src/exp2.c index 56eba78ba98..21c057cbe7e 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/exp2.c +++ b/Build/source/libs/mpfr/mpfr-src/src/exp2.c @@ -1,7 +1,7 @@ /* mpfr_exp2 -- power of 2 function 2^y -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp3.c b/Build/source/libs/mpfr/mpfr-src/src/exp3.c index 2cd201197f9..47482923326 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/exp3.c +++ b/Build/source/libs/mpfr/mpfr-src/src/exp3.c @@ -1,7 +1,7 @@ /* mpfr_exp -- exponential of a floating-point number -Copyright 1999, 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -175,7 +175,7 @@ mpfr_exp_3 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) /* decompose x */ /* we first write x = 1.xxxxxxxxxxxxx - ----- k bits -- */ + ----- k bits -- */ prec_x = MPFR_INT_CEIL_LOG2 (MPFR_PREC (x)) - MPFR_LOG2_GMP_NUMB_BITS; if (prec_x < 0) prec_x = 0; diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp_2.c b/Build/source/libs/mpfr/mpfr-src/src/exp_2.c index bd181bea622..d6bf4d6347a 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/exp_2.c +++ b/Build/source/libs/mpfr/mpfr-src/src/exp_2.c @@ -1,8 +1,8 @@ /* 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-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/expm1.c b/Build/source/libs/mpfr/mpfr-src/src/expm1.c index fab05be47f1..004ce4d5d51 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/expm1.c +++ b/Build/source/libs/mpfr/mpfr-src/src/expm1.c @@ -1,7 +1,7 @@ /* mpfr_expm1 -- Compute exp(x)-1 -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/extract.c b/Build/source/libs/mpfr/mpfr-src/src/extract.c index c3bb0190276..3eb7b946a32 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/extract.c +++ b/Build/source/libs/mpfr/mpfr-src/src/extract.c @@ -1,7 +1,7 @@ /* mpfr_extract -- bit-extraction function for the binary splitting algorithm -Copyright 2000-2002, 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2002, 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/factorial.c b/Build/source/libs/mpfr/mpfr-src/src/factorial.c index aa9a126d4e5..4f467d75cd2 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/factorial.c +++ b/Build/source/libs/mpfr/mpfr-src/src/factorial.c @@ -1,7 +1,7 @@ /* mpfr_fac_ui -- factorial of a non-negative integer -Copyright 2001, 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001, 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_intmax.c b/Build/source/libs/mpfr/mpfr-src/src/fits_intmax.c index c3d072a228d..b3ad9f18276 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/fits_intmax.c +++ b/Build/source/libs/mpfr/mpfr-src/src/fits_intmax.c @@ -1,7 +1,7 @@ /* mpfr_fits_intmax_p -- test whether an mpfr fits an intmax_t. -Copyright 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -33,6 +33,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., int mpfr_fits_intmax_p (mpfr_srcptr f, mpfr_rnd_t rnd) { + unsigned int saved_flags; mpfr_exp_t e; int prec; mpfr_t x, y; @@ -85,6 +86,7 @@ mpfr_fits_intmax_p (mpfr_srcptr f, mpfr_rnd_t rnd) MPFR_ASSERTD (e == prec); /* hard case: first round to prec bits, then check */ + saved_flags = __gmpfr_flags; mpfr_init2 (x, prec); mpfr_set (x, f, rnd); @@ -97,10 +99,16 @@ mpfr_fits_intmax_p (mpfr_srcptr f, mpfr_rnd_t rnd) } else { - res = MPFR_GET_EXP (x) == e; + /* 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 + that the number does not fit. That's why we use MPFR_EXP, not + MPFR_GET_EXP. */ + res = MPFR_EXP (x) == e; } mpfr_clear (x); + __gmpfr_flags = saved_flags; return res; } diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_s.h b/Build/source/libs/mpfr/mpfr-src/src/fits_s.h index 0dd77fb45a2..8e667bc0c41 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/fits_s.h +++ b/Build/source/libs/mpfr/mpfr-src/src/fits_s.h @@ -1,7 +1,7 @@ /* mpfr_fits_*_p -- test whether an mpfr fits a C signed type. -Copyright 2003-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -29,6 +29,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., int FUNCTION (mpfr_srcptr f, mpfr_rnd_t rnd) { + unsigned int saved_flags; mpfr_exp_t e; int prec; mpfr_t x; @@ -81,9 +82,16 @@ FUNCTION (mpfr_srcptr f, mpfr_rnd_t rnd) MPFR_ASSERTD (e == prec); /* hard case: first round to prec bits, then check */ + saved_flags = __gmpfr_flags; mpfr_init2 (x, prec); mpfr_set (x, f, rnd); - res = neg ? (mpfr_cmp_si (x, MINIMUM) >= 0) : (MPFR_GET_EXP (x) == e); + /* 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 + that the number does not fit. That's why we use MPFR_EXP, not + MPFR_GET_EXP. */ + res = neg ? (mpfr_cmp_si (x, MINIMUM) >= 0) : (MPFR_EXP (x) == e); mpfr_clear (x); + __gmpfr_flags = saved_flags; return res; } diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_sint.c b/Build/source/libs/mpfr/mpfr-src/src/fits_sint.c index 5c32fd3046a..5ab11409bff 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/fits_sint.c +++ b/Build/source/libs/mpfr/mpfr-src/src/fits_sint.c @@ -1,7 +1,7 @@ /* mpfr_fits_sint_p -- test whether an mpfr fits an int. -Copyright 2003, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_slong.c b/Build/source/libs/mpfr/mpfr-src/src/fits_slong.c index 2f51700206e..3ff287486a4 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/fits_slong.c +++ b/Build/source/libs/mpfr/mpfr-src/src/fits_slong.c @@ -1,7 +1,7 @@ /* mpfr_fits_slong_p -- test whether an mpfr fits a long. -Copyright 2003, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_sshort.c b/Build/source/libs/mpfr/mpfr-src/src/fits_sshort.c index d7cdd0b6acf..d9099800f02 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/fits_sshort.c +++ b/Build/source/libs/mpfr/mpfr-src/src/fits_sshort.c @@ -1,7 +1,7 @@ /* mpfr_fits_sshort_p -- test whether an mpfr fits a short. -Copyright 2003, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_u.h b/Build/source/libs/mpfr/mpfr-src/src/fits_u.h index ed837a29bc9..9f97c30c6aa 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/fits_u.h +++ b/Build/source/libs/mpfr/mpfr-src/src/fits_u.h @@ -1,7 +1,7 @@ /* mpfr_fits_*_p -- test whether an mpfr fits a C unsigned type. -Copyright 2003-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -25,6 +25,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., int FUNCTION (mpfr_srcptr f, mpfr_rnd_t rnd) { + unsigned int saved_flags; mpfr_exp_t e; int prec; TYPE s; @@ -62,9 +63,16 @@ FUNCTION (mpfr_srcptr f, mpfr_rnd_t rnd) MPFR_ASSERTD (e == prec); /* hard case: first round to prec bits, then check */ + saved_flags = __gmpfr_flags; mpfr_init2 (x, prec); mpfr_set (x, f, rnd); - res = MPFR_GET_EXP (x) == e; + /* 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 + that the number does not fit. That's why we use MPFR_EXP, not + MPFR_GET_EXP. */ + res = MPFR_EXP (x) == e; mpfr_clear (x); + __gmpfr_flags = saved_flags; return res; } diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_uint.c b/Build/source/libs/mpfr/mpfr-src/src/fits_uint.c index d62f9d21c75..96e2cc5abbc 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/fits_uint.c +++ b/Build/source/libs/mpfr/mpfr-src/src/fits_uint.c @@ -1,7 +1,7 @@ /* mpfr_fits_uint_p -- test whether an mpfr fits an unsigned int. -Copyright 2003, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_uintmax.c b/Build/source/libs/mpfr/mpfr-src/src/fits_uintmax.c index fc51d91c5e1..a206287cce3 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/fits_uintmax.c +++ b/Build/source/libs/mpfr/mpfr-src/src/fits_uintmax.c @@ -1,7 +1,7 @@ /* mpfr_fits_uintmax_p -- test whether an mpfr fits an uintmax_t. -Copyright 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_ulong.c b/Build/source/libs/mpfr/mpfr-src/src/fits_ulong.c index bbd2a3a1e8b..8e2c105199d 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/fits_ulong.c +++ b/Build/source/libs/mpfr/mpfr-src/src/fits_ulong.c @@ -1,7 +1,7 @@ /* mpfr_fits_ulong_p -- test whether an mpfr fits an unsigned long. -Copyright 2003, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_ushort.c b/Build/source/libs/mpfr/mpfr-src/src/fits_ushort.c index d4b389d630f..63bfbc0ecd1 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/fits_ushort.c +++ b/Build/source/libs/mpfr/mpfr-src/src/fits_ushort.c @@ -1,7 +1,7 @@ /* mpfr_fits_ushort_p -- test whether an mpfr fits an unsigned short. -Copyright 2003, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/fma.c b/Build/source/libs/mpfr/mpfr-src/src/fma.c index 8acb617f7d5..da81a567a7a 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/fma.c +++ b/Build/source/libs/mpfr/mpfr-src/src/fma.c @@ -1,7 +1,7 @@ /* mpfr_fma -- Floating multiply-add -Copyright 2001-2002, 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/fms.c b/Build/source/libs/mpfr/mpfr-src/src/fms.c index fe17e5b201b..868b4d66180 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/fms.c +++ b/Build/source/libs/mpfr/mpfr-src/src/fms.c @@ -1,7 +1,7 @@ /* mpfr_fms -- Floating multiply-subtract -Copyright 2001-2002, 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/frac.c b/Build/source/libs/mpfr/mpfr-src/src/frac.c index 5b26c2c2713..0bb38b23606 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/frac.c +++ b/Build/source/libs/mpfr/mpfr-src/src/frac.c @@ -1,7 +1,7 @@ /* mpfr_frac -- Fractional part of a floating-point number. -Copyright 2002-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2002-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/free_cache.c b/Build/source/libs/mpfr/mpfr-src/src/free_cache.c index 928936ade46..d65784f2825 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/free_cache.c +++ b/Build/source/libs/mpfr/mpfr-src/src/free_cache.c @@ -1,7 +1,7 @@ /* mpfr_free_cache - Free the cache used by MPFR for internal consts. -Copyright 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/frexp.c b/Build/source/libs/mpfr/mpfr-src/src/frexp.c index 0f8de7ed5e3..c5bcf0f442c 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/frexp.c +++ b/Build/source/libs/mpfr/mpfr-src/src/frexp.c @@ -1,7 +1,7 @@ /* mpfr_frexp -- convert to integral and fractional parts -Copyright 2011-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2011-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -26,6 +26,13 @@ int 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_BLOCK_DECL (flags); + + MPFR_LOG_FUNC + (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd), + ("y[%Pu]=%.*Rg exp=%" MPFR_EXP_FSPEC "d inex=%d", mpfr_get_prec (y), + mpfr_log_prec, y, (mpfr_eexp_t) *exp, inex)); if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x))) { @@ -49,8 +56,32 @@ mpfr_frexp (mpfr_exp_t *exp, mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) } } - inex = mpfr_set (y, x, rnd); + MPFR_BLOCK (flags, inex = mpfr_set (y, x, rnd)); + __gmpfr_flags = saved_flags; + + /* Possible overflow due to the rounding, no possible underflow. */ + + if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags))) + { + int inex2; + + /* An overflow here means that the exponent of y would be larger than + the one of x, thus x would be rounded to the next power of 2, and + the returned y should be 1/2 in absolute value, rounded (i.e. with + possible underflow or overflow). This also implies that x and y are + different objects, so that the exponent of x has not been lost. */ + MPFR_LOG_MSG (("Internal overflow\n", 0)); + MPFR_ASSERTD (x != y); + *exp = MPFR_GET_EXP (x) + 1; + inex2 = mpfr_set_si_2exp (y, MPFR_INT_SIGN (x), -1, rnd); + MPFR_LOG_MSG (("inex=%d inex2=%d\n", inex, inex2)); + if (inex2 != 0) + inex = inex2; + MPFR_RET (inex); + } + *exp = MPFR_GET_EXP (y); - MPFR_SET_EXP (y, 0); + /* Do not use MPFR_SET_EXP because the range has not been checked yet. */ + MPFR_EXP (y) = 0; return mpfr_check_range (y, inex, rnd); } diff --git a/Build/source/libs/mpfr/mpfr-src/src/gamma.c b/Build/source/libs/mpfr/mpfr-src/src/gamma.c index d19a5b7212a..eefd3dd50cf 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/gamma.c +++ b/Build/source/libs/mpfr/mpfr-src/src/gamma.c @@ -1,7 +1,7 @@ /* mpfr_gamma -- gamma function -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -70,6 +70,9 @@ bits_fac (unsigned long n) { mpfr_t x, y; unsigned long r, k; + MPFR_SAVE_EXPO_DECL (expo); + + MPFR_SAVE_EXPO_MARK (expo); mpfr_init2 (x, 38); mpfr_init2 (y, 38); mpfr_set_ui (x, n, MPFR_RNDZ); @@ -86,6 +89,8 @@ bits_fac (unsigned long n) r -= n / k; mpfr_clear (x); mpfr_clear (y); + MPFR_SAVE_EXPO_FREE (expo); + return r; } diff --git a/Build/source/libs/mpfr/mpfr-src/src/gammaonethird.c b/Build/source/libs/mpfr/mpfr-src/src/gammaonethird.c index 255e3fbbedc..f7a21fe1cc4 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/gammaonethird.c +++ b/Build/source/libs/mpfr/mpfr-src/src/gammaonethird.c @@ -1,7 +1,7 @@ /* Functions for evaluating Gamma(1/3) and Gamma(2/3). Used by mpfr_ai. -Copyright 2010-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2010-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/gen_inverse.h b/Build/source/libs/mpfr/mpfr-src/src/gen_inverse.h index 643cdb06350..c0715d1da8b 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/gen_inverse.h +++ b/Build/source/libs/mpfr/mpfr-src/src/gen_inverse.h @@ -1,7 +1,7 @@ /* generic inverse of a function. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/generic/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/generic/mparam.h index b850e6508f5..20cde126f51 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/generic/mparam.h +++ b/Build/source/libs/mpfr/mpfr-src/src/generic/mparam.h @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2015 Free Software Foundation, Inc. +Copyright 2005-2016 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_d.c b/Build/source/libs/mpfr/mpfr-src/src/get_d.c index e4098264a1e..aa5751e8ae0 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/get_d.c +++ b/Build/source/libs/mpfr/mpfr-src/src/get_d.c @@ -1,8 +1,8 @@ /* mpfr_get_d, mpfr_get_d_2exp -- convert a multiple precision floating-point number to a machine double precision float -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_d64.c b/Build/source/libs/mpfr/mpfr-src/src/get_d64.c index 16c9c936e56..84dd130ad57 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/get_d64.c +++ b/Build/source/libs/mpfr/mpfr-src/src/get_d64.c @@ -5,8 +5,8 @@ See http://gcc.gnu.org/ml/gcc/2006-06/msg00691.html, http://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html, and TR 24732 <http://www.open-std.org/jtc1/sc22/wg14/www/projects#24732>. -Copyright 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_exp.c b/Build/source/libs/mpfr/mpfr-src/src/get_exp.c index 9e177687bb0..99ae1184a73 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/get_exp.c +++ b/Build/source/libs/mpfr/mpfr-src/src/get_exp.c @@ -1,7 +1,7 @@ /* mpfr_get_exp - get the exponent of a floating-point number -Copyright 2002-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2002-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_f.c b/Build/source/libs/mpfr/mpfr-src/src/get_f.c index f129845b965..de94ddafbb6 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/get_f.c +++ b/Build/source/libs/mpfr/mpfr-src/src/get_f.c @@ -1,7 +1,7 @@ /* mpfr_get_f -- convert a MPFR number to a GNU MPF number -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_flt.c b/Build/source/libs/mpfr/mpfr-src/src/get_flt.c index 0fb66c32d0c..07b71206d86 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/get_flt.c +++ b/Build/source/libs/mpfr/mpfr-src/src/get_flt.c @@ -1,7 +1,7 @@ /* mpfr_get_flt -- convert a mpfr_t to a machine single precision float -Copyright 2009-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2009-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -49,6 +49,9 @@ mpfr_get_flt (mpfr_srcptr src, mpfr_rnd_t rnd_mode) if (MPFR_UNLIKELY(rnd_mode == MPFR_RNDA)) rnd_mode = negative ? MPFR_RNDD : MPFR_RNDU; + /* FIXME: The code below assumes the IEEE-754 binary32 format + with subnormal support. */ + /* 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) */ if (MPFR_UNLIKELY (e < -148)) diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_ld.c b/Build/source/libs/mpfr/mpfr-src/src/get_ld.c index b24f9b94ba6..1c1efedbc4d 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/get_ld.c +++ b/Build/source/libs/mpfr/mpfr-src/src/get_ld.c @@ -1,8 +1,8 @@ /* mpfr_get_ld, mpfr_get_ld_2exp -- convert a multiple precision floating-point number to a machine long double -Copyright 2002-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2002-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_patches.c b/Build/source/libs/mpfr/mpfr-src/src/get_patches.c index d5d93b4ebb6..da1e49ebc46 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/get_patches.c +++ b/Build/source/libs/mpfr/mpfr-src/src/get_patches.c @@ -1,7 +1,7 @@ /* mpfr_get_patches -- Patches that have been applied -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_si.c b/Build/source/libs/mpfr/mpfr-src/src/get_si.c index ea3fb164f70..ef8ce3966dd 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/get_si.c +++ b/Build/source/libs/mpfr/mpfr-src/src/get_si.c @@ -1,7 +1,7 @@ /* mpfr_get_si -- convert a floating-point number to a signed long. -Copyright 2003-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_sj.c b/Build/source/libs/mpfr/mpfr-src/src/get_sj.c index 49de8a00650..9bd68a181c8 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/get_sj.c +++ b/Build/source/libs/mpfr/mpfr-src/src/get_sj.c @@ -1,7 +1,7 @@ /* mpfr_get_sj -- convert a MPFR number to a huge machine signed integer -Copyright 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_str.c b/Build/source/libs/mpfr/mpfr-src/src/get_str.c index 137aaa4f79d..0b284062224 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/get_str.c +++ b/Build/source/libs/mpfr/mpfr-src/src/get_str.c @@ -1,7 +1,7 @@ /* mpfr_get_str -- output a floating-point number to a string -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_ui.c b/Build/source/libs/mpfr/mpfr-src/src/get_ui.c index 374d35dd1eb..0bf5b5e3f3b 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/get_ui.c +++ b/Build/source/libs/mpfr/mpfr-src/src/get_ui.c @@ -1,7 +1,7 @@ /* mpfr_get_ui -- convert a floating-point number to an unsigned long. -Copyright 2003-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_uj.c b/Build/source/libs/mpfr/mpfr-src/src/get_uj.c index eb79e5d4030..b7ea2d97726 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/get_uj.c +++ b/Build/source/libs/mpfr/mpfr-src/src/get_uj.c @@ -1,7 +1,7 @@ /* mpfr_get_uj -- convert a MPFR number to a huge machine unsigned integer -Copyright 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_z.c b/Build/source/libs/mpfr/mpfr-src/src/get_z.c index aebbfa33ed7..e323255137c 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/get_z.c +++ b/Build/source/libs/mpfr/mpfr-src/src/get_z.c @@ -1,8 +1,8 @@ /* mpfr_get_z -- get a multiple-precision integer from a floating-point number -Copyright 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_z_exp.c b/Build/source/libs/mpfr/mpfr-src/src/get_z_exp.c index 1431b013ef9..bc8eb0be505 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/get_z_exp.c +++ b/Build/source/libs/mpfr/mpfr-src/src/get_z_exp.c @@ -1,8 +1,8 @@ /* mpfr_get_z_2exp -- get a multiple-precision integer and an exponent from a floating-point number -Copyright 2000-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/gmp_op.c b/Build/source/libs/mpfr/mpfr-src/src/gmp_op.c index af2f8eeec3a..9418fa0984e 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/gmp_op.c +++ b/Build/source/libs/mpfr/mpfr-src/src/gmp_op.c @@ -1,7 +1,7 @@ /* Implementations of operations between mpfr and mpz/mpq data -Copyright 2001, 2003-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001, 2003-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/grandom.c b/Build/source/libs/mpfr/mpfr-src/src/grandom.c index 21e71ca7c5a..5d07ae9afd4 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/grandom.c +++ b/Build/source/libs/mpfr/mpfr-src/src/grandom.c @@ -3,8 +3,8 @@ distribution and round it to the precision of rop1, rop2 according to the given rounding mode. -Copyright 2011-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2011-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/hppa/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/hppa/mparam.h index fdde759046f..1d785616914 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/hppa/mparam.h +++ b/Build/source/libs/mpfr/mpfr-src/src/hppa/mparam.h @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2015 Free Software Foundation, Inc. +Copyright 2005-2016 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/hypot.c b/Build/source/libs/mpfr/mpfr-src/src/hypot.c index ea744ea74f8..da38906505d 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/hypot.c +++ b/Build/source/libs/mpfr/mpfr-src/src/hypot.c @@ -1,7 +1,7 @@ /* mpfr_hypot -- Euclidean distance -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/ia64/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/ia64/mparam.h index 4297632dbb8..e7649bb2938 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/ia64/mparam.h +++ b/Build/source/libs/mpfr/mpfr-src/src/ia64/mparam.h @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2015 Free Software Foundation, Inc. +Copyright 2005-2016 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/ieee_floats.h b/Build/source/libs/mpfr/mpfr-src/src/ieee_floats.h index 0cb44926ada..91ca5b92a8a 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/ieee_floats.h +++ b/Build/source/libs/mpfr/mpfr-src/src/ieee_floats.h @@ -1,7 +1,7 @@ /* auxiliary data to generate special IEEE floats (NaN, +Inf, -Inf) -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/init.c b/Build/source/libs/mpfr/mpfr-src/src/init.c index 23fa0f30d3e..e2aa53ffc3f 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/init.c +++ b/Build/source/libs/mpfr/mpfr-src/src/init.c @@ -1,7 +1,7 @@ /* mpfr_init -- initialize a floating-point number -Copyright 1999, 2001-2002, 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/init2.c b/Build/source/libs/mpfr/mpfr-src/src/init2.c index 0fb7dc76ae3..9e720f748fa 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/init2.c +++ b/Build/source/libs/mpfr/mpfr-src/src/init2.c @@ -1,7 +1,7 @@ /* mpfr_init2 -- initialize a floating-point number with given precision -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/inits.c b/Build/source/libs/mpfr/mpfr-src/src/inits.c index 8b761b842d9..888f788f2a3 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/inits.c +++ b/Build/source/libs/mpfr/mpfr-src/src/inits.c @@ -1,7 +1,7 @@ /* mpfr_inits -- initialize several floating-point numbers -Copyright 2003-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/inits2.c b/Build/source/libs/mpfr/mpfr-src/src/inits2.c index 9e5af2b84d5..4791139d3ec 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/inits2.c +++ b/Build/source/libs/mpfr/mpfr-src/src/inits2.c @@ -1,8 +1,8 @@ /* mpfr_inits2 -- initialize several floating-point numbers with given precision -Copyright 2003-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/inp_str.c b/Build/source/libs/mpfr/mpfr-src/src/inp_str.c index c46276f0722..b155b149e34 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/inp_str.c +++ b/Build/source/libs/mpfr/mpfr-src/src/inp_str.c @@ -1,8 +1,8 @@ /* 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-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/int_ceil_log2.c b/Build/source/libs/mpfr/mpfr-src/src/int_ceil_log2.c index 13610570c0c..a6595a6c713 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/int_ceil_log2.c +++ b/Build/source/libs/mpfr/mpfr-src/src/int_ceil_log2.c @@ -1,7 +1,7 @@ /* __gmpfr_int_ceil_log2 -- Integer ceil of log2(x) -Copyright 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/isinf.c b/Build/source/libs/mpfr/mpfr-src/src/isinf.c index ee588e9c98f..264a8ea1ac1 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/isinf.c +++ b/Build/source/libs/mpfr/mpfr-src/src/isinf.c @@ -1,7 +1,7 @@ /* mpfr_inf_p -- check for infinities -Copyright 2000-2001, 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2001, 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/isinteger.c b/Build/source/libs/mpfr/mpfr-src/src/isinteger.c index 335babff4a8..6ec39a47328 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/isinteger.c +++ b/Build/source/libs/mpfr/mpfr-src/src/isinteger.c @@ -1,7 +1,7 @@ /* mpfr_integer_p -- test if a mpfr variable is integer. -Copyright 2001-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/isnan.c b/Build/source/libs/mpfr/mpfr-src/src/isnan.c index e125ff9a1dc..36e8ad7a8b6 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/isnan.c +++ b/Build/source/libs/mpfr/mpfr-src/src/isnan.c @@ -1,7 +1,7 @@ /* mpfr_nan_p -- check for NaN -Copyright 2000-2001, 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2001, 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/isnum.c b/Build/source/libs/mpfr/mpfr-src/src/isnum.c index 35ba820f22f..e3bf2813ff7 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/isnum.c +++ b/Build/source/libs/mpfr/mpfr-src/src/isnum.c @@ -1,7 +1,7 @@ /* mpfr_number_p -- check for ordinary numbers -Copyright 2000-2002, 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/isqrt.c b/Build/source/libs/mpfr/mpfr-src/src/isqrt.c index 86910e8a538..56228df7cf1 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/isqrt.c +++ b/Build/source/libs/mpfr/mpfr-src/src/isqrt.c @@ -1,7 +1,7 @@ /* __gmpfr_isqrt && __gmpfr_cuberoot -- Integer square root and cube root -Copyright 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/isregular.c b/Build/source/libs/mpfr/mpfr-src/src/isregular.c index d45a7c32531..1b5c5519bba 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/isregular.c +++ b/Build/source/libs/mpfr/mpfr-src/src/isregular.c @@ -1,7 +1,7 @@ /* mpfr_regular_p -- check for regular number (neither NaN, Inf or zero) -Copyright 2009-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2009-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/iszero.c b/Build/source/libs/mpfr/mpfr-src/src/iszero.c index 2e9f3b5be56..45c6d470c86 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/iszero.c +++ b/Build/source/libs/mpfr/mpfr-src/src/iszero.c @@ -1,7 +1,7 @@ /* mpfr_zero_p -- check for zero -Copyright 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/jn.c b/Build/source/libs/mpfr/mpfr-src/src/jn.c index 40eecf7bb1f..182f1e04678 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/jn.c +++ b/Build/source/libs/mpfr/mpfr-src/src/jn.c @@ -1,8 +1,8 @@ /* mpfr_j0, mpfr_j1, mpfr_jn -- Bessel functions of 1st kind, integer order. http://www.opengroup.org/onlinepubs/009695399/functions/j0.html -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/jyn_asympt.c b/Build/source/libs/mpfr/mpfr-src/src/jyn_asympt.c index b630c9bf2b7..fe0f3b9b354 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/jyn_asympt.c +++ b/Build/source/libs/mpfr/mpfr-src/src/jyn_asympt.c @@ -1,7 +1,7 @@ /* mpfr_jn_asympt, mpfr_yn_asympt -- shared code for mpfr_jn and mpfr_yn -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -253,9 +253,9 @@ FUNCTION (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r) break; if (diverge != 0) { - mpfr_set (c, z, r); /* will force inex=0 below, which means the - asymptotic expansion failed */ - break; + MPFR_ZIV_FREE (loop); + mpfr_clear (c); + return 0; /* means that the asymptotic expansion failed */ } MPFR_ZIV_NEXT (loop, w); } diff --git a/Build/source/libs/mpfr/mpfr-src/src/li2.c b/Build/source/libs/mpfr/mpfr-src/src/li2.c index 9d9940e34bd..357ee4c9b50 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/li2.c +++ b/Build/source/libs/mpfr/mpfr-src/src/li2.c @@ -1,7 +1,7 @@ /* mpfr_li2 -- Dilogarithm. -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/lngamma.c b/Build/source/libs/mpfr/mpfr-src/src/lngamma.c index cd43df61551..de98b171b00 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/lngamma.c +++ b/Build/source/libs/mpfr/mpfr-src/src/lngamma.c @@ -1,7 +1,7 @@ /* mpfr_lngamma -- lngamma function -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -603,16 +603,17 @@ mpfr_lngamma (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) mpfr_get_prec (y), mpfr_log_prec, y, inex)); /* special cases */ - if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x) || + (MPFR_IS_NEG (x) && mpfr_integer_p (x)))) { - if (MPFR_IS_NAN (x) || MPFR_IS_NEG (x)) + if (MPFR_IS_NAN (x)) { MPFR_SET_NAN (y); MPFR_RET_NAN; } - else /* lngamma(+Inf) = lngamma(+0) = +Inf */ + else /* lngamma(+/-Inf) = lngamma(nonpositive integer) = +Inf */ { - if (MPFR_IS_ZERO (x)) + if (!MPFR_IS_INF (x)) mpfr_set_divby0 (); MPFR_SET_INF (y); MPFR_SET_POS (y); @@ -620,8 +621,8 @@ mpfr_lngamma (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) } } - /* if x < 0 and -2k-1 <= x <= -2k, then lngamma(x) = NaN */ - if (MPFR_IS_NEG (x) && (unit_bit (x) == 0 || mpfr_integer_p (x))) + /* if -2k-1 < x < -2k <= 0, then lngamma(x) = NaN */ + if (MPFR_IS_NEG (x) && unit_bit (x) == 0) { MPFR_SET_NAN (y); MPFR_RET_NAN; diff --git a/Build/source/libs/mpfr/mpfr-src/src/log.c b/Build/source/libs/mpfr/mpfr-src/src/log.c index d751a689fbc..2cb1e646cc6 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/log.c +++ b/Build/source/libs/mpfr/mpfr-src/src/log.c @@ -1,7 +1,7 @@ /* mpfr_log -- natural logarithm of a floating-point number -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/log10.c b/Build/source/libs/mpfr/mpfr-src/src/log10.c index d358d9ce6f9..5700af4c862 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/log10.c +++ b/Build/source/libs/mpfr/mpfr-src/src/log10.c @@ -1,7 +1,7 @@ /* mpfr_log10 -- logarithm in base 10. -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/log1p.c b/Build/source/libs/mpfr/mpfr-src/src/log1p.c index 6ef0e866ca8..53720fe2014 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/log1p.c +++ b/Build/source/libs/mpfr/mpfr-src/src/log1p.c @@ -1,7 +1,7 @@ /* mpfr_log1p -- Compute log(1+x) -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/log2.c b/Build/source/libs/mpfr/mpfr-src/src/log2.c index 4aca0f55753..6d755e027a3 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/log2.c +++ b/Build/source/libs/mpfr/mpfr-src/src/log2.c @@ -1,7 +1,7 @@ /* mpfr_log2 -- log base 2 -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/logging.c b/Build/source/libs/mpfr/mpfr-src/src/logging.c index dc42f9830c6..963fac705a5 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/logging.c +++ b/Build/source/libs/mpfr/mpfr-src/src/logging.c @@ -1,7 +1,7 @@ /* MPFR Logging functions. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/min_prec.c b/Build/source/libs/mpfr/mpfr-src/src/min_prec.c index c5e22755961..f2705d6fcf9 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/min_prec.c +++ b/Build/source/libs/mpfr/mpfr-src/src/min_prec.c @@ -1,7 +1,7 @@ /* mpfr_min_prec -- minimal size in bits to hold the mantissa -Copyright 2009-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2009-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/minmax.c b/Build/source/libs/mpfr/mpfr-src/src/minmax.c index c9dee653f63..46964927487 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/minmax.c +++ b/Build/source/libs/mpfr/mpfr-src/src/minmax.c @@ -1,7 +1,7 @@ /* mpfr_min -- min and max of x, y -Copyright 2001, 2003-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001, 2003-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/modf.c b/Build/source/libs/mpfr/mpfr-src/src/modf.c index e74ce168c61..36b017a7fb9 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/modf.c +++ b/Build/source/libs/mpfr/mpfr-src/src/modf.c @@ -1,7 +1,7 @@ /* mpfr_modf -- Integral and fractional part. -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/mp_clz_tab.c b/Build/source/libs/mpfr/mpfr-src/src/mp_clz_tab.c index b63373880c7..fdaa432db05 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mp_clz_tab.c +++ b/Build/source/libs/mpfr/mpfr-src/src/mp_clz_tab.c @@ -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-2015 Free Software Foundation, Inc. +Copyright 1991, 1993-1994, 1996-1997, 2000-2001, 2004, 2006-2016 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. It has been copied and adapted from the GNU MP Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/mparam_h.in b/Build/source/libs/mpfr/mpfr-src/src/mparam_h.in index bd6c91c6201..03b5454b24b 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mparam_h.in +++ b/Build/source/libs/mpfr/mpfr-src/src/mparam_h.in @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2015 Free Software Foundation, Inc. +Copyright 2005-2016 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpf2mpfr.h b/Build/source/libs/mpfr/mpfr-src/src/mpf2mpfr.h index 03f6afbf890..e0db8103a8b 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mpf2mpfr.h +++ b/Build/source/libs/mpfr/mpfr-src/src/mpf2mpfr.h @@ -1,7 +1,7 @@ /* mpf2mpfr.h -- Compatibility include file with mpf. -Copyright 1999-2002, 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2002, 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.c b/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.c index 893b2e495ad..d2d53ff8ad0 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.c +++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.c @@ -1,8 +1,8 @@ /* mpfr_gmp -- Limited gmp-impl emulator Modified version of the GMP files. -Copyright 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.h index b1862ffe717..445b35338e9 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.h +++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.h @@ -1,7 +1,7 @@ /* Interface to replace gmp-impl.h -Copyright 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -158,7 +158,7 @@ __MPFR_DECLSPEC void mpfr_assert_fail _MPFR_PROTO((const char *, int, #define ASSERT_FAIL(expr) mpfr_assert_fail (__FILE__, __LINE__, #expr) #define ASSERT(expr) MPFR_ASSERTD(expr) -/* Access fileds of GMP struct */ +/* Access fields of GMP struct */ #define SIZ(x) ((x)->_mp_size) #define ABSIZ(x) ABS (SIZ (x)) #define PTR(x) ((x)->_mp_d) diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h index 5ce52ac21d1..cce39c3824f 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h +++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h @@ -1,7 +1,7 @@ /* Utilities for MPFR developers, not exported. -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -234,6 +234,10 @@ typedef __gmp_const mp_limb_t *mpfr_limb_srcptr; ************* Global Internal Variables ************** ******************************************************/ +#if defined (__cplusplus) +extern "C" { +#endif + /* Cache struct */ struct __gmpfr_cache_s { mpfr_t x; @@ -243,32 +247,86 @@ struct __gmpfr_cache_s { typedef struct __gmpfr_cache_s mpfr_cache_t[1]; typedef struct __gmpfr_cache_s *mpfr_cache_ptr; -#if defined (__cplusplus) -extern "C" { +#if __GMP_LIBGMP_DLL +# define MPFR_WIN_THREAD_SAFE_DLL 1 #endif -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR unsigned int __gmpfr_flags; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_exp_t __gmpfr_emin; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_exp_t __gmpfr_emax; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_prec_t __gmpfr_default_fp_bit_precision; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_rnd_t __gmpfr_default_rounding_mode; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_euler; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_catalan; +/* 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 -#ifndef MPFR_USE_LOGGING -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_pi; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_log2; -#else +#if defined(__MPFR_WITHIN_MPFR) || !defined(MPFR_WIN_THREAD_SAFE_DLL) +extern MPFR_THREAD_ATTR unsigned int __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; +# 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; +# 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. */ -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_normal_pi; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_normal_log2; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_logging_pi; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_logging_log2; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_ptr __gmpfr_cache_const_pi; -__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_ptr __gmpfr_cache_const_log2; +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; +# 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(); +# ifndef MPFR_USE_LOGGING +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_cache_const_pi_f(); +__MPFR_DECLSPEC mpfr_cache_t * __gmpfr_cache_const_log2_f(); +# 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(); +# endif +# ifndef __MPFR_WITHIN_MPFR +# define __gmpfr_flags (*__gmpfr_flags_f()) +# define __gmpfr_emin (*__gmpfr_emin_f()) +# define __gmpfr_emax (*__gmpfr_emax_f()) +# define __gmpfr_default_fp_bit_precision (*__gmpfr_default_fp_bit_precision_f()) +# define __gmpfr_default_rounding_mode (*__gmpfr_default_rounding_mode_f()) +# define __gmpfr_cache_const_euler (*__gmpfr_cache_const_euler_f()) +# define __gmpfr_cache_const_catalan (*__gmpfr_cache_const_catalan_f()) +# ifndef MPFR_USE_LOGGING +# define __gmpfr_cache_const_pi (*__gmpfr_cache_const_pi_f()) +# define __gmpfr_cache_const_log2 (*__gmpfr_cache_const_log2_f()) +# else +# define __gmpfr_normal_pi (*__gmpfr_normal_pi_f()) +# define __gmpfr_logging_pi (*__gmpfr_logging_pi_f()) +# define __gmpfr_logging_log2 (*__gmpfr_logging_log2_f()) +# define __gmpfr_cache_const_pi (*__gmpfr_cache_const_pi_f()) +# define __gmpfr_cache_const_log2 (*__gmpfr_cache_const_log2_f()) +# endif +# endif #endif #define BASE_MAX 62 @@ -864,7 +922,7 @@ typedef intmax_t mpfr_eexp_t; #define MPFR_IS_LIKE_RNDD(rnd, sign) \ ((rnd==MPFR_RNDD) || (rnd==MPFR_RNDZ && sign>0) || (rnd==MPFR_RNDA && sign<0)) -/* Invert a rounding mode, RNDZ and RNDA are unchanged */ +/* 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)) @@ -994,7 +1052,7 @@ extern unsigned char *mpfr_stack; #define mpfr_const_catalan(_d,_r) mpfr_cache(_d,__gmpfr_cache_const_catalan,_r) #define MPFR_DECL_INIT_CACHE(_cache,_func) \ - mpfr_cache_t MPFR_THREAD_ATTR _cache = \ + MPFR_THREAD_ATTR mpfr_cache_t _cache = \ {{{{0,MPFR_SIGN_POS,0,(mp_limb_t*)0}},0,_func}} @@ -1875,7 +1933,8 @@ __MPFR_DECLSPEC int mpfr_round_raw_4 _MPFR_PROTO ((mp_limb_t *, __MPFR_DECLSPEC int mpfr_check _MPFR_PROTO ((mpfr_srcptr)); __MPFR_DECLSPEC int mpfr_sum_sort _MPFR_PROTO ((mpfr_srcptr *const, - unsigned long, mpfr_srcptr *)); + unsigned long, mpfr_srcptr *, + mpfr_prec_t *)); __MPFR_DECLSPEC int mpfr_get_cputime _MPFR_PROTO ((void)); diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-intmax.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr-intmax.h index 7a9b802d26d..3a7afc0fa75 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-intmax.h +++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-intmax.h @@ -1,7 +1,7 @@ /* MPFR internal header related to intmax_t. -Copyright 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-longlong.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr-longlong.h index 30aa7470bb6..1ba6d675bb4 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-longlong.h +++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-longlong.h @@ -1,7 +1,7 @@ /* 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-2015 Free Software Foundation, Inc. +2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012, 2013-2016 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 diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-thread.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr-thread.h index 4c77d3f515b..1ccaa17c30a 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-thread.h +++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-thread.h @@ -1,7 +1,7 @@ /* MPFR internal header related to thread-local variables. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -31,12 +31,9 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #ifndef MPFR_THREAD_ATTR # ifdef MPFR_USE_THREAD_SAFE # if defined(_MSC_VER) -# if defined(_WINDLL) -# error "Can't build MPFR DLL as thread safe." -# define MPFR_THREAD_ATTR -# else -# define MPFR_THREAD_ATTR __declspec( thread ) -# endif +# define MPFR_THREAD_ATTR __declspec( thread ) +# elif defined(MPFR_USE_C11_THREAD_SAFE) +# define MPFR_THREAD_ATTR _Thread_local # else # define MPFR_THREAD_ATTR __thread # endif diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr.h index 7473dfd79d6..e6105c94796 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mpfr.h +++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr.h @@ -1,7 +1,7 @@ /* mpfr.h -- Include file for mpfr. -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -26,8 +26,8 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., /* Define MPFR version number */ #define MPFR_VERSION_MAJOR 3 #define MPFR_VERSION_MINOR 1 -#define MPFR_VERSION_PATCHLEVEL 3 -#define MPFR_VERSION_STRING "3.1.3" +#define MPFR_VERSION_PATCHLEVEL 4 +#define MPFR_VERSION_STRING "3.1.4" /* Macros dealing with MPFR VERSION */ #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpn_exp.c b/Build/source/libs/mpfr/mpfr-src/src/mpn_exp.c index a1d38667f5b..5fac37e721f 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mpn_exp.c +++ b/Build/source/libs/mpfr/mpfr-src/src/mpn_exp.c @@ -1,7 +1,7 @@ /* mpfr_mpn_exp -- auxiliary function for mpfr_get_str and mpfr_set_str -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/mul.c b/Build/source/libs/mpfr/mpfr-src/src/mul.c index a67f774df86..67c974ffef3 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mul.c +++ b/Build/source/libs/mpfr/mpfr-src/src/mul.c @@ -1,7 +1,7 @@ /* mpfr_mul -- multiply two floating-point numbers -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/mul_2exp.c b/Build/source/libs/mpfr/mpfr-src/src/mul_2exp.c index 0e816801c53..dac89f1fe6a 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mul_2exp.c +++ b/Build/source/libs/mpfr/mpfr-src/src/mul_2exp.c @@ -1,7 +1,7 @@ /* mpfr_mul_2exp -- multiply a floating-point number by a power of two -Copyright 1999, 2001, 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001, 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/mul_2si.c b/Build/source/libs/mpfr/mpfr-src/src/mul_2si.c index b9293e2a1f3..04fdee403f6 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mul_2si.c +++ b/Build/source/libs/mpfr/mpfr-src/src/mul_2si.c @@ -1,7 +1,7 @@ /* mpfr_mul_2si -- multiply a floating-point number by a power of two -Copyright 1999, 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -39,7 +39,7 @@ mpfr_mul_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd_mode) { mpfr_exp_t exp = MPFR_GET_EXP (x); MPFR_SETRAW (inexact, y, x, exp, rnd_mode); - if (MPFR_UNLIKELY( n > 0 && (__gmpfr_emax < MPFR_EMIN_MIN + n || + if (MPFR_UNLIKELY(n >= 0 && (__gmpfr_emax < MPFR_EMIN_MIN + n || exp > __gmpfr_emax - n))) return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y)); else if (MPFR_UNLIKELY(n < 0 && (__gmpfr_emin > MPFR_EMAX_MAX + n || @@ -48,7 +48,8 @@ mpfr_mul_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd_mode) if (rnd_mode == MPFR_RNDN && (__gmpfr_emin > MPFR_EMAX_MAX + (n + 1) || exp < __gmpfr_emin - (n + 1) || - (inexact >= 0 && mpfr_powerof2_raw (y)))) + ((MPFR_IS_NEG (y) ? inexact <= 0 : inexact >= 0) && + mpfr_powerof2_raw (y)))) rnd_mode = MPFR_RNDZ; return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y)); } diff --git a/Build/source/libs/mpfr/mpfr-src/src/mul_2ui.c b/Build/source/libs/mpfr/mpfr-src/src/mul_2ui.c index cf7966c8238..8c9959abe37 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mul_2ui.c +++ b/Build/source/libs/mpfr/mpfr-src/src/mul_2ui.c @@ -1,7 +1,7 @@ /* mpfr_mul_2ui -- multiply a floating-point number by a power of two -Copyright 1999, 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/mul_d.c b/Build/source/libs/mpfr/mpfr-src/src/mul_d.c index 102f71f6e7d..ff2514ad7ba 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mul_d.c +++ b/Build/source/libs/mpfr/mpfr-src/src/mul_d.c @@ -1,8 +1,8 @@ /* mpfr_mul_d -- multiply a multiple precision floating-point number by a machine double precision float -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/mul_ui.c b/Build/source/libs/mpfr/mpfr-src/src/mul_ui.c index 9b762d4f7da..bd144761962 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mul_ui.c +++ b/Build/source/libs/mpfr/mpfr-src/src/mul_ui.c @@ -1,8 +1,8 @@ /* 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-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -126,7 +126,8 @@ int mpfr_mul_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode) res = mpfr_mul_ui (y, x, u, rnd_mode); else { - res = -mpfr_mul_ui (y, x, -u, MPFR_INVERT_RND (rnd_mode)); + res = - mpfr_mul_ui (y, x, - (unsigned long) u, + MPFR_INVERT_RND (rnd_mode)); MPFR_CHANGE_SIGN (y); } return res; diff --git a/Build/source/libs/mpfr/mpfr-src/src/mulders.c b/Build/source/libs/mpfr/mpfr-src/src/mulders.c index 8f23d21b678..a988db84bcb 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mulders.c +++ b/Build/source/libs/mpfr/mpfr-src/src/mulders.c @@ -1,7 +1,7 @@ /* Mulders' MulHigh function (short product) -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -236,9 +236,10 @@ mpfr_divhigh_n_basecase (mpfr_limb_ptr qp, mpfr_limb_ptr np, that in addition to the limb np[n-1] to reduce, we have at least 2 extra limbs, thus accessing np[n-3] is valid. */ - /* warning: we can have np[n-1]=d1 and np[n-2]=d0, but since {np,n} < D, - the largest possible partial quotient is B-1 */ - if (MPFR_UNLIKELY(np[n - 1] == d1 && np[n - 2] == d0)) + /* Warning: we can have np[n-1]>d1 or (np[n-1]=d1 and np[n-2]>=d0) here, + 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; else udiv_qr_3by2 (q2, q1, q0, np[n - 1], np[n - 2], np[n - 3], diff --git a/Build/source/libs/mpfr/mpfr-src/src/neg.c b/Build/source/libs/mpfr/mpfr-src/src/neg.c index 030d4c79abc..b9f5c702cb3 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/neg.c +++ b/Build/source/libs/mpfr/mpfr-src/src/neg.c @@ -1,7 +1,7 @@ /* mpfr_neg -- change the sign of a floating-point number -Copyright 1999-2001, 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2001, 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/next.c b/Build/source/libs/mpfr/mpfr-src/src/next.c index f03d3885919..c49c32928ee 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/next.c +++ b/Build/source/libs/mpfr/mpfr-src/src/next.c @@ -1,8 +1,8 @@ /* mpfr_nextabove, mpfr_nextbelow, mpfr_nexttoward -- next representable floating-point number -Copyright 1999, 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/out_str.c b/Build/source/libs/mpfr/mpfr-src/src/out_str.c index 046eb79f21b..88707571e44 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/out_str.c +++ b/Build/source/libs/mpfr/mpfr-src/src/out_str.c @@ -1,7 +1,7 @@ /* mpfr_out_str -- output a floating-point number to a stream -Copyright 1999, 2001-2002, 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/pow.c b/Build/source/libs/mpfr/mpfr-src/src/pow.c index 33bf5442ad1..62a3f018382 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/pow.c +++ b/Build/source/libs/mpfr/mpfr-src/src/pow.c @@ -1,7 +1,7 @@ /* mpfr_pow -- power function x^y -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/pow_si.c b/Build/source/libs/mpfr/mpfr-src/src/pow_si.c index 9ab6f82f810..3ea5cc56d9f 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/pow_si.c +++ b/Build/source/libs/mpfr/mpfr-src/src/pow_si.c @@ -1,7 +1,7 @@ /* mpfr_pow_si -- power function x^y with y a signed int -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/pow_ui.c b/Build/source/libs/mpfr/mpfr-src/src/pow_ui.c index 75e104ae408..061b54cbb7b 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/pow_ui.c +++ b/Build/source/libs/mpfr/mpfr-src/src/pow_ui.c @@ -1,8 +1,8 @@ /* mpfr_pow_ui-- compute the power of a floating-point by a machine integer -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/pow_z.c b/Build/source/libs/mpfr/mpfr-src/src/pow_z.c index a8913281c87..c2b0c79d39e 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/pow_z.c +++ b/Build/source/libs/mpfr/mpfr-src/src/pow_z.c @@ -1,7 +1,7 @@ /* mpfr_pow_z -- power function x^z with z a MPZ -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/powerof2.c b/Build/source/libs/mpfr/mpfr-src/src/powerof2.c index bacbcdcf6e4..f10ace0ad03 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/powerof2.c +++ b/Build/source/libs/mpfr/mpfr-src/src/powerof2.c @@ -1,7 +1,7 @@ /* mpfr_powerof2_raw -- test whether a floating-point number is a power of 2 -Copyright 2002-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2002-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/powerpc32/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/powerpc32/mparam.h index 687586afdb0..6b5816b495d 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/powerpc32/mparam.h +++ b/Build/source/libs/mpfr/mpfr-src/src/powerpc32/mparam.h @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2015 Free Software Foundation, Inc. +Copyright 2005-2016 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/powerpc64/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/powerpc64/mparam.h index 1e852a52e2d..79b87ceddce 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/powerpc64/mparam.h +++ b/Build/source/libs/mpfr/mpfr-src/src/powerpc64/mparam.h @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2015 Free Software Foundation, Inc. +Copyright 2005-2016 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/print_raw.c b/Build/source/libs/mpfr/mpfr-src/src/print_raw.c index 7c91ec0727c..80992c56798 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/print_raw.c +++ b/Build/source/libs/mpfr/mpfr-src/src/print_raw.c @@ -1,8 +1,8 @@ /* mpfr_print_binary -- print the internal binary representation of a floating-point number -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/print_rnd_mode.c b/Build/source/libs/mpfr/mpfr-src/src/print_rnd_mode.c index fa90f4823f1..f863bbcff07 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/print_rnd_mode.c +++ b/Build/source/libs/mpfr/mpfr-src/src/print_rnd_mode.c @@ -1,7 +1,7 @@ /* mpfr_print_rnd_mode -- convert a given rounding mode to a string -Copyright 1999, 2001-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/printf.c b/Build/source/libs/mpfr/mpfr-src/src/printf.c index adf90bbe375..72fb40e8a85 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/printf.c +++ b/Build/source/libs/mpfr/mpfr-src/src/printf.c @@ -1,7 +1,7 @@ /* mpfr_printf -- printf function and friends. -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/rec_sqrt.c b/Build/source/libs/mpfr/mpfr-src/src/rec_sqrt.c index aa7814f02cf..2be95302182 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/rec_sqrt.c +++ b/Build/source/libs/mpfr/mpfr-src/src/rec_sqrt.c @@ -1,7 +1,7 @@ /* mpfr_rec_sqrt -- inverse square root -Copyright 2008-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2008-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/reldiff.c b/Build/source/libs/mpfr/mpfr-src/src/reldiff.c index 058e39da604..eac12cb8284 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/reldiff.c +++ b/Build/source/libs/mpfr/mpfr-src/src/reldiff.c @@ -1,7 +1,7 @@ /* mpfr_reldiff -- compute relative difference of two floating-point numbers. -Copyright 2000-2001, 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2001, 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/rem1.c b/Build/source/libs/mpfr/mpfr-src/src/rem1.c index a977a0924c3..1299396e32b 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/rem1.c +++ b/Build/source/libs/mpfr/mpfr-src/src/rem1.c @@ -2,8 +2,8 @@ mpfr_fmod -- compute the floating-point remainder of x/y mpfr_remquo and mpfr_remainder -- argument reduction functions -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -59,6 +59,7 @@ mpfr_rem1 (mpfr_ptr rem, long *quo, mpfr_rnd_t rnd_q, mpfr_exp_t ex, ey; int compare, inex, q_is_odd, sign, signx = MPFR_SIGN (x); mpz_t mx, my, r; + int tiny = 0; MPFR_ASSERTD (rnd_q == MPFR_RNDN || rnd_q == MPFR_RNDZ); @@ -109,13 +110,27 @@ mpfr_rem1 (mpfr_ptr rem, long *quo, mpfr_rnd_t rnd_q, if (ex <= ey) { /* q = x/y = mx/(my*2^(ey-ex)) */ - mpz_mul_2exp (my, my, ey - ex); /* divide mx by my*2^(ey-ex) */ - if (rnd_q == MPFR_RNDZ) - /* 0 <= |r| <= |my|, r has the same sign as mx */ - mpz_tdiv_qr (mx, r, mx, my); + + /* First detect cases where q=0, to avoid creating a huge number + my*2^(ey-ex): if sx = mpz_sizeinbase (mx, 2) and sy = + mpz_sizeinbase (my, 2), we have x < 2^(ex + sx) and + y >= 2^(ey + sy - 1), thus if ex + sx <= ey + sy - 1 + the quotient is 0 */ + if (ex + (mpfr_exp_t) mpz_sizeinbase (mx, 2) < + ey + (mpfr_exp_t) mpz_sizeinbase (my, 2)) + { + tiny = 1; + mpz_set (r, mx); + mpz_set_ui (mx, 0); + } else - /* 0 <= |r| <= |my|, r has the same sign as my */ - mpz_fdiv_qr (mx, r, mx, my); + { + mpz_mul_2exp (my, my, ey - ex); /* divide mx by my*2^(ey-ex) */ + + /* since mx > 0 and my > 0, we can use mpz_tdiv_qr in all cases */ + mpz_tdiv_qr (mx, r, mx, my); + /* 0 <= |r| <= |my|, r has the same sign as mx */ + } if (rnd_q == MPFR_RNDN) q_is_odd = mpz_tstbit (mx, 0); @@ -181,7 +196,20 @@ mpfr_rem1 (mpfr_ptr rem, long *quo, mpfr_rnd_t rnd_q, /* FIXME: the comparison 2*r < my could be done more efficiently at the mpn level */ mpz_mul_2exp (r, r, 1); - compare = mpz_cmpabs (r, my); + /* if tiny=1, we should compare r with my*2^(ey-ex) */ + if (tiny) + { + if (ex + (mpfr_exp_t) mpz_sizeinbase (r, 2) < + ey + (mpfr_exp_t) mpz_sizeinbase (my, 2)) + compare = 0; /* r*2^ex < my*2^ey */ + else + { + mpz_mul_2exp (my, my, ey - ex); + compare = mpz_cmpabs (r, my); + } + } + else + compare = mpz_cmpabs (r, my); mpz_fdiv_q_2exp (r, r, 1); compare = ((compare > 0) || ((rnd_q == MPFR_RNDN) && (compare == 0) && q_is_odd)); diff --git a/Build/source/libs/mpfr/mpfr-src/src/rint.c b/Build/source/libs/mpfr/mpfr-src/src/rint.c index f2a9410a489..2e50a983df8 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/rint.c +++ b/Build/source/libs/mpfr/mpfr-src/src/rint.c @@ -1,7 +1,7 @@ /* mpfr_rint -- Round to an integer. -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/root.c b/Build/source/libs/mpfr/mpfr-src/src/root.c index c1a141c90bf..5bf45449851 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/root.c +++ b/Build/source/libs/mpfr/mpfr-src/src/root.c @@ -1,7 +1,7 @@ /* mpfr_root -- kth root. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -23,13 +23,15 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" - /* The computation of y = x^(1/k) is done as follows: + /* The computation of y = x^(1/k) is done as follows, except for large + values of k, for which this would be inefficient or yield internal + integer overflows: Let x = sign * m * 2^(k*e) where m is an integer with 2^(k*(n-1)) <= m < 2^(k*n) where n = PREC(y) - and m = s^k + r where 0 <= r and m < (s+1)^k + and m = s^k + t where 0 <= t and m < (s+1)^k we want that s has n bits i.e. s >= 2^(n-1), or m >= 2^(k*(n-1)) i.e. m must have at least k*(n-1)+1 bits @@ -38,11 +40,15 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., x^(1/k) = s * 2^e or (s+1) * 2^e according to the rounding mode. */ +static int +mpfr_root_aux (mpfr_ptr y, mpfr_srcptr x, unsigned long k, + mpfr_rnd_t rnd_mode); + int mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode) { mpz_t m; - mpfr_exp_t e, r, sh; + mpfr_exp_t e, r, sh, f; mpfr_prec_t n, size_m, tmp; int inexact, negative; MPFR_SAVE_EXPO_DECL (expo); @@ -55,50 +61,27 @@ mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode) if (MPFR_UNLIKELY (k <= 1)) { - if (k < 1) /* k==0 => y=x^(1/0)=x^(+Inf) */ -#if 0 - /* For 0 <= x < 1 => +0. - For x = 1 => 1. - For x > 1, => +Inf. - For x < 0 => NaN. - */ + if (k == 0) { - if (MPFR_IS_NEG (x) && !MPFR_IS_ZERO (x)) - { - MPFR_SET_NAN (y); - MPFR_RET_NAN; - } - inexact = mpfr_cmp (x, __gmpfr_one); - if (inexact == 0) - return mpfr_set_ui (y, 1, rnd_mode); /* 1 may be Out of Range */ - else if (inexact < 0) - return mpfr_set_ui (y, 0, rnd_mode); /* 0+ */ - else - { - mpfr_set_inf (y, 1); - return 0; - } + MPFR_SET_NAN (y); + MPFR_RET_NAN; } -#endif - { - MPFR_SET_NAN (y); - MPFR_RET_NAN; - } - else /* y =x^(1/1)=x */ + else /* y = x^(1/1) = x */ return mpfr_set (y, x, rnd_mode); } /* Singular values */ - else if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) { if (MPFR_IS_NAN (x)) { MPFR_SET_NAN (y); /* NaN^(1/k) = NaN */ MPFR_RET_NAN; } - else 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)) { @@ -106,27 +89,31 @@ mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode) MPFR_RET_NAN; } MPFR_SET_INF (y); - MPFR_SET_SAME_SIGN (y, x); - MPFR_RET (0); } else /* x is necessarily 0: (+0)^(1/k) = +0 (-0)^(1/k) = -0 */ { MPFR_ASSERTD (MPFR_IS_ZERO (x)); MPFR_SET_ZERO (y); - MPFR_SET_SAME_SIGN (y, x); - MPFR_RET (0); } + MPFR_SET_SAME_SIGN (y, x); + MPFR_RET (0); } /* Returns NAN for x < 0 and k even */ - else if (MPFR_IS_NEG (x) && (k % 2 == 0)) + if (MPFR_UNLIKELY (MPFR_IS_NEG (x) && (k % 2 == 0))) { MPFR_SET_NAN (y); MPFR_RET_NAN; } /* General case */ + + /* For large k, use exp(log(x)/k). The threshold of 100 seems to be quite + good when the precision goes to infinity. */ + if (k > 100) + return mpfr_root_aux (y, x, k, rnd_mode); + MPFR_SAVE_EXPO_MARK (expo); mpz_init (m); @@ -135,31 +122,24 @@ mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode) mpz_neg (m, m); r = e % (mpfr_exp_t) k; if (r < 0) - r += k; /* now r = e (mod k) with 0 <= e < r */ + r += k; /* now r = e (mod k) with 0 <= r < k */ + MPFR_ASSERTD (0 <= r && r < k); /* x = (m*2^r) * 2^(e-r) where e-r is a multiple of k */ MPFR_MPZ_SIZEINBASE2 (size_m, m); /* for rounding to nearest, we want the round bit to be in the root */ n = MPFR_PREC (y) + (rnd_mode == MPFR_RNDN); - /* we now multiply m by 2^(r+k*sh) so that root(m,k) will give - exactly n bits: we want k*(n-1)+1 <= size_m + k*sh + r <= k*n - i.e. sh = floor ((kn-size_m-r)/k) */ - if ((mpfr_exp_t) size_m + r > k * (mpfr_exp_t) n) - sh = 0; /* we already have too many bits */ + /* we now multiply m by 2^sh so that root(m,k) will give + exactly n bits: we want k*(n-1)+1 <= size_m + sh <= k*n + i.e. sh = k*f + r with f = max(floor((k*n-size_m-r)/k),0) */ + if ((mpfr_exp_t) size_m + r >= k * (mpfr_exp_t) n) + f = 0; /* we already have too many bits */ else - sh = (k * (mpfr_exp_t) n - (mpfr_exp_t) size_m - r) / k; - sh = k * sh + r; - if (sh >= 0) - { - mpz_mul_2exp (m, m, sh); - e = e - sh; - } - else if (r > 0) - { - mpz_mul_2exp (m, m, r); - e = e - r; - } + f = (k * (mpfr_exp_t) n - (mpfr_exp_t) size_m - r) / k; + sh = k * f + r; + mpz_mul_2exp (m, m, sh); + e = e - sh; /* invariant: x = m*2^e, with e divisible by k */ @@ -203,3 +183,97 @@ mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode) MPFR_SAVE_EXPO_FREE (expo); return mpfr_check_range (y, inexact, rnd_mode); } + +/* Compute y <- x^(1/k) using exp(log(x)/k). + 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. +*/ +static int +mpfr_root_aux (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode) +{ + int inexact, exact_root = 0; + mpfr_prec_t w; /* working precision */ + mpfr_t absx, t; + MPFR_GROUP_DECL(group); + MPFR_TMP_DECL(marker); + MPFR_ZIV_DECL(loop); + MPFR_SAVE_EXPO_DECL (expo); + + MPFR_TMP_INIT_ABS (absx, x); + + MPFR_TMP_MARK(marker); + w = MPFR_PREC(y) + 10; + /* Take some guard bits to prepare for the 'expt' lost bits below. + If |x| < 2^k, then log|x| < k, thus taking log2(k) bits should be fine. */ + if (MPFR_GET_EXP(x) > 0) + w += MPFR_INT_CEIL_LOG2 (MPFR_GET_EXP(x)); + MPFR_GROUP_INIT_1(group, w, t); + MPFR_SAVE_EXPO_MARK (expo); + MPFR_ZIV_INIT (loop, w); + for (;;) + { + mpfr_exp_t expt; + unsigned int err; + + 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); + /* 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) */ + mpfr_exp (t, t, MPFR_RNDN); + /* t = |x|^(1/k) * exp(tau) * (1 + theta1) with + |tau| <= 1.5 * 2^(expt - w) and |theta1| <= 2^(-w). + For |tau| <= 0.5 we have |exp(tau)-1| < 4/3*tau, thus + for w >= expt + 2 we have: + t = |x|^(1/k) * (1 + 2^(expt+2)*theta2) * (1 + theta1) with + |theta1|, |theta2| <= 2^(-w). + If expt+2 > 0, as long as w >= 1, we have: + t = |x|^(1/k) * (1 + 2^(expt+3)*theta3) with |theta3| < 2^(-w). + For expt+2 = 0, we have: + t = |x|^(1/k) * (1 + 2^2*theta3) with |theta3| < 2^(-w). + Finally for expt+2 < 0 we have: + t = |x|^(1/k) * (1 + 2*theta3) with |theta3| < 2^(-w). + */ + err = (expt + 2 > 0) ? expt + 3 + : (expt + 2 == 0) ? 2 : 1; + /* now t = |x|^(1/k) * (1 + 2^(err-w)) thus the error is at most + 2^(EXP(t) - w + err) */ + if (MPFR_LIKELY (MPFR_CAN_ROUND(t, w - err, MPFR_PREC(y), rnd_mode))) + break; + + /* If we fail to round correctly, check for an exact result or a + midpoint result with MPFR_RNDN (regarded as hard-to-round in + all precisions in order to determine the ternary value). */ + { + mpfr_t z, zk; + + mpfr_init2 (z, MPFR_PREC(y) + (rnd_mode == MPFR_RNDN)); + mpfr_init2 (zk, MPFR_PREC(x)); + mpfr_set (z, t, MPFR_RNDN); + inexact = mpfr_pow_ui (zk, z, k, MPFR_RNDN); + exact_root = !inexact && mpfr_equal_p (zk, absx); + if (exact_root) /* z is the exact root, thus round z directly */ + inexact = mpfr_set4 (y, z, rnd_mode, MPFR_SIGN (x)); + mpfr_clear (zk); + mpfr_clear (z); + if (exact_root) + break; + } + + MPFR_ZIV_NEXT (loop, w); + MPFR_GROUP_REPREC_1(group, w, t); + } + MPFR_ZIV_FREE (loop); + + if (!exact_root) + inexact = mpfr_set4 (y, t, rnd_mode, MPFR_SIGN (x)); + + MPFR_GROUP_CLEAR(group); + MPFR_TMP_FREE(marker); + MPFR_SAVE_EXPO_FREE (expo); + + return mpfr_check_range (y, inexact, rnd_mode); +} diff --git a/Build/source/libs/mpfr/mpfr-src/src/round_near_x.c b/Build/source/libs/mpfr/mpfr-src/src/round_near_x.c index 02a9a1b56b5..6aa0eb24389 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/round_near_x.c +++ b/Build/source/libs/mpfr/mpfr-src/src/round_near_x.c @@ -1,7 +1,7 @@ /* mpfr_round_near_x -- Round a floating point number nears another one. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/round_p.c b/Build/source/libs/mpfr/mpfr-src/src/round_p.c index bf12defd7ee..f19a66433f5 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/round_p.c +++ b/Build/source/libs/mpfr/mpfr-src/src/round_p.c @@ -1,7 +1,7 @@ /* mpfr_round_p -- check if an approximation is roundable. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -31,7 +31,11 @@ mpfr_round_p (mp_limb_t *bp, mp_size_t bn, mpfr_exp_t err0, mpfr_prec_t prec) { int i1, i2; + MPFR_ASSERTN(bp[bn - 1] & MPFR_LIMB_HIGHBIT); + i1 = mpfr_round_p_2 (bp, bn, err0, prec); + + /* compare with mpfr_can_round_raw */ i2 = mpfr_can_round_raw (bp, bn, MPFR_SIGN_POS, err0, MPFR_RNDN, MPFR_RNDZ, prec); if (i1 != i2) @@ -42,6 +46,7 @@ mpfr_round_p (mp_limb_t *bp, mp_size_t bn, mpfr_exp_t err0, mpfr_prec_t prec) gmp_fprintf (stderr, "%NX\n", bp, bn); MPFR_ASSERTN (0); } + return i1; } # define mpfr_round_p mpfr_round_p_2 @@ -62,6 +67,8 @@ mpfr_round_p (mp_limb_t *bp, mp_size_t bn, mpfr_exp_t err0, mpfr_prec_t prec) mp_limb_t tmp, mask; int s; + MPFR_ASSERTD(bp[bn - 1] & MPFR_LIMB_HIGHBIT); + err = (mpfr_prec_t) bn * GMP_NUMB_BITS; if (MPFR_UNLIKELY (err0 <= 0 || (mpfr_uexp_t) err0 <= prec || prec >= err)) return 0; /* can't round */ diff --git a/Build/source/libs/mpfr/mpfr-src/src/round_prec.c b/Build/source/libs/mpfr/mpfr-src/src/round_prec.c index 9dce103520f..c99d63e55ef 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/round_prec.c +++ b/Build/source/libs/mpfr/mpfr-src/src/round_prec.c @@ -1,8 +1,8 @@ /* 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-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -141,24 +141,40 @@ int mpfr_can_round_raw (const mp_limb_t *bp, mp_size_t bn, int neg, mpfr_exp_t err0, mpfr_rnd_t rnd1, mpfr_rnd_t rnd2, mpfr_prec_t prec) { - mpfr_prec_t err; + mpfr_prec_t err, prec0 = prec; mp_size_t k, k1, tn; int s, s1; mp_limb_t cc, cc2; mp_limb_t *tmp; MPFR_TMP_DECL(marker); + MPFR_ASSERTD(bp[bn - 1] & MPFR_LIMB_HIGHBIT); + if (MPFR_UNLIKELY(err0 < 0 || (mpfr_uexp_t) err0 <= prec)) return 0; /* can't round */ - else if (MPFR_UNLIKELY (prec > (mpfr_prec_t) bn * GMP_NUMB_BITS)) - { /* then ulp(b) < precision < error */ - return rnd2 == MPFR_RNDN && (mpfr_uexp_t) err0 - 2 >= prec; - /* can round only in rounding to the nearest and err0 >= prec + 2 */ - } MPFR_ASSERT_SIGN(neg); neg = MPFR_IS_NEG_SIGN(neg); + /* Transform RNDD and RNDU to Zero / Away */ + MPFR_ASSERTD((neg == 0) || (neg == 1)); + if (rnd1 != MPFR_RNDN) + rnd1 = MPFR_IS_LIKE_RNDZ(rnd1, neg) ? MPFR_RNDZ : MPFR_RNDA; + if (rnd2 != MPFR_RNDN) + rnd2 = MPFR_IS_LIKE_RNDZ(rnd2, neg) ? MPFR_RNDZ : MPFR_RNDA; + + 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 + (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. */ + if (rnd2 == MPFR_RNDN) + return (mpfr_uexp_t) err0 - 2 >= prec; + else + return (rnd1 == rnd2) && (mpfr_uexp_t) err0 - 2 >= prec; + } + /* 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) ? @@ -168,19 +184,25 @@ mpfr_can_round_raw (const mp_limb_t *bp, mp_size_t bn, int neg, mpfr_exp_t err0, k = (err - 1) / GMP_NUMB_BITS; MPFR_UNSIGNED_MINUS_MODULO(s, err); /* the error corresponds to bit s in limb k, the most significant limb - being limb 0 */ + being limb 0; in memory, limb k is bp[bn-1-k]. */ k1 = (prec - 1) / GMP_NUMB_BITS; MPFR_UNSIGNED_MINUS_MODULO(s1, prec); - /* the last significant bit is bit s1 in limb k1 */ + /* the least significant bit is bit s1 in limb k1 */ - /* don't need to consider the k1 most significant limbs */ + /* We don't need to consider the k1 most significant limbs. + They will be considered later only to detect when subtracting + the error bound yields a change of binade. + Warning! The number with updated bn may no longer be normalized. */ k -= k1; bn -= k1; prec -= (mpfr_prec_t) k1 * GMP_NUMB_BITS; - /* if when adding or subtracting (1 << s) in bp[bn-1-k], it does not - change bp[bn-1] >> s1, then we can round */ + /* 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 + adding or subtracting (1 << s) in bp[bn-1-k], it does not change the + rounding in direction 'rnd2' at ulp-position bp[bn-1] >> s1, taking also + into account the possible change of binade. */ MPFR_TMP_MARK(marker); tn = bn; k++; /* since we work with k+1 everywhere */ @@ -190,11 +212,6 @@ mpfr_can_round_raw (const mp_limb_t *bp, mp_size_t bn, int neg, mpfr_exp_t err0, MPFR_ASSERTD (k > 0); - /* Transform RNDD and RNDU to Zero / Away */ - MPFR_ASSERTD((neg == 0) || (neg ==1)); - if (MPFR_IS_RNDUTEST_OR_RNDDNOTTEST(rnd1, neg)) - rnd1 = MPFR_RNDZ; - switch (rnd1) { case MPFR_RNDZ: @@ -203,33 +220,54 @@ mpfr_can_round_raw (const mp_limb_t *bp, mp_size_t bn, int neg, mpfr_exp_t err0, /* 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 is the new value of bit s1 in bp[bn-1] */ + /* cc is the new value of bit s1 in bp[bn-1] after rounding 'rnd2' */ + /* now round b + 2^(MPFR_EXP(b)-err) */ - cc2 = mpn_add_1 (tmp + bn - k, bp + bn - k, k, MPFR_LIMB_ONE << s); + 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 */ break; case MPFR_RNDN: /* Round to nearest */ - /* first round b+2^(MPFR_EXP(b)-err) */ - cc = mpn_add_1 (tmp + bn - k, bp + bn - k, k, MPFR_LIMB_ONE << s); + + /* 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() */ cc = (tmp[bn - 1] >> s1) & 1; /* gives 0 when cc=1 */ cc ^= mpfr_round_raw2 (tmp, bn, neg, rnd2, prec); + /* cc is the new value of bit s1 in bp[bn-1]+eps after rounding 'rnd2' */ + + 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); + /* 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. + */ + 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)) + { + MPFR_TMP_FREE(marker); + return 0; + } break; default: /* Round away */ cc = (bp[bn - 1] >> s1) & 1; cc ^= mpfr_round_raw2 (bp, bn, neg, rnd2, prec); - /* now round b +/- 2^(MPFR_EXP(b)-err) */ - cc2 = mpn_sub_1 (tmp + bn - k, bp + bn - k, k, MPFR_LIMB_ONE << s); - break; - } + /* cc is the new value of bit s1 in bp[bn-1]+eps after rounding 'rnd2' */ - /* if cc2 is 1, then a carry or borrow propagates to the next limb */ - if (cc2 && cc) - { - MPFR_TMP_FREE(marker); - return 0; + goto subtract_eps; } cc2 = (tmp[bn - 1] >> s1) & 1; diff --git a/Build/source/libs/mpfr/mpfr-src/src/round_raw_generic.c b/Build/source/libs/mpfr/mpfr-src/src/round_raw_generic.c index d4e0e8ed347..2b67fcc989e 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/round_raw_generic.c +++ b/Build/source/libs/mpfr/mpfr-src/src/round_raw_generic.c @@ -1,7 +1,7 @@ /* mpfr_round_raw_generic -- Generic rounding function -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/scale2.c b/Build/source/libs/mpfr/mpfr-src/src/scale2.c index 8711cd4ab78..8439a019252 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/scale2.c +++ b/Build/source/libs/mpfr/mpfr-src/src/scale2.c @@ -1,7 +1,7 @@ /* mpfr_scale2 -- multiply a double float by 2^exp -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/sec.c b/Build/source/libs/mpfr/mpfr-src/src/sec.c index 5088cfa49a9..300591629a1 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sec.c +++ b/Build/source/libs/mpfr/mpfr-src/src/sec.c @@ -1,7 +1,7 @@ /* mpfr_sec - secant function = 1/cos. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/sech.c b/Build/source/libs/mpfr/mpfr-src/src/sech.c index ff8999605f3..4dd9da78439 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sech.c +++ b/Build/source/libs/mpfr/mpfr-src/src/sech.c @@ -1,7 +1,7 @@ /* mpfr_sech - Hyperbolic secant function = 1/cosh. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set.c b/Build/source/libs/mpfr/mpfr-src/src/set.c index be8d9012039..b10d7d8278d 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set.c @@ -1,7 +1,7 @@ /* mpfr_set -- copy of a floating-point number -Copyright 1999, 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_d.c b/Build/source/libs/mpfr/mpfr-src/src/set_d.c index e57b399f77c..c076ccf8405 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_d.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_d.c @@ -1,8 +1,8 @@ /* mpfr_set_d -- convert a machine double precision float to a multiple precision floating-point number -Copyright 1999-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_d64.c b/Build/source/libs/mpfr/mpfr-src/src/set_d64.c index 2ce71d6e663..a9300adfb95 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_d64.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_d64.c @@ -5,8 +5,8 @@ See http://gcc.gnu.org/ml/gcc/2006-06/msg00691.html, http://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html, and TR 24732 <http://www.open-std.org/jtc1/sc22/wg14/www/projects#24732>. -Copyright 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_dfl_prec.c b/Build/source/libs/mpfr/mpfr-src/src/set_dfl_prec.c index 158d167ab45..96464c459f9 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_dfl_prec.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_dfl_prec.c @@ -1,7 +1,7 @@ /* mpfr_set_default_prec, mpfr_get_default_prec -- set/get default precision -Copyright 1999-2001, 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2001, 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -23,9 +23,16 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-impl.h" /* default is IEEE double precision, i.e. 53 bits */ -mpfr_prec_t MPFR_THREAD_ATTR __gmpfr_default_fp_bit_precision \ +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 + void mpfr_set_default_prec (mpfr_prec_t prec) { diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_exp.c b/Build/source/libs/mpfr/mpfr-src/src/set_exp.c index 7e98dfd7aa5..f27fe5b59f0 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_exp.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_exp.c @@ -1,7 +1,7 @@ /* mpfr_set_exp - set the exponent of a floating-point number -Copyright 2002-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2002-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_f.c b/Build/source/libs/mpfr/mpfr-src/src/set_f.c index b6c9f5f12d2..67e6ae35655 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_f.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_f.c @@ -1,7 +1,7 @@ /* mpfr_set_f -- set a MPFR number from a GNU MPF number -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_flt.c b/Build/source/libs/mpfr/mpfr-src/src/set_flt.c index 3c26e148b92..b66da2f0d84 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_flt.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_flt.c @@ -1,7 +1,7 @@ /* mpfr_set_flt -- convert a machine single precision float to mpfr_t -Copyright 2009-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2009-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_inf.c b/Build/source/libs/mpfr/mpfr-src/src/set_inf.c index d5345ccf855..0f1f5c4e2e1 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_inf.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_inf.c @@ -1,7 +1,7 @@ /* mpfr_set_inf -- set a number to plus or minus infinity. -Copyright 2002, 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2002, 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_ld.c b/Build/source/libs/mpfr/mpfr-src/src/set_ld.c index 628807c44be..8c4fa841429 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_ld.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_ld.c @@ -1,8 +1,8 @@ /* mpfr_set_ld -- convert a machine long double to a multiple precision floating-point number -Copyright 2002-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2002-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_nan.c b/Build/source/libs/mpfr/mpfr-src/src/set_nan.c index a9ae517f35a..08b546fbc9c 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_nan.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_nan.c @@ -1,7 +1,7 @@ /* mpfr_set_nan -- set a number to NaN. -Copyright 2002, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2002, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_prc_raw.c b/Build/source/libs/mpfr/mpfr-src/src/set_prc_raw.c index 78cc5c3e3db..8638afa0feb 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_prc_raw.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_prc_raw.c @@ -1,7 +1,7 @@ /* mpfr_set_prec_raw -- reset the precision of a floating-point number -Copyright 2000-2001, 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2001, 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_prec.c b/Build/source/libs/mpfr/mpfr-src/src/set_prec.c index e9ea33dcc5f..578c0274d6c 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_prec.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_prec.c @@ -1,7 +1,7 @@ /* mpfr_set_prec -- reset the precision of a floating-point number -Copyright 1999, 2001-2002, 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001-2002, 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_q.c b/Build/source/libs/mpfr/mpfr-src/src/set_q.c index aa16a81b44a..cdfd0f083ca 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_q.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_q.c @@ -1,7 +1,7 @@ /* mpfr_set_q -- set a floating-point number from a multiple-precision rational -Copyright 2000-2002, 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2002, 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_rnd.c b/Build/source/libs/mpfr/mpfr-src/src/set_rnd.c index d6faa7b487b..10fc232312d 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_rnd.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_rnd.c @@ -1,8 +1,8 @@ /* mpfr_set_default_rounding_mode -- set the default rounding mode mpfr_get_default_rounding_mode -- get the default rounding mode -Copyright 1999, 2001, 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999, 2001, 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -23,7 +23,15 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-impl.h" -mpfr_rnd_t MPFR_THREAD_ATTR __gmpfr_default_rounding_mode = MPFR_RNDN; +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 void mpfr_set_default_rounding_mode (mpfr_rnd_t rnd_mode) diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_si.c b/Build/source/libs/mpfr/mpfr-src/src/set_si.c index 638862197d3..ce77aced2b2 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_si.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_si.c @@ -1,7 +1,7 @@ /* mpfr_set_si -- set a MPFR number from a machine signed integer -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_si_2exp.c b/Build/source/libs/mpfr/mpfr-src/src/set_si_2exp.c index 5b57254fc2a..f5add967644 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_si_2exp.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_si_2exp.c @@ -1,8 +1,8 @@ /* mpfr_set_si_2exp -- set a MPFR number from a machine signed integer with a shift -Copyright 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_sj.c b/Build/source/libs/mpfr/mpfr-src/src/set_sj.c index ef24c6b3701..2d1a734e212 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_sj.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_sj.c @@ -1,7 +1,7 @@ /* mpfr_set_sj -- set a MPFR number from a huge machine signed integer -Copyright 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_str.c b/Build/source/libs/mpfr/mpfr-src/src/set_str.c index 9da8821688c..191db5826f1 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_str.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_str.c @@ -1,7 +1,7 @@ /* mpfr_set_str -- set a floating-point number from a string -Copyright 2000-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_str_raw.c b/Build/source/libs/mpfr/mpfr-src/src/set_str_raw.c index f7e1167adab..e84c25059fe 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_str_raw.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_str_raw.c @@ -1,7 +1,7 @@ /* mpfr_set_str_binary -- set a floating-point number from a binary string -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_ui.c b/Build/source/libs/mpfr/mpfr-src/src/set_ui.c index 05d5346e995..d59f5b9d297 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_ui.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_ui.c @@ -1,7 +1,7 @@ /* mpfr_set_ui -- set a MPFR number from a machine unsigned integer -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_ui_2exp.c b/Build/source/libs/mpfr/mpfr-src/src/set_ui_2exp.c index 8ff538c6dad..de24331f1c9 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_ui_2exp.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_ui_2exp.c @@ -1,8 +1,8 @@ /* mpfr_set_ui_2exp -- set a MPFR number from a machine unsigned integer with a shift -Copyright 2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_uj.c b/Build/source/libs/mpfr/mpfr-src/src/set_uj.c index a1f679aea02..1dd15a5b24b 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_uj.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_uj.c @@ -1,7 +1,7 @@ /* mpfr_set_uj -- set a MPFR number from a huge machine unsigned integer -Copyright 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_z.c b/Build/source/libs/mpfr/mpfr-src/src/set_z.c index 590f5545d1b..e480bc653af 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_z.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_z.c @@ -1,7 +1,7 @@ /* mpfr_set_z -- set a floating-point number from a multiple-precision integer -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_z_exp.c b/Build/source/libs/mpfr/mpfr-src/src/set_z_exp.c index 15fc4d0aa31..5907ba88780 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_z_exp.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_z_exp.c @@ -1,8 +1,8 @@ /* mpfr_set_z_2exp -- set a floating-point number from a multiple-precision integer and an exponent -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_zero.c b/Build/source/libs/mpfr/mpfr-src/src/set_zero.c index 04a6ebeea17..ba471340f96 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/set_zero.c +++ b/Build/source/libs/mpfr/mpfr-src/src/set_zero.c @@ -1,7 +1,7 @@ /* mpfr_set_zero -- set a number to plus or minus zero. -Copyright 2009-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2009-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/setmax.c b/Build/source/libs/mpfr/mpfr-src/src/setmax.c index 5d79b62addf..cf8a873810b 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/setmax.c +++ b/Build/source/libs/mpfr/mpfr-src/src/setmax.c @@ -1,7 +1,7 @@ /* mpfr_setmax -- maximum representable floating-point number (raw version) -Copyright 2002-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2002-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/setmin.c b/Build/source/libs/mpfr/mpfr-src/src/setmin.c index 4b957b162a5..78b5deedfae 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/setmin.c +++ b/Build/source/libs/mpfr/mpfr-src/src/setmin.c @@ -1,7 +1,7 @@ /* mpfr_setmin -- minimum representable floating-point number (raw version) -Copyright 2002-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2002-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/setsign.c b/Build/source/libs/mpfr/mpfr-src/src/setsign.c index fa717ef9de9..06d9f7c3f45 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/setsign.c +++ b/Build/source/libs/mpfr/mpfr-src/src/setsign.c @@ -1,7 +1,7 @@ /* mpfr_setsign -- Produce a value with the magnitude of x and sign bit s -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/sgn.c b/Build/source/libs/mpfr/mpfr-src/src/sgn.c index 1e2a7fc5d2f..fe72bd71cb7 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sgn.c +++ b/Build/source/libs/mpfr/mpfr-src/src/sgn.c @@ -1,7 +1,7 @@ /* mpfr_sgn -- Sign of a floating point number. -Copyright 2003-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/si_op.c b/Build/source/libs/mpfr/mpfr-src/src/si_op.c index e1785345196..11d1e4192d5 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/si_op.c +++ b/Build/source/libs/mpfr/mpfr-src/src/si_op.c @@ -2,8 +2,8 @@ mpfr_sub_si -- sub a floating-point number with a machine integer mpfr_si_sub -- sub a machine number with a floating-point number -Copyright 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004-2016 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 @@ mpfr_add_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode) if (u >= 0) return mpfr_add_ui (y, x, u, rnd_mode); else - return mpfr_sub_ui (y, x, -u, rnd_mode); + return mpfr_sub_ui (y, x, - (unsigned long) u, rnd_mode); } int @@ -39,7 +39,7 @@ mpfr_sub_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode) if (u >= 0) return mpfr_sub_ui (y, x, u, rnd_mode); else - return mpfr_add_ui (y, x, -u, rnd_mode); + return mpfr_add_ui (y, x, - (unsigned long) u, rnd_mode); } int @@ -49,9 +49,9 @@ mpfr_si_sub (mpfr_ptr y, long int u, mpfr_srcptr x, mpfr_rnd_t rnd_mode) return mpfr_ui_sub (y, u, x, rnd_mode); else { - int res = -mpfr_add_ui (y, x, -u, MPFR_INVERT_RND (rnd_mode)); - MPFR_CHANGE_SIGN (y); - return res; + int res = - mpfr_add_ui (y, x, - (unsigned long) u, + MPFR_INVERT_RND (rnd_mode)); + MPFR_CHANGE_SIGN (y); + return res; } } - diff --git a/Build/source/libs/mpfr/mpfr-src/src/signbit.c b/Build/source/libs/mpfr/mpfr-src/src/signbit.c index 54632d368a4..a97f529543d 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/signbit.c +++ b/Build/source/libs/mpfr/mpfr-src/src/signbit.c @@ -1,7 +1,7 @@ /* mpfr_signbit -- Signbit of a MPFR number -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/sin.c b/Build/source/libs/mpfr/mpfr-src/src/sin.c index 44be51cb9a7..2a4c65e0f74 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sin.c +++ b/Build/source/libs/mpfr/mpfr-src/src/sin.c @@ -1,7 +1,7 @@ /* mpfr_sin -- sine of a floating-point number -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/sin_cos.c b/Build/source/libs/mpfr/mpfr-src/src/sin_cos.c index a064bc6b826..e665d063723 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sin_cos.c +++ b/Build/source/libs/mpfr/mpfr-src/src/sin_cos.c @@ -1,7 +1,7 @@ /* mpfr_sin_cos -- sine and cosine of a floating-point number -Copyright 2002-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2002-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/sinh.c b/Build/source/libs/mpfr/mpfr-src/src/sinh.c index 1dc010ee6a3..3b06e217302 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sinh.c +++ b/Build/source/libs/mpfr/mpfr-src/src/sinh.c @@ -1,7 +1,7 @@ /* mpfr_sinh -- hyperbolic sine -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/sinh_cosh.c b/Build/source/libs/mpfr/mpfr-src/src/sinh_cosh.c index 35f82ad6133..b41281408a4 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sinh_cosh.c +++ b/Build/source/libs/mpfr/mpfr-src/src/sinh_cosh.c @@ -1,7 +1,7 @@ /* mpfr_sinh_cosh -- hyperbolic sine and cosine -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/sparc64/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/sparc64/mparam.h index 8c5cfdc9afd..26a7b91240f 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sparc64/mparam.h +++ b/Build/source/libs/mpfr/mpfr-src/src/sparc64/mparam.h @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2015 Free Software Foundation, Inc. +Copyright 2005-2016 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/sqr.c b/Build/source/libs/mpfr/mpfr-src/src/sqr.c index ee55707955a..4096be731c5 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sqr.c +++ b/Build/source/libs/mpfr/mpfr-src/src/sqr.c @@ -1,7 +1,7 @@ /* mpfr_sqr -- Floating square -Copyright 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/sqrt.c b/Build/source/libs/mpfr/mpfr-src/src/sqrt.c index 1f5687be352..e1f75d33afe 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sqrt.c +++ b/Build/source/libs/mpfr/mpfr-src/src/sqrt.c @@ -1,7 +1,7 @@ /* mpfr_sqrt -- square root of a floating-point number -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -211,10 +211,11 @@ mpfr_sqrt (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode) rsize --; sh = 0; } + /* now rsize = MPFR_LIMB_SIZE(r) */ if (mpn_add_1 (rp0, rp, rsize, MPFR_LIMB_ONE << sh)) { expr ++; - rp[rsize - 1] = MPFR_LIMB_HIGHBIT; + rp0[rsize - 1] = MPFR_LIMB_HIGHBIT; } goto end; diff --git a/Build/source/libs/mpfr/mpfr-src/src/sqrt_ui.c b/Build/source/libs/mpfr/mpfr-src/src/sqrt_ui.c index 4cb6e9420ea..e824b088a39 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sqrt_ui.c +++ b/Build/source/libs/mpfr/mpfr-src/src/sqrt_ui.c @@ -1,7 +1,7 @@ /* mpfr_sqrt_ui -- square root of a machine integer -Copyright 2000-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/stack_interface.c b/Build/source/libs/mpfr/mpfr-src/src/stack_interface.c index a8d4a93de29..fdf0edf2ab1 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/stack_interface.c +++ b/Build/source/libs/mpfr/mpfr-src/src/stack_interface.c @@ -1,7 +1,7 @@ /* mpfr_stack -- initialize a floating-point number with given allocation area -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/strtofr.c b/Build/source/libs/mpfr/mpfr-src/src/strtofr.c index 17d6b63745b..67f5caa62a0 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/strtofr.c +++ b/Build/source/libs/mpfr/mpfr-src/src/strtofr.c @@ -1,7 +1,7 @@ /* mpfr_strtofr -- set a floating-point number from a string -Copyright 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/sub.c b/Build/source/libs/mpfr/mpfr-src/src/sub.c index 9b44123c601..cc4ec1ca714 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sub.c +++ b/Build/source/libs/mpfr/mpfr-src/src/sub.c @@ -1,7 +1,7 @@ /* mpfr_sub -- subtract two floating-point numbers -Copyright 2001-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/sub1.c b/Build/source/libs/mpfr/mpfr-src/src/sub1.c index 2586fd6ff3c..b00c4cd7cfc 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sub1.c +++ b/Build/source/libs/mpfr/mpfr-src/src/sub1.c @@ -1,7 +1,7 @@ /* mpfr_sub1 -- internal function to perform a "real" subtraction -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/sub1sp.c b/Build/source/libs/mpfr/mpfr-src/src/sub1sp.c index ddac834d17e..37b4d598d6e 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sub1sp.c +++ b/Build/source/libs/mpfr/mpfr-src/src/sub1sp.c @@ -1,8 +1,8 @@ /* mpfr_sub1sp -- internal function to perform a "real" substraction All the op must have the same precision -Copyright 2003-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/sub_d.c b/Build/source/libs/mpfr/mpfr-src/src/sub_d.c index 1050f6b8016..82c10ad8a1b 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sub_d.c +++ b/Build/source/libs/mpfr/mpfr-src/src/sub_d.c @@ -1,8 +1,8 @@ /* mpfr_sub_d -- subtract a machine double precision float from a multiple precision floating-point number -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/sub_ui.c b/Build/source/libs/mpfr/mpfr-src/src/sub_ui.c index 798fb1e6fc6..b366970eb34 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sub_ui.c +++ b/Build/source/libs/mpfr/mpfr-src/src/sub_ui.c @@ -1,7 +1,7 @@ /* mpfr_sub_ui -- subtract a floating-point number and a machine integer -Copyright 2000-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/subnormal.c b/Build/source/libs/mpfr/mpfr-src/src/subnormal.c index 0f7150c06e7..753c900ac80 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/subnormal.c +++ b/Build/source/libs/mpfr/mpfr-src/src/subnormal.c @@ -1,8 +1,8 @@ /* mpfr_subnormalize -- Subnormalize a floating point number emulating sub-normal numbers. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/sum.c b/Build/source/libs/mpfr/mpfr-src/src/sum.c index 9cbcbfac7f0..4cc0cc8ac63 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/sum.c +++ b/Build/source/libs/mpfr/mpfr-src/src/sum.c @@ -1,7 +1,7 @@ /* Sum -- efficiently sum a list of floating-point numbers -Copyright 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -45,9 +45,13 @@ 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 */ + 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. +*/ int -mpfr_sum_sort (mpfr_srcptr *const tab, unsigned long n, mpfr_srcptr *perm) +mpfr_sum_sort (mpfr_srcptr *const tab, unsigned long n, mpfr_srcptr *perm, + mpfr_prec_t *maxprec) { mpfr_exp_t min, max; mpfr_uexp_t exp_num; @@ -79,6 +83,8 @@ mpfr_sum_sort (mpfr_srcptr *const tab, unsigned long n, mpfr_srcptr *perm) 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; @@ -213,7 +219,8 @@ heap_sort (mpfr_srcptr *const tab, unsigned long n, mpfr_srcptr *perm) /* Sum a list of float with order given by permutation perm, - * intermediate size set to F. + * 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 @@ -230,16 +237,19 @@ sum_once (mpfr_ptr ret, mpfr_srcptr *const tab, unsigned long n, mpfr_prec_t F) for (i = 1; i < n - 1; i++) { MPFR_ASSERTD (!MPFR_IS_NAN (sum) && !MPFR_IS_INF (sum)); - error_trap |= mpfr_add (sum, sum, tab[i], MPFR_RNDN); + if (mpfr_add (sum, sum, tab[i], MPFR_RNDN)) + error_trap = 1; } - error_trap |= mpfr_add (ret, sum, tab[n - 1], MPFR_RNDN); + if (mpfr_add (ret, sum, tab[n - 1], MPFR_RNDN)) + error_trap = 1; mpfr_clear (sum); return error_trap; } /* 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) { @@ -266,7 +276,8 @@ mpfr_sum (mpfr_ptr ret, mpfr_ptr *const tab_p, unsigned long n, mpfr_rnd_t rnd) /* Sort and treat special cases */ MPFR_TMP_MARK (marker); perm = (mpfr_srcptr *) MPFR_TMP_ALLOC (n * sizeof *perm); - error_trap = mpfr_sum_sort (tab, n, 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)) { @@ -281,8 +292,7 @@ mpfr_sum (mpfr_ptr ret, mpfr_ptr *const tab_p, unsigned long n, mpfr_rnd_t rnd) MPFR_RET (0); } - /* Initial precision */ - prec = MAX (MPFR_PREC (tab[0]), MPFR_PREC (ret)); + /* 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); @@ -295,8 +305,7 @@ mpfr_sum (mpfr_ptr ret, mpfr_ptr *const tab_p, unsigned long n, mpfr_rnd_t rnd) 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, - MPFR_GET_EXP (cur_sum) - prec + 2, + mpfr_can_round (cur_sum, prec - 2, MPFR_RNDN, rnd, MPFR_PREC (ret))))) break; MPFR_ZIV_NEXT (loop, prec); @@ -305,11 +314,13 @@ mpfr_sum (mpfr_ptr ret, mpfr_ptr *const tab_p, unsigned long n, mpfr_rnd_t rnd) MPFR_ZIV_FREE (loop); MPFR_TMP_FREE (marker); - error_trap |= mpfr_set (ret, cur_sum, rnd); + if (mpfr_set (ret, cur_sum, rnd)) + error_trap = 1; mpfr_clear (cur_sum); MPFR_SAVE_EXPO_FREE (expo); - error_trap |= mpfr_check_range (ret, 0, rnd); + if (mpfr_check_range (ret, 0, rnd)) + error_trap = 1; return error_trap; /* It doesn't return the ternary value */ } diff --git a/Build/source/libs/mpfr/mpfr-src/src/swap.c b/Build/source/libs/mpfr/mpfr-src/src/swap.c index 99f2a507af6..a7282089003 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/swap.c +++ b/Build/source/libs/mpfr/mpfr-src/src/swap.c @@ -1,7 +1,7 @@ /* mpfr_swap (U, V) -- Swap U and V. -Copyright 2000-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/tan.c b/Build/source/libs/mpfr/mpfr-src/src/tan.c index d4274cb4466..b10edc620c7 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/tan.c +++ b/Build/source/libs/mpfr/mpfr-src/src/tan.c @@ -1,7 +1,7 @@ /* mpfr_tan -- tangent of a floating-point number -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/tanh.c b/Build/source/libs/mpfr/mpfr-src/src/tanh.c index 077dd2e7498..3ce860ac6b2 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/tanh.c +++ b/Build/source/libs/mpfr/mpfr-src/src/tanh.c @@ -1,7 +1,7 @@ /* mpfr_tanh -- hyperbolic tangent -Copyright 2001-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/uceil_exp2.c b/Build/source/libs/mpfr/mpfr-src/src/uceil_exp2.c index 64cb017cbcc..29c685ad4c8 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/uceil_exp2.c +++ b/Build/source/libs/mpfr/mpfr-src/src/uceil_exp2.c @@ -1,7 +1,7 @@ /* __gmpfr_ceil_exp2 - returns y >= 2^d -Copyright 1999-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/uceil_log2.c b/Build/source/libs/mpfr/mpfr-src/src/uceil_log2.c index 417df9dde04..b34a21c07bc 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/uceil_log2.c +++ b/Build/source/libs/mpfr/mpfr-src/src/uceil_log2.c @@ -1,7 +1,7 @@ /* __gmpfr_ceil_log2 - returns ceil(log(d)/log(2)) -Copyright 1999-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/ufloor_log2.c b/Build/source/libs/mpfr/mpfr-src/src/ufloor_log2.c index 0ad6d8522d2..8e7627e44fa 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/ufloor_log2.c +++ b/Build/source/libs/mpfr/mpfr-src/src/ufloor_log2.c @@ -1,7 +1,7 @@ /* __gmpfr_floor_log2 - returns floor(log(d)/log(2)) -Copyright 1999-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/ui_div.c b/Build/source/libs/mpfr/mpfr-src/src/ui_div.c index ac1efb3b984..dd190300d44 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/ui_div.c +++ b/Build/source/libs/mpfr/mpfr-src/src/ui_div.c @@ -1,8 +1,8 @@ /* 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-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -106,7 +106,8 @@ mpfr_si_div (mpfr_ptr y, long int u, mpfr_srcptr x, mpfr_rnd_t rnd_mode) res = mpfr_ui_div (y, u, x, rnd_mode); else { - res = -mpfr_ui_div (y, -u, x, MPFR_INVERT_RND(rnd_mode)); + res = - mpfr_ui_div (y, - (unsigned long) u, x, + MPFR_INVERT_RND(rnd_mode)); MPFR_CHANGE_SIGN (y); } return res; diff --git a/Build/source/libs/mpfr/mpfr-src/src/ui_pow.c b/Build/source/libs/mpfr/mpfr-src/src/ui_pow.c index b8b982184b0..ed71309ca98 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/ui_pow.c +++ b/Build/source/libs/mpfr/mpfr-src/src/ui_pow.c @@ -1,7 +1,7 @@ /* mpfr_ui_pow -- power of n function n^x -Copyright 2001-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2001-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/ui_pow_ui.c b/Build/source/libs/mpfr/mpfr-src/src/ui_pow_ui.c index eabb1fba8b8..98dc76e2165 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/ui_pow_ui.c +++ b/Build/source/libs/mpfr/mpfr-src/src/ui_pow_ui.c @@ -1,7 +1,7 @@ /* mpfr_ui_pow_ui -- compute the power beetween two machine integer -Copyright 1999-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 1999-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/ui_sub.c b/Build/source/libs/mpfr/mpfr-src/src/ui_sub.c index bb8166ef234..f4cbaac5120 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/ui_sub.c +++ b/Build/source/libs/mpfr/mpfr-src/src/ui_sub.c @@ -1,7 +1,7 @@ /* mpfr_ui_sub -- subtract a floating-point number from an integer -Copyright 2000-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/urandom.c b/Build/source/libs/mpfr/mpfr-src/src/urandom.c index 0610eb1dbd4..1232ff18aa3 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/urandom.c +++ b/Build/source/libs/mpfr/mpfr-src/src/urandom.c @@ -2,8 +2,8 @@ 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-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/urandomb.c b/Build/source/libs/mpfr/mpfr-src/src/urandomb.c index 3d1c12bf93c..fd728967aa6 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/urandomb.c +++ b/Build/source/libs/mpfr/mpfr-src/src/urandomb.c @@ -3,8 +3,8 @@ using STATE as the random state previously initialized by a call to gmp_randinit_lc_2exp_size(). -Copyright 2000-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2000-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/vasprintf.c b/Build/source/libs/mpfr/mpfr-src/src/vasprintf.c index 2d209dc1a6d..7db85a962c5 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/vasprintf.c +++ b/Build/source/libs/mpfr/mpfr-src/src/vasprintf.c @@ -1,8 +1,8 @@ /* mpfr_vasprintf -- main function for the printf functions family plus helper macros & functions. -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/version.c b/Build/source/libs/mpfr/mpfr-src/src/version.c index 96b2f614e67..130e0f86c1d 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/version.c +++ b/Build/source/libs/mpfr/mpfr-src/src/version.c @@ -1,7 +1,7 @@ /* mpfr_get_version -- MPFR version -Copyright 2004-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2004-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -25,5 +25,5 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., const char * mpfr_get_version (void) { - return "3.1.3"; + return "3.1.4"; } diff --git a/Build/source/libs/mpfr/mpfr-src/src/volatile.c b/Build/source/libs/mpfr/mpfr-src/src/volatile.c index bb4e7da42e0..938655ebab5 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/volatile.c +++ b/Build/source/libs/mpfr/mpfr-src/src/volatile.c @@ -4,8 +4,8 @@ CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN FUTURE MPFR RELEASES. -Copyright 2003-2004, 2006-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003-2004, 2006-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/x86/core2/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/x86/core2/mparam.h index 3a3abe2e99e..04edd526cea 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/x86/core2/mparam.h +++ b/Build/source/libs/mpfr/mpfr-src/src/x86/core2/mparam.h @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2015 Free Software Foundation, Inc. +Copyright 2005-2016 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/x86/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/x86/mparam.h index 6f5f4917503..978760a4c15 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/x86/mparam.h +++ b/Build/source/libs/mpfr/mpfr-src/src/x86/mparam.h @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2015 Free Software Foundation, Inc. +Copyright 2005-2016 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/x86_64/core2/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/x86_64/core2/mparam.h index 5d40b40d96a..59025ad0973 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/x86_64/core2/mparam.h +++ b/Build/source/libs/mpfr/mpfr-src/src/x86_64/core2/mparam.h @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2015 Free Software Foundation, Inc. +Copyright 2005-2016 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/x86_64/pentium4/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/x86_64/pentium4/mparam.h index 19db0a4d670..88a06e5425a 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/x86_64/pentium4/mparam.h +++ b/Build/source/libs/mpfr/mpfr-src/src/x86_64/pentium4/mparam.h @@ -1,6 +1,6 @@ /* Various Thresholds of MPFR, not exported. -*- mode: C -*- -Copyright 2005-2015 Free Software Foundation, Inc. +Copyright 2005-2016 Free Software Foundation, Inc. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/yn.c b/Build/source/libs/mpfr/mpfr-src/src/yn.c index c2c6bc97ea4..a17a7f35652 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/yn.c +++ b/Build/source/libs/mpfr/mpfr-src/src/yn.c @@ -1,8 +1,8 @@ /* mpfr_y0, mpfr_y1, mpfr_yn -- Bessel functions of 2nd kind, integer order. http://www.opengroup.org/onlinepubs/009695399/functions/y0.html -Copyright 2007-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2007-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. diff --git a/Build/source/libs/mpfr/mpfr-src/src/zeta.c b/Build/source/libs/mpfr/mpfr-src/src/zeta.c index ef5c9395733..df000b15fc4 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/zeta.c +++ b/Build/source/libs/mpfr/mpfr-src/src/zeta.c @@ -1,7 +1,7 @@ /* mpfr_zeta -- compute the Riemann Zeta function -Copyright 2003-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2003-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -377,8 +377,8 @@ mpfr_zeta (mpfr_t z, mpfr_srcptr s, mpfr_rnd_t rnd_mode) } } - /* Check for case s= 1 before changing the exponent range */ - if (mpfr_cmp (s, __gmpfr_one) ==0) + /* Check for case s=1 before changing the exponent range */ + if (mpfr_cmp (s, __gmpfr_one) == 0) { MPFR_SET_INF (z); MPFR_SET_POS (z); @@ -420,7 +420,7 @@ mpfr_zeta (mpfr_t z, mpfr_srcptr s, mpfr_rnd_t rnd_mode) MPFR_ZIV_INIT (loop, prec1); for (;;) { - mpfr_sub (s1, __gmpfr_one, s, MPFR_RNDN);/* s1 = 1-s */ + 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, @@ -432,17 +432,32 @@ mpfr_zeta (mpfr_t z, mpfr_srcptr s, mpfr_rnd_t rnd_mode) break; } mpfr_mul (z_pre, z_pre, y, MPFR_RNDN); /* gamma(1-s)*zeta(1-s) */ - mpfr_const_pi (p, MPFR_RNDD); - mpfr_mul (y, s, p, MPFR_RNDN); - mpfr_div_2ui (y, y, 1, MPFR_RNDN); /* s*Pi/2 */ - mpfr_sin (y, y, MPFR_RNDN); /* sin(Pi*s/2) */ - mpfr_mul (z_pre, z_pre, y, MPFR_RNDN); + + 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 */ mpfr_pow (y, y, s1, MPFR_RNDN); /* (2*Pi)^(s-1) */ mpfr_mul (z_pre, z_pre, y, MPFR_RNDN); mpfr_mul_2ui (z_pre, z_pre, 1, MPFR_RNDN); + /* 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 */ + mpfr_sin (y, p, MPFR_RNDN); /* y = sin(Pi*s/2) */ + if (MPFR_GET_EXP(y) < 0) /* take account of cancellation in sin(p) */ + { + mpfr_t t; + mpfr_init2 (t, prec1 - MPFR_GET_EXP(y)); + mpfr_const_pi (t, MPFR_RNDD); + mpfr_mul (t, s, t, MPFR_RNDN); + mpfr_div_2ui (t, t, 1, MPFR_RNDN); + mpfr_sin (y, t, MPFR_RNDN); + mpfr_clear (t); + } + mpfr_mul (z_pre, z_pre, y, MPFR_RNDN); + if (MPFR_LIKELY (MPFR_CAN_ROUND (z_pre, prec1 - add, precz, rnd_mode))) break; diff --git a/Build/source/libs/mpfr/mpfr-src/src/zeta_ui.c b/Build/source/libs/mpfr/mpfr-src/src/zeta_ui.c index 02ba337fb87..dc147e712a4 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/zeta_ui.c +++ b/Build/source/libs/mpfr/mpfr-src/src/zeta_ui.c @@ -1,7 +1,7 @@ /* mpfr_zeta_ui -- compute the Riemann Zeta function for integer argument. -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. |