code: public FormatStringBuffer format(double dbl) {
  
          Format fmt = getFormat();
  
          if (fmt.type != FLOAT) throw new IllegalArgumentException("Expected a float format");
  
          NumberFormat nf;
          if ((fmt.flags & SCI) > 0) {
              nf = new DecimalFormat("0.#E00", DecimalFormatSymbols.getInstance(Locale.ROOT));
          } else {
              nf = NumberFormat.getInstance(Locale.ROOT);
          }
          nf.setGroupingUsed((fmt.flags & GROUPING) != 0);
          if (fmt.precision != -1) {
              nf.setMaximumFractionDigits(fmt.precision);
              nf.setMinimumFractionDigits(fmt.precision);
          } else {
              nf.setMaximumFractionDigits(Integer.MAX_VALUE);
              nf.setMinimumFractionDigits(1);
          }
          String str = nf.format(dbl);
          if ((fmt.flags & SCI) == SCI && (fmt.flags & UPPER) == 0) {
              str = str.replace('E', 'e');
          }
          if ((fmt.flags & PLUS) == PLUS && dbl >= 0.0) str = "+" + str;
  
          int len = str.length();
          if ((fmt.flags & LEFT) != LEFT) while (len < fmt.fieldWidth--)
              buffer.append(' ');
  
          for (int i = 0; i < len; ++i)
              buffer.append(str.charAt(i));
  
          while (len < fmt.fieldWidth--)
              buffer.append(' ');
  
          return this;
      }
docs: Format a <tt>double</tt>.