lib/hpsqrt.rb in hpsqrt-1.7.0 vs lib/hpsqrt.rb in hpsqrt-1.8.0

- old
+ new

@@ -88,11 +88,11 @@ end def **(other) other = self.class.create(other) - if other.int? + if other.integer? result = self.class.create(1) other_i = other.real.to_i other_i.abs.times {|i| result *= self } @@ -122,11 +122,11 @@ def <=>(other) if !(Numeric===other) nil elsif self==other 0 - elsif !self.real? || !other.imag.zero? + elsif !self.imag.zero? || !other.imag.zero? nil else self.real <=> other.real end end @@ -242,17 +242,13 @@ "#<%s:0x%016x value=(%s) expr=(%s)>" % [self.class.name, self.object_id, to_c, expr] end end def real? - imag.zero? + false end - def imag? - !real? - end - - def int? + def integer? c = to_c c.imag.zero? && c.real==c.real.to_i end def float?