xxxxxxxxxx
66
let num;
let x;
let bnum;
let output;
let P;
let p;
function setup() {
createElement("h1", "Convert Your Numbers Into Binary Here!").position(0, 0);
createP("Our converter here, is able to covert numbers as high as nine quadrillion, seven trillion, one hundred and ninety-nine billion, two hundred and fifty-four million, seven hundred and forty thousand and nine hundred and ninety-two, AKA 9007199254740992, AKA 2^53, AKA 100000000000000000000000000000000000000000000000000000 in binary, in the blink of an eye. ANY positive interger below that. is converted with ease on THIS website.");
createElement("br");
P = createP();
num = 16;
x = num;
bnum = 1;
output = "";
for (let i = true; i;) {
if (x >= pow(2, bnum + 1)) {
bnum++;
} else {
i = false;
}
}
if (num < 0) {
num = abs(num);
output += "-"
}
}
function draw() {
if (x >= pow(2, bnum)) {
x -= pow(2, bnum);
output += "1";
} else {
output += "0";
}
bnum--;
p = "Anyways, your number, " + num + ", in binary is '" + output + "'. So yeah. There you go.";
if (bnum < 0) {
P.html(p);
frameRate(0);
}
}