Convert the start value to it's highest whole unit.
Accespts an optional precision for how many significant digits
to retain

@param int|null $precision
@return float
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;
    }
502505
public function getSize( $precision = NULL )
	{
		$size	= filesize( $this->fileName );
		if( $precision )
		{
			$size	= Alg_UnitFormater::formatBytes( $size, $precision );
		}
		return $size;
	}
423486
public static function readableSize($bytes, $precision = 1)
    {
        static $units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
        if ($bytes === 0) {
            return '0 '.$units[0];
        }
        $exponent = floor(log($bytes, 1024));
        $value = $bytes / pow(1024, $exponent);

        return round($value, $precision).' '.$units[$exponent];
    }
1164962
public function roundDown(int $precision = 0): Utility
    {
        return $this->round($this->number, $precision, PHP_ROUND_HALF_DOWN);
    }
219199
public static function fromFloat($float)
    {
        if (is_int($float)) {
            return new self($float);
        }

        if (!is_numeric($float)) {
            throw new InvalidArgumentException(
                'Argument passed is not a numeric value.'
            );
        }

        // Make sure the float is a float not scientific notation.
        // Limit a max of 8 chars to prevent float errors
        $float = rtrim(sprintf('%.8F', $float), '0');

        // Find and grab the decimal space and everything after it
        $denominator = strstr($float, '.');

        // Pad a one with zeros for the length of the decimal places
        // ie  0.1 = 10; 0.02 = 100; 0.01234 = 100000;
        $denominator = (int) str_pad('1', strlen($denominator), '0');
        // Multiply to get rid of the decimal places.
        $numerator = (int) ($float*$denominator);

        return new self($numerator, $denominator);
    }
379735
public static function fromDecimal(Decimal $decValue, int $scale = null): Decimal
    {
        self::paramsValidation($decValue, $scale);

        // This block protect us from unnecessary additional instances
        if ($scale === null || $scale >= $decValue->scale) {
            return $decValue;
        }

        return new static(
            self::innerRound($decValue->value, $scale),
            $scale
        );
    }
902298
public function stop(int $precision = -1)
    {
        $time = microtime(true);
        if ($this->stopTime === null) {
            $this->stopTime = $time;
            $this->duration = $this->stopTime - $this->startTime;
        }
        return $this->fmtDuration($this->duration, $precision);
    }
878919
public static function stop( $handle, $precision = self::DEFAULT_PRECISION )
    {
        $start_time = isset(self::$benchmarks[$handle]) ? self::$benchmarks[$handle] : NULL;
        $stop_time = microtime(true);

        self::$benchmarks[$handle] = $stop_time;

        return round( ($stop_time - $start_time) * 1000, $precision );
    }
1167788
public static function percentage(float $n, int $precision = 0): string
    {
        return self::$locale->percent(round($n, $precision + 2));
    }
1312756
public static Decimal fromLong(long l, int precision, int scale) {
		checkArgument(precision > 0 && precision <= MAX_LONG_DIGITS);
		checkArgument((l >= 0 ? l : -l) < POW10[precision]);
		return new Decimal(precision, scale, l, null);
	}
738095
public function getRuntime(int $precision = 10)
    {
        if ($this->startTime == $this::NOT_INITIALIZED || $this->endTime == $this::NOT_INITIALIZED) {
            return FALSE;
        }

        $runTime = round($this->endTime - $this->startTime, $precision);

        return $runTime;
    }
1124769
public static function float($value){

		$value = static::_nullValue($value);

		if($value !== null){

			// Avoid decimal separator nonsense
			$value = str_replace(',', '.', $value);
			$value = (float) $value;
		}

		return $value;
	}
1034966
public static function fromSatoshis($integer, $precision = null)
    {
        if ($precision === null) {
            $precision = static::$PRECISION;
        }

        // see if this looks like an exponent
        //   if so, convert this to a string
        $e_pos = is_integer($integer) ? false : strpos($integer, 'e+');
        if ($e_pos !== false) {
            $base = substr($integer, 0, $e_pos);
            $exponent = substr($integer, $e_pos + 2);
            $decimal_pos = strpos($base, '.');
            $decimal_count = strlen($base) - $decimal_pos - 1;
            $base = str_replace('.', '', $base);
            $zeros_count = $exponent - $decimal_count;
            $integer = $base . str_repeat('0', $zeros_count);
        }

        return new static(new BigInt($integer), $precision);
    }
105421
public function decimal($column, $precision = 8, $scale = 2)
    {
        return $this->table->addColumn($column, Type::DECIMAL, compact('precision', 'scale'));
    }
1304886
private function determinePrecision($options)
    {
        $precision = $options['float.precision'];

        if ($precision === false) {
            $precision = ini_get('serialize_precision');
        }

        return max(1, (int) $precision);
    }
1253286
public function allocateTo($n, $precision = self::PRECISION_CURRENCY)
    {
        if (!is_int($n)) {
            throw new Exception\InvalidArgumentException('Number of targets must be an integer');
        }

        return $this->allocate(array_fill(0, $n, 1), $precision);
    }
347547
private function round($value, $precision)
    {
        $precision = $this->getUninitializedPrecision($value, $precision);

        $roundingModeAttribute = $this->getAttribute(self::ROUNDING_MODE);
        if (isset(self::$phpRoundingMap[$roundingModeAttribute])) {
            $value = round($value, $precision, self::$phpRoundingMap[$roundingModeAttribute]);
        } elseif (isset(self::$customRoundingList[$roundingModeAttribute])) {
            $roundingCoef = pow(10, $precision);
            $value *= $roundingCoef;
            $value = (float) (string) $value;

            switch ($roundingModeAttribute) {
                case self::ROUND_CEILING:
                    $value = ceil($value);
                    break;
                case self::ROUND_FLOOR:
                    $value = floor($value);
                    break;
                case self::ROUND_UP:
                    $value = $value > 0 ? ceil($value) : floor($value);
                    break;
                case self::ROUND_DOWN:
                    $value = $value > 0 ? floor($value) : ceil($value);
                    break;
            }

            $value /= $roundingCoef;
        }

        return $value;
    }