summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-12-14 10:54:47 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-12-14 10:54:47 +0000
commitfa276d90124222cbfe5c8cebf366da2ec4393447 (patch)
treec85f519a4c91193639258d9ed32de583db8ab1b6
parentfa7148b432392c6e081ba26bd793f6f4c01c3ef6 (diff)
downloadmpfr-fa276d90124222cbfe5c8cebf366da2ec4393447.tar.gz
Add "MPFR_USE_NO_MACRO" user macro: it allows the user to link
directly with MPFR functions rather than using Macros to access them. It doesn't define MPFR variable inside mpfr.h too. Fix set.c and cmp.c in consequences. Fix mpf2mpfr.h to use mpfr_get_default_rounding_mode () if needed. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3135 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--cmp.c5
-rw-r--r--mpf2mpfr.h107
-rw-r--r--mpfr-impl.h27
-rw-r--r--mpfr.h73
-rw-r--r--set.c14
5 files changed, 131 insertions, 95 deletions
diff --git a/cmp.c b/cmp.c
index 641954b32..36afcd54f 100644
--- a/cmp.c
+++ b/cmp.c
@@ -95,8 +95,9 @@ mpfr_cmp3 (mpfr_srcptr b, mpfr_srcptr c, int s)
return 0;
}
+#undef mpfr_cmp
int
-(mpfr_cmp) (mpfr_srcptr b, mpfr_srcptr c)
+mpfr_cmp (mpfr_srcptr b, mpfr_srcptr c)
{
- return mpfr_cmp(b, c);
+ return mpfr_cmp3 (b, c, 1);
}
diff --git a/mpf2mpfr.h b/mpf2mpfr.h
index fdeac6cb0..40559dde8 100644
--- a/mpf2mpfr.h
+++ b/mpf2mpfr.h
@@ -27,11 +27,18 @@ MA 02111-1307, USA. */
#define mpf_srcptr mpfr_srcptr
#define mpf_ptr mpfr_ptr
+/* Get current Rounding Mode */
+#ifdef MPFR_USE_NO_MACRO
+# define MPFR_DEFAULT_RND mpfr_get_default_rounding_mode ()
+#else
+# define MPFR_DEFAULT_RND __gmpfr_default_rounding_mode
+#endif
+
/* mpf_init initalizes at 0 */
#undef mpf_init
-#define mpf_init(x) mpfr_init_set_ui ((x), 0, __gmpfr_default_rounding_mode)
+#define mpf_init(x) mpfr_init_set_ui ((x), 0, MPFR_DEFAULT_RND)
#undef mpf_init2
-#define mpf_init2(x,p) (mpfr_init2((x),(p)), mpfr_set_ui ((x), 0, __gmpfr_default_rounding_mode))
+#define mpf_init2(x,p) (mpfr_init2((x),(p)), mpfr_set_ui ((x), 0, MPFR_DEFAULT_RND))
/* functions which don't take as argument the rounding mode */
#undef mpf_ceil
@@ -61,7 +68,7 @@ MA 02111-1307, USA. */
#undef mpf_get_default_prec
#define mpf_get_default_prec mpfr_get_default_prec
#undef mpf_set_prec
-#define mpf_set_prec(x,p) mpfr_set_prec(x, p)
+#define mpf_set_prec mpfr_set_prec
#undef mpf_set_prec_raw
#define mpf_set_prec_raw mpfr_set_prec_raw
#undef mpf_trunc
@@ -70,100 +77,96 @@ MA 02111-1307, USA. */
#define mpf_sgn mpfr_sgn
#undef mpf_swap
#define mpf_swap mpfr_swap
+#undef mpf_dump
+#define mpf_dump mpfr_dump
/* functions which take as argument the rounding mode */
#undef mpf_abs
-#define mpf_abs(x,y) mpfr_abs(x,y,__gmpfr_default_rounding_mode)
+#define mpf_abs(x,y) mpfr_abs(x,y,MPFR_DEFAULT_RND)
#undef mpf_add
-#define mpf_add(x,y,z) mpfr_add(x,y,z,__gmpfr_default_rounding_mode)
+#define mpf_add(x,y,z) mpfr_add(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_add_ui
-#define mpf_add_ui(x,y,z) \
- mpfr_add_ui(x,y,z,__gmpfr_default_rounding_mode)
+#define mpf_add_ui(x,y,z) mpfr_add_ui(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_div
-#define mpf_div(x,y,z) mpfr_div(x,y,z,__gmpfr_default_rounding_mode)
+#define mpf_div(x,y,z) mpfr_div(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_div_ui
-#define mpf_div_ui(x,y,z) \
- mpfr_div_ui(x,y,z,__gmpfr_default_rounding_mode)
+#define mpf_div_ui(x,y,z) mpfr_div_ui(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_div_2exp
-#define mpf_div_2exp(x,y,z) \
- mpfr_div_2exp(x,y,z,__gmpfr_default_rounding_mode)
-#undef mpf_dump
-#define mpf_dump(x) mpfr_dump(x)
+#define mpf_div_2exp(x,y,z) mpfr_div_2exp(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_fits_slong_p
-#define mpf_fits_slong_p(x) mpfr_fits_ulong_p(x,__gmpfr_default_rounding_mode)
+#define mpf_fits_slong_p(x) mpfr_fits_ulong_p(x,MPFR_DEFAULT_RND)
#undef mpf_fits_ulong_p
-#define mpf_fits_ulong_p(x) mpfr_fits_ulong_p(x,__gmpfr_default_rounding_mode)
+#define mpf_fits_ulong_p(x) mpfr_fits_ulong_p(x,MPFR_DEFAULT_RND)
#undef mpf_fits_sint_p
-#define mpf_fits_sint_p(x) mpfr_fits_uint_p(x,__gmpfr_default_rounding_mode)
+#define mpf_fits_sint_p(x) mpfr_fits_uint_p(x,MPFR_DEFAULT_RND)
#undef mpf_fits_uint_p
-#define mpf_fits_uint_p(x) mpfr_fits_uint_p(x,__gmpfr_default_rounding_mode)
+#define mpf_fits_uint_p(x) mpfr_fits_uint_p(x,MPFR_DEFAULT_RND)
#undef mpf_fits_sshort_p
-#define mpf_fits_sshort_p(x) mpfr_fits_ushort_p(x,__gmpfr_default_rounding_mode)
+#define mpf_fits_sshort_p(x) mpfr_fits_ushort_p(x,MPFR_DEFAULT_RND)
#undef mpf_fits_ushort_p
-#define mpf_fits_ushort_p(x) mpfr_fits_ushort_p(x,__gmpfr_default_rounding_mode)
+#define mpf_fits_ushort_p(x) mpfr_fits_ushort_p(x,MPFR_DEFAULT_RND)
#undef mpf_get_str
-#define mpf_get_str(x,y,z,t,u) \
- mpfr_get_str(x,y,z,t,u,__gmpfr_default_rounding_mode)
+#define mpf_get_str(x,y,z,t,u) mpfr_get_str(x,y,z,t,u,MPFR_DEFAULT_RND)
#undef mpf_get_d
-#define mpf_get_d(x) mpfr_get_d(x,__gmpfr_default_rounding_mode)
+#define mpf_get_d(x) mpfr_get_d(x,MPFR_DEFAULT_RND)
#undef mpf_get_d_2exp
-#define mpf_get_d_2exp(e,x) mpfr_get_d_2exp(e,x,__gmpfr_default_rounding_mode)
+#define mpf_get_d_2exp(e,x) mpfr_get_d_2exp(e,x,MPFR_DEFAULT_RND)
#undef mpf_get_ui
-#define mpf_get_ui(x) mpfr_get_ui(x,__gmpfr_default_rounding_mode)
+#define mpf_get_ui(x) mpfr_get_ui(x,MPFR_DEFAULT_RND)
#undef mpf_get_si
-#define mpf_get_si(x) mpfr_get_ui(x,__gmpfr_default_rounding_mode)
+#define mpf_get_si(x) mpfr_get_ui(x,MPFR_DEFAULT_RND)
#undef mpf_inp_str
-#define mpf_inp_str(x,y,z) mpfr_inp_str(x,y,z,__gmpfr_default_rounding_mode)
+#define mpf_inp_str(x,y,z) mpfr_inp_str(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_set_str
-#define mpf_set_str(x,y,z) mpfr_set_str(x,y,z,__gmpfr_default_rounding_mode)
+#define mpf_set_str(x,y,z) mpfr_set_str(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_init_set
-#define mpf_init_set(x,y) mpfr_init_set(x,y,__gmpfr_default_rounding_mode)
+#define mpf_init_set(x,y) mpfr_init_set(x,y,MPFR_DEFAULT_RND)
#undef mpf_init_set_d
-#define mpf_init_set_d(x,y) mpfr_init_set_d(x,y,__gmpfr_default_rounding_mode)
+#define mpf_init_set_d(x,y) mpfr_init_set_d(x,y,MPFR_DEFAULT_RND)
#undef mpf_init_set_si
-#define mpf_init_set_si(x,y) mpfr_init_set_si(x,y,__gmpfr_default_rounding_mode)
+#define mpf_init_set_si(x,y) mpfr_init_set_si(x,y,MPFR_DEFAULT_RND)
#undef mpf_init_set_str
-#define mpf_init_set_str(x,y,z) mpfr_init_set_str(x,y,z,__gmpfr_default_rounding_mode)
+#define mpf_init_set_str(x,y,z) mpfr_init_set_str(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_init_set_ui
-#define mpf_init_set_ui(x,y) mpfr_init_set_ui(x,y,__gmpfr_default_rounding_mode)
+#define mpf_init_set_ui(x,y) mpfr_init_set_ui(x,y,MPFR_DEFAULT_RND)
#undef mpf_mul
-#define mpf_mul(x,y,z) mpfr_mul(x,y,z,__gmpfr_default_rounding_mode)
+#define mpf_mul(x,y,z) mpfr_mul(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_mul_2exp
-#define mpf_mul_2exp(x,y,z) mpfr_mul_2exp(x,y,z,__gmpfr_default_rounding_mode)
+#define mpf_mul_2exp(x,y,z) mpfr_mul_2exp(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_mul_ui
-#define mpf_mul_ui(x,y,z) mpfr_mul_ui(x,y,z,__gmpfr_default_rounding_mode)
+#define mpf_mul_ui(x,y,z) mpfr_mul_ui(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_neg
-#define mpf_neg(x,y) mpfr_neg(x,y,__gmpfr_default_rounding_mode)
+#define mpf_neg(x,y) mpfr_neg(x,y,MPFR_DEFAULT_RND)
#undef mpf_out_str
-#define mpf_out_str(x,y,z,t) mpfr_out_str(x,y,z,t,__gmpfr_default_rounding_mode)
+#define mpf_out_str(x,y,z,t) mpfr_out_str(x,y,z,t,MPFR_DEFAULT_RND)
#undef mpf_pow_ui
-#define mpf_pow_ui(x,y,z) mpfr_pow_ui(x,y,z,__gmpfr_default_rounding_mode)
+#define mpf_pow_ui(x,y,z) mpfr_pow_ui(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_reldiff
-#define mpf_reldiff(x,y,z) mpfr_reldiff(x,y,z,__gmpfr_default_rounding_mode)
+#define mpf_reldiff(x,y,z) mpfr_reldiff(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_set
-#define mpf_set(x,y) mpfr_set(x,y,__gmpfr_default_rounding_mode)
+#define mpf_set(x,y) mpfr_set(x,y,MPFR_DEFAULT_RND)
#undef mpf_set_d
-#define mpf_set_d(x,y) mpfr_set_d(x,y,__gmpfr_default_rounding_mode)
+#define mpf_set_d(x,y) mpfr_set_d(x,y,MPFR_DEFAULT_RND)
#undef mpf_set_q
-#define mpf_set_q(x,y) mpfr_set_q(x,y,__gmpfr_default_rounding_mode)
+#define mpf_set_q(x,y) mpfr_set_q(x,y,MPFR_DEFAULT_RND)
#undef mpf_set_si
-#define mpf_set_si(x,y) mpfr_set_si(x,y,__gmpfr_default_rounding_mode)
+#define mpf_set_si(x,y) mpfr_set_si(x,y,MPFR_DEFAULT_RND)
#undef mpf_set_ui
-#define mpf_set_ui(x,y) mpfr_set_ui(x,y,__gmpfr_default_rounding_mode)
+#define mpf_set_ui(x,y) mpfr_set_ui(x,y,MPFR_DEFAULT_RND)
#undef mpf_set_z
-#define mpf_set_z(x,y) mpfr_set_z(x,y,__gmpfr_default_rounding_mode)
+#define mpf_set_z(x,y) mpfr_set_z(x,y,MPFR_DEFAULT_RND)
#undef mpf_sqrt
-#define mpf_sqrt(x,y) mpfr_sqrt(x,y,__gmpfr_default_rounding_mode)
+#define mpf_sqrt(x,y) mpfr_sqrt(x,y,MPFR_DEFAULT_RND)
#undef mpf_sqrt_ui
-#define mpf_sqrt_ui(x,y) mpfr_sqrt_ui(x,y,__gmpfr_default_rounding_mode)
+#define mpf_sqrt_ui(x,y) mpfr_sqrt_ui(x,y,MPFR_DEFAULT_RND)
#undef mpf_sub
-#define mpf_sub(x,y,z) mpfr_sub(x,y,z,__gmpfr_default_rounding_mode)
+#define mpf_sub(x,y,z) mpfr_sub(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_sub_ui
-#define mpf_sub_ui(x,y,z) mpfr_sub_ui(x,y,z,__gmpfr_default_rounding_mode)
+#define mpf_sub_ui(x,y,z) mpfr_sub_ui(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_ui_div
-#define mpf_ui_div(x,y,z) mpfr_ui_div(x,y,z,__gmpfr_default_rounding_mode)
+#define mpf_ui_div(x,y,z) mpfr_ui_div(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_ui_sub
-#define mpf_ui_sub(x,y,z) mpfr_ui_sub(x,y,z,__gmpfr_default_rounding_mode)
+#define mpf_ui_sub(x,y,z) mpfr_ui_sub(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_urandomb
#define mpf_urandomb(x,y,n) mpfr_urandomb(x,y)
diff --git a/mpfr-impl.h b/mpfr-impl.h
index 7c0b8b0b6..f57b271c7 100644
--- a/mpfr-impl.h
+++ b/mpfr-impl.h
@@ -75,6 +75,20 @@ MA 02111-1307, USA. */
# define strncasecmp mpfr_strncasecmp
#endif
+/* Define theses variables if we have built MPFR with
+ MPFR_USE_NO_MACRO (ie mpfr.h doesn't declare them).
+ I don't see any interest to build MPFR with it. */
+#ifdef MPFR_USE_NO_MACRO
+extern unsigned int __gmpfr_flags;
+extern mp_exp_t __gmpfr_emin;
+extern mp_exp_t __gmpfr_emax;
+extern mp_prec_t __gmpfr_default_fp_bit_precision;
+extern mpfr_rnd_t __gmpfr_default_rounding_mode;
+extern mpfr_cache_t __gmpfr_cache_const_pi;
+extern mpfr_cache_t __gmpfr_cache_const_log2;
+extern mpfr_cache_t __gmpfr_cache_const_euler;
+#endif
+
/******************************************************
***************** Detection macros *******************
@@ -575,11 +589,14 @@ extern unsigned char *mpfr_stack;
***************** Cache macros **********************
******************************************************/
-/* Cache Handling */
-#ifdef MPFR_NO_CACHE
-# undef mpfr_const_pi
-# undef mpfr_const_log2
-# undef mpfr_const_euler
+/* Cache Handling: Check if we can use it */
+#undef mpfr_const_pi
+#undef mpfr_const_log2
+#undef mpfr_const_euler
+#ifndef MPFR_NO_CACHE
+# define mpfr_const_pi(_d,_r) mpfr_cache(_d, __gmpfr_cache_const_pi, _r)
+# define mpfr_const_log2(_d,_r) mpfr_cache(_d, __gmpfr_cache_const_log2, _r)
+# define mpfr_const_euler(_d,_r) mpfr_cache(_d, __gmpfr_cache_const_euler, _r)
#endif
#define MPFR_DECL_INIT_CACHE(_cache,_func) \
diff --git a/mpfr.h b/mpfr.h
index 41c3ccc96..5fd07989b 100644
--- a/mpfr.h
+++ b/mpfr.h
@@ -139,14 +139,21 @@ typedef struct __gmpfr_cache_s mpfr_cache_t[1];
+ __GMP_NOTHROW For C++: can't throw .
+ __GMP_EXTERN_INLINE Attribute for inline function.
* __gmp_const const (Supports for K&R compiler only for mpfr.h).
+ + __GMP_DECLSPEC_EXPORT compiling to go into a DLL
+ + __GMP_DECLSPEC_IMPORT compiling to go into a application
*/
/* Extra MPFR defines */
#define __MPFR_SENTINEL_ATTR
+#define __MPFR_THREAD_ATTR
#if defined (__GNUC__)
# if __GNUC__ >= 4
-# undef __MPFR_SENTINEL_ATTR
-# define __MPFR_SENTINEL_ATTR __attribute__ ((sentinel))
-# endif
+# undef __MPFR_SENTINEL_ATTR
+# define __MPFR_SENTINEL_ATTR __attribute__ ((sentinel))
+# endif
+# if (__GNUC__*10+__GNUC_MINOR__) >= 33
+# undef __MPFR_THREAD_ATTR
+# define __MPFR_THREAD_ATTR __thread
+# endif
#endif
/* Prototypes: Support of K&R compiler */
@@ -162,7 +169,8 @@ typedef struct __gmpfr_cache_s mpfr_cache_t[1];
#if defined (__cplusplus)
extern "C" {
#endif
-
+
+#ifndef MPFR_USE_NO_MACRO
extern unsigned int __gmpfr_flags;
extern mp_exp_t __gmpfr_emin;
extern mp_exp_t __gmpfr_emax;
@@ -171,6 +179,7 @@ extern mpfr_rnd_t __gmpfr_default_rounding_mode;
extern mpfr_cache_t __gmpfr_cache_const_pi;
extern mpfr_cache_t __gmpfr_cache_const_log2;
extern mpfr_cache_t __gmpfr_cache_const_euler;
+#endif
__gmp_const char * mpfr_get_version _MPFR_PROTO ((void));
@@ -473,8 +482,12 @@ int mpfr_strtofr _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, char **,
mp_limb_t __gmpfr_local_tab_##_x[((_p)-1)/GMP_NUMB_BITS+1]; \
mpfr_t _x = {{(_p),1,__MPFR_EXP_NAN,__gmpfr_local_tab_##_x}}
-/* Fast MACROS for theses functions
- WARNING: We must still define the functions! */
+/* Fast access macros to replace function interface.
+ If the USER don't want to use the macro interface, let him make happy
+ even if it produces faster and smaller code. */
+#ifndef MPFR_USE_NO_MACRO
+
+/* Inlining theses functions is both faster and smaller */
#define mpfr_nan_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_NAN)
#define mpfr_inf_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_INF)
#define mpfr_zero_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_ZERO)
@@ -529,32 +542,10 @@ int mpfr_strtofr _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, char **,
#define mpfr_mul_2exp(y,x,n,r) mpfr_mul_2ui((y),(x),(n),(r))
#define mpfr_div_2exp(y,x,n,r) mpfr_div_2ui((y),(x),(n),(r))
-#define mpfr_init_set_si(x, i, rnd) \
- ( mpfr_init(x), mpfr_set_si((x), (i), (rnd)) )
-#define mpfr_init_set_ui(x, i, rnd) \
- ( mpfr_init(x), mpfr_set_ui((x), (i), (rnd)) )
-#define mpfr_init_set_d(x, d, rnd) \
- ( mpfr_init(x), mpfr_set_d((x), (d), (rnd)) )
-#define mpfr_init_set_z(x, i, rnd) \
- ( mpfr_init(x), mpfr_set_z((x), (i), (rnd)) )
-#define mpfr_init_set_q(x, i, rnd) \
- ( mpfr_init(x), mpfr_set_q((x), (i), (rnd)) )
-#define mpfr_init_set(x, y, rnd) \
- ( mpfr_init(x), mpfr_set((x), (y), (rnd)) )
-#define mpfr_init_set_f(x, y, rnd) \
- ( mpfr_init(x), mpfr_set_f((x), (y), (rnd)) )
-
-#define mpfr_version (mpfr_get_version())
-
-#ifndef mpz_set_fr
-# define mpz_set_fr mpfr_get_z
-#endif
-
/* When using GCC, optimize certain common comparisons and affectations.
+ Remove ICC since it defines __GNUC__ but produces a
- huge number of warnings if you use this code
- + Remove C++ too, since it complains too much...
- FIXME: Use __extension__? */
+ huge number of warnings if you use this code.
+ + Remove C++ too, since it complains too much. */
#if defined (__GNUC__) && !defined(__ICC) && !defined(__cplusplus)
#if (__GNUC__ >= 2)
#undef mpfr_cmp_ui
@@ -581,6 +572,24 @@ int mpfr_strtofr _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, char **,
#endif
#endif
+#endif /* MPFR_NO_MACRO */
+
+/* Theses are defined to be macros */
+#define mpfr_init_set_si(x, i, rnd) \
+ ( mpfr_init(x), mpfr_set_si((x), (i), (rnd)) )
+#define mpfr_init_set_ui(x, i, rnd) \
+ ( mpfr_init(x), mpfr_set_ui((x), (i), (rnd)) )
+#define mpfr_init_set_d(x, d, rnd) \
+ ( mpfr_init(x), mpfr_set_d((x), (d), (rnd)) )
+#define mpfr_init_set_z(x, i, rnd) \
+ ( mpfr_init(x), mpfr_set_z((x), (i), (rnd)) )
+#define mpfr_init_set_q(x, i, rnd) \
+ ( mpfr_init(x), mpfr_set_q((x), (i), (rnd)) )
+#define mpfr_init_set(x, y, rnd) \
+ ( mpfr_init(x), mpfr_set((x), (y), (rnd)) )
+#define mpfr_init_set_f(x, y, rnd) \
+ ( mpfr_init(x), mpfr_set_f((x), (y), (rnd)) )
+
/* Compatibility layer -- obsolete functions and macros */
#define mpfr_cmp_abs mpfr_cmpabs
#define mpfr_round_prec(x,r,p) mpfr_prec_round(x,p,r)
@@ -593,5 +602,9 @@ int mpfr_strtofr _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, char **,
#define MPFR_EMIN_MAX mpfr_get_emin_max()
#define MPFR_EMAX_MIN mpfr_get_emax_min()
#define MPFR_EMAX_MAX mpfr_get_emax_max()
+#define mpfr_version (mpfr_get_version())
+#ifndef mpz_set_fr
+# define mpz_set_fr mpfr_get_z
+#endif
#endif /* __MPFR_H*/
diff --git a/set.c b/set.c
index bf9ed15a6..851d66b59 100644
--- a/set.c
+++ b/set.c
@@ -63,16 +63,18 @@ mpfr_set4 (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode, int signb)
}
}
-/* Set a to b (Define function which calls the macro) */
+/* Set a to b */
+#undef mpfr_set
int
-(mpfr_set) (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode)
+mpfr_set (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode)
{
- return mpfr_set (a, b, rnd_mode);
+ return mpfr_set4 (a, b, rnd_mode, MPFR_SIGN (b));
}
-/* Set a to |b| (Define function which calls the macro) */
+/* Set a to |b| */
+#undef mpfr_abs
int
-(mpfr_abs) (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode)
+mpfr_abs (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode)
{
- return mpfr_abs (a, b, rnd_mode);
+ return mpfr_set4 (a, b, rnd_mode, MPFR_SIGN_POS);
}