rat and bothcoef error





Dear all,

I am playing with a routine that checks if an input function is linear or not. In the bothcoef example in the manual, rat is used inside bothcoef like this:
        c: bothcoef (rat (expr, x), x),

with some expressions, this gives me an error (bothcoef: invalid arguments) due to the use of 'rat', 
for example here:

(%i01) expr :  -(x)/(x*x+y);
(%o01) -x/(x*x+y)
(%i02) c: rat(expr,x);
(%o02) -x/(x*x+y)
(%i03) bothcoef(c,x);
bothcoef: invalid arguments.
 -- an error. To debug this try: debugmode(true);
(%i04) bothcoef(expr,x);
(%o04) [-1/(y+x^2),0]
rat(expr) is the same(?) here as expr but bothcoef(expr,x) gives me an answer whereas bothcoef(rat(expr,x),x) does not.
Is this a bug or intended behavior?

Kind regards,
Nijso