r"""Makes sure that x is type of float
326068
def ensure_dtype_float(x, default=np.float64):
    

    """
    if isinstance(x, np.ndarray):
        if x.dtype.kind == 'f':
            return x
        elif x.dtype.kind == 'i':
            return x.astype(default)
        else:
            raise TypeError('x is of type '+str(x.dtype)+' that cannot be converted to float')
    else:
        raise TypeError('x is not an array')
1103859
def _cast_float(self, value):
        """"""
        try:
            return float(value)
        except ValueError:
            msg.err("Cannot convert {} to float for line {}.".format(value, self.identifier))
            exit(1)
947560
def enforce_type(self, attr, val):
        """"""
        if not attr in self.types:
            return utfstr(val)
        elif self.types[attr] == 'int':
            return int(float(val))
        elif self.types[attr] == 'float':
            return float(val)
        else:
            return utfstr(val)
656365
def _fmt_float(cls, x, **kw):
        
        n = kw.get('n')
        return '%.*f' % (n, cls._to_float(x))
839432
def get_val(self, x):
        """"""
        try:
            if self.subtype == 'integer':
                return int(round(x[self.col_name]))
            else:
                if np.isnan(x[self.col_name]):
                    return self.default_val

                return x[self.col_name]

        except (ValueError, TypeError):
            return self.default_val
1075674
def p_ConstValue_float(p):
  """"""
  p[0] = model.Value(type=model.Value.FLOAT, value=p[1])
1232554
def cast_float(x):
    
    try:
        x = float(x)
    except ValueError:
        try:
            x = x.strip()
        except AttributeError as e:
            logger_misc.warn("parse_str: AttributeError: String not number or word, {}, {}".format(x, e))
    return x
719864
def _handle_type(self, other):
        """"""
        if isinstance(other, Int):
            return Int
        elif isinstance(other, Float):
            return Float
        else:
            raise TypeError(
                f"Unsuported operation between `{type(self)}` and `{type(other)}`."
            )
939276
def _safe_type(value):
    """"""

    if type(value) is str: dtype = 'string'
    if type(value) is unicode: dtype = 'string'
    if type(value) is int: dtype = 'integer'
    if type(value) is float: dtype = 'real'

    return dtype
1008040
function isFloat (n, shouldCoerce) {
  if (shouldCoerce) {
    if (typeof n === "string") {
      n = parseFloat(n);
    }
  }

  return n === +n && n !== (n|0);
}
1022992
def incr_float(self, key, incr_by=1.):
        """"""
        return self.database.hincrbyfloat(self.key, key, incr_by)
798899
function isNotFloat(value, message, id) {
    if (message === void 0) { message = ''; }
    if (id === void 0) { id = ''; }
    if (this.enabled && typeof value === 'number' && value % 1 === 0) {
        throw TypeException.expectedType(assertionTypes.IS_NOT_FLOAT, value, '<float>', message, id);
    }
}
911872
def write_float(self, f):
        
        if type(f) is not float:
            raise TypeError('expected a float (got:%r)' % (type(f),))

        self.write(struct.pack("%sf" % self.endian, f))
1236078
def float_constructor(loader, node):
    """"""
    s = loader.construct_scalar(node)
    if s == '.inf':
        return Decimal('Infinity')
    elif s == '-.inf':
        return -Decimal('Infinity')
    elif s == '.nan':
        return Decimal('NaN')
    return Decimal(s)
752854
def get_float_value(self, section, option, default=0.0):
        """"""
        try:
            return self.parser.getfloat(section, option)
        except NoOptionError:
            return float(default)
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
842294
def is_complex_floating_dtype(dtype):
    """"""
    dtype = np.dtype(dtype)
    return np.issubsctype(getattr(dtype, 'base', None), np.complexfloating)