Skip to content

Commit

Permalink
Update powers-of-2.html
Browse files Browse the repository at this point in the history
  • Loading branch information
mcnole25 authored Sep 6, 2024
1 parent 4d40e51 commit 2346a67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions powers-of-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
</head>
<body>
<h1>Powers of 2 Calculator</h1>
<p>Calculate powers of 2 within seconds. Supports negative exponents, uses floating point numbers and BigInt.</p>
<p>Calculate powers of 2 within seconds. Supports negative exponents, uses floating point numbers, and BigInt.</p>
<span>x = </span><input type="number" id="exponent" value=0>
<span id="powerOf"></span><br>
<textarea id="result"></textarea>
<script>
setInterval(function() {
exponent.value = exponent.value.replaceAll(".", "")
if (Number(exponent.value) < -100) {exponent.value = -100;}
if (Number(exponent.value) > 1024) {exponent.value = 1024;}
if (Number(exponent.value) > 1500) {exponent.value = 1500;}
let x = Number(exponent.value);
if (x < 0) {
powerOf.innerHTML = "2<sup>" + x + "</sup> (" + -x + " decimal place/s)";
Expand Down

0 comments on commit 2346a67

Please sign in to comment.