I have a binary file containing 4-byte floats. I want to print these floats using od
. However, od
prints one additional value at the very first position. What is going on here?
The file looks like this:
xxd test | head -1
0000000: 932a 6541 7cdf 6b41 6c7e 7141 d779 7641 .*eA|.kAl~qA.yvA
od
prints this:
cat test | od -f -An -v -w4 | head -2
14,322894 14,742062
The first printed value (14.32) is not the first value in the file. The second printed value (14.74) is the actual first value from the file. I verified with several hex editors that
932a 6541
is 14.74206 (or a value very close to that). So where is od
getting the extra value (14.32) from? This also happens when all other options are omitted:
cat test | od -f | head -2
0000000 14,322894 14,742062 15,093365 15,404746
0000020 15,652825 15,938543 16,25734 16,616056
echo 932a65417cdf6b416c7e7141 | xxd -r -p | od -f
– Andreas Unterweger Mar 01 '16 at 10:41echo 932a6541 | xxd -r -p | od -f -
gives just the number 1,4322894e+01 when using a POSIX compliantod
. – schily Mar 01 '16 at 12:39