hpsqrt 1.7.0 → 1.8.0
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.
- checksums.yaml +4 -4
- data/README.md +3 -15
- data/lib/hpsqrt.rb +4 -8
- data/lib/hpsqrt/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 05dcb3de244a72c5d31cc3a6cb9591aedebe865b23a0622f36938efeb432b484
         | 
| 4 | 
            +
              data.tar.gz: 6062e3d23c3ed35228b19caf4ab8e84d53e06365609e3499acf6f82536c78712
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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 | 
            -
            #  | 
| 90 | 
            -
            p Sqrt( | 
| 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). | 
| 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. | 
| 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. | 
| 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 | 
            -
                 | 
| 247 | 
            +
                false
         | 
| 248 248 | 
             
              end
         | 
| 249 249 |  | 
| 250 | 
            -
              def  | 
| 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
         | 
    
        data/lib/hpsqrt/version.rb
    CHANGED
    
    
    
        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. | 
| 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- | 
| 11 | 
            +
            date: 2019-06-17 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         |