summaryrefslogtreecommitdiff
path: root/mpfr-impl.h
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2007-11-05 10:53:21 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2007-11-05 10:53:21 +0000
commita05a39b4b463797762e13dfe9972b5ea19af9467 (patch)
tree6ae00c24966e8964649f324c59397cc902c96f3a /mpfr-impl.h
parentac2087919695fb34f3096b56538d6756d050c6d6 (diff)
downloadmpfr-a05a39b4b463797762e13dfe9972b5ea19af9467.tar.gz
added new macro MPFR_ALIAS
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4947 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'mpfr-impl.h')
-rw-r--r--mpfr-impl.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/mpfr-impl.h b/mpfr-impl.h
index b44ff9b50..212bf572e 100644
--- a/mpfr-impl.h
+++ b/mpfr-impl.h
@@ -954,6 +954,23 @@ do { \
/* Needs <locale.h> */
#define MPFR_DECIMAL_POINT ((unsigned char) localeconv()->decimal_point[0])
+/* Set y to s*significand(x)*2^e, for example MPFR_ALIAS(y,x,1,MPFR_EXP(x))
+ sets y to |x|, and MPFR_ALIAS(y,x,MPFR_SIGN(x),0) sets y to x*2^f such
+ that 1/2 <= |y| < 1. Does not check y is in the valid exponent range.
+ WARNING! x and y share the same mantissa. So, some operations are
+ not valid if x has been provided via an argument, e.g., trying to
+ modify the mantissa of y, even temporarily, or calling mpfr_clear on y.
+*/
+#define MPFR_ALIAS(y,x,s,e) \
+ do \
+ { \
+ MPFR_PREC(y) = MPFR_PREC(x); \
+ MPFR_SIGN(y) = (s); \
+ MPFR_EXP(y) = (e); \
+ MPFR_MANT(y) = MPFR_MANT(x); \
+ } while (0)
+
+
/******************************************************
************** Save exponent macros ****************
******************************************************/