Skip to content

Fixed default number format#1114

Merged
clairernovotny merged 4 commits intoHumanizr:mainfrom
YohDeadfall:fix-default-number-format
Oct 29, 2021
Merged

Fixed default number format#1114
clairernovotny merged 4 commits intoHumanizr:mainfrom
YohDeadfall:fix-default-number-format

Conversation

@YohDeadfall
Copy link
Contributor

This PR fixes an issue happening only when ToString() is invoked on a ByteSize. Since parameterless ToString is optimized and doesn't invoke ToString(string format) it uses {0} {1} to create an output string, but this format has no information on how a value should be displayed and prints a number with high precision.

@YohDeadfall
Copy link
Contributor Author

Hello, @clairernovotny! Could you take a look at this PR and clarify its status?

@clairernovotny clairernovotny merged commit aea2bf9 into Humanizr:main Oct 29, 2021
@YohDeadfall YohDeadfall deleted the fix-default-number-format branch October 29, 2021 12:50
@clairernovotny
Copy link
Member

@YohDeadfall
Copy link
Contributor Author

Will take a look.


[Theory]
[InlineData(19854651984, 1, TimeUnit.Second, null, "18.4910856038332 GB/s")]
[InlineData(19854651984, 1, TimeUnit.Second, null, "18.49 GB/s")]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird. This line isn't present in main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants