Bounds on a rational number when rounded to a float
543488
function boundRat (r) {
  var f = ratToFloat(r)
  return [
    nextafter(f, -Infinity),
    nextafter(f, Infinity)
  ]
}
799495
function round(float, digits) {
		if(digits == null) {
			return Math.round(float);
		}
		var round = 10 * digits;
		return Math.round(float * round) / round;
	}
1043403
private double round(double value, int precision) {
    return BigDecimal.valueOf(value)
        .setScale(precision, RoundingMode.HALF_UP)
        .doubleValue();
  }
292014
def get_bound(pts):
    """"""
    (x0, y0, x1, y1) = (INF, INF, -INF, -INF)
    for (x, y) in pts:
        x0 = min(x0, x)
        y0 = min(y0, y)
        x1 = max(x1, x)
        y1 = max(y1, y)
    return (x0, y0, x1, y1)
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;
	}
664938
function preciseRound(num) {
        var decimals = options.round ? 0 : 1;
        return Math.round(num * Math.pow(10, decimals)) / Math.pow(10, decimals);
      }
719229
def fix_float_precision(float)
      decimals = float.to_f.to_s[/\d+\z/]
      fixed_decimals = decimals.sub(/(\d)\1{5,}\d{,2}\z/, '')

      decimals == fixed_decimals ? float : float.round(fixed_decimals.size)
    end
1108033
def round_float(float, places)
      factor = Float(10 * places)
      Float((float * factor).round / factor)
    end
1167800
def _param_bounds(self, gamma, q):
        
        if gamma < 1.4:
            gamma = 1.4
        if gamma > 2.9:
            gamma = 2.9
        if q < 0.01:
            q = 0.01
        return float(gamma), q
597392
def store_constraint_bounds(index, sense, rhs)
      case sense
      when :==
        lb = ub = rhs
      when :>=
        lb = rhs
        ub = Float::INFINITY
      when :<=
        lb = -Float::INFINITY
        ub = rhs
      end

      Cbc.Cbc_setRowLower @ptr, index, lb
      Cbc.Cbc_setRowUpper @ptr, index, ub
    end
774389
def bounds(self) -> Tuple[float, float, float, float]:
        
        return self.shape.bounds
439662
def safe_round(self, x):
        
        val = x[self.col_name]

        if np.isposinf(val):
            val = sys.maxsize

        elif np.isneginf(val):
            val = -sys.maxsize

        if np.isnan(val):
            val = self.default_val

        if self.subtype == 'integer':
            return int(round(val))

        return val
312101
def bound_range(vals, density, time_unit='us'):
    
    if not len(vals):
        return(np.nan, np.nan, density, False)
    low, high = vals.min(), vals.max()
    invert = False
    if len(vals) > 1 and vals[0] > vals[1]:
        invert = True
    if not density:
        with warnings.catch_warnings():
            warnings.filterwarnings('ignore', r'invalid value encountered in double_scalars')
            full_precision_density = compute_density(low, high, len(vals)-1)
            density = round(full_precision_density, sys.float_info.dig)
        if density == 0:
            density = full_precision_density
    if density == 0:
        raise ValueError('Could not determine Image density, ensure it has a non-zero range.')
    halfd = 0.5/density
    if isinstance(low, datetime_types):
        halfd = np.timedelta64(int(round(halfd)), time_unit)
    return low-halfd, high+halfd, density, invert
989796
def normal_round_int(x: float) -> int:
    
    if not math.isfinite(x):
        raise ValueError("Input to normal_round_int() is not finite")
    if x >= 0:
        # noinspection PyTypeChecker
        return math.floor(x + 0.5)
    else:
        # noinspection PyTypeChecker
        return math.ceil(x - 0.5)
650636
def _snapping_round(num, eps, resolution):
    

    rounded = round(num)
    delta = abs(num - rounded)
    if delta < eps:
        return int(rounded)
    else:
        return int(resolution(num))
886016
def _process_out_of_bounds(self, value, start, end):
        ""
        if isinstance(value, np.datetime64):
            v = dt64_to_dt(value)
            if isinstance(start, (int, float)):
                start = convert_timestamp(start)
            if isinstance(end, (int, float)):
                end = convert_timestamp(end)
            s, e = start, end
            if isinstance(s, np.datetime64):
                s = dt64_to_dt(s)
            if isinstance(e, np.datetime64):
                e = dt64_to_dt(e)
        else:
            v, s, e = value, start, end

        if v < s:
            value = start
        elif v > e:
            value = end

        return value
618693
def _rational(self, val):
        """"""

        I32 = 4294967296 # Maximum 32 bit unsigned int (i.e. 'I') value
        if isinstance(val, int):
             numer, denom = val, 1
        elif isinstance(val, fractions.Fraction):
            numer, denom = val.numerator, val.denominator
        elif hasattr(val, 'numer'):
            (numer, denom) = (int(val.numer()), int(val.denom()))
        else:
            param.main.param.warning("Casting type '%s' to Fraction.fraction"
                               % type(val).__name__)
            frac = fractions.Fraction(str(val))
            numer, denom = frac.numerator, frac.denominator
        return numer % I32, denom % I32