woot this one works but is too huge
This commit is contained in:
parent
7da3993bfd
commit
fe23193ce9
1 changed files with 3 additions and 3 deletions
6
silly.js
6
silly.js
|
@ -4,7 +4,7 @@
|
||||||
let logBits = 8;
|
let logBits = 8;
|
||||||
let logEntries = 2 ** logBits;
|
let logEntries = 2 ** logBits;
|
||||||
|
|
||||||
let powBits = 16;
|
let powBits = 21;
|
||||||
let powEntries = 2 ** powBits;
|
let powEntries = 2 ** powBits;
|
||||||
|
|
||||||
// Room to hold exponents up to 15.9 for 16-bit output
|
// Room to hold exponents up to 15.9 for 16-bit output
|
||||||
|
@ -29,7 +29,7 @@ function toFloat(fixed) {
|
||||||
let enloggen = new Uint32Array(logEntries);
|
let enloggen = new Uint32Array(logEntries);
|
||||||
for (let i = 0; i < logEntries; i++) {
|
for (let i = 0; i < logEntries; i++) {
|
||||||
enloggen[i] = toFixed(Math.log2(i));
|
enloggen[i] = toFixed(Math.log2(i));
|
||||||
if (enloggen[i] > 65535) {
|
if (enloggen[i] > powEntries) {
|
||||||
throw new Error('enloggen entry out of range')
|
throw new Error('enloggen entry out of range')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ for (let i = 0; i < logEntries; i++) {
|
||||||
let empower = new Uint16Array(powCount);
|
let empower = new Uint16Array(powCount);
|
||||||
for (let i = 0; i < powCount; i++) {
|
for (let i = 0; i < powCount; i++) {
|
||||||
empower[i] = Math.round(2 ** toFloat(i << reduction));
|
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')
|
throw new Error('empower entry out of range')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue