Check for p = 0.000.
518597
def check_p_equals_zero(text):
    """"""
    err = "psychology.p_equals_zero"
    msg = "Unless p really equals zero, you should use more decimal places."

    list = [
        "p = 0.00",
        "p = 0.000",
        "p = 0.0000",
    ]

    return existence_check(text, list, err, msg, join=True)
586311
def _validated(self, value):
        """"""
        if value is None:
            return None
        try:
            return self._format_num(value)
        except (TypeError, ValueError):
            self.fail('invalid', input=value)
        except OverflowError:
            self.fail('too_large', input=value)
1011383
private int samplePMF(double p[]) {

        double r = m_MetaRandom.nextDouble();

        double sum = 0.0;
        for (int i = 0; i < p.length; i++) {
            sum += p[i];
            if (r < sum) {
                return i;
            }
        }
        return -1;
    }
208648
def _check_above_value_float(string, minimum):
    
    value = float(string)

    if value < minimum:
        message = 'The Numeric Field value should be above %s' % minimum
        raise pp.ParseException(message)
880561
def value(self, t):
        """"""
        fraction = min(float(t) / max(1, self.schedule_timesteps), 1.0)
        return self.initial_p + fraction * (self.final_p - self.initial_p)
659278
def check_valid(line0, line1):
    
    data = line0.strip().split(b' ')
    if len(data) <= 2:
        return False
    # check if data[2:] is float values
    try:
        map(float, data[2:])
    except:
        return False
    return True
1213038
def evaluate(self, truth, predicted):
        
        correct = 0.0
        total = 0.0
        for i in range(len(truth)):
            if(truth[i] == predicted[i]):
                correct += 1
            total += 1
        return 1.0*correct/total
1016003
def _is_zero(x):
    
    if x is None:
        return True
    if isinstance(x, numbers.Number):
        return x == 0.0
    if isinstance(x, np.ndarray):
        return np.all(x == 0)
    return False
858496
def percentile(self, p):
        

        if not (0 <= p <= 100):
            raise ValueError("p must be between 0 and 100, inclusive.")

        p = float(p)/100.
        p *= self.n
        c_i = None
        t = 0

        if p == 0:
            return self.C.min_item()[1].mean

        for i, key in enumerate(self.C.keys()):
            c_i_plus_one = self.C[key]
            if i == 0:
                k = c_i_plus_one.count / 2

            else:
                k = (c_i_plus_one.count + c_i.count) / 2.
                if p < t + k:
                    z1 = p - t
                    z2 = t + k - p
                    return (c_i.mean * z2 + c_i_plus_one.mean * z1) / (z1 + z2)
            c_i = c_i_plus_one
            t += k

        return self.C.max_item()[1].mean
996146
function isSlowerThan(amount) {
  // always logging
  var diff = process.hrtime(this._start)
    , micro = Math.round(((diff[0] * 1e9) + diff[1]) / 1e3);
  if(amount === 0) return micro;
  if(micro > amount) {
    return micro;
  }
  return -1;
}
274108
def p_val(p):
    

    def val(s):
        try:
            x = float(s)
        except:
            x = 0
            warning(p.lineno(1), "Invalid string numeric constant '%s' evaluated as 0" % s)
        return x

    if p[2].type_ != TYPE.string:
        api.errmsg.syntax_error_expected_string(p.lineno(1), TYPE.to_string(p[2].type_))
        p[0] = None
    else:
        p[0] = make_builtin(p.lineno(1), 'VAL', p[2], lambda x: val(x), type_=TYPE.float_)
776606
function px (val) {
	try {
		val = parseFloat(parseLength(val).toFixed(4));
		if (val === 0) {
			return "0";
		} else {
			return val + "px";
		}
	} catch (ex) {
		return val;
	}
}
6241
function check_like_score(value) {
    if (value != null) {
        const res = parseInt(value, 10);
        if (!isNaN(res)) {
            return res;
        }
    }
    return 0;
}
951058
private boolean checkNlTin(final String ptin) {
    final int checkSum = ptin.charAt(8) - '0';
    int sum = 0;
    for (int i = 0; i < ptin.length() - 1; i++) {
      sum += (ptin.charAt(i) - '0') * (9 - i);
    }
    sum -= checkSum;
    return sum % 11 == 0;
  }
335223
def __find_a_zero(self):
        """"""
        row = -1
        col = -1
        i = 0
        n = self.n
        done = False

        while not done:
            j = 0
            while True:
                if (self.C[i][j] == 0) and \
                        (not self.row_covered[i]) and \
                        (not self.col_covered[j]):
                    row = i
                    col = j
                    done = True
                j += 1
                if j >= n:
                    break
            i += 1
            if i >= n:
                done = True

        return (row, col)
501986
def _q(self, number, precision='.00001'):
        """"""
        if np.isinf(number):
            return np.nan
        else:
            return D(D(number).quantize(D(precision)))
538875
def positive_nonzero_int(string):
    """"""
    error_msg = 'Positive non-zero integer required, {string} given.'.format(string=string)
    try:
        value = int(string)
    except ValueError:
        raise ArgumentTypeError(error_msg)
    if value <= 0:
        raise ArgumentTypeError(error_msg)
    return value