Skip to content

Fix dividing by zero#14

Merged
henrypp merged 2 commits into
henrypp:masterfrom
XakerTwo:fix_div0
Mar 5, 2025
Merged

Fix dividing by zero#14
henrypp merged 2 commits into
henrypp:masterfrom
XakerTwo:fix_div0

Conversation

@XakerTwo

Copy link
Copy Markdown
Contributor

Lead to issue mentioned in henrypp/memreduct#262 henrypp/memreduct#263
Also slightly optimized math for memory percentages

This is a cumulative PR, includes #13

-nan(ind) is not a way to display zero, it's a result of dividing by zero and this is a crash for int
check is only for virtual memory (its amount can be controlled by user)
physical memory can't be zero (then how you even run this)
not sure about system_cache

also optimized math for memory percentages
percent_f calculated first, then it converts to int percent
@henrypp henrypp merged commit 7570616 into henrypp:master Mar 5, 2025
@XakerTwo XakerTwo deleted the fix_div0 branch November 14, 2025 13:51
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