Artifact ce0b4c95c551aa8b492c71160bec00c160efae5da425fa18ef89b858def17ae0:
- File
mttroot/mtt/lib/reduce/fix_c.r
— part of check-in
[47742bde53]
at
2001-04-11 09:44:26
on branch origin/master
— Fixed cc and c problems to do with pow(x,y) and integers
mtt/lib/reduce/fix_c.r is included in rdae2dae and cse2smx_lang for
-c, -cc and -oct options (user: gawthrop@users.sourceforge.net, size: 350) [annotate] [blame] [check-ins using] [more...]
%% Fixes for c-code generation ON ROUNDED$ % No integer output %% Changes x^y to pow(x,y) OPERATOR pow$ FOR ALL x,y LET x^y = pow(x,y)$ % Use the pow function %% Derivatives FOR ALL f,g,x LET df(pow(f,g),x)= pow(f,g-1) * (df(f,x)*g + df(g,x)*f*log(f))$ %% Special cases FOR ALL x LET pow(x,0) = 1$ FOR ALL x LET pow(x,1) = x$ END$