Tweaked scripts to render new entry ratios as +∞%

We already rely on this symbol in these scripts, so might use it to
display the mathematically correct ratio for new entries.

This has the added benefit of ordering new entries vs extremely big
changes correctly:

  $ ./scripts/code.py -u test.after.csv -d test.before.csv
  function (1 added, 0 removed)      osize    nsize    dsize
  test_a                                 -       49      +49 (+∞%)
  test_b                                19      719     +700 (+3684.2%)
  test_c                                91      191     +100 (+109.9%)
  TOTAL                                110      959     +849 (+771.8%)
This commit is contained in:
Christopher Haster
2024-06-02 14:57:32 -05:00
parent 06bfed7a8b
commit 169952dec0
8 changed files with 8 additions and 8 deletions

View File

@@ -90,7 +90,7 @@ class RInt(co.namedtuple('RInt', 'x')):
elif not old and not new:
return 0.0
elif not old:
return 1.0
return +m.inf
else:
return (new-old) / old