Skip to content

Commit 6c664b2

Browse files
Fix formatting of numbers
Show whole numbers without decimal places, and fractional values to 3 decimal places of precision.
1 parent 6bc280e commit 6c664b2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

site/static/compare.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ <h3>Commits</h3>
8181
let html = "";
8282
if (datum) {
8383
html += "<td>";
84-
let txt = datum.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2});
84+
let txt = "";
85+
if (Number.isInteger(datum)) {
86+
txt = datum + "";
87+
} else {
88+
txt = datum.toLocaleString('en-US', {minimumFractionDigits: 3, maximumFractionDigits: 3});
89+
}
8590
if (selfProfileAvailable) {
8691
html += `<a href="/detailed-query.html?commit=${sha}&benchmark=${bench}&run_name=${run}">${txt}</a>`;
8792
} else {
@@ -103,7 +108,7 @@ <h3>Commits</h3>
103108
}
104109

105110
function add_percent(pct, dodgy, dodgy_marker) {
106-
if (pct && pct != Infinity && pct != -Infinity) {
111+
if (pct != null && pct != Infinity && pct != -Infinity) {
107112
let klass = "";
108113
if (pct > 1) {
109114
klass = 'span class="positive"';

0 commit comments

Comments
 (0)