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

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,45 @@
1
+ require 'test_helper'
2
+
3
+ class TC_MPFR_Functions < Test::Unit::TestCase
4
+ def setup
5
+ @a = GMP::F(1)
6
+ end
7
+
8
+ def test_const_existence
9
+ assert_nothing_raised("GMP::F#const_log2 should be callable.") { GMP::F.const_log2 }
10
+ assert_nothing_raised("GMP::F#const_pi should be callable.") { GMP::F.const_pi }
11
+ assert_nothing_raised("GMP::F#const_euler should be callable.") { GMP::F.const_euler }
12
+ assert_nothing_raised("GMP::F#const_catalan should be callable.") { GMP::F.const_catalan }
13
+ end
14
+
15
+ def test_function_existence
16
+ assert_nothing_raised("GMP::F.sqrt should be callable.") { @a.sqrt }
17
+
18
+ assert_nothing_raised("GMP::F.log should be callable.") { @a.log }
19
+ assert_nothing_raised("GMP::F.log2 should be callable.") { @a.log2 }
20
+ assert_nothing_raised("GMP::F.log10 should be callable.") { @a.log10 }
21
+ assert_nothing_raised("GMP::F.exp should be callable.") { @a.exp }
22
+
23
+ assert_nothing_raised("GMP::F.cos should be callable.") { @a.cos }
24
+ assert_nothing_raised("GMP::F.sin should be callable.") { @a.sin }
25
+ assert_nothing_raised("GMP::F.tan should be callable.") { @a.tan }
26
+ assert_nothing_raised("GMP::F.sec should be callable.") { @a.sec }
27
+ assert_nothing_raised("GMP::F.csc should be callable.") { @a.csc }
28
+ assert_nothing_raised("GMP::F.cot should be callable.") { @a.cot }
29
+
30
+ assert_nothing_raised("GMP::F.acos should be callable.") { @a.acos }
31
+ assert_nothing_raised("GMP::F.asin should be callable.") { @a.asin }
32
+ assert_nothing_raised("GMP::F.atan should be callable.") { @a.atan }
33
+
34
+ assert_nothing_raised("GMP::F.cosh should be callable.") { @a.cosh }
35
+ assert_nothing_raised("GMP::F.sinh should be callable.") { @a.sinh }
36
+ assert_nothing_raised("GMP::F.tanh should be callable.") { @a.tanh }
37
+
38
+ assert_nothing_raised("GMP::F.acosh should be callable.") { @a.acosh }
39
+ assert_nothing_raised("GMP::F.asinh should be callable.") { @a.asinh }
40
+ assert_nothing_raised("GMP::F.atanh should be callable.") { @a.atanh }
41
+
42
+ assert_nothing_raised("GMP::F.log1p should be callable.") { @a.log1p }
43
+ assert_nothing_raised("GMP::F.expm1 should be callable.") { @a.expm1 }
44
+ end
45
+ end
@@ -0,0 +1,49 @@
1
+ require 'test_helper'
2
+
3
+ class TC_MPFR_Random < Test::Unit::TestCase
4
+ def setup
5
+ end
6
+
7
+ def test_urandomb
8
+ @a = GMP::RandState.new
9
+ @a.seed(577)
10
+ g1 = [
11
+ GMP::F("0.39810885576093713"), GMP::F("0.97212443610368071"), GMP::F("0.23084385480845748"),
12
+ GMP::F("0.29428636987062717"), GMP::F("0.76895428585342840"), GMP::F("0.69329332764704654"),
13
+ GMP::F("0.60252711974045448"), GMP::F("0.03530920538566051"), GMP::F("0.60242124958975374"),
14
+ ]
15
+ g1.size.times do |i|
16
+ assert_in_delta(g1[i], @a.mpfr_urandomb, 1e-12, "GMP::RandState should mpfr_urandomb predictably.")
17
+ end
18
+ end
19
+
20
+ def test_reseed
21
+ @c = GMP::RandState.new
22
+ @c.seed(1000)
23
+ assert_in_delta(GMP::F("0.78522728792921048"), @c.mpfr_urandomb, 1e-12, "GMP::RandState should re-seed correctly.")
24
+ assert_in_delta(GMP::F("0.94422653925308231"), @c.mpfr_urandomb, 1e-12, "GMP::RandState should re-seed correctly.")
25
+ assert_in_delta(GMP::F("0.60678541956109799"), @c.mpfr_urandomb, 1e-12, "GMP::RandState should re-seed correctly.")
26
+ @c.seed(1000)
27
+ assert_in_delta(GMP::F("0.78522728792921048"), @c.mpfr_urandomb, 1e-12, "GMP::RandState should re-seed correctly.")
28
+ assert_in_delta(GMP::F("0.94422653925308231"), @c.mpfr_urandomb, 1e-12, "GMP::RandState should re-seed correctly.")
29
+ assert_in_delta(GMP::F("0.60678541956109799"), @c.mpfr_urandomb, 1e-12, "GMP::RandState should re-seed correctly.")
30
+ @c.seed(1000)
31
+ assert_in_delta(GMP::F("0.78522728792921048"), @c.mpfr_urandomb, 1e-12, "GMP::RandState should re-seed correctly.")
32
+ assert_in_delta(GMP::F("0.94422653925308231"), @c.mpfr_urandomb, 1e-12, "GMP::RandState should re-seed correctly.")
33
+ assert_in_delta(GMP::F("0.60678541956109799"), @c.mpfr_urandomb, 1e-12, "GMP::RandState should re-seed correctly.")
34
+ end
35
+
36
+ def test_random_independent_states
37
+ @d = GMP::RandState.new
38
+ @d.seed(577)
39
+ @e = GMP::RandState.new
40
+ @e.seed(577)
41
+
42
+ assert_in_delta(GMP::F("0.39810885576093713"), @d.mpfr_urandomb, 1e-12, "GMP::RandState should be independent correctly.")
43
+ assert_in_delta(GMP::F("0.97212443610368071"), @d.mpfr_urandomb, 1e-12, "GMP::RandState should be independent correctly.")
44
+ assert_in_delta(GMP::F("0.39810885576093713"), @e.mpfr_urandomb, 1e-12, "GMP::RandState should be independent correctly.")
45
+ assert_in_delta(GMP::F("0.97212443610368071"), @e.mpfr_urandomb, 1e-12, "GMP::RandState should be independent correctly.")
46
+ assert_in_delta(GMP::F("0.23084385480845748"), @d.mpfr_urandomb, 1e-12, "GMP::RandState should be independent correctly.")
47
+ assert_in_delta(GMP::F("0.23084385480845748"), @e.mpfr_urandomb, 1e-12, "GMP::RandState should be independent correctly.")
48
+ end
49
+ end
data/test/test_helper.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'test/unit'
2
+ require 'test_unit/assertions' # Monkey patch
2
3
  require 'rbconfig'
3
4
 
4
5
  ENV['PATH'] = [File.expand_path(
data/test/unit_tests.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'test_helper'
4
+
4
5
  require 'tc_z'
5
6
  require 'tc_z_basic'
6
7
  require 'tc_z_logic'
@@ -23,17 +24,11 @@ require 'tc_z_jac_leg_rem'
23
24
  require 'tc_z_gcd_lcm_invert'
24
25
  require 'tc_random'
25
26
 
26
- class TC_default_prec < Test::Unit::TestCase
27
- def test_default_prec
28
- assert_equal( 64, GMP::F.default_prec, "GMP::F.default_prec should be 64.")
29
- GMP::F.default_prec = 100
30
- assert_equal(128, GMP::F.default_prec, "GMP::F.default_prec should be assignable.")
31
- GMP::F.default_prec = 130
32
- assert_equal(160, GMP::F.default_prec, "GMP::F.default_prec should be assignable.")
33
- GMP::F.default_prec = 1000
34
- assert_equal(1024, GMP::F.default_prec, "GMP::F.default_prec should be assignable.")
35
- assert_raise(RangeError) { GMP::F.default_prec = -64 }
36
- assert_raise(TypeError) { GMP::F.default_prec = "Cow" }
37
- GMP::F.default_prec = 64
38
- end
39
- end
27
+ begin
28
+ GMP::MPFR_VERSION
29
+ require 'tc_mpfr_random'
30
+ require 'tc_mpfr_functions'
31
+ require 'mpfr_tsqrt'
32
+ rescue
33
+
34
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gmp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Tomasz Wegrzanowski
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2010-03-01 00:00:00 -07:00
13
+ date: 2010-03-08 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies: []
16
16
 
@@ -38,6 +38,9 @@ files:
38
38
  - ext/takeover.h
39
39
  - ext/extconf.rb
40
40
  - ext/libgmp-10.dll
41
+ - ext/libmpfr-1.dll
42
+ - ext/gmp.so
43
+ - test/mpfr_tsqrt.rb
41
44
  - test/tc_cmp.rb
42
45
  - test/tc_division.rb
43
46
  - test/tc_fib_fac_nextprime.rb
@@ -45,6 +48,8 @@ files:
45
48
  - test/tc_f_arithmetics_coersion.rb
46
49
  - test/tc_f_precision.rb
47
50
  - test/tc_logical_roots.rb
51
+ - test/tc_mpfr_functions.rb
52
+ - test/tc_mpfr_random.rb
48
53
  - test/tc_q.rb
49
54
  - test/tc_q_basic.rb
50
55
  - test/tc_random.rb
@@ -92,7 +97,7 @@ post_install_message:
92
97
  rdoc_options: []
93
98
 
94
99
  require_paths:
95
- - ext
100
+ - lib
96
101
  required_ruby_version: !ruby/object:Gem::Requirement
97
102
  requirements:
98
103
  - - ">="