I haven\'t learned this in programming class before, but now I need to know it. What are some good resources for learning these numbers and how to convert them? I pretty much am
Maybe playing with this inline snippet could help...
This little javascript snippet could convert in all ways:
You can type any valid entry in one of the input field, they will be instantly converted into each other fields.
Enter for sample 10 or 100, successively in each fields below (or try to enter 1767707668033969 in integer field ;) ...
function doChange(ent) {
var val=ent.target.value;
if (ent.target.id == 'hex') val=parseInt(val, 16);
else if (ent.target.id == 'oct') val=parseInt(val, 8);
else if (ent.target.id == 'bin') val=parseInt(val, 2);
else if (ent.target.id == 'sel') val=parseInt(val,
document.getElementById('radix').value);
document.getElementById('int').value=(val*1).toString(10);
document.getElementById('hex').value=(val*1).toString(16).toUpperCase();
document.getElementById('oct').value=(val*1).toString( 8);
document.getElementById('bin').value=(val*1).toString( 2);
document.getElementById('sel').value=(val*1).toString(
document.getElementById('radix').value).toUpperCase();
}
function selRadix(ent) {
var radix=ent.target.value;
document.getElementById('sel').value=
(1*document.getElementById('int').value).
toString(radix).toUpperCase();
}
function wStart() {
var ent=document.getElementsByTagName('input');
for (var i=0;i"+i+"";
ent.innerHTML+='';
ent.addEventListener('change',selRadix);
}
setTimeout(wStart,300);
body { font-family: sans; font-size: .8em; margin: 0pt; padding:1% }
input#int { width: 12%; }
input#hex { width: 10%; }
input#oct { width: 18%; }
input#bin, input#sel { width: 32%; }
Int
Hex
Oct
Bin
Radix: