Skip to content

Commit 3deaca7

Browse files
committed
Local error style fixes
1 parent f1d6d43 commit 3deaca7

File tree

2 files changed

+33
-19
lines changed

2 files changed

+33
-19
lines changed

src/herbie/LocalError/newLocalError.css

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,36 @@
1111
border-radius: 4px;
1212
} */
1313

14-
.high-error {
15-
background-color: rgba(255, 0, 0, 0.2); /* Light red for high errors */
16-
color: red;
14+
.high-error .accuracy-col {
15+
font-weight: 500;
16+
color: #b91c1c; /* Keep the red tone */
17+
background-color: #fdf2f2; /* Very subtle pink background */
18+
border-radius: 3px;
19+
padding: 2px 4px;
1720
}
1821

1922
.program-col {
2023
white-space: nowrap;
21-
padding-right: 50px;
2224
overflow-x: auto;
2325
display: block;
24-
}
25-
26-
.emphasize-diff {
27-
font-weight: 500;
28-
color: #b91c1c; /* Keep the red tone */
29-
background-color: #fdf2f2; /* Very subtle pink background */
30-
border-radius: 3px;
31-
padding: 2px 4px;
26+
text-align: left;
27+
max-width: 300px;
3228
}
3329

3430
.local-error td:not(.program-col) {
3531
text-align: right;
36-
}
32+
}
33+
34+
.local-error table {
35+
border-spacing: 10px 0px;
36+
}
37+
38+
.local-error td {
39+
font-family: 'Ruda', sans-serif;
40+
color: gray;
41+
}
42+
43+
.has-error td {
44+
color: black;
45+
}
46+

src/herbie/LocalError/newLocalError.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,14 @@ function TreeRow({
8686
return herbiejs.displayNumber(num);
8787
}
8888

89+
const isHighError = parseFloat(node["percent-accuracy"]) < 50;
90+
const hasError = parseFloat(node["percent-accuracy"]) < 99.9;
91+
92+
const rowClassName = isHighError ? "has-error high-error" : hasError ? "has-error" : "";
93+
8994
return (
9095
<>
91-
<tr>
96+
<tr className={ rowClassName }>
9297
<td className="border px-4 py-2 program-col">
9398
<span
9499
style={{ marginLeft: `${depth * 15}px`, cursor: "pointer" }}
@@ -123,14 +128,14 @@ function TreeRow({
123128
<td>{renderValue(node["actual-value"])}</td>
124129
<td>{renderValue(node["exact-value"])}</td>
125130
<td>{renderValue(node["abs-error-difference"])}</td>
126-
<td>
131+
<td className="accuracy-col">
127132
{parseFloat(node["percent-accuracy"]).toFixed(1)}%
128133
</td>
129-
<td>
130-
<span className={`${parseFloat(node["percent-accuracy"]) < 100 ? "high-error" : ""}`}>
134+
{/* <td>
135+
<span >
131136
{parseFloat(node["ulps-error"]).toFixed(1)}
132137
</span>
133-
</td>
138+
</td> */}
134139
</tr>
135140

136141
{isExpanded &&
@@ -185,7 +190,6 @@ function NewLocalError({ expressionId }: { expressionId: number }) {
185190
Difference
186191
</th>
187192
<th>Accuracy</th>
188-
<th>Local Error</th>
189193
</tr>
190194
</thead>
191195
<tbody>

0 commit comments

Comments
 (0)