Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 2557 by brad.froehle: inline Piecewise C code constructs not actually valid C
http://code.google.com/p/sympy/issues/detail?id=2557

In printing.tests.test_ccode, we test:

def test_ccode_Piecewise_deep():
    p = ccode(2*Piecewise((x,x<1),(x**2,True)))
    s = \
"""\
2*if (x < 1) {
   x
}
else {
   pow(x, 2)
}\
"""
    assert p == s


However this little snippet could never actually be valid C code. I think ccode should instead be generating a ternary statement, for example:

2*((x<1) : (x) ? (pow(x,2)))

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to