Fixed scientific convention issue in image size #4459
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #3091
In this code
HumanSizeWithPrecision()
method is used.This method takes two parameters
size
andprecision
.- Here is what I did:
I tried to reproduce the bug with this code.
And this resulted in
1e+03MB
being output.So I changed precision from
3
to4
like the following.And this gave me
999.9MB
output.In conclusion, this unexpected scientific convention results when we use precision
3
.In go-unit library the
HumanSize()
method usesHumanSizeWithPrecision(size, 4)
method under the hood, So I usedHumanSize()
instead of usingHumanSizeWithPrecision()
.- Description for the changelog
Replaced HumanSizeWithPrecision() with HumanSize().
- A picture of a cute animal (not mandatory but encouraged)
