public function setScale($scale)
    {
        if (!$this->isMutable()) {
            throw new RuntimeException(sprintf(
                'Cannot set the scale to "%s" since the numbere is immutable.',
                $scale
            ));
        }

        // Convert to a string to make sure that the __toString method is called for objects.
        $scaleValue = (string)$scale;
        if (!ctype_digit($scaleValue)) {
            throw new InvalidArgumentException(sprintf(
                'Cannot set the scale to "%s". Invalid value.',
                $scaleValue
            ));
        }

        $this->scale = (int)$scaleValue;

        return $this;
    }