[
https://issues.apache.org/jira/browse/IO-876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18014009#comment-18014009
]
Gary D. Gregory commented on IO-876:
------------------------------------
Hello [~singingbush]
Thank you for your report.
Make sure to evaluate your report against the current version: 2.20.0. Version
2.8.0 is pretty old... ;)
Then, feel free to create a pull request on GitHub or discuss it on the mailing
list.
TY!
> FileUtils.byteCountToDisplaySize returns incorrect values
> ---------------------------------------------------------
>
> Key: IO-876
> URL: https://issues.apache.org/jira/browse/IO-876
> Project: Commons IO
> Issue Type: Bug
> Affects Versions: 2.8.0
> Reporter: Samael Bate
> Priority: Major
>
> I get that there can be discrepancies depending on whether discussing GB or
> GiB but as commons-io has a constant for {{FileUtils.ONE_GB}} which is
> 1,073,741,824 I can presume that the value being returned by
> FileUtils.byteCountToDisplaySize should actually be an accurate GiB value,
> despite the text being just GB.
> So there's two problems here, the text saying MG, GB, etc should probably be
> formatted with the more correct text post-fixed (MiB, GiB, etc).
> However my main issue is that either way the results are just wrong. This
> seems to be caused by the function simply dropping the fractional digits
> rather than using any decimal places or rounding.
> For example 1.9 GB will get returned by this function as "1 GB":
> {code:java}
> FileUtils.byteCountToDisplaySize(2018148352L) // returns "1 GB" but is only
> just a little short of 2 GB{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)