There is a similar function already available in sympy/utilities/
compilef.py (which generates C code and compiles it dynamically using
libtcc). It's called cexpr and works with strings. But the
implementation is so much uglier. :)
Vinzent
On Sep 30, 11:08 am, "Ondrej Certik" <[EMAIL PROTECTED]>
On Tue, Sep 30, 2008 at 9:51 AM, Andy Ray Terrel <[EMAIL PROTECTED]> wrote:
>
> On Tue, Sep 30, 2008 at 12:11 AM, Ondrej Certik <[EMAIL PROTECTED]> wrote:
>>
>> On Mon, Sep 29, 2008 at 11:40 PM, Andy R. Terrel <[EMAIL PROTECTED]> wrote:
>>>
>>> Hmm updated my ancient code and got this to work:
>>>
On Tue, Sep 30, 2008 at 12:11 AM, Ondrej Certik <[EMAIL PROTECTED]> wrote:
>
> On Mon, Sep 29, 2008 at 11:40 PM, Andy R. Terrel <[EMAIL PROTECTED]> wrote:
>>
>> Hmm updated my ancient code and got this to work:
>>
>> class CppPrinter(printing.str.StrPrinter):
>>def _print_Pow(self, expr):
>>
On Mon, Sep 29, 2008 at 11:40 PM, Andy R. Terrel <[EMAIL PROTECTED]> wrote:
>
> Hmm updated my ancient code and got this to work:
>
> class CppPrinter(printing.str.StrPrinter):
>def _print_Pow(self, expr):
>PREC = printing.precedence.precedence(expr)
>if expr.exp is S.NegativeO
Hmm updated my ancient code and got this to work:
class CppPrinter(printing.str.StrPrinter):
def _print_Pow(self, expr):
PREC = printing.precedence.precedence(expr)
if expr.exp is S.NegativeOne:
return '1/%s'%(self.parenthesize(expr.base, PREC))
else: