note that result may exceed the original precision.
500723
public Decimal floor() {
		BigDecimal bd = toBigDecimal().setScale(0, RoundingMode.FLOOR);
		return fromBigDecimal(bd, bd.precision(), 0);
	}
1340009
private static boolean nearlyEqual(double a, double b, double epsilon)
    {
        final double absA = Math.abs(a);
        final double absB = Math.abs(b);
        final double diff = Math.abs(a - b);

        if (a == b)
        { // shortcut, handles infinities
            return true;
        }
        else if (a == 0 || b == 0 || diff < Double.MIN_NORMAL)
        {
            // a or b is zero or both are extremely close to it
            // relative error is less meaningful here
            return diff < (epsilon * Double.MIN_NORMAL);
        }
        else
        { // use relative error
            return diff / (absA + absB) < epsilon;
        }
    }
256107
def roundness(self, value):
        
        if (value is not None) and (not value in DG_V_ROUNDNESS):
            raise ValueError("Unrecognized value for roundness: '%s'" % value)
        self.__roundness = value
622883
def precision(self):
        
        true_pos = self.matrix[0][0]
        false_pos = self.matrix[1][0]
        return divide(1.0 * true_pos, true_pos + false_pos)
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
1206442
function toPrecision( number, places, truncation ) {
   // Define a maximum precision for truncation=NONE, taking into account 32bit machine limits.
   // We cannot use Number.toFixed because of rounding errors in MSIE8.
   const MAX_SIGNIFICANT_PLACES = 14;

   const actualPlaces = truncation === 'NONE' ? MAX_SIGNIFICANT_PLACES : places;

   if( actualPlaces === 0 ) {
      return `${Math.round( number )}`;
   }

   const multiplier = Math.pow( 10, actualPlaces );
   let str = `${Math.round( number * multiplier ) / multiplier}`;

   // Detect and avoid scientific notation for numbers x where |x| << 10^(-5)
   // A heuristic is used to avoid unnecessary string operations for "regular" numbers
   const absNumber = Math.abs( number );
   if( absNumber < 0.0001 ) {
      const exponent = parseInt( str.split( 'e-' )[ 1 ], 10 );
      if( exponent ) {
         const base = `${Math.pow( 10, exponent - 1 ) * Math.round( absNumber * multiplier ) / multiplier}`;
         str = `${number < 0 ? '-' : ''}0.${zeros( exponent - 1 ) + base.substring( 2 )}`;
      }
   }

   if( truncation === 'BOUNDED' || truncation === 'NONE' ) {
      return str;
   }

   const tmp = str.split( '.' );
   if( tmp.length === 1 ) {
      return `${str}.${zeros( actualPlaces )}`;
   }

   return str + zeros( actualPlaces - tmp[ 1 ].length );
}
689101
def round_if_near_integer(a, epsilon=1e-4):
    
    if abs(a - round(a)) <= epsilon:
        return round(a)
    else:
        return a
427524
def check_offset(self):
        """"""

        for d in range(self.dmps):
            if (self.y0[d] == self.goal[d]):
                self.goal[d] += 1e-4
930999
def raise_error_if_unphysical(f):
    
    def wrapper(self, *args, **kwargs):
        if self.k_vrh < 0 or self.g_vrh < 0:
            raise ValueError("Bulk or shear modulus is negative, property "
                             "cannot be determined")
        return f(self, *args, **kwargs)
    return wrapper
1326168
public void checkValid() {
        final StringBuilder b = new StringBuilder();
        if (precisionForFxRate < 2) {
            b.append("Precision for FX should be >=2");
        }
        if (precisionForInverseFxRate < 2) {
            if (b.length() > 0) {
                b.append(",");
            }
            b.append("Precision for 1/FX should be >=2");
        }
        if (ratesSnapshot.isEmpty() && baseFxRateProvider == null) {
            if (b.length() > 0) {
                b.append(",");
            }
            b.append("You must provide Base Rates Snapshots OR a BaseFxRateProvider");
        }

        if (b.length() > 0) {
            throw new IllegalArgumentException(b.toString());
        }
    }
1288887
def precision(y, z):
    
    tp, tn, fp, fn = contingency_table(y, z)
    return tp / (tp + fp)
809377
def _beyond_unit_bound(self, loglstar):
        """"""

        if self.logl_first_update is None:
            # If we haven't already updated our bounds, check if we satisfy
            # the provided criteria for establishing the first bounding update.
            check = (self.ncall > self.ubound_ncall and
                     self.eff < self.ubound_eff)
            if check:
                # Save the log-likelihood where our first update took place.
                self.logl_first_update = loglstar
            return check
        else:
            # If we've already update our bounds, check if we've exceeded the
            # saved log-likelihood threshold. (This is useful when sampling
            # within `dynamicsampler`).
            return loglstar >= self.logl_first_update
571021
private static double limitHprime(double hPrime) {
        hPrime /= 360.0;
        final double limited = 360.0 * (hPrime - floor(hPrime));

        if (limited < -180.0) {
            return limited + 360.0;
        } else if (limited > 180.0) {
            return limited - 360.0;
        } else {
            return limited;
        }
    }
939654
private static void scaleDownTenRoundUp(Slice decimal, int tenScale, Slice result)
    {
        boolean round;
        do {
            int powerTen = Math.min(tenScale, MAX_POWER_OF_TEN_INT);
            tenScale -= powerTen;

            int divisor = POWERS_OF_TEN_INT[powerTen];
            round = divideCheckRound(decimal, divisor, result);
            decimal = result;
        }
        while (tenScale > 0);

        if (round) {
            incrementUnsafe(decimal);
        }
    }
140107
public void round(int thePrecision) {
		if (getValue() != null) {
			BigDecimal newValue = getValue().round(new MathContext(thePrecision));
			setValue(newValue);
		}
	}
1304886
private function determinePrecision($options)
    {
        $precision = $options['float.precision'];

        if ($precision === false) {
            $precision = ini_get('serialize_precision');
        }

        return max(1, (int) $precision);
    }
1371172
public int precision(int recall) {
    int optimum = 0;
    for (int right = 0; right <= recall; right++) {
      int candidate = numpositive[right] + numnegative[recall - right];
      if (candidate > optimum) {
        optimum = candidate;
      }
    }
    return optimum;
  }