Calculate the area of the group ( group is still not created ).

@param $round
@param $order

@return int
168050
protected function getNumArea($round, $order)
    {
        $totalAreas = $this->settings->fightingAreas;
        $numFighters = $this->championship->fighters->count(); // 4
        $numGroups = $this->getTreeSize($numFighters, $this->championship->getGroupSize()) / $this->championship->getGroupSize(); // 1 -> 1

        $areaSize = $numGroups / ($totalAreas * pow(2, $round - 1));

        $numArea = intval(ceil($order / $areaSize)); // if round == 4, and second match 2/2 = 1 BAD
        return $numArea;
    }
143342
@Override
	public int countByG_U_O(long groupId, long userId, int orderStatus) {
		FinderPath finderPath = FINDER_PATH_COUNT_BY_G_U_O;

		Object[] finderArgs = new Object[] { groupId, userId, orderStatus };

		Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(4);

			query.append(_SQL_COUNT_COMMERCEORDER_WHERE);

			query.append(_FINDER_COLUMN_G_U_O_GROUPID_2);

			query.append(_FINDER_COLUMN_G_U_O_USERID_2);

			query.append(_FINDER_COLUMN_G_U_O_ORDERSTATUS_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(groupId);

				qPos.add(userId);

				qPos.add(orderStatus);

				count = (Long)q.uniqueResult();

				finderCache.putResult(finderPath, finderArgs, count);
			}
			catch (Exception e) {
				finderCache.removeResult(finderPath, finderArgs);

				throw processException(e);
			}
			finally {
				closeSession(session);
			}
		}

		return count.intValue();
	}
786803
static function round12b($val)
	{
		if($val > 100)
			return round($val);

		if($val > 10)
			return round($val, 1);

		if($val - floor($val) > 0.2)
			return round($val, 1);

		return round($val, 2);
	}
927612
public function gr($table, $where = array(), $order = array(), $cols = array(), $groupby = array(), $having = array(), $offset = 0, $time = null) {
        $ret = $this->f($this->g($table, $where, $offset, 1, $order, $cols, $groupby, $having, false, $time, true));
        if (!$ret) $ret = $this->f($this->g($table, $where, $offset, 1, $order, $cols, $groupby, $having, false, $time, false));
        return $ret;
    }
617171
protected function prepareOrderComponentsAccountOrder(array &$order)
    {
        $this->setItemOrderCartComponent($order, $this->price);
        $this->setItemOrderPriceRuleComponent($order, $this->price, $this->price_rule);
        $this->setItemOrderPaymentComponent($order, $this->price, $this->payment, $this->order);
        $this->setItemOrderShippingComponent($order, $this->price, $this->shipping, $this->order);

        ksort($order['data']['components']);
    }
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;
		}
	}
967728
def roundup(x, order):
    '''
    '''
    return x if x % 10**order == 0 else x + 10**order - x % 10**order
807738
public function gr($table, $where = array(), $order = array(), $cols = array(), $groupby = array(), $having = array(), $offset = 0, $time = null) {
        if ($this->logqueries) $start = microtime(true);
        $ret = $this->f($this->g($table, $where, $offset, 1, $order, $cols, $groupby, $having, false, $time, true));
        if (!$ret) $ret = $this->f($this->g($table, $where, $offset, 1, $order, $cols, $groupby, $having, false, $time, false));
        if ($this->logqueries) $res = file_put_contents($this->logfile, "GR: " . (number_format(microtime(true) - $start, 4)) . "\n", FILE_APPEND);
        return $ret;
    }
265647
public function addDivider($order = null)
    {
        $item = static::make(array('name' => 'divider', 'order' => $order));

        $this->childs[] = $item;

        return $item;
    }
842198
public static function bytes( $size, $round = 2 ) 
	{
		$unit = array( 'b', 'kb', 'mb', 'gb', 'tb', 'pb' );
		return @round( $size / pow( 1024, ( $i = floor( log( $size, 1024 ) ) ) ), $round ).$unit[$i];
	}
243724
protected function getSortDirections($order)
	{
		$segs=explode(',',$order);
		$directions=array();
		foreach($segs as $seg)
		{
			if(preg_match('/(.*?)(\s+(desc|asc))?$/i',trim($seg),$matches))
				$directions[$matches[1]]=isset($matches[3]) && !strcasecmp($matches[3],'desc');
			else
				$directions[trim($seg)]=false;
		}
		return $directions;
	}
1331105
public function divide($divisor, $roundingMode = self::ROUND_HALF_UP, $precision = self::PRECISION_GAAP)
    {
        $this->assertRoundingMode($roundingMode);
        $divisor = $this->castOperand($divisor);
        $precision = $this->castPrecision($precision);

        $innerPrecision = $this->getInnerPrecision();
        if ($divisor->isZero($innerPrecision)) {
            throw new Exception\InvalidArgumentException('Division by zero');
        }

        $amount = $this->amount->div($divisor, $innerPrecision + 1);

        if (null === $roundingMode) {
            $amount = $amount->round($precision);
        } else {
            $amount = Math::bcround($amount, $precision, $roundingMode);
        }

        return $this->newInstance($amount);
    }
450068
public static function margin($cost, $charge_out, $round = false)
    {
        // Avoid division by zero
        if ($cost == $charge_out) {
            return (float)0;
        }

        $cost        = self::mul($cost, -1); // make cost be a negative.
        $numerator   = self::add($cost, $charge_out);
        $denominator = max(abs($cost), abs($charge_out));
        $result      = self::div($numerator, $denominator);
        $product     = self::mul($result, 100);
        $margin      = $round ? self::round($product) : $product;

        return (float)$margin;
    }
935101
private function round($result, $round_method = null)
    {
        if ($round_method === PHP_ROUND_HALF_UP) {
            $result = ceil($result);
        } elseif ($round_method === PHP_ROUND_HALF_DOWN) {
            $result = floor($result);
        }

        return $result;
    }
119543
public function elapsedTime(int $round = null)
    {
        $time = $this->end - $this->start;
        if (!is_null($round)) {
            $time = round($time, $round);
        }

        return (float) $time;
    }
884123
public function getSerieCount($Serie)
    {
        if (isset($this->Data["Series"][$Serie]["Data"])) {
            return sizeof($this->Data["Series"][$Serie]["Data"]);
        }
        return 0;
    }
305236
def area(self):
        """"""
        area = self.parse['attributes'].get('Shape_Area')
        if area:
            return round(float(area) * 10.76391)