ruby-mpfr 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -2
- data/Manifest.txt +33 -7
- data/README.rdoc +10 -8
- data/Rakefile +4 -3
- data/ext/{extconf.rb → mpfr/extconf.rb} +4 -0
- data/ext/{ruby_mpfr.c → mpfr/ruby_mpfr.c} +466 -199
- data/ext/{ruby_mpfr.h → mpfr/ruby_mpfr.h} +2 -0
- data/ext/mpfr_matrix/mpfr/extconf.rb +7 -0
- data/ext/mpfr_matrix/mpfr/func_mpfr_matrix.c +524 -0
- data/ext/mpfr_matrix/mpfr/func_mpfr_matrix.h +72 -0
- data/ext/mpfr_matrix/mpfr/ruby_mpfr.h +40 -0
- data/ext/mpfr_matrix/mpfr/ruby_mpfr_matrix.c +1056 -0
- data/ext/mpfr_matrix/mpfr/ruby_mpfr_matrix.h +13 -0
- data/lib/mpfr/matrix.rb +145 -0
- data/lib/mpfr/version.rb +3 -0
- data/ruby-mpfr.gemspec +36 -0
- data/spec/mpfr/allocate_spec.rb +60 -0
- data/spec/mpfr/arithmetic_spec.rb +64 -0
- data/spec/mpfr/comparison_spec.rb +21 -0
- data/spec/mpfr/constant_spec.rb +23 -0
- data/spec/mpfr/conversion_spec.rb +14 -0
- data/spec/mpfr/exception_spec.rb +60 -0
- data/spec/mpfr/functions_spec.rb +25 -0
- data/spec/mpfr/generate_number_modulue.rb +44 -0
- data/spec/mpfr/precision_roundmode_spec.rb +65 -0
- data/spec/mpfr/rounding_spec.rb +51 -0
- data/spec/mpfr/set_value_spec.rb +77 -0
- data/spec/mpfr/spec_helper.rb +13 -0
- data/spec/mpfr/string_spec.rb +58 -0
- data/spec/mpfr_matrix/generate_matrix_arguments.rb +55 -0
- data/spec/mpfr_matrix/mpfr_matrix_alloc_spec.rb +126 -0
- data/spec/mpfr_matrix/mpfr_matrix_arithmetic_spec.rb +93 -0
- data/spec/mpfr_matrix/mpfr_matrix_set_element_spec.rb +55 -0
- data/spec/mpfr_matrix/mpfr_matrix_string_spec.rb +31 -0
- data/spec/mpfr_matrix/mpfr_square_matrix_spec.rb +75 -0
- data/spec/mpfr_matrix/spec_helper.rb +16 -0
- data/tasks/extconf.rake +36 -0
- metadata +48 -16
- data/lib/ruby-mpfr.rb +0 -6
- data/spec/ruby-mpfr_spec.rb +0 -11
- data/spec/spec_helper.rb +0 -10
- data/tasks/rspec.rake +0 -21
@@ -9,7 +9,8 @@ static VALUE __mpfr_class__, __sym_to_s__, __sym_to_str__;
|
|
9
9
|
|
10
10
|
/* Convert VALUE rnd (rounding mode number) to C integer and */
|
11
11
|
/* return it if it is valid as rounding mode number. */
|
12
|
-
mp_rnd_t r_mpfr_rnd_from_value(VALUE rnd)
|
12
|
+
mp_rnd_t r_mpfr_rnd_from_value(VALUE rnd)
|
13
|
+
{
|
13
14
|
mp_rnd_t r = (mp_rnd_t)NUM2INT(rnd);
|
14
15
|
if(!VALID_RND(r)){
|
15
16
|
rb_raise(rb_eArgError, "Argument must be Rounding Mode.");
|
@@ -19,7 +20,8 @@ mp_rnd_t r_mpfr_rnd_from_value(VALUE rnd){
|
|
19
20
|
|
20
21
|
/* If argc equals max, convert last argument to rounding mode number. */
|
21
22
|
/* Otherwise, return defoult rounding mode number. */
|
22
|
-
mp_rnd_t r_mpfr_rnd_from_optional_argument(int min, int max, int argc, VALUE *argv)
|
23
|
+
mp_rnd_t r_mpfr_rnd_from_optional_argument(int min, int max, int argc, VALUE *argv)
|
24
|
+
{
|
23
25
|
mp_rnd_t rnd;
|
24
26
|
if(argc >= min && argc <= max){
|
25
27
|
if(argc == max){
|
@@ -35,7 +37,8 @@ mp_rnd_t r_mpfr_rnd_from_optional_argument(int min, int max, int argc, VALUE *ar
|
|
35
37
|
|
36
38
|
/* If argc equals max, convert last argument to precision number. */
|
37
39
|
/* Otherwise, return defoult precision number. */
|
38
|
-
mp_rnd_t r_mpfr_prec_from_optional_argument(int min, int max, int argc, VALUE *argv)
|
40
|
+
mp_rnd_t r_mpfr_prec_from_optional_argument(int min, int max, int argc, VALUE *argv)
|
41
|
+
{
|
39
42
|
mp_prec_t prec;
|
40
43
|
if(argc >= min && argc <= max){
|
41
44
|
if(argc == max){
|
@@ -52,7 +55,8 @@ mp_rnd_t r_mpfr_prec_from_optional_argument(int min, int max, int argc, VALUE *a
|
|
52
55
|
/* min is a minimum number of arguments. */
|
53
56
|
/* max is a maximum number of arguments. */
|
54
57
|
void r_mpfr_get_rnd_prec_from_optional_arguments(mp_rnd_t *rnd, mp_prec_t *prec, int min, int max,
|
55
|
-
int argc, VALUE *argv)
|
58
|
+
int argc, VALUE *argv)
|
59
|
+
{
|
56
60
|
if(argc >= min && argc <= max){
|
57
61
|
if(argc >= max - 1){
|
58
62
|
*rnd = r_mpfr_rnd_from_value(argv[max - 2]);
|
@@ -71,7 +75,8 @@ void r_mpfr_get_rnd_prec_from_optional_arguments(mp_rnd_t *rnd, mp_prec_t *prec,
|
|
71
75
|
|
72
76
|
|
73
77
|
/* Set the default MPFR precision in bits. */
|
74
|
-
static VALUE r_mpfr_set_default_prec(VALUE self, VALUE prec)
|
78
|
+
static VALUE r_mpfr_set_default_prec(VALUE self, VALUE prec)
|
79
|
+
{
|
75
80
|
int set_prec = NUM2INT(prec);
|
76
81
|
if(set_prec <= 0){
|
77
82
|
rb_raise(rb_eRangeError, "Argument must be positive.");
|
@@ -81,10 +86,14 @@ static VALUE r_mpfr_set_default_prec(VALUE self, VALUE prec){
|
|
81
86
|
}
|
82
87
|
|
83
88
|
/* Return the default MPFR precision in bits. */
|
84
|
-
static VALUE r_mpfr_get_default_prec(VALUE self)
|
89
|
+
static VALUE r_mpfr_get_default_prec(VALUE self)
|
90
|
+
{
|
91
|
+
return INT2NUM((int)mpfr_get_default_prec());
|
92
|
+
}
|
85
93
|
|
86
94
|
/* Set the default rounding mode. The default rounding mode is MPFR::RNDN. */
|
87
|
-
static VALUE r_mpfr_set_default_rounding_mode(VALUE self, VALUE rnd)
|
95
|
+
static VALUE r_mpfr_set_default_rounding_mode(VALUE self, VALUE rnd)
|
96
|
+
{
|
88
97
|
mp_rnd_t a = NUM2INT(rnd);
|
89
98
|
if(VALID_RND(a)){
|
90
99
|
mpfr_set_default_rounding_mode(a);
|
@@ -95,86 +104,173 @@ static VALUE r_mpfr_set_default_rounding_mode(VALUE self, VALUE rnd){
|
|
95
104
|
}
|
96
105
|
|
97
106
|
/* Get the default rounding mode. */
|
98
|
-
static VALUE r_mpfr_get_default_rounding_mode(VALUE self)
|
107
|
+
static VALUE r_mpfr_get_default_rounding_mode(VALUE self)
|
108
|
+
{
|
109
|
+
return INT2NUM(mpfr_get_default_rounding_mode());
|
110
|
+
}
|
99
111
|
|
100
112
|
/* ------------------------------ Precision and Rounding Mode End ------------------------------ */
|
101
113
|
|
102
114
|
/* ------------------------------ Exception Related Functions Start ------------------------------ */
|
103
115
|
|
104
116
|
/* Return integer which is mpfr_get_emin(). */
|
105
|
-
static VALUE r_mpfr_get_emin(VALUE self)
|
117
|
+
static VALUE r_mpfr_get_emin(VALUE self)
|
118
|
+
{
|
119
|
+
return INT2NUM(mpfr_get_emin());
|
120
|
+
}
|
106
121
|
|
107
122
|
/* Return integer which is mpfr_get_emax(). */
|
108
|
-
static VALUE r_mpfr_get_emax(VALUE self)
|
123
|
+
static VALUE r_mpfr_get_emax(VALUE self)
|
124
|
+
{
|
125
|
+
return INT2NUM(mpfr_get_emax());
|
126
|
+
}
|
109
127
|
|
110
128
|
/* Return integer which is mpfr_set_emin( p1 ). */
|
111
|
-
static VALUE r_mpfr_set_emin(VALUE self, VALUE exp)
|
129
|
+
static VALUE r_mpfr_set_emin(VALUE self, VALUE exp)
|
130
|
+
{
|
131
|
+
return INT2NUM(mpfr_set_emin(NUM2INT(exp)));
|
132
|
+
}
|
112
133
|
|
113
134
|
/* Return integer which is mpfr_set_emax( p1 ). */
|
114
|
-
static VALUE r_mpfr_set_emax(VALUE self, VALUE exp)
|
135
|
+
static VALUE r_mpfr_set_emax(VALUE self, VALUE exp)
|
136
|
+
{
|
137
|
+
return INT2NUM(mpfr_set_emax(NUM2INT(exp)));
|
138
|
+
}
|
115
139
|
|
116
140
|
/* Return integer which is mpfr_get_emin_min(). */
|
117
|
-
static VALUE r_mpfr_get_emin_min(VALUE self)
|
141
|
+
static VALUE r_mpfr_get_emin_min(VALUE self)
|
142
|
+
{
|
143
|
+
return INT2NUM(mpfr_get_emin_min());
|
144
|
+
}
|
118
145
|
|
119
146
|
/* Return integer which is mpfr_get_emin_max(). */
|
120
|
-
static VALUE r_mpfr_get_emin_max(VALUE self)
|
147
|
+
static VALUE r_mpfr_get_emin_max(VALUE self)
|
148
|
+
{
|
149
|
+
return INT2NUM(mpfr_get_emin_max());
|
150
|
+
}
|
121
151
|
|
122
152
|
/* Return integer which is mpfr_get_emax_min(). */
|
123
|
-
static VALUE r_mpfr_get_emax_min(VALUE self)
|
153
|
+
static VALUE r_mpfr_get_emax_min(VALUE self)
|
154
|
+
{
|
155
|
+
return INT2NUM(mpfr_get_emax_min());
|
156
|
+
}
|
124
157
|
|
125
158
|
/* Return integer which is mpfr_get_emax_max(). */
|
126
|
-
static VALUE r_mpfr_get_emax_max(VALUE self)
|
159
|
+
static VALUE r_mpfr_get_emax_max(VALUE self)
|
160
|
+
{
|
161
|
+
return INT2NUM(mpfr_get_emax_max());
|
162
|
+
}
|
127
163
|
|
128
164
|
/* Execute mpfr_clear_underflow() and return nil. */
|
129
|
-
static VALUE r_mpfr_clear_underflow(VALUE self)
|
165
|
+
static VALUE r_mpfr_clear_underflow(VALUE self)
|
166
|
+
{
|
167
|
+
mpfr_clear_underflow();
|
168
|
+
return Qnil;
|
169
|
+
}
|
130
170
|
|
131
171
|
/* Execute mpfr_clear_overflow() and return nil. */
|
132
|
-
static VALUE r_mpfr_clear_overflow(VALUE self)
|
172
|
+
static VALUE r_mpfr_clear_overflow(VALUE self)
|
173
|
+
{
|
174
|
+
mpfr_clear_overflow();
|
175
|
+
return Qnil;
|
176
|
+
}
|
133
177
|
|
134
178
|
/* Execute mpfr_clear_nanflag() and return nil. */
|
135
|
-
static VALUE r_mpfr_clear_nanflag(VALUE self)
|
179
|
+
static VALUE r_mpfr_clear_nanflag(VALUE self)
|
180
|
+
{
|
181
|
+
mpfr_clear_nanflag();
|
182
|
+
return Qnil;
|
183
|
+
}
|
136
184
|
|
137
185
|
/* Execute mpfr_clear_inexflag() and return nil. */
|
138
|
-
static VALUE r_mpfr_clear_inexflag(VALUE self)
|
186
|
+
static VALUE r_mpfr_clear_inexflag(VALUE self)
|
187
|
+
{
|
188
|
+
mpfr_clear_inexflag();
|
189
|
+
return Qnil;
|
190
|
+
}
|
139
191
|
|
140
192
|
/* Execute mpfr_clear_erangeflag() and return nil. */
|
141
|
-
static VALUE r_mpfr_clear_erangeflag(VALUE self)
|
193
|
+
static VALUE r_mpfr_clear_erangeflag(VALUE self)
|
194
|
+
{
|
195
|
+
mpfr_clear_erangeflag();
|
196
|
+
return Qnil;
|
197
|
+
}
|
142
198
|
|
143
199
|
/* Execute mpfr_set_underflow() and return nil. */
|
144
|
-
static VALUE r_mpfr_set_underflow(VALUE self)
|
200
|
+
static VALUE r_mpfr_set_underflow(VALUE self)
|
201
|
+
{
|
202
|
+
mpfr_set_underflow();
|
203
|
+
return Qnil;
|
204
|
+
}
|
145
205
|
|
146
206
|
/* Execute mpfr_set_overflow() and return nil. */
|
147
|
-
static VALUE r_mpfr_set_overflow(VALUE self)
|
207
|
+
static VALUE r_mpfr_set_overflow(VALUE self)
|
208
|
+
{
|
209
|
+
mpfr_set_overflow();
|
210
|
+
return Qnil;
|
211
|
+
}
|
148
212
|
|
149
213
|
/* Execute mpfr_set_nanflag() and return nil. */
|
150
|
-
static VALUE r_mpfr_set_nanflag(VALUE self)
|
214
|
+
static VALUE r_mpfr_set_nanflag(VALUE self)
|
215
|
+
{
|
216
|
+
mpfr_set_nanflag();
|
217
|
+
return Qnil;
|
218
|
+
}
|
151
219
|
|
152
220
|
/* Execute mpfr_set_inexflag() and return nil. */
|
153
|
-
static VALUE r_mpfr_set_inexflag(VALUE self)
|
221
|
+
static VALUE r_mpfr_set_inexflag(VALUE self)
|
222
|
+
{
|
223
|
+
mpfr_set_inexflag();
|
224
|
+
return Qnil;
|
225
|
+
}
|
154
226
|
|
155
227
|
/* Execute mpfr_set_erangeflag() and return nil. */
|
156
|
-
static VALUE r_mpfr_set_erangeflag(VALUE self)
|
228
|
+
static VALUE r_mpfr_set_erangeflag(VALUE self)
|
229
|
+
{
|
230
|
+
mpfr_set_erangeflag();
|
231
|
+
return Qnil;
|
232
|
+
}
|
157
233
|
|
158
234
|
/* Execute mpfr_clear_flags() and return nil. */
|
159
|
-
static VALUE r_mpfr_clear_flags(VALUE self)
|
235
|
+
static VALUE r_mpfr_clear_flags(VALUE self)
|
236
|
+
{
|
237
|
+
mpfr_clear_flags();
|
238
|
+
return Qnil;
|
239
|
+
}
|
160
240
|
|
161
241
|
/* If underflow flag is set, this method returns true. Otherwise nil. */
|
162
|
-
static VALUE r_mpfr_underflow_p(VALUE self)
|
242
|
+
static VALUE r_mpfr_underflow_p(VALUE self)
|
243
|
+
{
|
244
|
+
return (mpfr_underflow_p() != 0 ? Qtrue : Qfalse);
|
245
|
+
}
|
163
246
|
|
164
247
|
/* If owerflow flag is set, this method returns true. Otherwise nil. */
|
165
|
-
static VALUE r_mpfr_overflow_p(VALUE self)
|
248
|
+
static VALUE r_mpfr_overflow_p(VALUE self)
|
249
|
+
{
|
250
|
+
return (mpfr_overflow_p() != 0 ? Qtrue : Qfalse);
|
251
|
+
}
|
166
252
|
|
167
253
|
/* If invalid flag is set, this method returns true. Otherwise nil. */
|
168
|
-
static VALUE r_mpfr_nanflag_p(VALUE self)
|
254
|
+
static VALUE r_mpfr_nanflag_p(VALUE self)
|
255
|
+
{
|
256
|
+
return (mpfr_nanflag_p() != 0 ? Qtrue : Qfalse);
|
257
|
+
}
|
169
258
|
|
170
259
|
/* If inexact flag is set, this method returns true. Otherwise nil. */
|
171
|
-
static VALUE r_mpfr_inexflag_p(VALUE self)
|
260
|
+
static VALUE r_mpfr_inexflag_p(VALUE self)
|
261
|
+
{
|
262
|
+
return (mpfr_inexflag_p() != 0 ? Qtrue : Qfalse);
|
263
|
+
}
|
172
264
|
|
173
265
|
/* If erange flag is set, this method returns true. Otherwise nil. */
|
174
|
-
static VALUE r_mpfr_erangeflag_p(VALUE self)
|
266
|
+
static VALUE r_mpfr_erangeflag_p(VALUE self)
|
267
|
+
{
|
268
|
+
return (mpfr_erangeflag_p() != 0 ? Qtrue : Qfalse);
|
269
|
+
}
|
175
270
|
|
176
271
|
/* Execute mpfr_check_range( self, p1, rnd ) and return self. */
|
177
|
-
static VALUE r_mpfr_check_range(int argc, VALUE *argv, VALUE self)
|
272
|
+
static VALUE r_mpfr_check_range(int argc, VALUE *argv, VALUE self)
|
273
|
+
{
|
178
274
|
mp_rnd_t rnd = r_mpfr_rnd_from_optional_argument(1, 2, argc, argv);
|
179
275
|
MPFR *ptr_self;
|
180
276
|
r_mpfr_get_struct(ptr_self, self);
|
@@ -183,7 +279,8 @@ static VALUE r_mpfr_check_range(int argc, VALUE *argv, VALUE self){
|
|
183
279
|
}
|
184
280
|
|
185
281
|
/* Execute mpfr_subnormalize( self, p1, rnd ) and return self. */
|
186
|
-
static VALUE r_mpfr_subnormalize(int argc, VALUE *argv, VALUE self)
|
282
|
+
static VALUE r_mpfr_subnormalize(int argc, VALUE *argv, VALUE self)
|
283
|
+
{
|
187
284
|
mp_rnd_t rnd = r_mpfr_rnd_from_optional_argument(1, 2, argc, argv);
|
188
285
|
MPFR *ptr_self;
|
189
286
|
r_mpfr_get_struct(ptr_self, self);
|
@@ -195,12 +292,32 @@ static VALUE r_mpfr_subnormalize(int argc, VALUE *argv, VALUE self){
|
|
195
292
|
|
196
293
|
/* ------------------------------ MPFR allocation Start ------------------------------ */
|
197
294
|
|
198
|
-
void r_mpfr_free(void *ptr)
|
295
|
+
void r_mpfr_free(void *ptr)
|
296
|
+
{
|
199
297
|
mpfr_clear(ptr);
|
200
298
|
free(ptr);
|
201
299
|
}
|
202
300
|
|
203
|
-
|
301
|
+
VALUE r_mpfr_make_new_fr_obj(MPFR *ptr)
|
302
|
+
{
|
303
|
+
VALUE ret;
|
304
|
+
MPFR *ptr_ret;
|
305
|
+
r_mpfr_make_struct_init(ret, ptr_ret);
|
306
|
+
mpfr_set(ptr_ret, ptr, mpfr_get_default_prec());
|
307
|
+
return ret;
|
308
|
+
}
|
309
|
+
|
310
|
+
VALUE r_mpfr_make_new_fr_obj2(MPFR *ptr, int prec)
|
311
|
+
{
|
312
|
+
VALUE ret;
|
313
|
+
MPFR *ptr_ret;
|
314
|
+
r_mpfr_make_struct_init2(ret, ptr_ret, prec);
|
315
|
+
mpfr_set(ptr_ret, ptr, prec);
|
316
|
+
return ret;
|
317
|
+
}
|
318
|
+
|
319
|
+
static void r_mpfr_convert_to_str_set(MPFR *ptr, VALUE obj, mp_rnd_t rnd)
|
320
|
+
{
|
204
321
|
if(RTEST(rb_funcall(rb_funcall(obj, class, 0), method_defined, 1, __sym_to_str__))){
|
205
322
|
char *str = StringValuePtr(obj);
|
206
323
|
mpfr_set_str(ptr, str, 10, rnd);
|
@@ -211,7 +328,8 @@ static void r_mpfr_convert_to_str_set(MPFR *ptr, VALUE obj, mp_rnd_t rnd){
|
|
211
328
|
}
|
212
329
|
}
|
213
330
|
|
214
|
-
void r_mpfr_set_robj(MPFR *ptr, VALUE obj, mp_rnd_t rnd)
|
331
|
+
void r_mpfr_set_robj(MPFR *ptr, VALUE obj, mp_rnd_t rnd)
|
332
|
+
{
|
215
333
|
if(RTEST(rb_funcall(__mpfr_class__, eqq, 1, obj))){
|
216
334
|
MPFR *ptr_obj;
|
217
335
|
r_mpfr_get_struct(ptr_obj, obj);
|
@@ -239,7 +357,8 @@ void r_mpfr_set_robj(MPFR *ptr, VALUE obj, mp_rnd_t rnd){
|
|
239
357
|
|
240
358
|
/* If obj is MPFR instance, then this method returns obj. */
|
241
359
|
/* Otherwise it returns MPFR.new(obj). */
|
242
|
-
VALUE r_mpfr_new_fr_obj(VALUE obj)
|
360
|
+
VALUE r_mpfr_new_fr_obj(VALUE obj)
|
361
|
+
{
|
243
362
|
if(RTEST(rb_funcall(__mpfr_class__, eqq, 1, obj))){
|
244
363
|
return obj;
|
245
364
|
}else{
|
@@ -247,7 +366,8 @@ VALUE r_mpfr_new_fr_obj(VALUE obj){
|
|
247
366
|
}
|
248
367
|
}
|
249
368
|
|
250
|
-
static VALUE r_mpfr_alloc(VALUE self)
|
369
|
+
static VALUE r_mpfr_alloc(VALUE self)
|
370
|
+
{
|
251
371
|
MPFR *ptr;
|
252
372
|
r_mpfr_make_struct(self, ptr);
|
253
373
|
return self;
|
@@ -259,7 +379,8 @@ static VALUE r_mpfr_alloc(VALUE self){
|
|
259
379
|
Possible arguments are value, rounding mode, and precesion.
|
260
380
|
All arguments are optional.
|
261
381
|
*/
|
262
|
-
static VALUE r_mpfr_initialize(int argc, VALUE *argv, VALUE self)
|
382
|
+
static VALUE r_mpfr_initialize(int argc, VALUE *argv, VALUE self)
|
383
|
+
{
|
263
384
|
MPFR *ptr;
|
264
385
|
r_mpfr_get_struct(ptr, self);
|
265
386
|
switch(argc){
|
@@ -288,7 +409,8 @@ static VALUE r_mpfr_initialize(int argc, VALUE *argv, VALUE self){
|
|
288
409
|
}
|
289
410
|
|
290
411
|
/* This method is the method of initialization for copying object. */
|
291
|
-
static VALUE r_mpfr_initialize_copy(VALUE self, VALUE other)
|
412
|
+
static VALUE r_mpfr_initialize_copy(VALUE self, VALUE other)
|
413
|
+
{
|
292
414
|
MPFR *ptr_self, *ptr_other;
|
293
415
|
r_mpfr_get_struct(ptr_self, self);
|
294
416
|
r_mpfr_get_struct(ptr_other, other);
|
@@ -298,7 +420,8 @@ static VALUE r_mpfr_initialize_copy(VALUE self, VALUE other){
|
|
298
420
|
}
|
299
421
|
|
300
422
|
/* Return array which have MPFR instance converted to from p1 and self. */
|
301
|
-
static VALUE r_mpfr_coerce(VALUE self, VALUE other)
|
423
|
+
static VALUE r_mpfr_coerce(VALUE self, VALUE other)
|
424
|
+
{
|
302
425
|
VALUE val_other;
|
303
426
|
MPFR *ptr_self, *ptr_other;
|
304
427
|
r_mpfr_get_struct(ptr_self, self);
|
@@ -308,7 +431,8 @@ static VALUE r_mpfr_coerce(VALUE self, VALUE other){
|
|
308
431
|
}
|
309
432
|
|
310
433
|
/* Return NaN. This method takes one optional argument meaning precision. */
|
311
|
-
static VALUE r_mpfr_nan(int argc, VALUE *argv, VALUE self)
|
434
|
+
static VALUE r_mpfr_nan(int argc, VALUE *argv, VALUE self)
|
435
|
+
{
|
312
436
|
mp_prec_t prec = r_mpfr_prec_from_optional_argument(0, 1, argc, argv);
|
313
437
|
MPFR *ptr_return;
|
314
438
|
VALUE val_ret;
|
@@ -318,7 +442,8 @@ static VALUE r_mpfr_nan(int argc, VALUE *argv, VALUE self){
|
|
318
442
|
}
|
319
443
|
|
320
444
|
/* Return plus infinity. This method takes one optional argument meaning precision. */
|
321
|
-
static VALUE r_mpfr_pinf(int argc, VALUE *argv, VALUE self)
|
445
|
+
static VALUE r_mpfr_pinf(int argc, VALUE *argv, VALUE self)
|
446
|
+
{
|
322
447
|
mp_prec_t prec = r_mpfr_prec_from_optional_argument(0, 1, argc, argv);
|
323
448
|
MPFR *ptr_return;
|
324
449
|
VALUE val_ret;
|
@@ -328,7 +453,8 @@ static VALUE r_mpfr_pinf(int argc, VALUE *argv, VALUE self){
|
|
328
453
|
}
|
329
454
|
|
330
455
|
/* Return minus infinity. This method takes one optional argument meaning precision. */
|
331
|
-
static VALUE r_mpfr_minf(int argc, VALUE *argv, VALUE self)
|
456
|
+
static VALUE r_mpfr_minf(int argc, VALUE *argv, VALUE self)
|
457
|
+
{
|
332
458
|
mp_prec_t prec = r_mpfr_prec_from_optional_argument(0, 1, argc, argv);
|
333
459
|
MPFR *ptr_return;
|
334
460
|
VALUE val_ret;
|
@@ -342,7 +468,8 @@ static VALUE r_mpfr_minf(int argc, VALUE *argv, VALUE self){
|
|
342
468
|
/* ------------------------------ Assignment Functions Start ------------------------------ */
|
343
469
|
|
344
470
|
/* Reset the precision of self to be exactly p1 bits and set its value to NaN. */
|
345
|
-
static VALUE r_mpfr_set_prec(VALUE self, VALUE prec)
|
471
|
+
static VALUE r_mpfr_set_prec(VALUE self, VALUE prec)
|
472
|
+
{
|
346
473
|
MPFR *ptr_self;
|
347
474
|
r_mpfr_get_struct(ptr_self, self);
|
348
475
|
mpfr_set_prec(ptr_self, NUM2INT(prec));
|
@@ -350,14 +477,16 @@ static VALUE r_mpfr_set_prec(VALUE self, VALUE prec){
|
|
350
477
|
}
|
351
478
|
|
352
479
|
/* Return precision actually used for assignments of self. */
|
353
|
-
static VALUE r_mpfr_get_prec(VALUE self)
|
480
|
+
static VALUE r_mpfr_get_prec(VALUE self)
|
481
|
+
{
|
354
482
|
MPFR *ptr_self;
|
355
483
|
r_mpfr_get_struct(ptr_self, self);
|
356
484
|
return INT2NUM((int)mpfr_get_prec(ptr_self));
|
357
485
|
}
|
358
486
|
|
359
487
|
/* Arguments are val, rnd, and prec. Set the value of self from val. rnd and prec are optional.*/
|
360
|
-
static VALUE r_mpfr_set(int argc, VALUE *argv, VALUE self)
|
488
|
+
static VALUE r_mpfr_set(int argc, VALUE *argv, VALUE self)
|
489
|
+
{
|
361
490
|
MPFR *ptr_self;
|
362
491
|
r_mpfr_get_struct(ptr_self, self);
|
363
492
|
mp_rnd_t rnd = r_mpfr_rnd_from_optional_argument(1, 2, argc, argv);
|
@@ -369,7 +498,8 @@ static VALUE r_mpfr_set(int argc, VALUE *argv, VALUE self){
|
|
369
498
|
Arguments are num, exp, rnd, and prec. Set the value of self from num multiplied by two to the power exp.
|
370
499
|
Set the value of self from val. rnd and prec are optional.
|
371
500
|
*/
|
372
|
-
static VALUE r_mpfr_set_fixnum_2exp(int argc, VALUE *argv, VALUE self)
|
501
|
+
static VALUE r_mpfr_set_fixnum_2exp(int argc, VALUE *argv, VALUE self)
|
502
|
+
{
|
373
503
|
MPFR *ptr_self;
|
374
504
|
r_mpfr_get_struct(ptr_self, self);
|
375
505
|
mp_rnd_t rnd = r_mpfr_rnd_from_optional_argument(2, 3, argc, argv);
|
@@ -381,7 +511,8 @@ static VALUE r_mpfr_set_fixnum_2exp(int argc, VALUE *argv, VALUE self){
|
|
381
511
|
If p1 is nonnegative Fixnum, set the value of self to plus Inf.
|
382
512
|
Otherwise, set the value of self to minus Inf.
|
383
513
|
*/
|
384
|
-
static VALUE r_mpfr_set_inf(VALUE self, VALUE sign)
|
514
|
+
static VALUE r_mpfr_set_inf(VALUE self, VALUE sign)
|
515
|
+
{
|
385
516
|
MPFR *ptr_self;
|
386
517
|
r_mpfr_get_struct(ptr_self, self);
|
387
518
|
mpfr_set_inf(ptr_self, NUM2INT(sign));
|
@@ -389,7 +520,8 @@ static VALUE r_mpfr_set_inf(VALUE self, VALUE sign){
|
|
389
520
|
}
|
390
521
|
|
391
522
|
/* Set the value of self to NaN. */
|
392
|
-
static VALUE r_mpfr_set_nan(VALUE self)
|
523
|
+
static VALUE r_mpfr_set_nan(VALUE self)
|
524
|
+
{
|
393
525
|
MPFR *ptr_self;
|
394
526
|
r_mpfr_get_struct(ptr_self, self);
|
395
527
|
mpfr_set_nan(ptr_self);
|
@@ -397,7 +529,8 @@ static VALUE r_mpfr_set_nan(VALUE self){
|
|
397
529
|
}
|
398
530
|
|
399
531
|
/* Swap the values self and p1 efficiently. p1 must be MPFR object. */
|
400
|
-
static VALUE r_mpfr_swap(VALUE self, VALUE other)
|
532
|
+
static VALUE r_mpfr_swap(VALUE self, VALUE other)
|
533
|
+
{
|
401
534
|
MPFR *ptr_self, *ptr_other;
|
402
535
|
r_mpfr_get_struct(ptr_self, self);
|
403
536
|
if(RTEST(rb_funcall(__mpfr_class__, eqq, 1, other))){
|
@@ -414,7 +547,8 @@ static VALUE r_mpfr_swap(VALUE self, VALUE other){
|
|
414
547
|
/* ------------------------------ Methods related to string Start ------------------------------ */
|
415
548
|
|
416
549
|
/* Output self by mpfr_asprintf( some_val, p1, self ). For example, p1 are "%.Re", "%.Rf" or "%.30Re" etc. */
|
417
|
-
static VALUE r_mpfr_to_strf(VALUE self, VALUE format_str)
|
550
|
+
static VALUE r_mpfr_to_strf(VALUE self, VALUE format_str)
|
551
|
+
{
|
418
552
|
MPFR *ptr_self;
|
419
553
|
r_mpfr_get_struct(ptr_self, self);
|
420
554
|
char *format = StringValuePtr(format_str);
|
@@ -426,7 +560,8 @@ static VALUE r_mpfr_to_strf(VALUE self, VALUE format_str){
|
|
426
560
|
}
|
427
561
|
|
428
562
|
/* Convert to string. */
|
429
|
-
static VALUE r_mpfr_to_s(VALUE self)
|
563
|
+
static VALUE r_mpfr_to_s(VALUE self)
|
564
|
+
{
|
430
565
|
MPFR *ptr_self;
|
431
566
|
r_mpfr_get_struct(ptr_self, self);
|
432
567
|
char *ret_str;
|
@@ -437,7 +572,8 @@ static VALUE r_mpfr_to_s(VALUE self){
|
|
437
572
|
}
|
438
573
|
|
439
574
|
/* Output for debugging. */
|
440
|
-
static VALUE r_mpfr_inspect(VALUE self)
|
575
|
+
static VALUE r_mpfr_inspect(VALUE self)
|
576
|
+
{
|
441
577
|
MPFR *ptr_s;
|
442
578
|
r_mpfr_get_struct(ptr_s, self);
|
443
579
|
char *ret_str;
|
@@ -452,7 +588,8 @@ static VALUE r_mpfr_inspect(VALUE self){
|
|
452
588
|
/* ------------------------------ Conversion functions Start ------------------------------ */
|
453
589
|
|
454
590
|
/* Return Float object by converting self. Optional argument is rnd meaning rounding mode. See MPFR reference for detail. */
|
455
|
-
static VALUE r_mpfr_get_d(int argc, VALUE *argv, VALUE self)
|
591
|
+
static VALUE r_mpfr_get_d(int argc, VALUE *argv, VALUE self)
|
592
|
+
{
|
456
593
|
MPFR *ptr_self;
|
457
594
|
r_mpfr_get_struct(ptr_self, self);
|
458
595
|
return rb_float_new(mpfr_get_d(ptr_self, r_mpfr_rnd_from_optional_argument(0, 1, argc, argv)));
|
@@ -460,7 +597,8 @@ static VALUE r_mpfr_get_d(int argc, VALUE *argv, VALUE self){
|
|
460
597
|
|
461
598
|
/* Return array having Float object d and Fixnum object i such that 0.5 <= abs(d) < 1.0 and */
|
462
599
|
/* d times 2 raised to exp equals self rounded to double precision. See MPFR reference for detail. */
|
463
|
-
static VALUE r_mpfr_get_d_2exp(int argc, VALUE *argv, VALUE self)
|
600
|
+
static VALUE r_mpfr_get_d_2exp(int argc, VALUE *argv, VALUE self)
|
601
|
+
{
|
464
602
|
MPFR *ptr_self;
|
465
603
|
r_mpfr_get_struct(ptr_self, self);
|
466
604
|
long int ret_val2;
|
@@ -469,42 +607,48 @@ static VALUE r_mpfr_get_d_2exp(int argc, VALUE *argv, VALUE self){
|
|
469
607
|
}
|
470
608
|
|
471
609
|
/* Return Fixnum object converted after rounding self with respect to rnd which is optional argument. */
|
472
|
-
static VALUE r_mpfr_get_si(int argc, VALUE *argv, VALUE self)
|
610
|
+
static VALUE r_mpfr_get_si(int argc, VALUE *argv, VALUE self)
|
611
|
+
{
|
473
612
|
MPFR *ptr_self;
|
474
613
|
r_mpfr_get_struct(ptr_self, self);
|
475
614
|
return INT2NUM(mpfr_get_si(ptr_self, r_mpfr_rnd_from_optional_argument(0, 1, argc, argv)));
|
476
615
|
}
|
477
616
|
|
478
617
|
/* Return Fixnum object which is nearest integer to self. */
|
479
|
-
static VALUE r_mpfr_round_to_i(VALUE self)
|
618
|
+
static VALUE r_mpfr_round_to_i(VALUE self)
|
619
|
+
{
|
480
620
|
MPFR *ptr_self;
|
481
621
|
r_mpfr_get_struct(ptr_self, self);
|
482
622
|
return INT2NUM(mpfr_get_si(ptr_self, GMP_RNDN));
|
483
623
|
}
|
484
624
|
|
485
625
|
/* Return Fixnum object which is the minimum integer over self. */
|
486
|
-
static VALUE r_mpfr_ceil_to_i(VALUE self)
|
626
|
+
static VALUE r_mpfr_ceil_to_i(VALUE self)
|
627
|
+
{
|
487
628
|
MPFR *ptr_self;
|
488
629
|
r_mpfr_get_struct(ptr_self, self);
|
489
630
|
return INT2NUM(mpfr_get_si(ptr_self, GMP_RNDU));
|
490
631
|
}
|
491
632
|
|
492
633
|
/* Return Fixnum object which is the maximum integer not over self. */
|
493
|
-
static VALUE r_mpfr_floor_to_i(VALUE self)
|
634
|
+
static VALUE r_mpfr_floor_to_i(VALUE self)
|
635
|
+
{
|
494
636
|
MPFR *ptr_self;
|
495
637
|
r_mpfr_get_struct(ptr_self, self);
|
496
638
|
return INT2NUM(mpfr_get_si(ptr_self, GMP_RNDD));
|
497
639
|
}
|
498
640
|
|
499
641
|
/* Return Fixnum object by truncating self. */
|
500
|
-
static VALUE r_mpfr_truncate_to_i(VALUE self)
|
642
|
+
static VALUE r_mpfr_truncate_to_i(VALUE self)
|
643
|
+
{
|
501
644
|
MPFR *ptr_self;
|
502
645
|
r_mpfr_get_struct(ptr_self, self);
|
503
646
|
return INT2NUM(mpfr_get_si(ptr_self, GMP_RNDZ));
|
504
647
|
}
|
505
648
|
|
506
649
|
/* Return array having String object meaning mantissa and Fixnum object meaning exponent. See MPFR reference for detail. */
|
507
|
-
static VALUE r_mpfr_get_str(VALUE self)
|
650
|
+
static VALUE r_mpfr_get_str(VALUE self)
|
651
|
+
{
|
508
652
|
MPFR *ptr_self;
|
509
653
|
r_mpfr_get_struct(ptr_self, self);
|
510
654
|
mp_exp_t e;
|
@@ -519,7 +663,8 @@ static VALUE r_mpfr_get_str(VALUE self){
|
|
519
663
|
/* ------------------------------ Basic Arithmetic Functions Start ------------------------------ */
|
520
664
|
|
521
665
|
/* Return self + p1. */
|
522
|
-
static VALUE r_mpfr_add(VALUE self, VALUE other)
|
666
|
+
static VALUE r_mpfr_add(VALUE self, VALUE other)
|
667
|
+
{
|
523
668
|
MPFR *ptr_self, *ptr_other, *ptr_return;
|
524
669
|
VALUE val_ret;
|
525
670
|
r_mpfr_get_struct(ptr_self, self);
|
@@ -543,7 +688,8 @@ static VALUE r_mpfr_add(VALUE self, VALUE other){
|
|
543
688
|
}
|
544
689
|
|
545
690
|
/* Return self - p1. */
|
546
|
-
static VALUE r_mpfr_sub(VALUE self, VALUE other)
|
691
|
+
static VALUE r_mpfr_sub(VALUE self, VALUE other)
|
692
|
+
{
|
547
693
|
MPFR *ptr_self, *ptr_other, *ptr_return;
|
548
694
|
VALUE val_ret;
|
549
695
|
r_mpfr_get_struct(ptr_self, self);
|
@@ -567,7 +713,8 @@ static VALUE r_mpfr_sub(VALUE self, VALUE other){
|
|
567
713
|
}
|
568
714
|
|
569
715
|
/* Return self * p1. */
|
570
|
-
static VALUE r_mpfr_mul(VALUE self, VALUE other)
|
716
|
+
static VALUE r_mpfr_mul(VALUE self, VALUE other)
|
717
|
+
{
|
571
718
|
MPFR *ptr_self, *ptr_other, *ptr_return;
|
572
719
|
VALUE val_ret;
|
573
720
|
r_mpfr_get_struct(ptr_self, self);
|
@@ -591,7 +738,8 @@ static VALUE r_mpfr_mul(VALUE self, VALUE other){
|
|
591
738
|
}
|
592
739
|
|
593
740
|
/* Return self / p1. */
|
594
|
-
static VALUE r_mpfr_div(VALUE self, VALUE other)
|
741
|
+
static VALUE r_mpfr_div(VALUE self, VALUE other)
|
742
|
+
{
|
595
743
|
MPFR *ptr_self, *ptr_other, *ptr_return;
|
596
744
|
VALUE val_ret;
|
597
745
|
r_mpfr_get_struct(ptr_self, self);
|
@@ -615,7 +763,8 @@ static VALUE r_mpfr_div(VALUE self, VALUE other){
|
|
615
763
|
}
|
616
764
|
|
617
765
|
/* Return p1-th power of self. */
|
618
|
-
static VALUE r_mpfr_pow(VALUE self, VALUE other)
|
766
|
+
static VALUE r_mpfr_pow(VALUE self, VALUE other)
|
767
|
+
{
|
619
768
|
MPFR *ptr_self, *ptr_other, *ptr_return;
|
620
769
|
VALUE val_ret;
|
621
770
|
r_mpfr_get_struct(ptr_self, self);
|
@@ -631,7 +780,8 @@ static VALUE r_mpfr_pow(VALUE self, VALUE other){
|
|
631
780
|
}
|
632
781
|
|
633
782
|
/* Return negative value of self. */
|
634
|
-
static VALUE r_mpfr_neg(int argc, VALUE *argv, VALUE self)
|
783
|
+
static VALUE r_mpfr_neg(int argc, VALUE *argv, VALUE self)
|
784
|
+
{
|
635
785
|
mp_rnd_t rnd;
|
636
786
|
mp_prec_t prec;
|
637
787
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 0, 2, argc, argv);
|
@@ -644,7 +794,8 @@ static VALUE r_mpfr_neg(int argc, VALUE *argv, VALUE self){
|
|
644
794
|
}
|
645
795
|
|
646
796
|
/* Return absolute value of self. */
|
647
|
-
static VALUE r_mpfr_abs(int argc, VALUE *argv, VALUE self)
|
797
|
+
static VALUE r_mpfr_abs(int argc, VALUE *argv, VALUE self)
|
798
|
+
{
|
648
799
|
mp_rnd_t rnd;
|
649
800
|
mp_prec_t prec;
|
650
801
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 0, 2, argc, argv);
|
@@ -661,7 +812,8 @@ static VALUE r_mpfr_abs(int argc, VALUE *argv, VALUE self){
|
|
661
812
|
/* ------------------------------ Math Basic Arithmetic Functions Start ------------------------------ */
|
662
813
|
|
663
814
|
/* This method needs two required arguments and returns p1 + p2. */
|
664
|
-
static VALUE r_mpfr_math_add(int argc, VALUE *argv, VALUE self)
|
815
|
+
static VALUE r_mpfr_math_add(int argc, VALUE *argv, VALUE self)
|
816
|
+
{
|
665
817
|
mp_rnd_t rnd;
|
666
818
|
mp_prec_t prec;
|
667
819
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
@@ -684,10 +836,11 @@ static VALUE r_mpfr_math_add(int argc, VALUE *argv, VALUE self){
|
|
684
836
|
}
|
685
837
|
|
686
838
|
/* This method needs two required arguments and returns p1 - p2. */
|
687
|
-
static VALUE r_mpfr_math_sub(int argc, VALUE *argv, VALUE self)
|
839
|
+
static VALUE r_mpfr_math_sub(int argc, VALUE *argv, VALUE self)
|
840
|
+
{
|
688
841
|
mp_rnd_t rnd;
|
689
842
|
mp_prec_t prec;
|
690
|
-
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec,
|
843
|
+
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
691
844
|
MPFR *ptr_arg1, *ptr_arg2, *ptr_return;
|
692
845
|
VALUE val_ret;
|
693
846
|
volatile VALUE tmp_argv0 = r_mpfr_new_fr_obj(argv[0]);
|
@@ -707,10 +860,11 @@ static VALUE r_mpfr_math_sub(int argc, VALUE *argv, VALUE self){
|
|
707
860
|
}
|
708
861
|
|
709
862
|
/* This method needs two required arguments and returns p1 - p2. */
|
710
|
-
static VALUE r_mpfr_math_mul(int argc, VALUE *argv, VALUE self)
|
863
|
+
static VALUE r_mpfr_math_mul(int argc, VALUE *argv, VALUE self)
|
864
|
+
{
|
711
865
|
mp_rnd_t rnd;
|
712
866
|
mp_prec_t prec;
|
713
|
-
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec,
|
867
|
+
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
714
868
|
MPFR *ptr_arg1, *ptr_arg2, *ptr_return;
|
715
869
|
VALUE val_ret;
|
716
870
|
volatile VALUE tmp_argv0 = r_mpfr_new_fr_obj(argv[0]);
|
@@ -730,10 +884,11 @@ static VALUE r_mpfr_math_mul(int argc, VALUE *argv, VALUE self){
|
|
730
884
|
}
|
731
885
|
|
732
886
|
/* This method needs two required arguments and returns p1 / p2. */
|
733
|
-
static VALUE r_mpfr_math_div(int argc, VALUE *argv, VALUE self)
|
887
|
+
static VALUE r_mpfr_math_div(int argc, VALUE *argv, VALUE self)
|
888
|
+
{
|
734
889
|
mp_rnd_t rnd;
|
735
890
|
mp_prec_t prec;
|
736
|
-
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec,
|
891
|
+
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
737
892
|
MPFR *ptr_arg1, *ptr_arg2, *ptr_return;
|
738
893
|
VALUE val_ret;
|
739
894
|
volatile VALUE tmp_argv0 = r_mpfr_new_fr_obj(argv[0]);
|
@@ -753,7 +908,8 @@ static VALUE r_mpfr_math_div(int argc, VALUE *argv, VALUE self){
|
|
753
908
|
}
|
754
909
|
|
755
910
|
/* mpfr_sqr(ret, p1, rnd). */
|
756
|
-
static VALUE r_mpfr_math_sqr(int argc, VALUE *argv, VALUE self)
|
911
|
+
static VALUE r_mpfr_math_sqr(int argc, VALUE *argv, VALUE self)
|
912
|
+
{
|
757
913
|
mp_rnd_t rnd;
|
758
914
|
mp_prec_t prec;
|
759
915
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -767,7 +923,8 @@ static VALUE r_mpfr_math_sqr(int argc, VALUE *argv, VALUE self){
|
|
767
923
|
}
|
768
924
|
|
769
925
|
/* mpfr_sqrt(ret, p1, rnd). */
|
770
|
-
static VALUE r_mpfr_math_sqrt(int argc, VALUE *argv, VALUE self)
|
926
|
+
static VALUE r_mpfr_math_sqrt(int argc, VALUE *argv, VALUE self)
|
927
|
+
{
|
771
928
|
mp_rnd_t rnd;
|
772
929
|
mp_prec_t prec;
|
773
930
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -791,7 +948,8 @@ static VALUE r_mpfr_math_sqrt(int argc, VALUE *argv, VALUE self){
|
|
791
948
|
}
|
792
949
|
|
793
950
|
/* mpfr_rec_sqrt(ret, p1, rnd). */
|
794
|
-
static VALUE r_mpfr_math_rec_sqrt(int argc, VALUE *argv, VALUE self)
|
951
|
+
static VALUE r_mpfr_math_rec_sqrt(int argc, VALUE *argv, VALUE self)
|
952
|
+
{
|
795
953
|
mp_rnd_t rnd;
|
796
954
|
mp_prec_t prec;
|
797
955
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -805,7 +963,8 @@ static VALUE r_mpfr_math_rec_sqrt(int argc, VALUE *argv, VALUE self){
|
|
805
963
|
}
|
806
964
|
|
807
965
|
/* mpfr_cbrt(ret, p1, rnd). */
|
808
|
-
static VALUE r_mpfr_math_cbrt(int argc, VALUE *argv, VALUE self)
|
966
|
+
static VALUE r_mpfr_math_cbrt(int argc, VALUE *argv, VALUE self)
|
967
|
+
{
|
809
968
|
mp_rnd_t rnd;
|
810
969
|
mp_prec_t prec;
|
811
970
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -819,7 +978,8 @@ static VALUE r_mpfr_math_cbrt(int argc, VALUE *argv, VALUE self){
|
|
819
978
|
}
|
820
979
|
|
821
980
|
/* mpfr_root(ret, p1, rnd). */
|
822
|
-
static VALUE r_mpfr_math_root(int argc, VALUE *argv, VALUE self)
|
981
|
+
static VALUE r_mpfr_math_root(int argc, VALUE *argv, VALUE self)
|
982
|
+
{
|
823
983
|
mp_rnd_t rnd;
|
824
984
|
mp_prec_t prec;
|
825
985
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
@@ -838,7 +998,8 @@ static VALUE r_mpfr_math_root(int argc, VALUE *argv, VALUE self){
|
|
838
998
|
}
|
839
999
|
|
840
1000
|
/* mpfr_pow(ret, p1, p2, rnd). */
|
841
|
-
static VALUE r_mpfr_math_pow(int argc, VALUE *argv, VALUE self)
|
1001
|
+
static VALUE r_mpfr_math_pow(int argc, VALUE *argv, VALUE self)
|
1002
|
+
{
|
842
1003
|
mp_rnd_t rnd;
|
843
1004
|
mp_prec_t prec;
|
844
1005
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
@@ -858,7 +1019,8 @@ static VALUE r_mpfr_math_pow(int argc, VALUE *argv, VALUE self){
|
|
858
1019
|
}
|
859
1020
|
|
860
1021
|
/* mpfr_dim(ret, p1, p2, rnd). */
|
861
|
-
static VALUE r_mpfr_math_dim(int argc, VALUE *argv, VALUE self)
|
1022
|
+
static VALUE r_mpfr_math_dim(int argc, VALUE *argv, VALUE self)
|
1023
|
+
{
|
862
1024
|
mp_rnd_t rnd;
|
863
1025
|
mp_prec_t prec;
|
864
1026
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
@@ -874,7 +1036,8 @@ static VALUE r_mpfr_math_dim(int argc, VALUE *argv, VALUE self){
|
|
874
1036
|
}
|
875
1037
|
|
876
1038
|
/* mpfr_mul_2si(ret, p1, p2, rnd). p2 must be integer. */
|
877
|
-
static VALUE r_mpfr_math_mul_2si(int argc, VALUE *argv, VALUE self)
|
1039
|
+
static VALUE r_mpfr_math_mul_2si(int argc, VALUE *argv, VALUE self)
|
1040
|
+
{
|
878
1041
|
mp_rnd_t rnd;
|
879
1042
|
mp_prec_t prec;
|
880
1043
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
@@ -888,7 +1051,8 @@ static VALUE r_mpfr_math_mul_2si(int argc, VALUE *argv, VALUE self){
|
|
888
1051
|
}
|
889
1052
|
|
890
1053
|
/* mpfr_div_2si(ret, p1, p2, rnd). p2 must be integer. */
|
891
|
-
static VALUE r_mpfr_math_div_2si(int argc, VALUE *argv, VALUE self)
|
1054
|
+
static VALUE r_mpfr_math_div_2si(int argc, VALUE *argv, VALUE self)
|
1055
|
+
{
|
892
1056
|
mp_rnd_t rnd;
|
893
1057
|
mp_prec_t prec;
|
894
1058
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
@@ -906,7 +1070,8 @@ static VALUE r_mpfr_math_div_2si(int argc, VALUE *argv, VALUE self){
|
|
906
1070
|
/* ------------------------------ Comparison Functions Start ------------------------------ */
|
907
1071
|
|
908
1072
|
/* Return negative integer if self < other, negative integer if self > other, or 0 if self == other. */
|
909
|
-
static VALUE r_mpfr_cmp(VALUE self, VALUE other)
|
1073
|
+
static VALUE r_mpfr_cmp(VALUE self, VALUE other)
|
1074
|
+
{
|
910
1075
|
MPFR *ptr_self, *ptr_other;
|
911
1076
|
r_mpfr_get_struct(ptr_self, self);
|
912
1077
|
int val_ret;
|
@@ -929,7 +1094,8 @@ static VALUE r_mpfr_cmp(VALUE self, VALUE other){
|
|
929
1094
|
}
|
930
1095
|
|
931
1096
|
/* mpfr_cmp_ui_2exp(self, p1, p2). */
|
932
|
-
static VALUE r_mpfr_cmp_ui_2exp(VALUE self, VALUE other, VALUE exp)
|
1097
|
+
static VALUE r_mpfr_cmp_ui_2exp(VALUE self, VALUE other, VALUE exp)
|
1098
|
+
{
|
933
1099
|
MPFR *ptr_self;
|
934
1100
|
r_mpfr_get_struct(ptr_self, self);
|
935
1101
|
VALUE val_ret;
|
@@ -943,14 +1109,16 @@ static VALUE r_mpfr_cmp_ui_2exp(VALUE self, VALUE other, VALUE exp){
|
|
943
1109
|
}
|
944
1110
|
|
945
1111
|
/* mpfr_cmp_si_2exp(self, p1, p2). */
|
946
|
-
static VALUE r_mpfr_cmp_si_2exp(VALUE self, VALUE other, VALUE exp)
|
1112
|
+
static VALUE r_mpfr_cmp_si_2exp(VALUE self, VALUE other, VALUE exp)
|
1113
|
+
{
|
947
1114
|
MPFR *ptr_self;
|
948
1115
|
r_mpfr_get_struct(ptr_self, self);
|
949
1116
|
return INT2FIX(mpfr_cmp_si_2exp(ptr_self, NUM2INT(other), NUM2INT(exp)));
|
950
1117
|
}
|
951
1118
|
|
952
1119
|
/* mpfr_cmpabs(self, p1). */
|
953
|
-
static VALUE r_mpfr_cmpabs(VALUE self, VALUE other)
|
1120
|
+
static VALUE r_mpfr_cmpabs(VALUE self, VALUE other)
|
1121
|
+
{
|
954
1122
|
MPFR *ptr_self, *ptr_other;
|
955
1123
|
r_mpfr_get_struct(ptr_self, self);
|
956
1124
|
volatile VALUE tmp_other = r_mpfr_new_fr_obj(other);
|
@@ -959,123 +1127,137 @@ static VALUE r_mpfr_cmpabs(VALUE self, VALUE other){
|
|
959
1127
|
}
|
960
1128
|
|
961
1129
|
/* Return true if self is NaN, nil otherwise. */
|
962
|
-
static VALUE r_mpfr_nan_p(VALUE self)
|
1130
|
+
static VALUE r_mpfr_nan_p(VALUE self)
|
1131
|
+
{
|
963
1132
|
MPFR *ptr_self;
|
964
1133
|
r_mpfr_get_struct(ptr_self, self);
|
965
1134
|
if(mpfr_nan_p(ptr_self) != 0){
|
966
1135
|
return Qtrue;
|
967
1136
|
}else{
|
968
|
-
return
|
1137
|
+
return Qfalse;
|
969
1138
|
}
|
970
1139
|
}
|
971
1140
|
|
972
1141
|
/* Return true if self is infinity, nil otherwise. */
|
973
|
-
static VALUE r_mpfr_inf_p(VALUE self)
|
1142
|
+
static VALUE r_mpfr_inf_p(VALUE self)
|
1143
|
+
{
|
974
1144
|
MPFR *ptr_self;
|
975
1145
|
r_mpfr_get_struct(ptr_self, self);
|
976
|
-
return (mpfr_inf_p(ptr_self) != 0 ? Qtrue :
|
1146
|
+
return (mpfr_inf_p(ptr_self) != 0 ? Qtrue : Qfalse);
|
977
1147
|
}
|
978
1148
|
|
979
1149
|
/* Return 1 if self is plus infinity, -1 if minus infinity. nil otherwise. */
|
980
|
-
static VALUE r_mpfr_inf_p2(VALUE self)
|
1150
|
+
static VALUE r_mpfr_inf_p2(VALUE self)
|
1151
|
+
{
|
981
1152
|
MPFR *ptr_self;
|
982
1153
|
r_mpfr_get_struct(ptr_self, self);
|
983
1154
|
if(mpfr_inf_p(ptr_self) != 0){
|
984
1155
|
return (mpfr_sgn(ptr_self) > 0 ? INT2NUM(1) : INT2NUM(-1));
|
985
1156
|
}else{
|
986
|
-
return
|
1157
|
+
return Qfalse;
|
987
1158
|
}
|
988
1159
|
}
|
989
1160
|
|
990
1161
|
/* Return true if self is number, nil otherwise */
|
991
|
-
static VALUE r_mpfr_number_p(VALUE self)
|
1162
|
+
static VALUE r_mpfr_number_p(VALUE self)
|
1163
|
+
{
|
992
1164
|
MPFR *ptr_self;
|
993
1165
|
r_mpfr_get_struct(ptr_self, self);
|
994
|
-
return (mpfr_number_p(ptr_self) != 0 ? Qtrue :
|
1166
|
+
return (mpfr_number_p(ptr_self) != 0 ? Qtrue : Qfalse);
|
995
1167
|
}
|
996
1168
|
|
997
1169
|
/* Return true if self is 0, nil otherwise. */
|
998
|
-
static VALUE r_mpfr_zero_p(VALUE self)
|
1170
|
+
static VALUE r_mpfr_zero_p(VALUE self)
|
1171
|
+
{
|
999
1172
|
MPFR *ptr_self;
|
1000
1173
|
r_mpfr_get_struct(ptr_self, self);
|
1001
|
-
return (mpfr_zero_p(ptr_self) != 0 ? Qtrue :
|
1174
|
+
return (mpfr_zero_p(ptr_self) != 0 ? Qtrue : Qfalse);
|
1002
1175
|
}
|
1003
1176
|
|
1004
1177
|
/* Return true if self is non zero, nil otherwise. */
|
1005
|
-
static VALUE r_mpfr_nonzero_p(VALUE self)
|
1178
|
+
static VALUE r_mpfr_nonzero_p(VALUE self)
|
1179
|
+
{
|
1006
1180
|
MPFR *ptr_self;
|
1007
1181
|
r_mpfr_get_struct(ptr_self, self);
|
1008
|
-
return (mpfr_zero_p(ptr_self) == 0 ? Qtrue :
|
1182
|
+
return (mpfr_zero_p(ptr_self) == 0 ? Qtrue : Qfalse);
|
1009
1183
|
}
|
1010
1184
|
|
1011
1185
|
/* mpfr_sgn(self). */
|
1012
|
-
static VALUE r_mpfr_sgn(VALUE self)
|
1186
|
+
static VALUE r_mpfr_sgn(VALUE self)
|
1187
|
+
{
|
1013
1188
|
MPFR *ptr_self;
|
1014
1189
|
r_mpfr_get_struct(ptr_self, self);
|
1015
1190
|
return INT2FIX(mpfr_sgn(ptr_self));
|
1016
1191
|
}
|
1017
1192
|
|
1018
1193
|
/* Return true if self > other, nil otherwise. */
|
1019
|
-
static VALUE r_mpfr_greater_p(VALUE self, VALUE other)
|
1194
|
+
static VALUE r_mpfr_greater_p(VALUE self, VALUE other)
|
1195
|
+
{
|
1020
1196
|
MPFR *ptr_self, *ptr_other;
|
1021
1197
|
r_mpfr_get_struct(ptr_self, self);
|
1022
1198
|
volatile VALUE tmp_other = r_mpfr_new_fr_obj(other);
|
1023
1199
|
r_mpfr_get_struct(ptr_other, tmp_other);
|
1024
|
-
return (mpfr_greater_p(ptr_self, ptr_other) != 0 ? Qtrue :
|
1200
|
+
return (mpfr_greater_p(ptr_self, ptr_other) != 0 ? Qtrue : Qfalse);
|
1025
1201
|
}
|
1026
1202
|
|
1027
1203
|
/* Return true if self >= other, nil otherwise. */
|
1028
|
-
static VALUE r_mpfr_greaterequal_p(VALUE self, VALUE other)
|
1204
|
+
static VALUE r_mpfr_greaterequal_p(VALUE self, VALUE other)
|
1205
|
+
{
|
1029
1206
|
MPFR *ptr_self, *ptr_other;
|
1030
1207
|
r_mpfr_get_struct(ptr_self, self);
|
1031
1208
|
volatile VALUE tmp_other = r_mpfr_new_fr_obj(other);
|
1032
1209
|
r_mpfr_get_struct(ptr_other, tmp_other);
|
1033
|
-
return (mpfr_greaterequal_p(ptr_self, ptr_other) != 0 ? Qtrue :
|
1210
|
+
return (mpfr_greaterequal_p(ptr_self, ptr_other) != 0 ? Qtrue : Qfalse);
|
1034
1211
|
}
|
1035
1212
|
|
1036
1213
|
/* Return true if self < other, nil otherwise. */
|
1037
|
-
static VALUE r_mpfr_less_p(VALUE self, VALUE other)
|
1214
|
+
static VALUE r_mpfr_less_p(VALUE self, VALUE other)
|
1215
|
+
{
|
1038
1216
|
MPFR *ptr_self, *ptr_other;
|
1039
1217
|
r_mpfr_get_struct(ptr_self, self);
|
1040
1218
|
volatile VALUE tmp_other = r_mpfr_new_fr_obj(other);
|
1041
1219
|
r_mpfr_get_struct(ptr_other, tmp_other);
|
1042
|
-
return (mpfr_less_p(ptr_self, ptr_other) != 0 ? Qtrue :
|
1220
|
+
return (mpfr_less_p(ptr_self, ptr_other) != 0 ? Qtrue : Qfalse);
|
1043
1221
|
}
|
1044
1222
|
|
1045
1223
|
/* Return true if self <= other, nil otherwise. */
|
1046
|
-
static VALUE r_mpfr_lessequal_p(VALUE self, VALUE other)
|
1224
|
+
static VALUE r_mpfr_lessequal_p(VALUE self, VALUE other)
|
1225
|
+
{
|
1047
1226
|
MPFR *ptr_self, *ptr_other;
|
1048
1227
|
r_mpfr_get_struct(ptr_self, self);
|
1049
1228
|
volatile VALUE tmp_other = r_mpfr_new_fr_obj(other);
|
1050
1229
|
r_mpfr_get_struct(ptr_other, tmp_other);
|
1051
|
-
return (mpfr_lessequal_p(ptr_self, ptr_other) != 0 ? Qtrue :
|
1230
|
+
return (mpfr_lessequal_p(ptr_self, ptr_other) != 0 ? Qtrue : Qfalse);
|
1052
1231
|
}
|
1053
1232
|
|
1054
1233
|
/* Return true if self < other or self > other, nil otherwise. */
|
1055
|
-
static VALUE r_mpfr_lessgreater_p(VALUE self, VALUE other)
|
1234
|
+
static VALUE r_mpfr_lessgreater_p(VALUE self, VALUE other)
|
1235
|
+
{
|
1056
1236
|
MPFR *ptr_self, *ptr_other;
|
1057
1237
|
r_mpfr_get_struct(ptr_self, self);
|
1058
1238
|
volatile VALUE tmp_other = r_mpfr_new_fr_obj(other);
|
1059
1239
|
r_mpfr_get_struct(ptr_other, tmp_other);
|
1060
|
-
return (mpfr_lessgreater_p(ptr_self, ptr_other) != 0 ? Qtrue :
|
1240
|
+
return (mpfr_lessgreater_p(ptr_self, ptr_other) != 0 ? Qtrue : Qfalse);
|
1061
1241
|
}
|
1062
1242
|
|
1063
1243
|
/* Return true if self == other, nil otherwise. */
|
1064
|
-
static VALUE r_mpfr_equal_p(VALUE self, VALUE other)
|
1244
|
+
static VALUE r_mpfr_equal_p(VALUE self, VALUE other)
|
1245
|
+
{
|
1065
1246
|
MPFR *ptr_self, *ptr_other;
|
1066
1247
|
r_mpfr_get_struct(ptr_self, self);
|
1067
1248
|
volatile VALUE tmp_other = r_mpfr_new_fr_obj(other);
|
1068
1249
|
r_mpfr_get_struct(ptr_other, tmp_other);
|
1069
|
-
return (mpfr_equal_p(ptr_self, ptr_other) != 0 ? Qtrue :
|
1250
|
+
return (mpfr_equal_p(ptr_self, ptr_other) != 0 ? Qtrue : Qfalse);
|
1070
1251
|
}
|
1071
1252
|
|
1072
1253
|
/* Return true if self or other is a NaN, nil otherwise */
|
1073
|
-
static VALUE r_mpfr_unordered_p(VALUE self, VALUE other)
|
1254
|
+
static VALUE r_mpfr_unordered_p(VALUE self, VALUE other)
|
1255
|
+
{
|
1074
1256
|
MPFR *ptr_self, *ptr_other;
|
1075
1257
|
r_mpfr_get_struct(ptr_self, self);
|
1076
1258
|
volatile VALUE tmp_other = r_mpfr_new_fr_obj(other);
|
1077
1259
|
r_mpfr_get_struct(ptr_other, tmp_other);
|
1078
|
-
return (mpfr_unordered_p(ptr_self, ptr_other) != 0 ? Qtrue :
|
1260
|
+
return (mpfr_unordered_p(ptr_self, ptr_other) != 0 ? Qtrue : Qfalse);
|
1079
1261
|
}
|
1080
1262
|
|
1081
1263
|
/* ------------------------------ Comparison Functions End ------------------------------ */
|
@@ -1083,7 +1265,8 @@ static VALUE r_mpfr_unordered_p(VALUE self, VALUE other){
|
|
1083
1265
|
/* ------------------------------ Integer Related Functions Start ------------------------------ */
|
1084
1266
|
|
1085
1267
|
/* mpfr_rint(ret, self, rnd) */
|
1086
|
-
static VALUE r_mpfr_m_rint(int argc, VALUE *argv, VALUE self)
|
1268
|
+
static VALUE r_mpfr_m_rint(int argc, VALUE *argv, VALUE self)
|
1269
|
+
{
|
1087
1270
|
mp_rnd_t rnd;
|
1088
1271
|
mp_prec_t prec;
|
1089
1272
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 0, 2, argc, argv);
|
@@ -1096,7 +1279,8 @@ static VALUE r_mpfr_m_rint(int argc, VALUE *argv, VALUE self){
|
|
1096
1279
|
}
|
1097
1280
|
|
1098
1281
|
/* mpfr_ceil(ret, self) */
|
1099
|
-
static VALUE r_mpfr_m_ceil(int argc, VALUE *argv, VALUE self)
|
1282
|
+
static VALUE r_mpfr_m_ceil(int argc, VALUE *argv, VALUE self)
|
1283
|
+
{
|
1100
1284
|
mp_prec_t prec = r_mpfr_prec_from_optional_argument(0, 1, argc, argv);
|
1101
1285
|
MPFR *ptr_self, *ptr_return;
|
1102
1286
|
VALUE val_ret;
|
@@ -1107,7 +1291,8 @@ static VALUE r_mpfr_m_ceil(int argc, VALUE *argv, VALUE self){
|
|
1107
1291
|
}
|
1108
1292
|
|
1109
1293
|
/* mpfr_floor(ret, self) */
|
1110
|
-
static VALUE r_mpfr_m_floor(int argc, VALUE *argv, VALUE self)
|
1294
|
+
static VALUE r_mpfr_m_floor(int argc, VALUE *argv, VALUE self)
|
1295
|
+
{
|
1111
1296
|
mp_prec_t prec = r_mpfr_prec_from_optional_argument(0, 1, argc, argv);
|
1112
1297
|
MPFR *ptr_self, *ptr_return;
|
1113
1298
|
VALUE val_ret;
|
@@ -1118,7 +1303,8 @@ static VALUE r_mpfr_m_floor(int argc, VALUE *argv, VALUE self){
|
|
1118
1303
|
}
|
1119
1304
|
|
1120
1305
|
/* mpfr_round(ret, self) */
|
1121
|
-
static VALUE r_mpfr_m_round(int argc, VALUE *argv, VALUE self)
|
1306
|
+
static VALUE r_mpfr_m_round(int argc, VALUE *argv, VALUE self)
|
1307
|
+
{
|
1122
1308
|
mp_prec_t prec = r_mpfr_prec_from_optional_argument(0, 1, argc, argv);
|
1123
1309
|
MPFR *ptr_self, *ptr_return;
|
1124
1310
|
VALUE val_ret;
|
@@ -1129,7 +1315,8 @@ static VALUE r_mpfr_m_round(int argc, VALUE *argv, VALUE self){
|
|
1129
1315
|
}
|
1130
1316
|
|
1131
1317
|
/* mpfr_trunc(ret, self) */
|
1132
|
-
static VALUE r_mpfr_m_trunc(int argc, VALUE *argv, VALUE self)
|
1318
|
+
static VALUE r_mpfr_m_trunc(int argc, VALUE *argv, VALUE self)
|
1319
|
+
{
|
1133
1320
|
mp_prec_t prec = r_mpfr_prec_from_optional_argument(0, 1, argc, argv);
|
1134
1321
|
MPFR *ptr_self, *ptr_return;
|
1135
1322
|
VALUE val_ret;
|
@@ -1140,7 +1327,8 @@ static VALUE r_mpfr_m_trunc(int argc, VALUE *argv, VALUE self){
|
|
1140
1327
|
}
|
1141
1328
|
|
1142
1329
|
/* mpfr_rint_ceil(ret, self, rnd) */
|
1143
|
-
static VALUE r_mpfr_rint_ceil(int argc, VALUE *argv, VALUE self)
|
1330
|
+
static VALUE r_mpfr_rint_ceil(int argc, VALUE *argv, VALUE self)
|
1331
|
+
{
|
1144
1332
|
mp_rnd_t rnd;
|
1145
1333
|
mp_prec_t prec;
|
1146
1334
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 0, 2, argc, argv);
|
@@ -1153,7 +1341,8 @@ static VALUE r_mpfr_rint_ceil(int argc, VALUE *argv, VALUE self){
|
|
1153
1341
|
}
|
1154
1342
|
|
1155
1343
|
/* mpfr_rint_floor(ret, self, rnd) */
|
1156
|
-
static VALUE r_mpfr_rint_floor(int argc, VALUE *argv, VALUE self)
|
1344
|
+
static VALUE r_mpfr_rint_floor(int argc, VALUE *argv, VALUE self)
|
1345
|
+
{
|
1157
1346
|
mp_rnd_t rnd;
|
1158
1347
|
mp_prec_t prec;
|
1159
1348
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 0, 2, argc, argv);
|
@@ -1166,7 +1355,8 @@ static VALUE r_mpfr_rint_floor(int argc, VALUE *argv, VALUE self){
|
|
1166
1355
|
}
|
1167
1356
|
|
1168
1357
|
/* mpfr_rint_round(ret, self, rnd) */
|
1169
|
-
static VALUE r_mpfr_rint_round(int argc, VALUE *argv, VALUE self)
|
1358
|
+
static VALUE r_mpfr_rint_round(int argc, VALUE *argv, VALUE self)
|
1359
|
+
{
|
1170
1360
|
mp_rnd_t rnd;
|
1171
1361
|
mp_prec_t prec;
|
1172
1362
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 0, 2, argc, argv);
|
@@ -1179,7 +1369,8 @@ static VALUE r_mpfr_rint_round(int argc, VALUE *argv, VALUE self){
|
|
1179
1369
|
}
|
1180
1370
|
|
1181
1371
|
/* mpfr_rint_trunc(ret, self, rnd) */
|
1182
|
-
static VALUE r_mpfr_rint_trunc(int argc, VALUE *argv, VALUE self)
|
1372
|
+
static VALUE r_mpfr_rint_trunc(int argc, VALUE *argv, VALUE self)
|
1373
|
+
{
|
1183
1374
|
mp_rnd_t rnd;
|
1184
1375
|
mp_prec_t prec;
|
1185
1376
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 0, 2, argc, argv);
|
@@ -1192,7 +1383,8 @@ static VALUE r_mpfr_rint_trunc(int argc, VALUE *argv, VALUE self){
|
|
1192
1383
|
}
|
1193
1384
|
|
1194
1385
|
/* mpfr_frac(ret, self, rnd) */
|
1195
|
-
static VALUE r_mpfr_frac(int argc, VALUE *argv, VALUE self)
|
1386
|
+
static VALUE r_mpfr_frac(int argc, VALUE *argv, VALUE self)
|
1387
|
+
{
|
1196
1388
|
mp_rnd_t rnd;
|
1197
1389
|
mp_prec_t prec;
|
1198
1390
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 0, 2, argc, argv);
|
@@ -1205,7 +1397,8 @@ static VALUE r_mpfr_frac(int argc, VALUE *argv, VALUE self){
|
|
1205
1397
|
}
|
1206
1398
|
|
1207
1399
|
/* Return [ret1, ret2] such that mpfr_modf(ret1, ret2, self, rnd). */
|
1208
|
-
static VALUE r_mpfr_modf(int argc, VALUE *argv, VALUE self)
|
1400
|
+
static VALUE r_mpfr_modf(int argc, VALUE *argv, VALUE self)
|
1401
|
+
{
|
1209
1402
|
mp_rnd_t rnd;
|
1210
1403
|
mp_prec_t prec;
|
1211
1404
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 0, 2, argc, argv);
|
@@ -1219,7 +1412,8 @@ static VALUE r_mpfr_modf(int argc, VALUE *argv, VALUE self){
|
|
1219
1412
|
}
|
1220
1413
|
|
1221
1414
|
/* mpfr_fmod(ret, self, p1, rnd) */
|
1222
|
-
static VALUE r_mpfr_fmod(int argc, VALUE *argv, VALUE self)
|
1415
|
+
static VALUE r_mpfr_fmod(int argc, VALUE *argv, VALUE self)
|
1416
|
+
{
|
1223
1417
|
mp_rnd_t rnd;
|
1224
1418
|
mp_prec_t prec;
|
1225
1419
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1234,7 +1428,8 @@ static VALUE r_mpfr_fmod(int argc, VALUE *argv, VALUE self){
|
|
1234
1428
|
}
|
1235
1429
|
|
1236
1430
|
/* mpfr_remainder(ret, self, p1, rnd) */
|
1237
|
-
static VALUE r_mpfr_remainder(int argc, VALUE *argv, VALUE self)
|
1431
|
+
static VALUE r_mpfr_remainder(int argc, VALUE *argv, VALUE self)
|
1432
|
+
{
|
1238
1433
|
mp_rnd_t rnd;
|
1239
1434
|
mp_prec_t prec;
|
1240
1435
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1249,7 +1444,8 @@ static VALUE r_mpfr_remainder(int argc, VALUE *argv, VALUE self){
|
|
1249
1444
|
}
|
1250
1445
|
|
1251
1446
|
/* mpfr_remainder(ret, self, p1, mpfr_getdefault_rounding_mode()) */
|
1252
|
-
static VALUE r_mpfr_remainder2(VALUE self, VALUE other)
|
1447
|
+
static VALUE r_mpfr_remainder2(VALUE self, VALUE other)
|
1448
|
+
{
|
1253
1449
|
MPFR *ptr_self, *ptr_other, *ptr_return;
|
1254
1450
|
VALUE val_ret;
|
1255
1451
|
r_mpfr_get_struct(ptr_self, self);
|
@@ -1261,7 +1457,8 @@ static VALUE r_mpfr_remainder2(VALUE self, VALUE other){
|
|
1261
1457
|
}
|
1262
1458
|
|
1263
1459
|
/* mpfr_remquo(ret1, ret2, self, p1, rnd) */
|
1264
|
-
static VALUE r_mpfr_remquo(int argc, VALUE *argv, VALUE self)
|
1460
|
+
static VALUE r_mpfr_remquo(int argc, VALUE *argv, VALUE self)
|
1461
|
+
{
|
1265
1462
|
mp_rnd_t rnd;
|
1266
1463
|
mp_prec_t prec;
|
1267
1464
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1277,7 +1474,8 @@ static VALUE r_mpfr_remquo(int argc, VALUE *argv, VALUE self){
|
|
1277
1474
|
}
|
1278
1475
|
|
1279
1476
|
/* If value of self is integer, return true. Otherwise, nil. */
|
1280
|
-
static VALUE r_mpfr_integer_p(VALUE self)
|
1477
|
+
static VALUE r_mpfr_integer_p(VALUE self)
|
1478
|
+
{
|
1281
1479
|
MPFR *ptr_self;
|
1282
1480
|
r_mpfr_get_struct(ptr_self, self);
|
1283
1481
|
return (mpfr_integer_p(ptr_self) != 0 ? Qtrue : Qnil);
|
@@ -1288,7 +1486,8 @@ static VALUE r_mpfr_integer_p(VALUE self){
|
|
1288
1486
|
/* ------------------------------ Miscellaneous Functions Start ------------------------------ */
|
1289
1487
|
|
1290
1488
|
/* mpfr_nexttoward(self, p1) */
|
1291
|
-
static VALUE r_mpfr_nexttoward(VALUE self, VALUE other)
|
1489
|
+
static VALUE r_mpfr_nexttoward(VALUE self, VALUE other)
|
1490
|
+
{
|
1292
1491
|
MPFR *ptr_self, *ptr_other;
|
1293
1492
|
r_mpfr_get_struct(ptr_self, self);
|
1294
1493
|
volatile VALUE tmp_other = r_mpfr_new_fr_obj(other);
|
@@ -1298,7 +1497,8 @@ static VALUE r_mpfr_nexttoward(VALUE self, VALUE other){
|
|
1298
1497
|
}
|
1299
1498
|
|
1300
1499
|
/* mpfr_nextabove(self) */
|
1301
|
-
static VALUE r_mpfr_nextabove(VALUE self)
|
1500
|
+
static VALUE r_mpfr_nextabove(VALUE self)
|
1501
|
+
{
|
1302
1502
|
MPFR *ptr_self;
|
1303
1503
|
r_mpfr_get_struct(ptr_self, self);
|
1304
1504
|
mpfr_nextabove(ptr_self);
|
@@ -1306,7 +1506,8 @@ static VALUE r_mpfr_nextabove(VALUE self){
|
|
1306
1506
|
}
|
1307
1507
|
|
1308
1508
|
/* mpfr_nextbelow(self) */
|
1309
|
-
static VALUE r_mpfr_nextbelow(VALUE self)
|
1509
|
+
static VALUE r_mpfr_nextbelow(VALUE self)
|
1510
|
+
{
|
1310
1511
|
MPFR *ptr_self;
|
1311
1512
|
r_mpfr_get_struct(ptr_self, self);
|
1312
1513
|
mpfr_nextbelow(ptr_self);
|
@@ -1314,7 +1515,8 @@ static VALUE r_mpfr_nextbelow(VALUE self){
|
|
1314
1515
|
}
|
1315
1516
|
|
1316
1517
|
/* If self is not number, return nil. Otherwise return an integer mpfr_get_exp(self). */
|
1317
|
-
static VALUE r_mpfr_get_exp(VALUE self)
|
1518
|
+
static VALUE r_mpfr_get_exp(VALUE self)
|
1519
|
+
{
|
1318
1520
|
MPFR *ptr_self;
|
1319
1521
|
r_mpfr_get_struct(ptr_self, self);
|
1320
1522
|
if(mpfr_number_p(ptr_self) != 0){
|
@@ -1325,7 +1527,8 @@ static VALUE r_mpfr_get_exp(VALUE self){
|
|
1325
1527
|
}
|
1326
1528
|
|
1327
1529
|
/* arg_exp is integer and we execute mpfr_set_exp(self, arg_exp). */
|
1328
|
-
static VALUE r_mpfr_set_exp(VALUE self, VALUE arg_exp)
|
1530
|
+
static VALUE r_mpfr_set_exp(VALUE self, VALUE arg_exp)
|
1531
|
+
{
|
1329
1532
|
MPFR *ptr_self;
|
1330
1533
|
r_mpfr_get_struct(ptr_self, self);
|
1331
1534
|
mp_exp_t exp = NUM2INT(arg_exp);
|
@@ -1334,14 +1537,16 @@ static VALUE r_mpfr_set_exp(VALUE self, VALUE arg_exp){
|
|
1334
1537
|
}
|
1335
1538
|
|
1336
1539
|
/* Return integer which is mpfr_signbit(self). */
|
1337
|
-
static VALUE r_mpfr_signbit(VALUE self)
|
1540
|
+
static VALUE r_mpfr_signbit(VALUE self)
|
1541
|
+
{
|
1338
1542
|
MPFR *ptr_self;
|
1339
1543
|
r_mpfr_get_struct(ptr_self, self);
|
1340
1544
|
return INT2FIX(mpfr_signbit(ptr_self));
|
1341
1545
|
}
|
1342
1546
|
|
1343
1547
|
/* mpfr_setsign(ret, self, p1, rnd) */
|
1344
|
-
static VALUE r_mpfr_setsign(int argc, VALUE *argv, VALUE self)
|
1548
|
+
static VALUE r_mpfr_setsign(int argc, VALUE *argv, VALUE self)
|
1549
|
+
{
|
1345
1550
|
mp_rnd_t rnd;
|
1346
1551
|
mp_prec_t prec;
|
1347
1552
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
@@ -1355,7 +1560,8 @@ static VALUE r_mpfr_setsign(int argc, VALUE *argv, VALUE self){
|
|
1355
1560
|
}
|
1356
1561
|
|
1357
1562
|
/* mpfr_copysign(ret, self, p1, rnd) */
|
1358
|
-
static VALUE r_mpfr_copysign(int argc, VALUE *argv, VALUE self)
|
1563
|
+
static VALUE r_mpfr_copysign(int argc, VALUE *argv, VALUE self)
|
1564
|
+
{
|
1359
1565
|
mp_rnd_t rnd;
|
1360
1566
|
mp_prec_t prec;
|
1361
1567
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
@@ -1374,7 +1580,8 @@ static VALUE r_mpfr_copysign(int argc, VALUE *argv, VALUE self){
|
|
1374
1580
|
/* ------------------------------ Rounding Mode Related Functions Start ------------------------------ */
|
1375
1581
|
|
1376
1582
|
/* mpfr_prec_round(ret, prec, rnd) */
|
1377
|
-
static VALUE r_mpfr_prec_round(int argc, VALUE *argv, VALUE self)
|
1583
|
+
static VALUE r_mpfr_prec_round(int argc, VALUE *argv, VALUE self)
|
1584
|
+
{
|
1378
1585
|
mp_rnd_t rnd;
|
1379
1586
|
mp_prec_t prec;
|
1380
1587
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 0, 2, argc, argv);
|
@@ -1388,7 +1595,8 @@ static VALUE r_mpfr_prec_round(int argc, VALUE *argv, VALUE self){
|
|
1388
1595
|
}
|
1389
1596
|
|
1390
1597
|
/* mpfr_prec_round(ret, prec, rnd) */
|
1391
|
-
static VALUE r_mpfr_prec_round2(int argc, VALUE *argv, VALUE self)
|
1598
|
+
static VALUE r_mpfr_prec_round2(int argc, VALUE *argv, VALUE self)
|
1599
|
+
{
|
1392
1600
|
mp_rnd_t rnd;
|
1393
1601
|
mp_prec_t prec;
|
1394
1602
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 0, 2, argc, argv);
|
@@ -1408,12 +1616,19 @@ static VALUE r_mpfr_prec_round2(int argc, VALUE *argv, VALUE self){
|
|
1408
1616
|
This method returns that class variable meaning the returned value of Special Functions in MPFR library.
|
1409
1617
|
See the MPFR reference for the kind of Special Functions and the meaning of the returned value of Special Functions.
|
1410
1618
|
*/
|
1411
|
-
static VALUE r_mpfr_get_special_func_state(VALUE self)
|
1619
|
+
static VALUE r_mpfr_get_special_func_state(VALUE self)
|
1620
|
+
{
|
1621
|
+
return rb_cv_get(r_mpfr_class, SPECIAL_FUNC_STATE);
|
1622
|
+
}
|
1412
1623
|
|
1413
|
-
static void r_mpfr_set_special_func_state(int num)
|
1624
|
+
static void r_mpfr_set_special_func_state(int num)
|
1625
|
+
{
|
1626
|
+
rb_cv_set(r_mpfr_class, SPECIAL_FUNC_STATE, INT2NUM(num));
|
1627
|
+
}
|
1414
1628
|
|
1415
1629
|
/* mpfr_log(ret, p1, rnd). */
|
1416
|
-
static VALUE r_mpfr_math_log(int argc, VALUE *argv, VALUE self)
|
1630
|
+
static VALUE r_mpfr_math_log(int argc, VALUE *argv, VALUE self)
|
1631
|
+
{
|
1417
1632
|
mp_rnd_t rnd;
|
1418
1633
|
mp_prec_t prec;
|
1419
1634
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1427,7 +1642,8 @@ static VALUE r_mpfr_math_log(int argc, VALUE *argv, VALUE self){
|
|
1427
1642
|
}
|
1428
1643
|
|
1429
1644
|
/* mpfr_log2(ret, p1, rnd). */
|
1430
|
-
static VALUE r_mpfr_math_log2(int argc, VALUE *argv, VALUE self)
|
1645
|
+
static VALUE r_mpfr_math_log2(int argc, VALUE *argv, VALUE self)
|
1646
|
+
{
|
1431
1647
|
mp_rnd_t rnd;
|
1432
1648
|
mp_prec_t prec;
|
1433
1649
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1441,7 +1657,8 @@ static VALUE r_mpfr_math_log2(int argc, VALUE *argv, VALUE self){
|
|
1441
1657
|
}
|
1442
1658
|
|
1443
1659
|
/* mpfr_log10(ret, p1, rnd). */
|
1444
|
-
static VALUE r_mpfr_math_log10(int argc, VALUE *argv, VALUE self)
|
1660
|
+
static VALUE r_mpfr_math_log10(int argc, VALUE *argv, VALUE self)
|
1661
|
+
{
|
1445
1662
|
mp_rnd_t rnd;
|
1446
1663
|
mp_prec_t prec;
|
1447
1664
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1455,7 +1672,8 @@ static VALUE r_mpfr_math_log10(int argc, VALUE *argv, VALUE self){
|
|
1455
1672
|
}
|
1456
1673
|
|
1457
1674
|
/* mpfr_exp(ret, p1, rnd). */
|
1458
|
-
static VALUE r_mpfr_math_exp(int argc, VALUE *argv, VALUE self)
|
1675
|
+
static VALUE r_mpfr_math_exp(int argc, VALUE *argv, VALUE self)
|
1676
|
+
{
|
1459
1677
|
mp_rnd_t rnd;
|
1460
1678
|
mp_prec_t prec;
|
1461
1679
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1469,7 +1687,8 @@ static VALUE r_mpfr_math_exp(int argc, VALUE *argv, VALUE self){
|
|
1469
1687
|
}
|
1470
1688
|
|
1471
1689
|
/* mpfr_exp2(ret, p1, rnd). */
|
1472
|
-
static VALUE r_mpfr_math_exp2(int argc, VALUE *argv, VALUE self)
|
1690
|
+
static VALUE r_mpfr_math_exp2(int argc, VALUE *argv, VALUE self)
|
1691
|
+
{
|
1473
1692
|
mp_rnd_t rnd;
|
1474
1693
|
mp_prec_t prec;
|
1475
1694
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1483,7 +1702,8 @@ static VALUE r_mpfr_math_exp2(int argc, VALUE *argv, VALUE self){
|
|
1483
1702
|
}
|
1484
1703
|
|
1485
1704
|
/* mpfr_exp10(ret, p1, rnd). */
|
1486
|
-
static VALUE r_mpfr_math_exp10(int argc, VALUE *argv, VALUE self)
|
1705
|
+
static VALUE r_mpfr_math_exp10(int argc, VALUE *argv, VALUE self)
|
1706
|
+
{
|
1487
1707
|
mp_rnd_t rnd;
|
1488
1708
|
mp_prec_t prec;
|
1489
1709
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1497,7 +1717,8 @@ static VALUE r_mpfr_math_exp10(int argc, VALUE *argv, VALUE self){
|
|
1497
1717
|
}
|
1498
1718
|
|
1499
1719
|
/* mpfr_cos(ret, p1, rnd). */
|
1500
|
-
static VALUE r_mpfr_math_cos(int argc, VALUE *argv, VALUE self)
|
1720
|
+
static VALUE r_mpfr_math_cos(int argc, VALUE *argv, VALUE self)
|
1721
|
+
{
|
1501
1722
|
mp_rnd_t rnd;
|
1502
1723
|
mp_prec_t prec;
|
1503
1724
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1511,7 +1732,8 @@ static VALUE r_mpfr_math_cos(int argc, VALUE *argv, VALUE self){
|
|
1511
1732
|
}
|
1512
1733
|
|
1513
1734
|
/* mpfr_sin(ret, p1, rnd). */
|
1514
|
-
static VALUE r_mpfr_math_sin(int argc, VALUE *argv, VALUE self)
|
1735
|
+
static VALUE r_mpfr_math_sin(int argc, VALUE *argv, VALUE self)
|
1736
|
+
{
|
1515
1737
|
mp_rnd_t rnd;
|
1516
1738
|
mp_prec_t prec;
|
1517
1739
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1525,7 +1747,8 @@ static VALUE r_mpfr_math_sin(int argc, VALUE *argv, VALUE self){
|
|
1525
1747
|
}
|
1526
1748
|
|
1527
1749
|
/* mpfr_tan(ret, p1, rnd). */
|
1528
|
-
static VALUE r_mpfr_math_tan(int argc, VALUE *argv, VALUE self)
|
1750
|
+
static VALUE r_mpfr_math_tan(int argc, VALUE *argv, VALUE self)
|
1751
|
+
{
|
1529
1752
|
mp_rnd_t rnd;
|
1530
1753
|
mp_prec_t prec;
|
1531
1754
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1539,7 +1762,8 @@ static VALUE r_mpfr_math_tan(int argc, VALUE *argv, VALUE self){
|
|
1539
1762
|
}
|
1540
1763
|
|
1541
1764
|
/* mpfr_sec(ret, p1, rnd). */
|
1542
|
-
static VALUE r_mpfr_math_sec(int argc, VALUE *argv, VALUE self)
|
1765
|
+
static VALUE r_mpfr_math_sec(int argc, VALUE *argv, VALUE self)
|
1766
|
+
{
|
1543
1767
|
mp_rnd_t rnd;
|
1544
1768
|
mp_prec_t prec;
|
1545
1769
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1553,7 +1777,8 @@ static VALUE r_mpfr_math_sec(int argc, VALUE *argv, VALUE self){
|
|
1553
1777
|
}
|
1554
1778
|
|
1555
1779
|
/* mpfr_csc(ret, p1, rnd). */
|
1556
|
-
static VALUE r_mpfr_math_csc(int argc, VALUE *argv, VALUE self)
|
1780
|
+
static VALUE r_mpfr_math_csc(int argc, VALUE *argv, VALUE self)
|
1781
|
+
{
|
1557
1782
|
mp_rnd_t rnd;
|
1558
1783
|
mp_prec_t prec;
|
1559
1784
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1567,7 +1792,8 @@ static VALUE r_mpfr_math_csc(int argc, VALUE *argv, VALUE self){
|
|
1567
1792
|
}
|
1568
1793
|
|
1569
1794
|
/* mpfr_cot(ret, p1, rnd). */
|
1570
|
-
static VALUE r_mpfr_math_cot(int argc, VALUE *argv, VALUE self)
|
1795
|
+
static VALUE r_mpfr_math_cot(int argc, VALUE *argv, VALUE self)
|
1796
|
+
{
|
1571
1797
|
mp_rnd_t rnd;
|
1572
1798
|
mp_prec_t prec;
|
1573
1799
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1581,7 +1807,8 @@ static VALUE r_mpfr_math_cot(int argc, VALUE *argv, VALUE self){
|
|
1581
1807
|
}
|
1582
1808
|
|
1583
1809
|
/* Return [sin, cos] such as mpfr_sin_cos(sin, cos, p1, rnd). */
|
1584
|
-
static VALUE r_mpfr_math_sin_cos(int argc, VALUE *argv, VALUE self)
|
1810
|
+
static VALUE r_mpfr_math_sin_cos(int argc, VALUE *argv, VALUE self)
|
1811
|
+
{
|
1585
1812
|
mp_rnd_t rnd;
|
1586
1813
|
mp_prec_t prec;
|
1587
1814
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
@@ -1596,7 +1823,8 @@ static VALUE r_mpfr_math_sin_cos(int argc, VALUE *argv, VALUE self){
|
|
1596
1823
|
}
|
1597
1824
|
|
1598
1825
|
/* mpfr_acos(ret, p1, rnd). */
|
1599
|
-
static VALUE r_mpfr_math_acos(int argc, VALUE *argv, VALUE self)
|
1826
|
+
static VALUE r_mpfr_math_acos(int argc, VALUE *argv, VALUE self)
|
1827
|
+
{
|
1600
1828
|
mp_rnd_t rnd;
|
1601
1829
|
mp_prec_t prec;
|
1602
1830
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1610,7 +1838,8 @@ static VALUE r_mpfr_math_acos(int argc, VALUE *argv, VALUE self){
|
|
1610
1838
|
}
|
1611
1839
|
|
1612
1840
|
/* mpfr_asin(ret, p1, rnd). */
|
1613
|
-
static VALUE r_mpfr_math_asin(int argc, VALUE *argv, VALUE self)
|
1841
|
+
static VALUE r_mpfr_math_asin(int argc, VALUE *argv, VALUE self)
|
1842
|
+
{
|
1614
1843
|
mp_rnd_t rnd;
|
1615
1844
|
mp_prec_t prec;
|
1616
1845
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1624,7 +1853,8 @@ static VALUE r_mpfr_math_asin(int argc, VALUE *argv, VALUE self){
|
|
1624
1853
|
}
|
1625
1854
|
|
1626
1855
|
/* mpfr_atan(ret, p1, rnd). */
|
1627
|
-
static VALUE r_mpfr_math_atan(int argc, VALUE *argv, VALUE self)
|
1856
|
+
static VALUE r_mpfr_math_atan(int argc, VALUE *argv, VALUE self)
|
1857
|
+
{
|
1628
1858
|
mp_rnd_t rnd;
|
1629
1859
|
mp_prec_t prec;
|
1630
1860
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1638,7 +1868,8 @@ static VALUE r_mpfr_math_atan(int argc, VALUE *argv, VALUE self){
|
|
1638
1868
|
}
|
1639
1869
|
|
1640
1870
|
/* mpfr_atan2(ret, p1, rnd). */
|
1641
|
-
static VALUE r_mpfr_math_atan2(int argc, VALUE *argv, VALUE self)
|
1871
|
+
static VALUE r_mpfr_math_atan2(int argc, VALUE *argv, VALUE self)
|
1872
|
+
{
|
1642
1873
|
mp_rnd_t rnd;
|
1643
1874
|
mp_prec_t prec;
|
1644
1875
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
@@ -1654,7 +1885,8 @@ static VALUE r_mpfr_math_atan2(int argc, VALUE *argv, VALUE self){
|
|
1654
1885
|
}
|
1655
1886
|
|
1656
1887
|
/* mpfr_cosh(ret, p1, rnd). */
|
1657
|
-
static VALUE r_mpfr_math_cosh(int argc, VALUE *argv, VALUE self)
|
1888
|
+
static VALUE r_mpfr_math_cosh(int argc, VALUE *argv, VALUE self)
|
1889
|
+
{
|
1658
1890
|
mp_rnd_t rnd;
|
1659
1891
|
mp_prec_t prec;
|
1660
1892
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1668,7 +1900,8 @@ static VALUE r_mpfr_math_cosh(int argc, VALUE *argv, VALUE self){
|
|
1668
1900
|
}
|
1669
1901
|
|
1670
1902
|
/* mpfr_sinh(ret, p1, rnd). */
|
1671
|
-
static VALUE r_mpfr_math_sinh(int argc, VALUE *argv, VALUE self)
|
1903
|
+
static VALUE r_mpfr_math_sinh(int argc, VALUE *argv, VALUE self)
|
1904
|
+
{
|
1672
1905
|
mp_rnd_t rnd;
|
1673
1906
|
mp_prec_t prec;
|
1674
1907
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1682,7 +1915,8 @@ static VALUE r_mpfr_math_sinh(int argc, VALUE *argv, VALUE self){
|
|
1682
1915
|
}
|
1683
1916
|
|
1684
1917
|
/* mpfr_tanh(ret, p1, rnd). */
|
1685
|
-
static VALUE r_mpfr_math_tanh(int argc, VALUE *argv, VALUE self)
|
1918
|
+
static VALUE r_mpfr_math_tanh(int argc, VALUE *argv, VALUE self)
|
1919
|
+
{
|
1686
1920
|
mp_rnd_t rnd;
|
1687
1921
|
mp_prec_t prec;
|
1688
1922
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1696,7 +1930,8 @@ static VALUE r_mpfr_math_tanh(int argc, VALUE *argv, VALUE self){
|
|
1696
1930
|
}
|
1697
1931
|
|
1698
1932
|
/* Return array contaning hyperbolic sine and hyperbolic cosine by mpfr_sinh_cosh(ret1, ret2, arg1, rnd). */
|
1699
|
-
static VALUE r_mpfr_math_sinh_cosh(int argc, VALUE *argv, VALUE self)
|
1933
|
+
static VALUE r_mpfr_math_sinh_cosh(int argc, VALUE *argv, VALUE self)
|
1934
|
+
{
|
1700
1935
|
mp_rnd_t rnd;
|
1701
1936
|
mp_prec_t prec;
|
1702
1937
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1711,7 +1946,8 @@ static VALUE r_mpfr_math_sinh_cosh(int argc, VALUE *argv, VALUE self){
|
|
1711
1946
|
}
|
1712
1947
|
|
1713
1948
|
/* mpfr_acosh(ret, p1, rnd). */
|
1714
|
-
static VALUE r_mpfr_math_acosh(int argc, VALUE *argv, VALUE self)
|
1949
|
+
static VALUE r_mpfr_math_acosh(int argc, VALUE *argv, VALUE self)
|
1950
|
+
{
|
1715
1951
|
mp_rnd_t rnd;
|
1716
1952
|
mp_prec_t prec;
|
1717
1953
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1725,7 +1961,8 @@ static VALUE r_mpfr_math_acosh(int argc, VALUE *argv, VALUE self){
|
|
1725
1961
|
}
|
1726
1962
|
|
1727
1963
|
/* mpfr_asinh(ret, p1, rnd). */
|
1728
|
-
static VALUE r_mpfr_math_asinh(int argc, VALUE *argv, VALUE self)
|
1964
|
+
static VALUE r_mpfr_math_asinh(int argc, VALUE *argv, VALUE self)
|
1965
|
+
{
|
1729
1966
|
mp_rnd_t rnd;
|
1730
1967
|
mp_prec_t prec;
|
1731
1968
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1739,7 +1976,8 @@ static VALUE r_mpfr_math_asinh(int argc, VALUE *argv, VALUE self){
|
|
1739
1976
|
}
|
1740
1977
|
|
1741
1978
|
/* mpfr_atanh(ret, p1, rnd). */
|
1742
|
-
static VALUE r_mpfr_math_atanh(int argc, VALUE *argv, VALUE self)
|
1979
|
+
static VALUE r_mpfr_math_atanh(int argc, VALUE *argv, VALUE self)
|
1980
|
+
{
|
1743
1981
|
mp_rnd_t rnd;
|
1744
1982
|
mp_prec_t prec;
|
1745
1983
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1753,7 +1991,8 @@ static VALUE r_mpfr_math_atanh(int argc, VALUE *argv, VALUE self){
|
|
1753
1991
|
}
|
1754
1992
|
|
1755
1993
|
/* mpfr_fac_ui(ret, p1, rnd). */
|
1756
|
-
static VALUE r_mpfr_math_fac_ui(int argc, VALUE *argv, VALUE self)
|
1994
|
+
static VALUE r_mpfr_math_fac_ui(int argc, VALUE *argv, VALUE self)
|
1995
|
+
{
|
1757
1996
|
mp_rnd_t rnd;
|
1758
1997
|
mp_prec_t prec;
|
1759
1998
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1770,7 +2009,8 @@ static VALUE r_mpfr_math_fac_ui(int argc, VALUE *argv, VALUE self){
|
|
1770
2009
|
}
|
1771
2010
|
|
1772
2011
|
/* mpfr_log1p(ret, p1, rnd). */
|
1773
|
-
static VALUE r_mpfr_math_log1p(int argc, VALUE *argv, VALUE self)
|
2012
|
+
static VALUE r_mpfr_math_log1p(int argc, VALUE *argv, VALUE self)
|
2013
|
+
{
|
1774
2014
|
mp_rnd_t rnd;
|
1775
2015
|
mp_prec_t prec;
|
1776
2016
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1784,7 +2024,8 @@ static VALUE r_mpfr_math_log1p(int argc, VALUE *argv, VALUE self){
|
|
1784
2024
|
}
|
1785
2025
|
|
1786
2026
|
/* mpfr_expm1(ret, p1, rnd). */
|
1787
|
-
static VALUE r_mpfr_math_expm1(int argc, VALUE *argv, VALUE self)
|
2027
|
+
static VALUE r_mpfr_math_expm1(int argc, VALUE *argv, VALUE self)
|
2028
|
+
{
|
1788
2029
|
mp_rnd_t rnd;
|
1789
2030
|
mp_prec_t prec;
|
1790
2031
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1798,7 +2039,8 @@ static VALUE r_mpfr_math_expm1(int argc, VALUE *argv, VALUE self){
|
|
1798
2039
|
}
|
1799
2040
|
|
1800
2041
|
/* mpfr_eint(ret, p1, rnd). */
|
1801
|
-
static VALUE r_mpfr_math_eint(int argc, VALUE *argv, VALUE self)
|
2042
|
+
static VALUE r_mpfr_math_eint(int argc, VALUE *argv, VALUE self)
|
2043
|
+
{
|
1802
2044
|
mp_rnd_t rnd;
|
1803
2045
|
mp_prec_t prec;
|
1804
2046
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1812,7 +2054,8 @@ static VALUE r_mpfr_math_eint(int argc, VALUE *argv, VALUE self){
|
|
1812
2054
|
}
|
1813
2055
|
|
1814
2056
|
/* mpfr_li2(ret, p1, rnd). */
|
1815
|
-
static VALUE r_mpfr_math_li2(int argc, VALUE *argv, VALUE self)
|
2057
|
+
static VALUE r_mpfr_math_li2(int argc, VALUE *argv, VALUE self)
|
2058
|
+
{
|
1816
2059
|
mp_rnd_t rnd;
|
1817
2060
|
mp_prec_t prec;
|
1818
2061
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1826,7 +2069,8 @@ static VALUE r_mpfr_math_li2(int argc, VALUE *argv, VALUE self){
|
|
1826
2069
|
}
|
1827
2070
|
|
1828
2071
|
/* mpfr_gamma(ret, p1, rnd). */
|
1829
|
-
static VALUE r_mpfr_math_gamma(int argc, VALUE *argv, VALUE self)
|
2072
|
+
static VALUE r_mpfr_math_gamma(int argc, VALUE *argv, VALUE self)
|
2073
|
+
{
|
1830
2074
|
mp_rnd_t rnd;
|
1831
2075
|
mp_prec_t prec;
|
1832
2076
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1840,7 +2084,8 @@ static VALUE r_mpfr_math_gamma(int argc, VALUE *argv, VALUE self){
|
|
1840
2084
|
}
|
1841
2085
|
|
1842
2086
|
/* mpfr_lngamma(ret, p1, rnd). */
|
1843
|
-
static VALUE r_mpfr_math_lngamma(int argc, VALUE *argv, VALUE self)
|
2087
|
+
static VALUE r_mpfr_math_lngamma(int argc, VALUE *argv, VALUE self)
|
2088
|
+
{
|
1844
2089
|
mp_rnd_t rnd;
|
1845
2090
|
mp_prec_t prec;
|
1846
2091
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1854,7 +2099,8 @@ static VALUE r_mpfr_math_lngamma(int argc, VALUE *argv, VALUE self){
|
|
1854
2099
|
}
|
1855
2100
|
|
1856
2101
|
/* Execute mpfr_lgamma(ret1, ret2, p1, rnd) and return [ret1, ret2]. */
|
1857
|
-
static VALUE r_mpfr_math_lgamma(int argc, VALUE *argv, VALUE self)
|
2102
|
+
static VALUE r_mpfr_math_lgamma(int argc, VALUE *argv, VALUE self)
|
2103
|
+
{
|
1858
2104
|
mp_rnd_t rnd;
|
1859
2105
|
mp_prec_t prec;
|
1860
2106
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1869,7 +2115,8 @@ static VALUE r_mpfr_math_lgamma(int argc, VALUE *argv, VALUE self){
|
|
1869
2115
|
}
|
1870
2116
|
|
1871
2117
|
/* mpfr_zeta(ret, p1, rnd). */
|
1872
|
-
static VALUE r_mpfr_math_zeta(int argc, VALUE *argv, VALUE self)
|
2118
|
+
static VALUE r_mpfr_math_zeta(int argc, VALUE *argv, VALUE self)
|
2119
|
+
{
|
1873
2120
|
mp_rnd_t rnd;
|
1874
2121
|
mp_prec_t prec;
|
1875
2122
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1891,7 +2138,8 @@ static VALUE r_mpfr_math_zeta(int argc, VALUE *argv, VALUE self){
|
|
1891
2138
|
}
|
1892
2139
|
|
1893
2140
|
/* mpfr_erf(ret, p1, rnd). */
|
1894
|
-
static VALUE r_mpfr_math_erf(int argc, VALUE *argv, VALUE self)
|
2141
|
+
static VALUE r_mpfr_math_erf(int argc, VALUE *argv, VALUE self)
|
2142
|
+
{
|
1895
2143
|
mp_rnd_t rnd;
|
1896
2144
|
mp_prec_t prec;
|
1897
2145
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1905,7 +2153,8 @@ static VALUE r_mpfr_math_erf(int argc, VALUE *argv, VALUE self){
|
|
1905
2153
|
}
|
1906
2154
|
|
1907
2155
|
/* mpfr_erfc(ret, p1, rnd). */
|
1908
|
-
static VALUE r_mpfr_math_erfc(int argc, VALUE *argv, VALUE self)
|
2156
|
+
static VALUE r_mpfr_math_erfc(int argc, VALUE *argv, VALUE self)
|
2157
|
+
{
|
1909
2158
|
mp_rnd_t rnd;
|
1910
2159
|
mp_prec_t prec;
|
1911
2160
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1919,7 +2168,8 @@ static VALUE r_mpfr_math_erfc(int argc, VALUE *argv, VALUE self){
|
|
1919
2168
|
}
|
1920
2169
|
|
1921
2170
|
/* mpfr_j0(ret, p1, rnd). */
|
1922
|
-
static VALUE r_mpfr_math_j0(int argc, VALUE *argv, VALUE self)
|
2171
|
+
static VALUE r_mpfr_math_j0(int argc, VALUE *argv, VALUE self)
|
2172
|
+
{
|
1923
2173
|
mp_rnd_t rnd;
|
1924
2174
|
mp_prec_t prec;
|
1925
2175
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1933,7 +2183,8 @@ static VALUE r_mpfr_math_j0(int argc, VALUE *argv, VALUE self){
|
|
1933
2183
|
}
|
1934
2184
|
|
1935
2185
|
/* mpfr_j1(ret, p1, rnd). */
|
1936
|
-
static VALUE r_mpfr_math_j1(int argc, VALUE *argv, VALUE self)
|
2186
|
+
static VALUE r_mpfr_math_j1(int argc, VALUE *argv, VALUE self)
|
2187
|
+
{
|
1937
2188
|
mp_rnd_t rnd;
|
1938
2189
|
mp_prec_t prec;
|
1939
2190
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1947,7 +2198,8 @@ static VALUE r_mpfr_math_j1(int argc, VALUE *argv, VALUE self){
|
|
1947
2198
|
}
|
1948
2199
|
|
1949
2200
|
/* mpfr_jn(ret, p2, p1, rnd) */
|
1950
|
-
static VALUE r_mpfr_math_jn(int argc, VALUE *argv, VALUE self)
|
2201
|
+
static VALUE r_mpfr_math_jn(int argc, VALUE *argv, VALUE self)
|
2202
|
+
{
|
1951
2203
|
mp_rnd_t rnd;
|
1952
2204
|
mp_prec_t prec;
|
1953
2205
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
@@ -1962,7 +2214,8 @@ static VALUE r_mpfr_math_jn(int argc, VALUE *argv, VALUE self){
|
|
1962
2214
|
}
|
1963
2215
|
|
1964
2216
|
/* mpfr_y0(ret, p1, rnd). */
|
1965
|
-
static VALUE r_mpfr_math_y0(int argc, VALUE *argv, VALUE self)
|
2217
|
+
static VALUE r_mpfr_math_y0(int argc, VALUE *argv, VALUE self)
|
2218
|
+
{
|
1966
2219
|
mp_rnd_t rnd;
|
1967
2220
|
mp_prec_t prec;
|
1968
2221
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1976,7 +2229,8 @@ static VALUE r_mpfr_math_y0(int argc, VALUE *argv, VALUE self){
|
|
1976
2229
|
}
|
1977
2230
|
|
1978
2231
|
/* mpfr_y1(ret, p1, rnd). */
|
1979
|
-
static VALUE r_mpfr_math_y1(int argc, VALUE *argv, VALUE self)
|
2232
|
+
static VALUE r_mpfr_math_y1(int argc, VALUE *argv, VALUE self)
|
2233
|
+
{
|
1980
2234
|
mp_rnd_t rnd;
|
1981
2235
|
mp_prec_t prec;
|
1982
2236
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
|
@@ -1990,7 +2244,8 @@ static VALUE r_mpfr_math_y1(int argc, VALUE *argv, VALUE self){
|
|
1990
2244
|
}
|
1991
2245
|
|
1992
2246
|
/* mpfr_yn(ret, p2, p1, rnd) */
|
1993
|
-
static VALUE r_mpfr_math_yn(int argc, VALUE *argv, VALUE self)
|
2247
|
+
static VALUE r_mpfr_math_yn(int argc, VALUE *argv, VALUE self)
|
2248
|
+
{
|
1994
2249
|
mp_rnd_t rnd;
|
1995
2250
|
mp_prec_t prec;
|
1996
2251
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
@@ -2005,7 +2260,8 @@ static VALUE r_mpfr_math_yn(int argc, VALUE *argv, VALUE self){
|
|
2005
2260
|
}
|
2006
2261
|
|
2007
2262
|
/* mpfr_fma(ret, p1, p2, p3, rnd). */
|
2008
|
-
static VALUE r_mpfr_math_fma(int argc, VALUE *argv, VALUE self)
|
2263
|
+
static VALUE r_mpfr_math_fma(int argc, VALUE *argv, VALUE self)
|
2264
|
+
{
|
2009
2265
|
mp_rnd_t rnd;
|
2010
2266
|
mp_prec_t prec;
|
2011
2267
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 3, 5, argc, argv);
|
@@ -2023,7 +2279,8 @@ static VALUE r_mpfr_math_fma(int argc, VALUE *argv, VALUE self){
|
|
2023
2279
|
}
|
2024
2280
|
|
2025
2281
|
/* mpfr_fms(ret, p1, p2, p3, rnd). */
|
2026
|
-
static VALUE r_mpfr_math_fms(int argc, VALUE *argv, VALUE self)
|
2282
|
+
static VALUE r_mpfr_math_fms(int argc, VALUE *argv, VALUE self)
|
2283
|
+
{
|
2027
2284
|
mp_rnd_t rnd;
|
2028
2285
|
mp_prec_t prec;
|
2029
2286
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 3, 5, argc, argv);
|
@@ -2041,7 +2298,8 @@ static VALUE r_mpfr_math_fms(int argc, VALUE *argv, VALUE self){
|
|
2041
2298
|
}
|
2042
2299
|
|
2043
2300
|
/* mpfr_agm(ret, p1, p2, rnd). */
|
2044
|
-
static VALUE r_mpfr_math_agm(int argc, VALUE *argv, VALUE self)
|
2301
|
+
static VALUE r_mpfr_math_agm(int argc, VALUE *argv, VALUE self)
|
2302
|
+
{
|
2045
2303
|
mp_rnd_t rnd;
|
2046
2304
|
mp_prec_t prec;
|
2047
2305
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
@@ -2057,7 +2315,8 @@ static VALUE r_mpfr_math_agm(int argc, VALUE *argv, VALUE self){
|
|
2057
2315
|
}
|
2058
2316
|
|
2059
2317
|
/* mpfr_hypot(ret, p1, p2, rnd). */
|
2060
|
-
static VALUE r_mpfr_math_hypot(int argc, VALUE *argv, VALUE self)
|
2318
|
+
static VALUE r_mpfr_math_hypot(int argc, VALUE *argv, VALUE self)
|
2319
|
+
{
|
2061
2320
|
mp_rnd_t rnd;
|
2062
2321
|
mp_prec_t prec;
|
2063
2322
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
@@ -2073,7 +2332,8 @@ static VALUE r_mpfr_math_hypot(int argc, VALUE *argv, VALUE self){
|
|
2073
2332
|
}
|
2074
2333
|
|
2075
2334
|
/* mpfr_const_log2(ret, rnd). */
|
2076
|
-
static VALUE r_mpfr_math_const_log2(int argc, VALUE *argv, VALUE self)
|
2335
|
+
static VALUE r_mpfr_math_const_log2(int argc, VALUE *argv, VALUE self)
|
2336
|
+
{
|
2077
2337
|
mp_rnd_t rnd;
|
2078
2338
|
mp_prec_t prec;
|
2079
2339
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 0, 2, argc, argv);
|
@@ -2085,7 +2345,8 @@ static VALUE r_mpfr_math_const_log2(int argc, VALUE *argv, VALUE self){
|
|
2085
2345
|
}
|
2086
2346
|
|
2087
2347
|
/* mpfr_const_pi(ret, rnd). */
|
2088
|
-
static VALUE r_mpfr_math_const_pi(int argc, VALUE *argv, VALUE self)
|
2348
|
+
static VALUE r_mpfr_math_const_pi(int argc, VALUE *argv, VALUE self)
|
2349
|
+
{
|
2089
2350
|
mp_rnd_t rnd;
|
2090
2351
|
mp_prec_t prec;
|
2091
2352
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 0, 2, argc, argv);
|
@@ -2097,7 +2358,8 @@ static VALUE r_mpfr_math_const_pi(int argc, VALUE *argv, VALUE self){
|
|
2097
2358
|
}
|
2098
2359
|
|
2099
2360
|
/* mpfr_const_euler(ret, rnd). */
|
2100
|
-
static VALUE r_mpfr_math_const_euler(int argc, VALUE *argv, VALUE self)
|
2361
|
+
static VALUE r_mpfr_math_const_euler(int argc, VALUE *argv, VALUE self)
|
2362
|
+
{
|
2101
2363
|
mp_rnd_t rnd;
|
2102
2364
|
mp_prec_t prec;
|
2103
2365
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 0, 2, argc, argv);
|
@@ -2109,7 +2371,8 @@ static VALUE r_mpfr_math_const_euler(int argc, VALUE *argv, VALUE self){
|
|
2109
2371
|
}
|
2110
2372
|
|
2111
2373
|
/* mpfr_const_catalan(ret, rnd). */
|
2112
|
-
static VALUE r_mpfr_math_const_catalan(int argc, VALUE *argv, VALUE self)
|
2374
|
+
static VALUE r_mpfr_math_const_catalan(int argc, VALUE *argv, VALUE self)
|
2375
|
+
{
|
2113
2376
|
mp_rnd_t rnd;
|
2114
2377
|
mp_prec_t prec;
|
2115
2378
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 0, 2, argc, argv);
|
@@ -2121,7 +2384,8 @@ static VALUE r_mpfr_math_const_catalan(int argc, VALUE *argv, VALUE self){
|
|
2121
2384
|
}
|
2122
2385
|
|
2123
2386
|
/* Execute mpfr_free_cache(). */
|
2124
|
-
static VALUE r_mpfr_math_free_cache(VALUE self)
|
2387
|
+
static VALUE r_mpfr_math_free_cache(VALUE self)
|
2388
|
+
{
|
2125
2389
|
mpfr_free_cache();
|
2126
2390
|
return Qnil;
|
2127
2391
|
}
|
@@ -2153,7 +2417,8 @@ static VALUE r_mpfr_math_sum(int argc, VALUE *argv, VALUE self){
|
|
2153
2417
|
/* ------------------------------ MPFR::Math Miscellaneous Functions Start ------------------------------ */
|
2154
2418
|
|
2155
2419
|
/* mpfr_min(ret, p1, p2, rnd). */
|
2156
|
-
static VALUE r_mpfr_math_min(int argc, VALUE *argv, VALUE self)
|
2420
|
+
static VALUE r_mpfr_math_min(int argc, VALUE *argv, VALUE self)
|
2421
|
+
{
|
2157
2422
|
mp_rnd_t rnd;
|
2158
2423
|
mp_prec_t prec;
|
2159
2424
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
@@ -2169,7 +2434,8 @@ static VALUE r_mpfr_math_min(int argc, VALUE *argv, VALUE self){
|
|
2169
2434
|
}
|
2170
2435
|
|
2171
2436
|
/* mpfr_max(ret, p1, p2, rnd). */
|
2172
|
-
static VALUE r_mpfr_math_max(int argc, VALUE *argv, VALUE self)
|
2437
|
+
static VALUE r_mpfr_math_max(int argc, VALUE *argv, VALUE self)
|
2438
|
+
{
|
2173
2439
|
mp_rnd_t rnd;
|
2174
2440
|
mp_prec_t prec;
|
2175
2441
|
r_mpfr_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
|
@@ -2184,9 +2450,10 @@ static VALUE r_mpfr_math_max(int argc, VALUE *argv, VALUE self){
|
|
2184
2450
|
return val_ret;
|
2185
2451
|
}
|
2186
2452
|
|
2187
|
-
/* ------------------------------ MPFR::Math Miscellaneous Functions End ------------------------------ */
|
2188
2453
|
|
2189
|
-
|
2454
|
+
|
2455
|
+
void Init_mpfr()
|
2456
|
+
{
|
2190
2457
|
/* ------------------------------ Class MPFR Start ------------------------------ */
|
2191
2458
|
|
2192
2459
|
/*
|