mathn 0.0.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 818cb0283d813753a2e05a18e40578392a029844
4
- data.tar.gz: 4f20b1e0d3244f4f8b3c85b98d95fffb969f55b6
2
+ SHA256:
3
+ metadata.gz: 8a6ea5b1a70a7d6b9db70b50924c925d5f39660de41e0929381de99daf75e9fb
4
+ data.tar.gz: 872cdbbec5bf3bd00445cb6e775ab20170bf6db86e0a1316c76359bd1acb544e
5
5
  SHA512:
6
- metadata.gz: a068c15a92ce14c3213a2a2cfcb76f4c70fc9894f7095079c00c3fb304b9ea9d3637ec2ef25747f20db98c85a26b375da4e6ba2f995672e992ae95daa6e0cee1
7
- data.tar.gz: 7e5873f7aff9454fbf2d98f565f13d9186b4615768f08fb30e8abbd6a9fbc65638ccd00fc3e9bff443ae48ce5c49c0b1cc1c2bbc5812a68192811b66fecf62f9
6
+ metadata.gz: 5ff741cbf1014ae45507c4d83264e687bc0d4b28711dd00a75068c2e8f9a943f6b9a5a763963d6f9d14e3ca79e8bcbe1b58f6da5be7f08cd929dbb68f92d9265
7
+ data.tar.gz: 43838f787c3d818931fea2911ce2fd0b83a809398c398c1bdc5feeeadb1915b0dacd8511763fe7f89a290e3a67f9da2890dc0a2d5c6991e0eb59020f03a6f58f
@@ -4,10 +4,10 @@ Redistribution and use in source and binary forms, with or without
4
4
  modification, are permitted provided that the following conditions
5
5
  are met:
6
6
  1. Redistributions of source code must retain the above copyright
7
- notice, this list of conditions and the following disclaimer.
7
+ notice, this list of conditions and the following disclaimer.
8
8
  2. Redistributions in binary form must reproduce the above copyright
9
- notice, this list of conditions and the following disclaimer in the
10
- documentation and/or other materials provided with the distribution.
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
11
 
12
12
  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13
13
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
data/COPYING ADDED
@@ -0,0 +1,56 @@
1
+ Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
2
+ You can redistribute it and/or modify it under either the terms of the
3
+ 2-clause BSDL (see the file BSDL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a. place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b. use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c. give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d. make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a. distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b. accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c. give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d. make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
data/LEGAL ADDED
@@ -0,0 +1,60 @@
1
+ # -*- rdoc -*-
2
+
3
+ = LEGAL NOTICE INFORMATION
4
+ --------------------------
5
+
6
+ All the files in this distribution are covered under either the Ruby's
7
+ license (see the file COPYING) or public-domain except some files
8
+ mentioned below.
9
+
10
+ == MIT License
11
+ >>>
12
+ Permission is hereby granted, free of charge, to any person obtaining
13
+ a copy of this software and associated documentation files (the
14
+ "Software"), to deal in the Software without restriction, including
15
+ without limitation the rights to use, copy, modify, merge, publish,
16
+ distribute, sublicense, and/or sell copies of the Software, and to
17
+ permit persons to whom the Software is furnished to do so, subject to
18
+ the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be
21
+ included in all copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
+
31
+ == Old-style BSD license
32
+ >>>
33
+ Redistribution and use in source and binary forms, with or without
34
+ modification, are permitted provided that the following conditions
35
+ are met:
36
+ 1. Redistributions of source code must retain the above copyright
37
+ notice, this list of conditions and the following disclaimer.
38
+ 2. Redistributions in binary form must reproduce the above copyright
39
+ notice, this list of conditions and the following disclaimer in the
40
+ documentation and/or other materials provided with the distribution.
41
+ 3. Neither the name of the University nor the names of its contributors
42
+ may be used to endorse or promote products derived from this software
43
+ without specific prior written permission.
44
+
45
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
46
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48
+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55
+ SUCH DAMAGE.
56
+
57
+ IMPORTANT NOTE::
58
+
59
+ From ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
60
+ paragraph 3 above is now null and void.
data/README.md CHANGED
@@ -1,8 +1,47 @@
1
1
  # Mathn
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/mathn`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Build Status](https://travis-ci.org/ruby/mathn.svg?branch=master)](https://travis-ci.org/ruby/mathn)
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ mathn serves to make mathematical operations more precise in Ruby and to integrate other mathematical standard libraries.
6
+
7
+ Without mathn:
8
+
9
+ ```ruby
10
+ 3 / 2 => 1 # Integer
11
+ ```
12
+
13
+ With mathn:
14
+
15
+ ```ruby
16
+ 3 / 2 => 3/2 # Rational
17
+ ```
18
+
19
+ mathn keeps value in exact terms.
20
+
21
+ Without mathn:
22
+
23
+ ```ruby
24
+ 20 / 9 * 3 * 14 / 7 * 3 / 2 # => 18
25
+ ```
26
+
27
+ With mathn:
28
+
29
+ ```ruby
30
+ 20 / 9 * 3 * 14 / 7 * 3 / 2 # => 20
31
+ ```
32
+
33
+ ## Global Behavioral changes
34
+
35
+ While older version of 'mathn', just by required, caused changes to
36
+ the behavior (and even the types) of operations on classes like
37
+ Integer newer `mathn` introduces the refinements `Math::N`, and you
38
+ have to enable it.
39
+
40
+ Before ruby 2.5, `mathn` was part of the ruby standard library. It was
41
+ was [deprecated in ruby 2.2.0](https://github.com/ruby/ruby/blob/v2_2_0/NEWS#stdlib-compatibility-issues-excluding-feature-bug-fixes),
42
+ and [removed from ruby 2.5.0](https://github.com/ruby/ruby/blob/ruby_2_5/NEWS#stdlib-compatibility-issues-excluding-feature-bug-fixes).
43
+ In order to use the library with a current version of ruby,
44
+ you must install it as a gem.
6
45
 
7
46
  ## Installation
8
47
 
@@ -22,7 +61,10 @@ Or install it yourself as:
22
61
 
23
62
  ## Usage
24
63
 
25
- TODO: Write usage instructions here
64
+ ```ruby
65
+ require 'mathn'
66
+ using Math::N
67
+ ```
26
68
 
27
69
  ## Development
28
70
 
@@ -32,10 +74,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
74
 
33
75
  ## Contributing
34
76
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/hsbt/mathn.
77
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/mathn.
36
78
 
37
79
 
38
80
  ## License
39
81
 
40
82
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # mathn/complex
4
+ module Math::N
5
+ refine ::Complex do
6
+ def canonicalize
7
+ if imag.zero?
8
+ real.canonicalize
9
+ else
10
+ self
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # mathn/rational
4
+ module Math::N
5
+ refine ::Rational do
6
+ def canonicalize
7
+ if denominator == 1
8
+ numerator.canonicalize
9
+ else
10
+ self
11
+ end
12
+ end
13
+ end
14
+ end
data/lib/mathn.rb CHANGED
@@ -1,7 +1,4 @@
1
- # frozen_string_literal: false
2
- #--
3
- # $Release Version: 0.5 $
4
- # $Revision: 1.1.1.1.4.1 $
1
+ # frozen_string_literal: true
5
2
 
6
3
  ##
7
4
  # = mathn
@@ -11,10 +8,12 @@
11
8
  #
12
9
  # Without mathn:
13
10
  #
11
+ # using Math::N
14
12
  # 3 / 2 => 1 # Integer
15
13
  #
16
14
  # With mathn:
17
15
  #
16
+ # using Math::N
18
17
  # 3 / 2 => 3/2 # Rational
19
18
  #
20
19
  # mathn keeps value in exact terms.
@@ -25,146 +24,140 @@
25
24
  #
26
25
  # With mathn:
27
26
  #
27
+ # using Math::N
28
28
  # 20 / 9 * 3 * 14 / 7 * 3 / 2 # => 20
29
29
  #
30
30
  #
31
- # When you require 'mathn', the libraries for Prime, CMath, Matrix and Vector
32
- # are also loaded.
31
+ # When you require 'mathn', the libraries for CMath is also loaded.
33
32
  #
34
33
  # == Copyright
35
34
  #
36
35
  # Author: Keiju ISHITSUKA (SHL Japan Inc.)
37
- #--
38
- # class Numeric follows to make this documentation findable in a reasonable
39
- # location
40
36
 
41
- warn('lib/mathn.rb is deprecated') if $VERBOSE
37
+ require "cmath"
38
+ require_relative "mathn/complex"
39
+ require_relative "mathn/rational"
42
40
 
43
- class Numeric; end
41
+ module Math::N
42
+ # The version string
43
+ VERSION = "0.2.0"
44
44
 
45
- require "cmath.rb"
46
- require "matrix.rb"
47
- require "prime.rb"
48
-
49
- require "mathn/rational"
50
- require "mathn/complex"
51
-
52
- unless defined?(Math.exp!)
53
- Object.instance_eval{remove_const :Math}
54
- Math = CMath # :nodoc:
55
- end
56
-
57
- ##
58
- # When mathn is required, Integer's division is enhanced to
59
- # return more precise values from mathematical expressions.
60
- #
61
- # 2/3*3 # => 0
62
- # require 'mathn'
63
- # 2/3*3 # => 2
64
- #
65
- # (2**72) / ((2**70) * 3) # => 4/3
66
-
67
- class Integer
68
- remove_method :/
45
+ refine ::Numeric do
46
+ alias canonicalize itself
47
+ end
69
48
 
70
- ##
71
- # +/+ defines the Rational division for Bignum.
72
- #
73
- # (2**72) / ((2**70) * 3) # => 4/3
49
+ using self # for canonicalize methods
74
50
 
75
- alias / quo
76
- end
51
+ def +(other) super.canonicalize end
52
+ def -(other) super.canonicalize end
53
+ def *(other) super.canonicalize end
54
+ def /(other) super.canonicalize end
55
+ def quo(other) super.canonicalize end
56
+ def **(other) super.canonicalize end
77
57
 
78
- ##
79
- # When mathn is required, the Math module changes as follows:
80
- #
81
- # Standard Math module behaviour:
82
- # Math.sqrt(4/9) # => 0.0
83
- # Math.sqrt(4.0/9.0) # => 0.666666666666667
84
- # Math.sqrt(- 4/9) # => Errno::EDOM: Numerical argument out of domain - sqrt
85
- #
86
- # After require 'mathn', this is changed to:
87
- #
88
- # require 'mathn'
89
- # Math.sqrt(4/9) # => 2/3
90
- # Math.sqrt(4.0/9.0) # => 0.666666666666667
91
- # Math.sqrt(- 4/9) # => Complex(0, 2/3)
92
-
93
- module Math
94
- remove_method(:sqrt)
95
-
96
- ##
97
- # Computes the square root of +a+. It makes use of Complex and
98
- # Rational to have no rounding errors if possible.
99
- #
100
- # Math.sqrt(4/9) # => 2/3
101
- # Math.sqrt(- 4/9) # => Complex(0, 2/3)
102
- # Math.sqrt(4.0/9.0) # => 0.666666666666667
103
-
104
- def sqrt(a)
105
- if a.kind_of?(Complex)
106
- sqrt!(a)
107
- elsif a.respond_to?(:nan?) and a.nan?
108
- a
109
- elsif a >= 0
110
- rsqrt(a)
111
- else
112
- Complex(0,rsqrt(-a))
58
+ # Transplant per methods.
59
+ canon = public_instance_methods(false).map do |n, h|
60
+ [n, instance_method(n)]
61
+ end
62
+ for klass in [::Integer, ::Rational, ::Complex]
63
+ refine klass do
64
+ canon.each {|n, m| define_method(n, m)}
113
65
  end
114
66
  end
115
67
 
116
68
  ##
117
- # Compute square root of a non negative number. This method is
118
- # internally used by +Math.sqrt+.
119
-
120
- def rsqrt(a) # :nodoc:
121
- if a.kind_of?(Float)
122
- sqrt!(a)
123
- elsif a.kind_of?(Rational)
124
- rsqrt(a.numerator)/rsqrt(a.denominator)
125
- else
126
- src = a
127
- max = 2 ** 32
128
- byte_a = [src & 0xffffffff]
129
- # ruby's bug
130
- while (src >= max) and (src >>= 32)
131
- byte_a.unshift src & 0xffffffff
132
- end
69
+ # Enhance Integer's division to return more precise values from
70
+ # mathematical expressions.
71
+ refine ::Integer do
72
+
73
+ ##
74
+ # +/+ defines the Rational division for Integer.
75
+ #
76
+ # require 'mathn'
77
+ # 2/3*3 # => 0
78
+ # (2**72) / ((2**70) * 3) # => 1
79
+ #
80
+ # using Math::N
81
+ # 2/3*3 # => 2
82
+ # (2**72) / ((2**70) * 3) # => 4/3
83
+ alias / quo
84
+ end
133
85
 
134
- answer = 0
135
- main = 0
136
- side = 0
137
- for elm in byte_a
138
- main = (main << 32) + elm
139
- side <<= 16
140
- if answer != 0
141
- if main * 4 < side * side
142
- applo = main.div(side)
143
- else
144
- applo = ((sqrt!(side * side + 4 * main) - side)/2.0).to_i + 1
145
- end
146
- else
147
- applo = sqrt!(main).to_i + 1
148
- end
149
-
150
- while (x = (side + applo) * applo) > main
151
- applo -= 1
152
- end
153
- main -= x
154
- answer = (answer << 16) + applo
155
- side += applo * 2
86
+ math = refine ::Math do
87
+ module_function
88
+
89
+ ##
90
+ # Computes the square root of +a+. It makes use of Complex and
91
+ # Rational to have no rounding errors if possible.
92
+ #
93
+ # Standard Math module behaviour:
94
+ # Math.sqrt(4/9) # => 0.0
95
+ # Math.sqrt(4.0/9.0) # => 0.6666666666666666
96
+ # Math.sqrt(- 4/9) # => Errno::EDOM: Numerical argument out of domain - sqrt
97
+ #
98
+ # When using 'Math::N', this is changed to:
99
+ #
100
+ # require 'mathn'
101
+ # using Math::N
102
+ # Math.sqrt(4/9) # => 2/3
103
+ # Math.sqrt(4.0/9.0) # => 0.666666666666666
104
+ # Math.sqrt(- 4/9) # => Complex(0, 2/3)
105
+
106
+ def sqrt(a)
107
+ return super unless a.respond_to?(:negative?)
108
+ return a if a.respond_to?(:nan?) and a.nan?
109
+ negative = a.negative?
110
+
111
+ # Compute square root of a non negative number.
112
+ case a
113
+ when Float
114
+ a = super(a.abs)
115
+ when Rational
116
+ a = sqrt(a.numerator.abs).quo sqrt(a.denominator.abs)
117
+ else
118
+ rt = Integer.sqrt(a = a.abs)
119
+ a = rt * rt == a ? rt : super(a)
156
120
  end
157
- if main == 0
158
- answer
121
+ negative ? Complex(0, a) : a
122
+ end
123
+
124
+ ##
125
+ # Computes the cubic root of +a+. It makes use of Complex and
126
+ # Rational to have no rounding errors if possible.
127
+ #
128
+ # Standard Math module behaviour:
129
+ # Math.cbrt(8/27) # => 0.0
130
+ # Math.cbrt(8.0/27.0) # => 0.666666666666666
131
+ # Math.cbrt(- 8/27) # => -1.0
132
+ #
133
+ # When using 'Math::N', this is changed to:
134
+ #
135
+ # require 'mathn'
136
+ # using Math::N
137
+ # Math.cbrt(8/27) # => (2/3)
138
+ # Math.cbrt(8.0/27.0) # => 0.666666666666666
139
+ # Math.cbrt(-8/27) # => (-2/3)
140
+
141
+ def cbrt(a)
142
+ case a
143
+ when Integer
144
+ rt = super
145
+ rt ** 3 == a ? Integer(rt) : rt
146
+ when Rational
147
+ cbrt(a.numerator).quo cbrt(a.denominator)
148
+ when Complex
149
+ a ** (1/3r)
159
150
  else
160
- sqrt!(a)
151
+ super
161
152
  end
162
153
  end
163
154
  end
164
155
 
165
- class << self
166
- remove_method(:sqrt)
156
+ # Transplant module functions.
157
+ refine ::Math.singleton_class do
158
+ math.private_instance_methods(false).each do |m|
159
+ next unless math.respond_to?(m)
160
+ public define_method(m, Math.instance_method(m))
161
+ end
167
162
  end
168
- module_function :sqrt
169
- module_function :rsqrt
170
163
  end
metadata CHANGED
@@ -1,51 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mathn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keiju ISHITSUKA
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2017-05-11 00:00:00.000000000 Z
10
+ date: 2024-10-31 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: bundler
13
+ name: cmath
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
18
  version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake-compiler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
19
+ type: :runtime
49
20
  prerelease: false
50
21
  version_requirements: !ruby/object:Gem::Requirement
51
22
  requirements:
@@ -54,30 +25,22 @@ dependencies:
54
25
  version: '0'
55
26
  description: Deprecated library that extends math operations.
56
27
  email:
57
- -
28
+ - keiju@ishitsuka.com
58
29
  executables: []
59
30
  extensions: []
60
31
  extra_rdoc_files: []
61
32
  files:
62
- - ".gitignore"
63
- - ".travis.yml"
64
- - Gemfile
65
- - LICENSE.txt
33
+ - BSDL
34
+ - COPYING
35
+ - LEGAL
66
36
  - README.md
67
- - Rakefile
68
- - bin/console
69
- - bin/setup
70
- - ext/mathn/complex/complex.c
71
- - ext/mathn/complex/extconf.rb
72
- - ext/mathn/rational/extconf.rb
73
- - ext/mathn/rational/rational.c
74
37
  - lib/mathn.rb
75
- - mathn.gemspec
38
+ - lib/mathn/complex.rb
39
+ - lib/mathn/rational.rb
76
40
  homepage: https://github.com/ruby/mathn
77
41
  licenses:
78
42
  - BSD-2-Clause
79
43
  metadata: {}
80
- post_install_message:
81
44
  rdoc_options: []
82
45
  require_paths:
83
46
  - lib
@@ -85,16 +48,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
48
  requirements:
86
49
  - - ">="
87
50
  - !ruby/object:Gem::Version
88
- version: '0'
51
+ version: '2.5'
89
52
  required_rubygems_version: !ruby/object:Gem::Requirement
90
53
  requirements:
91
54
  - - ">="
92
55
  - !ruby/object:Gem::Version
93
56
  version: '0'
94
57
  requirements: []
95
- rubyforge_project:
96
- rubygems_version: 2.6.12
97
- signing_key:
58
+ rubygems_version: 3.6.0.dev
98
59
  specification_version: 4
99
60
  summary: Deprecated library that extends math operations.
100
61
  test_files: []
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.dll
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - ruby-head
5
- before_install: gem install bundler
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in mathn.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,16 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test" << "test/lib"
6
- t.libs << "lib"
7
- t.test_files = FileList['test/**/test_*.rb']
8
- end
9
-
10
- ENV['RUBYOPT'] = "-w"
11
-
12
- require 'rake/extensiontask'
13
- Rake::ExtensionTask.new("mathn/complex")
14
- Rake::ExtensionTask.new("mathn/rational")
15
-
16
- task :default => [:compile, :test]
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "mathn"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,7 +0,0 @@
1
- extern void nucomp_canonicalization(int);
2
-
3
- void
4
- Init_complex(void)
5
- {
6
- nucomp_canonicalization(1);
7
- }
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: false
2
- require "mkmf"
3
-
4
- create_makefile "mathn/complex"
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: false
2
- require "mkmf"
3
-
4
- create_makefile "mathn/rational"
@@ -1,7 +0,0 @@
1
- extern void nurat_canonicalization(int);
2
-
3
- void
4
- Init_rational(void)
5
- {
6
- nurat_canonicalization(1);
7
- }
data/mathn.gemspec DELETED
@@ -1,23 +0,0 @@
1
- # coding: utf-8
2
- Gem::Specification.new do |spec|
3
- spec.name = "mathn"
4
- spec.version = "0.0.1"
5
- spec.authors = ["Keiju ISHITSUKA"]
6
- spec.email = [nil]
7
-
8
- spec.summary = "Deprecated library that extends math operations."
9
- spec.description = "Deprecated library that extends math operations."
10
- spec.homepage = "https://github.com/ruby/mathn"
11
- spec.license = "BSD-2-Clause"
12
-
13
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
14
- f.match(%r{^(test|spec|features)/})
15
- end
16
- spec.bindir = "exe"
17
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
- spec.require_paths = ["lib"]
19
-
20
- spec.add_development_dependency "bundler"
21
- spec.add_development_dependency "rake"
22
- spec.add_development_dependency "rake-compiler"
23
- end