This is an archive of the discontinued Mercurial Phabricator instance.

churn: remove redundant round()
ClosedPublic

Authored by durin42 on Oct 13 2018, 9:48 AM.

Details

Summary

To my surprise, the int() is required.

Spotted by Mads when he reviewed D5063. Thanks!

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

durin42 created this revision.Oct 13 2018, 9:48 AM
pulkit accepted this revision.Oct 13 2018, 9:49 AM
pulkit requested changes to this revision.Oct 13 2018, 10:02 AM
This revision now requires changes to proceed.Oct 13 2018, 10:02 AM
durin42 edited the summary of this revision. (Show Details)Oct 13 2018, 10:19 AM
durin42 retitled this revision from churn: remove redundant int() and round() to churn: remove redundant round().
durin42 updated this revision to Diff 12090.
pulkit accepted this revision.Oct 13 2018, 10:31 AM
This revision was automatically updated to reflect the committed changes.
yuja added a subscriber: yuja.Oct 13 2018, 11:38 AM
def charnum(count):
  • return int(round(count * width // maxcount))

+ return int(count * width // maxcount)

We're doing floating-point division as maxcount is float.