diff --git a/silly.js b/silly.js index 2dd95b5..26b2501 100644 --- a/silly.js +++ b/silly.js @@ -4,7 +4,7 @@ let logBits = 8; let logEntries = 2 ** logBits; -let powBits = 16; +let powBits = 21; let powEntries = 2 ** powBits; // Room to hold exponents up to 15.9 for 16-bit output @@ -29,7 +29,7 @@ function toFloat(fixed) { let enloggen = new Uint32Array(logEntries); for (let i = 0; i < logEntries; i++) { enloggen[i] = toFixed(Math.log2(i)); - if (enloggen[i] > 65535) { + if (enloggen[i] > powEntries) { throw new Error('enloggen entry out of range') } } @@ -41,7 +41,7 @@ for (let i = 0; i < logEntries; i++) { let empower = new Uint16Array(powCount); for (let i = 0; i < powCount; i++) { empower[i] = Math.round(2 ** toFloat(i << reduction)); - if (empower[i] > 65535) { + if (empower[i] > (logEntries * logEntries)) { throw new Error('empower entry out of range') } }