From: Yukihiro Matsumoto Date: 2004-10-14T02:39:43+09:00 Subject: Re: "nan".to_f ? Hi, In message "Re: "nan".to_f ?" on Wed, 13 Oct 2004 23:33:53 +0900, GOTO Kentaro writes: | def aNaN | s, e, m = rand(2), 2047, rand(2**52-1)+1 | [sprintf("%1b%011b%052b", s,e,m)].pack("B*").unpack("G").first | end | |I believe this will generate NaN on environments where |pack/unpack works and NaN exists. If the platform uses IEEE floating number, right? matz.