Rick DeNatale wrote:
> 
> How's this for a start?

Excellent!  Thanks.

All but my last test passed:

  require 'test/unit'
  require 'number_format'
  class TestNumberFormat < Test::Unit::TestCase
    def test_some_floats
      assert_equal( '%3.1f', '8.3'.to_number_format )
      assert_equal( '%05.3f', '0.500'.to_number_format )
      assert_equal( '%8.7f', '.0001170'.to_number_format )
      assert_equal( '%7.1f', '14000.0'.to_number_format )
      assert_equal( '%9.3E', '4.480E+09'.to_number_format )
      assert_equal( '%6.1e', '3.2e-5'.to_number_format )
      assert_equal( '%6.1f', '-254.2'.to_number_format )
    end
  end

   1) Failure:
  test_some_floats(TestNumberFormat) [-:11]:
  <"%6.1f"> expected but was
  <"%5.1f">.

Note: made the simple float leading digit match 0
or more to get the third test to pass.

Puzzling the minus sign part now...

Thanks again,
--
Bil Kleb
http://fun3d.larc.nasa.gov