@@ -4334,7 +4334,7 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.toggle-button {
43344334 border-radius: 4px;
43354335} */
43364336
4337- .high-error .accuracy-col {
4337+ .high-error .accuracy-col span {
43384338 font-weight: 500;
43394339 color: #b91c1c; /* Keep the red tone */
43404340 background-color: #fdf2f2; /* Very subtle pink background */
@@ -4352,10 +4352,11 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.toggle-button {
43524352
43534353.local-error td:not(.program-col), th:not(.program-col) {
43544354 text-align: right;
4355+ padding-left: 10px;
43554356}
43564357
43574358.local-error table {
4358- border-spacing: 10px 0px;
4359+ border-spacing: 0px 0px;
43594360}
43604361
43614362.local-error td {
@@ -4369,7 +4370,15 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.toggle-button {
43694370
43704371.no-explanations .explanation {
43714372 display: none;
4372- }`, "",{"version":3,"sources":["webpack://./src/herbie/LocalError/newLocalError.css"],"names":[],"mappings":"AAAA;EACE,gBAAgB;EAChB,YAAY;EACZ,eAAe;EACf,iBAAiB;EACjB,eAAe;AACjB;;AAEA;;;GAGG;;AAEH;EACE,gBAAgB;EAChB,cAAc,cAAc,sBAAsB;EAClD,yBAAyB,GAAG,gCAAgC;EAC5D,kBAAkB;EAClB,gBAAgB;AAClB;;AAEA;EACE,mBAAmB;EACnB,gBAAgB;EAChB,cAAc;EACd,gBAAgB;EAChB,gBAAgB;AAClB;;AAEA;IACI,iBAAiB;AACrB;;AAEA;EACE,wBAAwB;AAC1B;;AAEA;EACE,+BAA+B;EAC/B,WAAW;AACb;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,aAAa;AACf","sourcesContent":[".toggle-button {\n background: none;\n border: none;\n cursor: pointer;\n margin-right: 5px;\n font-size: 14px;\n}\n\n/* .local-error {\n padding: 2px 6px;\n border-radius: 4px;\n} */\n\n.high-error .accuracy-col {\n font-weight: 500;\n color: #b91c1c; /* Keep the red tone */\n background-color: #fdf2f2; /* Very subtle pink background */\n border-radius: 3px;\n padding: 2px 4px;\n}\n\n.program-col {\n white-space: nowrap;\n overflow-x: auto;\n display: block;\n text-align: left;\n max-width: 200px;\n}\n\n.local-error td:not(.program-col), th:not(.program-col) {\n text-align: right;\n}\n\n.local-error table {\n border-spacing: 10px 0px;\n}\n\n.local-error td {\n font-family: 'Ruda', sans-serif;\n color: gray;\n}\n\n.has-error td {\n color: black;\n}\n\n.no-explanations .explanation {\n display: none;\n}"],"sourceRoot":""}]);
4373+ }
4374+
4375+ /* slightly darken the hovered row */
4376+ .local-error tbody tr:hover {
4377+ background-color: #f3f4f6; /* Light gray background on hover */
4378+ border-radius: 5px;
4379+ transition: background-color 0.2s ease;
4380+ }
4381+ `, "",{"version":3,"sources":["webpack://./src/herbie/LocalError/newLocalError.css"],"names":[],"mappings":"AAAA;EACE,gBAAgB;EAChB,YAAY;EACZ,eAAe;EACf,iBAAiB;EACjB,eAAe;AACjB;;AAEA;;;GAGG;;AAEH;EACE,gBAAgB;EAChB,cAAc,cAAc,sBAAsB;EAClD,yBAAyB,GAAG,gCAAgC;EAC5D,kBAAkB;EAClB,gBAAgB;AAClB;;AAEA;EACE,mBAAmB;EACnB,gBAAgB;EAChB,cAAc;EACd,gBAAgB;EAChB,gBAAgB;AAClB;;AAEA;IACI,iBAAiB;IACjB,kBAAkB;AACtB;;AAEA;EACE,uBAAuB;AACzB;;AAEA;EACE,+BAA+B;EAC/B,WAAW;AACb;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,aAAa;AACf;;AAEA,oCAAoC;AACpC;EACE,yBAAyB,EAAE,mCAAmC;EAC9D,kBAAkB;EAClB,sCAAsC;AACxC","sourcesContent":[".toggle-button {\n background: none;\n border: none;\n cursor: pointer;\n margin-right: 5px;\n font-size: 14px;\n}\n\n/* .local-error {\n padding: 2px 6px;\n border-radius: 4px;\n} */\n\n.high-error .accuracy-col span {\n font-weight: 500;\n color: #b91c1c; /* Keep the red tone */\n background-color: #fdf2f2; /* Very subtle pink background */\n border-radius: 3px;\n padding: 2px 4px;\n}\n\n.program-col {\n white-space: nowrap;\n overflow-x: auto;\n display: block;\n text-align: left;\n max-width: 200px;\n}\n\n.local-error td:not(.program-col), th:not(.program-col) {\n text-align: right;\n padding-left: 10px;\n}\n\n.local-error table {\n border-spacing: 0px 0px;\n}\n\n.local-error td {\n font-family: 'Ruda', sans-serif;\n color: gray;\n}\n\n.has-error td {\n color: black;\n}\n\n.no-explanations .explanation {\n display: none;\n}\n\n/* slightly darken the hovered row */\n.local-error tbody tr:hover {\n background-color: #f3f4f6; /* Light gray background on hover */\n border-radius: 5px;\n transition: background-color 0.2s ease;\n}\n"],"sourceRoot":""}]);
43734382// Exports
43744383/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
43754384
@@ -205528,25 +205537,27 @@ function findAllErrorPaths(node, path = []) {
205528205537function shouldExpand(currentPath, allErrorPaths) {
205529205538 return allErrorPaths.some(errorPath => currentPath.every((val, index) => errorPath[index] === val));
205530205539}
205540+ let valueId = 0;
205531205541function TreeRow({ node, depth, currentPath, errorPaths, }) {
205532205542 const [isExpanded, setIsExpanded] = (0, react_1.useState)(() => shouldExpand(currentPath, errorPaths));
205533205543 const collapsedExpression = formatExpression(node);
205534205544 function renderValue(value) {
205535205545 if (value === "true" || value === "false") {
205536205546 return value;
205537205547 }
205548+ valueId += 1;
205538205549 const num = parseFloat(value);
205539205550 if (isNaN(num)) {
205540205551 return value;
205541205552 }
205542- return herbiejs.displayNumber(num);
205553+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "number-value", "data-tooltip-id": `value-tooltip-${valueId}`, children: herbiejs.displayNumber(num) }), (0, jsx_runtime_1.jsx)(react_tooltip_1.Tooltip, { id: `value-tooltip-${valueId}`, children: num.toString() })] } );
205543205554 }
205544205555 const isHighError = parseFloat(node["percent-accuracy"]) < 50;
205545205556 const hasError = parseFloat(node["percent-accuracy"]) < 99.9;
205546205557 const rowClassName = isHighError ? "has-error high-error" : hasError ? "has-error" : "";
205547205558 return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("tr", { className: rowClassName, children: [(0, jsx_runtime_1.jsx)("td", { className: "program-col", children: (0, jsx_runtime_1.jsxs)("span", { style: { marginLeft: `0px`, cursor: "pointer" }, onClick: () => setIsExpanded(prev => !prev), children: [depth > 0 && ((0, jsx_runtime_1.jsx)("span", { className: "pipe-lines", style: { marginRight: '5px' }, children: Array(depth).fill(null).map((_, i) => ((0, jsx_runtime_1.jsx)("span", { className: "pipe-line", style: { height: '20px', borderLeft: '1px solid gray', marginLeft: `${7.5 + (i > 0 ? 5 : 0)}px` } }, i))) })), node.children.length > 0 ? ((0, jsx_runtime_1.jsx)("span", { className: "toggle-button", children: isExpanded ? ((0, jsx_runtime_1.jsx)("svg", { style: { width: '15px', stroke: "var(--action-color)", transform: "rotate(180deg)", verticalAlign: "middle" }, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M6 9L12 15L18 9", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })) : ((0, jsx_runtime_1.jsx)("svg", { style: { width: '15px', stroke: "var(--action-color)", verticalAlign: "middle" }, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M6 9L12 15L18 9", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })) })) : ((0, jsx_runtime_1.jsx)("span", { style: { width: '3px', display: 'inline-block' } })), (0, jsx_runtime_1.jsx)("div", { style: {
205548205559 display: "inline-block",
205549- }, children: isExpanded ? mapOp(node.e) : collapsedExpression })] }) }), (0, jsx_runtime_1.jsx)("td", { children: renderValue(node["actual -value"]) }), (0, jsx_runtime_1.jsx)("td", { children: renderValue(node["exact -value"]) }), (0, jsx_runtime_1.jsx)("td", { children: renderValue(node["abs-error-difference"]) }), (0, jsx_runtime_1.jsxs )("td", { className: "accuracy-col", children: [parseFloat(node["percent-accuracy"]).toFixed(1), "%"] }), (0, jsx_runtime_1.jsx)("td", { className: "explanation", children: node.explanation ?
205560+ }, children: isExpanded ? mapOp(node.e) : collapsedExpression })] }) }), (0, jsx_runtime_1.jsx)("td", { children: renderValue(node["exact -value"]) }), (0, jsx_runtime_1.jsx)("td", { children: renderValue(node["actual -value"]) }), (0, jsx_runtime_1.jsx)("td", { children: renderValue(node["abs-error-difference"]) }), (0, jsx_runtime_1.jsx )("td", { className: "accuracy-col", children: (0, jsx_runtime_1.jsxs)("span", { children: [parseFloat(node["percent-accuracy"]).toFixed(1), "%"] }) }), (0, jsx_runtime_1.jsx)("td", { className: "explanation", children: node.explanation ?
205550205561 node.explanation === "cancellation" ? ((0, jsx_runtime_1.jsx)("a", { href: "https://en.wikipedia.org/wiki/Catastrophic_cancellation", target: "_blank", rel: "noopener noreferrer", children: (0, jsx_runtime_1.jsx)("span", { className: "explanation-link", title: "Click for more information about this error type", children: node.explanation }) })) :
205551205562 node.explanation === "oflow-rescue" ? ((0, jsx_runtime_1.jsx)("a", { href: "https://en.wikipedia.org/wiki/Floating-point_arithmetic#:~:text=including%20the%20zeros.-,overflow,-%2C%20set%20if%20the", target: "_blank", rel: "noopener noreferrer", children: (0, jsx_runtime_1.jsx)("span", { className: "explanation-link", title: "Click for more information about this error type", children: node.explanation }) })) :
205552205563 // TODO handle other explanations
@@ -205599,7 +205610,7 @@ function NewLocalError({ expressionId }) {
205599205610 }, (node) => node.children);
205600205611 const hasNoExplanations = explanationPaths.length === 0;
205601205612 // InfoIcon component for consistent tooltips
205602- const InfoIcon = ({ tooltipId, tooltipContent }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { "data-tooltip-id": tooltipId, "data-tooltip-content": tooltipContent, style: { marginLeft: '4px', cursor: 'help', color: 'var(--action-color)' }, children: (0, jsx_runtime_1.jsxs)("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "currentColor", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "2", fill: "none" }), (0, jsx_runtime_1.jsx)("text", { x: "12", y: "16", textAnchor: "middle", fontSize: "12", fontWeight: "bold", children: "? " })] }) }), (0, jsx_runtime_1.jsx)(react_tooltip_1.Tooltip, { id: tooltipId })] }));
205613+ const InfoIcon = ({ tooltipId, tooltipContent }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { "data-tooltip-id": tooltipId, "data-tooltip-content": tooltipContent, style: { marginLeft: '4px', cursor: 'help', color: 'var(--action-color)' }, children: (0, jsx_runtime_1.jsxs)("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "currentColor", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "2", fill: "none" }), (0, jsx_runtime_1.jsx)("text", { x: "12", y: "16", textAnchor: "middle", fontSize: "12", fontWeight: "bold", children: "i " })] }) }), (0, jsx_runtime_1.jsx)(react_tooltip_1.Tooltip, { id: tooltipId })] }));
205603205614 return ((0, jsx_runtime_1.jsx)("div", { className: `local-error ${hasNoExplanations ? ' no-explanations' : ''}`, children: (0, jsx_runtime_1.jsxs)("table", { children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("th", { className: "program-col", children: "Program" }), (0, jsx_runtime_1.jsxs)("th", { children: ["R Value", (0, jsx_runtime_1.jsx)(InfoIcon, { tooltipId: "r-value-tooltip", tooltipContent: "The exact value computed using infinite precision arithmetic" })] }), (0, jsx_runtime_1.jsxs)("th", { children: ["FP Value", (0, jsx_runtime_1.jsx)(InfoIcon, { tooltipId: "fp-value-tooltip", tooltipContent: "The actual computed value using floating-point arithmetic" })] }), (0, jsx_runtime_1.jsxs)("th", { children: ["Difference", (0, jsx_runtime_1.jsx)(InfoIcon, { tooltipId: "difference-tooltip", tooltipContent: "The absolute difference between the exact (R) and floating-point (FP) values" })] }), (0, jsx_runtime_1.jsxs)("th", { children: ["Accuracy", (0, jsx_runtime_1.jsx)(InfoIcon, { tooltipId: "accuracy-tooltip", tooltipContent: "Percentage accuracy of the floating-point computation compared to the exact result" })] }), (0, jsx_runtime_1.jsxs)("th", { className: "explanation", children: ["Explanation", (0, jsx_runtime_1.jsx)(InfoIcon, { tooltipId: "explanation-tooltip", tooltipContent: "An explanation code, if there is significant error" })] })] }) }), (0, jsx_runtime_1.jsx)("tbody", { children: (0, jsx_runtime_1.jsx)(TreeRow, { node: localErrorWithExplanations, depth: 0, currentPath: [], errorPaths: errorPaths }) })] }) }));
205604205615}
205605205616exports["default"] = NewLocalError;
0 commit comments