Rounds a number to a specified precision.

@param d
@param i
@return
977127
public static double round(double d, int i) {
        double multiplier = Math.pow(10, i);
        return Math.round(d*multiplier)/multiplier;
    }
1132947
function rounded (value, precision) {
  precision = Math.pow(10, precision);
  return Math.floor(value * precision) / precision;
}
656758
public static int round( int top , int div2 , int divisor ) {
		if( top > 0 )
			return (top + div2)/divisor;
		else
			return (top - div2)/divisor;
	}
254784
def round(self, ndigits=0):
        
        if ndigits is None:
            ndigits = 0
        return self.__class__(
            amount=self.amount.quantize(Decimal('1e' + str(-ndigits))),
            currency=self.currency)
330728
void setPrecisionUnit(int i) {
        if (upperBound[i] > lowerBound[i]) {
            double digits = Math.log10(Math.abs(upperBound[i] - lowerBound[i]));
            double residual = digits - Math.floor(digits);
            if (residual < 0.2) {
                // If the range is less than 15 units, we reduce one level.
                digits -= 1.0;
            }

            precisionDigits[i] = (int) Math.floor(digits);
            precisionUnit[i] = Math.pow(10, precisionDigits[i]);

            if (residual >= 0.2 && residual <= 0.7) {
                // In case of too few grids, we use a half of precision unit.
                precisionUnit[i] /= 2;
                precisionDigits[i] -= 1;
            }
        } else {
            precisionUnit[i] = 0.1;
        }
    }
647049
public double transformFromUnitInterval(int i, double d){
    	return (B[i]-A[i])*(d-1.0)+B[i];
    }
293021
public final static void itosReverse(long i, int index, char[] buf) {
		assert (i >= 0);
		long q;
		int r;

		// Get 2 digits/iteration using longs until quotient fits into an int
		while (i > Integer.MAX_VALUE) {
			q = i / 100;
			// really: r = i - (q * 100);
			r = (int) (i - ((q << 6) + (q << 5) + (q << 2)));
			i = q;
			buf[index++] = DigitOnes[r];
			buf[index++] = DigitTens[r];
		}

		// Get 2 digits/iteration using ints
		int q2;
		int i2 = (int) i;
		while (i2 >= 65536) {
			q2 = i2 / 100;
			// really: r = i2 - (q * 100);
			r = i2 - ((q2 << 6) + (q2 << 5) + (q2 << 2));
			i2 = q2;
			buf[index++] = DigitOnes[r];
			buf[index++] = DigitTens[r];
		}

		// Fall thru to fast mode for smaller numbers
		// assert(i2 <= 65536, i2);
		for (;;) {
			q2 = (i2 * 52429) >>> (16 + 3);
			r = i2 - ((q2 << 3) + (q2 << 1)); // r = i2-(q2*10) ...
			buf[index++] = digits[r];
			i2 = q2;
			if (i2 == 0)
				break;
		}
	}
117541
public static double roundWithDecimalPlace(double doubleNumber,
            int decimalPlace) {
        double pow = pow(10, decimalPlace);
        return Math.round(doubleNumber * pow) / pow;
    }
256353
public static double round(double value, int decimals, RoundingMode roundingMode) {
		if (decimals < 0) {
			throw new IllegalArgumentException("Invalid number of decimal places");
		}

		BigDecimal bd = new BigDecimal(value);
		return bd.setScale(decimals, roundingMode).doubleValue();
	}
50589
private int integerDigits(double d) {
    double value = Math.abs(d);
    if(value < 10) {
      return 1;
    }
    return (int) FastMath.log10(value) + 1;
  }
643943
private void bufferInt(long i) {
        buffer((byte) (i & 0xff));
        buffer((byte) ((i >>> 8) & 0xff));
        buffer((byte) ((i >>> 16) & 0xff));
        buffer((byte) ((i >>> 24) & 0xff));
    }
334599
static int round(int value, int precision, int significantDigits) {
		if (precision > 0) {
			value = (value + precision / 2) / precision * precision;
		}
		if (significantDigits > 0) {
			int forRounding = value;
			int precisionMax = (int) Math.pow(10, significantDigits);
			int multiplier = 1;
			while (value > precisionMax) {
				forRounding = value;
				multiplier *= 10;
				value /= 10;
			}
			if (forRounding % 10 >= 5) {
				value++;
			}
			value *= multiplier;
		}
		return value;
	}
972010
def get_rounded(self, digits):
        
        result = self.copy()
        result.round(digits)
        return result
1181854
public void putUnsignedInt(long i) {
        _buffer[_offset++] = (byte) (i >>> 24 & 0xff);
        _buffer[_offset++] = (byte) (i >> 16);
        _buffer[_offset++] = (byte) (i >> 8);
        _buffer[_offset++] = (byte) i;
    }
478954
public static int parseInt(String s, int i) {
		if (s == null) {
			return i;
		}
		try {
			return Integer.parseInt(s.trim());
		} catch (NumberFormatException e) {
			return i;
		}
	}
962295
def round_to_scale(number, precision):
    """"""
    if precision < 1:
        return round_to_float(number, precision)
    return round_to_int(number, precision)
354658
def frange(start, stop, step, precision):
    """"""
    value = start
    while round(value, precision) < stop:
        yield round(value, precision)
        value += step