// Modified from https://github.com/bartaz/ieee754-visualization/ // under the MIT license // Copyright 2013 Bartek Szopka (original author) /** * Returns the ieee-574 8 bytes composing the given double, starting from the * sign bit and ending in the lsb of the significand. * e.g. 123.456 -> [64, 94, 221, 47, 26, 159, 190, 119] */ function doubleToOctets(number: number) { const buffer = new ArrayBuffer(8); new DataView(buffer).setFloat64(0, number, false); return Array.from(new Uint8Array(buffer)); } export { doubleToOctets }