From: Colin Bartlett Date: 2009-12-20T23:51:10+09:00 Subject: Re: Correcting complex math If this can be made to work, it might be useful. Two thoughts that occur to me are: 1. The code you show would probably need to use Rational(?), otherwise 1/n (or 1.0/n) may not be what one thinks it is. 2. What would one do with a number (Float or Rational) which is arbitrarily close to 1/n but which is not 1/n? I'd also like to take the opportunity of this thread to suggest removing (!) something from Complex, unless anyone can make a good case for retaining it: require "complex" n = -2 #=> -2 p = 1 #=> 1 cn = Complex( n, 0 ) #=> Complex(-2, 0) cp = Complex( p, 0 ) #=> Complex(1, 0) n > p #=> false cn > p #=> true cn > cp #=> true The Complex numbers are not an "ordered field", at least not in any normally useful sense. At the moment if either x or y is Complex then x <=> y is calculated as x.abs <=> y.abs; # File complex.rb, line 312 def <=> (other) self.abs <=> other.abs end I think that can be misleading (see the examples above), and I would prefer it if "<=>" and "<", etc, were *not* defined for Complex, and if one wants to compare absolute values then one should do so explicitly.