xref: /netbsd-src/external/lgpl3/mpfr/dist/src/mpf2mpfr.h (revision ba125506a622fe649968631a56eba5d42ff57863)
1 /* mpf2mpfr.h -- Compatibility include file with mpf.
2 
3 Copyright 1999-2002, 2004-2023 Free Software Foundation, Inc.
4 Contributed by the AriC and Caramba projects, INRIA.
5 
6 This file is part of the GNU MPFR Library.
7 
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.
12 
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.
17 
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 https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
21 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
22 
23 #ifndef __MPFR_FROM_MPF__
24 #define __MPFR_FROM_MPF__
25 
26 /* types */
27 #define mpf_t mpfr_t
28 #define mpf_srcptr mpfr_srcptr
29 #define mpf_ptr mpfr_ptr
30 
31 /* Get current Rounding Mode */
32 #ifndef MPFR_DEFAULT_RND
33 # define MPFR_DEFAULT_RND mpfr_get_default_rounding_mode ()
34 #endif
35 
36 /* mpf_init initializes at 0 */
37 #undef mpf_init
38 #define mpf_init(x) mpfr_init_set_ui ((x), 0, MPFR_DEFAULT_RND)
39 #undef mpf_init2
40 #define mpf_init2(x,p) (mpfr_init2((x),(p)), mpfr_set_ui ((x), 0, MPFR_DEFAULT_RND))
41 
42 /* Warning! This assumes that all pointer types have the same representation. */
43 #undef mpf_inits
44 #define mpf_inits mpfr_inits
45 #undef mpf_clears
46 #define mpf_clears mpfr_clears
47 
48 /* functions which don't take as argument the rounding mode */
49 #undef mpf_ceil
50 #define mpf_ceil mpfr_ceil
51 #undef mpf_clear
52 #define mpf_clear mpfr_clear
53 #undef mpf_cmp
54 #define mpf_cmp mpfr_cmp
55 #undef mpf_cmp_si
56 #define mpf_cmp_si mpfr_cmp_si
57 #undef mpf_cmp_ui
58 #define mpf_cmp_ui mpfr_cmp_ui
59 #undef mpf_cmp_d
60 #define mpf_cmp_d mpfr_cmp_d
61 /* mpf_cmp_z appeared in GMP 6.1.0 */
62 #if __GNU_MP_VERSION > 6 || (__GNU_MP_VERSION == 6 && __GNU_MP_VERSION_MINOR >= 1)
63 #undef mpf_cmp_z
64 #define mpf_cmp_z mpfr_cmp_z
65 #endif
66 #undef mpf_eq
67 #define mpf_eq mpfr_eq
68 #undef mpf_floor
69 #define mpf_floor mpfr_floor
70 #undef mpf_get_prec
71 #define mpf_get_prec mpfr_get_prec
72 #undef mpf_integer_p
73 #define mpf_integer_p mpfr_integer_p
74 #undef mpf_random2
75 #define mpf_random2 mpfr_random2
76 #undef mpf_set_default_prec
77 #define mpf_set_default_prec mpfr_set_default_prec
78 #undef mpf_get_default_prec
79 #define mpf_get_default_prec mpfr_get_default_prec
80 #undef mpf_set_prec
81 #define mpf_set_prec mpfr_set_prec
82 #undef mpf_set_prec_raw
83 #define mpf_set_prec_raw(x,p) mpfr_prec_round(x,p,MPFR_DEFAULT_RND)
84 #undef mpf_trunc
85 #define mpf_trunc mpfr_trunc
86 #undef mpf_sgn
87 #define mpf_sgn mpfr_sgn
88 #undef mpf_swap
89 #define mpf_swap mpfr_swap
90 #undef mpf_dump
91 #define mpf_dump mpfr_dump
92 
93 /* functions which take as argument the rounding mode */
94 #undef mpf_abs
95 #define mpf_abs(x,y) mpfr_abs(x,y,MPFR_DEFAULT_RND)
96 #undef mpf_add
97 #define mpf_add(x,y,z) mpfr_add(x,y,z,MPFR_DEFAULT_RND)
98 #undef mpf_add_ui
99 #define mpf_add_ui(x,y,z) mpfr_add_ui(x,y,z,MPFR_DEFAULT_RND)
100 #undef mpf_div
101 #define mpf_div(x,y,z) mpfr_div(x,y,z,MPFR_DEFAULT_RND)
102 #undef mpf_div_ui
103 #define mpf_div_ui(x,y,z) mpfr_div_ui(x,y,z,MPFR_DEFAULT_RND)
104 #undef mpf_div_2exp
105 #define mpf_div_2exp(x,y,z) mpfr_div_2exp(x,y,z,MPFR_DEFAULT_RND)
106 #undef mpf_fits_slong_p
107 #define mpf_fits_slong_p(x) mpfr_fits_slong_p(x,MPFR_DEFAULT_RND)
108 #undef mpf_fits_ulong_p
109 #define mpf_fits_ulong_p(x) mpfr_fits_ulong_p(x,MPFR_DEFAULT_RND)
110 #undef mpf_fits_sint_p
111 #define mpf_fits_sint_p(x) mpfr_fits_sint_p(x,MPFR_DEFAULT_RND)
112 #undef mpf_fits_uint_p
113 #define mpf_fits_uint_p(x) mpfr_fits_uint_p(x,MPFR_DEFAULT_RND)
114 #undef mpf_fits_sshort_p
115 #define mpf_fits_sshort_p(x) mpfr_fits_sshort_p(x,MPFR_DEFAULT_RND)
116 #undef mpf_fits_ushort_p
117 #define mpf_fits_ushort_p(x) mpfr_fits_ushort_p(x,MPFR_DEFAULT_RND)
118 #undef mpf_get_str
119 #define mpf_get_str(x,y,z,t,u) mpfr_get_str(x,y,z,t,u,MPFR_DEFAULT_RND)
120 #undef mpf_get_d
121 #define mpf_get_d(x) mpfr_get_d(x,MPFR_DEFAULT_RND)
122 #undef mpf_get_d_2exp
123 #define mpf_get_d_2exp(e,x) mpfr_get_d_2exp(e,x,MPFR_DEFAULT_RND)
124 #undef mpf_get_ui
125 #define mpf_get_ui(x) mpfr_get_ui(x,MPFR_DEFAULT_RND)
126 #undef mpf_get_si
127 #define mpf_get_si(x) mpfr_get_si(x,MPFR_DEFAULT_RND)
128 #undef mpf_inp_str
129 #define mpf_inp_str(x,y,z) mpfr_inp_str(x,y,z,MPFR_DEFAULT_RND)
130 #undef mpf_set_str
131 #define mpf_set_str(x,y,z) mpfr_set_str(x,y,z,MPFR_DEFAULT_RND)
132 #undef mpf_init_set
133 #define mpf_init_set(x,y) mpfr_init_set(x,y,MPFR_DEFAULT_RND)
134 #undef mpf_init_set_d
135 #define mpf_init_set_d(x,y) mpfr_init_set_d(x,y,MPFR_DEFAULT_RND)
136 #undef mpf_init_set_si
137 #define mpf_init_set_si(x,y) mpfr_init_set_si(x,y,MPFR_DEFAULT_RND)
138 #undef mpf_init_set_str
139 #define mpf_init_set_str(x,y,z) mpfr_init_set_str(x,y,z,MPFR_DEFAULT_RND)
140 #undef mpf_init_set_ui
141 #define mpf_init_set_ui(x,y) mpfr_init_set_ui(x,y,MPFR_DEFAULT_RND)
142 #undef mpf_mul
143 #define mpf_mul(x,y,z) mpfr_mul(x,y,z,MPFR_DEFAULT_RND)
144 #undef mpf_mul_2exp
145 #define mpf_mul_2exp(x,y,z) mpfr_mul_2exp(x,y,z,MPFR_DEFAULT_RND)
146 #undef mpf_mul_ui
147 #define mpf_mul_ui(x,y,z) mpfr_mul_ui(x,y,z,MPFR_DEFAULT_RND)
148 #undef mpf_neg
149 #define mpf_neg(x,y) mpfr_neg(x,y,MPFR_DEFAULT_RND)
150 #undef mpf_out_str
151 #define mpf_out_str(x,y,z,t) mpfr_out_str(x,y,z,t,MPFR_DEFAULT_RND)
152 #undef mpf_pow_ui
153 #define mpf_pow_ui(x,y,z) mpfr_pow_ui(x,y,z,MPFR_DEFAULT_RND)
154 #undef mpf_reldiff
155 #define mpf_reldiff(x,y,z) mpfr_reldiff(x,y,z,MPFR_DEFAULT_RND)
156 #undef mpf_set
157 #define mpf_set(x,y) mpfr_set(x,y,MPFR_DEFAULT_RND)
158 #undef mpf_set_d
159 #define mpf_set_d(x,y) mpfr_set_d(x,y,MPFR_DEFAULT_RND)
160 #undef mpf_set_q
161 #define mpf_set_q(x,y) mpfr_set_q(x,y,MPFR_DEFAULT_RND)
162 #undef mpf_set_si
163 #define mpf_set_si(x,y) mpfr_set_si(x,y,MPFR_DEFAULT_RND)
164 #undef mpf_set_ui
165 #define mpf_set_ui(x,y) mpfr_set_ui(x,y,MPFR_DEFAULT_RND)
166 #undef mpf_set_z
167 #define mpf_set_z(x,y) mpfr_set_z(x,y,MPFR_DEFAULT_RND)
168 #undef mpf_sqrt
169 #define mpf_sqrt(x,y) mpfr_sqrt(x,y,MPFR_DEFAULT_RND)
170 #undef mpf_sqrt_ui
171 #define mpf_sqrt_ui(x,y) mpfr_sqrt_ui(x,y,MPFR_DEFAULT_RND)
172 #undef mpf_sub
173 #define mpf_sub(x,y,z) mpfr_sub(x,y,z,MPFR_DEFAULT_RND)
174 #undef mpf_sub_ui
175 #define mpf_sub_ui(x,y,z) mpfr_sub_ui(x,y,z,MPFR_DEFAULT_RND)
176 #undef mpf_ui_div
177 #define mpf_ui_div(x,y,z) mpfr_ui_div(x,y,z,MPFR_DEFAULT_RND)
178 #undef mpf_ui_sub
179 #define mpf_ui_sub(x,y,z) mpfr_ui_sub(x,y,z,MPFR_DEFAULT_RND)
180 #undef mpf_urandomb
181 #define mpf_urandomb(x,y,n) mpfr_urandomb(x,y)
182 
183 #undef mpz_set_f
184 #define mpz_set_f(z,f) mpfr_get_z(z,f,MPFR_DEFAULT_RND)
185 #undef mpq_set_f
186 #define mpq_set_f(q,f) mpfr_get_q(q,f)
187 
188 #endif /* __MPFR_FROM_MPF__ */
189