> (%i1) f(x):=sin(x);
> (%i4) g(x):='' diff(f(x),x);
> (%o4) g(x):=diff(f(x),x) <== This is the first sign of a problem. By using '', you intended to evaluate the diff(f(x),x) when defining g, but you didn't ... what you should be seeing here is cos(x). To get that, you needed to say ''(diff...) as Andrej's mail says.
> (%i6) g(%pi);
> (%o6) 0
...
> I am not sure why g(%pi) evaluates fine, but g(4*%pi) does not. I know
This is a bug. Maxima shouldn't be allowing you to differentiate with
respect to a constant like %pi any more than with respect to an
expression.
-s