Method for getting the PrecisionModel::FIXED precision of a numeric value.

@param float $numeric
@return float
172702
private function makeFixed(float $numeric): float {
        return intval($numeric * ($p = pow(10, $this->precision))) / $p;
    }
1167788
public static function percentage(float $n, int $precision = 0): string
    {
        return self::$locale->percent(round($n, $precision + 2));
    }
18120
public function toBest($precision = null)
    {
        $fromUnit = UnitResolver::resolve($this->from);
        $base = $this->getBase() == 2 ? 1024 : 1000;
        $converted = $this->start;
        while ($converted >= 1) {
            $fromUnit++;
            $result = $this->div($this->start, pow($base, $fromUnit), $precision);
            if ($result <= 1) return $converted;
            $converted = $result;
        }
        return $converted;
    }
1194103
protected function _getFloatColumn(Column\Float $column)
    {
        if (is_null($column->getDecimal())) {
            return sprintf(
                '%s FLOAT(%s)',
                $column->getName(),
                $column->getDigits()
            );
        }

        return sprintf(
            '%s DECIMAL(%s, %s)',
            $column->getName(),
            $column->getDigits(),
            $column->getDecimal()
        );
    }
1257828
private function sanitizePrecision($precision)
    {
        if (!is_numeric($precision) || $precision < 0) {
            throw new \InvalidArgumentException(sprintf('Invalid precision: %s', print_r($precision, true)));
        }

        return (int) $precision;
    }
847654
public static function toFloat($o) : ?float
    {
        $o = self::toNumber($o);

        if (is_numeric($o) === true) {
            return floatval($o);
        }

        return $o;
    }
1225444
public static function formatNumber( $float, $unit = 1, $precision = 0 )
	{
		Deprecation::getInstance()->setExceptionVersion( '0.8' )
			->message(  'Use one of the other methods instead' );
		if( (int) $unit )
		{
			$float	= $float / $unit;
			if( is_int( $precision ) )
				$float	= round( $float, $precision );
		}
		return $float;
	}
1284150
private function roundValue( $value, $precision )
	{
		if ( $precision == INF ) return $value;
		return round( $value, \XBRL_Instance::inferDecimals( $value, $precision ) );
	}
502505
public function getSize( $precision = NULL )
	{
		$size	= filesize( $this->fileName );
		if( $precision )
		{
			$size	= Alg_UnitFormater::formatBytes( $size, $precision );
		}
		return $size;
	}
705080
public function getPrettyNumber($value, $precision = 0)
    {
        if ($this->decimalPoint === null) {
            $locale = localeconv();

            $this->decimalPoint = $locale['decimal_point'];
            $this->thousandsSeparator = $locale['thousands_sep'];
        }

        return number_format($value, $precision, $this->decimalPoint, $this->thousandsSeparator);
    }
1117079
public function getAndSet(float $value): float
    {
        return floatval($this->handle->getSet($this->name, strval($value)));
    }
416883
public function additiveInverse(): Decimal
    {
        if ($this->isZero()) {
            return $this;
        } elseif ($this->isNegative()) {
            $value = \substr($this->value, 1);
        } else { // if ($this->isPositive()) {
            $value = '-' . $this->value;
        }

        return new static($value, $this->scale);
    }
861472
public function getDpr()
    {
        if (!is_numeric($this->dpr)) {
            return 1.0;
        }

        if ($this->dpr < 0 or $this->dpr > 8) {
            return 1.0;
        }

        return (double) $this->dpr;
    }
1349576
public static function inferPrecision( $value, $decimals )
	{
		if ( $decimals == "INF" ) return INF;
		if ( ! is_numeric( $value ) ) return false;

		$fValue = floatval( $value );

		if ( $value === false ) return false;
		if ( $decimals === "" ) return 0;

		$precision = 0;
		if ( preg_match( '/[-+]?[0]*([1-9]?[0-9]*)([.])?(0*)([1-9]?[0-9]*)?([eE])?([-+]?[0-9]*)?/', $value, $matches ) )
		{
			list( $all, $nonZeroInt, $period, $zeroDec, $nonZeroDec, $e, $exp ) = $matches;
			$precision = (
				$nonZeroInt
					? strlen( $nonZeroInt )
					: ( $nonZeroDec ? -strlen( $zeroDec ) : 0 )
				) + ( $exp ? intval( $exp ) : 0 ) + ( intval( $decimals ) );

			if ( $precision < 0 ) $precision = 0;
		}

		return $precision;
	}
1069782
public static function number(float $n, int $precision = 0): string
    {
        return self::$locale->number(round($n, $precision));
    }
698958
protected function setSpecificPrecisionFormat($precision)
    {
        if ($precision < 0) {
            throw new \InvalidArgumentException('Precision must be positive');
        }
        if ($precision > 3) {
            throw new \InvalidArgumentException('Invalid precision. Binary suffix converter can only represent values in '.
                'up to three decimal places');
        }

        $icuFormat = '#';
        if ($precision > 0) {
            $icuFormat .= \str_pad('#.', (2 + $precision), '0');
        }

        foreach ($this->binaryPrefixes as $size => $unitPattern) {
            if ($size >= 1024) {
                $symbol = \substr($unitPattern, \strpos($unitPattern, ' '));
                $this->binaryPrefixes[$size] = $icuFormat.$symbol;
            }
        }
    }
744999
public static function round($i, $precision = 0){

		$precision = pow(10,$precision);
		$i = $i*$precision;

		$ceil = ceil($i);
		$floor = floor($i);
		if( ($ceil - $i) <= ($i - $floor) ){
			return $ceil/$precision;
		}else{
			return $floor/$precision;
		}
	}