[overloading] fix rational display after 59c15042 30/21230/2
St├ęphane Mottelet [Thu, 16 Jan 2020 16:06:26 +0000 (17:06 +0100)]
Change-Id: If198d83646694f3ea49b995f85ccae08952acc4c

scilab/modules/overloading/macros/%r_p.sci

index 55c0848..22073fb 100644 (file)
@@ -92,13 +92,13 @@ function txt=p2str(p)
     //Handle long lines
     txt=[]
     pString = string(p);
-    monomLength = cumsum(2+length(strsplit(pString,[' +';' -'])))-2;
+    monomLength = cumsum(2+length(strsplit(pString,[" +";" -"])))-2;
     while %t
         last = find(monomLength<lines()(1)-3)($)
         toPrint = part(pString,1:monomLength(last));
         txt = [txt; toPrint];
-        if last == sum(coeff(p)<>0)
-           break
+        if degree(p) == -%inf || last == sum(coeff(p)<>0)
+            break
         end
         pString = part(pString,monomLength(last)+1:$);
         monomLength = monomLength - length(toPrint);