-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory Capacity formating error #367
Comments
Problematic values are between 1000 and 1024, in my example it was 1023.185546875. Formatter uses %.3G, expects three digits and therefore fails for values > 999. 1024 should be fine, I guess your capacity is slightly lower than 1 TiB (IEC/binary prefix). You can verify this by temporarily modifying + return sprintf('%s%.3G %s', $sign, $result, $units[$pow]);
- return sprintf('%s%s %s', $sign, $result, $units[$pow]); |
Yes, they are betweeen 1019 and 1023
|
This should also do the trick: - $pow = floor(log($value, $base));
+ $pow = floor(log($value, 1000)); However, you then get 0.987 (or 0,987, depending on your localization) - and I want to see 0.99 in this case (not more then three characters, ignoring the dot/comma) |
Should be fixed now. Related commit 880e091 deals with values between 0 and 1, which (as we're talking about Bytes) in theory should not occur. But who knows, there might be rounding errors when calculating free space. So I addressed that one too, just to be on the safe side. Thanks for reporting this! |
Expected Behavior
Capacity: 1.00 TiB
Current Behavior
Capacity: 1.02E+3 GiB
Possible Solution
Probably some rounding error since machines with 2 TiB produce
Capacity: 1.99 TiB
Steps to Reproduce (for bugs)
Well, have a machine with 1TiB
Or 1023 GiB perhaps!?
And go to the host-page.
Your Environment
The text was updated successfully, but these errors were encountered: