Tuesday, 15 September 2015
DECIMAL TO HEX CONVERTER CODE


-----------------------------------------------------------------------------------------------------------------
COPY AND PASTE BELOW CODE IN POST HTML SECTION
------------------------------------------------------------------------------------------------------------------
<html>
<head>
<style type="text/css">
input { font-size: 1em; }
@media (max-width:799px) {
.btn { font-size: 1.2em; padding:7px; }
}
@media (min-width:800px) {
.btn { font-size: 1.2em; padding:4px; }
}
.intext {
background:url(data:image/gif;base64,R0lGODlhsQBfALMAAO+9jPe9iP+9e/+9hOLBnOnBnMbGwdbGs63G3rXG1r3GzrnG2qXG563G56XG75zG9ywAAAAAsQBfAAAE/lDISau9OOvNZQBgKI5BZ55oqq7s+QHEcRi0gtyMo+98z9wIBc0gI4AGraRyyex8YjbE7kGtWq/YbFb3SygORmRzTC5bPjObQ8tuu9+PnzBsrttPsIMazu/7q3JgAHeEdzAGCAx/i4x+DgwJBgQlhZUsATEJio2cnX0MXwCUlqQYAXoNa56rrG8OCJKjpZaYBg2tuLlvsAWzhQAHUrrDxFsJB4O+Y6cKqsXP0FSgBGLKl8HR2doPCdTWKcAI2+PZx7LfGAAGm+Tt0AgH5+gS6uzu98/w8sqn9vj/xbrNI5AAoMFoDhQkmxXAgLODEIkxODCrQMGIGJ8ptHTAX8aP/rgQECDU8CHIk60cUKxjEaXLYRvJdHxJM5fIMQ5r6ky5UomBnUBZqfQZtKinoSx+Gl3ayMFIFQdMMp0Kp8HTE1GpavVjFavUrWC1NOjFAYDHsGixJNhXQUHat216YjgAt24WBmQvmLXL18paDG77Cn4gdwKBwYMZLJxwEXHfwgC+Ok6LQJbSyXydTgggDnNfA4Y9C25A6bJou08Dn7a7svPquqAFuH79VoEAzrTrIhAQOTdcBh8k+57qAITw4UsV90YeFsGAvczBJpAwO/rU2KatM316WPtUxfTOetc5fUL18TtjS8iOvqaDvLzFtz9puwL7+SffW4CO32V9C/f1/heRfnrJJyBA/11A14EZ4bVBgAy6g5QGATQW4T/qbVDALRfiowBbFxBwXIfFILBYBwuSuI1mKkCoYi4TQjXii510lURWNOpioxIEcJgjKwnAx6OPP3KSwIlLtFRkIwaAmAQAqi3JhwMZ1kHAeVJmEaQl6sz440ROmkFQlljE5Es/ZD5w0zwFRJkjlUh+MyaNCQk5jwQDENBMh3XeqaECBloHip1+poPIfLDEWSiFenqJmQPdhLmoBgXYMlwDBhA6qQqYAHraNJJumkItqQyGqRGikkSAAZq8BWksqc5ySCLEBYFMNbFac4gmjv7zSCTIhJqrrAVAkUAivUqEgBeSLRSg6LC55pEGDsnC8cgNkRCBKrTcqgBAsTIMcSwQ5JaL7RDaOtvtuuy2O0EEAAA7);
font-family:'Comic Sans MS';
font-weight:bold;
}
.outtext {
background:url(data:image/gif;base64,R0lGODlhsQBfALMAAO+9jPe9iP+9e/+9hOLBnOnBnMbGwdbGs63G3rXG1r3GzrnG2qXG563G56XG75zG9ywAAAAAsQBfAAAE/lDISau9OOvNZQBgKI5BZ55oqq7s+QHEcRi0gtyMo+98z9wIBc0gI4AGraRyyex8YjbE7kGtWq/YbFb3SygORmRzTC5bPjObQ8tuu9+PnzBsrttPsIMazu/7q3JgAHeEdzAGCAx/i4x+DgwJBgQlhZUsATEJio2cnX0MXwCUlqQYAXoNa56rrG8OCJKjpZaYBg2tuLlvsAWzhQAHUrrDxFsJB4O+Y6cKqsXP0FSgBGLKl8HR2doPCdTWKcAI2+PZx7LfGAAGm+Tt0AgH5+gS6uzu98/w8sqn9vj/xbrNI5AAoMFoDhQkmxXAgLODEIkxODCrQMGIGJ8ptHTAX8aP/rgQECDU8CHIk60cUKxjEaXLYRvJdHxJM5fIMQ5r6ky5UomBnUBZqfQZtKinoSx+Gl3ayMFIFQdMMp0Kp8HTE1GpavVjFavUrWC1NOjFAYDHsGixJNhXQUHat216YjgAt24WBmQvmLXL18paDG77Cn4gdwKBwYMZLJxwEXHfwgC+Ok6LQJbSyXydTgggDnNfA4Y9C25A6bJou08Dn7a7svPquqAFuH79VoEAzrTrIhAQOTdcBh8k+57qAITw4UsV90YeFsGAvczBJpAwO/rU2KatM316WPtUxfTOetc5fUL18TtjS8iOvqaDvLzFtz9puwL7+SffW4CO32V9C/f1/heRfnrJJyBA/11A14EZ4bVBgAy6g5QGATQW4T/qbVDALRfiowBbFxBwXIfFILBYBwuSuI1mKkCoYi4TQjXii510lURWNOpioxIEcJgjKwnAx6OPP3KSwIlLtFRkIwaAmAQAqi3JhwMZ1kHAeVJmEaQl6sz440ROmkFQlljE5Es/ZD5w0zwFRJkjlUh+MyaNCQk5jwQDENBMh3XeqaECBloHip1+poPIfLDEWSiFenqJmQPdhLmoBgXYMlwDBhA6qQqYAHraNJJumkItqQyGqRGikkSAAZq8BWksqc5ySCLEBYFMNbFac4gmjv7zSCTIhJqrrAVAkUAivUqEgBeSLRSg6LC55pEGDsnC8cgNkRCBKrTcqgBAsTIMcSwQ5JaL7RDaOtvtuuy2O0EEAAA7);
font-family:'Comic Sans MS';
font-weight:bold;
}
a:link { text-decoration: none; color: #083d8d; }
a:visited { text-decoration: none; color: #083d8d; }
a:active { text-decoration: underline; color: #000000; }
a:hover { text-decoration: underline; color: #000000; }
a:focus { outline: none; }
.math { font-family: "Times New Roman"; font-size: 1.6em; padding-left: 6px; font-weight: normal;}
.mathsymbol { font-family: "Times New Roman"; font-size: 1.2em; font-weight: normal; }
.text { font-family: "Times New Roman", Times, serif; font-size: 1.2em }
.code { font-family: "Courier New"; font-size: 1.0em; padding-left: 6px;}
.codebg { font-family: "Courier New"; font-size: 1.0em; color: #000000; background:#f0f0f0; margin-top: 0px; margin-bottom: 0px; padding: 10px; }
.codebg.p { font-family: "Courier New"; font-size: 1.0em; color: #000000; background:#f0f0f0; margin-top: 0px; margin-bottom: 0px;}
p.code { font-family: "Courier New"; font-size: 1.0em; color: #000000; background:#f0f0f0; margin:0px; padding:5px; border-width:1px; border-color:#ccc; border-style:solid; line-height:20px}
p.wcode { font-family: "Courier New"; font-size: 1.0em; color: #000000}
p.tcode { font-family: "Courier New"; font-size: 1.0em; color: #000000; background:#f0f0f0; margin:0px; padding:5px; border-width:1px; border-color:#ccc; border-style:solid; line-height:20px }
.table1 .hov { border: 2px black solid; padding: 4px; }
.table1 .ho2 { border: 2px #707070 solid; padding: 4px; }
.table1 .td { border: 1px black solid; padding: 5px; }
table.dtable, table.ntable { border: 1px #ccc solid; border-collapse:collapse; padding: 5px;}
table.dtable th, table.dtable td, table.ntable th, table.ntable td { border: 1px #ccc solid; border-collapse:collapse; padding: 5px; font-weight:normal;}
table.dtable th, table.ntable th { text-align:center }
table.ntable td { text-align:right }
table.calc, .calc2 {
border-spacing: 0px;
border-collapse: separate;
background: #e8e8e8;
border:1px #ddd solid;
border-radius:7px;
-moz-border-radius:7px;
-webkit-border-radius:7px;
}
table.calc td, .calc2 td {
padding: 2px;
border-width: 0px;
border-style: none;
background: #e8e8e8;
}
.calc2 select { padding:4px 2px; font-size:1.2em; font-family:Arial, Helvetica, sans-serif }
@media all and (max-width: 576px) {
.calc2 { padding:8px; margin-left:auto; margin-right:auto; }
.calc2 td { float:left; }
.calc2 td:nth-child(2) { clear:left; }
.calc2 tr td:nth-child(3) { padding-top:10px; }
.calc2 input[type=text], .calc2 input[type=number], .calc2 input[type=url] { width:190px; font-size:x-large; padding-left:3px; }
.calc2 tr td:nth-child(3) select { margin-top:-8px; }
}
@media all and (min-width: 577px) {
.calc2 { padding:15px; }
.calc2 tr { line-height:40px; }
.calc2 input[type=text], .calc2 input[type=number], .calc2 input[type=url] { width:220px; font-size:x-large; padding-left:3px; }
}
#area {
font-size:x-large;
width:100%;
}
</style>
<script type='text/javascript'>
function setfocus() {
document.calcform.x.focus();
}
function calc() {
x = document.calcform.x.value;
y = convert(x);
y = roundresult(y);
document.calcform.y.value = y;
}
function calctest() {
x = document.calcform.x.value;
y = convert(x);
//y = roundresult(y);
y = roundresult1(y);
document.calcform.y.value = y;
}
function calc3() {
x1 = document.calcform.x1.value;
x2 = document.calcform.x2.value;
y = convert(x1,x2);
y = roundresult(y);
document.calcform.y.value = y;
}
function calc4() {
x1 = document.calcform.x1.value;
x2 = document.calcform.x2.value;
x3 = document.calcform.x3.value;
y = convert(x1,x2,x3);
y = roundresult(y);
//yy = y.toString();
//if( yy.length>12 ) {
// y = parseFloat(y);
// y = y.toPrecision(10);
//}
document.calcform.y.value = y;
}
function calc5() {
x = document.calcform.x.value;
y = convert1(x);
y = roundresult(y);
document.calcform.y1.value = y;
y = convert2(x);
y = roundresult(y);
document.calcform.y2.value = y;
}
function calcbase(b1,b2) {
x = document.calcform.x.value;
document.calcform.y.value = convertbase(x,b1,b2);
}
function calcbase2() {
x = document.calcform.x.value;
y = convert(x);
document.calcform.y.value = y;
}
function roundresult(x) {
y = parseFloat(x);
y = roundnum(y,10);
return y;
}
function roundnum(x,p) {
var i;
var n=parseFloat(x);
var m=n.toPrecision(p+1);
var y=String(m);
i=y.indexOf('e');
if( i==-1 ) i=y.length;
j=y.indexOf('.');
if( i>j && j!=-1 )
{
while(i>0)
{
if(y.charAt(--i)=='0')
y = removeAt(y,i);
else
break;
}
if(y.charAt(i)=='.')
y = removeAt(y,i);
}
return y;
}
function removeAt(s,i) {
s = s.substring(0,i)+s.substring(i+1,s.length);
return s;
}
function convertbase(x,b1,b2) {
d="0123456789ABCDEFX";
x=x.replace(/ /,"");
x=x.toUpperCase();
y=0;
// return b1+b2;
for(i=x.length, s=1; i>=1; i--,s*=b1) {
c = x.charAt(i-1);
for(j=0; j<b1+1; j++) {
if( j==b1 ) {
y = "bad input number";
return y;
}
if( c == d.charAt(j) )
break;
}
y+=j*s;
}
x=y;
if( x==0 ) return "0";
y="";
for(s=1; s<=x; s*=b2);
if( x!=s ) s/=b2;
for(p=s; p>=1; p/=b2) {
i = Math.floor(x/p);
y+= d.charAt(i);
x-= i*p;
}
return y;
}
function convertbase2(x,b1,b2) {
x = parseInt(x, b1);
y = x.toString(b2);
return y;
}
var gcd = function(a, b) {
if ( ! b) {
return a;
}
return gcd(b, a % b);
};
function digits_after_period(x)
{
f = x.toString();
i = f.indexOf('.');
len = f.length-i-1;
return len;
}
function parseFraction(s)
{
var n1=n2=0;
var sign=n3=1;
i = s.indexOf(' ');
if( i==0 ) s=s.substring(1);
i = s.indexOf('-');
if( i==0 ) {s=s.substring(1); sign=-1;}
i = s.indexOf(' ');
if( i==0 ) s=s.substring(1);
i = s.indexOf(' ');
if( !isNaN(parseInt(s)) && isFinite(s) ) i=s.length;
if( i!=-1 )
{
n1 = parseInt(s.substring(0,i));
s = s.substring(i+1);
}
i = s.indexOf('/');
if( i!=-1 )
{
n2 = parseInt(s.substring(0,i));
s = s.substring(i+1);
n3 = parseInt(s);
}
return [sign,n1,n2,n3];
}
//]]>
</script>
</head>
<body>
<section id="doc">
<!-- #BeginEditable "doctext" -->
<h1>Decimal to Hex conversion</h1>
<p>Decimal to hex number conversion calculator and how to convert.</p>
<ul>
<li><a href="#calculator">Decimal to hex converter</a></li>
<li><a href="#how">How to convert from decimal to hex</a></li>
<li><a href="#table">Decimal to hex conversion table</a></li>
</ul>
<h2><a name="calculator"></a>Decimal to hex converter</h2>
<p>Enter a decimal number and press the <i>Convert</i> button:</p>
<form name="calcform">
<table class="calc2">
<tbody>
<tr>
<td><label for="x">Enter decimal number:</label></td>
<td class="math"><input type="number" id="x" name="x" class="intext" autofocus tabindex="1"></td>
<td class="mathsymbol"><sub>10</sub></td>
</tr>
<tr>
<td> </td>
<td><input onclick="calcbase2()" type="button" value="Convert" class="btn" tabindex="2"> <input type="reset" value="Reset" class="btn" tabindex="3"></td>
<td> </td>
</tr>
<tr>
<td>Hex result:</td>
<td class="math"><input type="text" name="y" class="outtext" readonly tabindex="4"></td>
<td class="mathsymbol"><sub>16</sub></td>
</tr>
</tbody>
</table>
</form>
<h2><a name="how"></a>How to convert from decimal to hex</h2>
<p>For decimal number x:</p>
<ol>
<li>Get the highest power of 16 that is less than the decimal number x: <p class="math">16<i><sup>n</sup></i> < <i>x</i>, (<i>n</i>=1,2,3,...)</li>
<li>The high hex digit is equal to the integer if the decimal number x divided by the highest power of 16 that is smaller than x:<p class="math"><i>d<sub>n</sub></i> = int(<i>x</i> / 16<i><sup>n</sup></i>)</li>
<li>Calculate the difference Δ of the number x and the hex digit d<sup>n</sup> times the power of 16, 16<sup>n</sup>:<p class="math">Δ = <i>x</i> - <i>d<sub>n</sub></i> × 16<i><sup>n</sup></i></li>
<li>Repeat step #1 with the difference result until the result is 0.</li>
</ol>
<h4>Example</h4>
<p>Convert x=603 to hex:</p>
<p class="math"><i>n</i>=2, 16<sup>2</sup>=256 < 603</p>
<p class="math"><i>n</i>=3, 16<sup>3</sup>=4096 > 603</p>
<p>So</p>
<p class="math"><i>n </i>= 2</p>
<p class="math"><i>d</i><sub>2</sub> = int(603 / 16<sup>2</sup>) = 2</p>
<p class="math">Δ = 603 - 2×16<sup>2</sup> = 91</p>
<p class="math"><i>n </i>= 1, <i>x</i> = Δ = 91</p>
<p class="math"><i>d</i><sub>1</sub> = int(91 / 16<sup>1</sup>) = 5</p>
<p class="math">Δ = 91 - 5×16<sup>1</sup> = 11</p>
<p class="math"><i>n </i>= 0, <i>x</i> = Δ = 11</p>
<p class="math"><i>d</i><sub>0</sub> = int(11 / 16<sup>0</sup>) = 11<sub><span style="font-size: 0.8em">10</span></sub> = B<sub><span style="font-size: 0.8em">16</span></sub></p>
<p class="math">Δ = 11 - 11×16<sup>0</sup> = 0</p>
<p class="math">(<i>d</i><sub>2</sub><i>d</i><sub>1</sub><i>d</i><sub>0</sub>) = 25B</p>
<p class="math">So</p>
<p class="math"><i>x</i> = 603<sub><span style="font-size: 0.8em">10</span></sub> = 25B<sub><span style="font-size: 0.8em">16</span></sub></p>
<h2><a name="table"></a>Decimal to hex conversion table</h2>
<table class="ntable">
<tr>
<th>Decimal<p>base 10</th>
<th>Hex<p>base 16</th>
</tr>
<tr>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>4</td>
</tr>
<tr>
<td>5</td>
<td>5</td>
</tr>
<tr>
<td>6</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>7</td>
</tr>
<tr>
<td>8</td>
<td>8</td>
</tr>
<tr>
<td>9</td>
<td>9</td>
</tr>
<tr>
<td>10</td>
<td>A</td>
</tr>
<tr>
<td>11</td>
<td>B</td>
</tr>
<tr>
<td>12</td>
<td>C</td>
</tr>
<tr>
<td>13</td>
<td>D</td>
</tr>
<tr>
<td>14</td>
<td>E</td>
</tr>
<tr>
<td>15</td>
<td>F</td>
</tr>
<tr>
<td>16</td>
<td>10</td>
</tr>
<tr>
<td>17</td>
<td>11</td>
</tr>
<tr>
<td>18</td>
<td>12</td>
</tr>
<tr>
<td>19</td>
<td>13</td>
</tr>
<tr>
<td>20</td>
<td>14</td>
</tr>
<tr>
<td>30</td>
<td>1E</td>
</tr>
<tr>
<td>40</td>
<td>28</td>
</tr>
<tr>
<td>50</td>
<td>32</td>
</tr>
<tr>
<td>60</td>
<td>3C</td>
</tr>
<tr>
<td>70</td>
<td>46</td>
</tr>
<tr>
<td>80</td>
<td>50</td>
</tr>
<tr>
<td>90</td>
<td>5A</td>
</tr>
<tr>
<td>100</td>
<td>64</td>
</tr>
<tr>
<td>200</td>
<td>C8</td>
</tr>
<tr>
<td>1000</td>
<td>3E8</td>
</tr>
<tr>
<td>2000</td>
<td>7D0</td>
</tr>
</table>
<script type="text/javascript">
<!--
function convert(x) {
x = parseInt(x);
if( x<0 ) {
if( x>=-32768 )
x+=65536;
else if( x>=-Math.pow(2,31))
x+=Math.pow(2,32);
else if( x>=-Math.pow(2,63) )
x+=Math.pow(2,64);
}
y = x.toString(16);
y = y.toUpperCase();
return(y);
}
//-->
</script>
<!-- #EndEditable -->
</section>
</body>
</html>
Related movie you might like to see :

White Space Remover

COMMENTS REMOVER CODE

COMMENTS REMOVER

FILE SAVE AS WITH JAVA SCRIPT METHO...

FILE SAVE AS WITH JAVA SCRIPT METH...

HTML CSS JAVA COMPRESSOR CODE

HTML CSS JAVA COMPRESSOR

ONLINE CSS UNMINIFIER CODE

ONLINE CSS UNMINIFIER

CSSO (CSS Optimizer)

SCRIPT TUTORIALS CSSO CSS COMPOSER ...

WHITE SPACE REMOVER CODE
?
+
X
Recommended for you
Loading..
Related Post for DECIMAL TO HEX CONVERTER CODE
SCRIPT TUTORIALS CSSO CSS COMPOSER CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ------------…
URDU TYPE WRITER Urdu keyboard Online .bt {cursor:pointer; width:32pt; font-size:20pt; color:#CC0033; font-family:'Times New Roman'; } .bta {cursor:pointer; width:38pt; font-size:20pt; …
HCF AND LCM WITH BRACH METHOD CALCULATOR HIGHEST COMMON FACTOR AND LOWEST COMMON MULTIPLE /* AngularJS v1.2.20 (c) 2010-2014 Google, Inc. http://angularjs.org License: MIT */ (function(S,U,s){'use strict';fu…
HOW MANY DIVISORS DOES A NUMBER HAVE? -------------------------------------------------------------------------------------------------------------------------- READ MORE: http://primes.utm.edu/glossary/xpage/tau.…
JavaScript Compressor Packer A JavaScript Compressor h1 { display: block; font-size: 2em; margin-top: 0.67em; margin-bottom: 0.67em; margin-left: 0; margin-right: 0; font-weight: bold;background: …
URDU TYPE WRITER CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
URL LINK SHORTNER READ MORE FIND THIS WORD (data:image link shortener http://fbgadgets.blogspot.co.uk/2014/12/image-converter-software.htmlIMAGE CONVERTER DATA URI FORMAT http://www.hongkiat…
LINEAR EQUATION CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
SCRIPT TUTORIALS CSSO CSS COMPOSER #stats{font-size:22px;font-weight:bold}.wpp-comments{} .content{border-left:none!important}.syntaxhighlighter .lines.no-wrap{overflow:auto!important;overflow-y:hidden!impo…
GREATEST COMMON FACTOR CALCULATOR CODE -------------------------------------------------------------------------------------------------------------------------- READ MORE: http://maths.wordpandit.com/h-c-f-by-…
PRIME FACTORS BRANCH CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
TRANSLATE IN JAVA SCRIPT -------------------------------------------------------------------------------------------------------------------------- ENGLISH TO HINDI CODE ------------------------------…
Remove Extra Spaces Remove Extra Spaces html {height:100%;} body {height:100%; margin:0px; padding:0px; font-family:arial; font-size:16px; line-height:1.7; background-color:#DFECFA;} h1 {c…
PRIME FACTORS BRANCH CALCULATOR PRIME FACTORS /* AngularJS v1.2.20 (c) 2010-2014 Google, Inc. http://angularjs.org License: MIT */ (function(S,U,s){'use strict';function v(b){return function(){var …
HOW MANY DIVISORS DOES A NUMBER HAVE? -------------------------------------------------------------------------------------------------------------------------- READ MORE: http://www.javascripter.net/math/calculat…
COMPRESS HTML COMPRESS HTML #content{width:500px;margin:0;padding:0;} h1 { width:500px; background: repeating-linear-gradient( 45deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2) 10p…
DATA URI CODE IMAGE CONVERT INTO JPG IMAGE Best Online Base64 to Image converter .arrow_box { position: relative; background: #ffffff; border: 4px solid #E9E9E9; } .arrow_box:after,.arrow_box:before { top: 100%; lef…
HCF AND LCM WITH BRACH METHOD CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
Labels:
TEXT TOOLS
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.