remez should test whether its input function is already a polynomial
When remez command is asked to compute a best polynomial approximation of degree n to a function f which turns out to be already a polynomial of degree less or equal to n, the result is trivially f itself and could be returned immediately.
Currently, this is however a case when remez command fails miserably while complaining with a lot of warnings.
Of course, f could be a polynomial of degree less than n in a so complicated manner that we do not expect all cases to be recognized. For instance, there is no harm failing to recognize a polynomial in the expression x^(log(9)/log(3))
. But when f is provably such a polynomial, remez should return the correct result without complaining.