按ieee754标准进行10进制和16进制的互相转换
import { hexIeee754_32ToNum, numToIeee754_32Hex } from "ieee754-hex";
console.log(numToIeee754_32Hex(20.5)); // [ '41', 'A4', '00', '00' ]
console.log(hexIeee754_32ToNum([ '41', 'A4', '00', '00' ])); // 20.5
import { hexIeee754_32ToNum, numToIeee754_32Hex } from "ieee754-hex";
console.log(numToIeee754_32Hex(20.5)); // [ '41', 'A4', '00', '00' ]
console.log(hexIeee754_32ToNum([ '41', 'A4', '00', '00' ])); // 20.5
npm i ieee754-hex
1
1.0.27
ISC
4.47 kB
6