Returns double value of argument, if possible, wrapped in Optional
Interprets String as Number
174890
public static Optional<Double> toDouble(Object arg) {
        if ( arg instanceof Number ) {
            return Optional.of( ( (Number) arg ).doubleValue() );
        }
        else if(arg instanceof String) {
            Optional<? extends Number> optional = toNumber( arg );
            if ( optional.isPresent() ) {
                return Optional.of( optional.get().doubleValue() );
            }
            else {
                return Optional.empty();
            }
        }
        else {
            return Optional.empty();
        }
    }
224514
def create_double(self, value: float) -> Double:
        
        self.append((6, value))
        self.append(None)
        return self.get(self.raw_count - 2)
608156
def _parse_canonical_double(doc):
    """"""
    d_str = doc['$numberDouble']
    if len(doc) != 1:
        raise TypeError('Bad $numberDouble, extra field(s): %s' % (doc,))
    if not isinstance(d_str, string_type):
        raise TypeError('$numberDouble must be string: %s' % (doc,))
    return float(d_str)
548770
def _to_number(cls, string):
        """"""
        try:
            if float(string) - int(string) == 0:
                return int(string)
            return float(string)
        except ValueError:
            try:
                return float(string)
            except ValueError:
                return string
1108145
def p_str(p):
    
    if is_number(p[2]):  # A constant is converted to string directly
        p[0] = symbols.STRING(str(p[2].value), p.lineno(1))
    else:
        p[0] = make_builtin(p.lineno(1), 'STR',
                            make_typecast(TYPE.float_, p[2], p.lineno(1)),
                            type_=TYPE.string)
1194472
public static double parseDouble(String val, double defValue){
        if(TextUtils.isEmpty(val)) return defValue;
        try{
            return Double.parseDouble(val);
        }catch(NumberFormatException e){
            return defValue;
        }
    }
1177594
function parseNumber( str ) {
	var v = parseFloat( str );
	if ( isnan( v ) ) {
		return new TypeError( 'invalid value. Unable to parse string as a number. Value: `' + str + '`.' );
	}
	return v;
}
802778
public static double asDouble(Object value) {
        if (value instanceof Number) {
            return ((Number) value).doubleValue();
        } else if (value instanceof Numeric) {
            return ((Numeric) value).asInteger();
        } else if (value instanceof CharSequence) {
            try {
                return Double.parseDouble(value.toString());
            } catch (NumberFormatException nfe) {
                throw new IncompatibleValueException("Unable to parse string \"" + Strings.escape(value.toString()) +
                                                     "\" to a double", nfe);
            }
        }
        throw new IncompatibleValueException(
                "Unable to convert " + value.getClass().getSimpleName() + " to a double");
    }
309904
function ( arg ) {
		var result = [1, 1],
		    first  = result[0],
		    second = result[1],
		    sum;

		// Subtracting 1 to account for `first` & `second`
		arg = ( arg || 100 ) - 1;
		
		if ( isNaN( arg ) || arg < 2 ) {
			throw new Error( label.error.invalidArguments );
		}

		while ( --arg ) {
			sum    = first + second;
			first  = second;
			second = sum;
			result.push( sum );
		}

		return result;
	}
1216957
def convert(self, argument):
    """"""
    if (_is_integer_type(argument) or isinstance(argument, float) or
        isinstance(argument, six.string_types)):
      return float(argument)
    else:
      raise TypeError(
          'Expect argument to be a string, int, or float, found {}'.format(
              type(argument)))
735789
function numberType(mname, tpe, options) {
  const doubles = options.themeDoubles.split(',')
  if (doubles && doubles.includes(mname)) {
    return 'Double'
  } else {
    return 'Int'
  }
}
886133
def _convert_py_number(value):
    
    try:
        return c_uamqp.int_value(value)
    except OverflowError:
        pass
    try:
        return c_uamqp.long_value(value)
    except OverflowError:
        pass
    return c_uamqp.double_value(value)
895970
private int getIntValue(String str, int defaultValue) {

        try {
            int intValue = Integer.parseInt(str);
            return (intValue > 0) ? intValue : defaultValue;
        } catch (NumberFormatException e) {
            // intentionally left blank
        }
        return defaultValue;
    }
137336
@Override
  public double getValueDouble(long[] args, long n) throws IOException {
    double value = 0;
    if (args != null) {
      for (long a : args) {
        value += a;
      }
    }
    return value;
  }
1242685
def two_numbers(
            cls, request,
            operation: (Ptypes.path,
                        String('One of the 4 arithmetic operations.',
                                enum=['add', 'sub', 'mul', 'div'])),
            first: (Ptypes.path,
                    Float('The first operand.')),
            second: (Ptypes.path,
                     Float('The second operand.'))) -> [
            (200, 'Ok', Float),
            (400, 'Wrong number format or invalid operation'),
            (422, 'NaN')]:
        ''''''
        log.info('Performing {} on {} and {}'.format(operation, first, second))
        try:
            first = float(first)
            second = float(second)
        except ValueError:
            Respond(400)
        if operation == 'add':
            Respond(200, first + second)
        elif operation == 'sub':
            Respond(200, first - second)
        elif operation == 'mul':
            Respond(200, first * second)
        elif operation == 'div':
            if second == 0:
                Respond(422)
            Respond(200, first / second)
        else:
            Respond(400)
1095713
def numberize(string):
    ''''''
    if not isinstance(string,basestring):
        return string
    just_int = r'^\s*[-+]?\d+\s*$'
    just_float = r'^\s*[-+]?\d+\.(\d+)?\s*$'
    if re.match(just_int,string):
        return int(string)
    if re.match(just_float,string):
        return float(string)
    return string
707710
function num2str(type) {
  switch (Number(type)) {
    case types.BYTE:
      return 'byte';
    case types.CHAR:
      return 'char';
    case types.SHORT:
      return 'short';
    case types.INT:
      return 'int';
    case types.FLOAT:
      return 'float';
    case types.DOUBLE:
      return 'double';
      /* istanbul ignore next */
    default:
      return 'undefined';
  }
}