Throw on NaN to prevent endless loops.