Attempt to cast *value* into a float, returning *default* if it fails.
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
236648
def getfloat(self, key, **kwargs):
        

        return self.get(key, cast_func=float, **kwargs)
1292864
def _parse_int(value, default=None):
    
    if value is None:
        return default
    try:
        return int(value)
    except ValueError:
        print "Couldn't cast value to `int`."
        return default
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)
517779
def toFloat(val):
    """"""
    hex = "0123456789abcdef"
    return float(hex.find(val[0]) * 16 + hex.find(val[1]))
657710
public static float getFloat(
    Object      value)
  {
    if (value == null)
    {
        return 0;
    }

    return Float.valueOf(value.toString()).floatValue();
  }
916100
def cast_value(val, totype):
    
    t = type(val)
    if issubclass(t, totype):
        return val  # no cast needed
    if issubclass(totype, bytes):
        return bytes(val)
    if issubclass(totype, str):
        return str(val)
    if issubclass(totype, bool):
        if issubclass(t, str):
            _v = val.lower()
            if _v in ("true", "yes", "y"):
                return True
            if _v in ("false", "no", "n"):
                return False
            raise TypeError("Not able to cast value: " + str(val) +
                            " with " + str(t) +
                            " to " + str(totype))

    if (issubclass(totype, (int, float)) and
        issubclass(t, (bytes, str, int, float))):
        if val:
            return totype(float(val))
        else:
            return totype(0)

    raise TypeError("Not able to cast value:" + str(val) +
                    " with " + str(t) +
                    " to " + str(totype))
82121
def get_float(self, key, optional=False):
        
        return self._get_typed_value(key, float, lambda x: float(x), optional)
52608
def get_float(self, key, default=None):
        
        value = self.get(key, default)
        return None if value is None else float(value)
100045
def __float(value):
    ''''''
    valid, _value = False, value
    try:
        _value = float(value)
        valid = True
    except ValueError:
        pass
    return (valid, _value, 'float')
920798
public JBBPOut Float(final float... value) throws IOException {
    assertNotEnded();
    assertArrayNotNull(value);
    if (this.processCommands) {
      for (final float f : value) {
        _writeFloat(f);
      }
    }
    return this;
  }
1212552
def _cast(self, value):
        
        if self.type != 'text':
            value = utils.cast(self.TYPES.get(self.type)['cast'], value)
        return value
882677
def decimal_default(obj):
    """"""
    if isinstance(obj, decimal.Decimal):
        if obj % 1:
            return float(obj)
        return int(obj)
    raise TypeError
1172188
def encode(cls, value):
        
        try:
            if float(value) + 0 == value:
                return repr(value)
        except (TypeError, ValueError):
            pass

        raise InvalidValue('not a float')
1227398
def type_cast_value(self, ctx, value):
        
        if self.type.is_composite:
            if self.nargs <= 1:
                raise TypeError('Attempted to invoke composite type '
                                'but nargs has been set to %s.  This is '
                                'not supported; nargs needs to be set to '
                                'a fixed value > 1.' % self.nargs)
            if self.multiple:
                return tuple(self.type(x or (), self, ctx) for x in value or ())
            return self.type(value or (), self, ctx)

        def _convert(value, level):
            if level == 0:
                return self.type(value, self, ctx)
            return tuple(_convert(x, level - 1) for x in value or ())
        return _convert(value, (self.nargs != 1) + bool(self.multiple))
840337
def try_float(s, default=None, minimum=None):
    
    if not s:
        return default
    try:
        val = float(s)
    except (TypeError, ValueError):
        raise InvalidNumber(s, label='Invalid float value')
    if (minimum is not None) and (val < minimum):
        val = minimum
    return val
766799
def create_float(self, value: float) -> Float:
        
        self.append((4, value))
        return self.get(self.raw_count - 1)