Round the dimensions of the given rectangle to the given number of digits.
168624
def round(self, digits=0):
        
        self._left = round(self._left, digits)
        self._bottom = round(self._bottom, digits)
        self._width = round(self._width, digits)
        self._height = round(self._height, digits)
1115510
def round_to_n(x, n):
    
    return round(x, -int(np.floor(np.log10(x))) + (n - 1))
860021
def round_to_float(number, precision):
    """"""
    rounded = Decimal(str(floor((number + precision / 2) // precision))
                      ) * Decimal(str(precision))
    return float(rounded)
46801
function(n) {
			var a = (n === Math.floor(n)) ? n : (Math.round(n*100))/100;
			return (a + "%");
		}
1192986
public static void roundInside( RectangleLength2D_F64 bound ) {
		double x0 = Math.ceil(bound.x0);
		double y0 = Math.ceil(bound.y0);
		double x1 = Math.floor(bound.x0+bound.width);
		double y1 = Math.floor(bound.y0+bound.height);

		bound.x0 = x0;
		bound.y0 = y0;
		bound.width = x1-x0;
		bound.height = y1-y0;
	}
877691
def round(self):
    """"""
    return Point(int(round(self.x)), int(round(self.y)))
768509
def round(self, digits=None):
        """"""
        copiedGlyph = self.copyWithoutMathSubObjects()
        # misc
        copiedGlyph.width = _roundNumber(self.width, digits)
        copiedGlyph.height = _roundNumber(self.height, digits)
        # contours
        copiedGlyph.contours = []
        if self.contours:
            copiedGlyph.contours = _roundContours(self.contours, digits)
        # components
        copiedGlyph.components = []
        if self.components:
            copiedGlyph.components = _roundComponents(self.components, digits)
        # guidelines
        copiedGlyph.guidelines = []
        if self.guidelines:
            copiedGlyph.guidelines = _roundGuidelines(self.guidelines, digits)
        # anchors
        copiedGlyph.anchors = []
        if self.anchors:
            copiedGlyph.anchors = _roundAnchors(self.anchors, digits)
        # image
        copiedGlyph.image = None
        if self.image:
            copiedGlyph.image = _roundImage(self.image, digits)
        return copiedGlyph
37621
private char [] applyPrecision(int length) {
        char [] result = new char[nDigits];
        for (int i = 0; i < result.length; i++) result[i] = '0';

        if (length >= nDigits || length < 0) {
            // no rounding necessary
            System.arraycopy(digits, 0, result, 0, nDigits);
            return result;
        }
        if (length == 0) {
            // only one digit (0 or 1) is returned because the precision
            // excludes all significant digits
            if (digits[0] >= '5') {
                result[0] = '1';
            }
            return result;
        }

        int i = length;
        int q = digits[i];
        if (q >= '5' && i > 0) {
            q = digits[--i];
            if ( q == '9' ) {
                while ( q == '9' && i > 0 ){
                    q = digits[--i];
                }
                if ( q == '9' ){
                    // carryout! High-order 1, rest 0s, larger exp.
                    result[0] = '1';
                    return result;
                }
            }
            result[i] = (char)(q + 1);
        }
        while (--i >= 0) {
            result[i] = digits[i];
        }
        return result;
    }
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
284120
public void set(Rectangle rectangle) {
        set(rectangle.getX(), rectangle.getY(), rectangle.getWidth(), rectangle.getHeight());
    }
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)
799495
function round(float, digits) {
		if(digits == null) {
			return Math.round(float);
		}
		var round = 10 * digits;
		return Math.round(float * round) / round;
	}
648241
def round_optimum(self, x):
        
        x = np.array(x)
        if not ((x.ndim == 1) or (x.ndim == 2 and x.shape[0] == 1)):
            raise ValueError("Unexpected dimentionality of x. Got {}, expected (1, N) or (N,)".format(x.ndim))

        if x.ndim == 2:
            x = x[0]

        x_rounded = []
        value_index = 0
        for variable in self.space_expanded:
            var_value = x[value_index : value_index + variable.dimensionality_in_model]
            var_value_rounded = variable.round(var_value)

            x_rounded.append(var_value_rounded)
            value_index += variable.dimensionality_in_model

        return np.atleast_2d(np.concatenate(x_rounded))
795658
def filled_rectangle(self, x0, y0, x1, y1):
        """"""
        x0, y0, x1, y1 = self.rect_helper(x0, y0, x1, y1)
        for x in range(x0, x1 + 1):
            for y in range(y0, y1 + 1):
                self.point(x, y, self.color)
537345
def round_to_n_decimal_places(array, n=3):
    
    # check if in scientific notation
    if issubclass(array.__class__, float) and '%.e'%array == str(array):
        return array # do nothing

    shape = np.shape(array)
    out = ((np.atleast_1d(array) * 10**n).round().astype('int') / (10.**n))
    return out.reshape(shape)
7126
private Rectangle fixRectangle(Rectangle rectangle, int baseWidth, int baseHeight) {
		if (this.positionBaseCentre) {
			// 修正图片位置从背景的中心计算
			rectangle.setLocation(//
					rectangle.x + (int) (Math.abs(baseWidth - rectangle.width) / 2), //
					rectangle.y + (int) (Math.abs(baseHeight - rectangle.height) / 2)//
			);
		}
		return rectangle;
	}
167972
def _round(self, **kwargs):
        
        mathInfo = self._toMathInfo(guidelines=False)
        mathInfo = mathInfo.round()
        self._fromMathInfo(mathInfo, guidelines=False)