@@ -71,7 +71,7 @@
</div>
<h3>[method:Integer nearestPowerOfTwo]( [page:Number n] )</h3>
- <div> Returns the nearest power of 2 to a given number [page:Number n].</div>
+ <div>Returns the nearest power of 2 that is smaller or equal to [page:Number n].</div>
<h3>[method:Integer nextPowerOfTwo]( [page:Number n] )</h3>
<div>Returns the nearest power of 2 that is bigger than [page:Number n].</div>
@@ -144,7 +144,7 @@ var _Math = {
nearestPowerOfTwo: function ( value ) {
- return Math.pow( 2, Math.round( Math.log( value ) / Math.LN2 ) );
+ return Math.pow( 2, Math.floor( Math.log( value ) / Math.LN2 ) );
},