# File lib/facet/lisp-format.rb, line 1068
        def execute(state)
          width = param(0, state, nil)
          digits = param(1, state, nil)
          edigits = param(2, state, nil)
          scale = param(3, state, 1)
          overflowchar = param(4, state, nil)
          padchar = param(5, state, ?\s).chr
          exponentchar = param(6, state, ?e).chr
          arg = state.next_arg
          if arg.respond_to? :to_f
            num = arg.to_f
            sign = (num >= 0 and at_mod?) ? '+' : ''
            exp = Math.log10(num.abs).floor - (scale - 1)
            exp_str = exponentchar + (exp >= 0 ? '+' : '-') +
              (edigits.nil? ? exp.abs.to_s : exp.abs.to_s.rjust(edigits, '0'))
            if digits.nil? and width.nil? and edigits.nil?
              str = sign + (num * (10 ** -exp)).to_s + exp_str
            else
              if digits.nil?
                prec = width - sign.length -
                  ((num * (10 ** -exp)).to_s.index(/\./) + 1) - exp_str.length
                str = sign + sprintf("%#.#{prec}f", num) + exp_str
              else
                if scale > 0
                  if scale < digits + 2
                    prec = digits - scale + 1
                  else
                    param_error 3, 'scale must be < digits + 2'
                  end
                else
                  prec = -scale + (digits + scale)
                end
                str = sign + sprintf("%#.#{prec}f", num * (10**-exp)) + exp_str
              end
              unless width.nil?
                if scale <= 0 and str.length > width
                  str.sub!(/^([+-]?)0\./, '\1.')
                end
                str = str.rjust(width, padchar) if str.length < width
              end
              unless width.nil? and overflowchar.nil?
                if not edigits.nil? and (exp_str.length - 2) > edigits
                  str = overflowchar.chr * width
                end
              end
            end
            state.output str
          elsif arg.respond_to? :to_int
            state.push_back_arg
            parameters = @params[0].nil? ? [] : [@params[0]]
            Factory.build(parameters, [], ?D, nil, @pos).execute(state)
          else
            arg_error 'argument is not a number or a number string'
          end
        end