after a bit of actual thought, i think that NaN is supposed to generate a note. if you do catch the note, the program should work fine.
e.g.
#include <u.h>
#include <libc.h>
void
note(void *, char *s)
{
if(strncmp(s, "sys: fp: ", 8) == 0)
noted(NCONT);
noted(NDFLT);
}
void
main(void)
{
double d;
notify(note);
d = NaN();
print("%g\n", d);
}
