gmp 0.4.3-x86-mingw32 → 0.4.7-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +16 -1
- data/README.rdoc +20 -1
- data/ext/gmp.c +55 -52
- data/ext/gmp.so +0 -0
- data/ext/gmpf.c +123 -28
- data/ext/gmpq.c +7 -6
- data/ext/gmpz.c +220 -179
- data/ext/mprnd.c +77 -0
- data/ext/mprnd.h +12 -0
- data/ext/ruby_gmp.h +66 -31
- data/manual.pdf +0 -0
- data/manual.tex +271 -39
- data/test/mpfr_tsqrt.rb +37 -8
- data/test/tc_hashes.rb +30 -0
- data/test/tc_mpfr_functions.rb +45 -2
- data/test/tc_mpfr_rounding.rb +27 -0
- data/test/tc_q.rb +12 -0
- data/test/test_helper.rb +1 -1
- data/test/unit_tests.rb +2 -0
- metadata +6 -2
data/CHANGELOG
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
0.4.7:
|
2
|
+
* Added 6 MPFR trig methods, plus eint, li2, gamma, lngamma, zeta, erf, erfc,
|
3
|
+
j0, j1, jn, y0, y1, and yn.
|
4
|
+
* Completely fixed the rounding constants. They are now objects, sporting name,
|
5
|
+
mode, and ieee754 reader methods.
|
6
|
+
* Added 4 MPFR "constants". Their values can change based on precision and
|
7
|
+
rounding mode. const_log2, const_pi, const_euler, const_catalan.
|
8
|
+
* Added GMP::Z.eql? and GMP::Z.hash to allow GMP::Z objects to be proper keys
|
9
|
+
in a hash
|
10
|
+
* "Completed" documentation of GMP::Z.
|
11
|
+
* Started documentation of GMP::Q.
|
12
|
+
* Tests now for GMP::Q.to_s.
|
13
|
+
* Unit test results: 84 tests, 1378 assertions, 0 failures, 0 errors
|
14
|
+
* Unit test results: 74 tests, 719 assertions, 0 failures, 0 errors (w/o MPFR)
|
15
|
+
|
1
16
|
0.4.3:
|
2
17
|
* Support for MPFR on Windows introduced. gmp-x86-mswin32 gem should be used.
|
3
18
|
* Removed compilation warnings when using MPFR
|
@@ -6,7 +21,7 @@
|
|
6
21
|
* Added MPFR rounding constants. These will be changed soon though.
|
7
22
|
* Added MPFR tests adapted straight from the MPFR library, just tsqrt so far.
|
8
23
|
* Added 3x MPFR functions: sec(), csc(), cot().
|
9
|
-
* Added function existence tests
|
24
|
+
* Added function existence tests
|
10
25
|
* Unit test results: 78 tests, 1025 assertions, 0 failures, 0 errors
|
11
26
|
* Unit test results: 72 tests, 593 assertions, 0 failures, 0 errors (w/o MPFR)
|
12
27
|
|
data/README.rdoc
CHANGED
@@ -161,6 +161,7 @@ You can also call them as:
|
|
161
161
|
scan0,scan1 starting at bitnr (1st arg), scan for a 0 or 1
|
162
162
|
(respectively), then return the index of the
|
163
163
|
first instance.
|
164
|
+
cmpabs comparison of absolute value
|
164
165
|
com 2's complement
|
165
166
|
com! in-place 2's complement
|
166
167
|
&,|,^ logical operations: and, or, xor
|
@@ -230,10 +231,25 @@ You can also call them as:
|
|
230
231
|
log2 binary logarithm of object
|
231
232
|
log10 decimal logarithm of object
|
232
233
|
exp e^object
|
234
|
+
exp2 2^object
|
235
|
+
exp10 10^object
|
233
236
|
log1p the same as (object + 1).log, with better
|
234
237
|
precision
|
235
238
|
expm1 the same as (object.exp) - 1, with better
|
236
239
|
precision
|
240
|
+
eint exponential integral of object
|
241
|
+
li2 real part of the dilogarithm of object
|
242
|
+
gamma Gamma fucntion of object
|
243
|
+
lngamma logarithm of the Gamma function of object
|
244
|
+
zeta Reimann Zeta function of object
|
245
|
+
erf error function of object
|
246
|
+
erfc complementary error function of object
|
247
|
+
j0 first kind Bessel function of order 0 of object
|
248
|
+
j1 first kind Bessel function of order 1 of object
|
249
|
+
jn first kind Bessel function of order n of object
|
250
|
+
y0 second kind Bessel function of order 0 of object
|
251
|
+
y1 second kind Bessel function of order 1 of object
|
252
|
+
yn second kind Bessel function of order n of object
|
237
253
|
cos \
|
238
254
|
sin |
|
239
255
|
tan |
|
@@ -246,6 +262,9 @@ You can also call them as:
|
|
246
262
|
cosh | of the object
|
247
263
|
sinh |
|
248
264
|
tanh |
|
265
|
+
sec |
|
266
|
+
csc |
|
267
|
+
cot |
|
249
268
|
aconh |
|
250
269
|
asinh |
|
251
270
|
atanh /
|
@@ -374,7 +393,7 @@ still relevant.
|
|
374
393
|
* better bignum parser
|
375
394
|
* zero-copy method for strings generation
|
376
395
|
* put rb_raise into nice macros
|
377
|
-
* benchmarks against Python GMP
|
396
|
+
* benchmarks against Python GMP and Perl GMP
|
378
397
|
* dup methods
|
379
398
|
* integrate F into system
|
380
399
|
* should Z.[] bits be 0/1 or true/false, 0 is true, what might badly surprise users
|
data/ext/gmp.c
CHANGED
@@ -7,6 +7,9 @@
|
|
7
7
|
#include <ruby_gmp.h>
|
8
8
|
|
9
9
|
VALUE mGMP, cGMP_Z, cGMP_Q, cGMP_F, cGMP_RandState;
|
10
|
+
#ifdef MPFR
|
11
|
+
VALUE cGMP_Rnd;
|
12
|
+
#endif
|
10
13
|
|
11
14
|
void r_gmpz_free(void *ptr) { mpz_clear (ptr); free (ptr); }
|
12
15
|
void r_gmpq_free(void *ptr) { mpq_clear (ptr); free (ptr); }
|
@@ -55,37 +58,6 @@ static VALUE r_gmpq_initialize(int argc, VALUE *argv, VALUE self)
|
|
55
58
|
return Qnil;
|
56
59
|
}
|
57
60
|
|
58
|
-
/* don't pass GMP::F here, it should be handled separately */
|
59
|
-
void mpf_set_value(MP_FLOAT *self_val, VALUE arg)
|
60
|
-
{
|
61
|
-
MP_RAT *arg_val_q;
|
62
|
-
MP_INT *arg_val_z;
|
63
|
-
|
64
|
-
if (GMPQ_P(arg)) {
|
65
|
-
mpq_get_struct(arg, arg_val_q);
|
66
|
-
mpf_set_q(self_val, arg_val_q);
|
67
|
-
} else if (GMPZ_P(arg)) {
|
68
|
-
mpz_get_struct(arg, arg_val_z);
|
69
|
-
mpf_set_z(self_val, arg_val_z);
|
70
|
-
} else if (FLOAT_P(arg)) {
|
71
|
-
mpf_set_d(self_val, NUM2DBL(arg));
|
72
|
-
} else if (FIXNUM_P(arg)) {
|
73
|
-
mpf_set_si(self_val, FIX2INT(arg));
|
74
|
-
} else if (STRING_P(arg)) {
|
75
|
-
if (mpf_set_str(self_val, STR2CSTR(arg), 10) == -1) {
|
76
|
-
rb_raise(rb_eRuntimeError, "Badly formatted string");
|
77
|
-
}
|
78
|
-
} else if (BIGNUM_P(arg)) {
|
79
|
-
#if 1 /* GMP3 code */
|
80
|
-
mpz_temp_from_bignum(arg_val_z, arg);
|
81
|
-
mpf_set_z(self_val, arg_val_z);
|
82
|
-
mpz_temp_free(arg_val_z);
|
83
|
-
#endif
|
84
|
-
} else {
|
85
|
-
rb_raise(rb_eTypeError, "Don't know how to convert %s into GMP::F", rb_class2name(rb_class_of(arg)));
|
86
|
-
}
|
87
|
-
}
|
88
|
-
|
89
61
|
static VALUE r_gmpz_coerce(VALUE self, VALUE arg)
|
90
62
|
{
|
91
63
|
return rb_assoc_new(r_gmpzsg_new(1, &arg, cGMP_Z), self);
|
@@ -126,28 +98,29 @@ static VALUE r_gmpfsg_get_default_rounding_mode(VALUE klass)
|
|
126
98
|
{
|
127
99
|
(void)klass;
|
128
100
|
const char *rounding_string_val;
|
129
|
-
VALUE rounding_string;
|
130
|
-
ID method_to_sym = rb_intern("to_sym");
|
131
101
|
rounding_string_val = mpfr_print_rnd_mode (mpfr_get_default_rounding_mode ());
|
132
|
-
|
133
|
-
|
134
|
-
|
102
|
+
if ( rounding_string_val == NULL ) {
|
103
|
+
return Qnil;
|
104
|
+
}
|
105
|
+
else {
|
106
|
+
return rb_const_get (mGMP, rb_intern (rounding_string_val));
|
107
|
+
}
|
135
108
|
}
|
136
109
|
|
137
110
|
static VALUE r_gmpfsg_set_default_rounding_mode(VALUE klass, VALUE arg)
|
138
111
|
{
|
139
112
|
(void)klass;
|
140
|
-
|
141
|
-
if (
|
142
|
-
|
143
|
-
if (
|
113
|
+
VALUE mode;
|
114
|
+
if (GMPRND_P(arg)) {
|
115
|
+
mode = rb_funcall (arg, rb_intern("mode"), 0);
|
116
|
+
if (FIX2INT(mode) < 0 || FIX2INT(mode) > 3) {
|
144
117
|
rb_raise(rb_eRangeError, "rounding mode must be one of the rounding mode constants.");
|
145
118
|
}
|
146
119
|
} else {
|
147
120
|
rb_raise(rb_eTypeError, "rounding mode must be one of the rounding mode constants.");
|
148
121
|
}
|
149
122
|
|
150
|
-
switch (
|
123
|
+
switch (FIX2INT(mode)) {
|
151
124
|
case 0:
|
152
125
|
mpfr_set_default_rounding_mode (GMP_RNDN);
|
153
126
|
break;
|
@@ -163,7 +136,35 @@ static VALUE r_gmpfsg_set_default_rounding_mode(VALUE klass, VALUE arg)
|
|
163
136
|
}
|
164
137
|
|
165
138
|
return Qnil;
|
166
|
-
}
|
139
|
+
}
|
140
|
+
|
141
|
+
mp_rnd_t r_get_rounding_mode(VALUE rnd)
|
142
|
+
{
|
143
|
+
VALUE mode;
|
144
|
+
|
145
|
+
if (GMPRND_P(rnd)) {
|
146
|
+
mode = rb_funcall (rnd, rb_intern("mode"), 0);
|
147
|
+
if (FIX2INT(mode) < 0 || FIX2INT(mode) > 3) {
|
148
|
+
rb_raise(rb_eRangeError, "rounding mode must be one of the rounding mode constants.");
|
149
|
+
}
|
150
|
+
} else {
|
151
|
+
rb_raise(rb_eTypeError, "rounding mode must be one of the rounding mode constants.");
|
152
|
+
}
|
153
|
+
|
154
|
+
switch (FIX2INT(mode)) {
|
155
|
+
case 0:
|
156
|
+
return GMP_RNDN;
|
157
|
+
case 1:
|
158
|
+
return GMP_RNDZ;
|
159
|
+
case 2:
|
160
|
+
return GMP_RNDU;
|
161
|
+
case 3:
|
162
|
+
return GMP_RNDD;
|
163
|
+
default:
|
164
|
+
return GMP_RNDN;
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
167
168
|
#endif /* MPFR */
|
168
169
|
|
169
170
|
#include "gmpf.h"
|
@@ -187,39 +188,41 @@ void Init_gmp() {
|
|
187
188
|
rb_define_const(mGMP, "MPFR_VERSION", rb_str_new2(MPFR_VERSION_STRING));
|
188
189
|
rb_define_const(mGMP, "MPFR_PREC_MIN", INT2FIX(MPFR_PREC_MIN));
|
189
190
|
rb_define_const(mGMP, "MPFR_PREC_MAX", INT2FIX(MPFR_PREC_MAX));
|
190
|
-
rb_define_const(mGMP, "GMP_RNDN", INT2FIX(0));
|
191
|
-
rb_define_const(mGMP, "GMP_RNDZ", INT2FIX(1));
|
192
|
-
rb_define_const(mGMP, "GMP_RNDU", INT2FIX(2));
|
193
|
-
rb_define_const(mGMP, "GMP_RNDD", INT2FIX(3));
|
191
|
+
// rb_define_const(mGMP, "GMP_RNDN", INT2FIX(0));
|
192
|
+
// rb_define_const(mGMP, "GMP_RNDZ", INT2FIX(1));
|
193
|
+
// rb_define_const(mGMP, "GMP_RNDU", INT2FIX(2));
|
194
|
+
// rb_define_const(mGMP, "GMP_RNDD", INT2FIX(3));
|
194
195
|
#endif /* MPFR */
|
195
196
|
|
196
197
|
cGMP_Z = rb_define_class_under(mGMP, "Z", rb_cInteger);
|
197
|
-
init_gmpz();
|
198
|
+
init_gmpz ();
|
198
199
|
rb_define_method(cGMP_Z, "coerce", r_gmpz_coerce, 1);
|
199
200
|
|
200
201
|
cGMP_Q = rb_define_class_under (mGMP, "Q", rb_cNumeric);
|
201
|
-
init_gmpq();
|
202
|
+
init_gmpq ();
|
202
203
|
rb_define_method(cGMP_Q, "initialize", r_gmpq_initialize, -1);
|
203
204
|
rb_define_method(cGMP_Q, "coerce", r_gmpq_coerce, 1);
|
204
205
|
rb_define_method(cGMP_Q, "num", r_gmpq_num, 0);
|
205
206
|
rb_define_method(cGMP_Q, "den", r_gmpq_den, 0);
|
206
207
|
|
207
208
|
cGMP_F = rb_define_class_under (mGMP, "F", rb_cNumeric);
|
208
|
-
init_gmpf();
|
209
|
+
init_gmpf ();
|
209
210
|
rb_define_singleton_method (cGMP_F, "default_prec", r_gmpfsg_get_default_prec, 0);
|
210
211
|
rb_define_singleton_method (cGMP_F, "default_prec=", r_gmpfsg_set_default_prec, 1);
|
211
212
|
#ifdef MPFR
|
213
|
+
cGMP_Rnd = rb_define_class_under (mGMP, "Rnd", rb_cObject);
|
212
214
|
rb_define_singleton_method (cGMP_F, "default_rounding_mode", r_gmpfsg_get_default_rounding_mode, 0);
|
213
215
|
rb_define_singleton_method (cGMP_F, "default_rounding_mode=", r_gmpfsg_set_default_rounding_mode, 1);
|
216
|
+
init_gmprnd ();
|
214
217
|
#endif /* MPFR */
|
215
|
-
rb_define_method(cGMP_F, "coerce", r_gmpf_coerce, 1); // new method - testing
|
218
|
+
rb_define_method (cGMP_F, "coerce", r_gmpf_coerce, 1); // new method - testing
|
216
219
|
|
217
220
|
/* rb_define_method(cGMP_F, "cmpabs", r_gmpf_cmpabs, 1);*/
|
218
221
|
|
219
222
|
cGMP_RandState = rb_define_class_under (mGMP, "RandState", rb_cObject);
|
220
|
-
init_gmprandstate();
|
223
|
+
init_gmprandstate ();
|
221
224
|
|
222
|
-
init_gmpbench_timing();
|
225
|
+
init_gmpbench_timing ();
|
223
226
|
|
224
227
|
// more
|
225
228
|
|
data/ext/gmp.so
CHANGED
Binary file
|
data/ext/gmpf.c
CHANGED
@@ -70,7 +70,6 @@ VALUE r_gmpfsg_new(int argc, VALUE *argv, VALUE klass)
|
|
70
70
|
{
|
71
71
|
MP_FLOAT *res_val;
|
72
72
|
VALUE res;
|
73
|
-
|
74
73
|
(void)klass;
|
75
74
|
|
76
75
|
if (argc > 2)
|
@@ -126,6 +125,37 @@ VALUE r_gmpf_initialize(int argc, VALUE *argv, VALUE self)
|
|
126
125
|
return Qnil;
|
127
126
|
}
|
128
127
|
|
128
|
+
/* don't pass GMP::F here, it should be handled separately */
|
129
|
+
void mpf_set_value(MP_FLOAT *self_val, VALUE arg)
|
130
|
+
{
|
131
|
+
MP_RAT *arg_val_q;
|
132
|
+
MP_INT *arg_val_z;
|
133
|
+
|
134
|
+
if (GMPQ_P(arg)) {
|
135
|
+
mpq_get_struct(arg, arg_val_q);
|
136
|
+
mpf_set_q(self_val, arg_val_q);
|
137
|
+
} else if (GMPZ_P(arg)) {
|
138
|
+
mpz_get_struct(arg, arg_val_z);
|
139
|
+
mpf_set_z(self_val, arg_val_z);
|
140
|
+
} else if (FLOAT_P(arg)) {
|
141
|
+
mpf_set_d(self_val, NUM2DBL(arg));
|
142
|
+
} else if (FIXNUM_P(arg)) {
|
143
|
+
mpf_set_si(self_val, FIX2INT(arg));
|
144
|
+
} else if (STRING_P(arg)) {
|
145
|
+
if (mpf_set_str(self_val, STR2CSTR(arg), 10) == -1) {
|
146
|
+
rb_raise(rb_eRuntimeError, "Badly formatted string");
|
147
|
+
}
|
148
|
+
} else if (BIGNUM_P(arg)) {
|
149
|
+
#if 1 /* GMP3 code */
|
150
|
+
mpz_temp_from_bignum(arg_val_z, arg);
|
151
|
+
mpf_set_z(self_val, arg_val_z);
|
152
|
+
mpz_temp_free(arg_val_z);
|
153
|
+
#endif
|
154
|
+
} else {
|
155
|
+
rb_raise(rb_eTypeError, "Don't know how to convert %s into GMP::F", rb_class2name(rb_class_of(arg)));
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
129
159
|
/*
|
130
160
|
* call-seq:
|
131
161
|
* GMP::F(arg)
|
@@ -518,19 +548,48 @@ DEFUN_FLOAT_CMP(ge,>=)
|
|
518
548
|
#ifdef MPFR
|
519
549
|
|
520
550
|
#define MPFR_SINGLE_FUNCTION(name) \
|
521
|
-
VALUE r_gmpfr_##name(VALUE self)
|
551
|
+
VALUE r_gmpfr_##name(int argc, VALUE *argv, VALUE self) \
|
522
552
|
{ \
|
523
553
|
MP_FLOAT *self_val, *res_val; \
|
524
|
-
|
554
|
+
VALUE rnd_mode, res_prec; \
|
555
|
+
unsigned long prec, res_prec_value; \
|
556
|
+
mp_rnd_t rnd_mode_value; \
|
525
557
|
VALUE res; \
|
526
558
|
\
|
559
|
+
rb_scan_args (argc, argv, "02", &rnd_mode, &res_prec); \
|
560
|
+
\
|
527
561
|
mpf_get_struct_prec (self, self_val, prec); \
|
528
|
-
|
562
|
+
if (NIL_P (rnd_mode)) { rnd_mode_value = __gmp_default_rounding_mode; } \
|
563
|
+
else { rnd_mode_value = r_get_rounding_mode(rnd_mode); } \
|
564
|
+
if (NIL_P (res_prec)) { res_prec_value = prec; } \
|
565
|
+
else { res_prec_value = FIX2INT (res_prec); } \
|
566
|
+
mpf_make_struct_init (res, res_val, res_prec_value); \
|
529
567
|
mpfr_##name (res_val, self_val, __gmp_default_rounding_mode); \
|
530
568
|
\
|
531
569
|
return res; \
|
532
570
|
}
|
533
571
|
|
572
|
+
#define MPFR_SINGLE_1ARG_FUNCTION(name) \
|
573
|
+
VALUE r_gmpfr_##name(int argc, VALUE *argv, VALUE self) \
|
574
|
+
{ \
|
575
|
+
MP_FLOAT *self_val, *res_val; \
|
576
|
+
VALUE arg1, res_prec; \
|
577
|
+
unsigned long prec, arg1_val, res_prec_value; \
|
578
|
+
VALUE res; \
|
579
|
+
\
|
580
|
+
rb_scan_args (argc, argv, "11", &arg1, &res_prec); \
|
581
|
+
\
|
582
|
+
mpf_get_struct_prec (self, self_val, prec); \
|
583
|
+
if (!FIXNUM_P (arg1)) { typeerror(ZXB); } \
|
584
|
+
arg1_val = FIX2LONG (arg1); \
|
585
|
+
if (NIL_P (res_prec)) { res_prec_value = prec; } \
|
586
|
+
else { res_prec_value = FIX2INT (res_prec); } \
|
587
|
+
mpf_make_struct_init (res, res_val, res_prec_value); \
|
588
|
+
mpfr_##name (res_val, arg1_val, self_val, __gmp_default_rounding_mode); \
|
589
|
+
\
|
590
|
+
return res; \
|
591
|
+
}
|
592
|
+
|
534
593
|
#define MPFR_CONST_FUNCTION(name) \
|
535
594
|
VALUE r_gmpfrsg_##name() \
|
536
595
|
{ \
|
@@ -550,7 +609,8 @@ MPFR_SINGLE_FUNCTION(log)
|
|
550
609
|
MPFR_SINGLE_FUNCTION(log2)
|
551
610
|
MPFR_SINGLE_FUNCTION(log10)
|
552
611
|
MPFR_SINGLE_FUNCTION(exp)
|
553
|
-
|
612
|
+
MPFR_SINGLE_FUNCTION(exp2)
|
613
|
+
MPFR_SINGLE_FUNCTION(exp10)
|
554
614
|
MPFR_SINGLE_FUNCTION(cos)
|
555
615
|
MPFR_SINGLE_FUNCTION(sin)
|
556
616
|
MPFR_SINGLE_FUNCTION(tan)
|
@@ -566,12 +626,29 @@ MPFR_SINGLE_FUNCTION(cosh)
|
|
566
626
|
MPFR_SINGLE_FUNCTION(sinh)
|
567
627
|
MPFR_SINGLE_FUNCTION(tanh)
|
568
628
|
|
629
|
+
MPFR_SINGLE_FUNCTION(sech)
|
630
|
+
MPFR_SINGLE_FUNCTION(csch)
|
631
|
+
MPFR_SINGLE_FUNCTION(coth)
|
569
632
|
MPFR_SINGLE_FUNCTION(acosh)
|
570
633
|
MPFR_SINGLE_FUNCTION(asinh)
|
571
634
|
MPFR_SINGLE_FUNCTION(atanh)
|
572
635
|
|
573
636
|
MPFR_SINGLE_FUNCTION(log1p)
|
574
637
|
MPFR_SINGLE_FUNCTION(expm1)
|
638
|
+
MPFR_SINGLE_FUNCTION(eint)
|
639
|
+
MPFR_SINGLE_FUNCTION(li2)
|
640
|
+
MPFR_SINGLE_FUNCTION(gamma)
|
641
|
+
MPFR_SINGLE_FUNCTION(lngamma)
|
642
|
+
/*MPFR_SINGLE_FUNCTION(lgamma)*/
|
643
|
+
MPFR_SINGLE_FUNCTION(zeta)
|
644
|
+
MPFR_SINGLE_FUNCTION(erf)
|
645
|
+
MPFR_SINGLE_FUNCTION(erfc)
|
646
|
+
MPFR_SINGLE_FUNCTION(j0)
|
647
|
+
MPFR_SINGLE_FUNCTION(j1)
|
648
|
+
MPFR_SINGLE_1ARG_FUNCTION(jn)
|
649
|
+
MPFR_SINGLE_FUNCTION(y0)
|
650
|
+
MPFR_SINGLE_FUNCTION(y1)
|
651
|
+
MPFR_SINGLE_1ARG_FUNCTION(yn)
|
575
652
|
|
576
653
|
MPFR_CONST_FUNCTION(const_log2)
|
577
654
|
MPFR_CONST_FUNCTION(const_pi)
|
@@ -743,7 +820,7 @@ void init_gmpf()
|
|
743
820
|
|
744
821
|
#ifdef MPFR
|
745
822
|
// Basic Arithmetic Functions
|
746
|
-
rb_define_method(cGMP_F, "sqrt", r_gmpfr_sqrt,
|
823
|
+
rb_define_method(cGMP_F, "sqrt", r_gmpfr_sqrt, -1);
|
747
824
|
|
748
825
|
rb_define_method(cGMP_F, "**", r_gmpfr_pow, 1);
|
749
826
|
|
@@ -754,32 +831,50 @@ void init_gmpf()
|
|
754
831
|
rb_define_method(cGMP_F, "number?", r_gmpfr_number_p, 0);
|
755
832
|
|
756
833
|
// Special Functions
|
757
|
-
rb_define_method(cGMP_F, "log", r_gmpfr_log,
|
758
|
-
rb_define_method(cGMP_F, "log2", r_gmpfr_log2,
|
759
|
-
rb_define_method(cGMP_F, "log10", r_gmpfr_log10,
|
760
|
-
rb_define_method(cGMP_F, "exp", r_gmpfr_exp,
|
761
|
-
|
762
|
-
rb_define_method(cGMP_F, "
|
763
|
-
rb_define_method(cGMP_F, "
|
764
|
-
rb_define_method(cGMP_F, "
|
765
|
-
rb_define_method(cGMP_F, "
|
766
|
-
rb_define_method(cGMP_F, "
|
767
|
-
rb_define_method(cGMP_F, "
|
834
|
+
rb_define_method(cGMP_F, "log", r_gmpfr_log, -1);
|
835
|
+
rb_define_method(cGMP_F, "log2", r_gmpfr_log2, -1);
|
836
|
+
rb_define_method(cGMP_F, "log10", r_gmpfr_log10, -1);
|
837
|
+
rb_define_method(cGMP_F, "exp", r_gmpfr_exp, -1);
|
838
|
+
rb_define_method(cGMP_F, "exp2", r_gmpfr_exp2, -1);
|
839
|
+
rb_define_method(cGMP_F, "exp10", r_gmpfr_exp10, -1);
|
840
|
+
rb_define_method(cGMP_F, "cos", r_gmpfr_cos, -1);
|
841
|
+
rb_define_method(cGMP_F, "sin", r_gmpfr_sin, -1);
|
842
|
+
rb_define_method(cGMP_F, "tan", r_gmpfr_tan, -1);
|
843
|
+
rb_define_method(cGMP_F, "sec", r_gmpfr_sec, -1);
|
844
|
+
rb_define_method(cGMP_F, "csc", r_gmpfr_csc, -1);
|
845
|
+
rb_define_method(cGMP_F, "cot", r_gmpfr_cot, -1);
|
768
846
|
|
769
|
-
rb_define_method(cGMP_F, "acos", r_gmpfr_acos,
|
770
|
-
rb_define_method(cGMP_F, "asin", r_gmpfr_asin,
|
771
|
-
rb_define_method(cGMP_F, "atan", r_gmpfr_atan,
|
847
|
+
rb_define_method(cGMP_F, "acos", r_gmpfr_acos, -1);
|
848
|
+
rb_define_method(cGMP_F, "asin", r_gmpfr_asin, -1);
|
849
|
+
rb_define_method(cGMP_F, "atan", r_gmpfr_atan, -1);
|
772
850
|
|
773
|
-
rb_define_method(cGMP_F, "cosh", r_gmpfr_cosh,
|
774
|
-
rb_define_method(cGMP_F, "sinh", r_gmpfr_sinh,
|
775
|
-
rb_define_method(cGMP_F, "tanh", r_gmpfr_tanh,
|
851
|
+
rb_define_method(cGMP_F, "cosh", r_gmpfr_cosh, -1);
|
852
|
+
rb_define_method(cGMP_F, "sinh", r_gmpfr_sinh, -1);
|
853
|
+
rb_define_method(cGMP_F, "tanh", r_gmpfr_tanh, -1);
|
776
854
|
|
777
|
-
rb_define_method(cGMP_F, "
|
778
|
-
rb_define_method(cGMP_F, "
|
779
|
-
rb_define_method(cGMP_F, "
|
855
|
+
rb_define_method(cGMP_F, "sech", r_gmpfr_sech, -1);
|
856
|
+
rb_define_method(cGMP_F, "csch", r_gmpfr_csch, -1);
|
857
|
+
rb_define_method(cGMP_F, "coth", r_gmpfr_coth, -1);
|
858
|
+
rb_define_method(cGMP_F, "acosh", r_gmpfr_acosh, -1);
|
859
|
+
rb_define_method(cGMP_F, "asinh", r_gmpfr_asinh, -1);
|
860
|
+
rb_define_method(cGMP_F, "atanh", r_gmpfr_atanh, -1);
|
780
861
|
|
781
|
-
rb_define_method(cGMP_F, "log1p",
|
782
|
-
rb_define_method(cGMP_F, "expm1",
|
862
|
+
rb_define_method(cGMP_F, "log1p", r_gmpfr_log1p, -1);
|
863
|
+
rb_define_method(cGMP_F, "expm1", r_gmpfr_expm1, -1);
|
864
|
+
rb_define_method(cGMP_F, "eint", r_gmpfr_eint, -1);
|
865
|
+
rb_define_method(cGMP_F, "li2", r_gmpfr_li2, -1);
|
866
|
+
rb_define_method(cGMP_F, "gamma", r_gmpfr_gamma, -1);
|
867
|
+
rb_define_method(cGMP_F, "lngamma", r_gmpfr_lngamma, -1);
|
868
|
+
/*rb_define_method(cGMP_F, "lgamma", r_gmpfr_lgamma, -1);*/
|
869
|
+
rb_define_method(cGMP_F, "zeta", r_gmpfr_zeta, -1);
|
870
|
+
rb_define_method(cGMP_F, "erf", r_gmpfr_erf, -1);
|
871
|
+
rb_define_method(cGMP_F, "erfc", r_gmpfr_erfc, -1);
|
872
|
+
rb_define_method(cGMP_F, "j0", r_gmpfr_j0, -1);
|
873
|
+
rb_define_method(cGMP_F, "j1", r_gmpfr_j1, -1);
|
874
|
+
rb_define_method(cGMP_F, "jn", r_gmpfr_jn, -1);
|
875
|
+
rb_define_method(cGMP_F, "y0", r_gmpfr_y0, -1);
|
876
|
+
rb_define_method(cGMP_F, "y1", r_gmpfr_y1, -1);
|
877
|
+
rb_define_method(cGMP_F, "yn", r_gmpfr_yn, -1);
|
783
878
|
|
784
879
|
rb_define_singleton_method(cGMP_F, "const_log2", r_gmpfrsg_const_log2, 0);
|
785
880
|
rb_define_singleton_method(cGMP_F, "const_pi", r_gmpfrsg_const_pi, 0);
|