Display a linear combination: Difference between revisions

m
→‎{{header|REXX}}: elided redundant use of ABS BIF.
(→‎{{header|REXX}}: added the REXX language.)
m (→‎{{header|REXX}}: elided redundant use of ABS BIF.)
Line 204:
$= /*nullify output (liner combination).*/
do k=1 for words(y); #=word(y,k) /* ◄───── process each of the elements.*/
if #=0 then iterate; a=abs(x/1) /*if the value is zero, then ignore it.*/
s='+ '; if #<0 then s='- ' /*define the sign: plus(+) or minus(-)*/
n=n+1; if n==1 then s=strip(s) /*if the 1st element used, handle sign.*/
if a\==abs(#/1) then s=s || a'*' /*useif amultiplier normalizedis absoluteunity, valuethen ofignore #.*/
if abs(#)\==1 then s=s || a'*' /*if multiplier is unity, then ignore #*/
$=$ s'e('k")" /*construct a liner combination element*/
end /*k*/
 
$=strip(strip($), 'L', "+") /*strip leading plus sign (1st element)*/