@param mixed $val

@return float

@throws \frictionlessdata\tableschema\Exceptions\FieldValidationException;
1329
protected function validateCastValue($val)
    {
        if (isset($this->descriptor()->bareNumber) && $this->descriptor()->bareNumber === false) {
            return mb_ereg_replace('((^\D*)|(\D*$))', '', $val);
        }
        $isPercent = false;
        if (is_string($val)) {
            if (substr($val, -1) == '%') {
                $val = rtrim($val, '%');
                $isPercent = true;
            }
            if (isset($this->descriptor()->groupChar)) {
                $val = str_replace($this->descriptor()->groupChar, '', $val);
            }
            if (isset($this->descriptor()->decimalChar) && $this->descriptor()->decimalChar != '.') {
                $val = str_replace($this->descriptor()->decimalChar, '.', $val);
            }
        }
        if (!is_numeric($val)) {
            throw $this->getValidationException('value must be numeric', $val);
        } else {
            $val = (float) $val;
            if ($isPercent) {
                $val = $val / 100;
            }

            return $val;
        }
    }
995342
protected function validateCastValue($val)
    {
        if (isset($this->descriptor()->bareNumber) && $this->descriptor()->bareNumber === false) {
            return mb_ereg_replace('((^\D*)|(\D*$))', '', $val);
        } elseif (!is_numeric($val)) {
            throw $this->getValidationException('value must be numeric', $val);
        } else {
            $intVal = (int) $val;
            if ($intVal != (float) $val) {
                throw $this->getValidationException('value must be an integer', $val);
            } else {
                return $intVal;
            }
        }
    }
1255897
public function filter($value) : float
    {
        $float = $value;

        if ($value) {
            $float = str_replace(',', '.', $value);
        }

        return (float) $float;
    }
291686
public function getFloat($fields = null, $where = null, $orderBy = null): float
    {
        return (float)self::get($fields, $where, $orderBy);
    }
419251
function type($val) {
		switch (gettype($val)) {
			case 'NULL':
				return \PDO::PARAM_NULL;
			case 'boolean':
				return \PDO::PARAM_BOOL;
			case 'integer':
				return \PDO::PARAM_INT;
			case 'resource':
				return \PDO::PARAM_LOB;
			case 'float':
				return self::PARAM_FLOAT;
			default:
				return \PDO::PARAM_STR;
		}
	}
119234
protected function realToBinary($val)
    {
        $bdata = self::typeBytes("2", 3); // 2 is 0010, type indicator for reals
        return $bdata.strrev(pack("d", (float)$val));
    }
110813
public function getVat() : ?float 
    {
        if ( ! $this->hasVat()) {
            $this->setVat($this->getDefaultVat());
        }
        return $this->vat;
    }
308796
protected function Sub( $val )
	{
		if ( ! $val instanceof ByteProxy ) throw new \InvalidArgumentException();
		return new IntProxy( $this->_value - $val->_value );
	}
662867
public function sum($field, $where = null): float
    {
        return floatval(self::get(['sum(' . $field . ')' => 'sum'], $where));
    }
696553
protected function Eq( $val )
	{
		if  (! $val->getIsNumeric() ) return false;
		return  $this->ToInt( null ) == $val->ToInt( null );
	}
1157770
protected function Sub( $val )
	{
		if ( ! $val instanceof ValueProxy ) throw new \InvalidArgumentException();
		return new IntProxy( $this->_value - $val->getValue() );
	}
835710
protected function validateNumber($value, ValidationField $field) {
        $result = filter_var($value, FILTER_VALIDATE_FLOAT);
        if ($result === false) {
            $field->addTypeError($value, 'number');
            return Invalid::value();
        }

        $result = $this->validateNumberProperties($result, $field);

        return $result;
    }
886714
public function float($key) {
        $v = new FloatValidator($this->shell->_unsafeVar[$key] ?? null, $this->shell);
        $v->_isUndefined = !array_key_exists($key, $this->shell->_unsafeVar);
        $this->shell->subValidators[$key] = $v;
        return $v;
    }
1117079
public function getAndSet(float $value): float
    {
        return floatval($this->handle->getSet($this->name, strval($value)));
    }
471244
private function tobytes($val) {
		$val = trim($val);
		$last = fix_strtolower($val{strlen($val)-1});
		switch($last) {
			case 'g':
				$val *= 1024;
			case 'm':
				$val *= 1024;
			case 'k':
				$val *= 1024;
		}
		return $val;
	}
245112
public function validate($value)
    {
        return is_float($value) ? Ok::unit() : Error::unit([ Error::NON_FLOAT ]);
    }
350907
protected function Div( $val )
	{
		$denominator = $val->getValue(); // Make sure it's a double not an int
		$numerator = $this->getValue();

		if ( is_nan( $denominator ) )
		{
			throw XPath2Exception::withErrorCode( "FOAR0001", Resources::FOAR0001 );
		}

		if ( is_nan( $numerator ) )
		{
			throw XPath2Exception::withErrorCode( "FOAR0002", Resources::FOAR0002 );
		}

		// Replace the handler because the status test handler traps any error and terminates the session
		$previousHandler = set_error_handler(null);
		$result = new DoubleProxy( @($numerator / $denominator) );
		set_error_handler( $previousHandler );
		return $result;

		// A long hand version without incurring a notice
		return new DoubleProxy(
			$denominator == 0
				? (
					$numerator == 0
						? NAN
						: ( ( strval( $denominator )[0] == '-' && strval( $numerator )[0] != '-' ) ||
							( strval( $numerator )[0] == '-' && strval( $denominator )[0] != '-' )
								? -INF : INF
						  )
				  ) : @($numerator / $denominator)
		);
	}