Skip to content

Commit

Permalink
Small cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderOMara committed Nov 16, 2024
1 parent c96c001 commit e5348bb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions f16.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ export function getFloat16(
littleEndian = false,
): number {
let m = dataView.getUint16(offset, littleEndian);
const s = m >> 8;
let s = m >> 8;
let e = s & 127;
s >>= 7;
m = (e & 3) * 256 + (m & 255);
if ((e >>= 2) === 31) {
m = m ? NaN : Infinity;
} else {
if (e) {
m += 1024;
e--;
}
m *= 2 ** (e - 24);
return m ? NaN : (s ? -Infinity : Infinity);
}
if (e) {
m += 1024;
e--;
}
return (s >> 7) ? -m : m;
m *= 2 ** (e - 24);
return s ? -m : m;
}

/**
Expand Down

0 comments on commit e5348bb

Please sign in to comment.