diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-10-02 18:16:30 +0200 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-10-02 18:16:30 +0200 |
commit | 9b00cf0da46154b27e439ced5d4a6abd388979ec (patch) | |
tree | 9a3c2cee20f0168f2392e4d78929cae4198bd61d /src/preamble.js | |
parent | fea282c5d45daf83170bff821aa0b3be7abd3499 (diff) |
fix math.h
Diffstat (limited to 'src/preamble.js')
-rw-r--r-- | src/preamble.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/preamble.js b/src/preamble.js index c59a50d1..fe2a0cb4 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -31,7 +31,11 @@ function SAFE_HEAP_ACCESS(dest, type, store, ignore) { } else { #if USE_TYPED_ARRAYS == 0 if (!HEAP[dest] && HEAP[dest] !== 0 && HEAP[dest] !== false) { // false can be the result of a mathop comparator - throw('Warning: Reading an invalid value at ' + dest + ' :: ' + new Error().stack + '\n'); + var error = true; + try { + if (HEAP[dest].toString() === 'NaN') error = false; // NaN is acceptable, as a double value + } catch(e){} + if (error) throw('Warning: Reading an invalid value at ' + dest + ' :: ' + new Error().stack + '\n'); } #endif if (type === null) return; |