From: Benoit Daloze Date: 2010-01-20T19:26:16+09:00 Subject: [ruby-core:27633] [Feature #2152] Split functionality of Float#inspect and Float#to_s Issue #2152 has been updated by Benoit Daloze. Hi dear Ruby creator ! |Hi, |I am not against provide both ways to represent float numbers, but I am |not sure to assign which behavior to which name, or to add a new |method. We need to investigate more on names. | matz. I don't know exactly why, but it seems very clear to me to have the pretty style at #to_s and the complete, full representation with #inspect. The fact is I really don't like to write things like '%.2f' % 2.34 (it sounds so old), I would love to simply do "My Float: #{f}". About inspect, it's the representation used by default in irb, and then is very useful to see the full representation when playing with Float. It's also what Kernel#p uses. Well, many classes that implements both are more complete in #inspect, and shorter in #to_s. #to_s is, as I think, for printing, while #inspect is more for debugging, or printing a complete representation. (Rational, Complex, String, Array(in 1.8), Hash, Encoding, the default inspect(Kernel#inspect,undocumented)) ---------------------------------------- http://redmine.ruby-lang.org/issues/show/2152 ---------------------------------------- http://redmine.ruby-lang.org