summaryrefslogtreecommitdiff
path: root/sec.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2007-05-28 21:23:23 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2007-05-28 21:23:23 +0000
commita0567033b41a7d01f58f2b557ed351defd2d2756 (patch)
treef10351502914ce3d95e6aa4b6a3d5f919d1bb6b0 /sec.c
parent4c18ec893eb785746066df6c05c6c5886acb4fbb (diff)
downloadmpfr-a0567033b41a7d01f58f2b557ed351defd2d2756.tar.gz
fixed problem of tiny inputs in mpfr_sec and mpfr_csc,
by adding a SPECIAL_TINY macro in gen_inverse.h git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4492 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'sec.c')
-rw-r--r--sec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sec.c b/sec.c
index 11c796adb..2a1ea14f8 100644
--- a/sec.c
+++ b/sec.c
@@ -25,5 +25,10 @@ MA 02110-1301, USA. */
#define ACTION_NAN(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1)
#define ACTION_INF(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1)
#define ACTION_ZERO(y,x) return mpfr_set_ui (y, 1, GMP_RNDN)
+/* for x near 0, sec(x) = 1 + x^2/2 + ..., more precisely |sec(x)-1| < x^2
+ for |x| <= 1. */
+#define ACTION_TINY(y,x,r) \
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT(y, __gmpfr_one, -2 * MPFR_GET_EXP (x), 0, \
+ 1, r, inexact = _inexact; goto end)
#include "gen_inverse.h"