hpsqrt 1.7.0 → 1.8.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
2
  SHA256:
3
- metadata.gz: d5bffde79d311243876f44ee4b1ff147ba20af8a9e4ba58350ded7c08d1b2813
4
- data.tar.gz: 39d401c261d8db364ef0c2ccd90c670950a80c31b93601713b4c45e8fe69ebac
3
+ metadata.gz: 05dcb3de244a72c5d31cc3a6cb9591aedebe865b23a0622f36938efeb432b484
4
+ data.tar.gz: 6062e3d23c3ed35228b19caf4ab8e84d53e06365609e3499acf6f82536c78712
5
5
  SHA512:
6
- metadata.gz: b115f6a582dff2eb3cbd81c4f02d1327a2399e52841d231422e2590a8f13ec36fd5db72a1079881ca3daacd7eb2e7d0ee63db9bc729e1cf442d9a2458d22a118
7
- data.tar.gz: b40e5458449e832a20d4f251c4191c4f1264400fb476c8cc3971e8a048f73b5f91f103543bf6e443ea5f41d3dd5586fd2dbb08a6c95760a3b7229682d5c30727
6
+ metadata.gz: 06e28c7a14e200465bfb6f578ce1d252a58e67fe0f786907ce98bd95c0b5b70292f80790113bbc8c3bca61bf0f0fb8b74e159b7fc25a3eb794f349a83427d5c5
7
+ data.tar.gz: 2537b6dee6cd313f3be6520c3a069a09a6ee3d170f1de6822efd1b80ebf3769c50d977ea798fd8a2ec350fe96cb2a4d0517883a0edd9f936e8477925ecc6bf59
data/README.md CHANGED
@@ -86,22 +86,10 @@ Type check:
86
86
  ```ruby
87
87
  require 'hpsqrt/core_ext'
88
88
 
89
- # real? returns true if imaginary number is 0
90
- p Sqrt(5).real?
91
- # => true
92
- p Sqrt(1i).real?
93
- # => false
94
-
95
- # imag? returns true if imaginary number is not 0
96
- p Sqrt(5).imag?
97
- # => false
98
- p Sqrt(1i).imag?
99
- # => true
100
-
101
- # int? return true if after the real decimal point is 0 and imaginary number is 0
102
- p Sqrt(2).int?
89
+ # integer? return true if after the real decimal point is 0 and imaginary number is 0
90
+ p Sqrt(2).integer?
103
91
  # => false
104
- p Sqrt(4).int?
92
+ p Sqrt(4).integer?
105
93
  # => true
106
94
 
107
95
  # float? return true if after the real decimal point is not 0 and imaginary number is 0
data/lib/hpsqrt.rb CHANGED
@@ -90,7 +90,7 @@ class HpSqrt < Numeric
90
90
  def **(other)
91
91
  other = self.class.create(other)
92
92
 
93
- if other.int?
93
+ if other.integer?
94
94
  result = self.class.create(1)
95
95
  other_i = other.real.to_i
96
96
  other_i.abs.times {|i|
@@ -124,7 +124,7 @@ class HpSqrt < Numeric
124
124
  nil
125
125
  elsif self==other
126
126
  0
127
- elsif !self.real? || !other.imag.zero?
127
+ elsif !self.imag.zero? || !other.imag.zero?
128
128
  nil
129
129
  else
130
130
  self.real <=> other.real
@@ -244,14 +244,10 @@ class HpSqrt < Numeric
244
244
  end
245
245
 
246
246
  def real?
247
- imag.zero?
247
+ false
248
248
  end
249
249
 
250
- def imag?
251
- !real?
252
- end
253
-
254
- def int?
250
+ def integer?
255
251
  c = to_c
256
252
  c.imag.zero? && c.real==c.real.to_i
257
253
  end
@@ -1,3 +1,3 @@
1
1
  class HpSqrt < Numeric
2
- VERSION = "1.7.0"
2
+ VERSION = "1.8.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hpsqrt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshida Tetsuya
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-16 00:00:00.000000000 Z
11
+ date: 2019-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler