@param int|float $n1
@param int|float $n2
@param bool      $round

@return float
557413
public static function div($n1, $n2, $round = false)
    {
        // Avoid division by Zero
        if ($n2 == 0) {
            return (float)0;
        }

        $quotient = bcdiv($n1, $n2, self::$scale);

        return $round ? self::round($quotient) : (float)$quotient;
    }
590545
public static function round($num, int $precision=0, int $mode=\PHP_ROUND_HALF_UP) {
		ref\format::round($num, $precision, $mode);
		return $num;
	}
712666
public function round($value, $currency = null)
    {
        return round($value / $this->interval, $this->precision) * $this->interval;
    }
1096446
public static function roundCollection(array $data, $precision = 2)
    {
        $output = array();

        foreach ($data as $key => $value){
            $output[$key] = round($value, $precision);
        }

        return $output;
    }
753485
public static function div($float1, $float2)
    {
        if (!static::is($float1) || !static::is($float2)) {
            throw new \InvalidArgumentException("The \$float1 and \$float2 parameters must be of type float.");
        }

        if ($float2 == 0) {
            throw new \InvalidArgumentException("Cannot divide by zero. The \$float2 parameter cannot be zero.");
        }

        return ($float1 / $float2);
    }
1250230
public function round($decimals = 2) {

		if(false === ('-' . intval($decimals) == '-' . $decimals)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($decimals)), E_USER_ERROR);
		}

		return $this -> convert(function($number, $decimals) {
			return round($number, $decimals);
		}, [$decimals]);
	}
1357991
public static double mutiply(final double n1, final double n2) {
		final BigDecimal b1 = new BigDecimal(n1);
		final BigDecimal b2 = new BigDecimal(n2);
		BigDecimal b3 = b1.multiply(b2);
		b3 = b3.setScale(3, BigDecimal.ROUND_HALF_UP);
		final double result = b3.doubleValue();
		return result;
	}
1332141
public static function cast( $input, $default = null, ?int $precision = null ) {

    $result = null;
    switch( true ) {
      case is_int( $input ) || is_float( $input ):
        $result = $input;
        break;

      case is_bool( $input ):
        $result = $input ? 1 : 0;
        break;

      case Text::is( $input, true ) && strlen( $input ) > 0 && ltrim( $input, '+-,.e0123456789' ) == '':
        $tmp    = floatval( str_replace( ',', '.', $input ) );
        $result = strpos( $input, '.' ) === false && strpos( $input, ',' ) === false ? intval( $tmp ) : $tmp;
        break;
    }

    if( $result === null ) return $default;
    else return $precision === null ? $result : ( $precision === 0 ? intval( $result ) : round( $result, $precision ) );
  }
494120
public function convertToBase($amt, $fcrn_id, $date,$round = 6) {
        $source = $this->getSysCcmpCurrencySource($date);
        $rate = $this->getCurrencyRate($fcrn_id, $date,$source);
        if ($rate === FALSE) {
            return FALSE;
        }
        
        /**
         * @todo add convert type to fcsr_courrency_source as definition
         */
        if ($source == 2){
            return round($rate * $amt, $round);
        }
        return round($amt/$rate, $round);

        
    }
462524
public function convert($value, $targetCurrency, $round = true, $valueCurrency = null)
    {
        return $this->getConverter()->convert($value, $targetCurrency, $round, $valueCurrency);
    }
756157
public static function between(
        $latitude1,
        $longitude1,
        $latitude2,
        $longitude2,
        $decimals = 1,
        $unit = 'km'
    ) {
        // define calculation variables
        $theta = $longitude1 - $longitude2;
        $distance = (sin(deg2rad($latitude1)) * sin(deg2rad($latitude2)))
            + (cos(deg2rad($latitude1)) * cos(deg2rad($latitude2)) * cos(deg2rad($theta)))
        ;
        $distance = acos($distance);
        $distance = rad2deg($distance);
        $distance = $distance * 60 * 1.1515;

        // unit is km
        if ($unit == 'km') {
            // redefine distance
            $distance = $distance * 1.609344;
        }

        // return with one decimal
        return round($distance, $decimals);
    }
119786
public static Boolean greaterThan( Number n1 , Number n2 )
    {
        Class<?> type = getComputationType(n1,n2);
        Number val1 = convertTo(n1,type);
        Number val2 = convertTo(n2,type);

        if (type == Long.class)
            return val1.longValue() > val2.longValue() ? Boolean.TRUE : Boolean.FALSE;
        return val1.doubleValue() > val2.doubleValue() ? Boolean.TRUE : Boolean.FALSE;
    }
459985
function(color1, color2, factor) {
		if (arguments.length < 3) { factor = 0.5; }
		var result = color1.slice();
		for (var i=0;i<3;i++) {
			result[i] = Math.round(result[i] + factor*(color2[i]-color1[i]));
		}
		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;
    }
626485
function (n1, n2) {
            var isOk1 = _isNumber(n1),
                isOk2 = _isNumber(n2);
            
            if (isOk1 && isOk2) {
                // both are finite numbers
                return (n1 - n2);
            }
            else if (isOk1)
                return -1;
            else if (isOk2)
                return 1;
            else
                return 0;
        }
201871
public static function mathAdd($decimal1, $decimal2) {
        if (!is_numeric($decimal1)) {
            throw new Exception("decimal1 is not a numeric value: " . $decimal1);
        }

        if (!is_numeric($decimal2)) {
            throw new Exception("decimal2 is not a numeric value: " . $decimal2);
        }

        return round($decimal1 + $decimal2, StaticEb::$roundPrecision);
    }
40813
public function compute(DecimalNumber $number, $precision, $roundingMode)
    {
        switch ($roundingMode) {
            case self::ROUND_HALF_UP:
                return $this->roundHalfUp($number, $precision);
                break;
            case self::ROUND_CEIL:
                return $this->ceil($number, $precision);
                break;
            case self::ROUND_FLOOR:
                return $this->floor($number, $precision);
                break;
            case self::ROUND_HALF_DOWN:
                return $this->roundHalfDown($number, $precision);
                break;
            case self::ROUND_TRUNCATE:
                return $this->truncate($number, $precision);
                break;
            case self::ROUND_HALF_EVEN:
                return $this->roundHalfEven($number, $precision);
                break;
        }

        throw new \InvalidArgumentException(sprintf("Invalid rounding mode: %s", print_r($roundingMode, true)));
    }