Good morning!

We got a question from a user:

        On the following URL [redacted], there is a description of the files, 
        namely the size that is expressed in MB.  I'd like to know if that 
        size is calculated using base 10 or base 2 mathematics.  

Digging into the code, I find this comment for org/dspace/app/util/Util.java

        /**
          * Formats the file size. Examples:
          *
          *  - 50 = 50B
          *  - 1024 = 1KB
          *  - 1,024,000 = 1MB etc
          *
          *  The numbers are formatted using java Locales
          *
          * @param in The number to covnert
          * @return the file size as a String
          */
        public static String formatFileSize(double in) {

That's some some funky math! it divides bytes by 1,024,000 to get MB, and 
1,024,000,000 to get GB. So it's neither base 2 math nor base 10, but a 
combination of both. 

Can anyone make a strong argument for requesting this be changed to either pure 
base 10 math (divide by 1,000,000 to Mebibytes / MiB) or pure base 2 (divide by 
1,048,576 to get Megabytes / MB). I prefer the latter, myself.

--Joel

Joel Richard
IT Specialist, Web Services Department
Smithsonian Institution Libraries | http://www.sil.si.edu/
(202) 633-1706 | [email protected]





------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Dspace-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-general

Reply via email to