Return float type user input
174468
def get_float(self, input_string):
        

        if input_string == '--training_fraction':

            # was the flag set?
            try:
                index = self.args.index(input_string) + 1
            except ValueError:
                # it wasn't, it's optional, so return the appropriate default
                return None

            # the flag was set, so check if a value was set, otherwise exit
            try:
                if self.args[index] in self.flags:
                    print("\n {flag} was set but a value was not specified".format(flag=input_string))
                    print_short_help()
                    sys.exit(1)
            except IndexError:
                print("\n {flag} was set but a value was not specified".format(flag=input_string))
                print_short_help()
                sys.exit(1)

            # a value was set, so check if its the correct type
            try:
                value = float(self.args[index])
            except ValueError:
                print("\n {flag} must be a float less than or equal to 1, e.g. 0.4".format(flag=input_string))
                print_short_help()
                sys.exit(1)
            if value > 1.0 or value < 0:
                print("\n {flag} must be a float less than or equal to 1, e.g. 0.4".format(flag=input_string))
                print_short_help()
                sys.exit(1)

            # everything checks out, so return the appropriate value
            return value
802261
def std_input(prompt="", style=None):
    
    p = ansi_wrap(prompt, **(style or {}))
    try:
        return raw_input(p).strip()
    except NameError:
        return input(p).strip()
752854
def get_float_value(self, section, option, default=0.0):
        """"""
        try:
            return self.parser.getfloat(section, option)
        except NoOptionError:
            return float(default)
1082645
def _ConvertFloat(value):
  """"""
  if value == 'nan':
    raise ParseError('Couldn\'t parse float "nan", use "NaN" instead.')
  try:
    # Assume Python compatible syntax.
    return float(value)
  except ValueError:
    # Check alternative spellings.
    if value == _NEG_INFINITY:
      return float('-inf')
    elif value == _INFINITY:
      return float('inf')
    elif value == _NAN:
      return float('nan')
    else:
      raise ParseError('Couldn\'t parse float: {0}.'.format(value))
311721
def getFloat(self, name, default=0.0, parent_search=False, multikeys_search=False):
		
		try:
			value = self.get(name, default, parent_search, multikeys_search)
			return float(value)

		except:
			# pas de configuration trouvé ou convertion impossible ?
			return default
145116
def get_input(input_func, input_str):
    
    val = input_func("Please enter your {0}: ".format(input_str))
    while not val or not len(val.strip()):
        val = input_func("You didn't enter a valid {0}, please try again: ".format(input_str))
    return val
874493
def ParseFloat(text):
  
  try:
    # Assume Python compatible syntax.
    return float(text)
  except ValueError:
    # Check alternative spellings.
    if _FLOAT_INFINITY.match(text):
      if text[0] == '-':
        return float('-inf')
      else:
        return float('inf')
    elif _FLOAT_NAN.match(text):
      return float('nan')
    else:
      # assume '1.0f' format
      try:
        return float(text.rstrip('f'))
      except ValueError:
        raise ValueError('Couldn\'t parse float: %s' % text)
1139144
def clean_float(v):
    """"""

    if v is None or not str(v).strip():
        return None

    return float(str(v).replace(',', ''))
350532
public static float[] asFloatTypeArray(List<Float> input) {
		float[] result = new float[input.size()];

		for (int i = 0; i < result.length; i++) {
			result[i] = input.get(i);
		}

		return result;
	}
1314957
def float(self, item, default=None):
        
        try:
            item = self.__getattr__(item)
        except AttributeError as err:
            if default is not None:
                return default
            raise err
        return float(item)
111812
def guess_type(s):
    
    sc = s.replace(',', '') # remove comma from potential numbers

    try:
        return int(sc)
    except ValueError:
        pass

    try:
        return float(sc)
    except ValueError:
        pass

    return s
1179216
def as_float(self):
        '''
        '''
        if not self.year:
            return None
        out = float(self.year.replace('?', '9'))
        if self.month:
            # TODO: we are assuming months are of equal length
            out += float(self.month.replace('?', '0')) / 12.0
            if self.day:
                out += float(self.day.replace('?', '0')) / 365.0
        return out
512081
def _parse_float(value, default=None):
    
    if value is None:
        return default
    try:
        return float(value)
    except ValueError:
        print "Couldn't cast value to `float`."
        return default
680067
def get_floats(bitwidth, limit=0):
    '''
    
    '''
    assert bitwidth in (32, 64, 80)

    values = [0.0, -1.0, 1.0, -1231231231231.0123, 123123123123123.123]
    for val in _limit_helper(values, limit):
        yield val
139304
def float2int(x):
    
    if not pd.isnull(x):
        if is_numeric(x):
            x=int(x)
    return x
435942
function( str ) {
        // if whole numbers, convert to integer
        if( /^\d+$/.test(str) ) return parseInt( str );
        // if decimal, convert to float
        if( /^\d*\.\d+$/.test(str) ) return parseFloat( str );
        // if "true" or "false", return boolean
        if( /^true$/.test(str) ) return true;
        if( /^false$/.test(str) ) return false;
        // else, return original string
        return str;
    }
176437
def _cast(self, value):
        
        if value.isdigit():
            value = int(value)
        elif re.compile("^\d+\.\d+").match(value):
            value = float(value)
        return value