Add ol.math.roundUpToPowerOfTwo
This commit is contained in:
@@ -29,6 +29,16 @@ ol.math.csch = function(x) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} x X.
|
||||
* @return {number} The smallest power of two greater than or equal to x.
|
||||
*/
|
||||
ol.math.roundUpToPowerOfTwo = function(x) {
|
||||
goog.asserts.assert(0 < x);
|
||||
return Math.pow(2, Math.ceil(Math.log(x) / Math.log(2)));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} x X.
|
||||
* @return {number} Hyperbolic secant of x.
|
||||
|
||||
Reference in New Issue
Block a user