Returns the negated value of this number.

@return BigDecimal
163748
public function negated() : BigDecimal
    {
        return new BigDecimal(Calculator::get()->neg($this->value), $this->scale);
    }
934761
public function isNumeric()
    {
        return in_array($this->type, [
            PropelTypes::NUMERIC,
            PropelTypes::DECIMAL,
            PropelTypes::TINYINT,
            PropelTypes::SMALLINT,
            PropelTypes::INTEGER,
            PropelTypes::BIGINT,
            PropelTypes::REAL,
            PropelTypes::FLOAT,
            PropelTypes::DOUBLE,
        ]);
    }
1147516
public function negate() : self
    {
        $b = [];

        foreach ($this->a as $value) {
            $b[] = -$value;
        }

        return static::quick($b);
    }
837820
public Object negate(Object val) {
    if (val instanceof Integer) {
      int valueAsInt = ((Integer) val).intValue();
      return Integer.valueOf(-valueAsInt);
    }
    else if (val instanceof Double) {
      double valueAsDouble = ((Double) val).doubleValue();
      return new Double(-valueAsDouble);
    }
    else if (val instanceof Long) {
      long valueAsLong = -((Long) val).longValue();
      return Long.valueOf(valueAsLong);
    }
    else if (val instanceof BigDecimal) {
      BigDecimal valueAsBigD = (BigDecimal) val;
      return valueAsBigD.negate();
    }
    else if (val instanceof BigInteger) {
      BigInteger valueAsBigI = (BigInteger) val;
      return valueAsBigI.negate();
    }
    else if (val instanceof Float) {
      float valueAsFloat = ((Float) val).floatValue();
      return new Float(-valueAsFloat);
    }
    else if (val instanceof Short) {
      short valueAsShort = ((Short) val).shortValue();
      return Short.valueOf((short) -valueAsShort);
    }
    else if (val instanceof Byte) {
      byte valueAsByte = ((Byte) val).byteValue();
      return Byte.valueOf((byte) -valueAsByte);
    }
    else if (val instanceof Boolean) {
      return ((Boolean) val).booleanValue() ? Boolean.FALSE : Boolean.TRUE;
    }
    throw new ArithmeticException("Object negation:(" + val + ")");
  }
102155
public function bitwiseNot()
    {
        // calculuate "not" without regard to $this->precision
        // (will always result in a smaller number. ie. ~1 isn't 1111 1110 - it's 0)
        $temp = $this->toBytes();
        $pre_msb = decbin(ord($temp[0]));
        $temp = ~ $temp;
        $msb = decbin(ord($temp[0]));
        if (strlen($msb) == 8) {
            $msb = substr($msb, strpos($msb, '0'));
        }
        $temp[0] = chr(bindec($msb));

        // see if we need to add extra leading 1's
        $current_bits = strlen($pre_msb) + 8 * strlen($temp) - 8;
        $new_bits = $this->precision - $current_bits;
        if ($new_bits <= 0) {
            return $this->protectedNormalize(new BigInteger($temp, 256));
        }

        // generate as many leading 1's as we need to.
        $leading_ones = chr((1 << ($new_bits & 0x7)) - 1) . str_repeat(chr(0xFF), $new_bits >> 3);
        $this->protectedBase256LShift($leading_ones, $current_bits);

        $temp = str_pad($temp, ceil($this->bits / 8), chr(0), STR_PAD_LEFT);

        return $this->protectedNormalize(new BigInteger($leading_ones | $temp, 256));
    }
824540
public function getMaxValue()
    {
        if (!$this->isNumeric()) {
            return null;
        }
        $dataType = $this->getEloquentDataMethod();
		$max = 2147483647;

        if ($this->isDecimal()) {
            $length = $this->getMethodParam(0) ?: 1;
            $declimal = $this->getMethodParam(1) ?: 0;
            $max = str_repeat('9', $length);

            if ($declimal > 0) {
                $max = substr_replace($max, '.', $declimal * -1, 0);
            }
            $max = floatval($max);
        } elseif ($dataType == 'integer' || $dataType == 'increments') {
            $max = $this->isUnsigned ? 4294967295 : 2147483647;
        } elseif ($dataType == 'mediumInteger' || $dataType == 'mediumIncrements') {
            $max = $this->isUnsigned ? 16777215 : 8388607;
        } elseif ($dataType == 'smallInteger' || $dataType == 'smallIncrements') {
            $max = $this->isUnsigned ? 65535 : 32767;
        } elseif ($dataType == 'tinyInteger' || $dataType == 'tinyIncrements') {
            $max = $this->isUnsigned ? 255 : 127;
        } elseif ($dataType == 'bigInteger' || $dataType == 'bigIncrements') {
            $max = $this->isUnsigned ? 18446744073709551615 : 9223372036854775807;
        }

        return $max;
    }
390239
public function decodeMpint()
    {
        $s = $this->decodeString();
        if ($s === null) {
            return null;
        }

        if ($s === '') {
            return gmp_init(0);
        }

        $n = gmp_init(bin2hex($s), 16);

        // Negative numbers: decode using two-complement.
        if (ord($s[0]) & 0x80) {
            // gmp_com() uses the number's size to compute
            // the complement, which is right in our case.
            $n = gmp_neg(gmp_add(gmp_com($n), "1"));
        }
        return $n;
    }
479368
public function negative()
    {
        if (!is_int($this->value) && !is_float($this->value)) {
            throw new InvalidIntOrFloatException($this->name, $this->value);
        } elseif ($this->value >= 0) {
            throw new NumberNotNegativeException($this->name, $this->value);
        }

        return $this;
    }
1064490
public Optional<BigDecimal> getMin() {
        if (property instanceof BaseIntegerProperty) {
            BaseIntegerProperty integerProperty = (BaseIntegerProperty) property;
            return Optional.ofNullable(integerProperty.getMinimum() != null ? integerProperty.getMinimum() : null);
        } else if (property instanceof AbstractNumericProperty) {
            AbstractNumericProperty numericProperty = (AbstractNumericProperty) property;
            return Optional.ofNullable(numericProperty.getMinimum());
        }
        return Optional.empty();
    }
707388
public function negate()
	{
		if ( $this->test() )
		{
			if ( class_exists('\\Imagick') )
			{
				if ( !$this->img->negateImage(false) ){
					$this->error = \defined('BBN_THERE_HAS_BEEN_A_PROBLEM') ?
						BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem';
				}
			}
			else if ( function_exists('imagefilter') )
			{
				if ( !imagefilter($this->img,IMG_FILTER_NEGATE) ){
					$this->error = \defined('BBN_THERE_HAS_BEEN_A_PROBLEM') ?
						BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem';
				}
			}
		}
		return $this;
	}
1181723
public function getFloatValue()
    {
        list($quotient, $remainder) = $this->big_integer->divide(self::precisionUnitsAsBigInt(1, $this->precision));
        return floatval($quotient->toString()) + floatval($remainder->toString() / pow(10, $this->precision));
    }
891918
public function getValueOld()
	{
		return $this->_value;

		switch ( $this->_xmlType->TypeCode )
		{
			case XmlTypeCode::String:

				return $this->_value;

			case XmlTypeCode::Double:

				if ( is_infinite( $this->_value ) )
				{
					return $this->_value > 0 ? INF : -INF;
				}

				// Can't do this because some conformance suite tests fail
				// as they expect a specifically formatted number.
				if ( ! is_string( $this->_value ) )
				{
					return $this->_value;
				}

				$maxDigits = 17;
				if ( preg_match( DecimalValue::Pattern, $this->_value, $matches ) )
				{
					if ( ! isset( $matches['exponent'] ) )
					{
						$maxDigits = min( @strlen( $matches['digits'] ) + @strlen( $matches['decimals'] ), $maxDigits );
					}
				}

				return str_replace( "+", "", sprintf( "%.{$maxDigits}G", $this->_value ) );

			case XmlTypeCode::Float:

				if ( is_infinite( $this->_value ) )
				{
					return $this->_value > 0 ? INF : -INF;
				}

				$maxDigits = 8;
				if ( preg_match( DecimalValue::Pattern, $this->_value, $matches ) )
				{
					// if ( isset( $matches['exponent'] ) )
					// {
					// 	return str_replace( "+", "", $this->_value );
					// }
					$maxDigits = min( @strlen( $matches['digits'] ) + @strlen( $matches['decimals'] ), $maxDigits );
				}

				return str_replace( "+", "", sprintf( "%.{$maxDigits}G", $this->_value ) );

		}

		return XPath2Convert::ToString( $this->_value );
	}
646476
public function positive()
    {
        if (!is_int($this->value) && !is_float($this->value)) {
            throw new InvalidIntOrFloatException($this->name, $this->value);
        } elseif ($this->value <= 0) {
            throw new NumberNotPositiveException($this->name, $this->value);
        }

        return $this;
    }
1361665
public double doubleValue() {
        /* To meet the risk of individual overflows of the exponents of
         * a separate invocation a.doubleValue() or b.doubleValue(), we divide first
         * in a BigDecimal environment and converst the result.
         */
        BigDecimal adivb = (new BigDecimal(a)).divide(new BigDecimal(b), MathContext.DECIMAL128);
        return adivb.doubleValue();
    }
1182227
public function getDepth(){

        if($this->depth === NULL){

            if($this->isRootNode()){
                $this->depth = -1;
            }
            else{
                $parents = [$this];
                $node = $this;
                while($parent = $node->parentNode()){
                    if(!$parent->isRootNode()){
                        $parents[] = $parent;
                    }
                    $node = $parent;
                }
                $this->depth = count($parents);
            }
        }

        return $this->depth;
    }
152928
public function getIntegerPart()
    {
        if ('0' === $this->coefficient) {
            return $this->coefficient;
        }

        if (0 === $this->exponent) {
            return $this->coefficient;
        }

        if ($this->exponent >= strlen($this->coefficient)) {
            return '0';
        }

        return substr($this->coefficient, 0, -$this->exponent);
    }
17651
public function l1Norm(): float
    {
        return array_reduce($this->toArray(), function (float $carry, float $value) {
            return $carry + abs($value);
        }, 0);
    }