woot this one works but is too huge

This commit is contained in:
Brooke Vibber 2023-01-07 18:33:06 -08:00
parent 7da3993bfd
commit fe23193ce9

View file

@ -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')
}
}