Monday, May 10, 2010

[TF004] NaN is not a Number (true/false?)

(true/false?) NaN is acronym for "Not a Number", therefore it's not a Number.

(Please don't kill me for this...) FALSE!
assert (Double) Double.NaN instanceof Number; // passes assertion
(ducks and run!!!)

2 comments:

  1. Technically, your (Double) is not a simple cast but instead causes autoboxing, so Double.NaN itself is (strictly speaking) not a Number after all :)

    ReplyDelete
  2. This blog entry is utterly worthless from technical point.

    I did smile when I wrote it, though, and that's good enough for me.

    ReplyDelete