// <![CDATA[ // // define base var digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; // remove blank space function ignoreSpaces(string) { var temp = ""; string = '' + string; splitstring = string.split(" "); for(i = 0; i < splitstring.length; i++) temp += splitstring[i]; return temp; } // prepare conversion function xtoy(base) { var k = converter.input.value; var i = 0; var sum=0; var j = 0; // no comma while(k.charAt(i)!="." && i<=k.length) i++; k = k.substring(0,i); i=0; // change LowerCase to UpperCase text = k var casechanged = text.toUpperCase(); k = casechanged // - minus sign, + minus sign var sign = 1; if (k.charAt(0) == "-") { sign=-1; k = k.substring(1,k.length); } var pot = k.length-1; // Convert while(pot>=0) { while (k.charAt(j)!=digits.charAt(i) && i<=base) i++; sum = sum + ((i) * Math.pow(base,pot)); j++; pot--; i=0; } ytox(sign*sum); } function ytox(z) { var base = converter.tobase.value; var xconverted; var k = z + ""; if (k.charAt(0) == "-") xconverted="-"; else xconverted=""; k = Math.abs(k); var j = 0; var i = 0; while(k>=Math.pow(base,(i+1))) i++; while(k>0){ while (k>=((j+1)*Math.pow(base,i))) j++; k = k - (j)*Math.pow(base,i); xconverted = xconverted + digits.charAt(j); i--; j = 0; } for(j=i;j>=0;j--) xconverted = xconverted + "0"; converter.output.value = xconverted } // ]]>
From base 1 - 36 to base 2 - 36
Use only numbers 0 - 9 and A - Z
this is base table : (Base=Red)
(Input/output value=blue)
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35)
Names in Base Number systems:
1 - unary 2 - binary 3 - ternary / trinary 4 - quaternary 5 - quinary / quinternary 6 - senary / heximal / hexary 7 - septenary / septuary 8 - octal / octonary / octonal / octimal 9 - nonary / novary / noval 10 - decimal / denary 11 - undecimal / undenary / unodecimal 12 - dozenal / duodecimal / duodenary 13 - tridecimal / tredecimal / triodecimal 14 - tetradecimal / quadrodecimal / quattuordecimal 15 - pentadecimal / quindecimal 16 - hexadecimal / sexadecimal / sedecimal 17 - septendecimal / heptadecimal 18 - octodecimal / decennoctal 19 - nonadecimal / novodecimal / decennoval 20 - vigesimal / bigesimal / bidecimal 21 - unovigesimal / unobigesimal 22 - duovigesimal 23 - triovigesimal 24 - quadrovigesimal / quadriovigesimal 26 - hexavigesimal / sexavigesimal 27 - heptovigesimal 28 - octovigesimal 29 - novovigesimal 30 - trigesimal / triogesimal 31 - unotrigesimal (...repeat naming pattern...) 36 - hexatridecimal / sexatrigesimal (...repeat naming pattern...)
Reference: http://www.kaagaard.dk/service/convert.htm