You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "shu kai yuan (JIRA)" <ji...@apache.org> on 2010/01/13 15:37:54 UTC

[jira] Created: (IO-226) question with byteCountToDisplaySize(long size)

question with byteCountToDisplaySize(long size)
-----------------------------------------------

                 Key: IO-226
                 URL: https://issues.apache.org/jira/browse/IO-226
             Project: Commons IO
          Issue Type: Bug
          Components: Utilities
            Reporter: shu kai yuan


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.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (IO-226) question with byteCountToDisplaySize(long size)

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated IO-226:
--------------------

    Issue Type: Improvement  (was: Bug)

Not really a bug anymore

> 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
>
> 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (IO-226) question with byteCountToDisplaySize(long size)

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12841633#action_12841633 ] 

Sebb commented on IO-226:
-------------------------

The size is currently rounded down, so it can lose precision.

However, even if it were rounded to the nearest boundary it would still lose some precision.

In order to avoid loss of precision it would have to display the value 2047 as 1.9990234375KB which is not very readable.

For the time being, I have updated the Javadoc to note that the value is rounded down:

URL: http://svn.apache.org/viewvc?rev=919253&view=rev
Log:
IO-226 - document rounding behaviour

> question with byteCountToDisplaySize(long size)
> -----------------------------------------------
>
>                 Key: IO-226
>                 URL: https://issues.apache.org/jira/browse/IO-226
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>            Reporter: shu kai yuan
>
> 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (IO-226) question with byteCountToDisplaySize(long size)

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton resolved IO-226.
--------------------------------

    Fix Version/s: 2.0
       Resolution: Fixed

> 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.
-
You can reply to this email to add a comment to the issue online.