Per http://dev.w3.org/2006/webapi/WebIDL/#es-unrestricted-double, this won't throw a type error.

If x is NaN, then return the IDL unrestricted double value that represents the IEEE 754 NaN value with the bit pattern 0x7ff8000000000000 [IEEE-754].