gmp 0.4.1-x86-mingw32 → 0.4.3-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ext/gmprandstate.c CHANGED
@@ -205,12 +205,13 @@ VALUE r_gmprandstate_urandomb(VALUE self, VALUE arg)
205
205
 
206
206
  /*
207
207
  * call-seq:
208
- * rand_state.urandomm(fixnum)
208
+ * rand_state.urandomm(integer)
209
209
  *
210
210
  * From the GMP Manual:
211
211
  *
212
212
  * Generate a uniformly distributed random integer in the range 0 to
213
- * fixnum-1, inclusive.
213
+ * _integer-1_, inclusive. _integer_ can be an instance of GMP::Z,
214
+ * Fixnum, or Bignum
214
215
  */
215
216
  VALUE r_gmprandstate_urandomm(VALUE self, VALUE arg)
216
217
  {
@@ -241,6 +242,54 @@ VALUE r_gmprandstate_urandomm(VALUE self, VALUE arg)
241
242
  return res;
242
243
  }
243
244
 
245
+
246
+ #ifdef MPFR
247
+ /**********************************************************************
248
+ * MPFR Random Numbers *
249
+ **********************************************************************/
250
+
251
+ /*
252
+ * call-seq:
253
+ * rand_state.mpfr_urandomb()
254
+ *
255
+ * From the MPFR Manual:
256
+ *
257
+ * Generate a uniformly distributed random float in the interval 0 <= rop < 1.
258
+ */
259
+ VALUE r_gmprandstate_mpfr_urandomb(int argc, VALUE *argv, VALUE self)
260
+ {
261
+ MP_RANDSTATE *self_val;
262
+ MP_FLOAT *res_val;
263
+ VALUE res;
264
+ unsigned long prec = 0;
265
+
266
+ if (argc > 1)
267
+ rb_raise (rb_eArgError, "wrong # of arguments(%d for 0 or 1)", argc);
268
+
269
+ mprandstate_get_struct (self,self_val);
270
+
271
+ if (argc == 1) {
272
+ if (FIXNUM_P (argv[0])) {
273
+ if (FIX2INT (argv[0]) >= 0)
274
+ prec = FIX2INT (argv[0]);
275
+ else
276
+ rb_raise (rb_eRangeError, "prec must be non-negative");
277
+ } else {
278
+ rb_raise (rb_eTypeError, "prec must be a Fixnum");
279
+ }
280
+ }
281
+
282
+ mpf_make_struct (res, res_val);
283
+ if (prec == 0) { mpf_init (res_val); }
284
+ else { mpf_init2 (res_val, prec); }
285
+
286
+ mpfr_urandomb (res_val, self_val);
287
+
288
+ return res;
289
+ }
290
+ #endif /* MPFR */
291
+
292
+
244
293
  void init_gmprandstate()
245
294
  {
246
295
  mGMP = rb_define_module("GMP");
@@ -258,4 +307,9 @@ void init_gmprandstate()
258
307
  // Integer Random Numbers
259
308
  rb_define_method(cGMP_RandState, "urandomb", r_gmprandstate_urandomb, 1);
260
309
  rb_define_method(cGMP_RandState, "urandomm", r_gmprandstate_urandomm, 1);
310
+
311
+ #ifdef MPFR
312
+ // Float Random Numbers
313
+ rb_define_method(cGMP_RandState, "mpfr_urandomb", r_gmprandstate_mpfr_urandomb, -1);
314
+ #endif /* MPFR */
261
315
  }
data/ext/libmpfr-1.dll ADDED
Binary file
data/ext/ruby_gmp.h CHANGED
@@ -207,6 +207,40 @@ extern VALUE r_gmpf_eq(VALUE self, VALUE arg);
207
207
  extern VALUE r_gmpf_cmp(VALUE self, VALUE arg);
208
208
  extern int mpf_cmp_value(MP_FLOAT *OP, VALUE arg);
209
209
 
210
+ // MPFR
211
+ #ifdef MPFR
212
+ extern VALUE r_gmpfr_sqrt(VALUE self);
213
+
214
+ extern VALUE r_gmpfr_log(VALUE self);
215
+ extern VALUE r_gmpfr_log2(VALUE self);
216
+ extern VALUE r_gmpfr_log10(VALUE self);
217
+ extern VALUE r_gmpfr_exp(VALUE self);
218
+
219
+ extern VALUE r_gmpfr_cos(VALUE self);
220
+ extern VALUE r_gmpfr_sin(VALUE self);
221
+ extern VALUE r_gmpfr_tan(VALUE self);
222
+ extern VALUE r_gmpfr_sec(VALUE self);
223
+ extern VALUE r_gmpfr_csc(VALUE self);
224
+ extern VALUE r_gmpfr_cot(VALUE self);
225
+
226
+ extern VALUE r_gmpfr_acos(VALUE self);
227
+ extern VALUE r_gmpfr_asin(VALUE self);
228
+ extern VALUE r_gmpfr_atan(VALUE self);
229
+
230
+ extern VALUE r_gmpfr_cosh(VALUE self);
231
+ extern VALUE r_gmpfr_sinh(VALUE self);
232
+ extern VALUE r_gmpfr_tanh(VALUE self);
233
+
234
+ extern VALUE r_gmpfr_acosh(VALUE self);
235
+ extern VALUE r_gmpfr_asinh(VALUE self);
236
+ extern VALUE r_gmpfr_atanh(VALUE self);
237
+
238
+ extern VALUE r_gmpfrsg_const_log2();
239
+ extern VALUE r_gmpfrsg_const_pi();
240
+ extern VALUE r_gmpfrsg_const_euler();
241
+ extern VALUE r_gmpfrsg_const_catalan();
242
+ #endif /* MPFR */
243
+
210
244
  // _unsorted_
211
245
  extern VALUE r_gmpf_sgn(VALUE self);
212
246
  extern VALUE r_gmpf_get_prec(VALUE self);
@@ -226,6 +260,11 @@ extern VALUE r_gmprandstate_seed(VALUE self, VALUE arg);
226
260
  extern VALUE r_gmprandstate_urandomb(VALUE self, VALUE arg);
227
261
  extern VALUE r_gmprandstate_urandomm(VALUE self, VALUE arg);
228
262
 
263
+ #ifdef MPFR
264
+ // Float Random Numbers
265
+ extern VALUE r_gmprandstate_mpfr_urandomb(int argc, VALUE *argv, VALUE self);
266
+ #endif /* MPFR */
267
+
229
268
 
230
269
  /* from gmpbench_timing.c */
231
270
 
data/manual.pdf CHANGED
Binary file
data/manual.tex CHANGED
@@ -28,8 +28,8 @@
28
28
  \huge{gmp} &\\
29
29
  \midrule[3pt]
30
30
  \multicolumn{2}{r}{\large{Ruby bindings to the GMP library}}\\
31
- \multicolumn{2}{r}{\large{Edition 0.4.1}}\\
32
- \multicolumn{2}{r}{\large{1 March 2010}}
31
+ \multicolumn{2}{r}{\large{Edition 0.4.3}}\\
32
+ \multicolumn{2}{r}{\large{8 March 2010}}
33
33
  \end{tabular}
34
34
 
35
35
  \vfill
@@ -41,7 +41,7 @@
41
41
  This manual describes how to use the gmp Ruby gem, which provides bindings to
42
42
  the GNU multiple precision arithmetic library, version 4.3.x or 5.0.x.\\
43
43
  \\
44
- Copyright 2009 Sam Rawlins.\\
44
+ Copyright 2009, 2010 Sam Rawlins.\\
45
45
  No license yet.
46
46
  \newpage
47
47
 
@@ -201,7 +201,29 @@ The gmp gem includes the namespace \texttt{GMP} and four classes within \texttt{
201
201
 
202
202
  In addition to the above four classes, there is also one constant within \texttt{GMP}:
203
203
  \begin{itemize}
204
- \item \texttt{GMP::GMP\_VERSION} - The version of GMP compiled into the gmp gem.
204
+ \item \texttt{GMP::GMP\_VERSION} - The version of GMP linked into the gmp gem
205
+ \item \texttt{GMP::GMP\_CC} - The compiler that compiled GMP linked into the gmp gem
206
+ \item \texttt{GMP::GMP\_CFLAGS} - The compiler flags used to compile GMP linked into
207
+ the gmp gem
208
+ \item \texttt{GMP::GMP\_BITS\_PER\_LIMB} - The number of bits per limb
209
+ \end{itemize}
210
+
211
+ \section{MPFR basics}
212
+
213
+ The gmp gem can optionally link to MPFR, the Multiple Precision Floating-Point Reliable
214
+ Library. The x86-mswin32 version of the gmp gem comes with MPFR. This library uses the
215
+ floating-point type from GMP, and thus the MPFR functions mapped in the gmp gem become
216
+ methods in \texttt{GMP::F}.
217
+
218
+ There are additional constants within \texttt{GMP} when MPFR is linked:
219
+ \begin{itemize}
220
+ \item \texttt{GMP::MPFR\_VERSION} - The version of MPFR linked into the gmp gem.
221
+ \item \texttt{GMP::GMP\_RNDN} - Rounding mode representing "round to nearest."
222
+ \item \texttt{GMP::GMP\_RNDZ} - Rounding mode representing "round toward zero."
223
+ \item \texttt{GMP::GMP\_RNDU} - Rounding mode representing "round toward positive
224
+ infinity."
225
+ \item \texttt{GMP::GMP\_RNDD} - Rounding mode representing "round toward negative
226
+ infinity."
205
227
  \end{itemize}
206
228
 
207
229
  \newpage
@@ -693,8 +715,6 @@ There is also a convenience method available, \texttt{GMP::Z()}.\\
693
715
  }
694
716
  \end{tabular}
695
717
 
696
-
697
-
698
718
  \subsection{Integer Logic and Bit Fiddling}
699
719
 
700
720
  \begin{tabular}{p{\methwidth} l r}
@@ -742,6 +762,35 @@ There is also a convenience method available, \texttt{GMP::Z()}.\\
742
762
  }
743
763
  \end{tabular}
744
764
 
765
+ \newpage
766
+ \section{Rational Functions}
767
+
768
+ \subsection{Initializing, Assigning Rationals}
769
+
770
+ \begin{tabular}{p{\methwidth} l r}
771
+ \toprule
772
+ \textbf{new} & & GMP::Q.new $\rightarrow$ \textit{rational} \\
773
+ & & GMP::Q.new(\textit{numerator = 0}, \textit{denominator = 1}) $\rightarrow$ \textit{rational} \\
774
+ & & GMP::Q.new(\textit{str}) $\rightarrow$ \textit{rational} \\
775
+ \cmidrule(r){2-3}
776
+ & \multicolumn{2}{p{\defnwidth}}{
777
+ This method creates a new \textit{GMP::Q} rational number. It takes two optional
778
+ arguments for the value of the numerator and denominator. These arguments can each be
779
+ an instance of several classes. Here are some
780
+ examples:\newline
781
+
782
+ \texttt{GMP::Q.new \qqqquad\qqqquad \#=> 0 (default) \newline
783
+ GMP::Q.new(1) \qqqquad\qquad\ \#=> 1 (Ruby Fixnum) \newline
784
+ GMP::Q.new(1,3) \qqqquad\ \#=> 1/3 (Ruby Fixnums) \newline
785
+ GMP::Q.new("127") \qqqquad\ \#=> 127 (Ruby String)\newline
786
+ GMP::Q.new(4294967296) \qquad \#=> 4294967296 (Ruby Bignum)\newline
787
+ GMP::Q.new(GMP::Z.new(31)) \#=> 31 (GMP Integer)}
788
+ }
789
+ \end{tabular}
790
+ \newline\newline
791
+
792
+ There is also a convenience method available, \texttt{GMP::Q()}.\\
793
+
745
794
  \newpage
746
795
  \section{Random Number Functions}
747
796
 
@@ -793,12 +842,23 @@ There is also a convenience method available, \texttt{GMP::Z()}.\\
793
842
 
794
843
  \begin{tabular}{p{\methwidth} l r}
795
844
  \toprule
796
- \textbf{urandomb} & & $state$.urandomb($n$) $\rightarrow$ $n$ \\
845
+ \textbf{urandomb} & & $state$.urandomb($n$) $\rightarrow$ $integer$ \\
797
846
  \cmidrule(r){2-3}
798
847
  & \multicolumn{2}{p{\defnwidth}}{
799
848
  Generates a uniformly distributed random integer in the range $0$ to $2^n -1$,
800
849
  inclusive.
801
850
  }
802
851
  \end{tabular}
852
+ \newline\newline
853
+
854
+ \begin{tabular}{p{\methwidth} l r}
855
+ \toprule
856
+ \textbf{urandomm} & & $state$.urandomm($n$) $\rightarrow$ $integer$ \\
857
+ \cmidrule(r){2-3}
858
+ & \multicolumn{2}{p{\defnwidth}}{
859
+ Generates a uniformly distributed random integer in the range $0$ to $n -1$,
860
+ inclusive. $n$ can be an instance of \gmpz, $Fixnum$, or $Bignum$.
861
+ }
862
+ \end{tabular}
803
863
 
804
864
  \end{document}
@@ -0,0 +1,53 @@
1
+ require 'test_helper'
2
+
3
+ class MPFR_TSQRT < Test::Unit::TestCase
4
+ def setup
5
+ @rand_state = GMP::RandState.new
6
+ end
7
+
8
+ # This really should be moved to be a method of GMP::F
9
+ def integer_component(f)
10
+ index_e = f.to_s.index('e')
11
+ exp = f.to_s[(index_e+1)..-1].to_i
12
+ return 0 if exp < 0
13
+ f.to_s[2..(index_e-1)][0,exp]
14
+ end
15
+
16
+ def check_diverse(as, p, qs)
17
+ q = GMP::F(as, p)
18
+ q = q.sqrt
19
+ assert_equal(integer_component(q), qs)
20
+ end
21
+
22
+ def property1(p, rounding)
23
+ current_rounding_mode = GMP::F.default_rounding_mode
24
+ GMP::F.default_rounding_mode = rounding
25
+ x = @rand_state.mpfr_urandomb(p)
26
+ y = @rand_state.mpfr_urandomb(p)
27
+ z = x**2 + y**2
28
+ z = x / z.sqrt
29
+ assert_between(-1, 1, z, "-1 <= x/sqrt(x^2+y^2) <= 1 should hold.")
30
+ GMP::F.default_rounding_mode = GMP.const_get(current_rounding_mode)
31
+ end
32
+
33
+ def property2(p, rounding)
34
+ current_rounding_mode = GMP::F.default_rounding_mode
35
+ GMP::F.default_rounding_mode = rounding
36
+ x = @rand_state.mpfr_urandomb(p)
37
+ y = (x ** 2).sqrt
38
+ assert_true(x == y, "sqrt(x^2) = x should hold.")
39
+ GMP::F.default_rounding_mode = GMP.const_get(current_rounding_mode)
40
+ end
41
+
42
+ def test_prec
43
+ (GMP::MPFR_PREC_MIN..128).each do |p|
44
+ property1(p, GMP::GMP_RNDN)
45
+ property1(p, GMP::GMP_RNDU)
46
+ property2(p, GMP::GMP_RNDN)
47
+ end
48
+
49
+ check_diverse("635030154261163106768013773815762607450069292760790610550915652722277604820131530404842415587328",
50
+ 160,
51
+ "796887792767063979679855997149887366668464780637")
52
+ end
53
+ end
@@ -2,47 +2,112 @@ require 'test_helper'
2
2
 
3
3
  class TC_precision < Test::Unit::TestCase
4
4
  def setup
5
+ begin
6
+ GMP::MPFR_VERSION
7
+ @initial_default_prec = GMP::F.default_prec
8
+ rescue
9
+ @initial_default_prec = GMP::F.default_prec
10
+ end
11
+ end
12
+
13
+ def test_initial_default_precision
14
+ begin
15
+ GMP::MPFR_VERSION
16
+ assert_equal(53, GMP::F.default_prec, "The initial default precision with MPFR should be 53.")
17
+ rescue
18
+ assert_equal(64, GMP::F.default_prec, "The initial default precision without MPFR should be 64.")
19
+ end
20
+ end
21
+
22
+ def test_initial_default_precision2
5
23
  @pi = GMP::F.new(3.14)
6
24
  @seven_halves = GMP::F.new(GMP::Q.new(7,2), 1000)
25
+ assert_in_delta(0, GMP::F.new(), 1e-12)
26
+ assert_equal(@initial_default_prec, GMP::F.new().prec)
27
+ assert_in_delta(3.14000000000000012434, @pi, 1e-12)
28
+ assert_equal(@initial_default_prec, @pi.prec)
29
+ assert_in_delta(1, GMP::F.new(1), 1e-12)
30
+ assert_equal(@initial_default_prec, GMP::F.new(1).prec)
31
+ assert_in_delta(3.14, GMP::F.new("3.14"), 1e-12)
32
+ assert_equal(@initial_default_prec, GMP::F.new("3.14").prec)
33
+ assert_in_delta(4294967296, GMP::F.new(2**32), 1e-12)
34
+ assert_equal(@initial_default_prec, GMP::F.new(2**32).prec)
35
+ assert_in_delta(3, GMP::F.new(GMP::Z.new(3)), 1e-12)
36
+ assert_equal(@initial_default_prec, GMP::F.new(GMP::Z.new(3)).prec)
37
+ assert_in_delta(3.5, GMP::F.new(GMP::Q.new(7,2)), 1e-12)
38
+ assert_equal(@initial_default_prec, GMP::F.new(GMP::Q.new(7,2)).prec)
39
+ assert_in_delta(3.14000000000000012434, GMP::F.new(@pi), 1e-12)
40
+ assert_equal(@initial_default_prec, GMP::F.new(@pi).prec)
7
41
  end
8
42
 
9
43
  def test_default_precision
10
- assert_equal("0.e+0", GMP::F.new().to_s)
11
- assert_equal(64, GMP::F.new().prec)
12
- assert_equal("0.314000000000000012434e+1", @pi.to_s)
13
- assert_equal(64, @pi.prec)
14
- assert_equal("0.1e+1", GMP::F.new(1).to_s)
15
- assert_equal(64, GMP::F.new(1).prec)
16
- assert_equal("0.314e+1", GMP::F.new("3.14").to_s)
17
- assert_equal(64, GMP::F.new("3.14").prec)
18
- assert_equal("0.4294967296e+10", GMP::F.new(2**32).to_s)
19
- assert_equal(64, GMP::F.new(2**32).prec)
20
- assert_equal("0.3e+1", GMP::F.new(GMP::Z.new(3)).to_s)
21
- assert_equal(64, GMP::F.new(GMP::Z.new(3)).prec)
22
- assert_equal("0.35e+1", GMP::F.new(GMP::Q.new(7,2)).to_s)
23
- assert_equal(64, GMP::F.new(GMP::Q.new(7,2)).prec)
24
- assert_equal("0.314000000000000012434e+1", GMP::F.new(@pi).to_s)
25
- assert_equal(64, GMP::F.new(@pi).prec)
44
+ GMP::F.default_prec = 128
45
+ @pi = GMP::F.new(3.14)
46
+ @seven_halves = GMP::F.new(GMP::Q.new(7,2), 1000)
47
+ assert_in_delta(0, GMP::F.new(), 1e-12)
48
+ assert_equal(128, GMP::F.new().prec)
49
+ assert_in_delta(3.14000000000000012434, @pi, 1e-12)
50
+ assert_equal(128, @pi.prec)
51
+ assert_in_delta(1, GMP::F.new(1), 1e-12)
52
+ assert_equal(128, GMP::F.new(1).prec)
53
+ assert_in_delta(3.14, GMP::F.new("3.14"), 1e-12)
54
+ assert_equal(128, GMP::F.new("3.14").prec)
55
+ assert_in_delta(4294967296, GMP::F.new(2**32), 1e-12)
56
+ assert_equal(128, GMP::F.new(2**32).prec)
57
+ assert_in_delta(3, GMP::F.new(GMP::Z.new(3)), 1e-12)
58
+ assert_equal(128, GMP::F.new(GMP::Z.new(3)).prec)
59
+ assert_in_delta(3.5, GMP::F.new(GMP::Q.new(7,2)), 1e-12)
60
+ assert_equal(128, GMP::F.new(GMP::Q.new(7,2)).prec)
61
+ assert_in_delta(3.14000000000000012434, GMP::F.new(@pi), 1e-12)
62
+ assert_equal(128, GMP::F.new(@pi).prec)
63
+ GMP::F.default_prec = @initial_default_prec
26
64
  end
27
65
 
28
66
  def test_specific_precision
29
- assert_equal("0.3140000000000000124344978758017532527446746826171875e+1", GMP::F.new(3.14, 1000).to_s)
30
- assert_equal(1024, GMP::F.new(3.14, 1000).prec)
31
- assert_equal("0.1e+1", GMP::F.new(1, 1000).to_s)
32
- assert_equal(1024, GMP::F.new(1, 1000).prec)
33
- assert_equal("0.314e+1", GMP::F.new("3.14", 1000).to_s)
34
- assert_equal(1024, GMP::F.new("3.14", 1000).prec)
35
- assert_equal("0.4294967296e+10", GMP::F.new(2**32, 1000).to_s)
36
- assert_equal(1024, GMP::F.new(2**32, 1000).prec)
37
- assert_equal("0.3e+1", GMP::F.new(GMP::Z.new(3), 1000).to_s)
38
- assert_equal(1024, GMP::F.new(GMP::Z.new(3), 1000).prec)
39
- assert_equal("0.35e+1", @seven_halves.to_s)
40
- assert_equal(1024, @seven_halves.prec)
41
- assert_equal("0.35e+1", GMP::F.new(@seven_halves).to_s)
42
- assert_equal(1024, GMP::F.new(@seven_halves).prec)
43
- assert_equal("0.3140000000000000124344978758017532527446746826171875e+1", GMP::F.new(@pi, 1000).to_s)
44
- assert_equal(1024, GMP::F.new(@pi, 1000).prec)
45
- assert_equal("0.35e+1", GMP::F.new(@seven_halves, 0).to_s)
46
- assert_equal(64, GMP::F.new(@seven_halves, 0).prec)
67
+ @pi = GMP::F.new(3.14)
68
+ @seven_halves = GMP::F.new(GMP::Q.new(7,2), 1024)
69
+ assert_equal(0, GMP::F.new(3.14, 1024).to_s =~ /0\.31400000000000001243449787580175325274467468261718750*e\+1/)
70
+ assert_equal(1024, GMP::F.new(3.14, 1024).prec)
71
+ assert_in_delta(1, GMP::F.new(1, 1024), 1e-12)
72
+ assert_equal(1024, GMP::F.new(1, 1024).prec)
73
+ assert_in_delta(3.14, GMP::F.new("3.14", 1024), 1e-12)
74
+ assert_equal(1024, GMP::F.new("3.14", 1024).prec)
75
+ assert_in_delta(4294967296, GMP::F.new(2**32, 1024), 1e-12)
76
+ assert_equal(1024, GMP::F.new(2**32, 1024).prec)
77
+ assert_in_delta(3, GMP::F.new(GMP::Z.new(3), 1024), 1e-12)
78
+ assert_equal(1024, GMP::F.new(GMP::Z.new(3), 1024).prec)
79
+ assert_in_delta(3.5, @seven_halves, 1e-12)
80
+ assert_equal(1024, @seven_halves.prec)
81
+ assert_in_delta(3.5, GMP::F.new(@seven_halves), 1e-12)
82
+ assert_equal(1024, GMP::F.new(@seven_halves).prec)
83
+ assert_equal(0, GMP::F.new(@pi, 1024).to_s =~ /0\.31400000000000001243449787580175325274467468261718750*e\+1/)
84
+ assert_equal(1024, GMP::F.new(@pi, 1024).prec)
85
+ assert_in_delta(3.5, GMP::F.new(@seven_halves, 0), 1e-12)
86
+ assert_equal(@initial_default_prec, GMP::F.new(@seven_halves, 0).prec)
87
+ end
88
+
89
+ def test_set_default_prec
90
+ begin
91
+ GMP::MPFR_VERSION
92
+ GMP::F.default_prec = 100
93
+ assert_equal(100, GMP::F.default_prec, "GMP::F.default_prec should be assignable.")
94
+ GMP::F.default_prec = 130
95
+ assert_equal(130, GMP::F.default_prec, "GMP::F.default_prec should be assignable.")
96
+ GMP::F.default_prec = 1000
97
+ assert_equal(1000, GMP::F.default_prec, "GMP::F.default_prec should be assignable.")
98
+ assert_raise(RangeError) { GMP::F.default_prec = -64 }
99
+ assert_raise(TypeError) { GMP::F.default_prec = "Cow" }
100
+ rescue NameError => err
101
+ raise unless err.to_s == "uninitialized constant GMP::MPFR_VERSION"
102
+ GMP::F.default_prec = 100
103
+ assert_equal(128, GMP::F.default_prec, "GMP::F.default_prec should be assignable.")
104
+ GMP::F.default_prec = 130
105
+ assert_equal(160, GMP::F.default_prec, "GMP::F.default_prec should be assignable.")
106
+ GMP::F.default_prec = 1000
107
+ assert_equal(1024, GMP::F.default_prec, "GMP::F.default_prec should be assignable.")
108
+ assert_raise(RangeError) { GMP::F.default_prec = -64 }
109
+ assert_raise(TypeError) { GMP::F.default_prec = "Cow" }
110
+ end
111
+ GMP::F.default_prec = @initial_default_prec
47
112
  end
48
113
  end