mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-23 06:32:23 +00:00
98bc4decde
Signed-off-by: Alexey Neyman <stilor@att.net>
141 lines
3.2 KiB
Diff
141 lines
3.2 KiB
Diff
---
|
|
PATCHES | 1 +
|
|
VERSION | 2 +-
|
|
asin.c | 12 +++++++-----
|
|
mpfr.h | 2 +-
|
|
tests/tasin.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
|
|
version.c | 2 +-
|
|
6 files changed, 55 insertions(+), 8 deletions(-)
|
|
|
|
--- /dev/null
|
|
+++ b/PATCHES
|
|
@@ -0,0 +1 @@
|
|
+asin_exprange
|
|
--- a/VERSION
|
|
+++ b/VERSION
|
|
@@ -1 +1 @@
|
|
-3.0.1
|
|
+3.0.1-p1
|
|
--- a/asin.c
|
|
+++ b/asin.c
|
|
@@ -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);
|
|
--- a/mpfr.h
|
|
+++ b/mpfr.h
|
|
@@ -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-p1"
|
|
|
|
/* Macros dealing with MPFR VERSION */
|
|
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
|
|
--- a/tests/tasin.c
|
|
+++ b/tests/tasin.c
|
|
@@ -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);
|
|
|
|
--- a/version.c
|
|
+++ b/version.c
|
|
@@ -25,5 +25,5 @@
|
|
const char *
|
|
mpfr_get_version (void)
|
|
{
|
|
- return "3.0.1";
|
|
+ return "3.0.1-p1";
|
|
}
|