Skip to content
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

Add tests for Human Readable functionality #1632

Merged
merged 6 commits into from
Jul 14, 2023
Merged

Conversation

dmah42
Copy link
Member

@dmah42 dmah42 commented Jul 14, 2023

also fix an issue where the SI/IEC unit wasn't being correctly passed through.

also fix an issue where the SI/IEC unit wasn't being correctly passed
through.
void AppendHumanReadable(int n, std::string* str) {
std::stringstream ss;
// Round down to the nearest SI prefix.
ss << ToBinaryStringFullySpecified(n, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a question. Why are we not sending Counter::kIs1000? Or will we make this change afterwards?

Copy link
Member Author

Choose a reason for hiding this comment

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

i wanted to get the barest minimal fixes for what's currently in the code before changing behaviour (aside from bug fixes).

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it.

@dmah42 dmah42 marked this pull request as ready for review July 14, 2023 11:30
@dmah42 dmah42 requested a review from LebedevRI July 14, 2023 11:39
src/string_util.cc Outdated Show resolved Hide resolved
@@ -43,8 +43,8 @@ void ToExponentAndMantissa(double val, double thresh, int precision,
// Adjust threshold so that it never excludes things which can't be rendered
// in 'precision' digits.
const double adjusted_threshold =
std::max(thresh, 1.0 / std::pow(10.0, precision));
const double big_threshold = adjusted_threshold * one_k;
std::max(1.0, 1.0 / std::pow(10.0, precision));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Personally, i like that thresh goes away.

LebedevRI
LebedevRI previously approved these changes Jul 14, 2023
Copy link
Collaborator

@LebedevRI LebedevRI left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me?
Thanks.

@dmah42 dmah42 merged commit b1c4a75 into main Jul 14, 2023
@dmah42 dmah42 deleted the add_string_util_tests branch July 14, 2023 12:56
varshneydevansh added a commit to varshneydevansh/benchmark that referenced this pull request Jul 14, 2023
…nto inconsistent_suffixes_console_reporter_1009

(from-  google#1632)
varshneydevansh added a commit to varshneydevansh/benchmark that referenced this pull request Jul 14, 2023
varshneydevansh added a commit to varshneydevansh/benchmark that referenced this pull request Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants