I suspect someone (many people) have already done this, previously, but I needed the practice.
I've ported the ECMAScript algorithm for Number.prototype.toFixed() to Ruby, and it's now included in my generically-named 'basiclibrary.rb' file as Numeric#round_to, available at
http://phrogz.net/RubyLibs/
(The full basiclibrary.rb file is available for download if you click on 'basiclibrary.rb' in the Files column, and then click on the "Full Code:" link near the top of that page.)
While this solution works, is this not the sort of thing that should be part of the built-ins? Would there be any objections to an RCR for including this functionality (not necessarily my sloppy-and-likely-inefficient code) in the built-in Numeric class?
···
--
(-, /\ \/ / /\/