From: Brian Ford Date: 2012-01-12T06:55:47+09:00 Subject: [ruby-core:42064] [ruby-trunk - Bug #5884] Float::NAN and 0.0/0.0 is represented differently when packed with 'g' Issue #5884 has been updated by Brian Ford. While it may make some sense that Float::NAN is the quite NaN (if I understand IEEE 754 correctly), really the only way to get NaN as a value in Ruby prior to Float::NAN was to compute 0.0/0.0, which I would expect to result in signaling NaN. Also, since both NaNs roundtrip through (un)pack('g') as a value on which #nan? returns true, most code should be fine. Despite all this, I think it would be least confusing if Float::NAN were actually the value computed by 0.0/0.0. Thanks, Brian ---------------------------------------- Bug #5884: Float::NAN and 0.0/0.0 is represented differently when packed with 'g' https://bugs.ruby-lang.org/issues/5884 Author: Hiro Asari Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 2.0.0dev (2011-12-31 trunk 34165) [x86_64-darwin11.2.0] $ ruby2.0 -e 'p [Float::NAN].pack("g")' "\x7F\xC0\x00\x00" $ ruby2.0 -e 'p [0.0/0.0].pack("g")' "\xFF\xC0\x00\x00" It would be nice to have Float::NAN and 0.0/0.0 behave identically in this regard. -- http://bugs.ruby-lang.org/