summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acos.c5
-rw-r--r--tests/tacos.c11
2 files changed, 13 insertions, 3 deletions
diff --git a/acos.c b/acos.c
index 907335197..b30514641 100644
--- a/acos.c
+++ b/acos.c
@@ -19,7 +19,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-
#include "mpfr-impl.h"
int
@@ -50,9 +49,9 @@ mpfr_acos (mpfr_ptr acos, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
MPFR_ASSERTD(MPFR_IS_ZERO(x));
/* acos(0)=Pi/2 */
- mpfr_const_pi (acos, rnd_mode);
+ inexact = mpfr_const_pi (acos, rnd_mode);
MPFR_SET_EXP (acos, MPFR_GET_EXP (acos) - 1);
- return 1; /* inexact */
+ return mpfr_check_range (acos, inexact, rnd_mode);
}
}
MPFR_CLEAR_FLAGS(x);
diff --git a/tests/tacos.c b/tests/tacos.c
index f566de22d..2bbe6ebbb 100644
--- a/tests/tacos.c
+++ b/tests/tacos.c
@@ -32,6 +32,7 @@ static void
special (void)
{
mpfr_t x, y;
+ int inex1, inex2;
mpfr_init2 (x, 32);
mpfr_init2 (y, 32);
@@ -54,6 +55,16 @@ special (void)
mpfr_print_binary (y); printf ("\n");
exit (1);
}
+
+ mpfr_set_prec (x, 2);
+ mpfr_set_ui (x, 0, GMP_RNDN);
+ inex1 = mpfr_acos (x, x, GMP_RNDN); /* Pi/2 */
+ inex2 = mpfr_const_pi (x, GMP_RNDN);
+ if (inex1 != inex2)
+ {
+ printf ("Error in mpfr_acos (3) for prec=2\n");
+ exit (1);
+ }
mpfr_clear (y);
mpfr_clear (x);