From: "naruse (Yui NARUSE)" Date: 2013-03-30T05:17:46+09:00 Subject: [ruby-core:53830] [Ruby 1.8 - Bug #1566][Rejected] sprintf with %e or %E Format Specifer Incorrectly Capitalises Inf and NaN Issue #1566 has been updated by naruse (Yui NARUSE). Description updated Status changed from Assigned to Rejected 1.8's sprintf is a simple wrapper of sprintf(3). sprintf(3)'s e/E behaves as you said. See also http://pubs.opengroup.org/onlinepubs/009695399/functions/fprintf.html ---------------------------------------- Bug #1566: sprintf with %e or %E Format Specifer Incorrectly Capitalises Inf and NaN https://bugs.ruby-lang.org/issues/1566#change-38039 Author: runpaint (Run Paint Run Run) Status: Rejected Priority: Normal Assignee: knu (Akinori MUSHA) Category: Target version: Ruby 1.8.8 ruby -v: ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux] =begin 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. =end -- http://bugs.ruby-lang.org/