public function truncate(DecimalNumber $number, $precision)
    {
        $precision = $this->sanitizePrecision($precision);

        if ($number->getPrecision() <= $precision) {
            return $number;
        }

        if (0 === $precision) {
            return new DecimalNumber($number->getSign() . $number->getIntegerPart());
        }

        return new DecimalNumber(
            $number->getSign()
            . $number->getIntegerPart()
            . '.'
            . substr($number->getFractionalPart(), 0, $precision)
        );
    }