When New Yorks trading floors closed following Septembers terrorist attacks, financial Web sites lost their data streams—with revealing results. For example, the financial page at Netscape.com (see chart) reported alarmingly that the Dow Industrials had opened the day at zero, with results last updated at “NaN p.m.” Nonprogrammers might well have wondered, “Why NaN?”
NaN, abbreviating “Not a Number,” is the IEEE 754 standard term for undefined values such as zero times infinity, zero divided by zero or infinity minus infinity. The Java language defines NaN as a special value, along with another—Infinity—for values such as one divided by zero. JavaScript, in Version 1.2 or later, uses NaN more broadly to signal that a piece of data was supposed to be a number but could not be translated into that form. Earlier versions, in the same situation, failed with a JavaScript error.
Proponents of Web services should ponder this example of unexpected results from unusual situations. As programs are chained together, there are fewer opportunities for a human user to notice and interpret error warnings—or even well-behaved signals like “NaN p.m.” The problem with hands-off software is that it is also brains-off: If users dont get a chance to think at run time, developers had better think harder at design time.