Rounds the specified value up to the next nearest power of two.
559721
public static int nextPowerOfTwo (int value)
    {
        return (int)Math.pow(2, Math.ceil(Math.log(value) / Math.log(2)));
    }
752434
def round(unit = :sec)
      next_unit = self.ceil(unit)
      this_unit = self.floor(unit)
      (self - this_unit) < (next_unit - self) ? this_unit : next_unit
    end
948788
function roundPrecision (x, d, places = 2) {
    return (Math.floor(x * d) / d).toFixed(places);
}
430339
public static final double round(double value, double precision)
   {
      precision = Math.pow(10, precision);
      return Math.round(value * precision) / precision;
   }
1350742
def round(self, value_array):
        

        min_value = self.domain[0]
        max_value = self.domain[1]

        rounded_value = value_array[0]
        if rounded_value < min_value:
            rounded_value = min_value
        elif rounded_value > max_value:
            rounded_value = max_value

        return [rounded_value]
140107
public void round(int thePrecision) {
		if (getValue() != null) {
			BigDecimal newValue = getValue().round(new MathContext(thePrecision));
			setValue(newValue);
		}
	}
1334554
function(value,i){
            i= Math.pow(10, i || 15);
            // default
            return Math.round(value*i)/i;
        }
1010246
public static int NextPowerOf2(int x) {
        --x;
        x |= x >> 1;
        x |= x >> 2;
        x |= x >> 4;
        x |= x >> 8;
        x |= x >> 16;
        return ++x;
    }
275466
function round(value, digits)
{
    if (! digits) { digits = 0; }
    var scale = Math.pow(10, digits);
    return Math.round(value * scale) / scale;
}
1110069
def round_to_int(number, precision):
    """"""
    precision = int(precision)
    rounded = (int(number) + precision / 2) // precision * precision
    return rounded
401500
public static double round(double value, int exponent) {
        double factor = Math.pow(10, exponent);
        return Math.round(value * factor) / factor;
    }
1089943
public static float round(float f, int decimalPlace) {
      return BigDecimal.valueOf((double) f).setScale(decimalPlace, BigDecimal.ROUND_HALF_UP).floatValue();
   }
967728
def roundup(x, order):
    '''
    '''
    return x if x % 10**order == 0 else x + 10**order - x % 10**order
656758
public static int round( int top , int div2 , int divisor ) {
		if( top > 0 )
			return (top + div2)/divisor;
		else
			return (top - div2)/divisor;
	}
156564
function roundToStep (value, step) {
  const stepDecimals = calculateDecimals(step);
  const stepDecimalsMultiplier = Math.pow(10, stepDecimals);

  value = Math.round(value / step) * step;

  return Math.round(value * stepDecimalsMultiplier) / stepDecimalsMultiplier;
}
894297
def round(digits = nil)
      rounded_value = digits ? value.round(digits) : value.round
      self.class.new(rounded_value, unit)
    end
1208235
def sround(x, precision=0):
    
    sr = StochasticRound(precision=precision)
    return sr.round(x)