IEE754 conversion utils

This commit is contained in:
Tim Olson
2023-12-02 21:46:23 -04:00
parent e25239d81f
commit 9797632ac6

View File

@@ -9,3 +9,15 @@ export function applyFills( orderStatus, filled ) {
} }
// console.log('applied fills', orderStatus) // console.log('applied fills', orderStatus)
} }
export function encodeIEE754(value) {
const buffer = new ArrayBuffer(2);
new DataView(buffer).setFloat32(0, value, false /* big endian */);
return buffer;
}
export function decodeIEE754(buffer) {
return new DataView(buffer).getFloat32(0, false);
}