upgrade to NetBSD CVS release from 2012/10/17 12:00:00 UTC Makefiles updates to imporve portability Made sure to be consistent in the usage of braces/parenthesis at least on a per file basis. For variables, it is recommended to continue to use braces.
320 lines
10 KiB
Diff
320 lines
10 KiB
Diff
diff -r -x CVS -N -U 3 dist/ansi2knr.c dist.orig/ansi2knr.c
|
|
--- dist/ansi2knr.c 2011-04-04 12:19:46.000000000 +0200
|
|
+++ dist.orig/ansi2knr.c 2011-06-20 07:53:13.000000000 +0200
|
|
@@ -1,6 +1,6 @@
|
|
/* Copyright (C) 1989, 2000 Aladdin Enterprises. All rights reserved. */
|
|
|
|
-/*$Id: ansi2knr.c,v 1.14 2003/09/06 05:36:56 eggert Exp $*/
|
|
+/*$Id: ansi2knr.c,v 1.1.1.1 2011/06/20 05:53:13 mrg Exp $*/
|
|
/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
|
|
|
|
/*
|
|
diff -r -x CVS -N -U 3 dist/asin.c dist.orig/asin.c
|
|
--- dist/asin.c 2011-04-04 12:19:18.000000000 +0200
|
|
+++ dist.orig/asin.c 2011-07-06 21:53:24.000000000 +0200
|
|
@@ -63,11 +63,14 @@
|
|
|
|
compared = mpfr_cmp_ui (xp, 1);
|
|
|
|
+ MPFR_SAVE_EXPO_MARK (expo);
|
|
+
|
|
if (MPFR_UNLIKELY (compared >= 0))
|
|
{
|
|
mpfr_clear (xp);
|
|
if (compared > 0) /* asin(x) = NaN for |x| > 1 */
|
|
{
|
|
+ MPFR_SAVE_EXPO_FREE (expo);
|
|
MPFR_SET_NAN (asin);
|
|
MPFR_RET_NAN;
|
|
}
|
|
@@ -80,13 +83,11 @@
|
|
inexact = -mpfr_const_pi (asin, MPFR_INVERT_RND(rnd_mode));
|
|
MPFR_CHANGE_SIGN (asin);
|
|
}
|
|
- mpfr_div_2ui (asin, asin, 1, rnd_mode); /* May underflow */
|
|
- return inexact;
|
|
+ mpfr_div_2ui (asin, asin, 1, rnd_mode);
|
|
}
|
|
}
|
|
-
|
|
- MPFR_SAVE_EXPO_MARK (expo);
|
|
-
|
|
+ else
|
|
+ {
|
|
/* Compute exponent of 1 - ABS(x) */
|
|
mpfr_ui_sub (xp, 1, xp, MPFR_RNDD);
|
|
MPFR_ASSERTD (MPFR_GET_EXP (xp) <= 0);
|
|
@@ -115,6 +116,7 @@
|
|
inexact = mpfr_set (asin, xp, rnd_mode);
|
|
|
|
mpfr_clear (xp);
|
|
+ }
|
|
|
|
MPFR_SAVE_EXPO_FREE (expo);
|
|
return mpfr_check_range (asin, inexact, rnd_mode);
|
|
diff -r -x CVS -N -U 3 dist/atan.c dist.orig/atan.c
|
|
--- dist/atan.c 2011-04-04 12:19:18.000000000 +0200
|
|
+++ dist.orig/atan.c 2011-07-06 21:53:24.000000000 +0200
|
|
@@ -431,5 +431,5 @@
|
|
MPFR_GROUP_CLEAR (group);
|
|
|
|
MPFR_SAVE_EXPO_FREE (expo);
|
|
- return mpfr_check_range (arctgt, inexact, rnd_mode);
|
|
+ return mpfr_check_range (atan, inexact, rnd_mode);
|
|
}
|
|
diff -r -x CVS -N -U 3 dist/config.guess dist.orig/config.guess
|
|
--- dist/config.guess 2011-04-04 12:19:46.000000000 +0200
|
|
+++ dist.orig/config.guess 2012-07-19 21:34:26.000000000 +0200
|
|
@@ -968,6 +968,9 @@
|
|
sparc:Linux:*:* | sparc64:Linux:*:*)
|
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
|
exit ;;
|
|
+ tile*:Linux:*:*)
|
|
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
|
|
+ exit ;;
|
|
vax:Linux:*:*)
|
|
echo ${UNAME_MACHINE}-dec-linux-gnu
|
|
exit ;;
|
|
diff -r -x CVS -N -U 3 dist/Makefile.in dist.orig/Makefile.in
|
|
--- dist/Makefile.in 2011-04-04 12:19:46.000000000 +0200
|
|
+++ dist.orig/Makefile.in 2011-06-21 06:03:33.000000000 +0200
|
|
@@ -464,8 +464,12 @@
|
|
$(SHELL) ./config.status --recheck
|
|
|
|
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
|
+ @echo "NOT REBUILDING $@"
|
|
+NetBSD_DISABLED_configure:
|
|
$(am__cd) $(srcdir) && $(AUTOCONF)
|
|
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
|
+ @echo "NOT REBUILDING $@"
|
|
+NetBSD_DISABLED_aclocal:
|
|
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
|
$(am__aclocal_m4_deps):
|
|
mparam.h: $(top_builddir)/config.status $(srcdir)/mparam_h.in
|
|
@@ -2048,6 +2052,8 @@
|
|
# should not be a problem in practice, in particular because "make dist"
|
|
# automatically rebuilds get_patches.c before generating the archives.
|
|
$(srcdir)/get_patches.c: PATCHES get_patches.sh
|
|
+ @echo "NOT REBUILDING $@"
|
|
+NetBSD_DISABLED_get_patches.c:
|
|
(cd $(srcdir) && ./get_patches.sh) > $@ || rm -f $@
|
|
|
|
tune:
|
|
diff -r -x CVS -N -U 3 dist/mpfr.h dist.orig/mpfr.h
|
|
--- dist/mpfr.h 2011-04-04 12:19:18.000000000 +0200
|
|
+++ dist.orig/mpfr.h 2011-07-06 21:53:24.000000000 +0200
|
|
@@ -27,7 +27,7 @@
|
|
#define MPFR_VERSION_MAJOR 3
|
|
#define MPFR_VERSION_MINOR 0
|
|
#define MPFR_VERSION_PATCHLEVEL 1
|
|
-#define MPFR_VERSION_STRING "3.0.1"
|
|
+#define MPFR_VERSION_STRING "3.0.1-p4"
|
|
|
|
/* Macros dealing with MPFR VERSION */
|
|
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
|
|
diff -r -x CVS -N -U 3 dist/PATCHES dist.orig/PATCHES
|
|
--- dist/PATCHES 2011-04-04 12:19:18.000000000 +0200
|
|
+++ dist.orig/PATCHES 2011-07-06 21:53:24.000000000 +0200
|
|
@@ -0,0 +1,4 @@
|
|
+texp-zero
|
|
+atan-expo-range
|
|
+rec_sqrt-carry
|
|
+asin_exprange
|
|
diff -r -x CVS -N -U 3 dist/rec_sqrt.c dist.orig/rec_sqrt.c
|
|
--- dist/rec_sqrt.c 2011-04-04 12:19:18.000000000 +0200
|
|
+++ dist.orig/rec_sqrt.c 2011-07-06 21:53:24.000000000 +0200
|
|
@@ -375,20 +375,37 @@
|
|
MPFR_ASSERTD(un == ln + 1 || un == ln + 2);
|
|
/* the high un-ln limbs of u will overlap the low part of {x+ln,xn},
|
|
we need to add or subtract the overlapping part {u + ln, un - ln} */
|
|
+ /* Warning! th may be 0, in which case the mpn_add_1 and mpn_sub_1
|
|
+ below (with size = th) mustn't be used. In such a case, the limb
|
|
+ (carry) will be 0, so that this is semantically a no-op, but if
|
|
+ mpn_add_1 and mpn_sub_1 are used, GMP (currently) still does a
|
|
+ non-atomic read/write in a place that is not always allocated,
|
|
+ with the possible consequences: a crash if the corresponding
|
|
+ address is not mapped, or (rather unlikely) memory corruption
|
|
+ if another process/thread writes at the same place; things may
|
|
+ be worse with future GMP versions. Hence the tests carry != 0. */
|
|
if (neg == 0)
|
|
{
|
|
if (ln > 0)
|
|
MPN_COPY (x, u, ln);
|
|
cy = mpn_add (x + ln, x + ln, xn, u + ln, un - ln);
|
|
/* add cu at x+un */
|
|
- cy += mpn_add_1 (x + un, x + un, th, cu);
|
|
+ if (cu != 0)
|
|
+ {
|
|
+ MPFR_ASSERTD (th != 0);
|
|
+ cy += mpn_add_1 (x + un, x + un, th, cu);
|
|
+ }
|
|
}
|
|
else /* negative case */
|
|
{
|
|
/* subtract {u+ln, un-ln} from {x+ln,un} */
|
|
cy = mpn_sub (x + ln, x + ln, xn, u + ln, un - ln);
|
|
/* carry cy is at x+un, like cu */
|
|
- cy = mpn_sub_1 (x + un, x + un, th, cy + cu); /* n - un = th */
|
|
+ if (cy + cu != 0)
|
|
+ {
|
|
+ MPFR_ASSERTD (th != 0);
|
|
+ cy = mpn_sub_1 (x + un, x + un, th, cy + cu); /* n - un = th */
|
|
+ }
|
|
/* cy cannot be zero, since the most significant bit of Xh is 1,
|
|
and the correction is bounded by 2^{-h+3} */
|
|
MPFR_ASSERTD(cy == 0);
|
|
diff -r -x CVS -N -U 3 dist/tests/tasin.c dist.orig/tests/tasin.c
|
|
--- dist/tests/tasin.c 2011-04-04 12:19:17.000000000 +0200
|
|
+++ dist.orig/tests/tasin.c 2011-07-06 21:53:24.000000000 +0200
|
|
@@ -219,6 +219,49 @@
|
|
mpfr_clear (y);
|
|
}
|
|
|
|
+static void
|
|
+reduced_expo_range (void)
|
|
+{
|
|
+ mpfr_exp_t emin, emax;
|
|
+ mpfr_t x, y, ex_y;
|
|
+ int inex, ex_inex;
|
|
+ unsigned int flags, ex_flags;
|
|
+
|
|
+ emin = mpfr_get_emin ();
|
|
+ emax = mpfr_get_emax ();
|
|
+
|
|
+ mpfr_inits2 (4, x, y, ex_y, (mpfr_ptr) 0);
|
|
+ mpfr_set_str (x, "-0.1e1", 2, MPFR_RNDN);
|
|
+
|
|
+ mpfr_set_emin (1);
|
|
+ mpfr_set_emax (1);
|
|
+ mpfr_clear_flags ();
|
|
+ inex = mpfr_asin (y, x, MPFR_RNDA);
|
|
+ flags = __gmpfr_flags;
|
|
+ mpfr_set_emin (emin);
|
|
+ mpfr_set_emax (emax);
|
|
+
|
|
+ mpfr_set_str (ex_y, "-0.1101e1", 2, MPFR_RNDN);
|
|
+ ex_inex = -1;
|
|
+ ex_flags = MPFR_FLAGS_INEXACT;
|
|
+
|
|
+ if (SIGN (inex) != ex_inex || flags != ex_flags ||
|
|
+ ! mpfr_equal_p (y, ex_y))
|
|
+ {
|
|
+ printf ("Error in reduced_expo_range\non x = ");
|
|
+ mpfr_dump (x);
|
|
+ printf ("Expected y = ");
|
|
+ mpfr_out_str (stdout, 2, 0, ex_y, MPFR_RNDN);
|
|
+ printf ("\n inex = %d, flags = %u\n", ex_inex, ex_flags);
|
|
+ printf ("Got y = ");
|
|
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
|
|
+ printf ("\n inex = %d, flags = %u\n", SIGN (inex), flags);
|
|
+ exit (1);
|
|
+ }
|
|
+
|
|
+ mpfr_clears (x, y, ex_y, (mpfr_ptr) 0);
|
|
+}
|
|
+
|
|
int
|
|
main (void)
|
|
{
|
|
@@ -226,6 +269,7 @@
|
|
|
|
special ();
|
|
special_overflow ();
|
|
+ reduced_expo_range ();
|
|
|
|
test_generic (2, 100, 15);
|
|
|
|
diff -r -x CVS -N -U 3 dist/tests/tatan.c dist.orig/tests/tatan.c
|
|
--- dist/tests/tatan.c 2011-04-04 12:19:17.000000000 +0200
|
|
+++ dist.orig/tests/tatan.c 2011-07-06 21:53:24.000000000 +0200
|
|
@@ -535,6 +535,52 @@
|
|
mpfr_clears (a, x, y, (mpfr_ptr) 0);
|
|
}
|
|
|
|
+/* http://websympa.loria.fr/wwsympa/arc/mpfr/2011-05/msg00008.html
|
|
+ * Incorrect flags (in debug mode on a 32-bit machine, assertion failure).
|
|
+ */
|
|
+static void
|
|
+reduced_expo_range (void)
|
|
+{
|
|
+ mpfr_exp_t emin, emax;
|
|
+ mpfr_t x, y, ex_y;
|
|
+ int inex, ex_inex;
|
|
+ unsigned int flags, ex_flags;
|
|
+
|
|
+ emin = mpfr_get_emin ();
|
|
+ emax = mpfr_get_emax ();
|
|
+
|
|
+ mpfr_inits2 (12, x, y, ex_y, (mpfr_ptr) 0);
|
|
+ mpfr_set_str (x, "0.1e-5", 2, MPFR_RNDN);
|
|
+
|
|
+ mpfr_set_emin (-5);
|
|
+ mpfr_set_emax (-5);
|
|
+ mpfr_clear_flags ();
|
|
+ inex = mpfr_atan (y, x, MPFR_RNDN);
|
|
+ flags = __gmpfr_flags;
|
|
+ mpfr_set_emin (emin);
|
|
+ mpfr_set_emax (emax);
|
|
+
|
|
+ mpfr_set_str (ex_y, "0.1e-5", 2, MPFR_RNDN);
|
|
+ ex_inex = 1;
|
|
+ ex_flags = MPFR_FLAGS_INEXACT;
|
|
+
|
|
+ if (SIGN (inex) != ex_inex || flags != ex_flags ||
|
|
+ ! mpfr_equal_p (y, ex_y))
|
|
+ {
|
|
+ printf ("Error in reduced_expo_range\non x = ");
|
|
+ mpfr_dump (x);
|
|
+ printf ("Expected y = ");
|
|
+ mpfr_out_str (stdout, 2, 0, ex_y, MPFR_RNDN);
|
|
+ printf ("\n inex = %d, flags = %u\n", ex_inex, ex_flags);
|
|
+ printf ("Got y = ");
|
|
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
|
|
+ printf ("\n inex = %d, flags = %u\n", SIGN (inex), flags);
|
|
+ exit (1);
|
|
+ }
|
|
+
|
|
+ mpfr_clears (x, y, ex_y, (mpfr_ptr) 0);
|
|
+}
|
|
+
|
|
int
|
|
main (int argc, char *argv[])
|
|
{
|
|
@@ -546,6 +592,7 @@
|
|
smallvals_atan2 ();
|
|
atan2_bug_20071003 ();
|
|
atan2_different_prec ();
|
|
+ reduced_expo_range ();
|
|
|
|
test_generic_atan (2, 200, 17);
|
|
test_generic_atan2 (2, 200, 17);
|
|
diff -r -x CVS -N -U 3 dist/tests/texp.c dist.orig/tests/texp.c
|
|
--- dist/tests/texp.c 2011-04-04 12:19:17.000000000 +0200
|
|
+++ dist.orig/tests/texp.c 2011-07-06 21:53:24.000000000 +0200
|
|
@@ -170,7 +170,9 @@
|
|
mpfr_set_prec (x, prec);
|
|
mpfr_set_prec (y, prec);
|
|
mpfr_set_prec (z, prec);
|
|
- mpfr_urandomb (x, RANDS);
|
|
+ do
|
|
+ mpfr_urandomb (x, RANDS);
|
|
+ while (MPFR_IS_ZERO (x)); /* 0 is handled by mpfr_exp only */
|
|
rnd = RND_RAND ();
|
|
mpfr_exp_2 (y, x, rnd);
|
|
mpfr_exp_3 (z, x, rnd);
|
|
diff -r -x CVS -N -U 3 dist/VERSION dist.orig/VERSION
|
|
--- dist/VERSION 2011-04-04 12:19:18.000000000 +0200
|
|
+++ dist.orig/VERSION 2011-07-06 21:53:24.000000000 +0200
|
|
@@ -1 +1 @@
|
|
-3.0.1
|
|
+3.0.1-p4
|
|
diff -r -x CVS -N -U 3 dist/version.c dist.orig/version.c
|
|
--- dist/version.c 2011-04-04 12:19:18.000000000 +0200
|
|
+++ dist.orig/version.c 2011-07-06 21:53:24.000000000 +0200
|
|
@@ -25,5 +25,5 @@
|
|
const char *
|
|
mpfr_get_version (void)
|
|
{
|
|
- return "3.0.1";
|
|
+ return "3.0.1-p4";
|
|
}
|