public function allocate(array $ratios, $precision = self::PRECISION_CURRENCY)
    {
        $precision  = $this->castPrecision($precision);
        $remainder  = $this->amount;
        $results    = [];
        $total      = Decimal::create(array_sum($ratios), $precision);

        foreach ($ratios as $ratio) {
            $share = $this->amount
                ->mul(Decimal::create($ratio, $precision), $precision)
                ->div($total, $precision);

            $results[] = $this->newInstance($share);
            $remainder = $remainder->sub($share, $precision);
        }

        $minValue = Decimal::create(
            $precision ? '0.' . str_repeat('0', $precision - 1) . '1' : 1
        );

        for ($i = 0; !$remainder->isZero($precision); $i++) {
            if ($remainder->isPositive()) {
                $remainder = $remainder->sub($minValue, $precision);
                $results[$i]->amount = $results[$i]->amount->add($minValue, $precision);
            } else {
                $remainder = $remainder->add($minValue, $precision);
                $results[$i]->amount = $results[$i]->amount->sub($minValue, $precision);
            }
        }

        return $results;
    }