GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / toolchains / hndtools-arm-linux-2.6.36-uclibc-4.5.3 / include / mpfr.h
blobfbdeb0ff0383c463c85e0d2ce72bbc1dc31d0b2b
1 /* mpfr.h -- Include file for mpfr.
3 Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
4 Contributed by the Arenaire and Cacao projects, INRIA.
6 This file is part of the GNU MPFR Library.
8 The GNU MPFR Library is free software; you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
13 The GNU MPFR Library is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
20 http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
21 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
23 #ifndef __MPFR_H
24 #define __MPFR_H
26 /* Define MPFR version number */
27 #define MPFR_VERSION_MAJOR 3
28 #define MPFR_VERSION_MINOR 0
29 #define MPFR_VERSION_PATCHLEVEL 1
30 #define MPFR_VERSION_STRING "3.0.1-p4"
32 /* Macros dealing with MPFR VERSION */
33 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
34 #define MPFR_VERSION \
35 MPFR_VERSION_NUM(MPFR_VERSION_MAJOR,MPFR_VERSION_MINOR,MPFR_VERSION_PATCHLEVEL)
37 /* Check if GMP is included, and try to include it (Works with local GMP) */
38 #ifndef __GMP_H__
39 # include <gmp.h>
40 #endif
42 /* Check if stdio.h is included or if the user wants FILE */
43 #if defined (_GMP_H_HAVE_FILE) || defined (MPFR_USE_FILE)
44 # define _MPFR_H_HAVE_FILE 1
45 #endif
47 #if defined (_GMP_H_HAVE_VA_LIST)
48 # define _MPFR_H_HAVE_VA_LIST 1
49 #endif
51 /* Check if <stdint.h> / <inttypes.h> is included or if the user
52 explicitly wants intmax_t. Automatical detection is done by
53 checking:
54 - INTMAX_C and UINTMAX_C, but not if the compiler is a C++ one
55 (as suggested by Patrick Pelissier) because the test does not
56 work well in this case. See:
57 http://websympa.loria.fr/wwsympa/arc/mpfr/2010-02/msg00025.html
58 We do not check INTMAX_MAX and UINTMAX_MAX because under Solaris,
59 these macros are always defined by <limits.h> (i.e. even when
60 <stdint.h> and <inttypes.h> are not included).
61 - _STDINT_H (defined by the glibc) and _STDINT_H_ (defined under
62 Mac OS X), but this test may not work with all implementations.
63 Portable software should not rely on these tests.
65 #if (defined (INTMAX_C) && defined (UINTMAX_C) && !defined(__cplusplus)) || \
66 defined (MPFR_USE_INTMAX_T) || defined (_STDINT_H) || defined (_STDINT_H_)
67 # define _MPFR_H_HAVE_INTMAX_T 1
68 #endif
70 /* Avoid some problems with macro expansion if the user defines macros
71 with the same name as keywords. By convention, identifiers and macro
72 names starting with mpfr_ are reserved by MPFR. */
73 typedef void mpfr_void;
74 typedef int mpfr_int;
75 typedef unsigned int mpfr_uint;
76 typedef long mpfr_long;
77 typedef unsigned long mpfr_ulong;
78 typedef size_t mpfr_size_t;
80 /* Definition of rounding modes (DON'T USE MPFR_RNDNA!).
81 Warning! Changing the contents of this enum should be seen as an
82 interface change since the old and the new types are not compatible
83 (the integer type compatible with the enumerated type can even change,
84 see ISO C99, 6.7.2.2#4), and in Makefile.am, AGE should be set to 0.
86 MPFR_RNDU must appear just before MPFR_RNDD (see
87 MPFR_IS_RNDUTEST_OR_RNDDNOTTEST in mpfr-impl.h).
89 MPFR_RNDF has been added, though not implemented yet, in order to avoid
90 to break the ABI once faithful rounding gets implemented.
92 If you change the order of the rounding modes, please update the routines
93 in texceptions.c which assume 0=RNDN, 1=RNDZ, 2=RNDU, 3=RNDD, 4=RNDA.
95 typedef enum {
96 MPFR_RNDN=0, /* round to nearest, with ties to even */
97 MPFR_RNDZ, /* round toward zero */
98 MPFR_RNDU, /* round toward +Inf */
99 MPFR_RNDD, /* round toward -Inf */
100 MPFR_RNDA, /* round away from zero */
101 MPFR_RNDF, /* faithful rounding (not implemented yet) */
102 MPFR_RNDNA=-1 /* round to nearest, with ties away from zero (mpfr_round) */
103 } mpfr_rnd_t;
105 /* kept for compatibility with MPFR 2.4.x and before */
106 #define GMP_RNDN MPFR_RNDN
107 #define GMP_RNDZ MPFR_RNDZ
108 #define GMP_RNDU MPFR_RNDU
109 #define GMP_RNDD MPFR_RNDD
111 /* Define precision : 1 (short), 2 (int) or 3 (long) (DON'T USE IT!)*/
112 #ifndef _MPFR_PREC_FORMAT
113 # if __GMP_MP_SIZE_T_INT == 1
114 # define _MPFR_PREC_FORMAT 2
115 # else
116 # define _MPFR_PREC_FORMAT 3
117 # endif
118 #endif
120 /* Let's make mpfr_prec_t signed in order to avoid problems due to the
121 usual arithmetic conversions when mixing mpfr_prec_t and mpfr_exp_t
122 in an expression (for error analysis) if casts are forgotten. */
123 #if _MPFR_PREC_FORMAT == 1
124 typedef short mpfr_prec_t;
125 typedef unsigned short mpfr_uprec_t;
126 #elif _MPFR_PREC_FORMAT == 2
127 typedef int mpfr_prec_t;
128 typedef unsigned int mpfr_uprec_t;
129 #elif _MPFR_PREC_FORMAT == 3
130 typedef long mpfr_prec_t;
131 typedef unsigned long mpfr_uprec_t;
132 #else
133 # error "Invalid MPFR Prec format"
134 #endif
136 /* Definition of precision limits without needing <limits.h> */
137 /* Note: the casts allows the expression to yield the wanted behavior
138 for _MPFR_PREC_FORMAT == 1 (due to integer promotion rules). */
139 #define MPFR_PREC_MIN 2
140 #define MPFR_PREC_MAX ((mpfr_prec_t)((mpfr_uprec_t)(~(mpfr_uprec_t)0)>>1))
142 /* Definition of sign */
143 typedef int mpfr_sign_t;
145 /* Definition of the exponent: same as in GMP. */
146 typedef mp_exp_t mpfr_exp_t;
148 /* Definition of the standard exponent limits */
149 #define MPFR_EMAX_DEFAULT ((mpfr_exp_t) (((mpfr_ulong) 1 << 30) - 1))
150 #define MPFR_EMIN_DEFAULT (-(MPFR_EMAX_DEFAULT))
152 /* Definition of the main structure */
153 typedef struct {
154 mpfr_prec_t _mpfr_prec;
155 mpfr_sign_t _mpfr_sign;
156 mpfr_exp_t _mpfr_exp;
157 mp_limb_t *_mpfr_d;
158 } __mpfr_struct;
160 /* Compatibility with previous types of MPFR */
161 #ifndef mp_rnd_t
162 # define mp_rnd_t mpfr_rnd_t
163 #endif
164 #ifndef mp_prec_t
165 # define mp_prec_t mpfr_prec_t
166 #endif
169 The represented number is
170 _sign*(_d[k-1]/B+_d[k-2]/B^2+...+_d[0]/B^k)*2^_exp
171 where k=ceil(_mp_prec/GMP_NUMB_BITS) and B=2^GMP_NUMB_BITS.
173 For the msb (most significant bit) normalized representation, we must have
174 _d[k-1]>=B/2, unless the number is singular.
176 We must also have the last k*GMP_NUMB_BITS-_prec bits set to zero.
179 typedef __mpfr_struct mpfr_t[1];
180 typedef __mpfr_struct *mpfr_ptr;
181 typedef __gmp_const __mpfr_struct *mpfr_srcptr;
183 /* For those who need a direct and fast access to the sign field.
184 However it is not in the API, thus use it at your own risk: it might
185 not be supported, or change name, in further versions!
186 Unfortunately, it must be defined here (instead of MPFR's internal
187 header file mpfr-impl.h) because it is used by some macros below.
189 #define MPFR_SIGN(x) ((x)->_mpfr_sign)
191 /* Stack interface */
192 typedef enum {
193 MPFR_NAN_KIND = 0,
194 MPFR_INF_KIND = 1, MPFR_ZERO_KIND = 2, MPFR_REGULAR_KIND = 3
195 } mpfr_kind_t;
197 /* GMP defines:
198 + size_t: Standard size_t
199 + __GMP_ATTRIBUTE_PURE Attribute for math functions.
200 + __GMP_NOTHROW For C++: can't throw .
201 + __GMP_EXTERN_INLINE Attribute for inline function.
202 * __gmp_const const (Supports for K&R compiler only for mpfr.h).
203 + __GMP_DECLSPEC_EXPORT compiling to go into a DLL
204 + __GMP_DECLSPEC_IMPORT compiling to go into a application
206 /* Extra MPFR defines */
207 #define __MPFR_SENTINEL_ATTR
208 #if defined (__GNUC__)
209 # if __GNUC__ >= 4
210 # undef __MPFR_SENTINEL_ATTR
211 # define __MPFR_SENTINEL_ATTR __attribute__ ((sentinel))
212 # endif
213 #endif
215 /* Prototypes: Support of K&R compiler */
216 #if defined (__GMP_PROTO)
217 # define _MPFR_PROTO __GMP_PROTO
218 #elif defined (__STDC__) || defined (__cplusplus)
219 # define _MPFR_PROTO(x) x
220 #else
221 # define _MPFR_PROTO(x) ()
222 #endif
223 /* Support for WINDOWS Dll:
224 Check if we are inside a MPFR build, and if so export the functions.
225 Otherwise does the same thing as GMP */
226 #if defined(__MPFR_WITHIN_MPFR) && __GMP_LIBGMP_DLL
227 # define __MPFR_DECLSPEC __GMP_DECLSPEC_EXPORT
228 #else
229 # define __MPFR_DECLSPEC __GMP_DECLSPEC
230 #endif
232 /* Note: In order to be declared, some functions need a specific
233 system header to be included *before* "mpfr.h". If the user
234 forgets to include the header, the MPFR function prototype in
235 the user object file is not correct. To avoid wrong results,
236 we raise a linker error in that case by changing their internal
237 name in the library (prefixed by __gmpfr instead of mpfr). See
238 the lines of the form "#define mpfr_xxx __gmpfr_xxx" below. */
240 #if defined (__cplusplus)
241 extern "C" {
242 #endif
244 __MPFR_DECLSPEC __gmp_const char * mpfr_get_version _MPFR_PROTO ((void));
245 __MPFR_DECLSPEC __gmp_const char * mpfr_get_patches _MPFR_PROTO ((void));
246 __MPFR_DECLSPEC int mpfr_buildopt_tls_p _MPFR_PROTO ((void));
247 __MPFR_DECLSPEC int mpfr_buildopt_decimal_p _MPFR_PROTO ((void));
249 __MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin _MPFR_PROTO ((void));
250 __MPFR_DECLSPEC int mpfr_set_emin _MPFR_PROTO ((mpfr_exp_t));
251 __MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_min _MPFR_PROTO ((void));
252 __MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_max _MPFR_PROTO ((void));
253 __MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax _MPFR_PROTO ((void));
254 __MPFR_DECLSPEC int mpfr_set_emax _MPFR_PROTO ((mpfr_exp_t));
255 __MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_min _MPFR_PROTO ((void));
256 __MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_max _MPFR_PROTO ((void));
258 __MPFR_DECLSPEC void mpfr_set_default_rounding_mode _MPFR_PROTO((mpfr_rnd_t));
259 __MPFR_DECLSPEC mpfr_rnd_t mpfr_get_default_rounding_mode _MPFR_PROTO((void));
260 __MPFR_DECLSPEC __gmp_const char *
261 mpfr_print_rnd_mode _MPFR_PROTO((mpfr_rnd_t));
263 __MPFR_DECLSPEC void mpfr_clear_flags _MPFR_PROTO ((void));
264 __MPFR_DECLSPEC void mpfr_clear_underflow _MPFR_PROTO ((void));
265 __MPFR_DECLSPEC void mpfr_clear_overflow _MPFR_PROTO ((void));
266 __MPFR_DECLSPEC void mpfr_clear_nanflag _MPFR_PROTO ((void));
267 __MPFR_DECLSPEC void mpfr_clear_inexflag _MPFR_PROTO ((void));
268 __MPFR_DECLSPEC void mpfr_clear_erangeflag _MPFR_PROTO ((void));
270 __MPFR_DECLSPEC void mpfr_set_underflow _MPFR_PROTO ((void));
271 __MPFR_DECLSPEC void mpfr_set_overflow _MPFR_PROTO ((void));
272 __MPFR_DECLSPEC void mpfr_set_nanflag _MPFR_PROTO ((void));
273 __MPFR_DECLSPEC void mpfr_set_inexflag _MPFR_PROTO ((void));
274 __MPFR_DECLSPEC void mpfr_set_erangeflag _MPFR_PROTO ((void));
276 __MPFR_DECLSPEC int mpfr_underflow_p _MPFR_PROTO ((void));
277 __MPFR_DECLSPEC int mpfr_overflow_p _MPFR_PROTO ((void));
278 __MPFR_DECLSPEC int mpfr_nanflag_p _MPFR_PROTO ((void));
279 __MPFR_DECLSPEC int mpfr_inexflag_p _MPFR_PROTO ((void));
280 __MPFR_DECLSPEC int mpfr_erangeflag_p _MPFR_PROTO ((void));
282 __MPFR_DECLSPEC int
283 mpfr_check_range _MPFR_PROTO ((mpfr_ptr, int, mpfr_rnd_t));
285 __MPFR_DECLSPEC void mpfr_init2 _MPFR_PROTO ((mpfr_ptr, mpfr_prec_t));
286 __MPFR_DECLSPEC void mpfr_init _MPFR_PROTO ((mpfr_ptr));
287 __MPFR_DECLSPEC void mpfr_clear _MPFR_PROTO ((mpfr_ptr));
289 __MPFR_DECLSPEC void
290 mpfr_inits2 _MPFR_PROTO ((mpfr_prec_t, mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR;
291 __MPFR_DECLSPEC void
292 mpfr_inits _MPFR_PROTO ((mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR;
293 __MPFR_DECLSPEC void
294 mpfr_clears _MPFR_PROTO ((mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR;
296 __MPFR_DECLSPEC int
297 mpfr_prec_round _MPFR_PROTO ((mpfr_ptr, mpfr_prec_t, mpfr_rnd_t));
298 __MPFR_DECLSPEC int
299 mpfr_can_round _MPFR_PROTO ((mpfr_srcptr, mpfr_exp_t, mpfr_rnd_t, mpfr_rnd_t,
300 mpfr_prec_t));
301 __MPFR_DECLSPEC mpfr_prec_t mpfr_min_prec _MPFR_PROTO ((mpfr_srcptr));
303 __MPFR_DECLSPEC mpfr_exp_t mpfr_get_exp _MPFR_PROTO ((mpfr_srcptr));
304 __MPFR_DECLSPEC int mpfr_set_exp _MPFR_PROTO ((mpfr_ptr, mpfr_exp_t));
305 __MPFR_DECLSPEC mpfr_prec_t mpfr_get_prec _MPFR_PROTO((mpfr_srcptr));
306 __MPFR_DECLSPEC void mpfr_set_prec _MPFR_PROTO((mpfr_ptr, mpfr_prec_t));
307 __MPFR_DECLSPEC void mpfr_set_prec_raw _MPFR_PROTO((mpfr_ptr, mpfr_prec_t));
308 __MPFR_DECLSPEC void mpfr_set_default_prec _MPFR_PROTO((mpfr_prec_t));
309 __MPFR_DECLSPEC mpfr_prec_t mpfr_get_default_prec _MPFR_PROTO((void));
311 __MPFR_DECLSPEC int mpfr_set_d _MPFR_PROTO ((mpfr_ptr, double, mpfr_rnd_t));
312 __MPFR_DECLSPEC int mpfr_set_flt _MPFR_PROTO ((mpfr_ptr, float, mpfr_rnd_t));
313 #ifdef MPFR_WANT_DECIMAL_FLOATS
314 __MPFR_DECLSPEC int mpfr_set_decimal64 _MPFR_PROTO ((mpfr_ptr, _Decimal64,
315 mpfr_rnd_t));
316 #endif
317 __MPFR_DECLSPEC int
318 mpfr_set_ld _MPFR_PROTO ((mpfr_ptr, long double, mpfr_rnd_t));
319 __MPFR_DECLSPEC int
320 mpfr_set_z _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, mpfr_rnd_t));
321 __MPFR_DECLSPEC int
322 mpfr_set_z_2exp _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, mpfr_exp_t, mpfr_rnd_t));
323 __MPFR_DECLSPEC void mpfr_set_nan _MPFR_PROTO ((mpfr_ptr));
324 __MPFR_DECLSPEC void mpfr_set_inf _MPFR_PROTO ((mpfr_ptr, int));
325 __MPFR_DECLSPEC void mpfr_set_zero _MPFR_PROTO ((mpfr_ptr, int));
326 __MPFR_DECLSPEC int
327 mpfr_set_f _MPFR_PROTO ((mpfr_ptr, mpf_srcptr, mpfr_rnd_t));
328 __MPFR_DECLSPEC int
329 mpfr_get_f _MPFR_PROTO ((mpf_ptr, mpfr_srcptr, mpfr_rnd_t));
330 __MPFR_DECLSPEC int mpfr_set_si _MPFR_PROTO ((mpfr_ptr, long, mpfr_rnd_t));
331 __MPFR_DECLSPEC int
332 mpfr_set_ui _MPFR_PROTO ((mpfr_ptr, unsigned long, mpfr_rnd_t));
333 __MPFR_DECLSPEC int
334 mpfr_set_si_2exp _MPFR_PROTO ((mpfr_ptr, long, mpfr_exp_t, mpfr_rnd_t));
335 __MPFR_DECLSPEC int
336 mpfr_set_ui_2exp _MPFR_PROTO ((mpfr_ptr,unsigned long,mpfr_exp_t,mpfr_rnd_t));
337 __MPFR_DECLSPEC int
338 mpfr_set_q _MPFR_PROTO ((mpfr_ptr, mpq_srcptr, mpfr_rnd_t));
339 __MPFR_DECLSPEC int
340 mpfr_set_str _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, int, mpfr_rnd_t));
341 __MPFR_DECLSPEC int
342 mpfr_init_set_str _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, int,
343 mpfr_rnd_t));
344 __MPFR_DECLSPEC int
345 mpfr_set4 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t, int));
346 __MPFR_DECLSPEC int
347 mpfr_abs _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
348 __MPFR_DECLSPEC int
349 mpfr_set _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
350 __MPFR_DECLSPEC int mpfr_neg _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
351 __MPFR_DECLSPEC int mpfr_signbit _MPFR_PROTO ((mpfr_srcptr));
352 __MPFR_DECLSPEC int
353 mpfr_setsign _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, int, mpfr_rnd_t));
354 __MPFR_DECLSPEC int
355 mpfr_copysign _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t));
357 #ifdef _MPFR_H_HAVE_INTMAX_T
358 #define mpfr_set_sj __gmpfr_set_sj
359 #define mpfr_set_sj_2exp __gmpfr_set_sj_2exp
360 #define mpfr_set_uj __gmpfr_set_uj
361 #define mpfr_set_uj_2exp __gmpfr_set_uj_2exp
362 #define mpfr_get_sj __gmpfr_mpfr_get_sj
363 #define mpfr_get_uj __gmpfr_mpfr_get_uj
364 __MPFR_DECLSPEC int mpfr_set_sj _MPFR_PROTO ((mpfr_t, intmax_t, mpfr_rnd_t));
365 __MPFR_DECLSPEC int
366 mpfr_set_sj_2exp _MPFR_PROTO ((mpfr_t, intmax_t, intmax_t, mpfr_rnd_t));
367 __MPFR_DECLSPEC int mpfr_set_uj _MPFR_PROTO ((mpfr_t, uintmax_t, mpfr_rnd_t));
368 __MPFR_DECLSPEC int
369 mpfr_set_uj_2exp _MPFR_PROTO ((mpfr_t, uintmax_t, intmax_t, mpfr_rnd_t));
370 __MPFR_DECLSPEC intmax_t mpfr_get_sj _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
371 __MPFR_DECLSPEC uintmax_t mpfr_get_uj _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
372 #endif
374 __MPFR_DECLSPEC mpfr_exp_t mpfr_get_z_2exp _MPFR_PROTO ((mpz_ptr, mpfr_srcptr));
375 __MPFR_DECLSPEC float mpfr_get_flt _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
376 __MPFR_DECLSPEC double mpfr_get_d _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
377 #ifdef MPFR_WANT_DECIMAL_FLOATS
378 __MPFR_DECLSPEC _Decimal64 mpfr_get_decimal64 _MPFR_PROTO ((mpfr_srcptr,
379 mpfr_rnd_t));
380 #endif
381 __MPFR_DECLSPEC long double mpfr_get_ld _MPFR_PROTO ((mpfr_srcptr,
382 mpfr_rnd_t));
383 __MPFR_DECLSPEC double mpfr_get_d1 _MPFR_PROTO ((mpfr_srcptr));
384 __MPFR_DECLSPEC double mpfr_get_d_2exp _MPFR_PROTO ((long*, mpfr_srcptr,
385 mpfr_rnd_t));
386 __MPFR_DECLSPEC long double mpfr_get_ld_2exp _MPFR_PROTO ((long*, mpfr_srcptr,
387 mpfr_rnd_t));
388 __MPFR_DECLSPEC long mpfr_get_si _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
389 __MPFR_DECLSPEC unsigned long mpfr_get_ui _MPFR_PROTO ((mpfr_srcptr,
390 mpfr_rnd_t));
391 __MPFR_DECLSPEC char*mpfr_get_str _MPFR_PROTO ((char*, mpfr_exp_t*, int, size_t,
392 mpfr_srcptr, mpfr_rnd_t));
393 __MPFR_DECLSPEC int mpfr_get_z _MPFR_PROTO ((mpz_ptr z, mpfr_srcptr f,
394 mpfr_rnd_t));
396 __MPFR_DECLSPEC void mpfr_free_str _MPFR_PROTO ((char *));
398 __MPFR_DECLSPEC int mpfr_urandom _MPFR_PROTO ((mpfr_ptr, gmp_randstate_t,
399 mpfr_rnd_t));
400 __MPFR_DECLSPEC int mpfr_urandomb _MPFR_PROTO ((mpfr_ptr, gmp_randstate_t));
402 __MPFR_DECLSPEC void mpfr_nextabove _MPFR_PROTO ((mpfr_ptr));
403 __MPFR_DECLSPEC void mpfr_nextbelow _MPFR_PROTO ((mpfr_ptr));
404 __MPFR_DECLSPEC void mpfr_nexttoward _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr));
406 #ifdef _MPFR_H_HAVE_FILE
407 #define mpfr_inp_str __gmpfr_inp_str
408 #define mpfr_out_str __gmpfr_out_str
409 __MPFR_DECLSPEC size_t mpfr_inp_str _MPFR_PROTO ((mpfr_ptr, FILE*, int,
410 mpfr_rnd_t));
411 __MPFR_DECLSPEC size_t mpfr_out_str _MPFR_PROTO ((FILE*, int, size_t,
412 mpfr_srcptr, mpfr_rnd_t));
413 #define mpfr_fprintf __gmpfr_fprintf
414 __MPFR_DECLSPEC int mpfr_fprintf _MPFR_PROTO ((FILE*, __gmp_const char*,
415 ...));
416 #endif
417 __MPFR_DECLSPEC int mpfr_printf _MPFR_PROTO ((__gmp_const char*, ...));
418 __MPFR_DECLSPEC int mpfr_asprintf _MPFR_PROTO ((char**, __gmp_const char*,
419 ...));
420 __MPFR_DECLSPEC int mpfr_sprintf _MPFR_PROTO ((char*, __gmp_const char*,
421 ...));
422 __MPFR_DECLSPEC int mpfr_snprintf _MPFR_PROTO ((char*, size_t,
423 __gmp_const char*, ...));
425 #ifdef _MPFR_H_HAVE_VA_LIST
426 #ifdef _MPFR_H_HAVE_FILE
427 #define mpfr_vfprintf __gmpfr_vfprintf
428 __MPFR_DECLSPEC int mpfr_vfprintf _MPFR_PROTO ((FILE*, __gmp_const char*,
429 va_list));
430 #endif /* _MPFR_H_HAVE_FILE */
431 #define mpfr_vprintf __gmpfr_vprintf
432 #define mpfr_vasprintf __gmpfr_vasprintf
433 #define mpfr_vsprintf __gmpfr_vsprintf
434 #define mpfr_vsnprintf __gmpfr_vsnprintf
435 __MPFR_DECLSPEC int mpfr_vprintf _MPFR_PROTO ((__gmp_const char*, va_list));
436 __MPFR_DECLSPEC int mpfr_vasprintf _MPFR_PROTO ((char**, __gmp_const char*,
437 va_list));
438 __MPFR_DECLSPEC int mpfr_vsprintf _MPFR_PROTO ((char*, __gmp_const char*,
439 va_list));
440 __MPFR_DECLSPEC int mpfr_vsnprintf _MPFR_PROTO ((char*, size_t,
441 __gmp_const char*, va_list));
442 #endif /* _MPFR_H_HAVE_VA_LIST */
444 __MPFR_DECLSPEC int mpfr_pow _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
445 mpfr_srcptr, mpfr_rnd_t));
446 __MPFR_DECLSPEC int mpfr_pow_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
447 long int, mpfr_rnd_t));
448 __MPFR_DECLSPEC int mpfr_pow_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
449 unsigned long int, mpfr_rnd_t));
450 __MPFR_DECLSPEC int mpfr_ui_pow_ui _MPFR_PROTO ((mpfr_ptr, unsigned long int,
451 unsigned long int, mpfr_rnd_t));
452 __MPFR_DECLSPEC int mpfr_ui_pow _MPFR_PROTO ((mpfr_ptr, unsigned long int,
453 mpfr_srcptr, mpfr_rnd_t));
454 __MPFR_DECLSPEC int mpfr_pow_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
455 mpz_srcptr, mpfr_rnd_t));
457 __MPFR_DECLSPEC int mpfr_sqrt _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
458 mpfr_rnd_t));
459 __MPFR_DECLSPEC int mpfr_sqrt_ui _MPFR_PROTO ((mpfr_ptr, unsigned long,
460 mpfr_rnd_t));
461 __MPFR_DECLSPEC int mpfr_rec_sqrt _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
462 mpfr_rnd_t));
464 __MPFR_DECLSPEC int mpfr_add _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
465 mpfr_srcptr, mpfr_rnd_t));
466 __MPFR_DECLSPEC int mpfr_sub _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
467 mpfr_srcptr, mpfr_rnd_t));
468 __MPFR_DECLSPEC int mpfr_mul _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
469 mpfr_srcptr, mpfr_rnd_t));
470 __MPFR_DECLSPEC int mpfr_div _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
471 mpfr_srcptr, mpfr_rnd_t));
473 __MPFR_DECLSPEC int mpfr_add_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
474 unsigned long, mpfr_rnd_t));
475 __MPFR_DECLSPEC int mpfr_sub_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
476 unsigned long, mpfr_rnd_t));
477 __MPFR_DECLSPEC int mpfr_ui_sub _MPFR_PROTO ((mpfr_ptr, unsigned long,
478 mpfr_srcptr, mpfr_rnd_t));
479 __MPFR_DECLSPEC int mpfr_mul_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
480 unsigned long, mpfr_rnd_t));
481 __MPFR_DECLSPEC int mpfr_div_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
482 unsigned long, mpfr_rnd_t));
483 __MPFR_DECLSPEC int mpfr_ui_div _MPFR_PROTO ((mpfr_ptr, unsigned long,
484 mpfr_srcptr, mpfr_rnd_t));
486 __MPFR_DECLSPEC int mpfr_add_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
487 long int, mpfr_rnd_t));
488 __MPFR_DECLSPEC int mpfr_sub_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
489 long int, mpfr_rnd_t));
490 __MPFR_DECLSPEC int mpfr_si_sub _MPFR_PROTO ((mpfr_ptr, long int,
491 mpfr_srcptr, mpfr_rnd_t));
492 __MPFR_DECLSPEC int mpfr_mul_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
493 long int, mpfr_rnd_t));
494 __MPFR_DECLSPEC int mpfr_div_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
495 long int, mpfr_rnd_t));
496 __MPFR_DECLSPEC int mpfr_si_div _MPFR_PROTO ((mpfr_ptr, long int,
497 mpfr_srcptr, mpfr_rnd_t));
499 __MPFR_DECLSPEC int mpfr_add_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
500 double, mpfr_rnd_t));
501 __MPFR_DECLSPEC int mpfr_sub_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
502 double, mpfr_rnd_t));
503 __MPFR_DECLSPEC int mpfr_d_sub _MPFR_PROTO ((mpfr_ptr, double,
504 mpfr_srcptr, mpfr_rnd_t));
505 __MPFR_DECLSPEC int mpfr_mul_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
506 double, mpfr_rnd_t));
507 __MPFR_DECLSPEC int mpfr_div_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
508 double, mpfr_rnd_t));
509 __MPFR_DECLSPEC int mpfr_d_div _MPFR_PROTO ((mpfr_ptr, double,
510 mpfr_srcptr, mpfr_rnd_t));
512 __MPFR_DECLSPEC int mpfr_sqr _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
514 __MPFR_DECLSPEC int mpfr_const_pi _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t));
515 __MPFR_DECLSPEC int mpfr_const_log2 _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t));
516 __MPFR_DECLSPEC int mpfr_const_euler _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t));
517 __MPFR_DECLSPEC int mpfr_const_catalan _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t));
519 __MPFR_DECLSPEC int mpfr_agm _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
520 mpfr_rnd_t));
522 __MPFR_DECLSPEC int mpfr_log _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
523 __MPFR_DECLSPEC int mpfr_log2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
524 __MPFR_DECLSPEC int mpfr_log10 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
525 mpfr_rnd_t));
526 __MPFR_DECLSPEC int mpfr_log1p _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
527 mpfr_rnd_t));
529 __MPFR_DECLSPEC int mpfr_exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
530 __MPFR_DECLSPEC int mpfr_exp2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
531 __MPFR_DECLSPEC int mpfr_exp10 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
532 mpfr_rnd_t));
533 __MPFR_DECLSPEC int mpfr_expm1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
534 mpfr_rnd_t));
535 __MPFR_DECLSPEC int mpfr_eint _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
536 __MPFR_DECLSPEC int mpfr_li2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
538 __MPFR_DECLSPEC int mpfr_cmp _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
539 __MPFR_DECLSPEC int mpfr_cmp3 _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr, int));
540 __MPFR_DECLSPEC int mpfr_cmp_d _MPFR_PROTO ((mpfr_srcptr, double));
541 __MPFR_DECLSPEC int mpfr_cmp_ld _MPFR_PROTO ((mpfr_srcptr, long double));
542 __MPFR_DECLSPEC int mpfr_cmpabs _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
543 __MPFR_DECLSPEC int mpfr_cmp_ui _MPFR_PROTO ((mpfr_srcptr, unsigned long));
544 __MPFR_DECLSPEC int mpfr_cmp_si _MPFR_PROTO ((mpfr_srcptr, long));
545 __MPFR_DECLSPEC int mpfr_cmp_ui_2exp _MPFR_PROTO ((mpfr_srcptr, unsigned long,
546 mpfr_exp_t));
547 __MPFR_DECLSPEC int mpfr_cmp_si_2exp _MPFR_PROTO ((mpfr_srcptr, long,
548 mpfr_exp_t));
549 __MPFR_DECLSPEC void mpfr_reldiff _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
550 mpfr_srcptr, mpfr_rnd_t));
551 __MPFR_DECLSPEC int mpfr_eq _MPFR_PROTO((mpfr_srcptr, mpfr_srcptr,
552 unsigned long));
553 __MPFR_DECLSPEC int mpfr_sgn _MPFR_PROTO ((mpfr_srcptr));
555 __MPFR_DECLSPEC int mpfr_mul_2exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
556 unsigned long, mpfr_rnd_t));
557 __MPFR_DECLSPEC int mpfr_div_2exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
558 unsigned long, mpfr_rnd_t));
559 __MPFR_DECLSPEC int mpfr_mul_2ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
560 unsigned long, mpfr_rnd_t));
561 __MPFR_DECLSPEC int mpfr_div_2ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
562 unsigned long, mpfr_rnd_t));
563 __MPFR_DECLSPEC int mpfr_mul_2si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
564 long, mpfr_rnd_t));
565 __MPFR_DECLSPEC int mpfr_div_2si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
566 long, mpfr_rnd_t));
568 __MPFR_DECLSPEC int mpfr_rint _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t));
569 __MPFR_DECLSPEC int mpfr_round _MPFR_PROTO((mpfr_ptr, mpfr_srcptr));
570 __MPFR_DECLSPEC int mpfr_trunc _MPFR_PROTO((mpfr_ptr, mpfr_srcptr));
571 __MPFR_DECLSPEC int mpfr_ceil _MPFR_PROTO((mpfr_ptr, mpfr_srcptr));
572 __MPFR_DECLSPEC int mpfr_floor _MPFR_PROTO((mpfr_ptr, mpfr_srcptr));
573 __MPFR_DECLSPEC int mpfr_rint_round _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
574 mpfr_rnd_t));
575 __MPFR_DECLSPEC int mpfr_rint_trunc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
576 mpfr_rnd_t));
577 __MPFR_DECLSPEC int mpfr_rint_ceil _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
578 mpfr_rnd_t));
579 __MPFR_DECLSPEC int mpfr_rint_floor _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
580 mpfr_rnd_t));
581 __MPFR_DECLSPEC int mpfr_frac _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
582 __MPFR_DECLSPEC int mpfr_modf _MPFR_PROTO ((mpfr_ptr, mpfr_ptr, mpfr_srcptr,
583 mpfr_rnd_t));
584 __MPFR_DECLSPEC int mpfr_remquo _MPFR_PROTO ((mpfr_ptr, long*, mpfr_srcptr,
585 mpfr_srcptr, mpfr_rnd_t));
586 __MPFR_DECLSPEC int mpfr_remainder _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
587 mpfr_srcptr, mpfr_rnd_t));
588 __MPFR_DECLSPEC int mpfr_fmod _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
589 mpfr_srcptr, mpfr_rnd_t));
591 __MPFR_DECLSPEC int mpfr_fits_ulong_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
592 __MPFR_DECLSPEC int mpfr_fits_slong_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
593 __MPFR_DECLSPEC int mpfr_fits_uint_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
594 __MPFR_DECLSPEC int mpfr_fits_sint_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
595 __MPFR_DECLSPEC int mpfr_fits_ushort_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
596 __MPFR_DECLSPEC int mpfr_fits_sshort_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
597 __MPFR_DECLSPEC int mpfr_fits_uintmax_p _MPFR_PROTO((mpfr_srcptr,mpfr_rnd_t));
598 __MPFR_DECLSPEC int mpfr_fits_intmax_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
600 __MPFR_DECLSPEC void mpfr_extract _MPFR_PROTO ((mpz_ptr, mpfr_srcptr,
601 unsigned int));
602 __MPFR_DECLSPEC void mpfr_swap _MPFR_PROTO ((mpfr_ptr, mpfr_ptr));
603 __MPFR_DECLSPEC void mpfr_dump _MPFR_PROTO ((mpfr_srcptr));
605 __MPFR_DECLSPEC int mpfr_nan_p _MPFR_PROTO((mpfr_srcptr));
606 __MPFR_DECLSPEC int mpfr_inf_p _MPFR_PROTO((mpfr_srcptr));
607 __MPFR_DECLSPEC int mpfr_number_p _MPFR_PROTO((mpfr_srcptr));
608 __MPFR_DECLSPEC int mpfr_integer_p _MPFR_PROTO ((mpfr_srcptr));
609 __MPFR_DECLSPEC int mpfr_zero_p _MPFR_PROTO ((mpfr_srcptr));
610 __MPFR_DECLSPEC int mpfr_regular_p _MPFR_PROTO ((mpfr_srcptr));
612 __MPFR_DECLSPEC int mpfr_greater_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
613 __MPFR_DECLSPEC int mpfr_greaterequal_p _MPFR_PROTO ((mpfr_srcptr,
614 mpfr_srcptr));
615 __MPFR_DECLSPEC int mpfr_less_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
616 __MPFR_DECLSPEC int mpfr_lessequal_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
617 __MPFR_DECLSPEC int mpfr_lessgreater_p _MPFR_PROTO((mpfr_srcptr,mpfr_srcptr));
618 __MPFR_DECLSPEC int mpfr_equal_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
619 __MPFR_DECLSPEC int mpfr_unordered_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
621 __MPFR_DECLSPEC int mpfr_atanh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
622 __MPFR_DECLSPEC int mpfr_acosh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
623 __MPFR_DECLSPEC int mpfr_asinh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
624 __MPFR_DECLSPEC int mpfr_cosh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t));
625 __MPFR_DECLSPEC int mpfr_sinh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t));
626 __MPFR_DECLSPEC int mpfr_tanh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t));
627 __MPFR_DECLSPEC int mpfr_sinh_cosh _MPFR_PROTO ((mpfr_ptr, mpfr_ptr,
628 mpfr_srcptr, mpfr_rnd_t));
630 __MPFR_DECLSPEC int mpfr_sech _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
631 __MPFR_DECLSPEC int mpfr_csch _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
632 __MPFR_DECLSPEC int mpfr_coth _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
634 __MPFR_DECLSPEC int mpfr_acos _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
635 __MPFR_DECLSPEC int mpfr_asin _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
636 __MPFR_DECLSPEC int mpfr_atan _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
637 __MPFR_DECLSPEC int mpfr_sin _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
638 __MPFR_DECLSPEC int mpfr_sin_cos _MPFR_PROTO ((mpfr_ptr, mpfr_ptr,
639 mpfr_srcptr, mpfr_rnd_t));
640 __MPFR_DECLSPEC int mpfr_cos _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
641 __MPFR_DECLSPEC int mpfr_tan _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
642 __MPFR_DECLSPEC int mpfr_atan2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_srcptr,
643 mpfr_rnd_t));
644 __MPFR_DECLSPEC int mpfr_sec _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
645 __MPFR_DECLSPEC int mpfr_csc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
646 __MPFR_DECLSPEC int mpfr_cot _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
648 __MPFR_DECLSPEC int mpfr_hypot _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
649 mpfr_srcptr, mpfr_rnd_t));
650 __MPFR_DECLSPEC int mpfr_erf _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
651 __MPFR_DECLSPEC int mpfr_erfc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
652 __MPFR_DECLSPEC int mpfr_cbrt _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
653 __MPFR_DECLSPEC int mpfr_root _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,unsigned long,mpfr_rnd_t));
654 __MPFR_DECLSPEC int mpfr_gamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
655 __MPFR_DECLSPEC int mpfr_lngamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
656 __MPFR_DECLSPEC int mpfr_lgamma _MPFR_PROTO((mpfr_ptr,int*,mpfr_srcptr,mpfr_rnd_t));
657 __MPFR_DECLSPEC int mpfr_digamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
658 __MPFR_DECLSPEC int mpfr_zeta _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
659 __MPFR_DECLSPEC int mpfr_zeta_ui _MPFR_PROTO ((mpfr_ptr,unsigned long,mpfr_rnd_t));
660 __MPFR_DECLSPEC int mpfr_fac_ui _MPFR_PROTO ((mpfr_ptr, unsigned long int,
661 mpfr_rnd_t));
662 __MPFR_DECLSPEC int mpfr_j0 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
663 __MPFR_DECLSPEC int mpfr_j1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
664 __MPFR_DECLSPEC int mpfr_jn _MPFR_PROTO ((mpfr_ptr, long, mpfr_srcptr,
665 mpfr_rnd_t));
666 __MPFR_DECLSPEC int mpfr_y0 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
667 __MPFR_DECLSPEC int mpfr_y1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
668 __MPFR_DECLSPEC int mpfr_yn _MPFR_PROTO ((mpfr_ptr, long, mpfr_srcptr,
669 mpfr_rnd_t));
671 __MPFR_DECLSPEC int mpfr_ai _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
673 __MPFR_DECLSPEC int mpfr_min _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
674 mpfr_rnd_t));
675 __MPFR_DECLSPEC int mpfr_max _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
676 mpfr_rnd_t));
677 __MPFR_DECLSPEC int mpfr_dim _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
678 mpfr_rnd_t));
680 __MPFR_DECLSPEC int mpfr_mul_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
681 mpz_srcptr, mpfr_rnd_t));
682 __MPFR_DECLSPEC int mpfr_div_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
683 mpz_srcptr, mpfr_rnd_t));
684 __MPFR_DECLSPEC int mpfr_add_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
685 mpz_srcptr, mpfr_rnd_t));
686 __MPFR_DECLSPEC int mpfr_sub_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
687 mpz_srcptr, mpfr_rnd_t));
688 __MPFR_DECLSPEC int mpfr_cmp_z _MPFR_PROTO ((mpfr_srcptr, mpz_srcptr));
690 __MPFR_DECLSPEC int mpfr_mul_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
691 mpq_srcptr, mpfr_rnd_t));
692 __MPFR_DECLSPEC int mpfr_div_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
693 mpq_srcptr, mpfr_rnd_t));
694 __MPFR_DECLSPEC int mpfr_add_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
695 mpq_srcptr, mpfr_rnd_t));
696 __MPFR_DECLSPEC int mpfr_sub_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
697 mpq_srcptr, mpfr_rnd_t));
698 __MPFR_DECLSPEC int mpfr_cmp_q _MPFR_PROTO ((mpfr_srcptr, mpq_srcptr));
700 __MPFR_DECLSPEC int mpfr_cmp_f _MPFR_PROTO ((mpfr_srcptr, mpf_srcptr));
702 __MPFR_DECLSPEC int mpfr_fma _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
703 mpfr_srcptr, mpfr_rnd_t));
704 __MPFR_DECLSPEC int mpfr_fms _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
705 mpfr_srcptr, mpfr_rnd_t));
706 __MPFR_DECLSPEC int mpfr_sum _MPFR_PROTO ((mpfr_ptr, mpfr_ptr *__gmp_const,
707 unsigned long, mpfr_rnd_t));
709 __MPFR_DECLSPEC void mpfr_free_cache _MPFR_PROTO ((void));
711 __MPFR_DECLSPEC int mpfr_subnormalize _MPFR_PROTO ((mpfr_ptr, int,
712 mpfr_rnd_t));
714 __MPFR_DECLSPEC int mpfr_strtofr _MPFR_PROTO ((mpfr_ptr, __gmp_const char *,
715 char **, int, mpfr_rnd_t));
717 __MPFR_DECLSPEC size_t mpfr_custom_get_size _MPFR_PROTO ((mpfr_prec_t));
718 __MPFR_DECLSPEC void mpfr_custom_init _MPFR_PROTO ((void *, mpfr_prec_t));
719 __MPFR_DECLSPEC void * mpfr_custom_get_significand _MPFR_PROTO ((mpfr_srcptr));
720 __MPFR_DECLSPEC mpfr_exp_t mpfr_custom_get_exp _MPFR_PROTO ((mpfr_srcptr));
721 __MPFR_DECLSPEC void mpfr_custom_move _MPFR_PROTO ((mpfr_ptr, void *));
722 __MPFR_DECLSPEC void mpfr_custom_init_set _MPFR_PROTO ((mpfr_ptr, int,
723 mpfr_exp_t, mpfr_prec_t, void *));
724 __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr));
726 #if defined (__cplusplus)
728 #endif
730 /* DON'T USE THIS! (For MPFR-public macros only, see below.)
731 The mpfr_sgn macro uses the fact that __MPFR_EXP_NAN and __MPFR_EXP_ZERO
732 are the smallest values.
733 FIXME: In the following macros, the cast of an unsigned type with MSB set
734 to the signed type mpfr_exp_t yields an integer overflow, which can give
735 unexpected results with future compilers and aggressive optimisations.
736 Why not working only with signed types, using INT_MIN and LONG_MIN? */
737 #if __GMP_MP_SIZE_T_INT
738 #define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(mpfr_uint)0)>>1))+2))
739 #define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(mpfr_uint)0)>>1))+1))
740 #define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(mpfr_uint)0)>>1))+3))
741 #else
742 #define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(mpfr_ulong)0)>>1))+2))
743 #define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(mpfr_ulong)0)>>1))+1))
744 #define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(mpfr_ulong)0)>>1))+3))
745 #endif
747 /* Define MPFR_USE_EXTENSION to avoid "gcc -pedantic" warnings. */
748 #ifndef MPFR_EXTENSION
749 # if defined(MPFR_USE_EXTENSION)
750 # define MPFR_EXTENSION __extension__
751 # else
752 # define MPFR_EXTENSION
753 # endif
754 #endif
756 /* Warning! This macro doesn't work with K&R C (e.g., compare the "gcc -E"
757 output with and without -traditional) and shouldn't be used internally.
758 For public use only, but see the MPFR manual. */
759 #define MPFR_DECL_INIT(_x, _p) \
760 MPFR_EXTENSION mp_limb_t __gmpfr_local_tab_##_x[((_p)-1)/GMP_NUMB_BITS+1]; \
761 MPFR_EXTENSION mpfr_t _x = {{(_p),1,__MPFR_EXP_NAN,__gmpfr_local_tab_##_x}}
763 /* Fast access macros to replace function interface.
764 If the USER don't want to use the macro interface, let him make happy
765 even if it produces faster and smaller code. */
766 #ifndef MPFR_USE_NO_MACRO
768 /* Inlining theses functions is both faster and smaller */
769 #define mpfr_nan_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_NAN)
770 #define mpfr_inf_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_INF)
771 #define mpfr_zero_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_ZERO)
772 #define mpfr_regular_p(_x) ((_x)->_mpfr_exp > __MPFR_EXP_INF)
773 #define mpfr_sgn(_x) \
774 ((_x)->_mpfr_exp < __MPFR_EXP_INF ? \
775 (mpfr_nan_p (_x) ? mpfr_set_erangeflag () : (mpfr_void) 0), 0 : \
776 MPFR_SIGN (_x))
778 /* Prevent them from using as lvalues */
779 #define MPFR_VALUE_OF(x) (0 ? (x) : (x))
780 #define mpfr_get_prec(_x) MPFR_VALUE_OF((_x)->_mpfr_prec)
781 #define mpfr_get_exp(_x) MPFR_VALUE_OF((_x)->_mpfr_exp)
782 /* Note: if need be, the MPFR_VALUE_OF can be used for other expressions
783 (of any type). Thanks to Wojtek Lerch and Tim Rentsch for the idea. */
785 #define mpfr_round(a,b) mpfr_rint((a), (b), MPFR_RNDNA)
786 #define mpfr_trunc(a,b) mpfr_rint((a), (b), MPFR_RNDZ)
787 #define mpfr_ceil(a,b) mpfr_rint((a), (b), MPFR_RNDU)
788 #define mpfr_floor(a,b) mpfr_rint((a), (b), MPFR_RNDD)
790 #define mpfr_cmp_ui(b,i) mpfr_cmp_ui_2exp((b),(i),0)
791 #define mpfr_cmp_si(b,i) mpfr_cmp_si_2exp((b),(i),0)
792 #define mpfr_set(a,b,r) mpfr_set4(a,b,r,MPFR_SIGN(b))
793 #define mpfr_abs(a,b,r) mpfr_set4(a,b,r,1)
794 #define mpfr_copysign(a,b,c,r) mpfr_set4(a,b,r,MPFR_SIGN(c))
795 #define mpfr_setsign(a,b,s,r) mpfr_set4(a,b,r,(s) ? -1 : 1)
796 #define mpfr_signbit(x) (MPFR_SIGN(x) < 0)
797 #define mpfr_cmp(b, c) mpfr_cmp3(b, c, 1)
798 #define mpfr_mul_2exp(y,x,n,r) mpfr_mul_2ui((y),(x),(n),(r))
799 #define mpfr_div_2exp(y,x,n,r) mpfr_div_2ui((y),(x),(n),(r))
802 /* When using GCC, optimize certain common comparisons and affectations.
803 + Remove ICC since it defines __GNUC__ but produces a
804 huge number of warnings if you use this code.
805 VL: I couldn't reproduce a single warning when enabling these macros
806 with icc 10.1 20080212 on Itanium. But with this version, __ICC isn't
807 defined (__INTEL_COMPILER is, though), so that these macros are enabled
808 anyway. Checking with other ICC versions is needed. Possibly detect
809 whether warnings are produced or not with a configure test.
810 + Remove C++ too, since it complains too much. */
811 /* Added casts to improve robustness in case of undefined behavior and
812 compiler extensions based on UB (in particular -fwrapv). MPFR doesn't
813 use such extensions, but these macros will be used by 3rd-party code,
814 where such extensions may be required.
815 Moreover casts to unsigned long have been added to avoid warnings in
816 programs that use MPFR and are compiled with -Wconversion; such casts
817 are OK since if X is a constant expression, then (unsigned long) X is
818 also a constant expression, so that the optimizations still work. The
819 warnings are probably related to the following two bugs:
820 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4210
821 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38470 (possibly a variant)
822 and the casts could be removed once these bugs are fixed.
823 Casts shouldn't be used on the generic calls (to the ..._2exp functions),
824 where implicit conversions are performed. Indeed, having at least one
825 implicit conversion in the macro allows the compiler to emit diagnostics
826 when normally expected, for instance in the following call:
827 mpfr_set_ui (x, "foo", MPFR_RNDN);
828 If this is not possible (for future macros), one of the tricks described
829 on http://groups.google.com/group/comp.std.c/msg/e92abd24bf9eaf7b could
830 be used. */
831 #if defined (__GNUC__) && !defined(__ICC) && !defined(__cplusplus)
832 #if (__GNUC__ >= 2)
833 #undef mpfr_cmp_ui
834 /* We use the fact that mpfr_sgn on NaN sets the erange flag and returns 0.
835 But warning! mpfr_sgn is specified as a macro in the API, thus the macro
836 mustn't be used if side effects are possible, like here. */
837 #define mpfr_cmp_ui(_f,_u) \
838 (__builtin_constant_p (_u) && (mpfr_ulong) (_u) == 0 ? \
839 (mpfr_sgn) (_f) : \
840 mpfr_cmp_ui_2exp ((_f), (_u), 0))
841 #undef mpfr_cmp_si
842 #define mpfr_cmp_si(_f,_s) \
843 (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \
844 mpfr_cmp_ui ((_f), (mpfr_ulong) (mpfr_long) (_s)) : \
845 mpfr_cmp_si_2exp ((_f), (_s), 0))
846 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
847 #undef mpfr_set_ui
848 #define mpfr_set_ui(_f,_u,_r) \
849 (__builtin_constant_p (_u) && (mpfr_ulong) (_u) == 0 ? \
850 __extension__ ({ \
851 mpfr_ptr _p = (_f); \
852 _p->_mpfr_sign = 1; \
853 _p->_mpfr_exp = __MPFR_EXP_ZERO; \
854 (mpfr_void) (_r); 0; }) : \
855 mpfr_set_ui_2exp ((_f), (_u), 0, (_r)))
856 #endif
857 #undef mpfr_set_si
858 #define mpfr_set_si(_f,_s,_r) \
859 (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \
860 mpfr_set_ui ((_f), (mpfr_ulong) (mpfr_long) (_s), (_r)) : \
861 mpfr_set_si_2exp ((_f), (_s), 0, (_r)))
862 #endif
863 #endif
865 /* Macro version of mpfr_stack interface for fast access */
866 #define mpfr_custom_get_size(p) ((mpfr_size_t) \
867 (((p)+GMP_NUMB_BITS-1)/GMP_NUMB_BITS*sizeof (mp_limb_t)))
868 #define mpfr_custom_init(m,p) do {} while (0)
869 #define mpfr_custom_get_significand(x) ((mpfr_void*)((x)->_mpfr_d))
870 #define mpfr_custom_get_exp(x) ((x)->_mpfr_exp)
871 #define mpfr_custom_move(x,m) do { ((x)->_mpfr_d = (mp_limb_t*)(m)); } while (0)
872 #define mpfr_custom_init_set(x,k,e,p,m) do { \
873 mpfr_ptr _x = (x); \
874 mpfr_exp_t _e; \
875 mpfr_kind_t _t; \
876 mpfr_int _s, _k; \
877 _k = (k); \
878 if (_k >= 0) { \
879 _t = (mpfr_kind_t) _k; \
880 _s = 1; \
881 } else { \
882 _t = (mpfr_kind_t) -k; \
883 _s = -1; \
885 _e = _t == MPFR_REGULAR_KIND ? (e) : \
886 _t == MPFR_NAN_KIND ? __MPFR_EXP_NAN : \
887 _t == MPFR_INF_KIND ? __MPFR_EXP_INF : __MPFR_EXP_ZERO; \
888 _x->_mpfr_prec = (p); \
889 _x->_mpfr_sign = _s; \
890 _x->_mpfr_exp = _e; \
891 _x->_mpfr_d = (mp_limb_t*) (m); \
892 } while (0)
893 #define mpfr_custom_get_kind(x) \
894 ( (x)->_mpfr_exp > __MPFR_EXP_INF ? \
895 (mpfr_int) MPFR_REGULAR_KIND * MPFR_SIGN (x) \
896 : (x)->_mpfr_exp == __MPFR_EXP_INF ? \
897 (mpfr_int) MPFR_INF_KIND * MPFR_SIGN (x) \
898 : (x)->_mpfr_exp == __MPFR_EXP_NAN ? (mpfr_int) MPFR_NAN_KIND \
899 : (mpfr_int) MPFR_ZERO_KIND * MPFR_SIGN (x) )
902 #endif /* MPFR_USE_NO_MACRO */
904 /* Theses are defined to be macros */
905 #define mpfr_init_set_si(x, i, rnd) \
906 ( mpfr_init(x), mpfr_set_si((x), (i), (rnd)) )
907 #define mpfr_init_set_ui(x, i, rnd) \
908 ( mpfr_init(x), mpfr_set_ui((x), (i), (rnd)) )
909 #define mpfr_init_set_d(x, d, rnd) \
910 ( mpfr_init(x), mpfr_set_d((x), (d), (rnd)) )
911 #define mpfr_init_set_ld(x, d, rnd) \
912 ( mpfr_init(x), mpfr_set_ld((x), (d), (rnd)) )
913 #define mpfr_init_set_z(x, i, rnd) \
914 ( mpfr_init(x), mpfr_set_z((x), (i), (rnd)) )
915 #define mpfr_init_set_q(x, i, rnd) \
916 ( mpfr_init(x), mpfr_set_q((x), (i), (rnd)) )
917 #define mpfr_init_set(x, y, rnd) \
918 ( mpfr_init(x), mpfr_set((x), (y), (rnd)) )
919 #define mpfr_init_set_f(x, y, rnd) \
920 ( mpfr_init(x), mpfr_set_f((x), (y), (rnd)) )
922 /* Compatibility layer -- obsolete functions and macros */
923 #define mpfr_cmp_abs mpfr_cmpabs
924 #define mpfr_round_prec(x,r,p) mpfr_prec_round(x,p,r)
925 #define __gmp_default_rounding_mode (mpfr_get_default_rounding_mode())
926 #define __mpfr_emin (mpfr_get_emin())
927 #define __mpfr_emax (mpfr_get_emax())
928 #define __mpfr_default_fp_bit_precision (mpfr_get_default_fp_bit_precision())
929 #define MPFR_EMIN_MIN mpfr_get_emin_min()
930 #define MPFR_EMIN_MAX mpfr_get_emin_max()
931 #define MPFR_EMAX_MIN mpfr_get_emax_min()
932 #define MPFR_EMAX_MAX mpfr_get_emax_max()
933 #define mpfr_version (mpfr_get_version())
934 #ifndef mpz_set_fr
935 # define mpz_set_fr mpfr_get_z
936 #endif
937 #define mpfr_add_one_ulp(x,r) \
938 (mpfr_sgn (x) > 0 ? mpfr_nextabove (x) : mpfr_nextbelow (x))
939 #define mpfr_sub_one_ulp(x,r) \
940 (mpfr_sgn (x) > 0 ? mpfr_nextbelow (x) : mpfr_nextabove (x))
941 #define mpfr_get_z_exp mpfr_get_z_2exp
942 #define mpfr_custom_get_mantissa mpfr_custom_get_significand
944 #endif /* __MPFR_H*/