public function clip(float $min, float $max) : self
    {
        if ($min > $max) {
            throw new InvalidArgumentException('Minimum cannot be'
                . ' greater than maximum.');
        }

        $b = [];

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

                continue 1;
            }

            if ($value < $min) {
                $b[] = $min;

                continue 1;
            }

            $b[] = $value;
        }

        return static::quick($b);
    }
public function clip(float $min, float $max) : self
    {
        if ($min > $max) {
            throw new InvalidArgumentException('Minimum cannot be'
                . ' greater than maximum.');
        }

        $b = [];

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

                continue 1;
            }

            if ($value < $min) {
                $b[] = $min;

                continue 1;
            }

            $b[] = $value;
        }

        return static::quick($b);
    }
public function clip ( float $ min , float $ max ) : self { if ( $ min > $ max ) { throw new InvalidArgumentException ( 'Minimum cannot be' . ' greater than maximum.' ) ; } $ b = [ ] ; foreach ( $ this -> a as $ value ) { if ( $ value > $ max ) { $ b [ ] = $ max ; continue 1 ; } if ( $ value < $ min ) { $ b [ ] = $ min ; continue 1 ; } $ b [ ] = $ value ; } return static :: quick ( $ b ) ; }
Clip the elements in the vector to be between given minimum and maximum
and return a new vector.

@param float $min
@param float $max
@throws \InvalidArgumentException
@return self
Clip the elements in the vector to be between given minimum and maximum and return a new vector .