Thursday, 7 June 2007

Incidentally...

... while(nan) doesn't compile since nan isn't defined. Technically, it should be while(real.nan), but that was a bit unwieldy.

As for what it does, it turns out that despite nan comparing false to everything including itself, it's effectively the same as while(true). Go figure.

1 comment:

Anonymous said...

I would say there are two explanaitions that both sound halfway logical:

- Imagine the expression as being compared to true

or

- Read 0 as false and everything else as true.