Kernel#puts and Kernel#print with NaN and Infinity values

Hello,

while I was filing a bug report regarding a different behaviour of
Math#hypot compared to the one verified under MRI 1.8.6 (see
http://is.gd/eGHa), I noticed that when a Float instance holds the
values NaN or Infinity then both Kernel#puts and Kernel#print emit
strings localized according to the language settings of the underlying
system. See below, returned strings are in Italian:

IronRuby (SVN r181)

0.0 / 0
=> NaN

printf("%s", 0.0 / 0)
NaN=> nil

puts 0.0 / 0
Non un numero reale
=> nil

1.0 / 0
=> Infinity

printf("%s", 1.0 / 0)
Infinity=> nil

puts 1.0 / 0
+Infinito
=> nil

MRI 1.8.6
irb(main):001:0> 0.0 / 0
=> NaN
irb(main):002:0> printf("%s", 0.0 / 0)
NaN=> nil
irb(main):003:0> puts 0.0 / 0
NaN
=> nil
irb(main):004:0> 1.0 / 0
=> Infinity
irb(main):005:0> printf("%s", 1.0 / 0)
Infinity=> nil
irb(main):006:0> puts 1.0 / 0
Infinity

Should this be considered a bug?

Yes, could you please file it?

Thanks,
Tomas

On Tue, Jan 6, 2009 at 17:07, Tomas M.
[email protected] wrote:

Yes, could you please file it?

Ok, just filed it.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs