[pypy-issue] Issue #2946: Raising ints to negative numbers casts first to longs and then to floats (pypy/pypy)

Julian Berman issues-reply at bitbucket.org
Wed Feb 6 06:04:50 EST 2019


New issue 2946: Raising ints to negative numbers casts first to longs and then to floats
https://bitbucket.org/pypy/pypy/issues/2946/raising-ints-to-negative-numbers-casts

Julian Berman:

Code:

```python
def main():
    s = 0.0
    for i in range(1, 100000):
        s += i ** -2
    return s

main()
```

Trace:

```
debug_merge_point(0, 0, '<code object main. file 'x.py'. line 1> #37 BINARY_POWER')
+699: guard_not_invalidated(descr=<Guard0x10955b028>) [p0, p3, p6, p7, p10, p14, p18, p20, p1, i37]
+699: p43 = call_r(ConstClass(fromint), i37, descr=<Callr 8 i EF=4>)
+803: guard_no_exception(descr=<Guard0x109566980>) [p0, p6, p7, p10, p14, p1, p43, i37]
+817: f45 = call_f(ConstClass(rbigint.tofloat), p43, descr=<Callf 8 r EF=4>)
```




More information about the pypy-issue mailing list