function str = printnumber(x,totallen)
    %
    scs= socscx (x);
    if scs>0;
        format='g';
        scstdv=-6;
    else
        format='f';
        scstdv=-3+scs;
    end;
    nformat=['%' ...  
      sprintf('%1u',totallen) '.' sprintf('%1u',totallen+scstdv) ...
      format];
    str = sprintf(nformat,x);
    