# Fast log base 2 in AS3

**URL:** <https://forum.kirupa.com/t/fast-log-base-2-in-as3/252551>\
**Category:** flash\
**Created:** [February 21, 2008, 5:04am UTC](https://forum.kirupa.com/t/fast-log-base-2-in-as3/252551 "2008-02-21T05:04:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![8bitninja](https://avatars.discourse-cdn.com/v4/letter/8/e9c0ed/32.png) [@8bitninja](https://forum.kirupa.com/u/8bitninja)\
**Post date:** [February 21, 2008, 5:04am UTC](https://forum.kirupa.com/t/fast-log-base-2-in-as3/252551/1 "2008-02-21T05:04:16Z")

</div>

[FONT=Courier New]Is there any really computationally fast way to calculate log base 2 in AS3 other than this:

```auto
var x:int=4096;
var x_ld:int=Math.log(x)*Math.LOG2E;

```

…also, are there any fast methods to determine whether a number is a power of 2?  
[/FONT]
