Forms in python don't support truediv
Bug #888529 reported by
Joachim Haga
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
UFL |
Fix Released
|
High
|
Unassigned |
Bug Description
Define f.x.
k = Constant(1.0)
and use it in a form,
a = (1/k) * u * v * dx
This doesn't work if future.__division__ is in effect ("from __future__ import division"). In this case, __div__ is replaced by __truediv__ and __floordiv__ (or their r-equivalents). I use this mode routinely to avoid any unintended integer divisions.
So: Constant, and maybe other entities, should set __truediv__ = __div__ and __rtruediv__ = __rdiv__.
(I believe Constant's __div__ semantics are really __truediv__ semantics anyway.)
Changed in ufl: | |
status: | New → Fix Committed |
importance: | Undecided → High |
Changed in ufl: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Looks like this belongs in UFL