用lua实现十六进制数和浮点数之间的互转(Little Endian)
-- true: Little Endian; false: Big Endian
print(hexToFloat('C40C5253', true)) => 902157303808.0
print(hexToFloat('C40C5253', false)) => -561.28631591797
print(floatToHex('902157303808.0', true)) => C40C5253
print(floatToHex('-561.28631591797', false)) => C40C5253
2022-09-08 18:06:38
1KB
lua
1