From: Jim Freeze Date: 2002-08-06T01:53:09+09:00 Subject: Is there a bug in Matrix or Complex? Hi: I found what I would call strange behavior with Matrix and Complex. -> cat c.rb require 'matrix' require 'complex' c1 = Complex.new(1,2) c2 = Complex.new(3,4) c3 = Complex.new(4,2) m = Matrix[[c1,c2],[c3,c2]] puts "m", m m = m.to_f puts "m.to_f", m puts "m.inv.inv", m.inv.inv puts "m.inv.inv.to_f", m.inv.inv.to_f puts (m == m.inv.inv.to_f) -> ruby c.rb m Matrix[[1+2i, 3+4i], [4+2i, 3+4i]] m.to_f Matrix[[1.0+2.0i, 3.0+4.0i], [4.0+2.0i, 3.0+4.0i]] m.inv.inv Matrix[[1.0+2i, 3.0+4i], [4.0+2i, 3+4i]] m.inv.inv.to_f Matrix[[1.0+2i, 3.0+4i], [4.0+2i, 3+4i]] false Why does taking the double inverse let the elements go back to integers? And, why does #to_f not convert each element to a float after taking the inverse? Thanks -- Jim Freeze If only I had something clever to say for my comment... ~