Round the given value to `scale` decimal places using HALF_UP rounding mode if `scale` >= 0
    or at integral part when `scale` < 0.

    >>> spark.createDataFrame([(2.5,)], ['a']).select(round('a', 0).alias('r')).collect()
    [Row(r=3.0)]
195451
def round(col, scale=0):
    
    sc = SparkContext._active_spark_context
    return Column(sc._jvm.functions.round(_to_java_column(col), scale))
608591
@SuppressWarnings("unchecked")
    private T roundOffValueToStep(T value) {
        double d = Math.round(value.doubleValue() / absoluteStepValuePrim) * absoluteStepValuePrim;
        return (T) numberType.toNumber(Math.max(absoluteMinValuePrim, Math.min(absoluteMaxValuePrim, d)));
    }
365589
def adapt_decimalfield_value(self, value, max_digits, decimal_places):
        
        if value is None:
            return None
        if isinstance(value, decimal.Decimal):
            context = decimal.getcontext().copy()
            context.prec = max_digits
            #context.rounding = ROUND_FLOOR
            return "%.*f" % (decimal_places + 1, value.quantize(decimal.Decimal(".1") ** decimal_places, context=context))
        else:
            return "%.*f" % (decimal_places + 1, value)
329791
def price_rounding(price, decimals=2):
    """"""
    try:
        exponent = D('.' + decimals * '0')
    except InvalidOperation:
        # Currencies with no decimal places, ex. JPY, HUF
        exponent = D()
    return price.quantize(exponent, rounding=ROUND_UP)
1089943
public static float round(float f, int decimalPlace) {
      return BigDecimal.valueOf((double) f).setScale(decimalPlace, BigDecimal.ROUND_HALF_UP).floatValue();
   }
1127289
def round(value)
      # If the number is within epsilon of X.5, round up (or down for negative
      # numbers).
      mod = value % 1
      mod_is_half = (mod - 0.5).abs < Script::Value::Number.epsilon
      if value > 0
        !mod_is_half && mod < 0.5 ? value.floor : value.ceil
      else
        mod_is_half || mod < 0.5 ? value.floor : value.ceil
      end
    end
1062594
def round_value(val)
      remainder = val % self.step_size
      unprecised = if (remainder * 2) >= self.step_size
                      (val - remainder) + self.step_size
                    else
                      val - remainder
                    end
      if self.step_size < 1
        precision = -Math.log10(self.step_size).floor
        (unprecised * (10 ** precision)).to_i.to_f / (10 ** precision)
      else
        unprecised
      end      
    end
390835
def valueAt(self, percent):
        
        values = self.values()
        if percent < 0:
            index = 0
        elif percent > 1:
            index = -1
        else:
            index = percent * (len(values) - 1)
        
        # allow some floating point errors for the index (30% left or right)
        remain = index % 1
        if remain < 0.3 or 0.7 < remain:
            try:
                return values[int(round(index))]
            except IndexError:
                return None
        return None
178087
public static BigDecimal roundToClosest(double value, double steps) {
        final BigDecimal down = DMatrixUtils.roundDownTo(value, steps);
        final BigDecimal up = DMatrixUtils.roundUpTo(value, steps);
        final BigDecimal orig = new BigDecimal(String.valueOf(value));
        if (orig.subtract(down).abs().compareTo(orig.subtract(up).abs()) < 0) {
            return down;
        }
        return up;
    }
967728
def roundup(x, order):
    '''
    '''
    return x if x % 10**order == 0 else x + 10**order - x % 10**order
788177
def widthratio(value, max_value, max_width):
    
    ratio = float(value) / float(max_value)
    return int(round(ratio * max_width))
257097
def _smart_round(figure, width=10, max_decimal=4):
    """"""
    n_digits = len(str(int(figure)))
    n_decimal = width - (n_digits + 1)
    if n_decimal <= 1:
        return str(int(figure))
    else:
        n_decimal = min(n_decimal, max_decimal)
        format_str = "%." + str(n_decimal) + "f"
        return format_str % figure
829086
function ratioToReal (min, max, value, step) {
  value = (max - min) * value + min;

  return roundToStep(value, step);
}
612907
private String roundToDecimalPlace(double distance, int decimalPlace) {
    numberFormat.setMaximumFractionDigits(decimalPlace);

    return numberFormat.format(distance);
  }
478238
public static BigDecimal roundHalfEven(BigDecimal value, int scale) {
		return round(value, scale, RoundingMode.HALF_EVEN);
	}
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;
}
909790
function round (float, precision) {
  precision = (precision === undefined ? 10 : precision)
  return parseFloat(float.toFixed(precision), 10)
}