```On Tuesday, 22 April 2003 at  3:49:23 +0900, Bret Jolly wrote:
> oinkoink+unet / rexx.com (Bret Jolly) wrote in message news:<7e7131a1.0304201226.4808d97e / posting.google.com>...
> > An old bug from ruby 1.6 is still unfixed in the ruby 1.8 preview.
> [...]
> This bug affects more than just the determinant (though I think the
> underlying problem is the same).  Other methods need the mathn library
> to work correctly.  For example:
> irb(main):001:0> require 'matrix'
> true
> irb(main):002:0> m = Matrix[[1, 3], [2, 4]]
> Matrix[[1, 3], [2, 4]]
> irb(main):003:0> n = m.inv
> Matrix[[-3, 2], [1, -1]]
> irb(main):004:0> m*n
> Matrix[[0, -1], [-2, 0]]
> irb(main):005:0> require 'mathn'
> true
> irb(main):006:0> n = m.inv
> Matrix[[-2, 3/2], [1, -1/2]]
> irb(main):007:0> m*n
> Matrix[[1, 0], [0, 1]]

Is the problem that you are asking for 5/9 not to be zero?

irb(main):001:0> require 'matrix'
=> true
irb(main):002:0> m=Matrix[[1.0,3.0],[2.0,4.0]]
=> Matrix[[1.0, 3.0], [2.0, 4.0]]
irb(main):003:0> n = m.inv
=> Matrix[[-2.0, 1.5], [1.0, -0.5]]
irb(main):004:0> m * n
=> Matrix[[1.0, 0.0], [0.0, 1.0]]

irb(main):001:0> require 'matrix'
=> true
irb(main):002:0> require 'rational'
=> true
irb(main):003:0>
irb(main):004:0>
m=Matrix[[Rational.new(1,1),Rational.new(3,1)],[Rational.new(2,1),Rational.new(4,1)]]
=> Matrix[[Rational(1, 1), Rational(3, 1)],
[Rational(2, 1), Rational(4, 1)]]
irb(main):005:0> n = m.inv
=> Matrix[[Rational(-2, 1), Rational(3, 2)],
[Rational(1, 1), Rational(-1, 2)]]
irb(main):006:0> m *n
=> Matrix[[Rational(1, 1), Rational(0, 1)],
[Rational(0, 1), Rational(1, 1)]]

--
Jim Freeze
----------
Too much of a good thing is WONDERFUL.
-- Mae West

```