Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why does storing 7 floating-point numbers need 34 bytes?

I have a file that stores 7 numbers in double. See below. But its size is only 34 bytes. Shouldn’t it be 7*8 = 56 bytes instead?

$ cat data
17.2
18.1
16.5
18.3
12.6
0.75
0.25$ ls -l data
-rw-r--r-- 1 root root 34 Apr 15 03:29 data

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The file contains text representations of the numbers (e.g. written out as digits with a decimal point and a newline separator) rather than as IEEE-754 floating point numbers. The byte count you’re seeing is for the number of characters used, not the number of bytes needed in IEEE-754 format.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading