/** * This method returns the greatest common divisor. * * @access public * @static * @param IInt32\Type $x the left operand * @param IInt32\Type $y the right operand * @return IInt32\Type the result */ public static function gcd(IInt32\Type $x, IInt32\Type $y) : IInt32\Type { return $y->unbox() == 0 ? $x : IInt32\Module::gcd($y, IInt32\Module::modulo($x, $y)); }
/** * This method tests the "modulo" method. * * @dataProvider data_modulo */ public function test_modulo(array $provided, array $expected) { $p0 = IInt32\Module::modulo(IInt32\Type::box($provided[0]), IInt32\Type::box($provided[1])); $e0 = $expected[0]; $this->assertInstanceOf('\\Saber\\Data\\IInt32\\Type', $p0); $this->assertEquals($e0, $p0->unbox()); }