Skip to content

Commit

Permalink
adding check for infinity when converting to hex
Browse files Browse the repository at this point in the history
  • Loading branch information
roeming committed Dec 2, 2024
1 parent e4b22a7 commit 683c2a7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ const OPERATOR_TOKEN_TO_VALUEWRAPPER = makeEnum_V(ALL_OPERATORS.map((e)=>[e.toke


const formatNumber = (val) =>{
if (document.getElementById("HexCheck").checked)
if (Number.isFinite(val) && document.getElementById("HexCheck").checked)
{
let newVal = Math.abs(val).toString(16).toUpperCase();
return (val < 0 ? "-0x" : "0x") + newVal;
Expand Down

0 comments on commit 683c2a7

Please sign in to comment.