degree of zero polynomial should be -Inf instead of 0
Reported by Stéphane MOTTELET (@mottelet)
BUG DESCRIPTION:
----------------
In Scilab, the degree of the zero polynomial should be -Inf, because, for any p,q
deg(p+q) <= max(deg(p),deg(q))
deg(p*q) = deg(p) + deg(q)
With Scilab convention of degree(zero polynomial)=0, there is a problem :
HOW TO REPRODUCE THE BUG:
-------------------------
zp=poly(0,'x','coeff')
q=poly([1 1],'x','coeff')
--> degree(zp*q)
ans =
0.
--> degree(zp)+degree(q)
ans =
1.
By defining degree(zp)=-%inf (see e.g. https://en.wikipedia.org/wiki/Degree_of_a_polynomial#Degree_of_the_zero_polynomial) we would have consistency with both rules, like this (desired Scilab output after eventual fix)
--> degree(zp)
ans =
-Inf
--> degree(zp*q)
ans =
-Inf
--> degree(zp)+degree(q)
ans =
-Inf
since
--> -%inf+1
ans =
-Inf
and also
--> degree(zp+q)
ans =
1.
-->max(degree(zp),degree(q))
ans =
1.
since
--> max(-%inf,1)
ans =
1.