VirtualBox

Changeset 97280 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
Oct 24, 2022 2:48:24 PM (2 years ago)
Author:
vboxsync
Message:

ValKit/analysis: Percent formatting improvement.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/analysis/reporting.py

    r97279 r97280  
    282282        if rdPct >= 100:
    283283            return '%s%s%%' % (chSign, utils.formatNumber(int(rdPct + 0.5)),);
    284         if rdPct * 100 + 0.5 >= 1:
    285             return '%s%.*f%%' % (chSign, cPctPrecision, rdPct + 0.005,);
     284        if round(rdPct, cPctPrecision) != 0:
     285            return '%s%.*f%%' % (chSign, cPctPrecision, rdPct,); # %.*f rounds.
    286286        return '~' + chSign + '0.' + '0' * cPctPrecision + '%';
    287287
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette