Subtract two float values with precision given by StaticEb::$roundPrecision

@param float/int Number one
@param float/int Number two
@return float the sum
542938
public static function mathSubtract($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);
    }
1213002
private double round(double number) {
        boolean isNegative = isNegative(number);
        if (isNegative)
            number = -number;

        // Apply rounding after multiplier
        if (roundingDouble > 0.0) {
            // number = roundingDouble
            //    * round(number / roundingDouble, roundingMode, isNegative);
            return round(
                number, roundingDouble, roundingDoubleReciprocal, roundingMode,
                isNegative);
        }
        return number;
    }
1043693
public FloatPoint Divide(FloatPoint point1, FloatPoint point2) {
        FloatPoint result = new FloatPoint(point1);
        result.Divide(point2);
        return result;
    }
1142021
public static function fraction($num, float $precision=0.0001) {
		ref\format::fraction($num, $precision);
		return $num;
	}
493394
public static double sub(float v1, float v2) {
		return sub(Float.toString(v1), Float.toString(v2)).doubleValue();
	}
513596
public function getTotalPrice( $precision = 2 ) {

		$price	= ( $this->price - $this->discount ) * $this->purchase;

		return round( $price, $precision );
	}
590545
public static function round($num, int $precision=0, int $mode=\PHP_ROUND_HALF_UP) {
		ref\format::round($num, $precision, $mode);
		return $num;
	}
948788
function roundPrecision (x, d, places = 2) {
    return (Math.floor(x * d) / d).toFixed(places);
}
584688
public function getCartTotal( $precision = 2 ) {

		$items	= $this->activeItems;

		$total	= 0;

		foreach( $items as $item ) {

			if( $item->keep ) {

				$total	+= $item->getTotalPrice();
			}
		}

		return round( $total, $precision );
	}
22968
public static function add($n1, $n2, $round = false)
    {
        $sum = bcadd($n1, $n2, self::$scale);

        return $round ? self::round($sum) : (float)$sum;
    }
679998
public function subtract($b)
    {
        switch (true) {
            case $b instanceof Matrix:
                $c = $this->subtractMatrix($b);
                break;

            case $b instanceof ColumnVector:
                $c = $this->subtractColumnVector($b);
                break;
                
            case $b instanceof Vector:
                $c = $this->subtractVector($b);
                break;

            case is_int($b) or is_float($b):
                $c = $this->subtractScalar($b);
                break;

            default:
                throw new InvalidArgumentException('Cannot subtract a '
                    . gettype($b) . ' from a matrix.');
        }

        return $c;
    }
306413
public function getRound( $precision = 0, $mode = PHP_ROUND_HALF_UP )
	{
		if ( $this->getIsDecimal() === false )
		{
			// return $this;
		}

		if ( $precision === false ) $precision = $this->scale( $this->_value );
		if ( is_null( $precision ) ) $precision = 0;
		// if( $precision < 0) $precision = 0;

		$factor = 1;

		// If the precision is negative create a factor
		if ( $precision < 0 )
		{
			$precision = abs( $precision );
			$factor = bcpow( 10, $precision, $precision );
			$precision = 0;
		}

		// Create a new decimal on which to perform rounding
		$rounder = $this->Div( $factor );

		$isHalf = false;
		$increment = "0";
		$number = $rounder->_value;
		$sign = "";

		if ( $mode == PHP_ROUND_HALF_EVEN || $mode == PHP_ROUND_HALF_ODD )
		{
			// These are only relevant if the precision rounds the least significant digit and that digit is 5.
			if ( $rounder->getDecimalIsHalf( $precision ) )
			{
				$isHalf = true;

				if ( $precision - 1 >= 0 )
				// if ( $this->getIntegerPart() != 0 )
				{
					if ( $rounder->getIsDecimalEven( $precision - 1) )
					{
						if ( $mode == PHP_ROUND_HALF_ODD )
						{
							$sign = $rounder->getIsNegative() ? "-" : "";
							// The amount to add or substract is 1 at the digit position one above the $scale position
							// If the scale is zero then the value change is 1 or -1.  If the scale is 1 then the
							// change is 0.1 or -0.1.
							$increment = $sign . bcpow( 10, "-$precision", $precision );
						}
					}
					else
					{
						if ( $mode == PHP_ROUND_HALF_EVEN )
						{
							$sign = $rounder->getIsNegative() ? "-" : "";
							// The amount to add or substract is 1 at the digit position one above the $scale position
							// If the scale is zero then the value change is 1 or -1.  If the scale is 1 then the
							// change is 0.1 or -0.1.
							$increment = $sign . bcpow( 10, "-$precision", $precision );

						}
					}
				}
				else
				{
					if ( $rounder->getIsIntegerEven( $precision ) )
					{
						if ( $mode == PHP_ROUND_HALF_ODD )
						{
							$sign = $rounder->getIsNegative() ? -1 : 1;
							$increment = 1 * $sign;
						}
					}
					else
					{
						if ( $mode == PHP_ROUND_HALF_EVEN )
						{
							$sign = $rounder->getIsNegative() ? -1 : 1;
							$increment = 1 * $sign;
						}
					}
				}

			}
		}

		if ( $rounder->getIsNegative() && $mode == PHP_ROUND_HALF_UP )
		{
			$mode = PHP_ROUND_HALF_DOWN;
		// 	$mode = $mode == PHP_ROUND_HALF_UP
		// 		? PHP_ROUND_HALF_DOWN
		// 		: PHP_ROUND_HALF_UP;
		}

		// Round half-up or half-down according to the $mode
		if ( ! $isHalf && $rounder->getIsCloserToNext( $precision, $mode ) )
		{
			$decimalPart = $rounder->getDecimalPart();
			if ( strlen( $decimalPart > $precision ) )
			{
				$sign = $rounder->getIsNegative() ? "-" : "";
				// The amount to add or substract is 1 at the digit position one above the $scale position
				// If the scale is zero then the value change is 1 or -1.  If the scale is 1 then the
				// change is 0.1 or -0.1.
				$increment = $sign . bcpow( 10, "-$precision", $precision );
			}
		}

		$rounder = DecimalValue::FromValue( bcadd( $rounder->getValue(), $increment, $precision ) );
		if ( $factor > 1 )
		{
			$rounder = $rounder->Mul( $factor );
		}

		return $rounder;
		// return new DecimalValue( $number );
	}
131156
public static final Point subtract(Point p1, Point p2)
    {
        return new AbstractPoint(p1.getX() - p2.getX(), p1.getY() - p2.getY());
    }
1135173
public static float trunc(Float number, int precision) {
        return (float)(Math.floor(number.doubleValue()*Math.pow(10,precision))/Math.pow(10,precision));
    }
424733
function roundToPrecision(numStr, scale, fixedDecimalScale) {
  //if number is empty don't do anything return empty string
  if (['', '-'].indexOf(numStr) !== -1) return numStr;
  var shoudHaveDecimalSeparator = numStr.indexOf('.') !== -1 && scale;

  var _splitDecimal = splitDecimal(numStr),
      beforeDecimal = _splitDecimal.beforeDecimal,
      afterDecimal = _splitDecimal.afterDecimal,
      hasNagation = _splitDecimal.hasNagation;

  var roundedDecimalParts = parseFloat("0.".concat(afterDecimal || '0')).toFixed(scale).split('.');
  var intPart = beforeDecimal.split('').reverse().reduce(function (roundedStr, current, idx) {
    if (roundedStr.length > idx) {
      return (Number(roundedStr[0]) + Number(current)).toString() + roundedStr.substring(1, roundedStr.length);
    }

    return current + roundedStr;
  }, roundedDecimalParts[0]);
  var decimalPart = limitToScale(roundedDecimalParts[1] || '', Math.min(scale, afterDecimal.length), fixedDecimalScale);
  var negation = hasNagation ? '-' : '';
  var decimalSeparator = shoudHaveDecimalSeparator ? '.' : '';
  return "".concat(negation).concat(intPart).concat(decimalSeparator).concat(decimalPart);
}
589498
def subtract(self, number1, number2):
        """"""
        return self._format_result(int(number1) - int(number2))
428621
public static function roundTo($number, $increment = 1.0) {
		$precision = static::getDecimalPlaces($increment);
		$res = round($number, $precision);
		if ($precision <= 0) {
			$res = (int)$res;
		}
		return $res;
	}