Missing precedence rules for And and Or
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
FFC |
Fix Released
|
Undecided
|
Kristian B. Ølgaard |
Bug Description
The code generation in FFC does not consider precedence of the &&/|| operators vs <,>,etc., which may result in wrong results as seen in this case. Suggested fix is to always add () around arguments to && and ||, but I'm not sure I understand how the formatting rules work (strings vs. lambdas in the formatting dict).
from dolfin import *
mesh = UnitSquare(100,100)
x = mesh.ufl_cell().x
f = conditional(
g = conditional(
fp = project(f, mesh=mesh)
gp = project(g, mesh=mesh)
print fp.vector(
print gp.vector(
plot(fp) # Wrong, looks just like g
plot(gp) # Correct
interactive()
Changed in ffc: | |
assignee: | nobody → Kristian B. Ølgaard (k.b.oelgaard) |
status: | New → Confirmed |
Changed in ffc: | |
status: | Confirmed → Fix Committed |
Changed in ffc: | |
status: | Fix Committed → Fix Released |