mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Fix blunder in operator priority
-a//-b did the wrong thing. Use -(a//-b) and add corresponding regression tests.
This commit is contained in:
parent
37483a72cb
commit
74115345f0
2 changed files with 10 additions and 1 deletions
|
@ -679,7 +679,7 @@ def div(a, b, f32=True):
|
|||
return a # this could be handled by using S32 but it's probably faster this way
|
||||
if (a < 0) ^ (b < 0):
|
||||
# signs differ - Python rounds towards -inf, we need rounding towards 0
|
||||
return - a//-b # that's -(a//-b) not (-a)//-b
|
||||
return -(a//-b)
|
||||
return a//b
|
||||
ret = F32(ff(a)/ff(b), f32)
|
||||
if math.isnan(ret): # A NaN result gives a math error.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue