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

round coverage percantage down #30

Closed
wants to merge 1 commit into from
Closed

round coverage percantage down #30

wants to merge 1 commit into from

Conversation

TomasVotruba
Copy link
Owner

@TomasVotruba TomasVotruba commented Mar 15, 2024

Ref #29

$relative = 100 * ($this->getTypedCount() / $this->totalCount);

// round down, to make error message clear that required value is not reached yet
return round($relative, 1, PHP_ROUND_HALF_DOWN);
Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately this does not work. PHP_ROUND_HALF_DOWN only affects what happens when the last digit is 5 which will be rounded down. You can use instead:

        return floor($relative * 10) / 10;

(I confirmed this works fine)

@TomasVotruba
Copy link
Owner Author

Surpassed by #31

@TomasVotruba TomasVotruba deleted the tv-round-down branch March 15, 2024 19:23
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.

2 participants