bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def acos(x): """acos(x) Return the arc cosine of x.""" return -(_prodi(log((x+(_i*sqrt((_one-(x*x))))))))
def x = _to_complex(x) acos(x): x = _to_complex(x) """acos(x) x = _to_complex(x) x = _to_complex(x) Return x = _to_complex(x) the x = _to_complex(x) arc x = _to_complex(x) cosine x = _to_complex(x) of x = _to_complex(x) x.""" x = _to_complex(x) x = _to_complex(x) return x = _to_complex(x) -(_prodi(log((x+(_i*sqrt((_o...
452,900
def asin(x): """asin(x) Return the arc sine of x.""" # -i * log[(sqrt(1-x**2) + i*x] squared = x*x sqrt_1_minus_x_sq = sqrt(_one-squared) return -(_prodi(log((sqrt_1_minus_x_sq+_prodi(x)))))
def x = _to_complex(x) asin(x): x = _to_complex(x) """asin(x) x = _to_complex(x) x = _to_complex(x) Return x = _to_complex(x) the x = _to_complex(x) arc x = _to_complex(x) sine x = _to_complex(x) of x = _to_complex(x) x.""" x = _to_complex(x) x = _to_complex(x) # x = _to_complex(x) -i x = _to_complex(x) * x = _to_com...
452,901
def asinh(x): """asinh(x) Return the hyperbolic arc sine of x.""" z = log((_sqrt_half * (sqrt(x+_i)+sqrt((x-_i))) )) return z+z
def x = _to_complex(x) asinh(x): x = _to_complex(x) """asinh(x) x = _to_complex(x) x = _to_complex(x) Return x = _to_complex(x) the x = _to_complex(x) hyperbolic x = _to_complex(x) arc x = _to_complex(x) sine x = _to_complex(x) of x = _to_complex(x) x.""" x = _to_complex(x) x = _to_complex(x) z x = _to_complex(x) = x...
452,902
def atan(x): """atan(x) Return the arc tangent of x.""" return _halfi*log(((_i+x)/(_i-x)))
def x = _to_complex(x) atan(x): x = _to_complex(x) """atan(x) x = _to_complex(x) x = _to_complex(x) Return x = _to_complex(x) the x = _to_complex(x) arc x = _to_complex(x) tangent x = _to_complex(x) of x = _to_complex(x) x.""" x = _to_complex(x) x = _to_complex(x) return x = _to_complex(x) _halfi*log(((_i+x)/(_i-x)))...
452,903
def atanh(x): """atanh(x) Return the hyperbolic arc tangent of x.""" return _half*log((_one+x)/(_one-x))
def x = _to_complex(x) atanh(x): x = _to_complex(x) """atanh(x) x = _to_complex(x) x = _to_complex(x) Return x = _to_complex(x) the x = _to_complex(x) hyperbolic x = _to_complex(x) arc x = _to_complex(x) tangent x = _to_complex(x) of x = _to_complex(x) x.""" x = _to_complex(x) x = _to_complex(x) return x = _to_comple...
452,904
def cos(x): """cos(x) Return the cosine of x.""" x = complex(x, 0) real = math.cos(x.real) * math.cosh(x.imag) imag = -math.sin(x.real) * math.sinh(x.imag) return complex(real, imag)
def cos(x): """cos(x) Return the cosine of x.""" x = _to_complex(x) real = math.cos(x.real) * math.cosh(x.imag) imag = -math.sin(x.real) * math.sinh(x.imag) return complex(real, imag)
452,905
def cosh(x): """cosh(x) Return the hyperbolic cosine of x.""" x = complex(x, 0) real = math.cos(x.imag) * math.cosh(x.real) imag = math.sin(x.imag) * math.sinh(x.real) return complex(real, imag)
def cosh(x): """cosh(x) Return the hyperbolic cosine of x.""" x = _to_complex(x) real = math.cos(x.imag) * math.cosh(x.real) imag = math.sin(x.imag) * math.sinh(x.real) return complex(real, imag)
452,906
def exp(x): """exp(x) Return the exponential value e**x.""" x = complex(x, 0) l = math.exp(x.real) real = l * math.cos(x.imag) imag = l * math.sin(x.imag) return complex(real, imag)
def exp(x): """exp(x) Return the exponential value e**x.""" x = _to_complex(x) l = math.exp(x.real) real = l * math.cos(x.imag) imag = l * math.sin(x.imag) return complex(real, imag)
452,907
def log(x, base=None): """log(x) Return the natural logarithm of x.""" if base is not None: return log(x) / log(base) x = complex(x, 0) l = math.hypot(x.real,x.imag) imag = math.atan2(x.imag, x.real) real = math.log(l) return complex(real, imag)
def log(x, base=None): """log(x) Return the natural logarithm of x.""" if base is not None: return log(x) / log(base) x = _to_complex(x) l = math.hypot(x.real,x.imag) imag = math.atan2(x.imag, x.real) real = math.log(l) return complex(real, imag)
452,908
def log10(x): """log10(x) Return the base-10 logarithm of x.""" x = complex(x, 0) l = math.hypot(x.real, x.imag) imag = math.atan2(x.imag, x.real)/math.log(10.) real = math.log10(l) return complex(real, imag)
def log10(x): """log10(x) Return the base-10 logarithm of x.""" x = _to_complex(x) l = math.hypot(x.real, x.imag) imag = math.atan2(x.imag, x.real)/math.log(10.) real = math.log10(l) return complex(real, imag)
452,909
def sin(x): """sin(x) Return the sine of x.""" x = complex(x, 0) real = math.sin(x.real) * math.cosh(x.imag) imag = math.cos(x.real) * math.sinh(x.imag) return complex(real, imag)
def sin(x): """sin(x) Return the sine of x.""" x = _to_complex(x) real = math.sin(x.real) * math.cosh(x.imag) imag = math.cos(x.real) * math.sinh(x.imag) return complex(real, imag)
452,910
def sinh(x): """sinh(x) Return the hyperbolic sine of x.""" x = complex(x, 0) real = math.cos(x.imag) * math.sinh(x.real) imag = math.sin(x.imag) * math.cosh(x.real) return complex(real, imag)
def sinh(x): """sinh(x) Return the hyperbolic sine of x.""" x = _to_complex(x) real = math.cos(x.imag) * math.sinh(x.real) imag = math.sin(x.imag) * math.cosh(x.real) return complex(real, imag)
452,911
def sqrt(x): """sqrt(x) Return the square root of x.""" x = complex(x, 0) if x.real == 0. and x.imag == 0.: real, imag = 0, 0 else: s = math.sqrt(0.5*(math.fabs(x.real) + math.hypot(x.real,x.imag))) d = 0.5*x.imag/s if x.real > 0.: real = s imag = d elif x.imag >= 0.: real = d imag = s else: real = -d imag = -s retur...
def sqrt(x): """sqrt(x) Return the square root of x.""" x = _to_complex(x) if x.real == 0. and x.imag == 0.: real, imag = 0, 0 else: s = math.sqrt(0.5*(math.fabs(x.real) + math.hypot(x.real,x.imag))) d = 0.5*x.imag/s if x.real > 0.: real = s imag = d elif x.imag >= 0.: real = d imag = s else: real = -d imag = -s retu...
452,912
def tan(x): """tan(x) Return the tangent of x.""" x = complex(x, 0) sr = math.sin(x.real) cr = math.cos(x.real) shi = math.sinh(x.imag) chi = math.cosh(x.imag) rs = sr * chi is_ = cr * shi rc = cr * chi ic = -sr * shi d = rc*rc + ic * ic real = (rs*rc + is_*ic) / d imag = (is_*rc - rs*ic) / d return complex(real, ima...
def tan(x): """tan(x) Return the tangent of x.""" x = _to_complex(x) sr = math.sin(x.real) cr = math.cos(x.real) shi = math.sinh(x.imag) chi = math.cosh(x.imag) rs = sr * chi is_ = cr * shi rc = cr * chi ic = -sr * shi d = rc*rc + ic * ic real = (rs*rc + is_*ic) / d imag = (is_*rc - rs*ic) / d return complex(real, im...
452,913
def __init__(self, cc=None): if cc is None: cc = 'gcc' self.cc = cc
def __init__(self, cc=None): if cc is None: try: cc = os.environ['CC'] except KeyError: cc = 'gcc' self.cc = cc
452,914
def c_type_descr__call__(space, w_type, __args__): if not isinstance(w_type, W_PyCTypeObject): # XXX is this possible? w_type = _precheck_for_new(space, w_type) return call__Type(space, w_type, __args__) pyo = make_ref(space, w_type) pto = rffi.cast(PyTypeObjectPtr, pyo) tp_new = pto.c_tp_new try: if not tp_new: raise...
def c_type_descr__call__(space, w_type, __args__): if not isinstance(w_type, W_PyCTypeObject): # XXX is this possible? w_type = _precheck_for_new(space, w_type) return call__Type(space, w_type, __args__) pyo = make_ref(space, w_type) pto = rffi.cast(PyTypeObjectPtr, pyo) tp_new = pto.c_tp_new try: if not tp_new: raise...
452,915
def test_simple_sums(self): ast = self.ast mod = self.get_ast("x = 4 + 5") expr = mod.body[0].value assert isinstance(expr, ast.BinOp) assert isinstance(expr.op, ast.Add) expr.op = ast.Sub() assert isinstance(expr.op, ast.Sub) co = compile(mod, "<example>", "exec") ns = {} exec co in ns assert ns["x"] == -1 mod = self....
def test_simple_sums(self): ast = self.ast mod = self.get_ast("x = 4 + 5") expr = mod.body[0].value assert isinstance(expr, ast.BinOp) assert isinstance(expr.op, ast.Add) expr.op = ast.Sub() assert isinstance(expr.op, ast.Sub) co = compile(mod, "<example>", "exec") ns = {} exec co in ns assert ns["x"] == -1 mod = self....
452,916
def setstate_w(self, space, w_state): w_buffer, w_flag = space.unpackiterable(w_state, 2) flag = space.r_longlong_w(w_flag) self.pendingcr = (flag & 1) flag >>= 1
def setstate_w(self, space, w_state): w_buffer, w_flag = space.unpackiterable(w_state, 2) flag = space.r_longlong_w(w_flag) self.pendingcr = bool(flag & 1) flag >>= 1
452,917
def browse_nightly(branch, baseurl=BASEURL, override_xml=None): if override_xml is None: url = baseurl + branch + '/' xml = urllib2.urlopen(url).read() else: xml = override_xml dom = minidom.parseString(xml) refs = [node.getAttribute('href') for node in dom.getElementsByTagName('a')] # all refs are of form: pypy-{type}...
def browse_nightly(branch, baseurl=BASEURL, override_xml=None): if override_xml is None: url = baseurl + branch + '/' xml = urllib2.urlopen(url).read() else: xml = override_xml dom = minidom.parseString(xml) refs = [node.getAttribute('href') for node in dom.getElementsByTagName('a') if 'pypy' in node.getAttribute('href...
452,918
def PyErr_PrintEx(space, set_sys_last_vars): """Print a standard traceback to sys.stderr and clear the error indicator. Call this function only when the error indicator is set. (Otherwise it will cause a fatal error!) If set_sys_last_vars is nonzero, the variables sys.last_type, sys.last_value and sys.last_traceback ...
def PyErr_PrintEx(space, set_sys_last_vars): """Print a standard traceback to sys.stderr and clear the error indicator. Call this function only when the error indicator is set. (Otherwise it will cause a fatal error!) If set_sys_last_vars is nonzero, the variables sys.last_type, sys.last_value and sys.last_traceback ...
452,919
def PyErr_PrintEx(space, set_sys_last_vars): """Print a standard traceback to sys.stderr and clear the error indicator. Call this function only when the error indicator is set. (Otherwise it will cause a fatal error!) If set_sys_last_vars is nonzero, the variables sys.last_type, sys.last_value and sys.last_traceback ...
def PyErr_PrintEx(space, set_sys_last_vars): """Print a standard traceback to sys.stderr and clear the error indicator. Call this function only when the error indicator is set. (Otherwise it will cause a fatal error!) If set_sys_last_vars is nonzero, the variables sys.last_type, sys.last_value and sys.last_traceback ...
452,920
def PyErr_PrintEx(space, set_sys_last_vars): """Print a standard traceback to sys.stderr and clear the error indicator. Call this function only when the error indicator is set. (Otherwise it will cause a fatal error!) If set_sys_last_vars is nonzero, the variables sys.last_type, sys.last_value and sys.last_traceback ...
def PyErr_PrintEx(space, set_sys_last_vars): """Print a standard traceback to sys.stderr and clear the error indicator. Call this function only when the error indicator is set. (Otherwise it will cause a fatal error!) If set_sys_last_vars is nonzero, the variables sys.last_type, sys.last_value and sys.last_traceback ...
452,921
def _dispatch_loop(self): code = self.code.co_code instr_index = 0 while True: jitdriver.jit_merge_point(code=code, instr_index=instr_index, frame=self) self.stack_depth = hint(self.stack_depth, promote=True) op = ord(code[instr_index]) instr_index += 1 if op >= opcode.HAVE_ARGUMENT: low = ord(code[instr_index]) hi = o...
def _dispatch_loop(self): code = self.code.co_code instr_index = 0 while True: jitdriver.jit_merge_point(code=code, instr_index=instr_index, frame=self) self.stack_depth = hint(self.stack_depth, promote=True) op = ord(code[instr_index]) instr_index += 1 if op >= HAVE_ARGUMENT: low = ord(code[instr_index]) hi = ord(code...
452,922
def main(x): s = 0 d = {} for i in range(x): s += g(**d) d[str(i)] = i if i % 100 == 99: d = {} return s
def main(x): s = 0 d = {} for i in range(x): s += g(**d) d[str(i)] = i if i % 100 == 99: d = {} return s
452,923
def main(n): i = 2 l = [] while i < n: i += 1 l.append(i) return i, len(l)
def main(n): i = 2 l = [] while i < n: i += 1 l.append(i) return i, len(l)
452,924
def main(n): i = 2 l = [] while i < n: i += 1 l.append(i) return i, len(l)
def main(n): i = 2 l = [] while i < n: i += 1 l.append(i) return i, len(l)
452,925
def wrap_setattr(space, w_self, w_args, func): func_target = rffi.cast(setattrofunc, func) check_num_args(space, w_args, 2) w_name, w_value = space.fixedview(w_args) # XXX "Carlo Verre hack"? if generic_cpy_call(space, func_target, w_self, w_name, w_value) < 0: space.fromcache(State).check_and_raise_exception(always=Tr...
def wrap_setattr(space, w_self, w_args, func): func_target = rffi.cast(setattrofunc, func) check_num_args(space, w_args, 2) w_name, w_value = space.fixedview(w_args) # XXX "Carlo Verre hack"? res = generic_cpy_call(space, func_target, w_self, w_name, w_value) if rffi.cast(lltype.Signed, res) == -1: space.fromcache(Stat...
452,926
def wrap_setattr(space, w_self, w_args, func): func_target = rffi.cast(setattrofunc, func) check_num_args(space, w_args, 2) w_name, w_value = space.fixedview(w_args) # XXX "Carlo Verre hack"? if generic_cpy_call(space, func_target, w_self, w_name, w_value) < 0: space.fromcache(State).check_and_raise_exception(always=Tr...
def wrap_setattr(space, w_self, w_args, func): func_target = rffi.cast(setattrofunc, func) check_num_args(space, w_args, 2) w_name, w_value = space.fixedview(w_args) # XXX "Carlo Verre hack"? if generic_cpy_call(space, func_target, w_self, w_name, w_value) < 0: space.fromcache(State).check_and_raise_exception(always=Tr...
452,927
def wrap_delattr(space, w_self, w_args, func): func_target = rffi.cast(setattrofunc, func) check_num_args(space, w_args, 1) w_name, = space.fixedview(w_args) # XXX "Carlo Verre hack"? if generic_cpy_call(space, func_target, w_self, w_name, None) < 0: space.fromcache(State).check_and_raise_exception(always=True) return ...
def wrap_delattr(space, w_self, w_args, func): func_target = rffi.cast(setattrofunc, func) check_num_args(space, w_args, 1) w_name, = space.fixedview(w_args) # XXX "Carlo Verre hack"? res = generic_cpy_call(space, func_target, w_self, w_name, None) if rffi.cast(lltype.Signed, res) == -1: space.fromcache(State).check_an...
452,928
def wrap_delattr(space, w_self, w_args, func): func_target = rffi.cast(setattrofunc, func) check_num_args(space, w_args, 1) w_name, = space.fixedview(w_args) # XXX "Carlo Verre hack"? if generic_cpy_call(space, func_target, w_self, w_name, None) < 0: space.fromcache(State).check_and_raise_exception(always=True) return ...
def wrap_delattr(space, w_self, w_args, func): func_target = rffi.cast(setattrofunc, func) check_num_args(space, w_args, 1) w_name, = space.fixedview(w_args) # XXX "Carlo Verre hack"? if generic_cpy_call(space, func_target, w_self, w_name, None) < 0: space.fromcache(State).check_and_raise_exception(always=True)
452,929
def wrap_encoder(space, uni, errors="strict"): state = space.fromcache(CodecState) func = getattr(runicode, rname) result = func(uni, len(uni), errors, state.encode_error_handler) return space.newtuple([space.wrap(result), space.wrap(len(uni))])
def wrap_encoder(space, uni, errors="strict"): state = space.fromcache(CodecState) func = getattr(runicode, rname) result = func(uni, len(uni), errors, state.encode_error_handler) return space.newtuple([space.wrap(result), space.wrap(len(uni))])
452,930
def wrap_decoder(space, string, errors="strict", w_final=False): final = space.is_true(w_final) state = space.fromcache(CodecState) func = getattr(runicode, rname) result, consumed = func(string, len(string), errors, final, state.decode_error_handler) return space.newtuple([space.wrap(result), space.wrap(consumed)])
def wrap_decoder(space, string, errors="strict", w_final=False): final = space.is_true(w_final) state = space.fromcache(CodecState) func = getattr(runicode, rname) result, consumed = func(string, len(string), errors, final, state.decode_error_handler) return space.newtuple([space.wrap(result), space.wrap(consumed)])
452,931
def __init__(self, cpu, jd): self.cpu = cpu self.jitdriver_sd = jd # XXX for now, only supports a single instance, # but several fields of it can be green seen = set() for name in jd.jitdriver.greens: if '.' in name: objname, fieldname = name.split('.') seen.add(objname) assert len(seen) == 1, ( "Current limitation: yo...
def __init__(self, cpu, jd): self.cpu = cpu self.jitdriver_sd = jd # XXX for now, only supports a single instance, # but several fields of it can be green seen = set() for name in jd.jitdriver.greens: if '.' in name: objname, fieldname = name.split('.') seen.add(objname) assert len(seen) == 1, ( "Current limitation: yo...
452,932
def repr__Complex(space, w_complex): print "AFA REPR", (w_complex, w_complex.realval, w_complex.imagval) if w_complex.realval == 0 and math.copysign(1., w_complex.realval) == 1.: return space.wrap(repr_format(w_complex.imagval) + 'j') sign = (math.copysign(1., w_complex.imagval) == 1.) and '+' or '' return space.wrap('...
def repr__Complex(space, w_complex): if w_complex.realval == 0 and math.copysign(1., w_complex.realval) == 1.: return space.wrap(repr_format(w_complex.imagval) + 'j') sign = (math.copysign(1., w_complex.imagval) == 1.) and '+' or '' return space.wrap('(' + repr_format(w_complex.realval) + sign + repr_format(w_complex.i...
452,933
def decode_mode(space, mode): flags = 0 rwa = False readable = False writable = False append = False plus = False for s in mode: if s == 'r': if rwa: _bad_mode(space) rwa = True readable = True elif s == 'w': if rwa: _bad_mode(space) rwa = True writable = True flags |= os.O_CREAT | os.O_TRUNC elif s == 'a': if rwa: _b...
def decode_mode(space, mode): flags = 0 rwa = False readable = False writable = False append = False plus = False for s in mode: if s == 'r': if rwa: _bad_mode(space) rwa = True readable = True elif s == 'w': if rwa: _bad_mode(space) rwa = True writable = True flags |= O_CREAT | O_TRUNC elif s == 'a': if rwa: _bad_mod...
452,934
def decode_mode(space, mode): flags = 0 rwa = False readable = False writable = False append = False plus = False for s in mode: if s == 'r': if rwa: _bad_mode(space) rwa = True readable = True elif s == 'w': if rwa: _bad_mode(space) rwa = True writable = True flags |= os.O_CREAT | os.O_TRUNC elif s == 'a': if rwa: _b...
def decode_mode(space, mode): flags = 0 rwa = False readable = False writable = False append = False plus = False for s in mode: if s == 'r': if rwa: _bad_mode(space) rwa = True readable = True elif s == 'w': if rwa: _bad_mode(space) rwa = True writable = True flags |= O_CREAT | os.O_TRUNC elif s == 'a': if rwa: _bad_...
452,935
def decode_mode(space, mode): flags = 0 rwa = False readable = False writable = False append = False plus = False for s in mode: if s == 'r': if rwa: _bad_mode(space) rwa = True readable = True elif s == 'w': if rwa: _bad_mode(space) rwa = True writable = True flags |= os.O_CREAT | os.O_TRUNC elif s == 'a': if rwa: _b...
def decode_mode(space, mode): flags = 0 rwa = False readable = False writable = False append = False plus = False for s in mode: if s == 'r': if rwa: _bad_mode(space) rwa = True readable = True elif s == 'w': if rwa: _bad_mode(space) rwa = True writable = True flags |= os.O_CREAT | os.O_TRUNC elif s == 'a': if rwa: _b...
452,936
def decode_mode(space, mode): flags = 0 rwa = False readable = False writable = False append = False plus = False for s in mode: if s == 'r': if rwa: _bad_mode(space) rwa = True readable = True elif s == 'w': if rwa: _bad_mode(space) rwa = True writable = True flags |= os.O_CREAT | os.O_TRUNC elif s == 'a': if rwa: _b...
def decode_mode(space, mode): flags = 0 rwa = False readable = False writable = False append = False plus = False for s in mode: if s == 'r': if rwa: _bad_mode(space) rwa = True readable = True elif s == 'w': if rwa: _bad_mode(space) rwa = True writable = True flags |= os.O_CREAT | os.O_TRUNC elif s == 'a': if rwa: _b...
452,937
def decode_mode(space, mode): flags = 0 rwa = False readable = False writable = False append = False plus = False for s in mode: if s == 'r': if rwa: _bad_mode(space) rwa = True readable = True elif s == 'w': if rwa: _bad_mode(space) rwa = True writable = True flags |= os.O_CREAT | os.O_TRUNC elif s == 'a': if rwa: _b...
def decode_mode(space, mode): flags = 0 rwa = False readable = False writable = False append = False plus = False for s in mode: if s == 'r': if rwa: _bad_mode(space) rwa = True readable = True elif s == 'w': if rwa: _bad_mode(space) rwa = True writable = True flags |= os.O_CREAT | os.O_TRUNC elif s == 'a': if rwa: _b...
452,938
def decode_mode(space, mode): flags = 0 rwa = False readable = False writable = False append = False plus = False for s in mode: if s == 'r': if rwa: _bad_mode(space) rwa = True readable = True elif s == 'w': if rwa: _bad_mode(space) rwa = True writable = True flags |= os.O_CREAT | os.O_TRUNC elif s == 'a': if rwa: _b...
def decode_mode(space, mode): flags = 0 rwa = False readable = False writable = False append = False plus = False for s in mode: if s == 'r': if rwa: _bad_mode(space) rwa = True readable = True elif s == 'w': if rwa: _bad_mode(space) rwa = True writable = True flags |= os.O_CREAT | os.O_TRUNC elif s == 'a': if rwa: _b...
452,939
def decode_mode(space, mode): flags = 0 rwa = False readable = False writable = False append = False plus = False for s in mode: if s == 'r': if rwa: _bad_mode(space) rwa = True readable = True elif s == 'w': if rwa: _bad_mode(space) rwa = True writable = True flags |= os.O_CREAT | os.O_TRUNC elif s == 'a': if rwa: _b...
def decode_mode(space, mode): flags = 0 rwa = False readable = False writable = False append = False plus = False for s in mode: if s == 'r': if rwa: _bad_mode(space) rwa = True readable = True elif s == 'w': if rwa: _bad_mode(space) rwa = True writable = True flags |= os.O_CREAT | os.O_TRUNC elif s == 'a': if rwa: _b...
452,940
def _normalizedcontainer(self): return self._ptr._obj
def _normalizedcontainer(self): return self._ptr._obj
452,941
def genop_float_is_true(self, op, arglocs, resloc): loc0, loc1 = arglocs self.mc.XORPD(loc0, loc0) self.mc.UCOMISD(loc0, loc1) self.mc.SETNE(lower_byte(resloc)) self.mc.MOVZX(resloc, lower_byte(resloc))
def genop_float_is_true(self, op, arglocs, resloc): loc0, loc1 = arglocs self.mc.XORPD(loc0, loc0) self.mc.UCOMISD(loc0, loc1) self.mc.SETNE(lower_byte(resloc)) self.mc.MOVZX(resloc, lower_byte(resloc))
452,942
def main(n): i = 0 a = A(1) while i < n: x = a.f(i) i = a.f(x) return i
def main(n): i = 0 a = A(1) while i < n: x = a.f(i) i = a.f(x) return i
452,943
def strptime(cls, date_string, format): 'string, format -> new datetime parsed from a string (like time.strptime()).' return cls(*_time.strptime(date_string, format)[0:6])
def strptime(cls, date_string, format): 'string, format -> new datetime parsed from a string (like time.strptime()).' return cls(*_time.strptime(date_string, format)[0:6])
452,944
def names_and_fields(_fields_, superclass, zero_offset=False, anon=None, is_union=False): # _fields_: list of (name, ctype, [optional_bitfield]) if isinstance(_fields_, tuple): _fields_ = list(_fields_) for f in _fields_: tp = f[1] if not isinstance(tp, _CDataMeta): raise TypeError("Expected CData subclass, got %s" % (...
def names_and_fields(_fields_, superclass, zero_offset=False, anon=None, is_union=False): # _fields_: list of (name, ctype, [optional_bitfield]) if isinstance(_fields_, tuple): _fields_ = list(_fields_) for f in _fields_: tp = f[1] if not isinstance(tp, _CDataMeta): raise TypeError("Expected CData subclass, got %s" % (...
452,945
def test_find_functions_darwin(): source = """\
def test_find_functions_darwin(): source = """\
452,946
def test_find_functions_darwin(): source = """\
def test_find_functions_darwin(): source = """\
452,947
def f(): return virtual_ref(X())
def f(): return virtual_ref(X())
452,948
def f(n): if n > 0: return virtual_ref(Y()) else: return non_virtual_ref(Z())
def f(n): if n > 0: return virtual_ref(Y()) else: return non_virtual_ref(Z())
452,949
def f(n): if n > 0: return virtual_ref(X()) else: return vref_None
def f(n): if n > 0: return virtual_ref(X()) else: return vref_None
452,950
def addsitepackages(known_paths): """Add site-packages to sys.path, in a PyPy-specific way.""" if hasattr(sys, 'pypy_version_info'): from distutils.sysconfig import get_python_lib sitedir = get_python_lib(standard_lib=False) if os.path.isdir(sitedir): addsitedir(sitedir, known_paths) return None
def addsitepackages(known_paths): """Add site-packages to sys.path, in a PyPy-specific way.""" if hasattr(sys, 'pypy_version_info') and hasattr(sys, 'prefix'): from distutils.sysconfig import get_python_lib sitedir = get_python_lib(standard_lib=False) if os.path.isdir(sitedir): addsitedir(sitedir, known_paths) return N...
452,951
def _make_signed_32(v): if v >= 0x80000000: v -= 0x100000000 return int(v)
def _make_signed_32(v): if v >= 0x80000000: v -= 0x100000000 return int(v)
452,952
def bit_length(space, w_obj): try: return space.wrap(w_obj.num.bit_length()) except OverflowError: raise OperationError(space.w_OverflowError, space.wrap("too many digits in integer"))
def bit_length(space, w_obj): try: return space.wrap(bigint.bit_length()) except OverflowError: raise OperationError(space.w_OverflowError, space.wrap("too many digits in integer"))
452,953
def cpython_struct(name, fields, forward=None): configname = name.replace(' ', '__') setattr(CConfig, configname, rffi_platform.Struct(name, fields)) if forward is None: forward = lltype.ForwardReference() TYPES[configname] = forward return forward
def cpython_struct(name, fields, forward=None): configname = name.replace(' ', '__') setattr(CConfig, configname, rffi_platform.Struct(name, fields)) if forward is None: forward = lltype.ForwardReference() TYPES[configname] = forward return forward
452,954
def __init__(self, cpu, translate_support_code=False, failargs_limit=1000): self.cpu = cpu self.verbose = False self.rtyper = cpu.rtyper self.malloc_func_addr = 0 self.malloc_array_func_addr = 0 self.malloc_str_func_addr = 0 self.malloc_unicode_func_addr = 0 self.fail_boxes_int = values_array(lltype.Signed, failargs_li...
def __init__(self, cpu, translate_support_code=False, failargs_limit=1000): self.cpu = cpu self.verbose = False self.rtyper = cpu.rtyper self.malloc_func_addr = 0 self.malloc_array_func_addr = 0 self.malloc_str_func_addr = 0 self.malloc_unicode_func_addr = 0 self.fail_boxes_int = values_array(lltype.Signed, failargs_li...
452,955
def _build_malloc_fixedsize_slowpath(self): # ---------- first helper for the slow path of malloc ---------- mc = codebuf.MachineCodeBlockWrapper() if self.cpu.supports_floats: # save the XMM registers in for i in range(self.cpu.NUM_REGS):# the *caller* frame, from esp+8 mc.MOVSD_sx((WORD*2)+8*i, i) mc.SUB_rr(...
def _build_malloc_fixedsize_slowpath(self): # ---------- first helper for the slow path of malloc ---------- mc = codebuf.MachineCodeBlockWrapper() if self.cpu.supports_floats: # save the XMM registers in for i in range(self.cpu.NUM_REGS):# the *caller* frame, from esp+8 mc.MOVSD_sx((WORD*2)+8*i, i) mc.SUB_rr(...
452,956
def _build_stack_check_slowpath(self): from pypy.rlib import rstack mc = codebuf.MachineCodeBlockWrapper() mc.PUSH_r(ebp.value) mc.MOV_rr(ebp.value, esp.value) # if IS_X86_64: # on the x86_64, we have to save all the registers that may # have been used to pass arguments for reg in [edi, esi, edx, ecx, r8, r9]: mc.PUSH_...
def _build_stack_check_slowpath(self): from pypy.rlib import rstack mc = codebuf.MachineCodeBlockWrapper() mc.PUSH_r(ebp.value) mc.MOV_rr(ebp.value, esp.value) # if IS_X86_64: # on the x86_64, we have to save all the registers that may # have been used to pass arguments for reg in [edi, esi, edx, ecx, r8, r9]: mc.PUSH_...
452,957
def _build_stack_check_slowpath(self): from pypy.rlib import rstack mc = codebuf.MachineCodeBlockWrapper() mc.PUSH_r(ebp.value) mc.MOV_rr(ebp.value, esp.value) # if IS_X86_64: # on the x86_64, we have to save all the registers that may # have been used to pass arguments for reg in [edi, esi, edx, ecx, r8, r9]: mc.PUSH_...
def _build_stack_check_slowpath(self): from pypy.rlib import rstack mc = codebuf.MachineCodeBlockWrapper() mc.PUSH_r(ebp.value) mc.MOV_rr(ebp.value, esp.value) # if IS_X86_64: # on the x86_64, we have to save all the registers that may # have been used to pass arguments for reg in [edi, esi, edx, ecx, r8, r9]: mc.PUSH_...
452,958
def _build_stack_check_slowpath(self): from pypy.rlib import rstack mc = codebuf.MachineCodeBlockWrapper() mc.PUSH_r(ebp.value) mc.MOV_rr(ebp.value, esp.value) # if IS_X86_64: # on the x86_64, we have to save all the registers that may # have been used to pass arguments for reg in [edi, esi, edx, ecx, r8, r9]: mc.PUSH_...
def _build_stack_check_slowpath(self): from pypy.rlib import rstack mc = codebuf.MachineCodeBlockWrapper() mc.PUSH_r(ebp.value) mc.MOV_rr(ebp.value, esp.value) # if IS_X86_64: # on the x86_64, we have to save all the registers that may # have been used to pass arguments for reg in [edi, esi, edx, ecx, r8, r9]: mc.PUSH_...
452,959
def _call_header_with_stack_check(self): startaddr, length, slowpathaddr = self.cpu.insert_stack_check() if slowpathaddr == 0: pass # no stack check (e.g. not translated) else: self.mc.MOV(eax, esp) # MOV eax, current self.mc.SUB(eax, heap(startaddr)) # SUB eax, [startaddr...
def _call_header_with_stack_check(self): if self.stack_check_slowpath == 0: pass # no stack check (e.g. not translated) else: self.mc.MOV(eax, esp) # MOV eax, current self.mc.SUB(eax, heap(startaddr)) # SUB eax, [startaddr] self.mc.CMP(eax, imm(length)) # CMP...
452,960
def _call_header_with_stack_check(self): startaddr, length, slowpathaddr = self.cpu.insert_stack_check() if slowpathaddr == 0: pass # no stack check (e.g. not translated) else: self.mc.MOV(eax, esp) # MOV eax, current self.mc.SUB(eax, heap(startaddr)) # SUB eax, [startaddr...
def _call_header_with_stack_check(self): startaddr, length, slowpathaddr = self.cpu.insert_stack_check() if slowpathaddr == 0: pass # no stack check (e.g. not translated) else: self.mc.MOV(eax, esp) # MOV eax, current self.mc.SUB(eax, heap(startaddr)) # SUB eax, [startaddr...
452,961
def epoll_ctl(self, ctl, w_fd, eventmask, ignore_ebadf=False): fd = as_fd_w(self.space, w_fd) with lltype.scoped_alloc(epoll_event) as ev: ev.c_events = rffi.cast(rffi.UINT, eventmask) ev.c_data.c_fd = fd
def epoll_ctl(self, ctl, w_fd, eventmask, ignore_ebadf=False): fd = as_fd_w(self.space, w_fd) with lltype.scoped_alloc(epoll_event) as ev: ev.c_events = rffi.cast(rffi.UINT, eventmask) ev.c_data.c_fd = fd
452,962
def entry_point(argv): l = [] for i in range(int(argv[1])): l.append("x" * int(argv[2])) return int(len(l) > 1000)
def entry_point(argv): l = [] for i in range(int(argv[1])): l.append("x" * int(argv[2])) return int(len(l) > 1000)
452,963
def get_build_version(): """Return the version of MSVC that was used to build Python. For Python 2.3 and up, the version number is included in sys.version. For earlier versions, assume the compiler is MSVC 6. """ return 8.0
def get_build_version(): """Return the version of MSVC that was used to build Python. For Python 2.3 and up, the version number is included in sys.version. For earlier versions, assume the compiler is MSVC 6. """ return 9.0
452,964
def ioctl_w(self, space, cmd, w_option): from pypy.rpython.lltypesystem import rffi, lltype from pypy.rlib import rwin32 from pypy.rlib.rsocket import _c
def ioctl_w(self, space, cmd, w_option): from pypy.rpython.lltypesystem import rffi, lltype from pypy.rlib import rwin32 from pypy.rlib.rsocket import _c
452,965
def ioctl_w(self, space, cmd, w_option): from pypy.rpython.lltypesystem import rffi, lltype from pypy.rlib import rwin32 from pypy.rlib.rsocket import _c
def ioctl_w(self, space, cmd, w_option): from pypy.rpython.lltypesystem import rffi, lltype from pypy.rlib import rwin32 from pypy.rlib.rsocket import _c
452,966
def ioctl_w(self, space, cmd, w_option): from pypy.rpython.lltypesystem import rffi, lltype from pypy.rlib import rwin32 from pypy.rlib.rsocket import _c
def ioctl_w(self, space, cmd, w_option): from pypy.rpython.lltypesystem import rffi, lltype from pypy.rlib import rwin32 from pypy.rlib.rsocket import _c
452,967
def _get_decoded_chars(self, size): if self.decoded_chars is None: return u""
def _get_decoded_chars(self, size): if self.decoded_chars is None: return u""
452,968
def _preprocess_include_dirs(self, include_dirs): res_incl_dirs = list(include_dirs) res_incl_dirs.append('/usr/local/include') return res_incl_dirs
def _preprocess_include_dirs(self, include_dirs): res_incl_dirs = list(include_dirs) res_incl_dirs.append(os.path.join(get_env("LOCALBASE", "/usr/local"), "include")) return res_incl_dirs
452,969
def _preprocess_library_dirs(self, library_dirs): res_lib_dirs = list(library_dirs) res_lib_dirs.append('/usr/local/lib') return res_lib_dirs
def _preprocess_library_dirs(self, library_dirs): res_lib_dirs = list(library_dirs) res_lib_dirs.append(os.path.join(get_env("LOCALBASE", "/usr/local"), "lib")) return res_lib_dirs
452,970
def include_dirs_for_libffi(self): return ['/usr/local/include']
def include_dirs_for_libffi(self): return ['/usr/local/include']
452,971
def library_dirs_for_libffi(self): return ['/usr/local/lib']
def library_dirs_for_libffi(self): return ['/usr/local/lib']
452,972
def library_dirs_for_libffi(self): return ['/usr/local/lib']
def library_dirs_for_libffi(self): return ['/usr/local/lib']
452,973
def descr_init(self, space, w_name, mode='r', closefd=True): if space.isinstance_w(w_name, space.w_float): raise OperationError(space.w_TypeError, space.wrap( "integer argument expected, got float"))
def descr_init(self, space, w_name, mode='r', closefd=True): if space.isinstance_w(w_name, space.w_float): raise OperationError(space.w_TypeError, space.wrap( "integer argument expected, got float"))
452,974
def isatty_w(self, space): self._check_closed(space) try: res = os.isatty(self.fd) except OSError, e: raise wrap_oserror(space, e) return space.wrap(res)
def isatty_w(self, space): self._check_closed(space) try: res = os.isatty(self.fd) except OSError, e: raise wrap_oserror(space, e, exception_name='w_IOError') return space.wrap(res)
452,975
def write_w(self, space, w_data): self._check_closed(space) # XXX self._check_writable(space) data = space.str_w(w_data)
defself._check_writable(space) write_w(self,self._check_writable(space) space,self._check_writable(space) w_data):self._check_writable(space) self._check_closed(space)self._check_writable(space) #self._check_writable(space) XXXself._check_writable(space) self._check_writable(space)self._check_writable(space) dataself._...
452,976
def read_w(self, space, w_size=None): self._check_closed(space) # XXX self._check_readable(space) size = convert_size(space, w_size)
defself._check_readable(space) read_w(self,self._check_readable(space) space,self._check_readable(space) w_size=None):self._check_readable(space) self._check_closed(space)self._check_readable(space) #self._check_readable(space) XXXself._check_readable(space) self._check_readable(space)self._check_readable(space) sizese...
452,977
def readinto_w(self, space, w_buffer): self._check_closed(space)
def readinto_w(self, space, w_buffer): self._check_closed(space)
452,978
def truncate_w(self, space, w_size=None): if space.is_w(w_size, space.w_None): w_size = self.tell_w(space)
def truncate_w(self, space, w_size=None): if space.is_w(w_size, space.w_None): w_size = self.tell_w(space)
452,979
def c_type_descr__call__(space, w_type, __args__): if isinstance(w_type, W_PyCTypeObject): pyo = make_ref(space, w_type) pto = rffi.cast(PyTypeObjectPtr, pyo) tp_new = pto.c_tp_new try: if not tp_new: raise operationerrfmt(space.w_TypeError, "cannot create '%s' instances", w_type.getname(space, '?')) args_w, kw_w = __...
def c_type_descr__call__(space, w_type, __args__): if isinstance(w_type, W_PyCTypeObject): pyo = make_ref(space, w_type) pto = rffi.cast(PyTypeObjectPtr, pyo) tp_new = pto.c_tp_new try: if not tp_new: raise operationerrfmt(space.w_TypeError, "cannot create '%s' instances", w_type.getname(space, '?')) args_w, kw_w = __...
452,980
def test_bound_lt(self): ops = """ [i0] i1 = int_lt(i0, 4) guard_true(i1) [] i2 = int_lt(i0, 5) guard_true(i2) [] jump(i0) """ expected = """ [i0] i1 = int_lt(i0, 4) guard_true(i1) [] jump(i0) """ self.optimize_loop(ops, expected)
def test_bound_lt(self): ops = """ [i0] i1 = int_lt(i0, 4) guard_true(i1) [] i2 = int_lt(i0, 5) guard_true(i2) [] jump(i0) """ preamble = """ [i0] i1 = int_lt(i0, 4) guard_true(i1) [] jump(i0) """ self.optimize_loop(ops, expected)
452,981
def test_bound_lt(self): ops = """ [i0] i1 = int_lt(i0, 4) guard_true(i1) [] i2 = int_lt(i0, 5) guard_true(i2) [] jump(i0) """ expected = """ [i0] i1 = int_lt(i0, 4) guard_true(i1) [] jump(i0) """ self.optimize_loop(ops, expected)
def test_bound_lt(self): ops = """ [i0] i1 = int_lt(i0, 4) guard_true(i1) [] i2 = int_lt(i0, 5) guard_true(i2) [] jump(i0) """ expected = """ [i0] i1 = int_lt(i0, 4) guard_true(i1) [] jump(i0) """ self.optimize_loop(ops, expected)
452,982
def optimize_loop_1(metainterp_sd, loop, virtuals=True): """Optimize loop.operations to make it match the input of loop.specnodes and to remove internal overheadish operations. Note that loop.specnodes must be applicable to the loop; you will probably get an AssertionError if not. """ optimizations = [OptIntBounds(), ...
def optimize_loop_1(metainterp_sd, loop, virtuals=True): """Optimize loop.operations to make it match the input of loop.specnodes and to remove internal overheadish operations. Note that loop.specnodes must be applicable to the loop; you will probably get an AssertionError if not. """ optimizations = [OptIntBounds(), ...
452,983
def merge_int(n): n += 1 if n == 1: return 1 elif n == 2: return 2 elif n == 3: return 3 return 4
def merge_int(n): n += 1 if n == 1: return 1 elif n == 2: return 2 elif n == 3: return 3 return 4
452,984
>>> def f(n):
>>> def f(n):
452,985
def PyObject_FREE(space, ptr): return lltype.free(ptr, flavor='raw')
def PyObject_FREE(space, ptr): lltype.free(ptr, flavor='raw')
452,986
from pypy.interpreter.typedef import TypeDef, GetSetProperty
from pypy.interpreter.typedef import TypeDef, GetSetProperty
452,987
def measuretime(space, repetitions, w_callable): if repetitions <= 0: w_DemoError = get(space, 'DemoError') msg = "repetition count must be > 0" raise OperationError(w_DemoError, space.wrap(msg)) starttime = time(None) for i in range(repetitions): space.call_function(w_callable) endtime = time(None) return space.wrap(e...
def measuretime(space, repetitions, w_callable): if repetitions <= 0: w_DemoError = get(space, 'DemoError') msg = "repetition count must be > 0" raise OperationError(w_DemoError, space.wrap(msg)) starttime = time(0) for i in range(repetitions): space.call_function(w_callable) endtime = time(None) return space.wrap(endt...
452,988
def measuretime(space, repetitions, w_callable): if repetitions <= 0: w_DemoError = get(space, 'DemoError') msg = "repetition count must be > 0" raise OperationError(w_DemoError, space.wrap(msg)) starttime = time(None) for i in range(repetitions): space.call_function(w_callable) endtime = time(None) return space.wrap(e...
def measuretime(space, repetitions, w_callable): if repetitions <= 0: w_DemoError = get(space, 'DemoError') msg = "repetition count must be > 0" raise OperationError(w_DemoError, space.wrap(msg)) starttime = time(None) for i in range(repetitions): space.call_function(w_callable) endtime = time(0) return space.wrap(endt...
452,989
def unpack_float(data, index, size, le): binary = data[index:index + 8] if le == "big": binary.reverse() unsigned = 0 for i in range(8): unsigned |= ord(binary[i]) << (i * 8) return float_unpack(unsigned, size)
def unpack_float(data, index, size, le): binary = data[index:index + 8] if le == "big": binary.reverse() unsigned = 0 for i in range(8): unsigned |= ord(binary[i]) << (i * 8) return float_unpack(unsigned, size, le)
452,990
def unpack_fields(space, w_fields): fields_w = space.unpackiterable(w_fields) fields = [] for w_tup in fields_w: l_w = space.unpackiterable(w_tup) len_l = len(l_w) if len_l == 2: bitsize = 0 elif len_l == 3: bitsize = l_w[2] else: raise OperationError(space.w_ValueError, space.wrap( "Expected list of 2- or 3-size tupl...
def unpack_fields(space, w_fields): fields_w = space.unpackiterable(w_fields) fields = [] for w_tup in fields_w: l_w = space.unpackiterable(w_tup) len_l = len(l_w) if len_l == 2: bitsize = 0 elif len_l == 3: bitsize = space.int_w(l_w[2]) else: raise OperationError(space.w_ValueError, space.wrap( "Expected list of 2- o...
452,991
def f(n): a = A() a.x = 1 if n < 1091212: a.x = 2 # fool the annotator lst = [n * 5, n * 10, n * 20] while n > 0: jitdriver.can_enter_jit(n=n, a=a, lst=lst) jitdriver.jit_merge_point(n=n, a=a, lst=lst) n += a.x n = lst.pop() lst.append(n - 10 + a.x) if a.x in lst: pass a.x = a.x + 1 - 1 a = lst.pop() b = lst.pop() retu...
def f(n): a = A() a.x = 1 if n < 1091212: a.x = 2 # fool the annotator lst = [n * 5, n * 10, n * 20] while n > 0: jitdriver.can_enter_jit(n=n, a=a, lst=lst) jitdriver.jit_merge_point(n=n, a=a, lst=lst) n += a.x n = lst.pop() lst.append(n - 10 + a.x) if a.x in lst: pass a.x = a.x + 1 - 1 a = lst.pop() b = lst.pop() retu...
452,992
def __init__(self, warmrunnerdesc): self.warmrunnerdesc = warmrunnerdesc self.cpu = warmrunnerdesc.cpu # we make the low-level type of an RPython class directly self.JIT_VIRTUAL_REF = lltype.GcStruct('JitVirtualRef', ('super', rclass.OBJECT), ('virtual_token', lltype.Signed), ('virtualref_index', lltype.Signed), ('forc...
def __init__(self, warmrunnerdesc): self.warmrunnerdesc = warmrunnerdesc self.cpu = warmrunnerdesc.cpu # we make the low-level type of an RPython class directly self.JIT_VIRTUAL_REF = lltype.GcStruct('JitVirtualRef', ('super', rclass.OBJECT), ('virtual_token', lltype.Signed), ('virtualref_index', lltype.Signed), ('forc...
452,993
def _really_force(self): if self.source_op is None: # this case should not occur; I only managed to get it once # in pypy-c-jit and couldn't reproduce it. The point is # that it relies on optimizefindnode.py computing exactly # the right level of specialization, and it seems that there # is still a corner case where i...
def _really_force(self): if self.source_op is None: # this case should not occur; I only managed to get it once # in pypy-c-jit and couldn't reproduce it. The point is # that it relies on optimizefindnode.py computing exactly # the right level of specialization, and it seems that there # is still a corner case where i...
452,994
def erfc(space, x): """The complementary error function""" return math1(space, _erfc, x)
def erfc(space, x): """The complementary error function""" return math1(space, _erfc, x)
452,995
def _erf_series(x): x2 = x * x acc = 0. fk = ERF_SERIES_TERMS * + .5 for i in range(ERF_SERIES_TERMS): acc = 2.0 * x2 * acc / fk fk -= 1. return acc * x * math.exp(-x2) / _sqrtpi
def _erf_series(x): x2 = x * x acc = 0. fk = ERF_SERIES_TERMS + .5 for i in range(ERF_SERIES_TERMS): acc = 2.0 * x2 * acc / fk fk -= 1. return acc * x * math.exp(-x2) / _sqrtpi
452,996
def _erf_series(x): x2 = x * x acc = 0. fk = ERF_SERIES_TERMS * + .5 for i in range(ERF_SERIES_TERMS): acc = 2.0 * x2 * acc / fk fk -= 1. return acc * x * math.exp(-x2) / _sqrtpi
def _erf_series(x): x2 = x * x acc = 0. fk = ERF_SERIES_TERMS * + .5 for i in range(ERF_SERIES_TERMS): acc = 2.0 + x2 * acc / fk fk -= 1. return acc * x * math.exp(-x2) / _sqrtpi
452,997
def _erfc_contfrac(x): if x >= ERFC_CONTFRAC_CUTOFF: return 0. x2 = x * x a = 0. da = 0. p = 1. p_last = 0. q = da + x2 q_last = 1. for i in range(ERFC_CONTFRAC_TERMS): a += da da += 2. b = da + x2 temp = p p = b * p - a * p_last p_last = temp temp = q q = b * q - a * q_last q_last = temp return p / q * x * math.exp(-x...
def _erfc_contfrac(x): if x >= ERFC_CONTFRAC_CUTOFF: return 0. x2 = x * x a = 0. da = .5 p = 1. p_last = 0. q = da + x2 q_last = 1. for i in range(ERFC_CONTFRAC_TERMS): a += da da += 2. b = da + x2 temp = p p = b * p - a * p_last p_last = temp temp = q q = b * q - a * q_last q_last = temp return p / q * x * math.exp(-x...
452,998
def _erfc_contfrac(x): if x >= ERFC_CONTFRAC_CUTOFF: return 0. x2 = x * x a = 0. da = 0. p = 1. p_last = 0. q = da + x2 q_last = 1. for i in range(ERFC_CONTFRAC_TERMS): a += da da += 2. b = da + x2 temp = p p = b * p - a * p_last p_last = temp temp = q q = b * q - a * q_last q_last = temp return p / q * x * math.exp(-x...
def _erfc_contfrac(x): if x >= ERFC_CONTFRAC_CUTOFF: return 0. x2 = x * x a = 0. da = 0. p = 1. p_last = 0. q = da + x2 q_last = 1. for i in range(ERFC_CONTFRAC_TERMS): a += da da += 2. b = da + x2 p_last, p = p, b * p - a * p_last q_last, q = q, b * q - a * q_last return p / q * x * math.exp(-x2) / _sqrtpi
452,999