Convert a string to a double -- Allowed input is in fixed
notation ddd.fff.

@return A double value representation of the string, or return Double.NaN
if the string can not be converted.
972685
public double toDouble()
  {
    /* XMLCharacterRecognizer.isWhiteSpace(char c) methods treats the following 
     * characters as white space characters.
     * ht - horizontal tab, nl - newline , cr - carriage return and sp - space
     * trim() methods by default also takes care of these white space characters
     * So trim() method is used to remove leading and trailing white spaces.
     */
	XMLString s = trim();
	double result = Double.NaN;
	for (int i = 0; i < s.length(); i++)
	{
		char c = s.charAt(i);
    if (c != '-' && c != '.' && ( c < 0X30 || c > 0x39)) {
            // The character is not a '-' or a '.' or a digit
            // then return NaN because something is wrong.
			return result;
        }
	}
	try
	{
		result = Double.parseDouble(s.toString());
	} catch (NumberFormatException e){}

	return result;
}
828825
public static float stringToFloat(String string) {
        string = string.trim();
        if (Checker.isDecimal(string)) {
            return Float.parseFloat(string);
        }
        return -1;
    }
820818
public static String doubleToString(double d) {
        if (Double.isInfinite(d) || Double.isNaN(d)) {
            return "null";
        }

// Shave off trailing zeros and decimal point, if possible.

        String string = Double.toString(d);
        if (string.indexOf('.') > 0 && string.indexOf('e') < 0
                && string.indexOf('E') < 0) {
            while (string.endsWith("0")) {
                string = string.substring(0, string.length() - 1);
            }
            if (string.endsWith(".")) {
                string = string.substring(0, string.length() - 1);
            }
        }
        return string;
    }
167770
@Override
    public double getDoubleValue( final String       key,
                                  final double       defaultValue )
    {
        return formatDoubleValue( key, getFormattedPropValue( key ), defaultValue );
    }
345813
function(value) {
  if (value && value._bsontype) {
    if (_.includes([ 'Decimal128', 'Long' ], value._bsontype)) {
      return value.toString();
    }
    if (_.includes([ 'Double', 'Int32' ], value._bsontype)) {
      return String(value.value);
    }
  }
  if (_.isString(value)) {
    return value;
  }
  return String(value);
}
1229482
@NotNull
    public String toSimpleString(boolean allowDecimal)
    {
        if (_denominator == 0 && _numerator != 0) {
            return toString();
        } else if (isInteger()) {
            return Integer.toString(intValue());
        } else if (_numerator != 1 && _denominator % _numerator == 0) {
            // common factor between denominator and numerator
            long newDenominator = _denominator / _numerator;
            return new Rational(1, newDenominator).toSimpleString(allowDecimal);
        } else {
            Rational simplifiedInstance = getSimplifiedInstance();
            if (allowDecimal) {
                String doubleString = Double.toString(simplifiedInstance.doubleValue());
                if (doubleString.length() < 5) {
                    return doubleString;
                }
            }
            return simplifiedInstance.toString();
        }
    }
391944
public static Double toDouble(Object value) {
        if (value == null) {
            return null;
        } else if (value instanceof Double) {
            return (Double) value;
        } else if (value instanceof Number) {
            return ((Number) value).doubleValue();
        } else {
            try {
                return Double.valueOf(value.toString().trim());
            } catch (NumberFormatException e) {
                throw new ConversionException("failed to convert: '" + value + "' to Double", e);
            }
        }
    }
246306
@Override
    public String handle(final Object value) {
        if (value instanceof Double) {
            return String.format(Locale.US, "%.14f", (Double) value);
        } else {
            throw new IllegalArgumentException("Can't serialize anything but Double");
        }
    }
654943
public double readDouble()
        throws IOException
    {
        int tag = read();

        switch (tag) {
            case 'T':
                return 1;
            case 'F':
                return 0;
            case 'I':
                return parseInt();
            case 'L':
                return (double) parseLong();
            case 'D':
                return parseDouble();

            default:
                throw expect("long", tag);
        }
    }
1099114
public static Double toDoubleObject(@NotNull String str) {
		// 统一行为，不要有时候抛NPE，有时候抛NumberFormatException
		if (str == null) {
			throw new NumberFormatException("null");
		}
		return Double.valueOf(str);
	}
533437
public static double toDouble(String x) throws NumberFormatException {
        if ("nan".equals(x)) {
            return Double.NaN;
        }
        if ("inf".equals(x)) {
            return Double.POSITIVE_INFINITY;
        }
        if ("-inf".equals(x)) {
            return Double.NEGATIVE_INFINITY;
        }

        return Double.parseDouble(x);
    }
486657
public double getDouble(String key) {
		addToDefaults(key, null);
		String value = getRequired(key);
		return Double.valueOf(value);
	}
197960
public double getDouble(int index)
  {
    Object value = _values[index - 1];

    if (value instanceof Double) {
      return (Double) value;
    }
    else if (value instanceof Float) {
      return (Float) value;
    }
    else if (value instanceof Number) {
      return (Double) ((Number) value);
    }
    else {
      return Double.valueOf(value.toString());
    }
  }
1350970
public double getDouble(String key, double defaultValue) {
    Object value = get(key);
    if (value instanceof Double) {
      return (double) value;
    }
    if (value instanceof Number) {
      return ((Number) value).doubleValue();
    } else if (value instanceof String) {
      try {
        return Double.valueOf((String) value);
      } catch (NumberFormatException ignored) {
      }
    }
    return defaultValue;
  }
560872
static double asDouble(Object value) throws ProvidenceConfigException {
        if (value instanceof Number) {
            return ((Number) value).doubleValue();
        } else if (value instanceof Numeric) {
            return ((Numeric) value).asInteger();
        }
        throw new ProvidenceConfigException(
                "Unable to convert " + value.getClass().getSimpleName() + " to a double");
    }
1155202
public double getDouble(String name, double defaultValue) {
        try {
            String value = getString(name, null);
            if (!StringUtils.isNullOrEmpty(value)) {
                return Double.parseDouble(value.trim());
            }
        } catch (NumberFormatException e) {
            log.warn("Failed to parse double for " + name + USING_DEFAULT_OF
                + defaultValue);
        }

        return defaultValue;
    }
504594
public static boolean isDouble(String string) {
    if (string == null) {
      return false;
    }

    try {
      Double.parseDouble(string);
    } catch (NumberFormatException e) {
      return false;
    }

    return true;
  }