smart stuff

Truncating floats
23 Oct 04 - http://www.approximity.com/cgi-bin/blogtariAgile/index.rb/Ruby/RubyTruncatingFloat.rdoc
I needed to cut off floats after n digits (no rounding).
  class Float
    def truncate(sd=2)
      scale=(10**sd).to_f
      (self * scale).to_i / scale
    end
  end
  a=0.255
  a.truncate(2) #-> 0.25