Andreas Enge on Thu, 28 Nov 2013 17:42:39 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [MPFR] Interfacing gmp and mpfr/mpc


With the same participants, we found a bug in the macro version of
mpfr_custom_init_set, which is corrected in the attached patch; the bug
seems to turn all negative numbers into -0.

As a temporary work-around, one may replace in code "mpfr_custom_init_set" by
"(mpfr_custom_init_set)", which forces to call the function with the same name
instead of the macro.

On Wed, Nov 27, 2013 at 10:04:33AM +0100, Vincent Lefevre wrote:
> You shouldn't use the mpfr_ and mpc_ prefixes in the name of your own
> functions, as they are reserved by MPFR and MPC.

Maybe; here, we tried to use the mpfr and mpc naming schemes, using the names
that these libraries would use if they included our functions. As there are
"GEN" and "pari" as parts of most names, there should be little risk of
duplicate definitions (but maybe mpfr_init_set_real could be renamed to
mpfr_init_set_GENr, or it could be made static).

Andreas

diff -r -u mpfr-3.1.2-src.orig/src/mpfr.h mpfr-3.1.2-src/src/mpfr.h
--- mpfr-3.1.2-src.orig/src/mpfr.h	2013-11-28 17:32:10.000000000 +0100
+++ mpfr-3.1.2-src/src/mpfr.h	2013-11-28 17:32:19.000000000 +0100
@@ -861,7 +861,7 @@
     _t = (mpfr_kind_t) _k;                                     \
     _s = 1;                                                    \
   } else {                                                     \
-    _t = (mpfr_kind_t) -k;                                     \
+    _t = (mpfr_kind_t) -_k;                                     \
     _s = -1;                                                   \
   }                                                            \
   _e = _t == MPFR_REGULAR_KIND ? (e) :                         \