diff options
-rw-r--r-- | src/preamble.js | 3 | ||||
-rw-r--r-- | src/settings.js | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/preamble.js b/src/preamble.js index 847d2d95..eaa02c90 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -129,7 +129,8 @@ function cRound(x) { //======================================== // Debugging tools - Mathop overflows //======================================== -function CHECK_OVERFLOW(value, bits) { +function CHECK_OVERFLOW(value, bits, ignore) { + if (ignore) return value; if (value === Infinity || value === -Infinity || Math.abs(value) >= Math.pow(2, bits)) { CorrectionsMonitor.note('Overflow'); } diff --git a/src/settings.js b/src/settings.js index 0243a191..249c8224 100644 --- a/src/settings.js +++ b/src/settings.js @@ -61,6 +61,9 @@ CHECK_OVERFLOWS = 0; // Add code that checks for overflows in integer math opera // some factor, in order to get 'random' hash values - by taking // that |value & hash_table_size| - then multiplying enough times will overflow. // But instead, you can do |value = value & 30_BITS| in each iteration. + // Note: CHECK_OVERFLOWS checks for overflows *after* CORRECT_OVERFLOWS + // has operated (if it has). So you must run *without* CORRECT_OVERFLOWS + // for this option to work. (Sorry for the discrepancy with CHECK_SIGNS - FIXME.) CORRECT_OVERFLOWS = 1; // Experimental code that tries to prevent unexpected JS overflows in integer // mathops, by doing controlled overflows (sort of parallel to a CPU). // Note that as mentioned above in CHECK_OVERFLOWS, the best thing is to |