From: Joel VanderWerf Date: 2002-01-03T08:12:58+09:00 Subject: [ruby-talk:30085] mathn questions I'm writing some numerical stuff in Ruby and C, and I'd like to use mathn.rb for the Ruby part. This is what irb's math mode uses to give you '1/2 ==> 1/2' rather than '1/2 ==> 0'. Two questions: 1. Does changing integer division in this way interfere with anything in the standard library? Any other consequences I should be aware of? The performance cost of using rationals is not a concern to me, even considering the garbage creation, since C code is doing all the heavy lifting anyway. I just want the Ruby front end to preserve as much precision as possible. 2. Prime generation seems to happen redundantly in mathn.rb. It looks like each time ** or gcd2 is called, the sequence of primes are enumerated (partially, of course) *twice*. It would be better to treat this sequence as static data and continue the enumeration as needed. This is not a big deal for me, just a suggestion for whoever is maintaining the code. I have the Ruby 1.6.6 version of mathn.rb (which is dated 1998/01/16).