Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How lua reads binary files to identify signed numbers and floating-point numbers
How lua reads binary files to identify signed numbers and floating-point numbers
If the selected number of decimal places is 16, multiply it by 65536 (2 16) to realize an integer:

( 1234.3945) 10*(2^ 16) 10=( 1234.3945) 10*(65536) 10=(80897277.952) 10

& gt(80897277) 10 // Remove decimals and keep integers.

=(4d 264 FD) 16 =(0 100 10 10 10 0 1 10 0 100 100 1 1 1 1 1 1 1 165438

( 1 1 12.999) 10*(2^ 16) 10

=( 1 1 12.999) 10*(65536) 10

=(7294 1502.464) 10

& gt (72941502)10//Remove the decimal and keep the integer.

=(458FFBE) 16

=(0 100 0 10 1 1000 1 1 1 1 1 1 1 1 10 1 1 1 1 10)2

Because it was multiplied by 65536, that is, the power of 2 16, when converting to binary, it should be shifted to the right by sixteen bits, and the zeros before and after it should be removed.

That is, (100101000.11165438.

Hope to adopt