Soft check that value <= $max

@param float|int $number
@return $this
@throws InvalidIntOrFloatException
@throws NumberNotLessException
977087
public function less($number)
    {
        if (!is_int($number) && !is_float($number)) {
            throw new InvalidIntOrFloatException('number', $number);
        }

        if (!is_int($this->value) && !is_float($this->value)) {
            throw new InvalidIntOrFloatException($this->name, $this->value);
        } elseif ($this->value > $number) {
            throw new NumberNotLessException($this->name, $this->value, $number);
        }

        return $this;
    }
552208
public function gt($number)
    {
        return (bool) (bccomp($this->number, static::validateInputNumber($number), $this->precision) === 1);
    }
239601
public static function bound($number, $min = 0, $max = PHP_INT_MAX)
    {
        $number = (int)$number;
        $min = (int)$min;
        $max = (int)$max;

        return min(max($number, $min), $max);
    }
57049
protected function validateNumber($number) {
    if (!(is_int($number) || is_string($number) && is_numeric($number))) {
      $type = is_object($number) ? get_class($number) : gettype($number);
      throw new \InvalidArgumentException(sprintf('An integer or numeric string was expected, but %s was given.', $type));
    }
  }
996673
public function setMax($max)
    {
        if (is_numeric($max) || Format::isVariableRef($max)) {
            $this->max = $max;
        } else {
            $msg = "'Max must be a numeric value or a variableRef, '" . gettype($max) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
389644
public ValueNumber forNumber(int number) {
        if (number >= getNumValuesAllocated()) {
            throw new IllegalArgumentException("Value " + number + " has not been allocated");
        }
        return allocatedValueList.get(number);
    }
22577
public function read($number)
    {
        if ($number > $this->last_read_post_number) {
            $this->last_read_post_number = $number;
            $this->last_read_at = Carbon::now();

            $this->raise(new UserRead($this));
        }

        return $this;
    }
430219
public function base10($number)
    {
        if (!is_int($number)) {
            throw new \InvalidArgumentException('Expecting integer');
        }

        if ($this->integerPart === '0' && !$this->fractionalPart) {
            return $this;
        }

        $sign = '';
        $integerPart = $this->integerPart;

        if ($integerPart[0] === '-') {
            $sign = '-';
            $integerPart = substr($integerPart, 1);
        }

        if ($number >= 0) {
            $integerPart = ltrim($integerPart, '0');
            $lengthIntegerPart = strlen($integerPart);
            $integers = $lengthIntegerPart - min($number, $lengthIntegerPart);
            $zeroPad = $number - min($number, $lengthIntegerPart);

            return new self(
                $sign.substr($integerPart, 0, $integers),
                rtrim(str_pad('', $zeroPad, '0').substr($integerPart, $integers).$this->fractionalPart, '0')
            );
        }

        $number = abs($number);
        $lengthFractionalPart = strlen($this->fractionalPart);
        $fractions = $lengthFractionalPart - min($number, $lengthFractionalPart);
        $zeroPad = $number - min($number, $lengthFractionalPart);

        return new self(
            $sign.ltrim($integerPart.substr($this->fractionalPart, 0, $lengthFractionalPart - $fractions).str_pad('', $zeroPad, '0'), '0'),
            substr($this->fractionalPart, $lengthFractionalPart - $fractions)
        );
    }
19566
public static function INT($number)
    {
        $number    = PHPExcel_Calculation_Functions::flattenSingleValue($number);

        if (is_null($number)) {
            return 0;
        } elseif (is_bool($number)) {
            return (int) $number;
        }
        if (is_numeric($number)) {
            return (int) floor($number);
        }
        return PHPExcel_Calculation_Functions::VALUE();
    }
384664
private static function prepareFloat($number): float
	{
		if ($number === null) {
			return 0;
		} elseif (is_numeric($number)) {
			return (float) $number;
		} else {
			throw new InvalidArgumentException("Value must be a number");
		}
	}
1279483
public function setAmountMax(float $amountMax): self
    {
        $this->amountMax = (int) ($amountMax * self::FACTOR_AMOUNT_MAX);
        return $this;
    }
68614
public function setMax($max)
    {
        $max = (int) $max;

        if ($max < 0) {
            throw new \InvalidArgumentException('Error: Maximum cannot be smaller than zero');
        }
        if ($max < $this->min) {
            // We do not throw an exception but silently adjust the minimum.
            $this->min = $max;
        }

        $this->max = $max;
    }
438562
public function divide($number = null)
    {
        if ($number === null) {
            $this->internalSetOperationModeWithHistory('divide');
        } elseif ($number instanceof Closure) {
            $this->internalSetOperationModeWithHistory('divide');
            return $this->group($number);
        } else {
            $this->performOperationOnExpressionEngine('divide', $number);
        }

        return $this;
    }
705925
public function Compare( $number, $scale = false )
	{
		if ( ! is_numeric( $number ) )
		{
			if ( ! $number instanceof DecimalValue && ! $number instanceof Integer )
			{
				return false;
			}

			$number = $number->getValue();
		}

		if ( $scale === false )
		{
			$scale = max( $this->getScale(), $this->scale( $number ) );
		}

		return bccomp( $this->_value, $number, $scale );
	}
959961
public function setPatch($number)
    {
        if (!Validator::isNumber($number)) {
            throw new InvalidNumberException($number);
        }

        $this->patch = intval($number);

        return $this;
    }
1151945
public function setAmount($amount)
    {
        if ($amount === null) {
            $this->amount = 0;
            return $this;
        }
        
        if (!is_int($amount)) {
            throw new InvalidArgumentException(sprintf(
                'Amount must be an integer, "%s" given',
                is_object($amount) ? get_class($amount) : gettype($amount)
            ));
        }
        
        // Overflow check is not necessary because we have an integer
        $this->amount = $amount;
        return $this;
    }
806804
public function setMax($max)
    {
        if ($max <= 0) {
            throw new InvalidArgumentException(sprintf('Supplied max value: %d must be greater than 0', $max));
        }
        $this->max = $max;
        return $this;
    }