Commit 8f5eff7c authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fix range check

Range checks for operator DIV and MINUS were incorrect
as reported by Alexandre Esteves
parent ac30fa51
......@@ -1260,12 +1260,12 @@ def arithmetic_expression(root, context):
'Max': str(float(left.Max) * float(right.Max))}
expr.exprType = type('Mul', (basic,), attrs)
elif isinstance(expr, ogAST.ExprMinus):
attrs = {'Min': str(float(left.Min) - float(right.Min)),
'Max': str(float(left.Max) - float(right.Max))}
attrs = {'Min': str(float(left.Min) - float(right.Max)),
'Max': str(float(left.Max) - float(right.Min))}
expr.exprType = type('Minus', (basic,), attrs)
elif isinstance(expr, ogAST.ExprDiv):
attrs = {'Min': str(float(left.Min) / (float(right.Min) or 1)),
'Max': str(float(left.Max) / (float(right.Max) or 1))}
attrs = {'Min': str(float(left.Min) / (float(right.Max) or 1)),
'Max': str(float(left.Max) / (float(right.Min) or 1))}
expr.exprType = type('Div', (basic,), attrs)
elif isinstance(expr, (ogAST.ExprMod, ogAST.ExprRem)):
attrs = {'Min': right.Min, 'Max': right.Max}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment