mirror of
https://github.com/NotAShelf/nix-evaluator-stats.git
synced 2026-04-29 05:15:21 +00:00
various: eliminate floating-point noise before displaying
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ic14f4c0a9e0bcbe3460bbecc670f713d6a6a6964
This commit is contained in:
parent
6102e75a9e
commit
d26a70dacd
3 changed files with 16 additions and 6 deletions
|
|
@ -303,7 +303,13 @@ const ComparisonView: Component<ComparisonViewProps> = props => {
|
|||
<Show when={!row.isReduction}>
|
||||
<ArrowUpIcon size={14} />
|
||||
</Show>
|
||||
{Math.abs(row.change).toFixed(prec())}%
|
||||
{parseFloat(
|
||||
(
|
||||
Math.round(Math.abs(row.change) * Math.pow(10, prec())) /
|
||||
Math.pow(10, prec())
|
||||
).toFixed(prec()),
|
||||
)}
|
||||
%
|
||||
</span>
|
||||
</Show>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,10 @@ const ThunkChart: Component<ThunkChartProps> = props => {
|
|||
<div class="ratio-bar">
|
||||
<div class="ratio-fill" style={{ width: `${avoidedRatio() * 100}%` }} />
|
||||
</div>
|
||||
<span class="ratio-label">Avoidance rate: {(avoidedRatio() * 100).toFixed(prec())}%</span>
|
||||
<span class="ratio-label">
|
||||
Avoidance rate:{' '}
|
||||
{Math.round(avoidedRatio() * 100 * Math.pow(10, prec())) / Math.pow(10, prec())}%
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue