From: "Hanmac (Hans Mackowiak)" Date: 2013-10-08T16:45:31+09:00 Subject: [ruby-core:57724] [ruby-trunk - Bug #8994][Open] add methods for Float to get if an NaN is quiet or not, also add class methods for Float to "generate" an quiet NaN and an loud NaN Issue #8994 has been reported by Hanmac (Hans Mackowiak). ---------------------------------------- Bug #8994: add methods for Float to get if an NaN is quiet or not, also add class methods for Float to "generate" an quiet NaN and an loud NaN https://bugs.ruby-lang.org/issues/8994 Author: Hanmac (Hans Mackowiak) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 2.1.0dev (2013-10-01) [x86_64-darwin12.5.0] Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN Currently its not easy possible to know of an NaN in ruby is silent or not like Float::NAN.quiet? there should also methods to make an new NaN like Float::quiet_nan, maybe with the possibility to set user data also there is [Float::NAN].pack("g") #=> "\x7F\xC0\x00\x00" [0.0/0.0].pack("g") #=> "\xFF\xC0\x00\x00" and [-(0.0/0.0)].pack("g") #=> "\x7F\xC0\x00\x00" so it seems that - can turn an quiet NaN into an loud one? (i am not 100% clear about that) specially when using two different NaN in one operation like [(0.0/0.0) + Float::NAN].pack("g") #=> "\xFF\xC0\x00\x00" [Float::NAN + (0.0/0.0)].pack("g") #=> "\x7F\xC0\x00\x00" Wikipedia says: For example, a bit-wise IEEE floating-point standard single precision (32-bit) NaN would be: s111 1111 1axx xxxx xxxx xxxx xxxx xxxx where s is the sign (most often ignored in applications), a determines the type of NaN, and x is an extra payload (most often ignored in applications). If a = 1, it is a quiet NaN; if a is zero and the payload is nonzero, then it is a signaling NaN. so it seems that the negation does it a bit wrong? i mean -@ should not change the value like that? -- http://bugs.ruby-lang.org/