Formats a double.

@param toFormat
the number to format
@return the formatted string.
@see java.util.Formatter for the documentation.
194745
@SuppressWarnings("resource")
	protected static final String format(final double toFormat) {
		return new Formatter(Locale.US).format(FLOATFORMAT, toFormat)
				.toString();
	}
191095
public static final Function<Double,String> toStr() {
        return (Function<Double,String>)((Function)FnNumber.toStr());
    }
651942
public static String formatPercent(double number, int scale) {
		final NumberFormat format = NumberFormat.getPercentInstance();
		format.setMaximumFractionDigits(scale);
		return format.format(number);
	}
1107578
public static String format(double[] v, int w, int d) {
    DecimalFormat format = new DecimalFormat();
    format.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
    format.setMinimumIntegerDigits(1);
    format.setMaximumFractionDigits(d);
    format.setMinimumFractionDigits(d);
    format.setGroupingUsed(false);

    int width = w + 1;
    StringBuilder msg = new StringBuilder() //
        .append('\n'); // start on new line.
    for(int i = 0; i < v.length; i++) {
      String s = format.format(v[i]); // format the number
      // At _least_ 1 whitespace is added
      whitespace(msg, Math.max(1, width - s.length())).append(s);
    }
    return msg.toString();
  }
1107705
private String formatUnits(Number value)
   {
      return (value == null ? null : m_formats.getUnitsDecimalFormat().format(value.doubleValue() / 100));
   }
944039
private String convert(String str, String dateFormat)
    {
        String ret = str;

        // Carry out the required string conversion
        long longValue = 0L;
        double doubleValue = 0.0d;

        // Convert the input value to a number
        if(str.length() > 0)
        {
            if(inputType == INTEGER_TYPE || inputType == NUMBER_TYPE)
                longValue = Long.parseLong(str);
            else if(inputType == DECIMAL_TYPE || inputType == SECONDS_TYPE)
                doubleValue = Double.parseDouble(str);
            else if(inputType == DATETIME_TYPE && inputFormat.length() > 0)
                longValue = parseDateTime(str, inputFormat);
        }

        // Convert seconds to milliseconds
        if(inputType == SECONDS_TYPE)
            doubleValue *= 1000.0d;

        // Allow for cross type conversions
        //   eg. decimal->datetime, seconds->datetime
        if(inputType == DECIMAL_TYPE || inputType == SECONDS_TYPE)
            longValue = (long)doubleValue;
        else
            doubleValue = (double)longValue;

        // Convert the number to the output format
        if(outputType == INTEGER_TYPE)
            ret = Long.toString(longValue);
        else if(outputType == DECIMAL_TYPE || outputType == SECONDS_TYPE)
            ret = convertDecimal(doubleValue, outputFormat);
        else if(outputType == DATETIME_TYPE)
            ret = convertDateTime(longValue, 
                outputFormat.length() > 0 ? outputFormat : dateFormat);
        else if(outputType == STRING_TYPE)
            ret = convertString(str, outputFormat, regex);

        return ret;
    }
1305408
public String format(Object number) {
         synchronized (fmt) {
             return style.format(
                     fmt.formatToCharacterIterator(number),
                     preExponent);
         }
     }
1154062
private Double getDouble(String number) {
    try {
      return Double.parseDouble(number);
    } catch (NumberFormatException e) {
      return null;
    }
  }
379675
public Double convertToDouble(String value) {
        Double result = null;
        if (value != null) {
            result = Double.valueOf(value);
        }
        return result;
    }
66310
public static String dealDouble(double count) {
        if (count < 0.005 && count > -0.005) {
            return "0.00";
        }
        String result = NUMFORMAT.format(count);
        return result.startsWith(".") ? "0" + result : result;
    }
39943
@Override
    public StringBuffer format(android.icu.math.BigDecimal number,
                               StringBuffer toAppendTo,
                               FieldPosition pos) {
        if (MIN_VALUE.compareTo(number) >= 0 || MAX_VALUE.compareTo(number) <= 0) {
            // We're outside of our normal range that this framework can handle.
            // The DecimalFormat will provide more accurate results.
            return getDecimalFormat().format(number, toAppendTo, pos);
        }
        if (number.scale() == 0) {
            return format(number.longValue(), toAppendTo, pos);
        }
        return format(number.doubleValue(), toAppendTo, pos);
    }
1246716
public static String formatDouble(final Double amount, String pattern) {
		if (pattern == null || pattern.equals("")) {
			pattern = JKFormatUtil.DEFAULT_DOUBLE_FORMAT;
		}
		return JKFormatUtil.getNumberFormatter(pattern).format(amount);
	}
745302
public <N extends Number> CellFormatResult format(final String formatPattern, final N value) {
        return format(formatPattern, value, Locale.getDefault());
    }
1159946
public Double convertStringToDouble(String value) {
        Double result;
        try {
            result = Double.valueOf(value);
        } catch (NumberFormatException e) {
            result = DEFAULT_DOUBLE_VALUE;
        }
        return result;
    }
659865
public static String formatNum(
      ULocale uLocale,
      double number,
      String formatType,
      String numbersKeyword,
      @Nullable Integer minFractionDigits,
      @Nullable Integer maxFractionDigits) {
    uLocale = uLocale.setKeywordValue("numbers", numbersKeyword);
    NumberFormat numberFormat;
    switch (formatType) {
      case "decimal":
        numberFormat = NumberFormat.getInstance(uLocale);
        break;
      case "percent":
        numberFormat = NumberFormat.getPercentInstance(uLocale);
        break;
      case "currency":
        numberFormat = NumberFormat.getCurrencyInstance(uLocale);
        break;
      case "scientific":
        numberFormat = NumberFormat.getScientificInstance(uLocale);
        break;
      case "compact_short":
        {
          CompactDecimalFormat compactNumberFormat =
              CompactDecimalFormat.getInstance(uLocale, CompactStyle.SHORT);
          compactNumberFormat.setMaximumSignificantDigits(3);
          numberFormat = compactNumberFormat;
          break;
        }
      case "compact_long":
        {
          CompactDecimalFormat compactNumberFormat =
              CompactDecimalFormat.getInstance(uLocale, CompactStyle.LONG);
          compactNumberFormat.setMaximumSignificantDigits(3);
          numberFormat = compactNumberFormat;
          break;
        }
      default:
        throw new IllegalArgumentException(
            "First argument to formatNum must be "
                + "constant, and one of: 'decimal', 'currency', 'percent', 'scientific', "
                + "'compact_short', or 'compact_long'.");
    }

    if (minFractionDigits != null) {
      numberFormat.setMinimumFractionDigits(minFractionDigits);
    }
    if (maxFractionDigits != null) {
      numberFormat.setMaximumFractionDigits(maxFractionDigits);
    }
    return numberFormat.format(number);
  }
711626
public static String writeDouble(Double value) {
		if (value==null) return null;
		
		return Double.toString(value);			
	}
262937
private String format(double fileSize, Units units)
  {
    StringBuilder builder = new StringBuilder();
    builder.append(numberFormat.format(fileSize));
    builder.append(' ');
    builder.append(units.name());
    return builder.toString();
  }