Accepts: float, int, long, str, unicode
        Returns: float
175634
def validate(self, value):
        
        if isinstance(value, (str, unicode, int, long)):
            value = float(value)
        value = super(Float, self).validate(value)
        if not isinstance(value, (float)):
            raise ValueError("Not an float: %r" % (value, ))
        return value
602354
def positivefloat(value):
    
    f = float(not_empty(value))
    if f < 0:
        raise ValueError('float %s < 0' % f)
    return f
1185496
def _normalize(value):
        
        if hasattr(value, 'value'):
            value = value.value
        if value is not None:
            value = long(value)
        return value
1326630
def form(value):
    
    if isinstance(value, FLOAT + INT):
        if value <= 0:
            return str(value)
        elif value < .001:
            return '%.3E' % value
        elif value < 10 and isinstance(value, FLOAT):
            return '%.5f' % value
        elif value > 1000:
            return '{:,d}'.format(int(round(value)))
        elif numpy.isnan(value):
            return 'NaN'
        else:  # in the range 10-1000
            return str(int(value))
    elif isinstance(value, bytes):
        return decode(value)
    elif isinstance(value, str):
        return value
    elif isinstance(value, numpy.object_):
        return str(value)
    elif hasattr(value, '__len__') and len(value) > 1:
        return ' '.join(map(form, value))
    return str(value)
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
1344416
def _convert_to_floats(self, data):
        
        for key, value in data.items():
            data[key] = float(value)

        return data
1082308
def value(self):
        
        if self.opts['int']:
            return int(self.val)
        else:
            return float(self.val)
1269238
def floating_point(
        element_name,  # type: Text
        attribute=None,  # type: Optional[Text]
        required=True,  # type: bool
        alias=None,  # type: Optional[Text]
        default=0.0,  # type: Optional[float]
        omit_empty=False,  # type: bool
        hooks=None  # type: Optional[Hooks]
):
    # type: (...) -> Processor
    
    value_parser = _number_parser(float)
    return _PrimitiveValue(
        element_name,
        value_parser,
        attribute,
        required,
        alias,
        default,
        omit_empty,
        hooks
    )
474087
def positive_float(s):
    
    err_msg = "must be a positive number, not %r" % s
    try:
        value = float(s)
    except ValueError:
        raise argparse.ArgumentTypeError(err_msg)
    if value <= 0:
        raise argparse.ArgumentTypeError(err_msg)
    return value
470969
def t_NUMBER(self, t):
        '
        try:
            sv = t.value
            v = float(sv)
            iv = int(v)
            t.value = (iv if iv == v else v, sv)
        except ValueError:
            print("Number %s is too large!" % t.value)
            t.value = 0
        return t
715823
def to_float(value, default=_marker):
    
    if not is_floatable(value):
        if default is not _marker:
            return to_float(default)
        fail("Value %s is not floatable" % repr(value))
    return float(value)
826630
def toFloat(value):
    
    if isinstance(value, str):
        return strFloat(value)
    elif isinstance(value, list):
        return slistFloat(value)
    else:
        return value
650900
def long2str(l):
    """"""
    if type(l) not in (types.IntType, types.LongType):
        raise ValueError('the input must be an integer')

    if l < 0:
        raise ValueError('the input must be greater than 0')
    s = ''
    while l:
        s = s + chr(l & 255)
        l >>= 8

    return s
147039
def _enforceDataType(self, data):
        
        value = float(data)
        if math.isnan(value):
            raise ValueError("FloatCti can't store NaNs")

        if math.isinf(value):
            if value > 0:
                logger.warn("Replacing inf by the largest representable float")
                value = sys.float_info.max
            else:
                logger.warn("Replacing -inf by the smallest representable float")
                value = -sys.float_info.max

        return value
1231278
def getFloat(t):
    
    d = c_double()
    if PL_get_float(t, byref(d)):
        return d.value
    else:
        raise InvalidTypeError("float")
133922
def to_int(s):
    
    try:
        return int(s.replace('_', ''))
    except ValueError:
        return int(ast.literal_eval(s))
827034
def safe_float(string, default=None):
    
    value = default
    try:
        value = float(string)
    except TypeError:
        pass
    except ValueError:
        pass
    return value