src/Number/Rational.php
private function multiplyRational(Rational $r): Rational
    {
        $w = $this->whole;
        $n = $this->numerator;
        $d = $this->denominator;

        $w2 = $r->whole;
        $n2 = $r->numerator;
        $d2 = $r->denominator;

        $new_w = $w * $w2;
        $new_n = $w * $n2 * $d + $w2 * $n * $d2 + $n2 * $n;
        $new_d = $d * $d2;

        return new Rational($new_w, $new_n, $new_d);
    }
private function multiplyRational(Rational $r): Rational
    {
        $w = $this->whole;
        $n = $this->numerator;
        $d = $this->denominator;

        $w2 = $r->whole;
        $n2 = $r->numerator;
        $d2 = $r->denominator;

        $new_w = $w * $w2;
        $new_n = $w * $n2 * $d + $w2 * $n * $d2 + $n2 * $n;
        $new_d = $d * $d2;

        return new Rational($new_w, $new_n, $new_d);
    }
private function multiplyRational ( Rational $ r ) : Rational { $ w = $ this -> whole ; $ n = $ this -> numerator ; $ d = $ this -> denominator ; $ w2 = $ r -> whole ; $ n2 = $ r -> numerator ; $ d2 = $ r -> denominator ; $ new_w = $ w * $ w2 ; $ new_n = $ w * $ n2 * $ d + $ w2 * $ n * $ d2 + $ n2 * $ n ; $ new_d = $ d * $ d2 ; return new Rational ( $ new_w , $ new_n , $ new_d ) ; }
Multiply a rational number

@param Rational $r

@return Rational
Multiply a rational number