summaryrefslogtreecommitdiff
path: root/Build/source/libs/mpfr/mpfr-src/src/mpfr.h
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/mpfr/mpfr-src/src/mpfr.h')
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpfr.h1122
1 files changed, 603 insertions, 519 deletions
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr.h
index 6dba95f2743..4b71733d862 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpfr.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr.h
@@ -24,32 +24,32 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#define __MPFR_H
/* Define MPFR version number */
-#define MPFR_VERSION_MAJOR 3
-#define MPFR_VERSION_MINOR 1
-#define MPFR_VERSION_PATCHLEVEL 6
-#define MPFR_VERSION_STRING "3.1.6"
+#define MPFR_VERSION_MAJOR 4
+#define MPFR_VERSION_MINOR 0
+#define MPFR_VERSION_PATCHLEVEL 0
+#define MPFR_VERSION_STRING "4.0.0"
+
+/* User macros:
+ MPFR_USE_FILE: Define it to make MPFR define functions dealing
+ with FILE* (auto-detect).
+ MPFR_USE_INTMAX_T: Define it to make MPFR define functions dealing
+ with intmax_t (auto-detect).
+ MPFR_USE_VA_LIST: Define it to make MPFR define functions dealing
+ with va_list (auto-detect).
+ MPFR_USE_C99_FEATURE: Define it to 1 to make MPFR support C99-feature
+ (auto-detect), to 0 to bypass the detection.
+ MPFR_USE_EXTENSION: Define it to make MPFR use GCC extension to
+ reduce warnings.
+ MPFR_USE_NO_MACRO: Define it to make MPFR remove any overriding
+ function macro.
+*/
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
#define MPFR_VERSION \
MPFR_VERSION_NUM(MPFR_VERSION_MAJOR,MPFR_VERSION_MINOR,MPFR_VERSION_PATCHLEVEL)
-/* Check if GMP is included, and try to include it (Works with local GMP) */
-#ifndef __GMP_H__
-# include <gmp.h>
-#endif
-
-/* GMP's internal __gmp_const macro has been removed on 2012-03-04:
- http://gmplib.org:8000/gmp/rev/d287cfaf6732
- const is standard and now assumed to be available. If the __gmp_const
- definition is no longer present in GMP, this probably means that GMP
- assumes that const is available; thus let's define it to const.
- Note: this is a temporary fix that can be backported to previous MPFR
- versions. In the future, __gmp_const should be replaced by const like
- in GMP. */
-#ifndef __gmp_const
-# define __gmp_const const
-#endif
+#include <gmp.h>
/* Avoid some problems with macro expansion if the user defines macros
with the same name as keywords. By convention, identifiers and macro
@@ -61,6 +61,28 @@ typedef long mpfr_long;
typedef unsigned long mpfr_ulong;
typedef size_t mpfr_size_t;
+/* Global (possibly TLS) flags. Might also be used in an mpfr_t in the
+ future (there would be room as mpfr_sign_t just needs 1 byte).
+ TODO: The tests currently assume that the flags fits in an unsigned int;
+ this should be cleaned up, e.g. by defining a function that outputs the
+ flags as a string or by using the flags_out function (from tests/tests.c
+ directly). */
+typedef unsigned int mpfr_flags_t;
+
+/* Flags macros (in the public API) */
+#define MPFR_FLAGS_UNDERFLOW 1
+#define MPFR_FLAGS_OVERFLOW 2
+#define MPFR_FLAGS_NAN 4
+#define MPFR_FLAGS_INEXACT 8
+#define MPFR_FLAGS_ERANGE 16
+#define MPFR_FLAGS_DIVBY0 32
+#define MPFR_FLAGS_ALL (MPFR_FLAGS_UNDERFLOW | \
+ MPFR_FLAGS_OVERFLOW | \
+ MPFR_FLAGS_NAN | \
+ MPFR_FLAGS_INEXACT | \
+ MPFR_FLAGS_ERANGE | \
+ MPFR_FLAGS_DIVBY0)
+
/* Definition of rounding modes (DON'T USE MPFR_RNDNA!).
Warning! Changing the contents of this enum should be seen as an
interface change since the old and the new types are not compatible
@@ -70,9 +92,6 @@ typedef size_t mpfr_size_t;
MPFR_RNDU must appear just before MPFR_RNDD (see
MPFR_IS_RNDUTEST_OR_RNDDNOTTEST in mpfr-impl.h).
- MPFR_RNDF has been added, though not implemented yet, in order to avoid
- to break the ABI once faithful rounding gets implemented.
-
If you change the order of the rounding modes, please update the routines
in texceptions.c which assume 0=RNDN, 1=RNDZ, 2=RNDU, 3=RNDD, 4=RNDA.
*/
@@ -82,7 +101,7 @@ typedef enum {
MPFR_RNDU, /* round toward +Inf */
MPFR_RNDD, /* round toward -Inf */
MPFR_RNDA, /* round away from zero */
- MPFR_RNDF, /* faithful rounding (not implemented yet) */
+ MPFR_RNDF, /* faithful rounding */
MPFR_RNDNA=-1 /* round to nearest, with ties away from zero (mpfr_round) */
} mpfr_rnd_t;
@@ -98,7 +117,7 @@ typedef enum {
/* Define precision: 1 (short), 2 (int) or 3 (long) (DON'T USE IT!) */
#ifndef _MPFR_PREC_FORMAT
-# if __GMP_MP_SIZE_T_INT == 1
+# if __GMP_MP_SIZE_T_INT
# define _MPFR_PREC_FORMAT 2
# else
# define _MPFR_PREC_FORMAT 3
@@ -132,10 +151,13 @@ typedef unsigned long mpfr_uprec_t;
#endif
/* Definition of precision limits without needing <limits.h> */
-/* Note: the casts allows the expression to yield the wanted behavior
- for _MPFR_PREC_FORMAT == 1 (due to integer promotion rules). */
-#define MPFR_PREC_MIN 2
-#define MPFR_PREC_MAX ((mpfr_prec_t)((mpfr_uprec_t)(~(mpfr_uprec_t)0)>>1))
+/* Note: The casts allows the expression to yield the wanted behavior
+ for _MPFR_PREC_FORMAT == 1 (due to integer promotion rules). We
+ also make sure that MPFR_PREC_MIN and MPFR_PREC_MAX have a signed
+ integer type. The "- 256" allows more security, avoiding some
+ integer overflows in extreme cases; ideally it should be useless. */
+#define MPFR_PREC_MIN 1
+#define MPFR_PREC_MAX ((mpfr_prec_t) ((((mpfr_uprec_t) -1) >> 1) - 256))
/* Definition of sign */
typedef int mpfr_sign_t;
@@ -167,7 +189,11 @@ typedef uintmax_t mpfr_uexp_t;
/* DON'T USE THIS! (For MPFR-public macros only, see below.)
The mpfr_sgn macro uses the fact that __MPFR_EXP_NAN and __MPFR_EXP_ZERO
- are the smallest values. */
+ are the smallest values. For a n-bit type, EXP_MAX is 2^(n-1)-1,
+ EXP_ZERO is 1-2^(n-1), EXP_NAN is 2-2^(n-1), EXP_INF is 3-2^(n-1).
+ This may change in the future. MPFR code should not be based on these
+ representations (but if this is absolutely needed, protect the code
+ with a static assertion). */
#define __MPFR_EXP_MAX ((mpfr_exp_t) (((mpfr_uexp_t) -1) >> 1))
#define __MPFR_EXP_NAN (1 - __MPFR_EXP_MAX)
#define __MPFR_EXP_ZERO (0 - __MPFR_EXP_MAX)
@@ -202,7 +228,7 @@ typedef struct {
typedef __mpfr_struct mpfr_t[1];
typedef __mpfr_struct *mpfr_ptr;
-typedef __gmp_const __mpfr_struct *mpfr_srcptr;
+typedef const __mpfr_struct *mpfr_srcptr;
/* For those who need a direct and fast access to the sign field.
However it is not in the API, thus use it at your own risk: it might
@@ -214,16 +240,22 @@ typedef __gmp_const __mpfr_struct *mpfr_srcptr;
/* Stack interface */
typedef enum {
- MPFR_NAN_KIND = 0,
- MPFR_INF_KIND = 1, MPFR_ZERO_KIND = 2, MPFR_REGULAR_KIND = 3
+ MPFR_NAN_KIND = 0,
+ MPFR_INF_KIND = 1,
+ MPFR_ZERO_KIND = 2,
+ MPFR_REGULAR_KIND = 3
} mpfr_kind_t;
+/* Free cache policy */
+typedef enum {
+ MPFR_FREE_LOCAL_CACHE = 1, /* 1 << 0 */
+ MPFR_FREE_GLOBAL_CACHE = 2 /* 1 << 1 */
+} mpfr_free_cache_t;
+
/* GMP defines:
+ size_t: Standard size_t
- + __GMP_ATTRIBUTE_PURE Attribute for math functions.
+ __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
*/
@@ -236,25 +268,59 @@ typedef enum {
# endif
#endif
-/* Prototypes: Support of K&R compiler */
-#if defined (__GMP_PROTO)
-# define _MPFR_PROTO __GMP_PROTO
-#elif defined (__STDC__) || defined (__cplusplus)
-# define _MPFR_PROTO(x) x
-#else
-# define _MPFR_PROTO(x) ()
+/* If the user hasn't requested his/her preference
+ and if the intension of support by the compiler is C99
+ and if the compiler is known to support the C99 feature
+ then we can auto-detect the C99 support as OK.
+ __GNUC__ is used to detect GNU-C, ICC & CLANG compilers.
+ Currently we need only variadic macros, and they are present
+ since GCC >= 3. We don't test library version since we don't
+ use any feature present in the library too (except intmax_t,
+ but they use another detection).*/
+#ifndef MPFR_USE_C99_FEATURE
+# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+# if defined (__GNUC__)
+# if __GNUC__ >= 3
+# define MPFR_USE_C99_FEATURE 1
+# endif
+# endif
+# endif
+# ifndef MPFR_USE_C99_FEATURE
+# define MPFR_USE_C99_FEATURE 0
+# endif
#endif
+
/* Support for WINDOWS Dll:
Check if we are inside a MPFR build, and if so export the functions.
Otherwise does the same thing as GMP */
#if defined(__MPFR_WITHIN_MPFR) && __GMP_LIBGMP_DLL
# define __MPFR_DECLSPEC __GMP_DECLSPEC_EXPORT
#else
+# ifndef __GMP_DECLSPEC
+# define __GMP_DECLSPEC
+# endif
# define __MPFR_DECLSPEC __GMP_DECLSPEC
#endif
/* Use MPFR_DEPRECATED to mark MPFR functions, types or variables as
- deprecated. Code inspired by Apache Subversion's svn_types.h file. */
+ deprecated. Code inspired by Apache Subversion's svn_types.h file.
+ For compatibility with MSVC, MPFR_DEPRECATED must be put before
+ __MPFR_DECLSPEC (not at the end of the function declaration as
+ documented in the GCC manual); GCC does not seem to care.
+ Moreover, in order to avoid a warning when testing such functions,
+ do something like:
+ +------------------------------------------
+ |#ifndef _MPFR_NO_DEPRECATED_funcname
+ |MPFR_DEPRECATED
+ |#endif
+ |__MPFR_DECLSPEC int mpfr_funcname (...);
+ +------------------------------------------
+ and in the corresponding test program:
+ +------------------------------------------
+ |#define _MPFR_NO_DEPRECATED_funcname
+ |#include "mpfr-test.h"
+ +------------------------------------------
+*/
#if defined(__GNUC__) && \
(__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
# define MPFR_DEPRECATED __attribute__ ((deprecated))
@@ -263,6 +329,11 @@ typedef enum {
#else
# define MPFR_DEPRECATED
#endif
+/* TODO: Also define MPFR_EXPERIMENTAL for experimental functions?
+ See SVN_EXPERIMENTAL in Subversion 1.9+ as an example:
+ __attribute__((warning("..."))) can be used with GCC 4.3.1+ but
+ not __llvm__, and __declspec(deprecated("...")) can be used with
+ MSC as above. */
/* Note: In order to be declared, some functions need a specific
system header to be included *before* "mpfr.h". If the user
@@ -276,451 +347,415 @@ typedef enum {
extern "C" {
#endif
-__MPFR_DECLSPEC __gmp_const char * mpfr_get_version _MPFR_PROTO ((void));
-__MPFR_DECLSPEC __gmp_const char * mpfr_get_patches _MPFR_PROTO ((void));
-__MPFR_DECLSPEC int mpfr_buildopt_tls_p _MPFR_PROTO ((void));
-__MPFR_DECLSPEC int mpfr_buildopt_decimal_p _MPFR_PROTO ((void));
-__MPFR_DECLSPEC int mpfr_buildopt_gmpinternals_p _MPFR_PROTO ((void));
-__MPFR_DECLSPEC __gmp_const char * mpfr_buildopt_tune_case _MPFR_PROTO ((void));
-
-__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin _MPFR_PROTO ((void));
-__MPFR_DECLSPEC int mpfr_set_emin _MPFR_PROTO ((mpfr_exp_t));
-__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_min _MPFR_PROTO ((void));
-__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_max _MPFR_PROTO ((void));
-__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax _MPFR_PROTO ((void));
-__MPFR_DECLSPEC int mpfr_set_emax _MPFR_PROTO ((mpfr_exp_t));
-__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_min _MPFR_PROTO ((void));
-__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_max _MPFR_PROTO ((void));
-
-__MPFR_DECLSPEC void mpfr_set_default_rounding_mode _MPFR_PROTO((mpfr_rnd_t));
-__MPFR_DECLSPEC mpfr_rnd_t mpfr_get_default_rounding_mode _MPFR_PROTO((void));
-__MPFR_DECLSPEC __gmp_const char *
- mpfr_print_rnd_mode _MPFR_PROTO((mpfr_rnd_t));
-
-__MPFR_DECLSPEC void mpfr_clear_flags _MPFR_PROTO ((void));
-__MPFR_DECLSPEC void mpfr_clear_underflow _MPFR_PROTO ((void));
-__MPFR_DECLSPEC void mpfr_clear_overflow _MPFR_PROTO ((void));
-__MPFR_DECLSPEC void mpfr_clear_divby0 _MPFR_PROTO ((void));
-__MPFR_DECLSPEC void mpfr_clear_nanflag _MPFR_PROTO ((void));
-__MPFR_DECLSPEC void mpfr_clear_inexflag _MPFR_PROTO ((void));
-__MPFR_DECLSPEC void mpfr_clear_erangeflag _MPFR_PROTO ((void));
-
-__MPFR_DECLSPEC void mpfr_set_underflow _MPFR_PROTO ((void));
-__MPFR_DECLSPEC void mpfr_set_overflow _MPFR_PROTO ((void));
-__MPFR_DECLSPEC void mpfr_set_divby0 _MPFR_PROTO ((void));
-__MPFR_DECLSPEC void mpfr_set_nanflag _MPFR_PROTO ((void));
-__MPFR_DECLSPEC void mpfr_set_inexflag _MPFR_PROTO ((void));
-__MPFR_DECLSPEC void mpfr_set_erangeflag _MPFR_PROTO ((void));
-
-__MPFR_DECLSPEC int mpfr_underflow_p _MPFR_PROTO ((void));
-__MPFR_DECLSPEC int mpfr_overflow_p _MPFR_PROTO ((void));
-__MPFR_DECLSPEC int mpfr_divby0_p _MPFR_PROTO ((void));
-__MPFR_DECLSPEC int mpfr_nanflag_p _MPFR_PROTO ((void));
-__MPFR_DECLSPEC int mpfr_inexflag_p _MPFR_PROTO ((void));
-__MPFR_DECLSPEC int mpfr_erangeflag_p _MPFR_PROTO ((void));
-
-__MPFR_DECLSPEC int
- mpfr_check_range _MPFR_PROTO ((mpfr_ptr, int, mpfr_rnd_t));
-
-__MPFR_DECLSPEC void mpfr_init2 _MPFR_PROTO ((mpfr_ptr, mpfr_prec_t));
-__MPFR_DECLSPEC void mpfr_init _MPFR_PROTO ((mpfr_ptr));
-__MPFR_DECLSPEC void mpfr_clear _MPFR_PROTO ((mpfr_ptr));
+__MPFR_DECLSPEC const char * mpfr_get_version (void);
+__MPFR_DECLSPEC const char * mpfr_get_patches (void);
+__MPFR_DECLSPEC int mpfr_buildopt_tls_p (void);
+__MPFR_DECLSPEC int mpfr_buildopt_float128_p (void);
+__MPFR_DECLSPEC int mpfr_buildopt_decimal_p (void);
+__MPFR_DECLSPEC int mpfr_buildopt_gmpinternals_p (void);
+__MPFR_DECLSPEC int mpfr_buildopt_sharedcache_p (void);
+__MPFR_DECLSPEC const char * mpfr_buildopt_tune_case (void);
+
+__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin (void);
+__MPFR_DECLSPEC int mpfr_set_emin (mpfr_exp_t);
+__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_min (void);
+__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_max (void);
+__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax (void);
+__MPFR_DECLSPEC int mpfr_set_emax (mpfr_exp_t);
+__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_min (void);
+__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_max (void);
+
+__MPFR_DECLSPEC void mpfr_set_default_rounding_mode (mpfr_rnd_t);
+__MPFR_DECLSPEC mpfr_rnd_t mpfr_get_default_rounding_mode (void);
+__MPFR_DECLSPEC const char * mpfr_print_rnd_mode (mpfr_rnd_t);
+
+__MPFR_DECLSPEC void mpfr_clear_flags (void);
+__MPFR_DECLSPEC void mpfr_clear_underflow (void);
+__MPFR_DECLSPEC void mpfr_clear_overflow (void);
+__MPFR_DECLSPEC void mpfr_clear_divby0 (void);
+__MPFR_DECLSPEC void mpfr_clear_nanflag (void);
+__MPFR_DECLSPEC void mpfr_clear_inexflag (void);
+__MPFR_DECLSPEC void mpfr_clear_erangeflag (void);
+
+__MPFR_DECLSPEC void mpfr_set_underflow (void);
+__MPFR_DECLSPEC void mpfr_set_overflow (void);
+__MPFR_DECLSPEC void mpfr_set_divby0 (void);
+__MPFR_DECLSPEC void mpfr_set_nanflag (void);
+__MPFR_DECLSPEC void mpfr_set_inexflag (void);
+__MPFR_DECLSPEC void mpfr_set_erangeflag (void);
+
+__MPFR_DECLSPEC int mpfr_underflow_p (void);
+__MPFR_DECLSPEC int mpfr_overflow_p (void);
+__MPFR_DECLSPEC int mpfr_divby0_p (void);
+__MPFR_DECLSPEC int mpfr_nanflag_p (void);
+__MPFR_DECLSPEC int mpfr_inexflag_p (void);
+__MPFR_DECLSPEC int mpfr_erangeflag_p (void);
+
+__MPFR_DECLSPEC void mpfr_flags_clear (mpfr_flags_t);
+__MPFR_DECLSPEC void mpfr_flags_set (mpfr_flags_t);
+__MPFR_DECLSPEC mpfr_flags_t mpfr_flags_test (mpfr_flags_t);
+__MPFR_DECLSPEC mpfr_flags_t mpfr_flags_save (void);
+__MPFR_DECLSPEC void mpfr_flags_restore (mpfr_flags_t,
+ mpfr_flags_t);
+
+__MPFR_DECLSPEC int mpfr_check_range (mpfr_ptr, int, mpfr_rnd_t);
+
+__MPFR_DECLSPEC void mpfr_init2 (mpfr_ptr, mpfr_prec_t);
+__MPFR_DECLSPEC void mpfr_init (mpfr_ptr);
+__MPFR_DECLSPEC void mpfr_clear (mpfr_ptr);
__MPFR_DECLSPEC void
- mpfr_inits2 _MPFR_PROTO ((mpfr_prec_t, mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR;
+ mpfr_inits2 (mpfr_prec_t, mpfr_ptr, ...) __MPFR_SENTINEL_ATTR;
__MPFR_DECLSPEC void
- mpfr_inits _MPFR_PROTO ((mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR;
+ mpfr_inits (mpfr_ptr, ...) __MPFR_SENTINEL_ATTR;
__MPFR_DECLSPEC void
- mpfr_clears _MPFR_PROTO ((mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR;
-
-__MPFR_DECLSPEC int
- mpfr_prec_round _MPFR_PROTO ((mpfr_ptr, mpfr_prec_t, mpfr_rnd_t));
-__MPFR_DECLSPEC int
- mpfr_can_round _MPFR_PROTO ((mpfr_srcptr, mpfr_exp_t, mpfr_rnd_t, mpfr_rnd_t,
- mpfr_prec_t));
-__MPFR_DECLSPEC mpfr_prec_t mpfr_min_prec _MPFR_PROTO ((mpfr_srcptr));
-
-__MPFR_DECLSPEC mpfr_exp_t mpfr_get_exp _MPFR_PROTO ((mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_set_exp _MPFR_PROTO ((mpfr_ptr, mpfr_exp_t));
-__MPFR_DECLSPEC mpfr_prec_t mpfr_get_prec _MPFR_PROTO((mpfr_srcptr));
-__MPFR_DECLSPEC void mpfr_set_prec _MPFR_PROTO((mpfr_ptr, mpfr_prec_t));
-__MPFR_DECLSPEC void mpfr_set_prec_raw _MPFR_PROTO((mpfr_ptr, mpfr_prec_t));
-__MPFR_DECLSPEC void mpfr_set_default_prec _MPFR_PROTO((mpfr_prec_t));
-__MPFR_DECLSPEC mpfr_prec_t mpfr_get_default_prec _MPFR_PROTO((void));
-
-__MPFR_DECLSPEC int mpfr_set_d _MPFR_PROTO ((mpfr_ptr, double, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_set_flt _MPFR_PROTO ((mpfr_ptr, float, mpfr_rnd_t));
+ mpfr_clears (mpfr_ptr, ...) __MPFR_SENTINEL_ATTR;
+
+__MPFR_DECLSPEC int mpfr_prec_round (mpfr_ptr, mpfr_prec_t, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_can_round (mpfr_srcptr, mpfr_exp_t, mpfr_rnd_t,
+ mpfr_rnd_t, mpfr_prec_t);
+__MPFR_DECLSPEC mpfr_prec_t mpfr_min_prec (mpfr_srcptr);
+
+__MPFR_DECLSPEC mpfr_exp_t mpfr_get_exp (mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_set_exp (mpfr_ptr, mpfr_exp_t);
+__MPFR_DECLSPEC mpfr_prec_t mpfr_get_prec (mpfr_srcptr);
+__MPFR_DECLSPEC void mpfr_set_prec (mpfr_ptr, mpfr_prec_t);
+__MPFR_DECLSPEC void mpfr_set_prec_raw (mpfr_ptr, mpfr_prec_t);
+__MPFR_DECLSPEC void mpfr_set_default_prec (mpfr_prec_t);
+__MPFR_DECLSPEC mpfr_prec_t mpfr_get_default_prec (void);
+
+__MPFR_DECLSPEC int mpfr_set_d (mpfr_ptr, double, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_set_flt (mpfr_ptr, float, mpfr_rnd_t);
#ifdef MPFR_WANT_DECIMAL_FLOATS
-__MPFR_DECLSPEC int mpfr_set_decimal64 _MPFR_PROTO ((mpfr_ptr, _Decimal64,
- mpfr_rnd_t));
+/* _Decimal64 is not defined in C++,
+ cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51364 */
+__MPFR_DECLSPEC int mpfr_set_decimal64 (mpfr_ptr, _Decimal64, mpfr_rnd_t);
+#endif
+__MPFR_DECLSPEC int mpfr_set_ld (mpfr_ptr, long double, mpfr_rnd_t);
+#ifdef MPFR_WANT_FLOAT128
+__MPFR_DECLSPEC int mpfr_set_float128 (mpfr_ptr, __float128, mpfr_rnd_t);
+__MPFR_DECLSPEC __float128 mpfr_get_float128 (mpfr_srcptr, mpfr_rnd_t);
#endif
-__MPFR_DECLSPEC int
- mpfr_set_ld _MPFR_PROTO ((mpfr_ptr, long double, mpfr_rnd_t));
-__MPFR_DECLSPEC int
- mpfr_set_z _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int
- mpfr_set_z_2exp _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, mpfr_exp_t, mpfr_rnd_t));
-__MPFR_DECLSPEC void mpfr_set_nan _MPFR_PROTO ((mpfr_ptr));
-__MPFR_DECLSPEC void mpfr_set_inf _MPFR_PROTO ((mpfr_ptr, int));
-__MPFR_DECLSPEC void mpfr_set_zero _MPFR_PROTO ((mpfr_ptr, int));
-__MPFR_DECLSPEC int
- mpfr_set_f _MPFR_PROTO ((mpfr_ptr, mpf_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int
- mpfr_get_f _MPFR_PROTO ((mpf_ptr, mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_set_si _MPFR_PROTO ((mpfr_ptr, long, mpfr_rnd_t));
-__MPFR_DECLSPEC int
- mpfr_set_ui _MPFR_PROTO ((mpfr_ptr, unsigned long, mpfr_rnd_t));
-__MPFR_DECLSPEC int
- mpfr_set_si_2exp _MPFR_PROTO ((mpfr_ptr, long, mpfr_exp_t, mpfr_rnd_t));
-__MPFR_DECLSPEC int
- mpfr_set_ui_2exp _MPFR_PROTO ((mpfr_ptr,unsigned long,mpfr_exp_t,mpfr_rnd_t));
-__MPFR_DECLSPEC int
- mpfr_set_q _MPFR_PROTO ((mpfr_ptr, mpq_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int
- mpfr_set_str _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, int, mpfr_rnd_t));
-__MPFR_DECLSPEC int
- mpfr_init_set_str _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, int,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int
- mpfr_set4 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t, int));
-__MPFR_DECLSPEC int
- mpfr_abs _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int
- mpfr_set _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_neg _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_signbit _MPFR_PROTO ((mpfr_srcptr));
-__MPFR_DECLSPEC int
- mpfr_setsign _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, int, mpfr_rnd_t));
-__MPFR_DECLSPEC int
- mpfr_copysign _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t));
-
-__MPFR_DECLSPEC mpfr_exp_t mpfr_get_z_2exp _MPFR_PROTO ((mpz_ptr, mpfr_srcptr));
-__MPFR_DECLSPEC float mpfr_get_flt _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC double mpfr_get_d _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_set_z (mpfr_ptr, mpz_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_set_z_2exp (mpfr_ptr, mpz_srcptr, mpfr_exp_t,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC void mpfr_set_nan (mpfr_ptr);
+__MPFR_DECLSPEC void mpfr_set_inf (mpfr_ptr, int);
+__MPFR_DECLSPEC void mpfr_set_zero (mpfr_ptr, int);
+
+#ifndef MPFR_USE_MINI_GMP
+ /* mini-gmp does not provide mpf_t, we disable the following functions */
+__MPFR_DECLSPEC int mpfr_set_f (mpfr_ptr, mpf_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_cmp_f (mpfr_srcptr, mpf_srcptr);
+__MPFR_DECLSPEC int mpfr_get_f (mpf_ptr, mpfr_srcptr, mpfr_rnd_t);
+#endif
+__MPFR_DECLSPEC int mpfr_set_si (mpfr_ptr, long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_set_ui (mpfr_ptr, unsigned long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_set_si_2exp (mpfr_ptr, long, mpfr_exp_t, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_set_ui_2exp (mpfr_ptr, unsigned long, mpfr_exp_t,
+ mpfr_rnd_t);
+#ifndef MPFR_USE_MINI_GMP
+ /* mini-gmp does not provide mpq_t, we disable the following functions */
+__MPFR_DECLSPEC int mpfr_set_q (mpfr_ptr, mpq_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_mul_q (mpfr_ptr, mpfr_srcptr, mpq_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_div_q (mpfr_ptr, mpfr_srcptr, mpq_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_add_q (mpfr_ptr, mpfr_srcptr, mpq_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_sub_q (mpfr_ptr, mpfr_srcptr, mpq_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_cmp_q (mpfr_srcptr, mpq_srcptr);
+__MPFR_DECLSPEC void mpfr_get_q (mpq_ptr q, mpfr_srcptr f);
+#endif
+__MPFR_DECLSPEC int mpfr_set_str (mpfr_ptr, const char *, int, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_init_set_str (mpfr_ptr, const char *, int,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_set4 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t, int);
+__MPFR_DECLSPEC int mpfr_abs (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_set (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_neg (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_signbit (mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_setsign (mpfr_ptr, mpfr_srcptr, int, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_copysign (mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
+ mpfr_rnd_t);
+
+__MPFR_DECLSPEC mpfr_exp_t mpfr_get_z_2exp (mpz_ptr, mpfr_srcptr);
+__MPFR_DECLSPEC float mpfr_get_flt (mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC double mpfr_get_d (mpfr_srcptr, mpfr_rnd_t);
#ifdef MPFR_WANT_DECIMAL_FLOATS
-__MPFR_DECLSPEC _Decimal64 mpfr_get_decimal64 _MPFR_PROTO ((mpfr_srcptr,
- mpfr_rnd_t));
+__MPFR_DECLSPEC _Decimal64 mpfr_get_decimal64 (mpfr_srcptr, mpfr_rnd_t);
+#endif
+__MPFR_DECLSPEC long double mpfr_get_ld (mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC double mpfr_get_d1 (mpfr_srcptr);
+__MPFR_DECLSPEC double mpfr_get_d_2exp (long*, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC long double mpfr_get_ld_2exp (long*, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_frexp (mpfr_exp_t*, mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC long mpfr_get_si (mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC unsigned long mpfr_get_ui (mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC char * mpfr_get_str (char*, mpfr_exp_t*, int, size_t,
+ mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_get_z (mpz_ptr z, mpfr_srcptr f, mpfr_rnd_t);
+
+__MPFR_DECLSPEC void mpfr_free_str (char *);
+
+__MPFR_DECLSPEC int mpfr_urandom (mpfr_ptr, gmp_randstate_t, mpfr_rnd_t);
+#ifndef _MPFR_NO_DEPRECATED_GRANDOM /* for the test of this function */
+MPFR_DEPRECATED
+#endif
+__MPFR_DECLSPEC int mpfr_grandom (mpfr_ptr, mpfr_ptr, gmp_randstate_t,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_nrandom (mpfr_ptr, gmp_randstate_t, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_erandom (mpfr_ptr, gmp_randstate_t, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_urandomb (mpfr_ptr, gmp_randstate_t);
+
+__MPFR_DECLSPEC void mpfr_nextabove (mpfr_ptr);
+__MPFR_DECLSPEC void mpfr_nextbelow (mpfr_ptr);
+__MPFR_DECLSPEC void mpfr_nexttoward (mpfr_ptr, mpfr_srcptr);
+
+#ifndef MPFR_USE_MINI_GMP
+__MPFR_DECLSPEC int mpfr_printf (const char*, ...);
+__MPFR_DECLSPEC int mpfr_asprintf (char**, const char*, ...);
+__MPFR_DECLSPEC int mpfr_sprintf (char*, const char*, ...);
+__MPFR_DECLSPEC int mpfr_snprintf (char*, size_t, const char*, ...);
#endif
-__MPFR_DECLSPEC long double mpfr_get_ld _MPFR_PROTO ((mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC double mpfr_get_d1 _MPFR_PROTO ((mpfr_srcptr));
-__MPFR_DECLSPEC double mpfr_get_d_2exp _MPFR_PROTO ((long*, mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC long double mpfr_get_ld_2exp _MPFR_PROTO ((long*, mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_frexp _MPFR_PROTO ((mpfr_exp_t*, mpfr_ptr,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC long mpfr_get_si _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC unsigned long mpfr_get_ui _MPFR_PROTO ((mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC char*mpfr_get_str _MPFR_PROTO ((char*, mpfr_exp_t*, int, size_t,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_get_z _MPFR_PROTO ((mpz_ptr z, mpfr_srcptr f,
- mpfr_rnd_t));
-
-__MPFR_DECLSPEC void mpfr_free_str _MPFR_PROTO ((char *));
-
-__MPFR_DECLSPEC int mpfr_urandom _MPFR_PROTO ((mpfr_ptr, gmp_randstate_t,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_grandom _MPFR_PROTO ((mpfr_ptr, mpfr_ptr, gmp_randstate_t,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_urandomb _MPFR_PROTO ((mpfr_ptr, gmp_randstate_t));
-
-__MPFR_DECLSPEC void mpfr_nextabove _MPFR_PROTO ((mpfr_ptr));
-__MPFR_DECLSPEC void mpfr_nextbelow _MPFR_PROTO ((mpfr_ptr));
-__MPFR_DECLSPEC void mpfr_nexttoward _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr));
-
-__MPFR_DECLSPEC int mpfr_printf _MPFR_PROTO ((__gmp_const char*, ...));
-__MPFR_DECLSPEC int mpfr_asprintf _MPFR_PROTO ((char**, __gmp_const char*,
- ...));
-__MPFR_DECLSPEC int mpfr_sprintf _MPFR_PROTO ((char*, __gmp_const char*,
- ...));
-__MPFR_DECLSPEC int mpfr_snprintf _MPFR_PROTO ((char*, size_t,
- __gmp_const char*, ...));
-
-__MPFR_DECLSPEC int mpfr_pow _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_pow_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- long int, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_pow_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- unsigned long int, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_ui_pow_ui _MPFR_PROTO ((mpfr_ptr, unsigned long int,
- unsigned long int, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_ui_pow _MPFR_PROTO ((mpfr_ptr, unsigned long int,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_pow_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpz_srcptr, mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_sqrt _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_sqrt_ui _MPFR_PROTO ((mpfr_ptr, unsigned long,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_rec_sqrt _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_add _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_sub _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_mul _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_div _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_srcptr, mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_add_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- unsigned long, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_sub_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- unsigned long, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_ui_sub _MPFR_PROTO ((mpfr_ptr, unsigned long,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_mul_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- unsigned long, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_div_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- unsigned long, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_ui_div _MPFR_PROTO ((mpfr_ptr, unsigned long,
- mpfr_srcptr, mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_add_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- long int, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_sub_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- long int, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_si_sub _MPFR_PROTO ((mpfr_ptr, long int,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_mul_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- long int, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_div_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- long int, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_si_div _MPFR_PROTO ((mpfr_ptr, long int,
- mpfr_srcptr, mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_add_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- double, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_sub_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- double, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_d_sub _MPFR_PROTO ((mpfr_ptr, double,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_mul_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- double, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_div_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- double, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_d_div _MPFR_PROTO ((mpfr_ptr, double,
- mpfr_srcptr, mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_sqr _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_const_pi _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_const_log2 _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_const_euler _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_const_catalan _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_agm _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
- mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_log _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_log2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_log10 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_log1p _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_exp2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_exp10 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_expm1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_eint _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_li2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_cmp _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_cmp3 _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr, int));
-__MPFR_DECLSPEC int mpfr_cmp_d _MPFR_PROTO ((mpfr_srcptr, double));
-__MPFR_DECLSPEC int mpfr_cmp_ld _MPFR_PROTO ((mpfr_srcptr, long double));
-__MPFR_DECLSPEC int mpfr_cmpabs _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_cmp_ui _MPFR_PROTO ((mpfr_srcptr, unsigned long));
-__MPFR_DECLSPEC int mpfr_cmp_si _MPFR_PROTO ((mpfr_srcptr, long));
-__MPFR_DECLSPEC int mpfr_cmp_ui_2exp _MPFR_PROTO ((mpfr_srcptr, unsigned long,
- mpfr_exp_t));
-__MPFR_DECLSPEC int mpfr_cmp_si_2exp _MPFR_PROTO ((mpfr_srcptr, long,
- mpfr_exp_t));
-__MPFR_DECLSPEC void mpfr_reldiff _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_eq _MPFR_PROTO((mpfr_srcptr, mpfr_srcptr,
- unsigned long));
-__MPFR_DECLSPEC int mpfr_sgn _MPFR_PROTO ((mpfr_srcptr));
-
-__MPFR_DECLSPEC int mpfr_mul_2exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- unsigned long, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_div_2exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- unsigned long, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_mul_2ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- unsigned long, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_div_2ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- unsigned long, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_mul_2si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- long, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_div_2si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- long, mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_rint _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_round _MPFR_PROTO((mpfr_ptr, mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_trunc _MPFR_PROTO((mpfr_ptr, mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_ceil _MPFR_PROTO((mpfr_ptr, mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_floor _MPFR_PROTO((mpfr_ptr, mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_rint_round _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_rint_trunc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_rint_ceil _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_rint_floor _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_frac _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_modf _MPFR_PROTO ((mpfr_ptr, mpfr_ptr, mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_remquo _MPFR_PROTO ((mpfr_ptr, long*, mpfr_srcptr,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_remainder _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_fmod _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_srcptr, mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_fits_ulong_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_fits_slong_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_fits_uint_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_fits_sint_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_fits_ushort_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_fits_sshort_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_fits_uintmax_p _MPFR_PROTO((mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_fits_intmax_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
-
-__MPFR_DECLSPEC void mpfr_extract _MPFR_PROTO ((mpz_ptr, mpfr_srcptr,
- unsigned int));
-__MPFR_DECLSPEC void mpfr_swap _MPFR_PROTO ((mpfr_ptr, mpfr_ptr));
-__MPFR_DECLSPEC void mpfr_dump _MPFR_PROTO ((mpfr_srcptr));
-
-__MPFR_DECLSPEC int mpfr_nan_p _MPFR_PROTO((mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_inf_p _MPFR_PROTO((mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_number_p _MPFR_PROTO((mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_integer_p _MPFR_PROTO ((mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_zero_p _MPFR_PROTO ((mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_regular_p _MPFR_PROTO ((mpfr_srcptr));
-
-__MPFR_DECLSPEC int mpfr_greater_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_greaterequal_p _MPFR_PROTO ((mpfr_srcptr,
- mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_less_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_lessequal_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_lessgreater_p _MPFR_PROTO((mpfr_srcptr,mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_equal_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
-__MPFR_DECLSPEC int mpfr_unordered_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
-
-__MPFR_DECLSPEC int mpfr_atanh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_acosh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_asinh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_cosh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_sinh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_tanh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_sinh_cosh _MPFR_PROTO ((mpfr_ptr, mpfr_ptr,
- mpfr_srcptr, mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_sech _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_csch _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_coth _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_acos _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_asin _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_atan _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_sin _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_sin_cos _MPFR_PROTO ((mpfr_ptr, mpfr_ptr,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_cos _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_tan _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_atan2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_sec _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_csc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_cot _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_hypot _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_erf _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_erfc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_cbrt _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_root _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,unsigned long,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_gamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_lngamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_lgamma _MPFR_PROTO((mpfr_ptr,int*,mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_digamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_zeta _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_zeta_ui _MPFR_PROTO ((mpfr_ptr,unsigned long,mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_fac_ui _MPFR_PROTO ((mpfr_ptr, unsigned long int,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_j0 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_j1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_jn _MPFR_PROTO ((mpfr_ptr, long, mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_y0 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_y1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_yn _MPFR_PROTO ((mpfr_ptr, long, mpfr_srcptr,
- mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_ai _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_min _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_max _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
- mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_dim _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
- mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_mul_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpz_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_div_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpz_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_add_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpz_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_sub_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpz_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_z_sub _MPFR_PROTO ((mpfr_ptr, mpz_srcptr,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_cmp_z _MPFR_PROTO ((mpfr_srcptr, mpz_srcptr));
-
-__MPFR_DECLSPEC int mpfr_mul_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpq_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_div_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpq_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_add_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpq_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_sub_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
- mpq_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_cmp_q _MPFR_PROTO ((mpfr_srcptr, mpq_srcptr));
-
-__MPFR_DECLSPEC int mpfr_cmp_f _MPFR_PROTO ((mpfr_srcptr, mpf_srcptr));
-
-__MPFR_DECLSPEC int mpfr_fma _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_fms _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
- mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_sum _MPFR_PROTO ((mpfr_ptr, mpfr_ptr *__gmp_const,
- unsigned long, mpfr_rnd_t));
-
-__MPFR_DECLSPEC void mpfr_free_cache _MPFR_PROTO ((void));
-
-__MPFR_DECLSPEC int mpfr_subnormalize _MPFR_PROTO ((mpfr_ptr, int,
- mpfr_rnd_t));
-
-__MPFR_DECLSPEC int mpfr_strtofr _MPFR_PROTO ((mpfr_ptr, __gmp_const char *,
- char **, int, mpfr_rnd_t));
-
-__MPFR_DECLSPEC size_t mpfr_custom_get_size _MPFR_PROTO ((mpfr_prec_t));
-__MPFR_DECLSPEC void mpfr_custom_init _MPFR_PROTO ((void *, mpfr_prec_t));
-__MPFR_DECLSPEC void * mpfr_custom_get_significand _MPFR_PROTO ((mpfr_srcptr));
-__MPFR_DECLSPEC mpfr_exp_t mpfr_custom_get_exp _MPFR_PROTO ((mpfr_srcptr));
-__MPFR_DECLSPEC void mpfr_custom_move _MPFR_PROTO ((mpfr_ptr, void *));
-__MPFR_DECLSPEC void mpfr_custom_init_set _MPFR_PROTO ((mpfr_ptr, int,
- mpfr_exp_t, mpfr_prec_t, void *));
-__MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr));
+
+__MPFR_DECLSPEC int mpfr_pow (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_pow_si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_pow_ui (mpfr_ptr, mpfr_srcptr, unsigned long,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_ui_pow_ui (mpfr_ptr, unsigned long, unsigned long,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_ui_pow (mpfr_ptr, unsigned long, mpfr_srcptr,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_pow_z (mpfr_ptr, mpfr_srcptr, mpz_srcptr, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_sqrt (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_sqrt_ui (mpfr_ptr, unsigned long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_rec_sqrt (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_add (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_sub (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_mul (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_div (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_add_ui (mpfr_ptr, mpfr_srcptr, unsigned long,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_sub_ui (mpfr_ptr, mpfr_srcptr, unsigned long,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_ui_sub (mpfr_ptr, unsigned long, mpfr_srcptr,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_mul_ui (mpfr_ptr, mpfr_srcptr, unsigned long,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_div_ui (mpfr_ptr, mpfr_srcptr, unsigned long,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_ui_div (mpfr_ptr, unsigned long, mpfr_srcptr,
+ mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_add_si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_sub_si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_si_sub (mpfr_ptr, long, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_mul_si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_div_si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_si_div (mpfr_ptr, long, mpfr_srcptr, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_add_d (mpfr_ptr, mpfr_srcptr, double, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_sub_d (mpfr_ptr, mpfr_srcptr, double, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_d_sub (mpfr_ptr, double, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_mul_d (mpfr_ptr, mpfr_srcptr, double, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_div_d (mpfr_ptr, mpfr_srcptr, double, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_d_div (mpfr_ptr, double, mpfr_srcptr, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_sqr (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_const_pi (mpfr_ptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_const_log2 (mpfr_ptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_const_euler (mpfr_ptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_const_catalan (mpfr_ptr, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_agm (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_log (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_log2 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_log10 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_log1p (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_log_ui (mpfr_ptr, unsigned long, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_exp (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_exp2 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_exp10 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_expm1 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_eint (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_li2 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_cmp (mpfr_srcptr, mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_cmp3 (mpfr_srcptr, mpfr_srcptr, int);
+__MPFR_DECLSPEC int mpfr_cmp_d (mpfr_srcptr, double);
+__MPFR_DECLSPEC int mpfr_cmp_ld (mpfr_srcptr, long double);
+__MPFR_DECLSPEC int mpfr_cmpabs (mpfr_srcptr, mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_cmp_ui (mpfr_srcptr, unsigned long);
+__MPFR_DECLSPEC int mpfr_cmp_si (mpfr_srcptr, long);
+__MPFR_DECLSPEC int mpfr_cmp_ui_2exp (mpfr_srcptr, unsigned long, mpfr_exp_t);
+__MPFR_DECLSPEC int mpfr_cmp_si_2exp (mpfr_srcptr, long, mpfr_exp_t);
+__MPFR_DECLSPEC void mpfr_reldiff (mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_eq (mpfr_srcptr, mpfr_srcptr, unsigned long);
+__MPFR_DECLSPEC int mpfr_sgn (mpfr_srcptr);
+
+__MPFR_DECLSPEC int mpfr_mul_2exp (mpfr_ptr, mpfr_srcptr, unsigned long,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_div_2exp (mpfr_ptr, mpfr_srcptr, unsigned long,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_mul_2ui (mpfr_ptr, mpfr_srcptr, unsigned long,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_div_2ui (mpfr_ptr, mpfr_srcptr, unsigned long,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_mul_2si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_div_2si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_rint (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_roundeven (mpfr_ptr, mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_round (mpfr_ptr, mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_trunc (mpfr_ptr, mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_ceil (mpfr_ptr, mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_floor (mpfr_ptr, mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_rint_roundeven (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_rint_round (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_rint_trunc (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_rint_ceil (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_rint_floor (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_frac (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_modf (mpfr_ptr, mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_remquo (mpfr_ptr, long*, mpfr_srcptr, mpfr_srcptr,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_remainder (mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_fmod (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_fmodquo (mpfr_ptr, long*, mpfr_srcptr, mpfr_srcptr,
+ mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_fits_ulong_p (mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_fits_slong_p (mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_fits_uint_p (mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_fits_sint_p (mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_fits_ushort_p (mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_fits_sshort_p (mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_fits_uintmax_p (mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_fits_intmax_p (mpfr_srcptr, mpfr_rnd_t);
+
+__MPFR_DECLSPEC void mpfr_extract (mpz_ptr, mpfr_srcptr, unsigned int);
+__MPFR_DECLSPEC void mpfr_swap (mpfr_ptr, mpfr_ptr);
+__MPFR_DECLSPEC void mpfr_dump (mpfr_srcptr);
+
+__MPFR_DECLSPEC int mpfr_nan_p (mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_inf_p (mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_number_p (mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_integer_p (mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_zero_p (mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_regular_p (mpfr_srcptr);
+
+__MPFR_DECLSPEC int mpfr_greater_p (mpfr_srcptr, mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_greaterequal_p (mpfr_srcptr, mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_less_p (mpfr_srcptr, mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_lessequal_p (mpfr_srcptr, mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_lessgreater_p (mpfr_srcptr, mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_equal_p (mpfr_srcptr, mpfr_srcptr);
+__MPFR_DECLSPEC int mpfr_unordered_p (mpfr_srcptr, mpfr_srcptr);
+
+__MPFR_DECLSPEC int mpfr_atanh (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_acosh (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_asinh (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_cosh (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_sinh (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_tanh (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_sinh_cosh (mpfr_ptr, mpfr_ptr, mpfr_srcptr,
+ mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_sech (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_csch (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_coth (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_acos (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_asin (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_atan (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_sin (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_sin_cos (mpfr_ptr, mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_cos (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_tan (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_atan2 (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_sec (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_csc (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_cot (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_hypot (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_erf (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_erfc (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_cbrt (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+#ifndef _MPFR_NO_DEPRECATED_ROOT /* for the test of this function */
+MPFR_DEPRECATED
+#endif
+__MPFR_DECLSPEC int mpfr_root (mpfr_ptr, mpfr_srcptr, unsigned long,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_rootn_ui (mpfr_ptr, mpfr_srcptr, unsigned long,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_gamma (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_gamma_inc (mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_beta (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_lngamma (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_lgamma (mpfr_ptr, int *, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_digamma (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_zeta (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_zeta_ui (mpfr_ptr, unsigned long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_fac_ui (mpfr_ptr, unsigned long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_j0 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_j1 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_jn (mpfr_ptr, long, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_y0 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_y1 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_yn (mpfr_ptr, long, mpfr_srcptr, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_ai (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_min (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_max (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_dim (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_mul_z (mpfr_ptr, mpfr_srcptr, mpz_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_div_z (mpfr_ptr, mpfr_srcptr, mpz_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_add_z (mpfr_ptr, mpfr_srcptr, mpz_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_sub_z (mpfr_ptr, mpfr_srcptr, mpz_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_z_sub (mpfr_ptr, mpz_srcptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_cmp_z (mpfr_srcptr, mpz_srcptr);
+
+__MPFR_DECLSPEC int mpfr_fma (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_fms (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr,
+ mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_fmma (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_fmms (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_sum (mpfr_ptr, const mpfr_ptr *, unsigned long,
+ mpfr_rnd_t);
+
+__MPFR_DECLSPEC void mpfr_free_cache (void);
+__MPFR_DECLSPEC void mpfr_free_cache2 (mpfr_free_cache_t);
+__MPFR_DECLSPEC void mpfr_free_pool (void);
+__MPFR_DECLSPEC int mpfr_mp_memory_cleanup (void);
+
+__MPFR_DECLSPEC int mpfr_subnormalize (mpfr_ptr, int, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_strtofr (mpfr_ptr, const char *, char **, int,
+ mpfr_rnd_t);
+
+__MPFR_DECLSPEC void mpfr_round_nearest_away_begin (mpfr_t);
+__MPFR_DECLSPEC int mpfr_round_nearest_away_end (mpfr_t, int);
+
+__MPFR_DECLSPEC size_t mpfr_custom_get_size (mpfr_prec_t);
+__MPFR_DECLSPEC void mpfr_custom_init (void *, mpfr_prec_t);
+__MPFR_DECLSPEC void * mpfr_custom_get_significand (mpfr_srcptr);
+__MPFR_DECLSPEC mpfr_exp_t mpfr_custom_get_exp (mpfr_srcptr);
+__MPFR_DECLSPEC void mpfr_custom_move (mpfr_ptr, void *);
+__MPFR_DECLSPEC void mpfr_custom_init_set (mpfr_ptr, int, mpfr_exp_t,
+ mpfr_prec_t, void *);
+__MPFR_DECLSPEC int mpfr_custom_get_kind (mpfr_srcptr);
#if defined (__cplusplus)
}
@@ -742,6 +777,18 @@ __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr));
MPFR_EXTENSION mp_limb_t __gmpfr_local_tab_##_x[((_p)-1)/GMP_NUMB_BITS+1]; \
MPFR_EXTENSION mpfr_t _x = {{(_p),1,__MPFR_EXP_NAN,__gmpfr_local_tab_##_x}}
+#if MPFR_USE_C99_FEATURE
+/* C99 & C11 version: functions with multiple inputs supported */
+#define mpfr_round_nearest_away(func, rop, ...) \
+ (mpfr_round_nearest_away_begin(rop), \
+ mpfr_round_nearest_away_end((rop), func((rop), __VA_ARGS__, MPFR_RNDN)))
+#else
+/* C89 version: function with one input supported */
+#define mpfr_round_nearest_away(func, rop, op) \
+ (mpfr_round_nearest_away_begin(rop), \
+ mpfr_round_nearest_away_end((rop), func((rop), (op), MPFR_RNDN)))
+#endif
+
/* 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. */
@@ -761,8 +808,12 @@ __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr));
#define MPFR_VALUE_OF(x) (0 ? (x) : (x))
#define mpfr_get_prec(_x) MPFR_VALUE_OF((_x)->_mpfr_prec)
#define mpfr_get_exp(_x) MPFR_VALUE_OF((_x)->_mpfr_exp)
-/* Note: if need be, the MPFR_VALUE_OF can be used for other expressions
- (of any type). Thanks to Wojtek Lerch and Tim Rentsch for the idea. */
+/* Note 1: If need be, the MPFR_VALUE_OF can be used for other expressions
+ (of any type). Thanks to Wojtek Lerch and Tim Rentsch for the idea.
+ Note 2: Defining mpfr_get_exp() as a macro has the effect to disable
+ the check that the argument is a pure FP number (done in the function);
+ this increases the risk of undetected error and makes debugging more
+ complex. Is it really worth in practice? (Potential FIXME) */
#define mpfr_round(a,b) mpfr_rint((a), (b), MPFR_RNDNA)
#define mpfr_trunc(a,b) mpfr_rint((a), (b), MPFR_RNDZ)
@@ -782,12 +833,13 @@ __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr));
/* 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 some Intel C/C++ (ICC) versions since they now define __GNUC__
+ but produce a huge number of warnings if you use this code.
VL: I couldn't reproduce a single warning when enabling these macros
- with icc 10.1 20080212 on Itanium. But with this version, __ICC isn't
- defined (__INTEL_COMPILER is, though), so that these macros are enabled
- anyway. Checking with other ICC versions is needed. Possibly detect
+ with icc 10.1 20080212 on Itanium. But with this version, the obsolete
+ __ICC macro isn't defined (__INTEL_COMPILER is, though), so that these
+ macros are enabled anyway. Checking with other ICC versions is needed.
+ For now, !defined(__ICC) seems to be the right test. Possibly detect
whether warnings are produced or not with a configure test.
+ Remove C++ too, since it complains too much. */
/* Added casts to improve robustness in case of undefined behavior and
@@ -799,8 +851,8 @@ __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr));
are OK since if X is a constant expression, then (unsigned long) X is
also a constant expression, so that the optimizations still work. The
warnings are probably related to the following two bugs:
- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4210
- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38470 (possibly a variant)
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=4210
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38470 (possibly a variant)
and the casts could be removed once these bugs are fixed.
Casts shouldn't be used on the generic calls (to the ..._2exp functions),
where implicit conversions are performed. Indeed, having at least one
@@ -812,6 +864,7 @@ __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr));
be used. */
#if defined (__GNUC__) && !defined(__ICC) && !defined(__cplusplus)
#if (__GNUC__ >= 2)
+
#undef mpfr_cmp_ui
/* We use the fact that mpfr_sgn on NaN sets the erange flag and returns 0.
But warning! mpfr_sgn is specified as a macro in the API, thus the macro
@@ -820,11 +873,13 @@ __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr));
(__builtin_constant_p (_u) && (mpfr_ulong) (_u) == 0 ? \
(mpfr_sgn) (_f) : \
mpfr_cmp_ui_2exp ((_f), (_u), 0))
+
#undef mpfr_cmp_si
#define mpfr_cmp_si(_f,_s) \
(__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \
mpfr_cmp_ui ((_f), (mpfr_ulong) (mpfr_long) (_s)) : \
mpfr_cmp_si_2exp ((_f), (_s), 0))
+
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
#undef mpfr_set_ui
#define mpfr_set_ui(_f,_u,_r) \
@@ -836,11 +891,43 @@ __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr));
(mpfr_void) (_r); 0; }) : \
mpfr_set_ui_2exp ((_f), (_u), 0, (_r)))
#endif
+
#undef mpfr_set_si
#define mpfr_set_si(_f,_s,_r) \
(__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \
mpfr_set_ui ((_f), (mpfr_ulong) (mpfr_long) (_s), (_r)) : \
mpfr_set_si_2exp ((_f), (_s), 0, (_r)))
+
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+/* If the source is a constant number that is a power of 2,
+ optimize the call */
+#undef mpfr_mul_ui
+#define mpfr_mul_ui(_f, _g, _u,_r) \
+ (__builtin_constant_p (_u) && (mpfr_ulong) (_u) >= 1 && \
+ ((mpfr_ulong) (_u) & ((mpfr_ulong) (_u) - 1)) == 0 ? \
+ mpfr_mul_2si((_f), (_g), __builtin_ctzl (_u), (_r)) : \
+ mpfr_mul_ui ((_f), (_g), (_u), (_r)))
+#undef mpfr_div_ui
+#define mpfr_div_ui(_f, _g, _u,_r) \
+ (__builtin_constant_p (_u) && (mpfr_ulong) (_u) >= 1 && \
+ ((mpfr_ulong) (_u) & ((mpfr_ulong) (_u) - 1)) == 0 ? \
+ mpfr_mul_2si((_f), (_g), - __builtin_ctzl (_u), (_r)) : \
+ mpfr_div_ui ((_f), (_g), (_u), (_r)))
+#endif
+
+/* If the source is a constant number that is non-negative,
+ optimize the call */
+#undef mpfr_mul_si
+#define mpfr_mul_si(_f, _g, _s,_r) \
+ (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \
+ mpfr_mul_ui ((_f), (_g), (mpfr_ulong) (mpfr_long) (_s), (_r)) : \
+ mpfr_mul_si ((_f), (_g), (_s), (_r)))
+#undef mpfr_div_si
+#define mpfr_div_si(_f, _g, _s,_r) \
+ (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \
+ mpfr_div_ui ((_f), (_g), (mpfr_ulong) (mpfr_long) (_s), (_r)) : \
+ mpfr_div_si ((_f), (_g), (_s), (_r)))
+
#endif
#endif
@@ -894,12 +981,14 @@ __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr));
( mpfr_init(x), mpfr_set_ld((x), (d), (rnd)) )
#define mpfr_init_set_z(x, i, rnd) \
( mpfr_init(x), mpfr_set_z((x), (i), (rnd)) )
+#ifndef MPFR_USE_MINI_GMP
#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)) )
+#endif
+#define mpfr_init_set(x, y, rnd) \
+ ( mpfr_init(x), mpfr_set((x), (y), (rnd)) )
/* Compatibility layer -- obsolete functions and macros */
/* Note: it is not possible to output warnings, unless one defines
@@ -923,10 +1012,6 @@ __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr));
#ifndef mpz_set_fr
# define mpz_set_fr mpfr_get_z
#endif
-#define mpfr_add_one_ulp(x,r) \
- (mpfr_sgn (x) > 0 ? mpfr_nextabove (x) : mpfr_nextbelow (x))
-#define mpfr_sub_one_ulp(x,r) \
- (mpfr_sgn (x) > 0 ? mpfr_nextbelow (x) : mpfr_nextabove (x))
#define mpfr_get_z_exp mpfr_get_z_2exp
#define mpfr_custom_get_mantissa mpfr_custom_get_significand
@@ -950,7 +1035,8 @@ __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr));
*/
#if (defined (INTMAX_C) && defined (UINTMAX_C) && !defined(__cplusplus)) || \
defined (MPFR_USE_INTMAX_T) || \
- defined (_STDINT_H) || defined (_STDINT_H_) || defined (_STDINT)
+ defined (_STDINT_H) || defined (_STDINT_H_) || defined (_STDINT) || \
+ defined (_SYS_STDINT_H_) /* needed for FreeBSD */
# ifndef _MPFR_H_HAVE_INTMAX_T
# define _MPFR_H_HAVE_INTMAX_T 1
@@ -964,14 +1050,12 @@ extern "C" {
#define mpfr_set_uj_2exp __gmpfr_set_uj_2exp
#define mpfr_get_sj __gmpfr_mpfr_get_sj
#define mpfr_get_uj __gmpfr_mpfr_get_uj
-__MPFR_DECLSPEC int mpfr_set_sj _MPFR_PROTO ((mpfr_t, intmax_t, mpfr_rnd_t));
-__MPFR_DECLSPEC int
- mpfr_set_sj_2exp _MPFR_PROTO ((mpfr_t, intmax_t, intmax_t, mpfr_rnd_t));
-__MPFR_DECLSPEC int mpfr_set_uj _MPFR_PROTO ((mpfr_t, uintmax_t, mpfr_rnd_t));
-__MPFR_DECLSPEC int
- mpfr_set_uj_2exp _MPFR_PROTO ((mpfr_t, uintmax_t, intmax_t, mpfr_rnd_t));
-__MPFR_DECLSPEC intmax_t mpfr_get_sj _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
-__MPFR_DECLSPEC uintmax_t mpfr_get_uj _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_set_sj (mpfr_t, intmax_t, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_set_sj_2exp (mpfr_t, intmax_t, intmax_t, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_set_uj (mpfr_t, uintmax_t, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_set_uj_2exp (mpfr_t, uintmax_t, intmax_t, mpfr_rnd_t);
+__MPFR_DECLSPEC intmax_t mpfr_get_sj (mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC uintmax_t mpfr_get_uj (mpfr_srcptr, mpfr_rnd_t);
#if defined (__cplusplus)
}
@@ -992,13 +1076,17 @@ extern "C" {
#define mpfr_inp_str __gmpfr_inp_str
#define mpfr_out_str __gmpfr_out_str
-__MPFR_DECLSPEC size_t mpfr_inp_str _MPFR_PROTO ((mpfr_ptr, FILE*, int,
- mpfr_rnd_t));
-__MPFR_DECLSPEC size_t mpfr_out_str _MPFR_PROTO ((FILE*, int, size_t,
- mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC size_t mpfr_inp_str (mpfr_ptr, FILE*, int, mpfr_rnd_t);
+__MPFR_DECLSPEC size_t mpfr_out_str (FILE*, int, size_t, mpfr_srcptr,
+ mpfr_rnd_t);
+#ifndef MPFR_USE_MINI_GMP
#define mpfr_fprintf __gmpfr_fprintf
-__MPFR_DECLSPEC int mpfr_fprintf _MPFR_PROTO ((FILE*, __gmp_const char*,
- ...));
+__MPFR_DECLSPEC int mpfr_fprintf (FILE*, const char*, ...);
+#endif
+#define mpfr_fpif_export __gmpfr_fpif_export
+#define mpfr_fpif_import __gmpfr_fpif_import
+__MPFR_DECLSPEC int mpfr_fpif_export (FILE*, mpfr_ptr);
+__MPFR_DECLSPEC int mpfr_fpif_import (mpfr_ptr, FILE*);
#if defined (__cplusplus)
}
@@ -1021,13 +1109,10 @@ extern "C" {
#define mpfr_vasprintf __gmpfr_vasprintf
#define mpfr_vsprintf __gmpfr_vsprintf
#define mpfr_vsnprintf __gmpfr_vsnprintf
-__MPFR_DECLSPEC int mpfr_vprintf _MPFR_PROTO ((__gmp_const char*, va_list));
-__MPFR_DECLSPEC int mpfr_vasprintf _MPFR_PROTO ((char**, __gmp_const char*,
- va_list));
-__MPFR_DECLSPEC int mpfr_vsprintf _MPFR_PROTO ((char*, __gmp_const char*,
- va_list));
-__MPFR_DECLSPEC int mpfr_vsnprintf _MPFR_PROTO ((char*, size_t,
- __gmp_const char*, va_list));
+__MPFR_DECLSPEC int mpfr_vprintf (const char*, va_list);
+__MPFR_DECLSPEC int mpfr_vasprintf (char**, const char*, va_list);
+__MPFR_DECLSPEC int mpfr_vsprintf (char*, const char*, va_list);
+__MPFR_DECLSPEC int mpfr_vsnprintf (char*, size_t, const char*, va_list);
#if defined (__cplusplus)
}
@@ -1048,8 +1133,7 @@ extern "C" {
#endif
#define mpfr_vfprintf __gmpfr_vfprintf
-__MPFR_DECLSPEC int mpfr_vfprintf _MPFR_PROTO ((FILE*, __gmp_const char*,
- va_list));
+__MPFR_DECLSPEC int mpfr_vfprintf (FILE*, const char*, va_list);
#if defined (__cplusplus)
}