Artifact 0b3202721a0d54d119ee230836d3aafcd5567574b18c5e465031ab784571b436:
- File
mttroot/mtt/lib/reduce/fix_c.r
— part of check-in
[5b09adc924]
at
2002-05-10 12:41:08
on branch origin/master
— Substitution of pi for its numerical value moved from
useful-functions.hh to fix_c.r (user: gawthrop@users.sourceforge.net, size: 482) [annotate] [blame] [check-ins using] [more...]
%% Fixes for c-code generation %% Set PI explicitly here to avoid later conflict with cc headers LET PI = 3.1415$ 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$ OPERATOR fabs$ FOR ALL x let abs(x) = fabs(x)$ END$