Hi,
In message "Re: "nan".to_f ?"
on Thu, 14 Oct 2004 02:39:43 +0900, Yukihiro Matsumoto wrote:
> | 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?
Agreed! And if there exists NaN on a non IEEE platform,
that NaN must be another concept because NaN is defined in
IEEE 754.
Gotoken