[ 
https://issues.apache.org/jira/browse/IO-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13079442#comment-13079442
 ] 

Yury Kats edited comment on IO-226 at 8/4/11 4:18 PM:
------------------------------------------------------

What is the reason for rounding down?

bq. it would have to display the value 2047 as 1.9990234375KB which is not very 
readable.

This can easily be turned into "1.9" (or "1.99"), which is readable and way 
more accurate.

Because of the current behaviour, any project I've been on ends up writing its 
own byteCountToDisplaySize method and not using FileUtils.
Who needs a method that returns "1 GB" for a 1.99GB file?

      was (Author: ykats):
    What is the reason for rounding down?

.bq. it would have to display the value 2047 as 1.9990234375KB which is not 
very readable.

This can easily be turned into "1.9" (or "1.99"), which is readable and way 
more accurate.

Because of the current behaviour, any project I've been on ends up writing its 
own byteCountToDisplaySize method and not using FileUtils.
Who needs a method that returns "1 GB" for a 1.99GB file?
  
> question with byteCountToDisplaySize(long size)
> -----------------------------------------------
>
>                 Key: IO-226
>                 URL: https://issues.apache.org/jira/browse/IO-226
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>            Reporter: shu kai yuan
>             Fix For: 2.0
>
>
> I do not understand the byteCountToDisplaySize(long size) method which is in  
> class FileUtils of the package org.apache.commons.io.
> If  the parameter size is 2047 , the method will return 1 KB.Why it will lose 
> precision.
> I read the code. 
> Maybe it is a bug?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to