Bug #1566: sprintf with %e or %E Format Specifer Incorrectly Capitalises Inf and NaN
http://redmine.ruby-lang.org/issues/show/1566

Author: Run Paint Run Run
Status: Open, Priority: Normal
Target version: Ruby 1.8.6
ruby -v: ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]

sprintf/String#% use the %e and %E format specifier to determine the case of results which are NaN or Inf. For example:

  $ ruby1.8 -ve 'p sprintf("%e", 0.0/0)'
  ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
  "nan"

  $ ruby1.8 -ve 'p sprintf("%E", 0.0/0)'
  ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
  "NAN"

I suspect this is wrong for the following reasons:

* 1.9 doesn't capitalise these values, i.e. it always returns Inf or NaN.
* The rdoc description for the %E field is "Equivalent to `e', but uses an uppercase E to indicate the exponent." Neither Inf or NaN are exponents.
* The description for the %e field doesn't make any mention of it's output case.
* JRuby, and I believe Rubinius, behave as 1.9 does.
* NaN and Inf have specific mathematical meanings; it doesn't make sense to subject them to English capitalisation rules.


----------------------------------------
http://redmine.ruby-lang.org