integer function width(n)
integer n
! Returns the number of digits:
if(n==0) then
width =1
else
width =log10(real(abs(n)))+1
endif

if(n <0) width =width+1
end
