You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get different results depending on whether a variable I just set is immediately accessed or not.
Variable "ro".
Right after I define it there's a line that just says "#ro".
If that line is commented out, I get the wrong result.
If it's live, I get the right result.
Casting the elements in "ro" to int also makes it work.
Printing "ro" makes it work.
To test, call gga like this:
gga (65, 60, 0, True, 1, [65., 65.], [4100., 2000.], 1.)
Correct output is:
B
234.0
If "#ro" is commented out you'll get this instead:
C
0.0
import math
gis_t4 = {
0 : 123,
2000 : 234,
7000 : 345,
}
def f (data, tx, s):
txu = tx * s
keys = sorted(list(data.keys()))
for i in range(len(keys) - 1, -1, -1):
k = keys[i]
if txu >= k:
return data[k] / s
return data[0] / s
#pythran export gga (
# int, int, int, bool, int, float64 list, float64 list, float64
#)
def gga (b, c, y, m, cnum, osa, tx, s):
other_cnum = 1 - cnum
tca = (b if cnum == 0 else c) + y
oca = (b if other_cnum == 0 else c) + y
tto = max(osa[other_cnum] - oca, 0.)
if tto == 0:
fraction = 1.
else:
fraction = max (1 - tto, 0.)
ro = [
(b + y) >= math.floor(osa[cnum]),
(c + y) >= math.floor(osa[other_cnum]),
]
#ro
if not m:
print ('A')
return 0.
else:
if ro[other_cnum] and tca >= 60 and tca <= 64:
print ('B')
return f (gis_t4, tx[cnum] + tx[other_cnum], s) * fraction
else:
print ('C')
return 0.
The text was updated successfully, but these errors were encountered:
The preprocessed code as output by pythran -P mycode.py shows that some forward substitution happen, that's probably the reason. I'll be offline for a few weeks, but I'll have a look afterward. Thanks for reporting!
I get different results depending on whether a variable I just set is immediately accessed or not.
Variable "ro".
Right after I define it there's a line that just says "#ro".
If that line is commented out, I get the wrong result.
If it's live, I get the right result.
Casting the elements in "ro" to int also makes it work.
Printing "ro" makes it work.
To test, call gga like this:
gga (65, 60, 0, True, 1, [65., 65.], [4100., 2000.], 1.)
Correct output is:
B
234.0
If "#ro" is commented out you'll get this instead:
C
0.0
The text was updated successfully, but these errors were encountered: