definitely too long :D

This commit is contained in:
Brooke Vibber 2023-01-07 18:37:55 -08:00
parent fe23193ce9
commit badc730f2b

View file

@ -55,10 +55,14 @@ function log2(val) {
// returns rounded integer
function pow2(fixed) {
let n = fixed >> reduction;
if (empower[n] == undefined) {
console.log(`float ${toFloat(fixed)} fixed ${fixed} n ${n} max ${empower.length}`);
if (n >= empower.length) {
/*
console.log(`ERROR float ${toFloat(fixed)} fixed ${fixed} n ${n} max ${empower.length}`);
//throw new Error('whoops');
throw new Error('whoops');
*/
// Overflow? Round down.
return empower[empower.length - 1];
}
return empower[n];
}
@ -76,6 +80,7 @@ function mul(a, b) {
return pow2(la + lb);
}
/*
for (let i = 0; i < logEntries; i++) {
let l = log2(i);
let p = pow2(l);
@ -92,7 +97,7 @@ for (let i = 0; i < powEntries; i++) {
let val = pow2(fixed);
console.log(`${i} ${fixed} ${float} ${val}`)
}
*/
// now just try multipling numbers
let deltas = 0;