phpjs
Version:
73 lines (56 loc) • 1.44 kB
HTML
<!-- Generated by Rakefile:build -->
<strong>
<a href="http://kevin.vanzonneveld.net" rel="nofollow">Kevin van Zonneveld</a>
</strong>
on 2009-08-16 15:19:18 <br />
@ Tim de Koning: Thanks for pointing that out.
<hr />
<strong>
<a href="http://www.kingsquare.nl" rel="nofollow">Tim de Koning</a>
</strong>
on 2009-08-06 13:17:58 <br />
Please note that there is a difference between the handling of large numbers in different browsers. e.g.
IE8
<pre><code>
>>decbin(3747030078639374300)
"1.101000000000000100000000000010000000000000001(e+61)"
</code></pre>
Firefox 3.5
<pre><code>
>>> decbin(3747030078639374300)
"11010000000000001000000000000100000000000000010000000000000000"
</code></pre>
This is caused by the fact that Number.toString(2) doesn't work in IE for numbers written in scientific notation internally.
<hr />
<strong>
<a href="http://brett-zamir.me" rel="nofollow">Brett Zamir</a>
</strong>
on 2009-08-05 03:58:58 <br />
@nord_ua: Thanks for the report! Fixed in SVN...
<hr />
<strong>
nord_ua
</strong>
on 2009-08-04 12:23:28 <br />
<pre><code>
decbin(-3)
</code></pre>
-11
<hr />
<strong>
ben
</strong>
on 2008-11-06 21:21:58 <br />
wow!!! so cool!!!
<hr />
<strong>
Onno Marsman
</strong>
on 2008-10-04 11:56:57 <br />
decbin('8') does not work correctly. A fix:
<pre><code>
function decbin(number) {
return parseInt(number).toString(2);
}
</code></pre>
<hr />